(bug)(admin) fix timesheets ('transferMethod is readonly')

This commit is contained in:
Andrea Vos 2024-09-23 23:14:48 +02:00
parent f795186d81
commit 6046815f05

View File

@ -87,6 +87,7 @@
</div> </div>
<section> <section>
<Debug :v="transferMethod"/>
<p> <p>
<strong>Transfer method:</strong> <strong>Transfer method:</strong>
<span v-for="(label, value) in transferMethods" class="form-check form-check-inline"> <span v-for="(label, value) in transferMethods" class="form-check form-check-inline">
@ -187,12 +188,29 @@ export default {
months: MONTHS, months: MONTHS,
transferMethods: TRANSFER_METHODS, transferMethods: TRANSFER_METHODS,
timesheet: this.buildTimesheet(this.persistent),
transferMethod: this.persistent?.transfer || '',
transferDetails: {
bank_name: this.persistent?.details?.bank_name || '',
bank_iban: this.persistent?.details?.bank_iban || '',
bank_bic: this.persistent?.details?.bank_bic || '',
paypal_email: this.persistent?.details?.paypal_email || '',
charity_name: this.persistent?.details?.charity_name || '',
charity_url: this.persistent?.details?.charity_url || '',
notes: this.persistent?.details?.notes || '',
},
focusMonth: null, focusMonth: null,
focusArea: null, focusArea: null,
}; };
}, },
computed: { watch: {
timesheet() { year() {
this.$refs['cell-1-0'][0].focus();
},
},
methods: {
buildTimesheet(persistent) {
const timesheet = {}; const timesheet = {};
for (let y = min.year; y <= max.year; y++) { for (let y = min.year; y <= max.year; y++) {
timesheet[y] = {}; timesheet[y] = {};
@ -202,33 +220,12 @@ export default {
} }
timesheet[y][m] = {}; timesheet[y][m] = {};
for (const area of AREAS) { for (const area of AREAS) {
timesheet[y][m][area] = this.persistent?.timesheet?.[y]?.[m]?.[area] || 0; timesheet[y][m][area] = persistent?.timesheet?.[y]?.[m]?.[area] || 0;
} }
} }
} }
return timesheet; return timesheet;
}, },
transferMethod() {
return this.persistent?.transfer || '';
},
transferDetails() {
return {
bank_name: this.persistent?.details?.bank_name || '',
bank_iban: this.persistent?.details?.bank_iban || '',
bank_bic: this.persistent?.details?.bank_bic || '',
paypal_email: this.persistent?.details?.paypal_email || '',
charity_name: this.persistent?.details?.charity_name || '',
charity_url: this.persistent?.details?.charity_url || '',
notes: this.persistent?.details?.notes || '',
};
},
},
watch: {
year() {
this.$refs['cell-1-0'][0].focus();
},
},
methods: {
dt(year, month) { dt(year, month) {
return DateTime.local(parseInt(year), parseInt(month), 1); return DateTime.local(parseInt(year), parseInt(month), 1);
}, },