//= require ./lists_dropdown /* global Vue */ (() => { const ModalStore = gl.issueBoards.ModalStore; window.gl = window.gl || {}; window.gl.issueBoards = window.gl.issueBoards || {}; gl.issueBoards.ModalFooter = Vue.extend({ data() { return ModalStore.store; }, computed: { submitDisabled() { return !ModalStore.selectedCount(); }, submitText() { const count = ModalStore.selectedCount(); return `Add ${count} issue${count > 1 || !count ? 's' : ''}`; }, }, methods: { hideModal() { this.showAddIssuesModal = false; }, addIssues() { const list = this.selectedList; const issueIds = this.selectedIssues.map(issue => issue.id); // Post the data to the backend gl.boardService.addMultipleIssues(list, issueIds); // Add the issues on the frontend issueIds.forEach((id) => { const issue = this.issues.filter(fIssue => fIssue.id === id)[0]; list.addIssue(issue); list.issuesSize += 1; }); this.hideModal(); }, }, components: { 'lists-dropdown': gl.issueBoards.ModalFooterListsDropdown, }, template: ` `, }); })();