From b1b3af130e0be2892229a6b82f95df37edf81233 Mon Sep 17 00:00:00 2001 From: Arsenije Savic Date: Tue, 26 Sep 2023 12:35:19 -0600 Subject: [PATCH] fix(proposal): edit assigment proposal --- src/pages/proposals/ProposalDetail.vue | 7 ++- src/pages/proposals/create/StepDuration.vue | 1 - src/store/proposals/index.js | 58 +++++++++++++++------ 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/pages/proposals/ProposalDetail.vue b/src/pages/proposals/ProposalDetail.vue index 16e53c95e..9289ee0e3 100644 --- a/src/pages/proposals/ProposalDetail.vue +++ b/src/pages/proposals/ProposalDetail.vue @@ -200,6 +200,7 @@ const PROPOSAL_QUERY = ` } start { + docId details_startTime_t } @@ -1460,15 +1461,13 @@ export default { } if (this.proposal?.__typename === PROPOSAL_TYPE.ROLE) { // Role Assignment - const tier = this.tiers.find(tier => tier.label === (this.proposal?.salaryband?.[0]?.details_name_s || DEFAULT_TIER)) + const tier = this.tiers.find(tier => tier.label === (this.proposal?.salaryband?.[0]?.name || DEFAULT_TIER)) // const archetype = this.archetypes.find(archetype => archetype.label === this.proposal?.salaryband?.[0]?.assignment?.[0]?.role?.[0]?.system_nodeLabel_s) this.$store.commit('proposals/setRole', { value: this.proposal?.role[0] }) - - // this.$store.commit('proposals/setRole', archetype) this.$store.commit('proposals/setTier', tier) - this.$store.commit('proposals/setAnnualUsdSalary', this.proposal?.details_annualUsdSalary_a.split(' ')[0]) + this.$store.commit('proposals/setAnnualUsdSalary', parseFloat(tier.value.annualAmount.split(' ')[0])) this.$store.commit('proposals/setMinDeferred', tier?.value?.minDeferred || 0) this.$store.commit('proposals/setMinCommitment', 0) diff --git a/src/pages/proposals/create/StepDuration.vue b/src/pages/proposals/create/StepDuration.vue index cd7284603..fd7615706 100644 --- a/src/pages/proposals/create/StepDuration.vue +++ b/src/pages/proposals/create/StepDuration.vue @@ -224,7 +224,6 @@ widget q-icon(size="xs" name="fa fa-calendar-alt") q-date.bg-internal-bg.calendar.absolute.z-top( :options="isDateAvaiable" - @input="onDateChanged" @navigation="onDateNavigate" minimal="minimal" ref="calendar" diff --git a/src/store/proposals/index.js b/src/store/proposals/index.js index cd47a27d9..6c8ae58a9 100644 --- a/src/store/proposals/index.js +++ b/src/store/proposals/index.js @@ -603,9 +603,12 @@ export default { { label: 'title', value: ['string', draft.title] }, { label: 'description', value: ['string', draft.description] }, { label: 'url', value: ['string', draft.url] }, - { label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] }, - { label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] }, - { label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] }, + + { label: 'deferred_perc_x100', value: ['int64', draft?.deferred || 0] }, + { label: 'usd_amount', value: ['asset', `${parseFloat(draft.usdAmount.toFixed(2))} USD`] }, + // { label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] }, + // { label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] }, + // { label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] }, { label: 'voice_amount', value: ['asset', `${parseFloat(draft.voice).toFixed(rootState.dao.settings.voiceTokenDecimals)} ${rootState.dao.settings.voiceToken}`] }, ...(rootState.dao.settings.rewardToken @@ -881,18 +884,28 @@ export default { { label: 'title', value: ['string', draft.title] }, { label: 'description', value: ['string', draft.description] }, { label: 'url', value: ['string', draft.url] }, - { label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] }, - { label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] }, - { label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] }, + + { label: 'deferred_perc_x100', value: ['int64', draft?.deferred || 0] }, + { label: 'usd_amount', value: ['asset', `${parseFloat(draft.usdAmount.toFixed(2))} USD`] }, + // { label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] }, + // { label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] }, + // { label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] }, { label: 'voice_amount', value: ['asset', `${parseFloat(draft.voice).toFixed(rootState.dao.settings.voiceTokenDecimals)} ${rootState.dao.settings.voiceToken}`] }, - { label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] }, - { label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] }, + ...(rootState.dao.settings.rewardToken + ? [{ label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] }] + : [] + ), + ...(rootState.dao.settings.pegToken + ? [{ label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] }] + : [] + ), { label: 'start_period', value: ['int64', draft.startPeriod.docId] }, { label: 'period_count', value: ['int64', draft.periodCount] }, - { label: 'recipient', value: ['name', rootState.accounts.account] }, - ...(draft.parentId ? [{ label: 'quest_start', value: ['int64', draft.parentId] }] : []) + { label: 'recipient', value: ['name', rootState.accounts.account] } + // ...(draft.circle ? [{ label: 'circle_id', value: ['int64', draft.circle.value] }] : []), + // ...(draft.parentQuest ? [{ label: 'quest_start', value: ['int64', draft.parentQuest.value] }] : []) ] break @@ -902,18 +915,28 @@ export default { { label: 'title', value: ['string', draft.title] }, { label: 'description', value: ['string', draft.description] }, { label: 'url', value: ['string', draft.url] }, - { label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] }, - { label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] }, - { label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] }, + + { label: 'deferred_perc_x100', value: ['int64', draft?.deferred || 0] }, + { label: 'usd_amount', value: ['asset', `${parseFloat(draft.usdAmount.toFixed(2))} USD`] }, + // { label: 'annual_usd_salary', value: ['asset', `${parseFloat(draft.annualUsdSalary).toFixed(2)} USD`] }, + // { label: 'fulltime_capacity_x100', value: ['int64', Math.round(parseFloat(draft.roleCapacity) * 100)] }, + // { label: 'min_deferred_x100', value: ['int64', Math.round(parseFloat(draft.minDeferred))] }, { label: 'voice_amount', value: ['asset', `${parseFloat(draft.voice).toFixed(rootState.dao.settings.voiceTokenDecimals)} ${rootState.dao.settings.voiceToken}`] }, - { label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] }, - { label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] }, + ...(rootState.dao.settings.rewardToken + ? [{ label: 'reward_amount', value: ['asset', `${parseFloat(draft.reward).toFixed(rootState.dao.settings.rewardTokenDecimals)} ${rootState.dao.settings.rewardToken}`] }] + : [] + ), + ...(rootState.dao.settings.pegToken + ? [{ label: 'peg_amount', value: ['asset', `${parseFloat(draft.peg).toFixed(rootState.dao.settings.pegTokenDecimals)} ${rootState.dao.settings.pegToken}`] }] + : [] + ), { label: 'start_period', value: ['int64', draft.startPeriod.docId] }, { label: 'period_count', value: ['int64', draft.periodCount] }, - { label: 'recipient', value: ['name', rootState.accounts.account] }, - ...(draft.parentId ? [{ label: 'quest_start', value: ['int64', draft.parentId] }] : []) + { label: 'recipient', value: ['name', rootState.accounts.account] } + // ...(draft.circle ? [{ label: 'circle_id', value: ['int64', draft.circle.value] }] : []), + // ...(draft.parentQuest ? [{ label: 'quest_start', value: ['int64', draft.parentQuest.value] }] : []) ] break } @@ -927,6 +950,7 @@ export default { content_groups: [content] } }] + console.log(JSON.parse(JSON.stringify(actions))) return this.$api.signTransaction(actions) } } catch (e) {