manageline.html.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php
  2. /**
  3. * The manageLine view file of product 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 product
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('changeProgramTip', $lang->product->lineChangeProgram);
  12. $hasProgram = in_array($this->config->systemMode, array('ALM', 'PLM')) && helper::hasFeature('program');
  13. $tree = array();
  14. $formRowList = null;
  15. $formRowList[] = formRow
  16. (
  17. cell
  18. (
  19. setClass('flex flex-1'),
  20. formGroup
  21. (
  22. set::width($hasProgram ? '1/2' : 'full'),
  23. set::label($lang->product->lineName),
  24. set::labelClass('font-bold')
  25. ),
  26. $hasProgram ? formGroup
  27. (
  28. set::width('1/2'),
  29. set::className('ml-4'),
  30. set::label($lang->product->program),
  31. set::labelClass('font-bold required')
  32. ) : null
  33. ),
  34. cell
  35. (
  36. set::width('100px'),
  37. formGroup
  38. (
  39. span(setClass('form-label font-bold'), set::style(array('justify-content' =>'flex-start')), $lang->actions)
  40. )
  41. )
  42. );
  43. foreach($lines as $line)
  44. {
  45. $line->actions['items'][] = array('key' => 'delete', 'icon' => 'trash', 'className' => 'btn ghost toolbar-item square size-sm rounded ajax-submit', 'data-confirm' => $lang->product->confirmDeleteLine, 'url' => createLink('product', 'ajaxDeleteLine', 'lineID=' . $line->id));
  46. $formRowList[] = formRow
  47. (
  48. cell
  49. (
  50. setClass('flex flex-1'),
  51. formGroup
  52. (
  53. set::width($hasProgram ? '1/2' : 'full'),
  54. set::control(array('control' => 'text', 'id' => "modules_id{$line->id}")),
  55. set::name("modules[id$line->id]"),
  56. set::value($line->name)
  57. ),
  58. $hasProgram ? formGroup
  59. (
  60. set::width('1/2'),
  61. set::className('ml-4'),
  62. set::control(array('control' => 'picker', 'id' => "programs_id{$line->id}", 'required' => true)),
  63. set::name("programs[id$line->id]"),
  64. set::items($linePrograms[$line->id]),
  65. set::value($line->root),
  66. on::change('isProductLineEmpty')
  67. ) : null
  68. ),
  69. cell(set::width('100px'))
  70. );
  71. }
  72. for($i = 0; $i <= 5; $i ++)
  73. {
  74. $formRowList[] = formRow
  75. (
  76. set::className('line-row-add'),
  77. cell
  78. (
  79. setClass('flex flex-1'),
  80. formGroup
  81. (
  82. set::width($hasProgram ? '1/2' : 'full'),
  83. set::control(array('control' => 'text', 'id' => "modules_{$i}")),
  84. set::name("modules[$i]")
  85. ),
  86. $hasProgram ? formGroup
  87. (
  88. set::width('1/2'),
  89. set::className('ml-4'),
  90. set::control(array('control' => 'picker', 'id' => "programs_{$i}", 'required'=> true)),
  91. set::name("programs[$i]"),
  92. set::items($programs),
  93. set::value('0')
  94. ) : null
  95. ),
  96. cell
  97. (
  98. set::width('100px'),
  99. formGroup
  100. (
  101. setClass('ml-5 pl-2 flex self-center'),
  102. btn
  103. (
  104. setClass('btn btn-link text-gray addLine'),
  105. icon('plus'),
  106. on::click('addNewLine')
  107. ),
  108. btn
  109. (
  110. setClass('btn btn-link text-gray removeLine'),
  111. icon('trash'),
  112. on::click('removeLine')
  113. )
  114. )
  115. )
  116. );
  117. }
  118. jsVar('+index', $i);
  119. modalHeader(set::title($lang->product->manageLine), set::titleClass('text-lg font-bold'));
  120. div
  121. (
  122. set::className('flex'),
  123. cell
  124. (
  125. set::width('232px'),
  126. set::className('lineTree mr-1'),
  127. panel
  128. (
  129. set::title($lang->product->line),
  130. treeEditor
  131. (
  132. set::type('line'),
  133. set::items($lines),
  134. set::canEdit(false),
  135. set::canSplit(false),
  136. set::canDelete(false),
  137. set::sortable(),
  138. set::onSort(jsRaw('window.updateOrder'))
  139. )
  140. )
  141. ),
  142. cell
  143. (
  144. set::width('2/3'),
  145. form
  146. (
  147. set::submitBtnText($lang->save),
  148. set::className('border-b-0'),
  149. $formRowList
  150. )
  151. )
  152. );
  153. /* ====== Render page ====== */
  154. render();