user selects if they track full tank or partial fillup

This commit is contained in:
Alex H
2023-04-13 22:55:09 -04:00
parent 2a8325c6ce
commit e2e4169787
2 changed files with 74 additions and 68 deletions

View File

@@ -5,7 +5,7 @@
"thismonth": "This month", "thismonth": "This month",
"pastxdays": "Past one day | Past {count} days", "pastxdays": "Past one day | Past {count} days",
"pastxmonths": "Past one month | Past {count} months", "pastxmonths": "Past one month | Past {count} months",
"thisyear": "This year", "thisyear": "This year",
"alltime": "All Time", "alltime": "All Time",
"noattachments": "No Attachments so far", "noattachments": "No Attachments so far",
"attachments": "Attachments", "attachments": "Attachments",
@@ -43,15 +43,15 @@
"createnow": "Create Now", "createnow": "Create Now",
"yourvehicles": "Your Vehicles", "yourvehicles": "Your Vehicles",
"menu": { "menu": {
"quickentries": "Quick Entries", "quickentries": "Quick Entries",
"logout": "Log out", "logout": "Log out",
"import": "Import", "import": "Import",
"home": "Home", "home": "Home",
"settings": "Settings", "settings": "Settings",
"admin": "Admin", "admin": "Admin",
"sitesettings": "Site Settings", "sitesettings": "Site Settings",
"users": "Users", "users": "Users",
"login": "Log in" "login": "Log in"
}, },
"enterusername": "Enter your username", "enterusername": "Enter your username",
"enterpassword": "Enter your password", "enterpassword": "Enter your password",
@@ -81,34 +81,34 @@
"quantity": "Quantity", "quantity": "Quantity",
"gasstation": "Gas Station", "gasstation": "Gas Station",
"fuel": { "fuel": {
"petrol": "Petrol", "petrol": "Petrol",
"diesel": "Diesel", "diesel": "Diesel",
"cng": "CNG", "cng": "CNG",
"lpg": "LPG", "lpg": "LPG",
"electric": "Electric", "electric": "Electric",
"ethanol": "Ethanol" "ethanol": "Ethanol"
}, },
"unit": { "unit": {
"long": { "long": {
"litre": "Litre", "litre": "Litre",
"gallon": "Gallon", "gallon": "Gallon",
"kilowatthour": "Kilowatt Hour", "kilowatthour": "Kilowatt Hour",
"kilogram": "Kilogram", "kilogram": "Kilogram",
"usgallon": "US Gallon", "usgallon": "US Gallon",
"minutes": "Minutes", "minutes": "Minutes",
"kilometers": "Kilometers", "kilometers": "Kilometers",
"miles": "Miles" "miles": "Miles"
}, },
"short": { "short": {
"litre": "Lt", "litre": "Lt",
"gallon": "Gal", "gallon": "Gal",
"kilowatthour": "KwH", "kilowatthour": "KwH",
"kilogram": "Kg", "kilogram": "Kg",
"usgallon": "US Gal", "usgallon": "US Gal",
"minutes": "Mins", "minutes": "Mins",
"kilometers": "Km", "kilometers": "Km",
"miles": "Mi" "miles": "Mi"
} }
}, },
"avgfillupqty": "Avg Fillup Qty", "avgfillupqty": "Avg Fillup Qty",
"avgfillupexpense": "Avg Fillup Expense", "avgfillupexpense": "Avg Fillup Expense",
@@ -117,7 +117,9 @@
"price": "Price", "price": "Price",
"total": "Total", "total": "Total",
"fulltank": "Tank Full", "fulltank": "Tank Full",
"partialfillup": "Partial Fillup",
"getafulltank": "Did you get a full tank?", "getafulltank": "Did you get a full tank?",
"tankpartialfull": "Which do you track?",
"by": "By", "by": "By",
"expenses": "Expenses", "expenses": "Expenses",
"expensetype": "Expense Type", "expensetype": "Expense Type",
@@ -182,6 +184,7 @@
"fillingstation": "Filling Station Name", "fillingstation": "Filling Station Name",
"comments": "Comments", "comments": "Comments",
"missfillupbefore": "Did you miss the fillup entry before this one?", "missfillupbefore": "Did you miss the fillup entry before this one?",
"missedfillup": "Missed Fillup",
"fillupdate": "Fillup Date", "fillupdate": "Fillup Date",
"fillupsavedsuccessfully": "Fillup Saved Successfully", "fillupsavedsuccessfully": "Fillup Saved Successfully",
"expensesavedsuccessfully": "Expense Saved Successfully", "expensesavedsuccessfully": "Expense Saved Successfully",
@@ -199,25 +202,25 @@
"testconn": "Test Connection", "testconn": "Test Connection",
"migrate": "Migrate", "migrate": "Migrate",
"init": { "init": {
"migrateclarkson": "Migrate from Clarkson", "migrateclarkson": "Migrate from Clarkson",
"migrateclarksondesc": "If you have an existing Clarkson deployment and you want to migrate your data from that, press the following button.", "migrateclarksondesc": "If you have an existing Clarkson deployment and you want to migrate your data from that, press the following button.",
"freshinstall": "Fresh Install", "freshinstall": "Fresh Install",
"freshinstalldesc": "If you want a fresh install of Hammond, press the following button.", "freshinstalldesc": "If you want a fresh install of Hammond, press the following button.",
"clarkson": { "clarkson": {
"desc": "<p>You need to make sure that this deployment of Hammond can access the MySQL database used by Clarkson.</p><p>If that is not directly possible, you can make a copy of that database somewhere accessible from this instance.</p><p>Once that is done, enter the connection string to the MySQL instance in the following format.</p><p>All the users imported from Clarkson will have their username as their email in Clarkson database and pasword set to<span class='' style='font-weight:bold'>hammond</span></p><code>user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local</code><br/><br/>", "desc": "<p>You need to make sure that this deployment of Hammond can access the MySQL database used by Clarkson.</p><p>If that is not directly possible, you can make a copy of that database somewhere accessible from this instance.</p><p>Once that is done, enter the connection string to the MySQL instance in the following format.</p><p>All the users imported from Clarkson will have their username as their email in Clarkson database and pasword set to<span class='' style='font-weight:bold'>hammond</span></p><code>user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local</code><br/><br/>",
"success": "We have successfully migrated the data from Clarkson. You will be redirected to the login screen shortly where you can login using your existing email and password : hammond" "success": "We have successfully migrated the data from Clarkson. You will be redirected to the login screen shortly where you can login using your existing email and password : hammond"
}, },
"fresh": { "fresh": {
"setupadminuser": "Setup Admin Users", "setupadminuser": "Setup Admin Users",
"yourpassword": "Your Password", "yourpassword": "Your Password",
"youremail": "Your Email", "youremail": "Your Email",
"yourname": "Your Name", "yourname": "Your Name",
"success": "You have been registered successfully. You will be redirected to the login screen shortly where you can login and start using the system." "success": "You have been registered successfully. You will be redirected to the login screen shortly where you can login and start using the system."
} }
}, },
"roles": { "roles": {
"ADMIN": "ADMIN", "ADMIN": "ADMIN",
"USER": "USER" "USER": "USER"
}, },
"profile": "Profile", "profile": "Profile",
"processedon": "Processed on", "processedon": "Processed on",
@@ -225,4 +228,4 @@
"disable": "Disable", "disable": "Disable",
"confirm": "Go Ahead", "confirm": "Go Ahead",
"labelforfile": "Label for this file" "labelforfile": "Label for this file"
} }

