Commit 2ad45130 authored by Clément Damiens's avatar Clément Damiens
Browse files

Merge remote-tracking branch 'origin/development' into development

parents 7fc7828f 3179ae6b
......@@ -13,7 +13,7 @@ if( Form::canFormAccess( ['roles'=>["Financeur","Opérateur"] ]))
<tbody class="directoryLines">
<tr>
<td colspan='2' ><h3 style="color:#16A9B1">Intention Opérateur</h3></td>
<td colspan='2' ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>">Intention Opérateur</h4></td>
</tr>
<?php
$str = "";
......
......@@ -3,6 +3,9 @@
if( isset($this->costum["form"]["params"][$kunik]["budgetCopy"]) )
$copy = $this->costum["form"]["params"][$kunik]["budgetCopy"];
else if( count(Yii::app()->session["budgetInputList"]) == 1 )
$copy = array_keys( Yii::app()->session["budgetInputList"])[0];
//var_dump($copy);
$copyT = explode(".", $copy);
$copyF = $copyT[0];
......@@ -287,6 +290,8 @@ if( isset($this->costum["form"]["params"]["financement"]["tpl"])){
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
//costum.lists.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.workerList = <?php echo json_encode($orgs); ?>;
......
......@@ -312,9 +312,6 @@ $(document).ready(function() {
tplCtx.id = $(this).data("id");
tplCtx.collection = $(this).data("collection");
tplCtx.path = $(this).data("path");
//if no params config on the element.costum.form.params.<?php echo $kunik ?>
//then we load default values available in forms.inputs.<?php echo $kunik ?>xxx.params
//mylog.log(".editParams",sectionDyf.<?php echo $kunik ?>Params,calData);
dyFObj.openForm( sectionDyf.<?php echo $kunik ?>Params,null, sectionDyf.<?php echo $kunik ?>ParamsData);
});
......
......@@ -4,6 +4,8 @@ $copy = "opalProcess1.depense";
if( isset($this->costum["form"]["params"][$kunik]["budgetCopy"]) )
$copy = $this->costum["form"]["params"][$kunik]["budgetCopy"];
else if( count(Yii::app()->session["budgetInputList"]) == 1 )
$copy = array_keys( Yii::app()->session["budgetInputList"])[0];
//var_dump($copy);
$copyT = explode(".", $copy);
$copyF = $copyT[0];
......@@ -112,7 +114,7 @@ foreach ( $amounts as $k => $l) {
<tr>
<td colspan='<?php echo count( $properties)+2?>' ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn.$editParamsBtn.$editBtnL?></h4>
<?php echo $info;
if( !isset($this->costum["form"]["params"][$kunik]["budgetCopy"]) )
if( !isset($budgetKey) )
echo "<br/><span class='text-red text-center'><i class='fa fa-warning fa-2x'></i> THIS FIELD HAS TO BE CONFIGURED FIRST ".$editParamsBtn."</span>";?>
</td>
</tr>
......@@ -403,6 +405,8 @@ if( isset($this->costum["form"]["params"]["financement"]["tpl"])){
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
costum.lists.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.financersList = <?php echo json_encode($orgs); ?>;
......
<?php
if( $canEdit )
if( Form::canFormAccess( ['roles'=>["Financeur"] ]) )
{
if( isset($form['id']) )
{ ?>
{
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [
"limitRoles" =>["Financeur"]
];
if( isset($this->costum["form"]["params"][$kunik]) ) {
if( isset($this->costum["form"]["params"][$kunik]["limitRoles"]) )
$paramsData["financersList"] = $this->costum["form"]["params"][$kunik]["limitRoles"];
}
?>
<div id="copyEquilibreBudgetaire"></div>
......@@ -10,7 +22,7 @@ if( $canEdit )
<tbody class="directoryLines">
<tr>
<td colspan='2' ><h3 style="color:#16A9B1">Validation</h3>
<td colspan='2' ><43 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>">Validation</h4>
</td>
</tr>
<?php
......@@ -88,94 +100,145 @@ if( $canEdit )
<script type="text/javascript">
sectionDyf.<?php echo $kunik ?>ParamsData = <?php echo json_encode( $paramsData ); ?>;
$(document).ready(function() {
mylog.log("render","/modules/costum/views/tpls/forms/cplx/stepValidation.php");
documentManager.bindEvents();
sectionDyf.<?php echo $kunik ?>Params = {
"jsonSchema" : {
"title" : "<?php echo $kunik ?> config",
"icon" : "fa-cog",
"properties" : {
limitRoles : {
inputType : "array",
label : "Liste des roles qui pourront valider cette étape",
values : sectionDyf.<?php echo $kunik ?>ParamsData.limitRoles
}
},
save : function () {
tplCtx.value = {};
$.each( sectionDyf.<?php echo $kunik ?>Params.jsonSchema.properties , function(k,val) {
if(val.inputType == "array")
tplCtx.value[k] = getArray('.'+k+val.inputType);
else if(val.inputType == "properties")
tplCtx.value[k] = getPairsObj('.'+k+val.inputType);
else
tplCtx.value[k] = $("#"+k).val();
});
mylog.log("save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined")
toastr.error('value cannot be empty!');
else {
dataHelper.path2Value( tplCtx, function(params) {
$("#ajax-modal").html("<div class='text-center'><i class='fa fa-spin fa-spinner'></i></div>");
location.reload();
} );
}
}
}
};
$(".edit<?php echo $kunik ?>Params").off().on("click",function() {
tplCtx.id = $(this).data("id");
tplCtx.collection = $(this).data("collection");
tplCtx.path = $(this).data("path");
//if no params config on the element.costum.form.params.<?php echo $kunik ?>
//then we load default values available in forms.inputs.<?php echo $kunik ?>xxx.params
//mylog.log(".editParams",sectionDyf.<?php echo $kunik ?>Params,calData);
dyFObj.openForm( sectionDyf.<?php echo $kunik ?>Params,null, sectionDyf.<?php echo $kunik ?>ParamsData);
});
//documentManager.bindEvents();
typeObj.validation<?php echo $form['id'] ?> = {
jsonSchema : {
title : "Validation",
icon : "gavel",
onLoads : {
sub : function(){
dyFInputs.setSub("bg-red");
},
},
save : function() {
var formData = $("#ajaxFormModal").serializeFormJSON();
var today = new Date();
today = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear();
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "validation."+formData.form,
value : {
//who : formData.who,
valid : formData.valid,
description : formData.description,
date : today ,
user : userId
}
};
mylog.log("validation save",ctxTpl);
dataHelper.path2Value( ctxTpl, function(params) {
dyFObj.closeForm();
//only increment step form to next step if step valid
if( ctxTpl.value.valid == "valid" || ctxTpl.value.valid == "validReserve" ){
step = 0;
if(costum.form.ids.length == $.inArray( "<?php echo $form['id'] ?>", costum.form.ids )+1)
step = "all";
else
step = costum.form.ids[$.inArray( "<?php echo $form['id'] ?>", costum.form.ids )+1];
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "step",
value : step
};
mylog.log("save step save",ctxTpl);
dataHelper.path2Value( ctxTpl, function(params) {
location.reload();
} );
} else
location.reload();
} );
},
properties : {
info : {
inputType : "custom",
html:"<p></p>",
},
valid : {
"label" : "Valider",
"inputType" : "select",
"placeholder" : "---- Selectionner Valider ----",
"options" : {
"notValid":"Non validé",
"validReserve" : "Validé avec réserves",
"valid" : "Validé sans réserve"
}
},
description : dyFInputs.textarea( tradDynForm["description"], "..." ),
// date : {
// inputType : "date",
// label : "Date",
// placeholder : "Date de Validation",
// rules : {
// required : true,
// greaterThanNow : ["DD/MM/YYYY"]
// }
// },
form : dyFInputs.inputHidden()
}
}
};
jsonSchema : {
title : "Validation",
icon : "gavel",
onLoads : {
sub : function(){
dyFInputs.setSub("bg-red");
},
},
save : function() {
var formData = $("#ajaxFormModal").serializeFormJSON();
var today = new Date();
today = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear();
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "validation."+formData.form,
value : {
//who : formData.who,
valid : formData.valid,
description : formData.description,
date : today ,
user : userId
}
};
mylog.log("validation save",ctxTpl);
dataHelper.path2Value( ctxTpl, function(params) {
dyFObj.closeForm();
//only increment step form to next step if step valid
if( ctxTpl.value.valid == "valid" || ctxTpl.value.valid == "validReserve" ){
step = 0;
if(costum.form.ids.length == $.inArray( "<?php echo $form['id'] ?>", costum.form.ids )+1)
step = "all";
else
step = costum.form.ids[$.inArray( "<?php echo $form['id'] ?>", costum.form.ids )+1];
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
collection : "answers",
path : "step",
value : step
};
mylog.log("save step save",ctxTpl);
dataHelper.path2Value( ctxTpl, function(params) {
location.reload();
} );
} else
location.reload();
} );
},
properties : {
info : {
inputType : "custom",
html:"<p></p>",
},
valid : {
"label" : "Valider",
"inputType" : "select",
"placeholder" : "---- Selectionner Valider ----",
"options" : {
"notValid":"Non validé",
"validReserve" : "Validé avec réserves",
"valid" : "Validé sans réserve"
}
},
description : dyFInputs.textarea( tradDynForm["description"], "..." ),
// date : {
// inputType : "date",
// label : "Date",
// placeholder : "Date de Validation",
// rules : {
// required : true,
// greaterThanNow : ["DD/MM/YYYY"]
// }
// },
form : dyFInputs.inputHidden()
}
}
};
$('.validEdit').off().on("click", function() {
var setVal = { form : $(this).data("type")};
dyFObj.openForm( typeObj[ 'validation'+setVal.form ], null, setVal );
......
......@@ -24,6 +24,8 @@ if($answer){
$copy = "opalProcess1.depense";
if( isset($this->costum["form"]["params"][$kunik]["budgetCopy"]) )
$copy = $this->costum["form"]["params"][$kunik]["budgetCopy"];
else if( count(Yii::app()->session["budgetInputList"]) == 1 )
$copy = array_keys( Yii::app()->session["budgetInputList"])[0];
//var_dump($copy);
$copyT = explode(".", $copy);
$copyF = $copyT[0];
......@@ -539,6 +541,9 @@ if( isset($this->costum["form"]["params"]["financement"]["tpl"])){
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
//costum.lists.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.workerList = <?php echo json_encode($orgs); ?>;
......
......@@ -96,7 +96,7 @@ if( isset( $form["inputs"] ) ){ ?>
"answer" => $answer,
"answers" => $answers ,//sub answers for this input
"label" => $input["label"] ,//$ct." - ".$input["label"] ,
"titleColor"=> "#16A9B1",
"titleColor"=> (isset($this->costum["colors"]["pink"])) ? $this->costum["colors"]["pink"] : "#16A9B1",
"info" => isset($input["info"]) ? $input["info"] : "" ,
"placeholder" => isset($input["placeholder"]) ? $input["placeholder"] : "" ,
"form" => $form,
......
......@@ -25,17 +25,17 @@ if( isset($this->costum["tpls"][$keyTpl]) ) {
<style type="text/css">
.swMain ul li > a.done .stepNumber {
border-color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
background-color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
border-color: <?php echo ( @$color2 ) ? $color2 : $defaultColor ?>;
background-color: <?php echo ( @$color2 ) ? $color2 : $defaultColor ?>;
}
swMain > ul li > a.selected .stepDesc, .swMain li > a.done .stepDesc {
color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
color: <?php echo ( @$color2 ) ? $color2 : $defaultColor ?>;
font-weight: bolder;
}
.swMain > ul li > a.selected::before, .swMain li > a.done::before{
border-color: <?php echo ( @$color1 ) ? $color1 : $defaultColor ?>;
border-color: <?php echo ( @$color2 ) ? $color2 : $defaultColor ?>;
}
</style>
......
Markdown is supported
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