close.html.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * The close view file of execution module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package execution
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $confirmTip = !empty($unclosedTasks) ? sprintf($this->lang->execution->confirmCloseExecution, implode($this->lang->comma, array_keys($unclosedTasks))) : '';
  12. $confirmURL = $this->createLink('execution', 'close', "executionID={$executionID}&from={$from}");
  13. $beforeSubmit = jsRaw("() =>
  14. {
  15. let realBegan = '{$execution->realBegan}';
  16. let realEnd = $('[name=realEnd]').val();
  17. let today = zui.formatDate(zui.createDate(), 'yyyy-MM-dd');
  18. if(realBegan >= realEnd || realEnd > today) return true;
  19. zui.Modal.confirm('{$confirmTip}').then((res) =>
  20. {
  21. if(res)
  22. {
  23. const formData = new FormData($('#zin_execution_close_{$executionID}_form')[0]);
  24. $.ajaxSubmit({url: '{$confirmURL}', data: formData});
  25. }
  26. });
  27. return false;
  28. }");
  29. $space = common::checkNotCN() ? ' ' : '';
  30. modalHeader(set::title($lang->execution->close . $space . $lang->executionCommon));
  31. formPanel
  32. (
  33. set::formID('zin_execution_close_' . $executionID . '_form'),
  34. set::submitBtnText($lang->execution->close . $space . $lang->executionCommon),
  35. !empty($unclosedTasks) ? set::ajax(array('beforeSubmit' => $beforeSubmit)) : null,
  36. formGroup
  37. (
  38. set::width('1/2'),
  39. set::label($lang->execution->realEnd),
  40. set::name('realEnd'),
  41. set::control('date'),
  42. set::value(!helper::isZeroDate($execution->realEnd) ? $execution->realEnd : helper::today())
  43. ),
  44. formGroup
  45. (
  46. set::label($lang->comment),
  47. editor(set::name('comment'), set::rows('6'))
  48. )
  49. );
  50. hr();
  51. history();
  52. /* ====== Render page ====== */
  53. render();