dialogWithBoardSwimlaneListCard.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { DialogWithBoardSwimlaneList } from '/client/lib/dialogWithBoardSwimlaneList';
  2. export class DialogWithBoardSwimlaneListCard extends DialogWithBoardSwimlaneList {
  3. getDefaultOption(boardId) {
  4. const ret = {
  5. 'boardId' : "",
  6. 'swimlaneId' : "",
  7. 'listId' : "",
  8. 'cardId': "",
  9. }
  10. return ret;
  11. }
  12. /** returns if the card id was the last confirmed one
  13. * @param cardId check this card id
  14. * @return if the card id was the last confirmed one
  15. */
  16. isDialogOptionCardId(cardId) {
  17. let ret = this.cardOption.cardId == cardId;
  18. return ret;
  19. }
  20. /** returns all available cards of the current list */
  21. cards() {
  22. const list = Lists.findOne(this.selectedListId.get());
  23. const ret = list.cards(this.selectedSwimlaneId.get());
  24. return ret;
  25. }
  26. events() {
  27. return [
  28. {
  29. 'click .js-done'() {
  30. const boardSelect = this.$('.js-select-boards')[0];
  31. const boardId = boardSelect.options[boardSelect.selectedIndex].value;
  32. const listSelect = this.$('.js-select-lists')[0];
  33. const listId = listSelect.options[listSelect.selectedIndex].value;
  34. const swimlaneSelect = this.$('.js-select-swimlanes')[0];
  35. const swimlaneId = swimlaneSelect.options[swimlaneSelect.selectedIndex].value;
  36. const cardSelect = this.$('.js-select-cards')[0];
  37. const cardId = cardSelect.options[cardSelect.selectedIndex].value;
  38. const options = {
  39. 'boardId' : boardId,
  40. 'swimlaneId' : swimlaneId,
  41. 'listId' : listId,
  42. 'cardId': cardId,
  43. }
  44. this.setDone(cardId, options);
  45. Popup.back(2);
  46. },
  47. 'change .js-select-boards'(event) {
  48. const boardId = $(event.currentTarget).val();
  49. this.getBoardData(boardId);
  50. },
  51. 'change .js-select-swimlanes'(event) {
  52. this.selectedSwimlaneId.set($(event.currentTarget).val());
  53. },
  54. 'change .js-select-lists'(event) {
  55. this.selectedListId.set($(event.currentTarget).val());
  56. },
  57. },
  58. ];
  59. }
  60. }