diff --git a/src/pages/proposals/ProposalDetail.vue b/src/pages/proposals/ProposalDetail.vue index 8bc7c5669..f99e4bde7 100644 --- a/src/pages/proposals/ProposalDetail.vue +++ b/src/pages/proposals/ProposalDetail.vue @@ -959,7 +959,7 @@ export default { // }, result (data) { - if ((data.data.getDocument.dao[0].details_daoName_n !== this.selectedDao.name) && !this.isBadge) { + if ((data?.data?.getDocument?.dao[0]?.details_daoName_n !== this?.selectedDao?.name) && !this.isBadge) { this.$router.push({ name: '404-not-found' }) } } @@ -1054,7 +1054,7 @@ export default { commentSectionId () { return this?.proposal?.cmntsect[0].docId }, ownAssignment () { - return (this.proposal.__typename === PROPOSAL_TYPE.ROLE || this.proposal.__typename === PROPOSAL_TYPE.ABILITY) && + return (this?.proposal?.__typename === PROPOSAL_TYPE.ROLE || this?.proposal?.__typename === PROPOSAL_TYPE.ABILITY) && this.proposal.details_assignee_n === this.account && proposalParsing.status(this.proposal) !== PROPOSAL_STATE.PROPOSED && proposalParsing.status(this.proposal) !== PROPOSAL_STATE.REJECTED && @@ -1089,7 +1089,7 @@ export default { loading () { return this.$apollo.queries.proposal.loading }, - isBadge () { return this.proposal.__typename === PROPOSAL_TYPE.BADGE }, + isBadge () { return this.proposal?.__typename === PROPOSAL_TYPE.BADGE }, badgeHolders () { const uniqueHolders = lodash.uniqBy(this.proposal.assignment, 'details_assignee_n') @@ -1177,7 +1177,7 @@ export default { }, onApply (proposal) { - if (proposal.__typename === PROPOSAL_TYPE.BADGE) { + if (proposal?.__typename === PROPOSAL_TYPE.BADGE) { proposal.type = PROPOSAL_TYPE.BADGE // this.$store.commit('proposals/setNext', true) @@ -1199,7 +1199,7 @@ export default { this.saveDraft() this.$router.push({ name: 'proposal-create', params: { draftId } }) } - if (proposal.__typename === PROPOSAL_TYPE.ARCHETYPE) { + if (proposal?.__typename === PROPOSAL_TYPE.ARCHETYPE) { proposal.type = PROPOSAL_TYPE.ARCHETYPE // this.$store.commit('proposals/setNext', true) this.$store.commit('proposals/setType', CONFIG.options.recurring.options.assignment.type) @@ -1286,41 +1286,40 @@ export default { Policy: { key: 'policy', title: 'Policy' }, Quest: { key: 'quest', title: 'Quest' }, Budget: { key: 'circlebudget', title: 'Budget' } - }[this.proposal.__typename] + }[this.proposal?.__typename] - this.$store.commit('proposals/setStepIndex', 1) + this.$store.commit('proposals/setStepIndex', 0) this.$store.commit('proposals/setCategory', category) - this.$store.commit('proposals/setType', this.proposal.__typename) + this.$store.commit('proposals/setType', this.proposal?.__typename) this.$store.commit('proposals/setState', this.proposal?.details_state_s) this.$store.commit('proposals/setProposalId', this.proposal?.docId) this.$store.commit('proposals/setTitle', this.proposal?.details_title_s) this.$store.commit('proposals/setDescription', this.proposal?.details_description_s) + // this.$store.commit('proposals/setCircle', this.proposal?.details_description_s) this.$store.commit('proposals/setUsdAmount', parseFloat(this?.proposal?.details_usdAmount_a)) this.$store.commit('proposals/setCommitment', parseFloat(this?.proposal?.details_timeShareX100_i)) this.$store.commit('proposals/setDeferred', parseFloat(this?.proposal?.details_deferredPercX100_i)) - if (this.proposal.__typename === PROPOSAL_TYPE.CIRCLE) { + this.$store.commit('proposals/setUrl', this.proposal?.details_url_s) + + if (this.proposal?.__typename === PROPOSAL_TYPE.CIRCLE) { this.$store.commit('proposals/setCircle', { label: this.proposal?.parentcircle[0]?.name, value: this.proposal?.parentcircle[0]?.id }) } - if (this.proposal.__typename === PROPOSAL_TYPE.POLICY) { + if (this.proposal?.__typename === PROPOSAL_TYPE.POLICY) { this.$store.commit('proposals/setCircle', { label: this.proposal?.parentcircle[0]?.name, value: this.proposal?.parentcircle[0]?.id }) } - if (this.proposal.__typename === PROPOSAL_TYPE.PAYOUT) { - this.$store.commit('proposals/setUrl', this.proposal?.details_url_s) - } - - if (this.proposal.__typename === PROPOSAL_TYPE.ROLE) { // Role Assignment + if (this.proposal?.__typename === PROPOSAL_TYPE.ROLE) { // Role Assignment const tier = this.tiers.find(tier => tier.label === this.proposal?.salaryband?.[0]?.details_name_s) const archetype = this.archetypes.find(archetype => archetype.label === this.proposal?.salaryband?.[0]?.assignment?.[0]?.role?.[0]?.system_nodeLabel_s) this.$store.commit('proposals/setRole', archetype) @@ -1330,26 +1329,27 @@ export default { this.$store.commit('proposals/setMinDeferred', tier?.value?.minDeferred || 0) this.$store.commit('proposals/setMinCommitment', 0) - this.$store.commit('proposals/setCommitment', parseFloat(1)) - this.$store.commit('proposals/setDeferred', parseFloat(tier.value.minDeferred)) + this.$store.commit('proposals/setCommitment', this.proposal?.details_timeShareX100_i) + this.$store.commit('proposals/setDeferred', parseFloat(this.proposal?.details_deferredPercX100_i)) this.$store.commit('proposals/setStartPeriod', this.proposal?.start[0]) + // this.$store.commit('proposals/setStartDate', this.proposal?.start[0]?.details_startTime_t) this.$store.commit('proposals/setPeriodCount', this.proposal?.details_periodCount_i) // this.$store.commit('proposals/setMinDeferred', this.proposal?.role[0]?.details_minDeferredX100_i) } - if (this.proposal.__typename === PROPOSAL_TYPE.ABILITY || this.proposal.__typename === PROPOSAL_TYPE.ASSIGNBADGE) { // Badge Assignment + 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) } - if (this.proposal.__typename === PROPOSAL_TYPE.ARCHETYPE) { + if (this.proposal?.__typename === PROPOSAL_TYPE.ARCHETYPE) { this.$store.commit('proposals/setAnnualUsdSalary', parseInt(this.proposal?.details_annualUsdSalary_a.split(' ').shift())) this.$store.commit('proposals/setRoleCapacity', this.proposal?.details_fulltimeCapacityX100_i) this.$store.commit('proposals/setMinDeferred', this.proposal?.details_minDeferredX100_i) } - if (this.proposal.__typename === PROPOSAL_TYPE.BADGE) { + if (this.proposal?.__typename === PROPOSAL_TYPE.BADGE) { this.$store.commit('proposals/setBadge', this?.proposal) this.$store.commit('proposals/setPurpose', this.proposal?.details_purpose_s) this.$store.commit('proposals/setIcon', this.proposal?.details_icon_s) @@ -1410,7 +1410,7 @@ export default { await this.$forceUpdate() }, toggle (proposal) { - return proposal.__typename === PROPOSAL_TYPE.ROLE || proposal.__typename === PROPOSAL_TYPE.ARCHETYPE || (proposal.__typename === PROPOSAL_TYPE.EDIT && proposal.original?.[0].role) + return proposal?.__typename === PROPOSAL_TYPE.ROLE || proposal?.__typename === PROPOSAL_TYPE.ARCHETYPE || (proposal?.__typename === PROPOSAL_TYPE.EDIT && proposal.original?.[0].role) }, async fetchComment (commentId) { @@ -1501,7 +1501,7 @@ export default { proposal-item.bottom-no-rounded(v-if="ownAssignment" background="white" :proposal="proposal" :clickable="ownAssignment" :expandable="true" :owner="true" :moons="true" @claim-all="$emit('claim-all')" @change-deferred="(val) => $emit('change-deferred', val)" :selectedDao="selectedDao" :daoSettings="daoSettings" :votingPercentages="votingPercentages") .separator-container(v-if="ownAssignment") q-separator(color="grey-3" inset) - proposal-view(:proposal="optimisticProposal ? optimisticProposal : proposal" :ownAssignment="ownAssignment" :class="{'top-no-rounded': ownAssignment}" :withToggle="toggle(proposal)" :created="proposalParsing.created(proposal)" :restrictions="proposalParsing.restrictions(proposal)" :status="proposalParsing.status(proposal)" :docId="proposalParsing.docId(proposal)" :creator="proposalParsing.creator(proposal)" :capacity="proposalParsing.capacity(proposal)" :deferred="proposalParsing.deferred(proposal)" :description="proposalParsing.description(proposal)" :periodCount="proposalParsing.periodCount(proposal)" :salary="proposalParsing.salary(proposal)" :start="proposalParsing.start(proposal)" :subtitle="!ownAssignment ? proposalParsing.subtitle(proposal) : undefined" :title="!ownAssignment ? proposalParsing.title(proposal) : undefined" :type="proposal.__typename === 'Suspend' ? proposal.suspend[0].__typename : proposal.__typename" :url="proposalParsing.url(proposal)" :icon="proposalParsing.icon(proposal)" :commit="proposalParsing.commit(optimisticProposal ? optimisticProposal : proposal)" :compensation="proposalParsing.compensation(optimisticProposal ? optimisticProposal : proposal, daoSettings)" :tokens="proposalParsing.tokens(optimisticProposal ? optimisticProposal : proposal, periodsOnCycle, daoSettings, isDefaultBadgeMultiplier)" :isBadge="isBadge" :pastQuorum="proposalParsing.pastQuorum(proposal)" :pastUnity="proposalParsing.pastUnity(proposal)" :votingMethod="proposalParsing.votingMethod(proposal)" :parentCircle="proposalParsing.parentCircle(proposal)" @change-deferred="onDeferredUpdate" @change-commit="onCommitUpdate") + proposal-view(:proposal="optimisticProposal ? optimisticProposal : proposal" :ownAssignment="ownAssignment" :class="{'top-no-rounded': ownAssignment}" :withToggle="toggle(proposal)" :created="proposalParsing.created(proposal)" :restrictions="proposalParsing.restrictions(proposal)" :status="proposalParsing.status(proposal)" :docId="proposalParsing.docId(proposal)" :creator="proposalParsing.creator(proposal)" :capacity="proposalParsing.capacity(proposal)" :deferred="proposalParsing.deferred(proposal)" :description="proposalParsing.description(proposal)" :periodCount="proposalParsing.periodCount(proposal)" :salary="proposalParsing.salary(proposal)" :start="proposalParsing.start(proposal)" :subtitle="!ownAssignment ? proposalParsing.subtitle(proposal) : undefined" :title="!ownAssignment ? proposalParsing.title(proposal) : undefined" :type="proposal?.__typename === 'Suspend' ? proposal.suspend[0].__typename : proposal?.__typename" :url="proposalParsing.url(proposal)" :icon="proposalParsing.icon(proposal)" :commit="proposalParsing.commit(optimisticProposal ? optimisticProposal : proposal)" :compensation="proposalParsing.compensation(optimisticProposal ? optimisticProposal : proposal, daoSettings)" :tokens="proposalParsing.tokens(optimisticProposal ? optimisticProposal : proposal, periodsOnCycle, daoSettings, isDefaultBadgeMultiplier)" :isBadge="isBadge" :pastQuorum="proposalParsing.pastQuorum(proposal)" :pastUnity="proposalParsing.pastUnity(proposal)" :votingMethod="proposalParsing.votingMethod(proposal)" :parentCircle="proposalParsing.parentCircle(proposal)" @change-deferred="onDeferredUpdate" @change-commit="onCommitUpdate") comments-widget(v-if="!isBadge" :comments="comments" :disable="expired" @create="createComment" @update="updateComment" @delete="deleteComment" @like="likeComment" @unlike="unlikeComment" @load-comment="fetchComment") .col-12.col-lg-3(v-if="!isBadge" :class="{ 'q-pl-md': $q.screen.gt.md }") widget.bg-primary(v-if="proposalParsing.status(proposal) === PROPOSAL_STATE.DRAFTED && isCreator && state === 'WAITING'") @@ -1559,10 +1559,10 @@ export default { ) .separator-container(v-if="ownAssignment") q-separator(color="grey-3" inset) - proposal-view(:proposal="optimisticProposal ? optimisticProposal : proposal" :ownAssignment="ownAssignment" :class="{'top-no-rounded': ownAssignment}" :withToggle="toggle(proposal)" :created="proposalParsing.created(proposal)" :restrictions="proposalParsing.restrictions(proposal)" :status="proposalParsing.status(proposal)" :docId="proposalParsing.docId(proposal)" :creator="proposalParsing.creator(proposal)" :capacity="proposalParsing.capacity(proposal)" :deferred="proposalParsing.deferred(proposal)" :description="proposalParsing.description(proposal)" :periodCount="proposalParsing.periodCount(proposal)" :salary="proposalParsing.salary(proposal)" :start="proposalParsing.start(proposal)" :subtitle="!ownAssignment ? proposalParsing.subtitle(proposal) : undefined" :title="!ownAssignment ? proposalParsing.title(proposal) : undefined" :type="proposal.__typename === 'Suspend' ? proposal.suspend[0].__typename : proposal.__typename" :url="proposalParsing.url(proposal)" :icon="proposalParsing.icon(proposal)" :commit="proposalParsing.commit(optimisticProposal ? optimisticProposal : proposal)" :compensation="proposalParsing.compensation(optimisticProposal ? optimisticProposal : proposal, daoSettings)" :tokens="proposalParsing.tokens(optimisticProposal ? optimisticProposal : proposal, periodsOnCycle, daoSettings, isDefaultBadgeMultiplier)" :isBadge="isBadge" :pastQuorum="proposalParsing.pastQuorum(proposal)" :pastUnity="proposalParsing.pastUnity(proposal)" :purpose="proposalParsing.purpose(proposal)" :votingMethod="proposalParsing.votingMethod(proposal)" :parentCircle="proposalParsing.parentCircle(proposal)" @change-deferred="onDeferredUpdate" @change-commit="onCommitUpdate") + proposal-view(:proposal="optimisticProposal ? optimisticProposal : proposal" :ownAssignment="ownAssignment" :class="{'top-no-rounded': ownAssignment}" :withToggle="toggle(proposal)" :created="proposalParsing.created(proposal)" :restrictions="proposalParsing.restrictions(proposal)" :status="proposalParsing.status(proposal)" :docId="proposalParsing.docId(proposal)" :creator="proposalParsing.creator(proposal)" :capacity="proposalParsing.capacity(proposal)" :deferred="proposalParsing.deferred(proposal)" :description="proposalParsing.description(proposal)" :periodCount="proposalParsing.periodCount(proposal)" :salary="proposalParsing.salary(proposal)" :start="proposalParsing.start(proposal)" :subtitle="!ownAssignment ? proposalParsing.subtitle(proposal) : undefined" :title="!ownAssignment ? proposalParsing.title(proposal) : undefined" :type="proposal?.__typename === 'Suspend' ? proposal.suspend[0].__typename : proposal?.__typename" :url="proposalParsing.url(proposal)" :icon="proposalParsing.icon(proposal)" :commit="proposalParsing.commit(optimisticProposal ? optimisticProposal : proposal)" :compensation="proposalParsing.compensation(optimisticProposal ? optimisticProposal : proposal, daoSettings)" :tokens="proposalParsing.tokens(optimisticProposal ? optimisticProposal : proposal, periodsOnCycle, daoSettings, isDefaultBadgeMultiplier)" :isBadge="isBadge" :pastQuorum="proposalParsing.pastQuorum(proposal)" :pastUnity="proposalParsing.pastUnity(proposal)" :purpose="proposalParsing.purpose(proposal)" :votingMethod="proposalParsing.votingMethod(proposal)" :parentCircle="proposalParsing.parentCircle(proposal)" @change-deferred="onDeferredUpdate" @change-commit="onCommitUpdate") comments-widget(v-if="!isBadge" :comments="comments" :disable="expired" @create="createComment" @update="updateComment" @delete="deleteComment" @like="likeComment" @unlike="unlikeComment" @load-comment="fetchComment") .col-12.col-sm-3(:class="{ 'q-pl-md': $q.screen.gt.sm }") - widget.q-mb-md.position-relative(v-if="proposalParsing.status(proposal) === PROPOSAL_STATE.APPROVED && proposal.__typename === PROPOSAL_TYPE.QUEST_START && !claimPayments.length" :title="$t('pages.proposals.proposaldetail.questCompletion')") + widget.q-mb-md.position-relative(v-if="proposalParsing.status(proposal) === PROPOSAL_STATE.APPROVED && proposal?.__typename === PROPOSAL_TYPE.QUEST_START && !claimPayments.length" :title="$t('pages.proposals.proposaldetail.questCompletion')") .text-ellipsis.text-body.q-my-xl {{ $t('pages.proposals.proposaldetail.didYouFinish') }} q-btn.full-width.q-mt-xl.q-px-lg(rounded color="primary" no-caps @click="onQuestPayout") {{ $t('pages.proposals.proposaldetail.claimYourPayment') }} widget.bg-primary(v-if="proposalParsing.status(proposal) === PROPOSAL_STATE.DRAFTED && isCreator && state === 'WAITING'") diff --git a/src/pages/proposals/create/StepDuration.vue b/src/pages/proposals/create/StepDuration.vue index 93c6579d9..2fdfd0306 100644 --- a/src/pages/proposals/create/StepDuration.vue +++ b/src/pages/proposals/create/StepDuration.vue @@ -1,18 +1,56 @@ @@ -240,22 +244,35 @@ widget .q-gutter-sm(:class="{ 'row': $q.screen.gt.md }") .col.select-date-block.relative label.h-h7 {{ $t('pages.proposals.create.stepduration.startDate') }} - q-input.rounded-border.col.q-mt-xs(dense outlined rounded v-model="startValue") + q-input.rounded-border.col.q-mt-xs(dense outlined rounded v-model="startDate") template(v-slot:append) q-icon(size="xs" name="fa fa-calendar-alt") - q-date.bg-internal-bg.calendar.absolute.z-top(no-unset :options="datePickerOptions" minimal="minimal" ref="calendar" v-model="startValue" rounded) + q-date.bg-internal-bg.calendar.absolute.z-top( + :options="isDateAvaiable" + @input="onDateChanged" + @navigation="onDateNavigate" + minimal="minimal" + ref="calendar" + rounded + v-model="startDate" + ) + .col label.h-h7 {{ $t('pages.proposals.create.stepduration.periods') }} - q-input.rounded-border.col.q-mt-xs(dense outlined rounded v-model="periodCount") + q-input.rounded-border.col.q-mt-xs(dense outlined rounded v-model="periodCount" :max="MAX_PERIODS") q-tooltip {{ $t('pages.proposals.create.stepduration.1MoonPeriod') }} + .col label.h-h7 {{ $t('pages.proposals.create.stepduration.endDate') }} - q-input.rounded-border.col.q-mt-xs(dense filled rounded disable v-model="dateString") + q-input.rounded-border.col.q-mt-xs(dense filled rounded disable v-model="durationString") + .row.justify-center(v-if="$apolloData.queries.periods.loading") q-spinner-tail(size="md") - .confirm.q-mt-xl(v-if="startIndex >= 0 && endIndex >= 0") + + .confirm.q-mt-xl .text-negative.h-b2.q-ml-xs.text-center(v-if="periodCount >= MAX_PERIODS") {{ $t('pages.proposals.create.stepduration.youMustSelect', { '1': MAX_PERIODS, '2': periodCount }) }} .text-negative.h-b2.q-ml-xs.text-center(v-if="periodCount < 0") {{ $t('pages.proposals.create.stepduration.theStartDate') }} + .next-step.q-mt-xl .row.items-center(:class="{'justify-between': !$store.state.proposals.draft.edit, 'justify-end': $store.state.proposals.draft.edit}") nav.row.justify-end.full-width.q-gutter-xs(v-if="$q.screen.gt.md")