From 4645f53c927262404bb4674d56a2bed25d5e0f15 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Tue, 4 Jul 2023 08:43:01 +0800 Subject: [PATCH] * Add manage team modal to edit task page. --- module/task/config/form.php | 13 +- module/task/control.php | 5 +- module/task/css/common.ui.css | 12 ++ module/task/css/create.ui.css | 12 -- module/task/js/common.ui.js | 75 +++++++++++ module/task/js/create.ui.js | 77 +---------- module/task/js/edit.ui.js | 153 +++++----------------- module/task/model.php | 5 +- module/task/ui/create.html.php | 4 +- module/task/ui/edit.html.php | 70 ++++++---- module/task/ui/taskteam.html.php | 218 +++++++++++++++++++++++++++++++ module/task/zen.php | 1 + 12 files changed, 401 insertions(+), 244 deletions(-) create mode 100644 module/task/js/common.ui.js create mode 100644 module/task/ui/taskteam.html.php diff --git a/module/task/config/form.php b/module/task/config/form.php index c38fd6a9df..6079e9b5c1 100644 --- a/module/task/config/form.php +++ b/module/task/config/form.php @@ -39,12 +39,12 @@ $config->task->form->cancel['status'] = array('type' => 'string', 'required' => $config->task->form->cancel['comment'] = array('type' => 'string', 'required' => false, 'default' => '', 'control' => 'editor'); $config->task->form->manageTeam = array(); -$config->task->form->manageTeam['status'] = array('type' => 'string', 'required' => false, 'default' => ''); -$config->task->form->manageTeam['estimate'] = array('type' => 'float', 'required' => false, 'default' => 0); -$config->task->form->manageTeam['left'] = array('type' => 'float', 'required' => false, 'default' => 0); -$config->task->form->manageTeam['consumed'] = array('type' => 'float', 'required' => false, 'default' => 0); -$config->task->form->manageTeam['lastEditedDate'] = array('type' => 'string', 'required' => false, 'default' => $now); -$config->task->form->manageTeam['assignedDate'] = array('type' => 'string', 'required' => false, 'default' => $now); +$config->task->form->manageTeam['status'] = array('type' => 'string', 'required' => false, 'default' => ''); +$config->task->form->manageTeam['estimate'] = array('type' => 'float', 'required' => false, 'default' => 0); +$config->task->form->manageTeam['left'] = array('type' => 'float', 'required' => false, 'default' => 0); +$config->task->form->manageTeam['consumed'] = array('type' => 'float', 'required' => false, 'default' => 0); +$config->task->form->manageTeam['lastEditedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); +$config->task->form->manageTeam['assignedDate'] = array('type' => 'string', 'required' => false, 'default' => $now); $config->task->form->edit = common::formConfig('task', 'edit'); $config->task->form->edit['name'] = array('type' => 'string', 'required' => true); @@ -83,7 +83,6 @@ $config->task->form->team->create['teamConsumed'] = array('type' => 'array', 'r $config->task->form->team->create['teamLeft'] = array('type' => 'array', 'required' => false, 'default' => array()); $config->task->form->team->edit = $config->task->form->team->create; -$config->task->form->team->edit['deleteFiles'] = array('type' => 'array', 'required' => false, 'default' => array()); $config->task->form->batchedit = common::formConfig('task', 'batchEdit'); $config->task->form->batchedit['id'] = array('type' => 'int', 'required' => false, 'default' => 0, 'base' => true); diff --git a/module/task/control.php b/module/task/control.php index d868d89251..405c5fa907 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -175,8 +175,11 @@ class task extends control $task = $this->taskZen->buildTaskForEdit($task); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + /* For team task. */ + $teamData = $this->post->team ? form::data($this->config->task->form->team->edit)->get() : new stdclass(); + /* Update task. */ - $changes = $this->task->update($task); + $changes = $this->task->update($task, $teamData); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); /* Execute hooks and synchronize the status of related objects. */ diff --git a/module/task/css/common.ui.css b/module/task/css/common.ui.css index b66b89c893..bca4877524 100644 --- a/module/task/css/common.ui.css +++ b/module/task/css/common.ui.css @@ -1,3 +1,15 @@ div.no-background .input-group-addon {background: none;} .items-center {align-items: center !important;} .flex-center {justify-content: center;} + +#modalTeam .table tr {border:none} +#modalTeam .team-saveBtn {text-align: center !important} +#modalTeam .team-saveBtn .btn{min-width: 96px;} +#modalTeam .team-index {text-align: right;} +.team-number {display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 10px; text-align: center; background: #f4f5f7;} + +#teamTable tr td:first-child {width: 40px; position: relative;} +#teamTable tr td:first-child .icon{position:absolute; top: 40px; right: 19px;display: block; font-size: 8px; color: #9ea3bd;} +#teamTable tr:nth-last-child(2) td:first-child .icon {display: none;} + +:root {--modal-base: 45rem;} diff --git a/module/task/css/create.ui.css b/module/task/css/create.ui.css index 738d110727..8e37d01250 100644 --- a/module/task/css/create.ui.css +++ b/module/task/css/create.ui.css @@ -6,21 +6,9 @@ #taskCreateForm .selectStoryLabel {top: 50%;} #testStoryBox th.required:before {content: '*'; color: rgba(var(--color-danger-500-rgb),var(--tw-text-opacity)); margin-right: 0.25rem; position: relative; top: 0.125rem;} -#modalTeam .table tr {border:none} -#modalTeam .team-saveBtn {text-align: center !important} -#modalTeam .team-saveBtn .btn{min-width: 96px;} -#modalTeam .team-index {text-align: right;} -.team-number {display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 10px; text-align: center; background: #f4f5f7;} - #multipleBox {min-width: 100px} .assignedToBox {align-items: center !important} .assignedToBox .add-team {margin-bottom: 5px} .assignedToList {display: flex; align-items: center; flex-wrap: wrap} .assignedToList .label, .assignedToList .icon{margin-right: 5px; margin-bottom: 5px} - -:root {--modal-base: 45rem;} - -#teamTable tr td:first-child {width: 40px; position: relative;} -#teamTable tr td:first-child .icon{position:absolute; top: 40px; right: 19px;display: block; font-size: 8px; color: #9ea3bd;} -#teamTable tr:nth-last-child(2) td:first-child .icon {display: none;} diff --git a/module/task/js/common.ui.js b/module/task/js/common.ui.js new file mode 100644 index 0000000000..8f2ada92bd --- /dev/null +++ b/module/task/js/common.ui.js @@ -0,0 +1,75 @@ +$('#teamTable').on('click.team', '.btn-add', function() +{ + var $newRow = $(this).closest('tr').clone(); + + $newRow.find('select').val(''); + $newRow.find('input').val(''); + + $(this).closest('tr').after($newRow); + + toggleBtn(); + setLineIndex(); +}) + +$('#teamTable').on('click.team', '.btn-delete', function() +{ + var $row = $(this).closest('tr').remove(); + toggleBtn(); + setLineIndex(); +}); + +/* 切换串行/并行 展示/隐藏工序图标. */ +$('.form').on('change.team', '[name="mode"]', function() +{ + if($(this).val() == 'multi') + { + $('#teamTable td .icon-angle-down').addClass('hidden'); + } + else + { + $('#teamTable td .icon-angle-down').removeClass('hidden'); + } +}); + +/** + * Set line number. + * + * @access public + * @return void + */ +function setLineIndex() +{ + let index = 1; + $('.team-number').each(function() + { + $(this).text(index); + $(this).closest('tr').find('select[name^=team]').attr('name', 'team[' + index + ']'); + $(this).closest('tr').find('input[name^=teamEstimate]').attr('name', 'teamEstimate[' + index + ']'); + index ++; + }); + +} + +/** + * Check delete button hide or not. + * + * @access public + * @return void + */ +function toggleBtn() +{ + var $deleteBtn = $('#teamTable').find('.btn-delete'); + if($deleteBtn.length == 1) + { + $deleteBtn.addClass('hidden'); + } + else + { + $deleteBtn.removeClass('hidden'); + } +}; + +function onPageUnmount() +{ + $('#modalTeam').off('.saveTeam'); +} diff --git a/module/task/js/create.ui.js b/module/task/js/create.ui.js index a9400a36da..23a73c9a97 100644 --- a/module/task/js/create.ui.js +++ b/module/task/js/create.ui.js @@ -367,7 +367,6 @@ window.addItem = function(obj) $tr.after($tr.clone()); } - /** * Remove a row. * @@ -381,7 +380,7 @@ window.removeItem = function(obj) $(obj).closest('tr').remove(); } -$('#teamTable').on('click.team', '.toolbar-item', function() +$('#teamTable .team-saveBtn').on('click.team', '.btn', function() { $('div.assignedToList').html(''); @@ -395,7 +394,7 @@ $('#teamTable').on('click.team', '.toolbar-item', function() { if($(this).val() == '') return; - const selectObj = $(this)[0]; + let selectObj = $(this)[0]; let realname = selectObj.options[selectObj.selectedIndex].text; if(!team.includes(realname)) team.push(realname); @@ -434,75 +433,3 @@ $('#teamTable').on('click.team', '.toolbar-item', function() zui.Modal.hide(); return false; }) - -$('#teamTable').on('click.team', '.btn-add', function() -{ - var $newRow = $(this).closest('tr').clone(); - $(this).closest('tr').after($newRow); - - toggleBtn(); - setLineIndex(); -}) - -$('#teamTable').on('click.team', '.btn-delete', function() -{ - var $row = $(this).closest('tr').remove(); - toggleBtn(); - setLineIndex(); -}); - -/* 切换串行/并行 展示/隐藏工序图标. */ -$('#teamTable').on('change.team', '#mode', function() -{ - if($(this).val() == 'multi') - { - $('#teamTable td .icon-angle-down').addClass('hidden'); - } - else - { - $('#teamTable td .icon-angle-down').removeClass('hidden'); - } -}); - -/** - * Set line number. - * - * @access public - * @return void - */ -function setLineIndex() -{ - let index = 1; - $('.team-number').each(function() - { - $(this).text(index); - $(this).closest('tr').find('select[name^=team]').attr('name', 'team[' + index + ']'); - $(this).closest('tr').find('input[name^=teamEstimate]').attr('name', 'teamEstimate[' + index + ']'); - index ++; - }); - -} - -/** - * Check delete button hide or not. - * - * @access public - * @return void - */ -function toggleBtn() -{ - var $deleteBtn = $('#teamTable').find('.btn-delete'); - if($deleteBtn.length == 1) - { - $deleteBtn.addClass('hidden'); - } - else - { - $deleteBtn.removeClass('hidden'); - } -}; - -function onPageUnmount() -{ - $('#modalTeam').off('.saveTeam'); -} diff --git a/module/task/js/edit.ui.js b/module/task/js/edit.ui.js index b61ab74d51..bfbfaddead 100644 --- a/module/task/js/edit.ui.js +++ b/module/task/js/edit.ui.js @@ -1,14 +1,3 @@ -$(function() -{ - $('.record-estimate-toggle').modalTrigger({width:900, type:'iframe', afterHide: function(){parent.location.href=parent.location.href;}}); - if(!newRowCount) $('#taskTeamEditor tr.member').last().addClass('member-last'); - - if($('#consumedSpan').parent().find('button').hasClass('disabled')) - { - $('#consumedSpan').parent().find('button').attr('disabled','disabled') - } -}) - /** * Change mode event. * @@ -16,9 +5,9 @@ $(function() * @access public * @return viod */ -function changeMode(mode) +window.changeMode = function(e) { - console.log(mode); + let mode = $(e.target).val(); if(mode != 'single') { if(mode != 'multi') @@ -43,126 +32,50 @@ function changeMode(mode) } } -/** - * Load module, stories and members. - * - * @param int $executionID - * @access public - * @return void - */ -function loadAll(executionID) +$('#teamTable .team-saveBtn').on('click.team', '.btn', function() { - if(confirm(confirmChangeExecution)) - { - loadModuleMenu(executionID); - loadExecutionStories(executionID); - loadExecutionMembers(executionID); - } - else - { - $('#execution').val(oldExecutionID); - $("#execution").trigger("chosen:updated"); - } -} - -/** - * Load module of the execution. - * - * @param int $executionID - * @access public - * @return void - */ -function loadModuleMenu(executionID) -{ - var link = createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + executionID + '&viewtype=task'); - $('#moduleIdBox').load(link, function(){$('#module').chosen();}); -} - -/** - * Load stories of the execution. - * - * @param int $executionID - * @access public - * @return void - */ -function loadExecutionStories(executionID, moduleID) -{ - if(typeof(moduleID) == 'undefined') moduleID = 0; - var link = createLink('story', 'ajaxGetExecutionStories', 'executionID=' + executionID + '&productID=0&branch=0&moduleID=' + moduleID + '&storyID=' + oldStoryID); - $('#storyIdBox').load(link, function(){$('#story').chosen();}); -} - -/** - * Load team members of the execution. - * - * @param int $executionID - * @access public - * @return void - */ -function loadExecutionMembers(executionID) -{ - var link = createLink('execution', 'ajaxGetMembers', 'executionID=' + executionID + '&assignedTo=' + oldAssignedTo); - $('#assignedToIdBox').load(link, function(){$('#assignedToIdBox').find('select').chosen()}); -} - -/* empty function. */ -function setPreview(){} - -$(document).ready(function() -{ - $('#showAllModule').change(function() - { - var moduleID = $('#moduleIdBox #module').val(); - var extra = $(this).prop('checked') ? 'allModule' : ''; - $('#moduleIdBox').load(createLink('tree', 'ajaxGetOptionMenu', "rootID=" + executionID + '&viewType=task&branch=0&rootModuleID=0&returnType=html&fieldID=&needManage=0&extra=' + extra), function() - { - $('#moduleIdBox #module').val(moduleID).chosen(); - }); - }); -}); - -$(document).on('click', '#confirmButton', function() -{ - var memberCount = ''; - var totalEstimate = 0; - var totalConsumed = oldConsumed; - var totalLeft = 0; - var error = false; + let memberCount = ''; + let totalEstimate = 0; + let totalConsumed = oldConsumed; + let totalLeft = 0; + let error = false; $('select[name^=team]').each(function() { if($(this).val() == '') return; memberCount++; - var $tr = $(this).closest('tr'); - var account = $(this).find('option:selected').text(); + let selectObj = $(this)[0]; + let realname = selectObj.options[selectObj.selectedIndex].text; - var estimate = parseFloat($tr.find('[name^=teamEstimate]').val()); + let $tr = $(this).closest('tr'); + + let estimate = parseFloat($tr.find('[name^=teamEstimate]').val()); if(!isNaN(estimate)) totalEstimate += estimate; if(isNaN(estimate) || estimate <= 0) { - bootbox.alert(account + ' ' + estimateNotEmpty); - error = true; - return false; + zui.Modal.alert(realname + ' ' + estimateNotEmpty); + error = true; + return false; } - var consumed = parseFloat($tr.find('[name^=teamConsumed]').val()); + let consumed = parseFloat($tr.find('[name^=teamConsumed]').val()); if(!isNaN(consumed)) totalConsumed += consumed; - var $left = $tr.find('[name^=teamLeft]'); - var left = parseFloat($left.val()); + let $left = $tr.find('[name^=teamLeft]'); + let left = parseFloat($left.val()); if(!isNaN(left)) totalLeft += left; if(!$left.prop('readonly') && (isNaN(left) || left <= 0) && team.length > 0) { - bootbox.alert(account + ' ' + leftNotEmpty); + zui.Modal.alert(realname + ' ' + leftNotEmpty); error = true; return false; } if(estimate == 0 || isNaN(estimate)) { - $(this).val('').trigger("chosen:updated"); - bootbox.alert(estimateNotEmpty); + $(this).val(''); + zui.Modal.alert(estimateNotEmpty); error = true; return false; } @@ -172,13 +85,13 @@ $(document).on('click', '#confirmButton', function() if(memberCount < 2) { - bootbox.alert(teamMemberError); + zui.Modal.alert(teamMemberError); return false; } if(totalLeft == 0 && (taskStatus == 'doing' || taskStatus == 'pause')) { - bootbox.alert(totalLeftError); + zui.Modal.alert(totalLeftError); return false; } @@ -187,7 +100,8 @@ $(document).on('click', '#confirmButton', function() $('#left').val(totalLeft); updateAssignedTo(); - $('.close').click(); + zui.Modal.hide(); + return false; }); /** @@ -206,14 +120,16 @@ function updateAssignedTo() var isTeamMember = false; $('select[name^=team]').each(function() { - if($(this).find('option:selected').text() == '') return; + let selectObj = $(this)[0]; + let realname = selectObj.options[selectObj.selectedIndex].text; + + if(realname == '') return; if($(this).val() == currentUser) isTeamMember = true; - var account = $(this).find('option:selected').val(); - var realName = $(this).find('option:selected').text(); - var selected = account == assignedTo ? 'selected' : ''; + let account = $(this).val(); + let selected = account == assignedTo ? 'selected' : ''; - html += ""; + html += ""; }); if(mode == 'multi' && isTeamMember && mode != 'linear') @@ -235,6 +151,5 @@ function updateAssignedTo() } $('#assignedTo').html(html); - if(mode != 'single' && mode == 'linear' && $('#modalTeam tr.member-doing').length == 0 && $('#modalTeam tr.member-wait').length >= 1) $('[name=assignedTo]').val($('#modalTeam tr.member-wait:first').find('select[name^=team]:first').val()); - $('#assignedTo').trigger('chosen:updated'); + if(mode == 'linear' && $('#teamTable tr.member-doing').length == 0 && $('#teamTable tr.member-wait').length >= 1) $('[name=assignedTo]').val($('#teamTable tr.member-wait:first').find('select[name^=team]:first').val()); } diff --git a/module/task/model.php b/module/task/model.php index a31a15774c..5ce2a1bcd6 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -692,10 +692,11 @@ class taskModel extends model * Update a task. * * @param object $task + * @param object $teamData * @access public * @return array|string|false */ - public function update(object $task): array|string|false + public function update(object $task, object $teamData): array|string|false { $taskID = $task->id; $oldTask = $this->getByID($taskID); @@ -709,7 +710,7 @@ class taskModel extends model /* Compute hours and manage team for multi-task. */ if($this->post->team and count(array_filter($this->post->team)) > 1) { - $teams = $this->manageTaskTeam($oldTask->mode, $taskID, $task->status); + $teams = $this->manageTaskTeam($oldTask->mode, $task, $teamData); if(!empty($teams)) $task = $this->computeMultipleHours($oldTask, $task, array(), false); } diff --git a/module/task/ui/create.html.php b/module/task/ui/create.html.php index c1d1a5e165..9d2be3ded3 100644 --- a/module/task/ui/create.html.php +++ b/module/task/ui/create.html.php @@ -144,7 +144,7 @@ for($i = 1; $i <= 3; $i ++) set::width('240px'), select ( - set::name("team[$i]"), + set::name("team[]"), set::items($members), ), ), @@ -155,7 +155,7 @@ for($i = 1; $i <= 3; $i ++) ( input ( - set::name("teamEstimate[$i]"), + set::name("teamEstimate[]"), set::placeholder($lang->task->estimateAB), ), to::suffix($lang->task->suffixHour), diff --git a/module/task/ui/edit.html.php b/module/task/ui/edit.html.php index 76218b1430..64d06543aa 100644 --- a/module/task/ui/edit.html.php +++ b/module/task/ui/edit.html.php @@ -12,6 +12,8 @@ declare(strict_types=1); namespace zin; +include './taskteam.html.php'; + /* ====== Preparing and processing page data ====== */ jsVar('oldStoryID', $task->story); jsVar('oldAssignedTo', $task->assignedTo); @@ -19,7 +21,7 @@ jsVar('oldExecutionID', $task->execution); jsVar('oldConsumed', $task->consumed); jsVar('taskStatus', $task->status); jsVar('currentUser', $app->user->account); -jsVar('team', $task->members); +jsVar('team', array_values($task->members)); jsVar('members', $members); jsVar('page', 'edit'); jsVar('confirmChangeExecution', $lang->task->confirmChangeExecution); @@ -53,6 +55,7 @@ $canceledByOptions = $users; $closedByOptions = $users; $closedReasonOptions = $lang->task->reasonList; $teamOptions = $members; +$hiddenTeam = $task->mode != '' ? '' : 'hidden'; /* ====== Define the page structure with zin widgets ====== */ @@ -191,7 +194,8 @@ detailBody set::name('mode'), set::value($task->mode), set::items($modeOptions), - on::change('changeMode(this.value)') + set::required(true), + on::change('changeMode') ) ) : item @@ -216,14 +220,14 @@ detailBody 'type' => 'picker', 'items' => $assignedToOptions ))), - $task->mode != '' - ? btn(set(array - ( - 'type' => 'btn', - 'text' => $lang->task->team, - 'class' => 'input-group-btn team-group' - ))) - : null + btn(set(array + ( + 'type' => 'btn', + 'text' => $lang->task->team, + 'class' => "input-group-btn team-group $hiddenTeam", + 'url' => '#modalTeam', + 'data-toggle' => 'modal', + ))) ) ), item @@ -284,6 +288,33 @@ detailBody ) ), ), + modalTrigger + ( + modal + ( + set::id('modalTeam'), + set::title($lang->task->teamMember), + h::table + ( + set::id('teamTable'), + setClass('table table-form'), + $teamForm, + h::tr + ( + h::td + ( + setClass('team-saveBtn'), + set(array('colspan' => 6)), + btn + ( + setClass('toolbar-item btn primary'), + $lang->save + ) + ) + ) + ) + ) + ), tableData ( set::title($lang->task->legendEffort), @@ -316,6 +347,7 @@ detailBody ( set::name('estimate'), set::value($task->estimate), + !empty($task->team) ? set::readonly(true) : null ), div ( @@ -336,6 +368,7 @@ detailBody span ( setClass('span-text mr-1'), + set::id('consumedSpan'), $task->consumed . 'H' ), h::a @@ -354,6 +387,7 @@ detailBody ( set::name('left'), set::value($task->left), + !empty($task->team) ? set::readonly(true) : null ), div ( @@ -451,7 +485,6 @@ detailBody ( set::name('closedDate'), set::value($task->closedDate), - set::type('datetime-local') ) ), item @@ -461,24 +494,9 @@ detailBody ( set::name('lastEditedDate'), set::value($task->lastEditedDate), - set::type('datetime-local'), set::id('lastEditedDate'), ) ), - item - ( - set::trClass('hidden'), - control - ( - set::name('team[]'), - set::type('picker'), - set::id('team'), - set::items($teamOptions) - ) - ), ) ) ); -/* ====== Render page ====== */ - -render(); diff --git a/module/task/ui/taskteam.html.php b/module/task/ui/taskteam.html.php new file mode 100644 index 0000000000..5dcf810396 --- /dev/null +++ b/module/task/ui/taskteam.html.php @@ -0,0 +1,218 @@ + + * @package task + * @link http://www.zentao.net + */ + +namespace zin; + +$teamForm = array(); +$hiddenArrow = (empty($task->mode) or $task->mode == 'linear') ? '' : 'hidden'; +$i = 1; + +if(!empty($task->team)) +{ + foreach($task->team as $member) + { + $memberDisabled = false; + $sortDisabled = false; + $memberStatus = $member->status; + if($memberStatus == 'done') $memberDisabled = true; + if($memberStatus != 'wait' and $task->mode == 'linear') $sortDisabled = true; + if($memberStatus == 'done' and $task->mode == 'multi') $sortDisabled = true; + if(strpos('|closed|cancel|pause|', $task->status) !== false and $app->rawMethod != 'activate') + { + $memberStatus = $task->status; + $memberDisabled = true; + $sortDisabled = true; + } + + $hourDisabled = $memberDisabled; + + $teamForm[] = h::tr + ( + set + ( + array + ( + 'class' => "member member-$memberStatus", + 'data-estimate' => (float)$member->estimate, + 'data-consumed' => (float)$member->consumed, + 'data-left' => (float)$member->left + ) + ), + h::td + ( + setClass('team-index'), + span + ( + setClass("team-number"), + $i + ), + icon("angle-down $hiddenArrow") + ), + h::td + ( + set::width('240px'), + select + ( + set::name("team[]"), + set::items($members), + set::value($member->account), + $memberDisabled ? set::disabled(true) : null + ), + ), + h::td + ( + set::width('135px'), + inputControl + ( + input + ( + set::name("teamEstimate[]"), + set::value((float)$member->estimate), + $hourDisabled ? set::readonly(true) : null, + set::placeholder($lang->task->estimateAB), + ), + to::suffix($lang->task->suffixHour), + set::suffixWidth(20), + ), + ), + h::td + ( + set::width('135px'), + inputControl + ( + input + ( + set::name("teamConsumed[]"), + set::value((float)$member->consumed), + set::readonly(true), + set::placeholder($lang->task->consumedAB), + ), + to::suffix($lang->task->suffixHour), + set::suffixWidth(20), + ), + ), + h::td + ( + set::width('135px'), + inputControl + ( + input + ( + set::name("teamLeft[]"), + set::value((float)$member->left), + $hourDisabled ? set::readonly(true) : null, + set::placeholder($lang->task->leftAB), + ), + to::suffix($lang->task->suffixHour), + set::suffixWidth(20), + ), + ), + h::td + ( + set::width('100px'), + setClass('center'), + btnGroup + ( + set::items(array( + array('icon' => 'plus', 'class' => 'btn btn-link btn-add'), + array('icon' => 'trash', 'class' => 'btn btn-link btn-delete'), + )) + ) + ) + ); + + $i ++; + } +} + +$count = $i + 3; +for($i; $i < $count; $i ++) +{ + $teamForm[] = h::tr + ( + h::td + ( + setClass('team-index'), + span + ( + setClass("team-number"), + $i + ), + icon("angle-down $hiddenArrow") + ), + h::td + ( + set::width('240px'), + select + ( + set::name("team[]"), + set::items($members), + ), + ), + h::td + ( + set::width('135px'), + inputControl + ( + input + ( + set::name("teamEstimate[]"), + set::placeholder($lang->task->estimateAB), + ), + to::suffix($lang->task->suffixHour), + set::suffixWidth(20), + ), + ), + !empty($task->team) ? h::td + ( + set::width('135px'), + inputControl + ( + input + ( + set::name("teamConsumed[]"), + set::value(0), + set::readonly(true), + set::placeholder($lang->task->consumedAB), + ), + to::suffix($lang->task->suffixHour), + set::suffixWidth(20), + ), + ) : null, + !empty($task->team) ? h::td + ( + set::width('135px'), + inputControl + ( + input + ( + set::name("teamLeft[]"), + set::placeholder($lang->task->leftAB), + ), + to::suffix($lang->task->suffixHour), + set::suffixWidth(20), + ), + ) : null, + h::td + ( + set::width('100px'), + setClass('center'), + btnGroup + ( + set::items(array( + array('icon' => 'plus', 'class' => 'btn btn-link btn-add'), + array('icon' => 'trash', 'class' => 'btn btn-link btn-delete'), + )) + ) + ) + ); +} diff --git a/module/task/zen.php b/module/task/zen.php index e77dfd2b0d..dda3899491 100644 --- a/module/task/zen.php +++ b/module/task/zen.php @@ -419,6 +419,7 @@ class taskZen extends task $now = helper::now(); $task = form::data($this->config->task->form->edit)->add('id', $task->id) + ->setDefault('deleteFiles', array()) ->setIF(!$task->assignedTo && !empty($oldTask->team) && !empty($this->post->team), 'assignedTo', $this->task->getAssignedTo4Multi($this->post->team, $oldTask)) ->setIF($task->assignedTo != $oldTask->assignedTo, 'assignedDate', $now) ->setIF($task->mode == 'single', 'mode', '')