Skip to content

Commit

Permalink
fix(proposal): edit assigment proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenijesavic committed Sep 26, 2023
1 parent 5d7b208 commit b1b3af1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 22 deletions.
7 changes: 3 additions & 4 deletions src/pages/proposals/ProposalDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const PROPOSAL_QUERY = `
}

start {
docId
details_startTime_t
}

Expand Down Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion src/pages/proposals/create/StepDuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
58 changes: 41 additions & 17 deletions src/store/proposals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
}
Expand All @@ -927,6 +950,7 @@ export default {
content_groups: [content]
}
}]
console.log(JSON.parse(JSON.stringify(actions)))

Check failure on line 953 in src/store/proposals/index.js

View workflow job for this annotation

GitHub Actions / build-dev

Unexpected console statement

Check failure on line 953 in src/store/proposals/index.js

View workflow job for this annotation

GitHub Actions / build-dev

Unexpected console statement
return this.$api.signTransaction(actions)
}
} catch (e) {
Expand Down

0 comments on commit b1b3af1

Please sign in to comment.