Commit 3bda78df authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

bugs in create steps

parent 74026502
......@@ -8,8 +8,13 @@
$ct = 0;
$subFormIds = [];
foreach ($forms as $fix => $f) {
if(isset($f["ids"]))
$subFormIds = array_merge( $subFormIds, $f["ids"] );
if(isset($f["ids"])){
foreach ($f["ids"] as $ix => $sfid) {
if(!in_array($sfid , $subFormIds))
$subFormIds[] = $sfid;
}
}
if($ct == 0)
echo '<div class="row ">';
?>
......@@ -20,27 +25,42 @@ foreach ($forms as $fix => $f) {
<span class="col-xs-2">
<a href="javascript:;" class="editFormBtn" data-id="<?php echo $fix ?>"><i class="fa fa-pencil text-dark"></i></a>
<a href="javascript:;" class="deleteFormBtn" data-id="<?php echo $fix ?>"><i class="fa fa-trash text-red"></i></a> </span></h4>
<?php
echo $fix.'<br/>';
$activStr = "<span class='label label-danger'><i class='fa fa-thumbs-o-down'></i> Pas activé</span>";
if(isset($f['active']) && $f['active'] == true)
$activStr = "<span class='label label-success'><i class='fa fa-thumbs-o-up'></i> Activé</span>"; ; ?>
if( isset($f['active']) && $f['active'] == true )
$activStr = "<span class='label label-success'><i class='fa fa-thumbs-o-up'></i> Activé</span>"; ?>
active : <?php echo $activStr ?><br/>
steps : <br/>
<?php
if(isset($f['ids'])){
foreach ( $f["ids"] as $ix => $i ) {
echo '<i class="fa fa-file-text-o"></i> '.$f[$i]['name']."<br/>";
}
}?>
<a href='javascript:;' data-id='<?php echo $fix ?>' class="showAnswersBtn btn btn-xs btn-default col-sm-4 col-sm-12 bold">
<i class='fa fa-comments'></i>(<?php echo $f["answers"]; ?>) <?php echo (isset($f['what'])) ? $f['what'] : "RÉPONSES" ?>
</a>
<a href='javascript:;' data-id='<?php echo $fix ?>' class="configBtn btn btn-xs btn-danger col-sm-4 col-sm-12 bold">
<i class='fa fa-cogs'></i> CONFIG
</a>
<a target='_blank' href='costum/co/index/slug/<?php echo $el["slug"] ?>#answer.index.id.new.form.<?php echo $fix ?>' class="btn btn-xs btn-primary col-sm-4 col-xs-12 bold">
<i class='fa fa-file-text-o'></i> RÉPONDRE
</a>
<?php if( isset( $f['active'] ) && $f['active'] == true ) { ?>
<a target='_blank' href='costum/co/index/slug/<?php echo $el["slug"] ?>#answer.index.id.new.form.<?php echo $fix ?>' class="btn btn-xs btn-primary col-sm-4 col-xs-12 bold">
<i class='fa fa-file-text-o'></i> RÉPONDRE
</a>
<?php } else { ?>
<a target='_blank' href='costum/co/index/slug/<?php echo $el["slug"] ?>#answer.index.id.new.form.<?php echo $fix ?>' class="btn btn-xs btn-primary col-sm-4 col-xs-12 bold">
<i class='fa fa-pencil'></i> CONSTRUIRE
</a>
<?php } ?>
</div>
</div>
......@@ -76,7 +96,7 @@ jQuery(document).ready(function() {
});
$('.editFormBtn').off().click( function(){
tplCtx.id = $(this).data("id");
dyFObj.openForm( oformParams, null, formsData[$(this).data("id")] )
dyFObj.openForm( oform , null, formsData[$(this).data("id")] )
});
$('.deleteFormBtn').off().click( function(){
tplCtx.id = $(this).data("id");
......@@ -241,9 +261,11 @@ var oformParams = {
else if(val.inputType == "array"){
tplCtx.value[k] = getArray('.'+k+val.inputType);
if(k=="ids"){
var cx = subForms.length;
$.each(tplCtx.value[k],function(ix,fName) {
if(!$.inArray(fName, subForms) == -1 ){
var newFormId = "<?php echo $el["slug"] ?>"+subForms.length;
mylog.log("check sub Form",fName, "<?php echo $el["slug"] ?>"+cx);
if($.inArray(fName, subForms) < 0 ){
var newFormId = "<?php echo $el["slug"] ?>"+cx;
tplCtx.value[k][ix] = newFormId;
var newForm ={
collection : "forms",
......@@ -254,8 +276,11 @@ var oformParams = {
inputs : {}
}
};
dataHelper.path2Value( newForm, function() { } );
countSubForms++;
dataHelper.path2Value( newForm, function() {
mylog.log("created new sub Form",newFormId);
} );
cx++;
}
})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment