diff --git a/ui/src/router/views/import-generic.vue b/ui/src/router/views/import-generic.vue index 594017d..0cd4a07 100644 --- a/ui/src/router/views/import-generic.vue +++ b/ui/src/router/views/import-generic.vue @@ -37,7 +37,7 @@ export default { odoReading: null, isTankFull: null, hasMissedFillup: null, - comments: null, // [int] + comments: [], // [int] fillingStation: null, date: null, fuelSubType: null, @@ -94,7 +94,7 @@ export default { }, '') } const calculateTotal = (row) => { - return this.fileHeadingMap.totalAmount === -1 + return this.fileHeadingMap.totalAmount === "-1" ? (row[this.fileHeadings.fuelQuantity] * row[this.fileHeadings.perUnitPrice]).toFixed(2) : row[this.fileHeadingMap.totalAmount] } @@ -120,8 +120,13 @@ export default { item[k] = calculateTotal(row) } else if (this.isFullTankString) { item[k] = setFullTank(row) - } else if (this.invertFullTank) { - item[k] = !row[headings[k]] + } else if (k === 'isTankFull') { + if (this.invertFullTank) { + item[k] = Boolean(!row[headings[k]]) + } else { + item[k] = Boolean(row[headings[k]]) + } + } else if (k === 'hasMissedFillup') { } else if (k === 'date') { item[k] = new Date(row[headings[k]]).toISOString() } else { @@ -157,8 +162,9 @@ export default { position: 'is-bottom', type: 'is-danger', }) - if (ex.response && ex.response.data.errors) { - this.errors = ex.response.data.errors + console.log(ex) + if (ex.response && ex.response.data.error) { + this.errors.push(ex.response.data.error) } }) } catch (e) { @@ -171,14 +177,10 @@ export default { }, checkFieldString() { const tankFull = this.fileData[1][this.fileHeadingMap.isTankFull] - if (typeof tankFull !== 'boolean') { - if (typeof tankFull === 'string' && tankFull.length > 0) { - this.isFullTankString = true - } else { - this.errors.push('The value of Tank Full needs to be a boolean (true,false) or consistent string.') - } + if (typeof tankFull !== 'boolean' && typeof tankFull === 'string') { + this.isFullTankString = true } - }, + } }, } @@ -200,9 +202,7 @@ export default {
  • {{ $t('importhintvehiclecreated') }}
  • -
  • {{ $t('dontimportagain') }}
  • +
  • {{ $t('dontimportagain') }}
  • @@ -270,7 +270,8 @@ export default { - +
    - +

    There was an error logging in to your account.