Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(step-payout): add custom input for default tier #2415

Merged
merged 3 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ export const PERIOD_NUMBERS = Object.freeze({
SECS_PER_YEAR: 31557600,
CYCLE_DURATION_SEC: 2629800
})

export const DEFAULT_TIER = 'Custom Reward'
Alex-IS marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 1 addition & 19 deletions src/pages/proposals/create/StepPayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ export default {
}
},

// '$store.state.proposals.draft.type': {
// immediate: true,
// handler () {
// this.custom = false
// }
// },

'$store.state.proposals.draft.annualUsdSalary': {
immediate: true,
handler (val) {
Expand Down Expand Up @@ -124,11 +117,7 @@ export default {
} else if (proposalType === 'contribution' && (!this.usdAmount || this.usdAmount <= 0) && !this.custom) {
return true
}
// if (!this.usdAmount && this.$store.state.proposals.draft.category.key !== 'assignment') {
// return true
// } else if (!this.annualUsdSalary && this.$store.state.proposals.draft.category.key !== 'archetype') {
// return true
// }

return false
},

Expand Down Expand Up @@ -296,12 +285,6 @@ export default {
return proposalType === 'contribution'
}
},
// mounted () {
// if (!this.pegCoefficientLabel) {
// this.$store.commit('proposals/setPegCoefficientLabel', 0)
// this.$store.commit('proposals/setPegCoefficient', this.calculateCoefficient(0))
// }
// },

methods: {
isValidCommitment (commitment) {
Expand Down Expand Up @@ -338,7 +321,6 @@ export default {
},

calculateCoefficient (coefficient) {
// if (!coefficient || coefficient === 0) return 0
return ((coefficient * 100) + 10000)
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/pages/proposals/create/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ export default {
label: I18n.t('proposal-creation.manageYourSalary'),
description: I18n.t('proposal-creation.fieldsBelowDisplayTheMinimum')
},
annualUsdSalaryCustom: {
key: 'annualUsdSalaryCustom',
label: I18n.t('proposal-creation.totalUSDEquivalent'),
type: 'asset'
},
commitment: {
key: 'commitment',
label: I18n.t('proposal-creation.chooseYourCommitmentLevel'),
Expand Down
16 changes: 10 additions & 6 deletions src/store/proposals/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Storage from '~/localStorage/storage'
import { PROPOSAL_TYPE, PERIOD_NUMBERS } from '~/const'
import { PROPOSAL_TYPE, PERIOD_NUMBERS, DEFAULT_TIER } from '~/const'
/**
* This vuex data store contains the data needed in the proposal creation wizard.
*/
Expand Down Expand Up @@ -514,11 +514,15 @@ export default {
{ label: 'description', value: ['string', draft.description] },
{ label: 'url', value: ['string', draft.url] },

{ label: 'salary_band_id', value: ['int64', draft.tier.value.id] },
// TODO: if salary_band_id is not present these are required
// { 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))] },
...(draft.tier.value.name !== DEFAULT_TIER
? [
{ label: 'salary_band_id', value: ['int64', draft.tier.value.id] }
]
: [
{ 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: 'time_share_x100', value: ['int64', draft.commitment] },
{ label: 'deferred_perc_x100', value: ['int64', draft.deferred] },
Expand Down
Loading