showimport.html.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace zin;
  3. jsVar('forceReview', data('forceReview'));
  4. jsVar('storyType', data('type'));
  5. if($app->tab == 'product') data('activeMenuID', $type);
  6. jsVar('productID', data('productID'));
  7. jsVar('hasBranch', data('hasBranch'));
  8. jsVar('branchModules', data('branchModules'));
  9. jsVar('branchPlans', data('branchPlans'));
  10. jsVar('allModules', data('stories.fields.module.items'));
  11. jsVar('allPlans', data('stories.fields.plan.items'));
  12. include $app->getModuleRoot() . 'transfer/ui/showimport.html.php';
  13. pageJS(<<<'JS'
  14. $(document).off('change', "[name^='branch']").on('change', "[name^='branch']", function(e)
  15. {
  16. setModuleAndPlanByBranch(e);
  17. });
  18. window.renderImportRowData = function($row, index, row)
  19. {
  20. if(hasBranch === true && typeof row.branch != 'undefined' && row.branch !== '')
  21. {
  22. const modules = typeof branchModules[row.branch] == 'undefined' ? allModules : branchModules[row.branch];
  23. $row.find('.form-batch-control[data-name="module"]').find('.picker-box').on('inited', function(e, info)
  24. {
  25. let $picker = info[0];
  26. let options = $picker.options;
  27. options.items = modules != null ? modules : [];
  28. options.defaultValue = row.module;
  29. $picker.render(options);
  30. $picker.$.setValue(row.module);
  31. });
  32. const plans = typeof branchPlans[row.branch] == 'undefined' ? allPlans : branchPlans[row.branch];
  33. $row.find('.form-batch-control[data-name="plan"]').find('.picker-box').on('inited', function(e, info)
  34. {
  35. let $picker = info[0];
  36. let options = $picker.options;
  37. options.items = plans != null ? plans : [];
  38. options.defaultValue = row.plan;
  39. $picker.render(options);
  40. $picker.$.setValue(row.plan);
  41. });
  42. }
  43. $row.find('.form-batch-control[data-name="reviewer"]').find('.picker-box').on('inited', function(e, info)
  44. {
  45. let $picker = info[0];
  46. let options = $picker.options;
  47. if(row.reviewer)
  48. {
  49. options.ditto = false;
  50. $picker.render(options);
  51. $picker.$.setValue(row.reviewer);
  52. }
  53. });
  54. };
  55. JS
  56. );