From fb742f19a7b32bb5039c6eadb0014d8b9ea660f9 Mon Sep 17 00:00:00 2001 From: Alf Sebastian Houge Date: Sun, 17 Apr 2022 18:50:14 +0200 Subject: [PATCH] Change currency field from select to autocomplete --- ui/src/router/views/initialize.vue | 88 +++++++++++++----------------- ui/src/router/views/settings.vue | 32 +++++++++-- 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/ui/src/router/views/initialize.vue b/ui/src/router/views/initialize.vue index 8401a34..d389a35 100644 --- a/ui/src/router/views/initialize.vue +++ b/ui/src/router/views/initialize.vue @@ -21,13 +21,27 @@ export default { email: '', password: '', distanceUnit: 1, - currency: 'INR', + currency: '', }, } }, computed: { ...mapGetters('auth', ['isInitialized']), ...mapState('vehicles', ['currencyMasters', 'distanceUnitMasters']), + filteredCurrencyMasters() { + return this.currencyMasters.filter((option) => { + return ( + option.namePlural + .toString() + .toLowerCase() + .indexOf(this.registerModel.currency.toLowerCase()) >= 0 || + option.code + .toString() + .toLowerCase() + .indexOf(this.registerModel.currency.toLowerCase()) >= 0 + ) + }) + }, }, mounted() { store.dispatch('vehicles/fetchMasters').then((data) => {}) @@ -139,6 +153,9 @@ export default { }) .finally(() => (this.isWorking = false)) }, + formatCurrency(option) { + return `${option.namePlural} (${option.code})` + }, }, } @@ -148,15 +165,10 @@ export default {

Migrate from Clarkson

- If you have an existing Clarkson deployment and you want to migrate your data from that, - press the following button. + If you have an existing Clarkson deployment and you want to migrate your data from that, press the following button.


- - Migrate from Clarkson + Migrate from Clarkson

Fresh Install

@@ -170,21 +182,12 @@ export default {

Migrate from Clarkson

+

You need to make sure that this deployment of Hammond can access the MySQL database used by Clarkson.

+

If that is not directly possible, you can make a copy of that database somewhere accessible from this instance.

+

Once that is done, enter the connection string to the MySQL instance in the following format.

You need to make sure that this deployment of Hammond can access the MySQL database used by - Clarkson.

-

If that is not directly possible, you can make a copy of that database somewhere accessible - from this instance.

-

Once that is done, enter the connection string to the MySQL instance in the following - format.

-

All the users imported from Clarkson will have their username as their email in Clarkson - database and pasword set to hammond

All the users imported from Clarkson will have their username as their email in Clarkson database and pasword set to + hammond

user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local @@ -200,15 +203,8 @@ export default {
- Test ConnectionMigrate + Test ConnectionMigrate Cancel
@@ -222,28 +218,22 @@ export default { - + - - - + - + diff --git a/ui/src/router/views/settings.vue b/ui/src/router/views/settings.vue index 4f94c7e..856faa9 100644 --- a/ui/src/router/views/settings.vue +++ b/ui/src/router/views/settings.vue @@ -44,6 +44,20 @@ export default { return this.changePassModel.new === this.changePassModel.renew }, + filteredCurrencyMasters() { + return this.currencyMasters.filter((option) => { + return ( + option.namePlural + .toString() + .toLowerCase() + .indexOf(this.settingsModel.currency.toLowerCase()) >= 0 || + option.code + .toString() + .toLowerCase() + .indexOf(this.settingsModel.currency.toLowerCase()) >= 0 + ) + }) + }, }, methods: { changePassword() { @@ -109,6 +123,9 @@ export default { this.tryingToSave = false }) }, + formatCurrency(option) { + return `${option.namePlural} (${option.code})` + }, }, } @@ -123,11 +140,16 @@ export default { These will be used as default values whenever you create a new fillup or expense. - - - +