Commit c0ad3528 authored by Tibor Katelbach's avatar Tibor Katelbach

action budgets

parent 2b7f5a92
......@@ -74,7 +74,7 @@ $properties = [
];
}
if($debug)var_dump($answers);
var_dump($paramsData);
if($debug)var_dump($paramsData);
?>
<?php
......
......@@ -22,7 +22,7 @@ pour chaque ligne de dépense , on peut
if($answer){
$copy = "opalProcess1.depense";
if( isset($parentForm["params"][$kunik]["budgetCopy"]) )
if( !empty($parentForm["params"][$kunik]["budgetCopy"]) )
$copy = $parentForm["params"][$kunik]["budgetCopy"];
else if( count(Yii::app()->session["budgetInputList"]) == 1 )
$copy = array_keys( Yii::app()->session["budgetInputList"])[0];
......@@ -57,14 +57,14 @@ $paramsData = [
];
if( isset($parentForm["params"][$kunik]["tpl"]) )
if( !empty($parentForm["params"][$kunik]["tpl"]) )
$paramsData["tpl"] = $parentForm["params"][$kunik]["tpl"];
if( isset($parentForm["params"][$kunik]["budgetCopy"]) )
if( !empty($parentForm["params"][$kunik]["budgetCopy"]) )
$paramsData["budgetCopy"] = $parentForm["params"][$kunik]["budgetCopy"];
if( isset($parentForm["params"][$kunik]["limitRoles"]) )
$paramsData["limitRoles"] = $parentForm["params"][$kunik]["limitRoles"];
if( isset($parentForm["params"][$kunik]["budgetCopy"]) )
$paramsData["budgetCopy"] = $parentForm["params"][$kunik]["budgetCopy"];
if( isset($parentForm["params"][$kunik]["useActions"]) )
$paramsData["useActions"] = $parentForm["params"][$kunik]["useActions"];
$communityLinks = Element::getCommunityByParentTypeAndId( $parentForm["parent"] );
$organizations = Link::groupFindByType( Organization::COLLECTION,$communityLinks,["name","links"] );
......@@ -312,6 +312,7 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<script type="text/javascript">
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
......@@ -373,6 +374,19 @@ $(document).ready(function() {
label : "Input Bugdet",
inputType : "select",
options : dyFObj.elementObjParams.budgetInputList
},
useActions : {
inputType : "checkboxSimple",
label : "Generer des actions de communecter ",
subLabel : "Permet d'utiliser le DDA et OCECO pour suivre et comptabiliser l'avancement",
params : {
onText : "Oui",
offText : "Non",
onLabel : "Oui",
offLabel : "Non",
labelText : "Generer des actions de communecter"
},
checked : sectionDyf.<?php echo $kunik ?>ParamsData.useActions
}
},
save : function () {
......@@ -384,7 +398,7 @@ $(document).ready(function() {
tplCtx.value[k] = getPairsObj('.'+k+val.inputType);
else
tplCtx.value[k] = $("#"+k).val();
});
});
mylog.log("save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined")
......@@ -677,14 +691,14 @@ $(document).ready(function() {
prioModal.css({'background-color': '#000'} );
$(".bootbox #add-todo-item").off().on('click', function(e){
e.preventDefault();
listObj.addTodoItem()
listObj.addItem()
});
$(".bootbox #new-todo-item, .bootbox #new-todo-item-when,.bootbox #new-todo-item-who,.bootbox #new-todo-item-price ").off().on('keypress', function(e){
var keycode;
if (window.event) {keycode = window.event.keyCode;e=event;}
else if (e){ keycode = e.which;}
if( keycode=="13" )
listObj.addTodoItem();
listObj.addItem();
});
......@@ -693,12 +707,45 @@ $(document).ready(function() {
todoPath = "answerObj.answers."+tplCtx.form+".";
todoPath += tplCtx.budgetpath+"["+tplCtx.pos+"].todo";
mylog.log("build todos path ",todoPath);
if( notNull(todoPath ) )
if( notNull( todoPath ) )
{
var todos = eval( todoPath );
mylog.log("build todos",todos);
$.each(todos, function(ix,todo) {
listObj.buildTodo(todo, ix );
if(sectionDyf.<?php echo $kunik ?>ParamsData.useActions!="true"){
listObj.data = eval( todoPath );
} else {
<?php
$actions = PHDB::find(Actions::COLLECTION);
$list = [];
$ct = 0;
foreach ($actions as $id => $a) {
if( !empty($a['name']) && isset($a['idUserAuthor']) && $ct <= 10 ){
$ct++;
$item = [
"id" => $id,
"what" => $a['name'],
"uid" => $a['idUserAuthor'],
"created" => $a['created'],
"who" => [],
"price" => "300"
];
if(isset($a['startDate']))
$item['when'] = $a['startDate'];
if(isset($a['links']['contributors'])){
$links = Link::groupFindByType( Person::COLLECTION,$a["links"]['contributors'],["name",'username'] );
foreach ($links as $i => $u) {
$item['who'][] = $u['name'];
}
}
$list[] = $item;
$ct++;
}
}
?>
listObj.data = <?php echo json_encode( $list ); ?>;
}
mylog.log("build actions",listObj.data);
$.each(listObj.data, function(ix,todo) {
listObj.buildList(todo, ix );
})
}
......@@ -717,7 +764,8 @@ function closePrioModalRel (){
urlCtrl.loadByHash(location.hash);
}
var listObj = {
addTodoItem : function () {
data : null,
addItem : function () {
var today = new Date();
today = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear();
......@@ -736,9 +784,9 @@ var listObj = {
if($(".bootbox #new-todo-item-who").val())
todo.who = $(".bootbox #new-todo-item-who").val() ;
mylog.log("addTodoItem",todo, tplCtx.editTaskpos);
mylog.log("addItem",todo, tplCtx.editTaskpos);
listObj.buildTodo(todo, tplCtx.editTaskpos);
listObj.buildList(todo, tplCtx.editTaskpos);
listObj.btnInit();
if( notNull(tplCtx.form) && notNull(formInputs [tplCtx.form]) ){
......@@ -757,8 +805,8 @@ var listObj = {
//todoArray au lieu de géré avec des li
//avoir un array avec des objets + render
buildTodo : function (todoObj, pos) {
mylog.log("buildTodo ",todoObj, pos);
buildList : function (todoObj, pos) {
mylog.log("buildList ",todoObj, pos);
var uid = (notNull( todoObj.uid)) ? todoObj.uid : userId;
var who = "";
if(!notNull( todoObj.who)) who = userConnected.name;
......@@ -806,7 +854,7 @@ var listObj = {
$(".bootbox #todo-list").append("<li class='liTodo col-xs-12' data-pos='"+pos+"' data-uid='"+uid+"' data-created='"+created+"' data-who='"+who+"' data-whoids='"+whoids+"' data-when='"+when+"' data-price='"+price+"' >"+str+"</li>");
},
deleteTodoItem : function (e, item) {
deleteItem : function (e, item) {
e.preventDefault();
var taskPos = $(item).parent().parent().data("pos");
$(item).parent().parent().fadeOut('slow', function() {
......@@ -821,7 +869,7 @@ var listObj = {
});
},
editTodoItem : function (e, item) {
editItem : function (e, item) {
e.preventDefault();
tplCtx.editTaskpos = $(item).parent().parent().data("pos");
$(".bootbox #new-todo-item").val( $(item).parent().parent().find(".liText").text() );
......@@ -835,11 +883,10 @@ var listObj = {
})
}else
$(".bootbox #new-todo-item-who").val( $(item).parent().parent().data("who") );
},
completeTodoItem : function () {
completeItem : function () {
tplCtx.editTaskpos = $(this).parent().parent().data("pos");
var today = new Date();
var now = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear()+ ' ' + today.getHours()+ ':' + today.getMinutes();
......@@ -864,7 +911,7 @@ var listObj = {
var todoObj = ( notNull(formInputs [tplCtx.form]) ) ? answerObj.answers[tplCtx.form][tplCtx.budgetpath][tplCtx.pos].todo[taskPos] :
answerObj.answers[tplCtx.budgetpath][tplCtx.pos].todo[taskPos];
listObj.buildTodo(todoObj, tplCtx.editTaskpos);
listObj.buildList(todoObj, tplCtx.editTaskpos);
listObj.btnInit();
var todoDone = 0;
......@@ -888,16 +935,16 @@ var listObj = {
btnInit : function() {
$(".bootbox #todo-list").on('click', '.todo-item-delete', function(e){
var item = this;
listObj.deleteTodoItem(e, item)
listObj.deleteItem(e, item)
})
$(".bootbox #todo-list").on('click', '.todo-item-edit', function(e){
var item = this;
listObj.editTodoItem(e, item)
listObj.editItem(e, item)
})
$(".bootbox .todo-item-done").off().on('click', listObj.completeTodoItem);
$(".bootbox .todo-item-done").off().on('click', listObj.completeItem);
// $(".bootbox .liTodo").on('click', function(e){
// var item = this;
// editTodoItem(e, item)
// editItem(e, item)
// })
}
}
......
This diff is collapsed.
......@@ -89,7 +89,7 @@
$tds .= $a["worker"]["workType"];
else if( $i == "progress")
{
if(isset($a["todo"])){
if(!empty($a["todo"])){
$progress = floor($todoDone*100/count($a["todo"]));
}
else {
......
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