From 182a5048b86db6b0e6ef531b7b4ebd22ea44cc3b Mon Sep 17 00:00:00 2001 From: Evgeni B Date: Wed, 6 Sep 2023 16:02:50 +0300 Subject: [PATCH] fix(proposal): edit badge requrring assignments (#DEV-917) (#2417) --- src/pages/proposals/ProposalDetail.vue | 4 ++-- src/pages/proposals/create/StepDetails.vue | 4 ++-- src/store/proposals/index.js | 12 ++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/pages/proposals/ProposalDetail.vue b/src/pages/proposals/ProposalDetail.vue index 676ffb8a7..7a32507ae 100644 --- a/src/pages/proposals/ProposalDetail.vue +++ b/src/pages/proposals/ProposalDetail.vue @@ -1336,8 +1336,8 @@ export default { // this.$store.commit('proposals/setMinDeferred', this.proposal?.role[0]?.details_minDeferredX100_i) } - if (this.proposal.__typename === PROPOSAL_TYPE.ABILITY) { // Badge Assignment - this.$store.commit('proposals/setBadge', this?.proposal.badge) + if (this.proposal.__typename === PROPOSAL_TYPE.ABILITY || this.proposal.__typename === PROPOSAL_TYPE.ASSIGNBADGE) { // Badge Assignment + this.$store.commit('proposals/setBadge', this?.proposal.badge?.[0]) this.$store.commit('proposals/setStartPeriod', this.proposal?.start[0]) this.$store.commit('proposals/setPeriodCount', this.proposal?.details_periodCount_i) } diff --git a/src/pages/proposals/create/StepDetails.vue b/src/pages/proposals/create/StepDetails.vue index 3d38c7cd5..ba55f10e6 100644 --- a/src/pages/proposals/create/StepDetails.vue +++ b/src/pages/proposals/create/StepDetails.vue @@ -160,10 +160,10 @@ widget section.q-mt-xl .col.q-mt-sm(v-if="fields.title") label.h-label {{ fields.title.label }} - q-input.q-mt-xs.rounded-border(:disable="isEditing || isProposalType(PROPOSAL_TYPE.ABILITY)" :placeholder="fields.title.placeholder" :rules="[val => !!val || $t('pages.proposals.create.stepdetails.titleIsRequired'), val => (val.length <= TITLE_MAX_LENGTH) || $t('pages.proposals.create.stepdetails.proposalTitleLengthHasToBeLess', { TITLE_MAX_LENGTH: TITLE_MAX_LENGTH, length: title.length })]" dense outlined v-model="title") + q-input.q-mt-xs.rounded-border(:disable="isEditing || isProposalType(PROPOSAL_TYPE.ABILITY) || isProposalType(PROPOSAL_TYPE.ASSIGNBADGE)" :placeholder="fields.title.placeholder" :rules="[val => !!val || $t('pages.proposals.create.stepdetails.titleIsRequired'), val => (val.length <= TITLE_MAX_LENGTH) || $t('pages.proposals.create.stepdetails.proposalTitleLengthHasToBeLess', { TITLE_MAX_LENGTH: TITLE_MAX_LENGTH, length: title.length })]" dense outlined v-model="title") .col.q-mt-sm(v-if="fields.description") label.h-label {{ fields.description.label }} - q-field.q-mt-xs.rounded-border(:rules="[rules.required, val => this.$sanitize(val, { allowedTags: [] }).length < DESCRIPTION_MAX_LENGTH || $t('pages.proposals.create.stepdetails.theDescriptionMustContainLess', { DESCRIPTION_MAX_LENGTH: DESCRIPTION_MAX_LENGTH, length: this.$sanitize(description, { allowedTags: [] }).length })]" dense maxlength="4000" outlined ref="bio" stack-label v-model="description" :disable="isProposalType(PROPOSAL_TYPE.ABILITY)") + q-field.q-mt-xs.rounded-border(:rules="[rules.required, val => this.$sanitize(val, { allowedTags: [] }).length < DESCRIPTION_MAX_LENGTH || $t('pages.proposals.create.stepdetails.theDescriptionMustContainLess', { DESCRIPTION_MAX_LENGTH: DESCRIPTION_MAX_LENGTH, length: this.$sanitize(description, { allowedTags: [] }).length })]" dense maxlength="4000" outlined ref="bio" stack-label v-model="description" :disable="isProposalType(PROPOSAL_TYPE.ABILITY) || isProposalType(PROPOSAL_TYPE.ASSIGNBADGE)") input-editor.full-width(:placeholder="fields.description.placeholder" :toolbar="[['bold', 'italic', /*'strike', 'underline'*/],['token', 'hr', 'link', 'custom_btn'],['quote', 'unordered', 'ordered']]" flat ref="editorRef" v-model="description") .col.q-mt-sm(v-if="fields.circle") label.h-label {{ fields.circle.label }} diff --git a/src/store/proposals/index.js b/src/store/proposals/index.js index 42aa6016b..cda89b963 100644 --- a/src/store/proposals/index.js +++ b/src/store/proposals/index.js @@ -744,6 +744,18 @@ export default { ] break + case PROPOSAL_TYPE.ASSIGNBADGE: + content = [ + { label: 'content_group_label', value: ['string', 'details'] }, + { label: 'assignee', value: ['name', rootState.accounts.account] }, + { label: 'title', value: ['string', draft.title] }, + { label: 'description', value: ['string', draft.description] }, + { label: 'badge', value: ['int64', draft.badge.docId] }, + { label: 'start_period', value: ['int64', draft.startPeriod.docId] }, + { label: 'period_count', value: ['int64', draft.periodCount] } + ] + break + case PROPOSAL_TYPE.ARCHETYPE: content = [ { label: 'content_group_label', value: ['string', 'details'] },