create.html.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  2. <?php include $app->getModuleRoot() . 'common/view/datepicker.html.php';?>
  3. <?php include $app->getModuleRoot() . 'common/view/kindeditor.html.php';?>
  4. <?php
  5. foreach(explode(',', $config->demand->create->requiredFields) as $field)
  6. {
  7. if($field and strpos($showFields, $field) === false) $showFields .= ',' . $field;
  8. }
  9. ?>
  10. <?php js::set('showFields', $showFields);?>
  11. <?php js::set('requiredFields', $config->demand->create->requiredFields);?>
  12. <?php js::set('isCopy', !empty($demand));?>
  13. <?php js::set('from', $from);?>
  14. <?php js::set('isUndetermined', !empty($demand) && $demand->product == '');?>
  15. <div id="mainContent" class="main-content fade">
  16. <div class="center-block">
  17. <div class="main-header">
  18. <h2><?php echo $lang->demand->create;?></h2>
  19. <?php if(!$this->demand->checkForceReview()):?>
  20. <div class="needNotReviewBox">
  21. <div class='checkbox-primary'>
  22. <input id='needNotReview' name='needNotReview' value='1' type='checkbox' class='no-margin' <?php echo $needReview;?>/>
  23. <label for='needNotReview'><?php echo $lang->demand->needNotReview;?></label>
  24. </div>
  25. </div>
  26. <?php endif;?>
  27. <div class="pull-right btn-toolbar">
  28. <?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=demand&section=custom&key=createFields')?>
  29. <?php include $app->getModuleRoot() . 'common/view/customfield.html.php';?>
  30. </div>
  31. </div>
  32. <form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
  33. <table class="table table-form">
  34. <tbody>
  35. <?php if(!empty($demand) || !empty($from)):?>
  36. <tr>
  37. <th><?php echo $lang->demand->demandpool;?></th>
  38. <td><?php echo html::select('pool', $demandpools, !empty($demand->pool) ? $demand->pool : '', "class='form-control picker-select'");?></td>
  39. </tr>
  40. <?php endif;?>
  41. <tr>
  42. <th><?php echo $lang->demand->product;?></th>
  43. <td>
  44. <div class='input-group'>
  45. <?php echo html::select('product[]', $products, !empty($demand->product) ? $demand->product : '', "class='form-control picker-select' multiple");?>
  46. <?php echo html::input('undeterminedProduct', '', "class='form-control hidden' disabled");?>
  47. <span class='input-group-addon'>
  48. <div class="checkbox-primary">
  49. <input type="checkbox" name="undetermined" value="0" id="undetermined" onchange="toggleProductDropdown()" />
  50. <label for="undetermined0"><?php echo $lang->demand->undetermined;?></label>
  51. </div>
  52. </span>
  53. </div>
  54. </td>
  55. <td id="assignedToBox">
  56. <div class='input-group'>
  57. <span class='input-group-addon'><?php echo $lang->demand->assignedTo;?></span>
  58. <?php echo html::select('assignedTo', isset($assignTo) ? $assignTo : '', !empty($demand->assignedTo) ? $demand->assignedTo: '', "class='form-control picker-select'");?>
  59. </div>
  60. </td>
  61. </tr>
  62. <?php $hiddenSource = strpos(",$showFields,", ',source,') !== false ? '' : 'hidden';?>
  63. <tr class='sourceBox <?php echo $hiddenSource;?>'>
  64. <th><?php echo $lang->demand->source;?></th>
  65. <td>
  66. <div class='table-row'>
  67. <?php echo html::select('source', $lang->demand->sourceList, !empty($demand->source) ? $demand->source : '', "class='form-control chosen'");?>
  68. </div>
  69. </td>
  70. <td>
  71. <div class='input-group'>
  72. <span class='input-group-addon'><?php echo $lang->demand->sourceNote;?></span>
  73. <?php echo html::input('sourceNote', !empty($demand->sourceNote) ? $demand->sourceNote : '', "class='form-control'");?>
  74. </div>
  75. </td>
  76. </tr>
  77. <tr>
  78. <th><?php echo $lang->demand->duration;?></th>
  79. <td><?php echo html::select('duration', $lang->demand->durationList, !empty($demand->duration) ? $demand->duration : '', "class='form-control chosen'");?></td>
  80. <td>
  81. <div class='input-group'>
  82. <span class='input-group-addon'><?php echo $lang->demand->BSA;?>
  83. <icon class='icon icon-help' data-toggle='popover' data-trigger='focus hover' data-placement='right' data-tip-class='text-muted popover-sm' data-content="<?php echo $lang->demand->bsaTip;?>"></icon>
  84. </span>
  85. <?php echo html::select('BSA', $lang->demand->bsaList, !empty($demand->BSA) ? $demand->BSA : '', "class='form-control chosen'");?>
  86. </div>
  87. </td>
  88. </tr>
  89. <tr>
  90. <th><?php echo $lang->demand->feedbackedBy;?></th>
  91. <td>
  92. <div class='table-row'>
  93. <div class='table-col'>
  94. <div class='input-group'>
  95. <?php echo html::input('feedbackedBy', !empty($demand->feedbackBy) ? $demand->feedbackBy : '', "class='form-control'");?>
  96. </div>
  97. </div>
  98. <div class='table-col'>
  99. <div class='input-group'>
  100. <span class='input-group-addon fix-border'><?php echo $lang->demand->email;?></span>
  101. <?php echo html::input('email', !empty($demand->mail) ? $demand->mail : '', "class='form-control'");?>
  102. </div>
  103. </div>
  104. </div>
  105. </td>
  106. <td>
  107. <div class='input-group'>
  108. <span class='input-group-addon'><?php echo $lang->demand->parent;?></span>
  109. <?php echo html::select('parent', isset($parents) ? $parents : '', '', "class='form-control chosen'");?>
  110. </div>
  111. </td>
  112. </tr>
  113. <tr>
  114. <?php $required = $this->demand->checkForceReview() ? 'required' : '';?>
  115. <?php echo $this->demand->checkForceReview() ? '' : html::hidden('needNotReview', 1);?>
  116. <th><?php echo $lang->demand->reviewer;?></th>
  117. <td id='reviewerBox'><?php echo html::select('reviewer[]', isset($reviewers) ? $reviewers : '', !empty($demand->reviewers) ? $demand->reviewers : '',"class='form-control picker-select' multiple $required");?></td>
  118. </tr>
  119. <tr>
  120. <th><?php echo $lang->demand->name;?></th>
  121. <td colspan='2'>
  122. <div class='table-row'>
  123. <div class='table-col input-size'>
  124. <div class="input-control has-icon-right">
  125. <?php echo html::input('title', !empty($demand->title) ? $demand->title : '', "class='form-control' required");?>
  126. <div class="colorpicker">
  127. <button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><span class="color-bar"></span><i class="ic"></i></button>
  128. <ul class="dropdown-menu clearfix">
  129. <li class="heading"><?php echo $lang->demand->colorTag;?><i class="icon icon-close"></i></li>
  130. </ul>
  131. <input type="hidden" class="colorpicker" id="color" name="color" value="" data-icon="color" data-wrapper="input-control-icon-right" data-update-color="#title" data-provide="colorpicker">
  132. </div>
  133. </div>
  134. </div>
  135. <div class="table-col categoryBox">
  136. <div class="input-group">
  137. <span class="input-group-addon fix-border br-0"><?php echo $lang->demand->category;?></span>
  138. <?php echo html::select('category', $lang->demand->categoryList, !empty($demand->category) ? $demand->category : '', "class='form-control chosen'");?>
  139. </div>
  140. </div>
  141. <?php $hiddenPri = strpos(",$showFields,", ',pri,') !== false ? '' : 'hidden';?>
  142. <div class="table-col priBox <?php echo $hiddenPri?>">
  143. <div class="input-group">
  144. <span class="input-group-addon fix-border br-0"><?php echo $lang->demand->pri;?></span>
  145. <?php
  146. $hasCustomPri = false;
  147. foreach($lang->demand->priList as $priKey => $priValue)
  148. {
  149. if(!empty($priKey) and (string)$priKey != (string)$priValue)
  150. {
  151. $hasCustomPri = true;
  152. break;
  153. }
  154. }
  155. $pri = 3;
  156. unset($lang->demand->priList['']);
  157. $priList = $lang->demand->priList;
  158. if(end($priList)) unset($priList[0]);
  159. if(!isset($priList[$pri]))
  160. {
  161. reset($priList);
  162. $pri = key($priList);
  163. }
  164. if(!empty($demand->pri)) $pri = $demand->pri;
  165. ?>
  166. <?php if($hasCustomPri):?>
  167. <?php echo html::select('pri', (array)$priList, $pri, "class='form-control'");?>
  168. <?php else:?>
  169. <div class="input-group-btn pri-selector" data-type="pri">
  170. <button type="button" class="btn dropdown-toggle br-0" data-toggle="dropdown">
  171. <span class="pri-text"><span class="label-pri label-pri-<?php echo empty($pri) ? '0' : $pri?>" title="<?php echo $pri?>"><?php echo $pri?></span></span> &nbsp;<span class="caret"></span>
  172. </button>
  173. <div class='dropdown-menu pull-right'>
  174. <?php echo html::select('pri', (array)$priList, $pri, "class='form-control' data-provide='labelSelector' data-label-class='label-pri'");?>
  175. </div>
  176. </div>
  177. <?php endif;?>
  178. </div>
  179. </div>
  180. </div>
  181. </td>
  182. </tr>
  183. <tr>
  184. <th><?php echo $lang->demand->spec;?></th>
  185. <td colspan='2'><?php echo html::textarea('spec', !empty($demand->spec) ? $demand->spec : '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
  186. </tr>
  187. <?php $hiddenVerify = strpos(",$showFields,", ',verify,') !== false ? '' : 'hidden';?>
  188. <tr class="verifyBox <?php echo $hiddenVerify;?>">
  189. <th><?php echo $lang->demand->verify;?></th>
  190. <td colspan="2"><?php echo html::textarea('verify', !empty($demand->verify) ? $demand->verify : '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
  191. </tr>
  192. <tr>
  193. <th><?php echo $lang->files;?></th>
  194. <td colspan='2'>
  195. <?php
  196. if(isset($demand->files)) echo $this->fetch('file', 'printFiles', array('files' => $demand->files, 'fieldset' => 'false', 'object' => null, 'method' => 'edit', 'showDelete' => true, 'showEdit' => false));
  197. echo $this->fetch('file', 'buildoldform', 'fileCount=1&percent=0.85');
  198. ?>
  199. </td>
  200. </tr>
  201. <?php $hiddenMailto = strpos(",$showFields,", ',mailto,') !== false ? '' : 'hidden';?>
  202. <tr class='mailtoBox <?php echo $hiddenMailto;?>'>
  203. <th><?php echo $lang->demand->mailto;?></th>
  204. <td colspan='2'>
  205. <div class="input-group">
  206. <?php echo html::select('mailto[]', $users, !empty($demand->mailto) ? $demand->mailto : '', "class='form-control chosen' data-placeholder='{$lang->chooseUsersToMail}' multiple");?>
  207. <?php echo $this->fetch('my', 'buildContactLists');?>
  208. </div>
  209. </td>
  210. </tr>
  211. <?php $hiddenKeyWords = strpos(",$showFields,", ',keywords,') !== false ? '' : 'hidden';?>
  212. <tr class="<?php echo $hiddenKeyWords?> keywordsBox">
  213. <th><?php echo $lang->demand->keywords;?></th>
  214. <td colspan="2">
  215. <?php echo html::input('keywords', !empty($demand->keywords) ? $demand->keywords : '', 'class="form-control"');?>
  216. </td>
  217. </tr>
  218. <tr>
  219. <td class='form-actions text-center' colspan='3'>
  220. <?php if(!$this->demand->checkForceReview()):?>
  221. <?php echo html::commonButton($lang->save, "id='saveDemand' onclick=save(this)", 'btn btn-primary btn-wide needNotReview');?>
  222. <?php echo html::commonButton($lang->demand->saveDraft, 'id="saveDraftDemand" onclick=save(this,"draft")', 'btn btn-secondary btn-wide needNotReview');?>
  223. <?php endif;?>
  224. <?php echo html::commonButton($lang->demand->saveDraft, "id='saveDraft' onclick=save(this,'draft')", 'btn btn-primary btn-wide needReview');?>
  225. <?php echo html::commonButton($lang->demand->submitReview, "id='submitReview' onclick=save(this)", 'btn btn-secondary btn-wide needReview');?>
  226. <?php if(empty($demand)):?>
  227. <?php echo html::hidden('pool', $pool->id);?>
  228. <?php endif;?>
  229. <?php echo html::backButton();?>
  230. </td>
  231. </tr>
  232. </tbody>
  233. </table>
  234. </form>
  235. </div>
  236. </div>
  237. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>