diff --git a/src/boot/axios.js b/src/boot/axios.js index b5758897..1f384ff3 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -38,6 +38,7 @@ export default boot(({ app }) => { app.config.globalProperties.$jApi = jApi; app.provide('jApi', jApi); + app.provide('api', api); }); export { api, jApi }; diff --git a/src/components/common/VnForm.vue b/src/components/common/VnForm.vue new file mode 100644 index 00000000..ccddcad2 --- /dev/null +++ b/src/components/common/VnForm.vue @@ -0,0 +1,207 @@ + + + + + + + + + + {{ title }} + + + + + + + + diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue new file mode 100644 index 00000000..62984159 --- /dev/null +++ b/src/components/common/VnInput.vue @@ -0,0 +1,124 @@ + + + + + + + + + + + { + value = null; + emit('remove'); + } + " + /> + + + {{ info }} + + + + + + + + +en-US: + inputMin: Must be more than {value} +es-ES: + inputMin: Must be more than {value} +ca-ES: + inputMin: Ha de ser més gran que {value} +fr-FR: + inputMin: Doit être supérieur à {value} +pt-PT: + inputMin: Deve ser maior que {value} + diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue new file mode 100644 index 00000000..24b82017 --- /dev/null +++ b/src/components/common/VnSelect.vue @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + diff --git a/src/components/ui/ChangePasswordForm.vue b/src/components/ui/ChangePasswordForm.vue new file mode 100644 index 00000000..591523f2 --- /dev/null +++ b/src/components/ui/ChangePasswordForm.vue @@ -0,0 +1,87 @@ + + + + + + + + + + + + + +en-US: + changePassword: Change password + newPassword: New password + oldPassword: Old password + repeatPassword: Repeat password +es-ES: + changePassword: Cambiar contraseña + newPassword: Nueva contraseña + oldPassword: Contraseña antigua + repeatPassword: Repetir contraseña +ca-ES: + changePassword: Canviar contrasenya + newPassword: Nova contrasenya + oldPassword: Contrasenya antiga + repeatPassword: Repetir contrasenya +fr-FR: + changePassword: Changer le mot de passe + newPassword: Nouveau mot de passe + oldPassword: Ancien mot de passe + repeatPassword: Répéter le mot de passe +pt-PT: + changePassword: Alterar palavra-passe + newPassword: Nova palavra-passe + oldPassword: Palavra-passe antiga + repeatPassword: Repetir palavra-passe + diff --git a/src/js/db/sqlService.js b/src/js/db/sqlService.js new file mode 100644 index 00000000..375e2f74 --- /dev/null +++ b/src/js/db/sqlService.js @@ -0,0 +1,42 @@ +export const generateUpdateSqlQuery = ( + schema, + table, + pks, + columnsUpdated, + formData +) => { + const setClauses = columnsUpdated + .map(colName => `${colName} = '${formData[colName]}'`) + .join(', '); + const whereClause = Object.keys(pks) + .map(pk => `${pk} = ${pks[pk]}`) + .join(' AND '); + + return ` + START TRANSACTION; + UPDATE ${schema}.${table} SET ${setClauses} WHERE (${whereClause}); + SELECT ${columnsUpdated.join(', ')} FROM ${schema}.${table} WHERE (${whereClause}); + COMMIT; + `; +}; + +export const generateInsertSqlQuery = ( + schema, + table, + formData, + columnsUpdated, + createModelDefault +) => { + const columns = [createModelDefault.field, ...columnsUpdated].join(', '); + const values = [ + createModelDefault.value, + ...columnsUpdated.map(colName => `'${formData[colName]}'`) + ].join(', '); + + return ` + START TRANSACTION; + INSERT INTO ${schema}.${table} (${columns}) VALUES (${values}); + SELECT id, ${columnsUpdated.join(', ')} FROM ${schema}.${table} WHERE (id = LAST_INSERT_ID()); + COMMIT; + `; +}; diff --git a/src/pages/Account/AccountConf.vue b/src/pages/Account/AccountConf.vue deleted file mode 100644 index 87184d4d..00000000 --- a/src/pages/Account/AccountConf.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - - // TODO: VISTA A DESARROLLAR! - - - - - diff --git a/src/pages/Account/AccountConfig.vue b/src/pages/Account/AccountConfig.vue new file mode 100644 index 00000000..47a85c8c --- /dev/null +++ b/src/pages/Account/AccountConfig.vue @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +en-US: + personalInformation: Personal Information + name: Name + email: Email + nickname: Display name + lang: Language + receiveInvoicesByMail: Receive invoices by mail + addresses: Addresses + changePassword: Change password +es-ES: + personalInformation: Datos personales + name: Nombre + email: Correo electrónico + nickname: Nombre a mostrar + lang: Idioma + receiveInvoicesByMail: Recibir facturas por correo + addresses: Direcciones + changePassword: Cambiar contraseña +ca-ES: + personalInformation: Dades personals + name: Nom + email: Correu electrònic + nickname: Nom a mostrar + lang: Idioma + receiveInvoicesByMail: Rebre factures per correu + addresses: Adreces + changePassword: Canviar contrasenya +fr-FR: + personalInformation: Informations personnelles + name: Nom + email: E-mail + nickname: Nom à afficher + lang: Langue + receiveInvoicesByMail: Recevoir des factures par courrier + addresses: Adresses + changePassword: Changer le mot de passe +pt-PT: + personalInformation: Dados pessoais + name: Nome + email: E-mail + nickname: Nom à afficher + lang: Língua + receiveInvoicesByMail: Receber faturas por correio + addresses: Endereços + changePassword: Alterar palavra-passe + diff --git a/src/router/routes.js b/src/router/routes.js index 1ab82dcc..a8952650 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -57,10 +57,10 @@ const routes = [ { name: 'Account', path: '/account/conf', - component: () => import('pages/Account/AccountConf.vue') + component: () => import('pages/Account/AccountConfig.vue') }, { - name: 'Addresses', + name: 'AddressesList', path: '/account/address-list', component: () => import('pages/Account/AddressList.vue') },