Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions src/views/CreateNewCardCustomPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ import Description from '../components/card/Description.vue'
import CardPlusOutline from 'vue-material-design-icons/CardPlusOutline.vue'
import FormatColumnsIcon from 'vue-material-design-icons/FormatColumns.vue'
import DeckIcon from '../components/icons/DeckIcon.vue'
import { showError } from '../helpers/errors.js'

const cardApi = new CardApi()
const apiClient = new BoardApi()
Expand Down Expand Up @@ -216,7 +217,7 @@ export default {
fetchBoards() {
axios.get(generateUrl('/apps/deck/boards')).then((response) => {
this.boards = response.data.filter((board) => {
return board?.permissions?.PERMISSION_EDIT
return board?.permissions?.PERMISSION_EDIT && !board?.archived && !board?.deletedAt
})
this.loading = false
})
Expand All @@ -239,19 +240,30 @@ export default {
},
async createCard() {
this.creating = true
const response = await cardApi.addCard({
boardId: this.selectedBoard.id,
stackId: this.selectedStack.id,
title: this.card.title,
description: this.card.description,
duedate: this.card.duedate,
labels: this.card.labels.map(label => label.id),
users: this.card.assignedUsers.map(user => { return { id: user.uid, type: user.type } }),
})
this.newCard = response
this.creating = false
this.created = true
this.$emit('submit', window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck') + `/card/${this.newCard.id}`)

try {
const response = await cardApi.addCard({
boardId: this.selectedBoard.id,
stackId: this.selectedStack.id,
title: this.card.title,
description: this.card.description,
duedate: this.card.duedate,
labels: this.card.labels.map(label => label.id),
users: this.card.assignedUsers.map(user => {
return {
id: user.uid,
type: user.type,
}
}),
})
this.newCard = response
this.creating = false
this.created = true
this.$emit('submit', window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck') + `/card/${this.newCard.id}`)
} catch (e) {
this.creating = false
showError(e)
}
},
onSelectLabel(label) {
this.card.labels.push(label)
Expand Down