mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
Merge branch 'master' into 3536-feature-modify-frontend-for-cross-community-redeem-link-disbursement
This commit is contained in:
commit
2743d55fa3
@ -163,10 +163,14 @@ const validationSchema = computed(() => {
|
|||||||
.min(5, ({ min }) => ({ key: 'form.validation.contributionMemo.min', values: { min } }))
|
.min(5, ({ min }) => ({ key: 'form.validation.contributionMemo.min', values: { min } }))
|
||||||
.max(512, ({ max }) => ({ key: 'form.validation.contributionMemo.max', values: { max } }))
|
.max(512, ({ max }) => ({ key: 'form.validation.contributionMemo.max', values: { max } }))
|
||||||
.required('form.validation.contributionMemo.required'),
|
.required('form.validation.contributionMemo.required'),
|
||||||
hours: number()
|
hours: string()
|
||||||
.typeError({ key: 'form.validation.hours.typeError', values: { min: 0.01, max: maxHours } })
|
.typeError({ key: 'form.validation.hours.typeError', values: { min: 0.01, max: maxHours } })
|
||||||
.required()
|
.required()
|
||||||
// .transform((value, originalValue) => (originalValue === '' ? undefined : value))
|
.transform((currentValue) =>
|
||||||
|
!currentValue || typeof currentValue !== 'string'
|
||||||
|
? currentValue
|
||||||
|
: currentValue.replace(',', '.'),
|
||||||
|
)
|
||||||
.min(0.01, ({ min }) => ({ key: 'form.validation.hours.min', values: { min } }))
|
.min(0.01, ({ min }) => ({ key: 'form.validation.hours.min', values: { min } }))
|
||||||
.max(maxHours, ({ max }) => ({ key: 'form.validation.hours.max', values: { max } }))
|
.max(maxHours, ({ max }) => ({ key: 'form.validation.hours.max', values: { max } }))
|
||||||
.test('decimal-places', 'form.validation.hours.decimal-places', (value) => {
|
.test('decimal-places', 'form.validation.hours.decimal-places', (value) => {
|
||||||
@ -217,7 +221,8 @@ const updateField = (newValue, name) => {
|
|||||||
if (typeof name === 'string' && name.length) {
|
if (typeof name === 'string' && name.length) {
|
||||||
form[name] = newValue
|
form[name] = newValue
|
||||||
if (name === 'hours') {
|
if (name === 'hours') {
|
||||||
const amount = form.hours ? hoursToAmount(form.hours) : GDD_PER_HOUR
|
const hoursTransformed = validationSchema.value.fields.hours.cast(newValue)
|
||||||
|
const amount = hoursTransformed ? hoursToAmount(hoursTransformed) : GDD_PER_HOUR
|
||||||
form.amount = amount.toString()
|
form.amount = amount.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user