View File

@@ -14,7 +14,7 @@ export default {
user: { user: {
type: Object, type: Object,
required: true, required: true,
} },
}, },
data: function () { data: function () {
return { return {
@@ -38,7 +38,7 @@ export default {
fillingStation: null, fillingStation: null,
date: null, date: null,
fuelSubType: null, fuelSubType: null,
} },
} }
}, },
computed: { computed: {
@@ -58,7 +58,7 @@ export default {
return '' return ''
} }
} }
} },
}, },
mounted() { mounted() {
this.myVehicles = this.vehicles this.myVehicles = this.vehicles
@@ -76,7 +76,7 @@ export default {
Papa.parse(this.file, this.papaConfig) Papa.parse(this.file, this.papaConfig)
}, },
importData() { importData() {
if (typeof this.fileData[1][this.fillupModel.isTankFull] !== "boolean") { if (typeof this.fileData[1][this.fillupModel.isTankFull] !== 'boolean') {
this.errors.push('The value of Tank Full needs to be a boolean (true,false).') this.errors.push('The value of Tank Full needs to be a boolean (true,false).')
return return
} }
@@ -84,11 +84,11 @@ export default {
headings: this.fillupModel, headings: this.fillupModel,
data: this.fileData.splice(1, this.fileData.length), data: this.fileData.splice(1, this.fileData.length),
fullTankInverted: this.inverted, fullTankInverted: this.inverted,
vehicleId: this.selectedVehicle.id vehicleId: this.selectedVehicle.id,
} }
alert(JSON.stringify(content)) alert(JSON.stringify(content))
}, },
} },
} }
</script> </script>
@@ -109,7 +109,9 @@ export default {
<li>{{ $t('importhintvehiclecreated') }}</li> <li>{{ $t('importhintvehiclecreated') }}</li>
<li v-html="$t('importhintcurrdist')"></li> <li v-html="$t('importhintcurrdist')"></li>
<li v-html="$t('importhintunits')"></li> <li v-html="$t('importhintunits')"></li>
<li><b>{{ $t('dontimportagain') }}</b></li> <li
><b>{{ $t('dontimportagain') }}</b></li
>
</ol> </ol>
</div> </div>
</div> </div>
@@ -177,8 +179,7 @@ export default {
</option> </option>
</b-select> </b-select>
</b-field> </b-field>
<b-field <b-field :label="$t('per', { '0': $t('price'), '1': $t('unit.short.' + selectedVehicle.fuelUnitDetail.key) })">
:label="$t('per', { '0': $t('price'), '1': $t('unit.short.' + selectedVehicle.fuelUnitDetail.key) })">
<b-select v-model.number="fillupModel.perUnitPrice" type="number" min="0" step=".001" expanded required> <b-select v-model.number="fillupModel.perUnitPrice" type="number" min="0" step=".001" expanded required>
<option v-for="(option, index) in fileHeadings" :key="index" :value="index"> <option v-for="(option, index) in fileHeadings" :key="index" :value="index">
{{ option }} {{ option }}
@@ -200,15 +201,18 @@ export default {
</option> </option>
</b-select> </b-select>
</b-field> </b-field>
<b-field :label="$t('getafulltank')"> <b-field :label="$t('tankpartialfull')">
<b-radio-button v-model="invert" native-value="false">{{ $t('fulltank') }}</b-radio-button>
<b-radio-button v-model="invert" native-value="true">{{ $t('partialfillup') }}</b-radio-button>
</b-field>
<b-field>
<b-select v-model="fillupModel.isTankFull"> <b-select v-model="fillupModel.isTankFull">
<option v-for="(option, index) in fileHeadings" :key="index" :value="index"> <option v-for="(option, index) in fileHeadings" :key="index" :value="index">
{{ option }} {{ option }}
</option> </option>
</b-select> </b-select>
<b-checkbox-button v-model="invert" inverted>Invert Value</b-checkbox-button>
</b-field> </b-field>
<b-field :label="$t('missfillupbefore')"> <b-field :label="$t('missedfillup')">
<b-select v-model="fillupModel.hasMissedFillup"> <b-select v-model="fillupModel.hasMissedFillup">
<option v-for="(option, index) in fileHeadings" :key="index" :value="index"> <option v-for="(option, index) in fileHeadings" :key="index" :value="index">
{{ option }} {{ option }}
@@ -231,8 +235,7 @@ export default {
</b-field> </b-field>
<br /> <br />
<b-field> <b-field>
<b-button tag="button" native-type="submit" type="is-primary" :value="$t('save')" :label="$t('import')" <b-button tag="button" native-type="submit" type="is-primary" :value="$t('save')" :label="$t('import')" expanded />
expanded />
<p v-if="authError"> There was an error logging in to your account. </p> <p v-if="authError"> There was an error logging in to your account. </p>
</b-field> </b-field>
</span> </span>