create.html.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * The create file of durationestimation module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yuting Wang<wangyuting@easycorp.ltd>
  8. * @package durationestimation
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. jsVar('projectID', $project->id);
  13. jsVar('estimation', $workestimation);
  14. $totalWorkload = 0;
  15. $totalStaff = 0;
  16. foreach($stages as $stage)
  17. {
  18. $estimation = zget($estimationList, $stage->id, array());
  19. $stage->stage = $stage->id;
  20. $stage->workload = zget($estimation, 'workload', $stage->percent);
  21. $stage->workloadLabel = zget($workestimation, 'scale', 0) * $stage->workload / 100;
  22. $stage->worktimeRate = zget($estimation, 'workload', $stage->percent);
  23. $stage->people = zget($estimation, 'people', 0);
  24. $stage->startDate = zget($estimation, 'startDate', '');
  25. $stage->endDate = zget($estimation, 'endDate', '');
  26. $totalWorkload += $stage->workloadLabel;
  27. $totalStaff += $stage->people;
  28. }
  29. $formBatchItems = array();
  30. $formBatchItems[] = array('name' => 'stage' , 'control' => 'input', 'hidden' => true);
  31. $formBatchItems[] = array('label' => $lang->durationestimation->stage, 'name' => 'name' , 'control' => 'input');
  32. $formBatchItems[] = array('label' => $lang->durationestimation->workloadRate . "(%)", 'name' => 'workload', 'control' => array('control' => 'number', 'data-on' => 'change', 'data-call' => 'changeWorkload', 'data-params' => 'event'));
  33. $formBatchItems[] = array('label' => $lang->durationestimation->workload . "({$lang->hourCommon})", 'name' => 'workloadLabel', 'control' => 'input', 'disabled' => true);
  34. $formBatchItems[] = array('label' => $lang->durationestimation->worktimeRate . '(%)', 'name' => 'worktimeRate', 'control' => 'number');
  35. $formBatchItems[] = array('label' => $lang->durationestimation->people, 'name' => 'people', 'control' => array('control' => 'number', 'data-on' => 'change', 'data-call' => 'computeTotalStaff', 'data-params' => 'event'));
  36. $formBatchItems[] = array('label' => $lang->durationestimation->startDate, 'name' => 'startDate', 'control' => array('control' => 'date', 'data-on' => 'change', 'data-call' => 'computeEndDate', 'data-params' => 'event'));
  37. $formBatchItems[] = array('label' => $lang->durationestimation->endDate, 'name' => 'endDate', 'control' => 'date');
  38. formBatchPanel
  39. (
  40. empty($stages) ? set::actions('') : null,
  41. set::mode('edit'),
  42. set::data(array_values($stages)),
  43. set::items($formBatchItems)
  44. );
  45. query('.form-actions')->before(html("<div class='pl-6'>" . sprintf($lang->durationestimation->summary, zget($workestimation, 'scale', ''), $totalWorkload, $totalStaff) . "</div>"));