From 74da17c8e238dab58a14dc0350c150411e2a2808 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 6 Feb 2024 11:59:00 +0100 Subject: [PATCH 01/20] refs #4774 router, template trad --- src/i18n/en/index.js | 1 + src/i18n/es/index.js | 1 + src/pages/Worker/TraductionsVn.vue | 9 +++++++++ src/router/modules/worker.js | 11 ++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/pages/Worker/TraductionsVn.vue diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 1a7a4c27e..ec2397bf5 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -774,6 +774,7 @@ export default { notifications: 'Notifications', workerCreate: 'New worker', department: 'Department', + TraductionsVn: 'Traductions', }, list: { name: 'Name', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 83de42ee0..ac1c6fcd1 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -774,6 +774,7 @@ export default { notifications: 'Notificaciones', workerCreate: 'Nuevo trabajador', department: 'Departamentos', + TraductionsVn: 'Traducciones', }, list: { name: 'Nombre', diff --git a/src/pages/Worker/TraductionsVn.vue b/src/pages/Worker/TraductionsVn.vue new file mode 100644 index 000000000..a644f620e --- /dev/null +++ b/src/pages/Worker/TraductionsVn.vue @@ -0,0 +1,9 @@ + + + + + + + diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js index 27a6f19a9..244290a0c 100644 --- a/src/router/modules/worker.js +++ b/src/router/modules/worker.js @@ -10,7 +10,7 @@ export default { component: RouterView, redirect: { name: 'WorkerMain' }, menus: { - main: ['WorkerList', 'WorkerDepartment'], + main: ['WorkerList', 'WorkerDepartment', 'TraductionsVn'], card: ['WorkerNotificationsManager'], departmentCard: ['BasicData'], }, @@ -39,6 +39,15 @@ export default { }, component: () => import('src/pages/Worker/WorkerDepartment.vue'), }, + { + path: 'traductionsVn', + name: 'TraductionsVn', + meta: { + title: 'TraductionsVn', + icon: 'history_edu', + }, + component: () => import('src/pages/Worker/TraductionsVn.vue'), + }, { path: 'create', name: 'WorkerCreate', -- 2.40.1 From 03f7443d4098107806dd87050b8efa2ee10ad92e Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 14 Feb 2024 11:45:38 +0100 Subject: [PATCH 02/20] refs #4774 qtable --- src/pages/Worker/TraductionsVn.vue | 46 ++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/pages/Worker/TraductionsVn.vue b/src/pages/Worker/TraductionsVn.vue index a644f620e..0b6cec8bf 100644 --- a/src/pages/Worker/TraductionsVn.vue +++ b/src/pages/Worker/TraductionsVn.vue @@ -1,7 +1,49 @@ - + -- 2.40.1 From deb194887354a8ae4316b3b14690225ff3a8842a Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 26 Apr 2024 08:28:19 +0200 Subject: [PATCH 03/20] refs #4774 changes traductions --- src/i18n/es/index.js | 9 +++++++++ src/pages/Worker/TraductionsVn.vue | 20 +++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 07e78167c..264cdb550 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -1,3 +1,5 @@ +import TraductionsVn from 'src/pages/Worker/TraductionsVn.vue'; + export default { globals: { lang: { @@ -889,6 +891,13 @@ export default { }, imageNotFound: 'No se ha encontrado la imagen', }, + TraductionsVn: { + pageTitles: { + TraductionsVn: 'Traducciones', + }, + OriginalLanguage: 'Idioma Original', + SecondLanguage: 'Idioma Secundario', + }, wagon: { pageTitles: { wagons: 'Vagones', diff --git a/src/pages/Worker/TraductionsVn.vue b/src/pages/Worker/TraductionsVn.vue index 0b6cec8bf..fe07a6978 100644 --- a/src/pages/Worker/TraductionsVn.vue +++ b/src/pages/Worker/TraductionsVn.vue @@ -2,6 +2,7 @@ import { useStateStore } from 'src/stores/useStateStore'; import { computed } from 'vue'; import { useI18n } from 'vue-i18n'; +import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; const { t } = useI18n(); const columns = computed(() => [ @@ -20,28 +21,29 @@ const columns = computed(() => [ -- 2.40.1 From 4e8ffacea2c523e42e1a10814952b81a15178953 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 18 Oct 2024 07:55:02 +0200 Subject: [PATCH 04/20] fix: refs #4774 fix front table --- src/i18n/en/index.js | 2 +- src/i18n/es/index.js | 17 ++--- src/pages/Worker/TraductionsVn.vue | 53 -------------- src/pages/Worker/TranslationsVn.vue | 104 +++++++++++++++++++++++++++ src/router/modules/index.js | 2 + src/router/modules/translationsVn.js | 16 +++++ src/router/modules/worker.js | 10 +-- src/router/routes.js | 2 + 8 files changed, 137 insertions(+), 69 deletions(-) delete mode 100644 src/pages/Worker/TraductionsVn.vue create mode 100644 src/pages/Worker/TranslationsVn.vue create mode 100644 src/router/modules/translationsVn.js diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index b1c8732ef..f7e0d780e 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -826,7 +826,7 @@ export default { notifications: 'Notifications', workerCreate: 'New worker', department: 'Department', - TraductionsVn: 'Traductions', + TranslationsVn: 'Translations', }, list: { name: 'Name', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 264cdb550..cdbc55574 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -1,4 +1,4 @@ -import TraductionsVn from 'src/pages/Worker/TraductionsVn.vue'; +import TranslationsVn from 'src/pages/Worker/TranslationsVn.vue'; export default { globals: { @@ -819,6 +819,10 @@ export default { hasToSendMail: 'Enviar fichadas por mail', departmentRemoved: 'Departamento eliminado', }, + TranslationsVn: { + OriginalLanguage: 'Idioma Original', + SecondLanguage: 'Idioma Secundario', + }, worker: { pageTitles: { workers: 'Trabajadores', @@ -828,7 +832,7 @@ export default { notifications: 'Notificaciones', workerCreate: 'Nuevo trabajador', department: 'Departamentos', - TraductionsVn: 'Traducciones', + TranslationsVn: 'Traducciones', }, list: { name: 'Nombre', @@ -890,14 +894,7 @@ export default { bankEntity: 'Swift / BIC', }, imageNotFound: 'No se ha encontrado la imagen', - }, - TraductionsVn: { - pageTitles: { - TraductionsVn: 'Traducciones', - }, - OriginalLanguage: 'Idioma Original', - SecondLanguage: 'Idioma Secundario', - }, + wagon: { pageTitles: { wagons: 'Vagones', diff --git a/src/pages/Worker/TraductionsVn.vue b/src/pages/Worker/TraductionsVn.vue deleted file mode 100644 index fe07a6978..000000000 --- a/src/pages/Worker/TraductionsVn.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - diff --git a/src/pages/Worker/TranslationsVn.vue b/src/pages/Worker/TranslationsVn.vue new file mode 100644 index 000000000..83e0ec098 --- /dev/null +++ b/src/pages/Worker/TranslationsVn.vue @@ -0,0 +1,104 @@ + + + + + + + diff --git a/src/router/modules/index.js b/src/router/modules/index.js index bf7e46b00..d5895a9f8 100644 --- a/src/router/modules/index.js +++ b/src/router/modules/index.js @@ -22,6 +22,7 @@ import Account from './account'; import Monitor from './monitor'; import MailAlias from './mailAlias'; import Role from './role'; +import TranslationsVn from './translationsVn.js'; export default [ Item, @@ -48,4 +49,5 @@ export default [ MailAlias, Monitor, Role, + TranslationsVn, ]; diff --git a/src/router/modules/translationsVn.js b/src/router/modules/translationsVn.js new file mode 100644 index 000000000..cbc01c1aa --- /dev/null +++ b/src/router/modules/translationsVn.js @@ -0,0 +1,16 @@ +import { RouterView } from 'vue-router'; + +export default { + path: '/translations', + name: 'Translations', + meta: { + title: 'translations', + icon: 'history_edu', + moduleName: 'Translations', + }, + component: RouterView, + menus: { + main: [], + card: [], + }, +}; diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js index 00c8403f0..89c15efd8 100644 --- a/src/router/modules/worker.js +++ b/src/router/modules/worker.js @@ -12,7 +12,7 @@ export default { component: RouterView, redirect: { name: 'WorkerMain' }, menus: { - main: ['WorkerList', 'WorkerDepartment', 'TraductionsVn'], + main: ['WorkerList', 'WorkerDepartment', 'TranslationsVn'], card: [ 'WorkerBasicData', 'WorkerNotes', @@ -55,13 +55,13 @@ export default { component: () => import('src/pages/Worker/WorkerDepartment.vue'), }, { - path: 'traductionsVn', - name: 'TraductionsVn', + path: 'translations', + name: 'TranslationsVn', meta: { - title: 'TraductionsVn', + title: 'translations', icon: 'history_edu', }, - component: () => import('src/pages/Worker/TraductionsVn.vue'), + component: () => import('src/pages/Worker/TranslationsVn.vue'), }, { path: 'create', diff --git a/src/router/routes.js b/src/router/routes.js index cced308b5..b5aa6cb4a 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -22,6 +22,7 @@ import zone from 'src/router/modules/zone'; import account from './modules/account'; import monitor from 'src/router/modules/monitor'; import mailAlias from './modules/mailAlias'; +import translationsVn from './modules/translationsVn'; const routes = [ { @@ -97,6 +98,7 @@ const routes = [ account, role, mailAlias, + translationsVn, { path: '/:catchAll(.*)*', name: 'NotFound', -- 2.40.1 From 61bbeb70129229e92f7c9116d80fe9d9473fc220 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 22 Oct 2024 10:37:54 +0200 Subject: [PATCH 05/20] fix: refs #4774 fix translations --- src/components/CrudModel.vue | 1 + src/i18n/en/index.js | 7 +- src/i18n/es/index.js | 9 +-- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Worker/TranslationsVn.vue | 101 +++++++++++++++++----------- 6 files changed, 75 insertions(+), 45 deletions(-) diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index a4cb55a2c..7e6751b5a 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -95,6 +95,7 @@ defineExpose({ getChanges, formData, vnPaginateRef, + resetData, }); onBeforeRouteLeave((to, from, next) => { diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index f7e0d780e..e7753a660 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -817,6 +817,11 @@ export default { hasToSendMail: 'Send check-ins by email', departmentRemoved: 'Department removed', }, + translations: { + pageTitles: { + translations: 'Translations', + }, + }, worker: { pageTitles: { workers: 'Workers', @@ -826,7 +831,7 @@ export default { notifications: 'Notifications', workerCreate: 'New worker', department: 'Department', - TranslationsVn: 'Translations', + translations: 'Translations', }, list: { name: 'Name', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index cdbc55574..1121f485c 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -819,9 +819,10 @@ export default { hasToSendMail: 'Enviar fichadas por mail', departmentRemoved: 'Departamento eliminado', }, - TranslationsVn: { - OriginalLanguage: 'Idioma Original', - SecondLanguage: 'Idioma Secundario', + translations: { + pageTitles: { + translations: 'Traducciones', + }, }, worker: { pageTitles: { @@ -832,7 +833,7 @@ export default { notifications: 'Notificaciones', workerCreate: 'Nuevo trabajador', department: 'Departamentos', - TranslationsVn: 'Traducciones', + translations: 'Traducciones', }, list: { name: 'Nombre', diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index b73395df2..aba5bea86 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -277,6 +277,7 @@ globals: medical: Mutual RouteExtendedList: Router wasteRecalc: Waste recaclulate + translations: Translations supplier: Supplier created: Created worker: Worker diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 2552c9549..94ffcedf2 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -281,6 +281,7 @@ globals: serial: Facturas por serie medical: Mutua wasteRecalc: Recalcular mermas + translations: Traducciones supplier: Proveedor created: Fecha creación worker: Trabajador diff --git a/src/pages/Worker/TranslationsVn.vue b/src/pages/Worker/TranslationsVn.vue index 83e0ec098..a69801585 100644 --- a/src/pages/Worker/TranslationsVn.vue +++ b/src/pages/Worker/TranslationsVn.vue @@ -13,92 +13,113 @@ const { t } = useI18n(); const columns = computed(() => [ { align: 'left', - name: 'companyFk', - label: t('company18n'), - chip: { - condition: () => true, - }, - isId: true, + name: primaryKey, + label: t('primaryKey'), }, { align: 'left', - name: 'footnotes', + name: field, label: t('defaultLang(en)'), + component: 'input', }, { align: 'left', name: 'secondLang', label: t('secondLang'), + component: 'input', }, ]); const tableRef = ref({}); const langs = ref([]); -const pk = ref('companyFk'); -const value = ref('footnotes'); +const tables = ref([]); const lang = ref('es'); +const primaryKey = computed(() => table.value.primaryKey); +const field = computed(() => table.value.field); +const table = ref(); const originalData = ref(); -const englishData = ref(); +const url = computed(() => table.value?.tableName + 's'); // onMounted(() => { // loadTable(); // }); async function loadTable() { - console.log('lang.value.code: ', lang.value); const data = tableRef.value.CrudModelRef.formData; if (!originalData.value) originalData.value = data; - + if (!originalData.value) return; const en = originalData.value.filter((d) => d.lang === 'en'); for (const translation of en) { translation['secondLang'] = originalData.value.find( - (d) => d[pk.value] == translation[pk.value] && d['lang'] == lang.value - )?.[value.value]; + (d) => + d[primaryKey.value] == translation[primaryKey.value] && + d['lang'] == lang.value + )?.[field.value]; } console.log('data: ', en); - tableRef.value.CrudModelRef.formData = en; + await tableRef.value.CrudModelRef.resetData(en); } function resetOriginalData() { originalData.value = null; } + +function upsertI18n() { + axios.patch(url.value, {}); +} - + es: + primaryKey: Clave primaria + defaultLang(en): Idioma por defecto(Eng) + secondLang: Idioma secundario + table: Tabla + lang: Idioma + en: + primaryKey: Primary key + defaultLang(en): Default language(Eng) + secondLang: Second language + table: Table + lang: Language -- 2.40.1 From 42f975b025d95575fcb6357a4586011337db1df9 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 22 Oct 2024 12:22:45 +0200 Subject: [PATCH 06/20] fix: refs #4774 create --- src/pages/Customer/Card/CustomerBasicData.vue | 2 + src/pages/Worker/TranslationsVn.vue | 58 +++++++++++++++---- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/pages/Customer/Card/CustomerBasicData.vue b/src/pages/Customer/Card/CustomerBasicData.vue index d31669b43..b5587858b 100644 --- a/src/pages/Customer/Card/CustomerBasicData.vue +++ b/src/pages/Customer/Card/CustomerBasicData.vue @@ -93,12 +93,14 @@ const exprBuilder = (param, value) => { :label="t('customer.basicData.phone')" :rules="validate('client.phone')" clearable + type="number" v-model="data.phone" /> diff --git a/src/pages/Worker/TranslationsVn.vue b/src/pages/Worker/TranslationsVn.vue index a69801585..629419701 100644 --- a/src/pages/Worker/TranslationsVn.vue +++ b/src/pages/Worker/TranslationsVn.vue @@ -1,7 +1,6 @@ @@ -93,7 +122,7 @@ function upsertI18n() { :options="langs" option-label="code" option-value="code" - @update:model-value="loadTable()" + @update:model-value="loadTable(true)" /> @@ -102,8 +131,13 @@ function upsertI18n() { data-key="translations" :url="url" :columns="columns" + :create="{ + urlCreate: url, + title: 'Create translation', + onDataSaved: () => tableRef.reload(), + formInitialData: { lang: 'en' }, + }" :right-search="false" - :is-editable="true" @on-fetch="loadTable()" :save-fn="upsertI18n" /> -- 2.40.1 From 82b53ea1aa9db601d685d699a9f61a456bb93045 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 24 Oct 2024 12:57:17 +0200 Subject: [PATCH 07/20] fix: refs #4774 finalize --- src/components/VnTable/VnTable.vue | 8 ++ src/components/ui/VnPaginate.vue | 2 +- src/pages/Worker/TranslationsVn.vue | 109 +++++++++++++++++----------- 3 files changed, 75 insertions(+), 44 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 5239fe859..52eb390ea 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -183,6 +183,12 @@ watch( { immediate: true } ); +watch( + () => $props.create, + (value) => (createForm.value = value), + { immediate: true } +); + watch( () => route.query[$props.searchUrl], (val) => setUserParams(val) @@ -535,6 +541,7 @@ function handleScroll() { diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 80c607214..72f14e76c 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -128,7 +128,7 @@ const addFilter = async (filter, params) => { async function fetch(params) { useArrayData(props.dataKey, params); - arrayData.reset(['filter.skip', 'skip']); + arrayData.reset(['filter.skip', 'skip', 'page']); await arrayData.fetch({ append: false }); if (!store.hasMoreData) isLoading.value = false; diff --git a/src/pages/Worker/TranslationsVn.vue b/src/pages/Worker/TranslationsVn.vue index 629419701..e29b503d8 100644 --- a/src/pages/Worker/TranslationsVn.vue +++ b/src/pages/Worker/TranslationsVn.vue @@ -7,6 +7,7 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import axios from 'axios'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import FetchData from 'src/components/FetchData.vue'; +import VnInput from 'src/components/common/VnInput.vue'; const { t } = useI18n(); const columns = computed(() => [ @@ -18,19 +19,13 @@ const columns = computed(() => [ }, { align: 'left', - name: field, + name: 'en', label: t('defaultLang(en)'), - create: true, }, { align: 'left', - name: 'secondLang', - label: t('secondLang'), - component: 'input', - isEditable: true, - attrs: { - clearable: false, - }, + name: lang, + label: lang, }, { align: 'right', @@ -42,6 +37,7 @@ const columns = computed(() => [ icon: 'save', action: (row) => upsertI18n(row), isPrimary: true, + disable: (row) => !row.hasChanges, }, ], }, @@ -54,47 +50,52 @@ const lang = ref('es'); const primaryKey = computed(() => table.value.primaryKey); const field = computed(() => table.value.field); const table = ref(); -const originalData = ref(); +const originalData = ref([]); const url = computed(() => table.value?.tableName + 's'); -async function loadTable(changeLang) { - console.log('table: ', tableRef.value.CrudModelRef.formData); - const data = tableRef.value.CrudModelRef.formData; - if (!changeLang) originalData.value = data; - if (!originalData.value) return; - const en = originalData.value.filter((d) => d.lang === 'en'); - for (const translation of en) { - translation['secondLang'] = originalData.value.find( - (d) => - d[primaryKey.value] == translation[primaryKey.value] && - d['lang'] == lang.value - )?.[field.value]; - } - console.log('data: ', en); +async function loadTable(data) { + if (data) { + originalData.value = []; + tableRef.value.CrudModelRef.formData = []; + const newData = {}; + for (const translation of data) { + if (!newData[translation[primaryKey.value]]) + newData[translation[primaryKey.value]] = {}; + newData[translation[primaryKey.value]][translation.lang] = + translation[field.value]; + } - await tableRef.value.CrudModelRef.resetData(en); + for (const currentData in newData) { + originalData.value.push({ + [primaryKey.value]: currentData, + ...newData[currentData], + }); + tableRef.value.CrudModelRef.formData.push({ + [primaryKey.value]: currentData, + ...newData[currentData], + }); + } + return; + } + tableRef.value.CrudModelRef.formData = JSON.parse(JSON.stringify(originalData.value)); } function resetOriginalData() { originalData.value = null; } -function upsertI18n(data) { - const newData = { ...data }; - newData[field.value] = newData.secondLang; - newData.lang = lang.value; - delete newData.secondLang; - delete newData.$index; - axios.patch(url.value, newData); -} +async function upsertI18n(data) { + await axios.patch(url.value, { + [field.value]: data[lang.value], + [primaryKey.value]: data[primaryKey.value], + lang: lang.value, + }); -function deleteI18n(data) { - // const newData = { ...data }; - // newData[field.value] = newData.secondLang; - // newData.lang = lang.value; - // delete newData.secondLang; - // delete newData.$index; - // axios.deleteById(url.value, newData); + const index = originalData.value.findIndex( + (t) => t[primaryKey.value] == data[primaryKey.value] + ); + originalData.value[index] = data; + data.hasChanges = false; } @@ -122,7 +123,7 @@ function deleteI18n(data) { :options="langs" option-label="code" option-value="code" - @update:model-value="loadTable(true)" + @update:model-value="loadTable()" /> @@ -131,6 +132,7 @@ function deleteI18n(data) { data-key="translations" :url="url" :columns="columns" + :filter="{ limit: 50 }" :create="{ urlCreate: url, title: 'Create translation', @@ -138,9 +140,30 @@ function deleteI18n(data) { formInitialData: { lang: 'en' }, }" :right-search="false" - @on-fetch="loadTable()" + @on-fetch="(data) => loadTable(data)" :save-fn="upsertI18n" - /> + :search-url="false" + > + + + -- 2.40.1 From c29dedaad7477af7bf7c55d7216049cb5b74bc86 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 28 Oct 2024 11:52:39 +0100 Subject: [PATCH 08/20] fix: refs #4774 front remove --- src/pages/Worker/TranslationsVn.vue | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/pages/Worker/TranslationsVn.vue b/src/pages/Worker/TranslationsVn.vue index e29b503d8..f36407a9d 100644 --- a/src/pages/Worker/TranslationsVn.vue +++ b/src/pages/Worker/TranslationsVn.vue @@ -11,6 +11,12 @@ import VnInput from 'src/components/common/VnInput.vue'; const { t } = useI18n(); const columns = computed(() => [ + { + align: 'left', + name: 'id', + label: t('id'), + visible: false, + }, { align: 'left', name: primaryKey, @@ -39,6 +45,19 @@ const columns = computed(() => [ isPrimary: true, disable: (row) => !row.hasChanges, }, + { + title: t('globals.delete'), + icon: 'delete', + isPrimary: true, + action: (row) => + openConfirmationModal( + t('You are going to delete this ticket purchase request'), + t( + 'This ticket will be removed from ticket purchase requests! Continue anyway?' + ), + () => removeLine(row.id) + ), + }, ], }, ]); @@ -97,6 +116,16 @@ async function upsertI18n(data) { originalData.value[index] = data; data.hasChanges = false; } + +// async function removeLine(id) { +// try { +// await axios.delete(`TicketRequests/${id}`); +// notify(t('globals.dataSaved'), 'positive'); +// location.reload(); +// } catch (err) { +// console.error('Error ', err); +// } +// }