batchedit.ui.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. window.handleRenderRow = function($row, index, row)
  2. {
  3. /* Set the branches for the row. */
  4. if(branchProduct)
  5. {
  6. $row.find('.form-batch-control[data-name="branch"] .picker-box').on('inited', function(e, info)
  7. {
  8. const branchLink = $.createLink('branch', 'ajaxGetBranches', 'productID=' + row.product);
  9. $.getJSON(branchLink, function(branches)
  10. {
  11. if(!branches.length)
  12. {
  13. info[0].render({disabled: 'disabled'});
  14. }
  15. else
  16. {
  17. let $branch = info[0];
  18. $branch.render({items: branches});
  19. $branch.$.setValue(row.branch);
  20. }
  21. });
  22. });
  23. }
  24. /* Set the modules for the row. */
  25. $row.find('.form-batch-control[data-name="module"] .picker-box').on('inited', function(e, info)
  26. {
  27. let $module = info[0];
  28. $module.render({items: modulePairs[row.id]});
  29. $module.$.setValue(row.module);
  30. });
  31. $row.find('.form-batch-control[data-name="story"] .picker-box').on('inited', function(e, info)
  32. {
  33. const storyLink = $.createLink('story', 'ajaxGetProductStories', 'productID=' + row.product + '&branch=' + row.branch + '&moduleID=' + row.module + '&storyID=' + row.story + '&onlyOption=false&status=active&limit=0&type=&hasParent=0');
  34. $.getJSON(storyLink, function(stories)
  35. {
  36. let $story = info[0];
  37. $story.render({items: stories});
  38. $story.$.setValue(row.story);
  39. });
  40. });
  41. /* Set the scenes for the row. */
  42. $row.find('.form-batch-control[data-name="scene"] .picker-box').on('inited', function(e, info)
  43. {
  44. let $scene = info[0];
  45. $scene.render({items: scenePairs[row.id]});
  46. $scene.$.setValue(row.scene);
  47. });
  48. }