ajaxselectstory.html.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace zin;
  3. featureBar(li
  4. (
  5. setClass('nav-item'),
  6. a(setClass('active'), $lang->testcase->selectStory)
  7. ));
  8. $cols = array();
  9. $cols['id'] = $config->story->dtable->fieldList['id'];
  10. $cols['pri'] = $config->story->dtable->fieldList['pri'];
  11. $cols['module'] = $config->story->dtable->fieldList['module'];
  12. $cols['title'] = $config->story->dtable->fieldList['title'];
  13. $cols['stage'] = $config->story->dtable->fieldList['stage'];
  14. $cols['openedBy'] = $config->story->dtable->fieldList['openedBy'];
  15. $cols['estimate'] = $config->story->dtable->fieldList['estimate'];
  16. $cols['title']['data-toggle'] = 'modal';
  17. $cols['title']['data-size'] = 'lg';
  18. $cols['module']['map'] = $modules;
  19. foreach($cols as $colKey => $col) $cols[$colKey]['sortType'] = false;
  20. $footToolbarGroup = array('type' => 'class', 'component' => 'div', 'className' => 'input-group size-sm');
  21. $footToolbarGroup['html'] = "<input type='text' class='form-control w-14' autocomplete='off' name='num' value='10' id='num'><select class='form-control w-14' name='fileType'><option value='xlsx'>xlsx</option><option value='xls'>xls</option></select><button type='submit' class='btn primary' >{$lang->testcase->exportTemplate}</button>";
  22. form
  23. (
  24. setID('selectStoryForm'),
  25. set::url($this->createLink('testcase', 'exportTemplate', "productID={$product->id}")),
  26. set::ajax(array('beforeSubmit' => jsRaw('clickSubmit'))),
  27. set::actions(array()),
  28. dtable
  29. (
  30. set::userMap($users),
  31. set::cols($cols),
  32. set::data($stories),
  33. set::checkable(true),
  34. set::loadPartial(true),
  35. set::showToolbarOnChecked(false),
  36. set::footToolbar(array($footToolbarGroup)),
  37. set::footPager(usePager())
  38. )
  39. );
  40. pageJS(<<<JAVASCRIPT
  41. window.clickSubmit = function(e)
  42. {
  43. const checkedList = zui.DTable.query($(e.target).find('.dtable')).$.getChecks();
  44. if(!checkedList.length) return;
  45. const \$form = $(e.target);
  46. checkedList.forEach((id) => \$form.append('<input name="stories[]" value="' + id +'">'));
  47. $('.modal').modal('hide');
  48. }
  49. JAVASCRIPT
  50. );
  51. render();