Merge branch 'dev' into 8001-expeditionGrafana
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
844d72a2e3
186
CHANGELOG.md
186
CHANGELOG.md
|
@ -1,3 +1,189 @@
|
||||||
|
# Version 24.48 - 2024-11-25
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- chore: correct checkNotification (fix_customer_issues) by:alexm
|
||||||
|
- chore: perf (warmFix_order_equalSalix) by:alexm
|
||||||
|
- chore: refs #6818 add spaces by:jorgep
|
||||||
|
- chore: refs #6818 drop useless code & comment by:jorgep
|
||||||
|
- chore: refs #7273 sticky add btn & refactor by:jorgep
|
||||||
|
- chore: refs #7524 fix test by:jorgep
|
||||||
|
- chore: refs #8039 not required by:alexm
|
||||||
|
- chore: refs #8078 fiz tests by:jorgep
|
||||||
|
- chore: refs #8078 rollback ref by:jorgep
|
||||||
|
- chore: remove console.log (warmFix_invoiceOut_Global) by:alexm
|
||||||
|
- chore: typo (fix_itemType-redirection) by:alexm
|
||||||
|
- feat: #6943 use openURL quasar by:Javier Segarra
|
||||||
|
- feat: #7782 add cypress report by:Javier Segarra
|
||||||
|
- feat: #7782 cypress.config watchForFileChanges by:Javier Segarra
|
||||||
|
- feat: #7782 npm run resetDatabase by:Javier Segarra
|
||||||
|
- feat: #7782 waitUntil domContentLoad by:Javier Segarra
|
||||||
|
- feat: added composable to confirm orders by:Jon
|
||||||
|
- feat: add /reports in gitignore (warmFix_reports_in_gitignore) by:alexm
|
||||||
|
- feat: apply changes for customerModule by:Javier Segarra
|
||||||
|
- feat: disabled buttons by:Javier Segarra
|
||||||
|
- feat: move buttons to DescriptorMenu by:Javier Segarra
|
||||||
|
- feat: refs #6818 add icon by:jorgep
|
||||||
|
- feat: refs #6818 fetch url & default channel by:jorgep
|
||||||
|
- feat: refs #6818 saysimple integration by:jorgep
|
||||||
|
- feat: refs #6839 module searching (6839-addSearchMenu) by:jorgep
|
||||||
|
- feat: refs #6839 normalize search by:jorgep
|
||||||
|
- feat: refs #6919 sync entry data by:jorgep
|
||||||
|
- feat: refs #7006 itemType basic data new inputs by:guillermo
|
||||||
|
- feat: refs #7006 itemTypeLog added by:guillermo
|
||||||
|
- feat: refs #7193 modified parking to use the scope and corrected small errors by:Jon
|
||||||
|
- feat: refs #7206 added inactive label and corrected minor errors by:Jon
|
||||||
|
- feat: refs #7308 #7308 remove warnings related to useSession by:Javier Segarra
|
||||||
|
- feat: refs #7349 usa back con permisos by:jgallego
|
||||||
|
- feat: refs #7524 add front test by:jorgep
|
||||||
|
- feat: refs #7874 improve vn-notes ui by:jorgep
|
||||||
|
- feat: refs #7970 notify changes by:Jon
|
||||||
|
- feat(): refs #8039 canceledError not notify by:alexm
|
||||||
|
- feat: refs #8039 notify error unify by:alexm
|
||||||
|
- feat: refs #8039 show duplicate request in local by:alexm
|
||||||
|
- feat: refs #8078 add shortcut multi selection by:jorgep
|
||||||
|
- feat: refs #8078 add tests by:jorgep
|
||||||
|
- feat: refs#8087 Redadas en travel by:Carlos Andrés
|
||||||
|
- feat: refs #8087 Traspasar redadas a travels by:Carlos Andrés
|
||||||
|
- feat: remove comments by:Javier Segarra
|
||||||
|
- feat(Supplier): add companySize by:alexm
|
||||||
|
- feat: use composable to unify logic by:Javier Segarra
|
||||||
|
- feat(VnInput): empty to null by:alexm
|
||||||
|
- feat(VnSelect): order data equal salix by:alexm
|
||||||
|
- feat(VnSelect): refs #7136 add scroll (7136-vnSelect_paginate_simplify_2) by:alexm
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- chore: perf (warmFix_order_equalSalix) by:alexm
|
||||||
|
- chore: refs #7273 sticky add btn & refactor by:jorgep
|
||||||
|
- fix: better performance (warmFix_accountAcls) by:alexm
|
||||||
|
- perf: minor bugs detected by:Javier Segarra
|
||||||
|
- perf: refs #6943 #6943 merge command by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 declare composable inst4ead code duplicated by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 handle composable i18n by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 handle i18n by:Javier Segarra
|
||||||
|
- perf: refs #7283 #7283 i18n params by:Javier Segarra
|
||||||
|
- perf: refs #7308 #7308 remove comments by:Javier Segarra
|
||||||
|
- perf: remove appendParams by:Javier Segarra
|
||||||
|
- perf: use const in VnLocation by:Javier Segarra
|
||||||
|
- perf: use required instead :required="true" by:Javier Segarra
|
||||||
|
- refactor: apply QPopupProxy by:wbuezas
|
||||||
|
- refactor: changed confirmOrder directory by:Jon
|
||||||
|
- refactor: change keyup.enter for update:model-value by:wbuezas
|
||||||
|
- refactor(InvoiceInBasicData): use VnDms by:alexm
|
||||||
|
- refactor: modified composable by:Jon
|
||||||
|
- refactor: refs #6818 change channel source by:jorgep
|
||||||
|
- refactor: refs #6818 channel logic by:jorgep
|
||||||
|
- refactor: refs #6919 export filter by:jorgep
|
||||||
|
- refactor: refs #7132 1st wave of changes in global translations files by:Jon
|
||||||
|
- refactor: refs #7132 account's module translations by:Jon
|
||||||
|
- refactor: refs #7132 customer's module translations by:Jon
|
||||||
|
- refactor: refs #7132 deleted pageTitles repeated by:Jon
|
||||||
|
- refactor: refs #7132 delete duplicate translations' keys by:Jon
|
||||||
|
- refactor: refs #7132 deleted useless code by:Jon
|
||||||
|
- refactor: refs #7132 global translations files changed by:Jon
|
||||||
|
- refactor: refs #7266 Changed method name by:guillermo
|
||||||
|
- refactor: refs #7950 Created cmr model by:guillermo
|
||||||
|
- refactor: refs #7970 added emit by:Jon
|
||||||
|
- refactor: refs #7970 refactored VnConfirm to emit events by:Jon
|
||||||
|
- refactor: refs #8185 modified LeftMenu to avoid duplicates by:Jon
|
||||||
|
- refactor: remove unused variable by:wbuezas
|
||||||
|
- refactor: revert catalog changes by:Jon
|
||||||
|
- refactor: small change by:wbuezas
|
||||||
|
- test: refactor e2e by:alexm
|
||||||
|
- test: refs #8039 add hasNotify and, refactor: agencyWorkCenter test by:alexm
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- chore: refs #7524 fix test by:jorgep
|
||||||
|
- fix: better performance (warmFix_accountAcls) by:alexm
|
||||||
|
- fix: catalog view category and type filter by:wbuezas
|
||||||
|
- fix: category and tags filters by:Jon
|
||||||
|
- fix: changed route.query by:Jon
|
||||||
|
- fix: change type vnput by:Javier Segarra
|
||||||
|
- fix(ClaimList): stateCode orderBy priority by:alexm
|
||||||
|
- fix: entryFilters by:carlossa
|
||||||
|
- fix: filter panel by:Jon
|
||||||
|
- fix(InvoiceOutGlobal): parallelism by:alexm
|
||||||
|
- fix: itemBotanical by:Javier Segarra
|
||||||
|
- fix: itemType redirection and fix filters by:alexm
|
||||||
|
- fix: logout spec (warmFix_logout.spec) by:alexm
|
||||||
|
- fix: merge errors by:alexm
|
||||||
|
- fix: order catalog by:wbuezas
|
||||||
|
- fix: order catalog fixes by:wbuezas
|
||||||
|
- fix: refs #6818 use right icon by:jorgep
|
||||||
|
- fix: refs #6896 fixed module problems by:Jon
|
||||||
|
- fix: refs #7193 fixed e2e test by:Jon
|
||||||
|
- fix: refs #7206 deleted duplicate code by:Jon
|
||||||
|
- fix: refs #7273 use same filter by:jorgep
|
||||||
|
- fix: refs #7283 #7283 bugs by:Javier Segarra
|
||||||
|
- fix: refs #7283 #7283 ItemDiary subToolbar by:Javier Segarra
|
||||||
|
- fix: refs #7283 #7283 ItemSummary bugs by:Javier Segarra
|
||||||
|
- fix: refs #7283 Account image resolution by:guillermo
|
||||||
|
- fix: refs #7283 css by:jorgep
|
||||||
|
- fix: refs #7283 filter by:carlossa
|
||||||
|
- fix: refs #7283 fix image by:carlossa
|
||||||
|
- fix: refs #7283 fix pr by:carlossa
|
||||||
|
- fix: refs #7283 fix preview by:carlossa
|
||||||
|
- fix: refs #7283 fix required by:carlossa
|
||||||
|
- fix: refs #7283 item filters by:carlossa
|
||||||
|
- fix: refs #7283 itemtype fix by:carlossa
|
||||||
|
- fix: refs #7283 order translation by:carlossa
|
||||||
|
- fix: refs #7283 preview by:carlossa
|
||||||
|
- fix: refs #7283 tooltips !Item by:Javier Segarra
|
||||||
|
- fix: refs #7306 clean warning by:carlossa
|
||||||
|
- fix: refs #7310 clean warning by:carlossa
|
||||||
|
- fix: refs #7323 locale #7396 by:jorgep
|
||||||
|
- fix: refs #7323 show advanced fields by:jorgep
|
||||||
|
- fix: refs #7349 dependencia no usada by:jgallego
|
||||||
|
- fix: refs #7524 e2e & worker module by:jorgep
|
||||||
|
- fix: refs #7874 add title by:jorgep
|
||||||
|
- fix: refs #7874 show name by:jorgep
|
||||||
|
- fix: refs #7943 use correct data-key by:jorgep
|
||||||
|
- fix: refs #7943 use summary by:jorgep
|
||||||
|
- fix: refs #8039 bad tests by:alexm
|
||||||
|
- fix: refs #8039 o not handle unnecessary errors by:alexm
|
||||||
|
- fix: refs #8078 e2e #7970 by:jorgep
|
||||||
|
- fix: refs #8078 handleSelection by:jorgep
|
||||||
|
- fix: refs #8078 improve cy command (8078-enableMultiSelection) by:jorgep
|
||||||
|
- fix: refs #8078 improve handleSelection by:jorgep
|
||||||
|
- fix: reset category by:wbuezas
|
||||||
|
- fix: tag chips by:Jon
|
||||||
|
- fix: vnSearchbar spec (warmFix_vnSearchBar.spec) by:alexm
|
||||||
|
- fix(VnSelect): setOptions when applyFilter by:alexm
|
||||||
|
- fix: worker test e2e by:Jon
|
||||||
|
- Merge branch 'dev' into fix_customer_issues by:Javier Segarra
|
||||||
|
- refactor: revert catalog changes by:Jon
|
||||||
|
- refs #7283 fix conflicts by:carlossa
|
||||||
|
- refs #7283 fix descriptorproxy by:carlossa
|
||||||
|
- refs #7283 fixedPrice by:carlossa
|
||||||
|
- refs #7283 fixedPrices by:carlossa
|
||||||
|
- refs #7283 fix itemFixed by:carlossa
|
||||||
|
- refs #7283 fix itemFixedPrice by:carlossa
|
||||||
|
- refs #7283 fix itemMigration by:carlossa
|
||||||
|
- refs #7283 fix itemMigration list filters by:carlossa
|
||||||
|
- refs #7283 fix items by:carlossa
|
||||||
|
- refs #7283 fix items error get images by:carlossa
|
||||||
|
- refs #7283 fix items images by:carlossa
|
||||||
|
- refs #7283 fix request by:carlossa
|
||||||
|
- refs #7283 fix searchbar by:carlossa
|
||||||
|
- refs #7283 fix viewSummary by:carlossa
|
||||||
|
- refs #7283 fix yml list basicData by:carlossa
|
||||||
|
- refs #7283 itemRequest fix by:carlossa
|
||||||
|
- refs #7283 itemRequest fix deny by:carlossa
|
||||||
|
- refs #7283 itemRequest fix reload by:carlossa
|
||||||
|
- refs #72983 fix filters by:carlossa
|
||||||
|
- revert: commit by:Javier Segarra
|
||||||
|
- revert e57a253c6f649382da187d1129449d265fb26d3b by:Javier Segarra
|
||||||
|
- test: #8162 fix clientList spec by:Javier Segarra
|
||||||
|
- test: #8162 fix vnLocation spec by:Javier Segarra
|
||||||
|
- test: fix arrayData by:Javier Segarra
|
||||||
|
- test: fix e2e by:alexm
|
||||||
|
- test: fix e2e by:Javier Segarra
|
||||||
|
- test: refs #8039 fix WorkerNotification e2e by:alexm
|
||||||
|
- test: refs #8039 fix ZoneWarehouse e2e by:alexm
|
||||||
|
- warmfix: ItemLastEntries to date (origin/warmfix_itemLastEntriesFilter) by:Javier Segarra
|
||||||
|
|
||||||
# Version 24.40 - 2024-10-02
|
# Version 24.40 - 2024-10-02
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
const { defineConfig } = require('cypress');
|
const { defineConfig } = require('cypress');
|
||||||
|
// https://docs.cypress.io/app/tooling/reporters
|
||||||
|
// https://docs.cypress.io/app/references/configuration
|
||||||
|
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
|
@ -16,6 +19,7 @@ module.exports = defineConfig({
|
||||||
reporterOptions: {
|
reporterOptions: {
|
||||||
charts: true,
|
charts: true,
|
||||||
reportPageTitle: 'Cypress Inline Reporter',
|
reportPageTitle: 'Cypress Inline Reporter',
|
||||||
|
reportFilename: '[status]_[datetime]-report',
|
||||||
embeddedScreenshots: true,
|
embeddedScreenshots: true,
|
||||||
reportDir: 'test/cypress/reports',
|
reportDir: 'test/cypress/reports',
|
||||||
inlineAssets: true,
|
inlineAssets: true,
|
||||||
|
|
|
@ -17,10 +17,6 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -48,7 +44,7 @@ const onDataSaved = (...args) => {
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Names')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('city.name')"
|
:rules="validate('city.name')"
|
||||||
/>
|
/>
|
||||||
|
@ -56,7 +52,6 @@ const onDataSaved = (...args) => {
|
||||||
:province-selected="$props.provinceSelected"
|
:province-selected="$props.provinceSelected"
|
||||||
:country-fk="$props.countryFk"
|
:country-fk="$props.countryFk"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:provinces="$props.provinces"
|
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -22,12 +22,15 @@ const postcodeFormData = reactive({
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const townsFetchDataRef = ref(null);
|
const townsFetchDataRef = ref(false);
|
||||||
const provincesFetchDataRef = ref(null);
|
const countriesFetchDataRef = ref(false);
|
||||||
|
const provincesFetchDataRef = ref(false);
|
||||||
const countriesOptions = ref([]);
|
const countriesOptions = ref([]);
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
const townsOptions = ref([]);
|
const townsOptions = ref([]);
|
||||||
const town = ref({});
|
const town = ref({});
|
||||||
|
const townFilter = ref({});
|
||||||
|
const countryFilter = ref({});
|
||||||
|
|
||||||
function onDataSaved(formData) {
|
function onDataSaved(formData) {
|
||||||
const newPostcode = {
|
const newPostcode = {
|
||||||
|
@ -56,10 +59,60 @@ async function onCityCreated(newTown, formData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTown(newTown, data) {
|
function setTown(newTown, data) {
|
||||||
if (!newTown) return;
|
|
||||||
town.value = newTown;
|
town.value = newTown;
|
||||||
data.provinceFk = newTown.provinceFk;
|
data.provinceFk = newTown?.provinceFk ?? newTown;
|
||||||
data.countryFk = newTown.province.countryFk;
|
data.countryFk = newTown?.province?.countryFk ?? newTown;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setCountry(countryFk, data) {
|
||||||
|
data.townFk = null;
|
||||||
|
data.provinceFk = null;
|
||||||
|
data.countryFk = countryFk;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function filterTowns(name) {
|
||||||
|
if (name !== '') {
|
||||||
|
townFilter.value.where = {
|
||||||
|
name: {
|
||||||
|
like: `%${name}%`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await townsFetchDataRef.value?.fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function filterCountries(name) {
|
||||||
|
if (name !== '') {
|
||||||
|
countryFilter.value.where = {
|
||||||
|
name: {
|
||||||
|
like: `%${name}%`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await countriesFetchDataRef.value?.fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchTowns(countryFk) {
|
||||||
|
if (!countryFk) return;
|
||||||
|
townFilter.value.where = {
|
||||||
|
provinceFk: {
|
||||||
|
inq: provincesOptions.value.map(({ id }) => id),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await townsFetchDataRef.value?.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleProvinces(data) {
|
||||||
|
provincesOptions.value = data;
|
||||||
|
if (postcodeFormData.countryFk) {
|
||||||
|
await fetchTowns(postcodeFormData.countryFk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function handleTowns(data) {
|
||||||
|
townsOptions.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCountries(data) {
|
||||||
|
countriesOptions.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setProvince(id, data) {
|
async function setProvince(id, data) {
|
||||||
|
@ -73,60 +126,7 @@ async function onProvinceCreated(data) {
|
||||||
await provincesFetchDataRef.value.fetch({
|
await provincesFetchDataRef.value.fetch({
|
||||||
where: { countryFk: postcodeFormData.countryFk },
|
where: { countryFk: postcodeFormData.countryFk },
|
||||||
});
|
});
|
||||||
postcodeFormData.provinceFk.value = data.id;
|
postcodeFormData.provinceFk = data.id;
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => [postcodeFormData.countryFk],
|
|
||||||
async (newCountryFk, oldValueFk) => {
|
|
||||||
if (Array.isArray(newCountryFk)) {
|
|
||||||
newCountryFk = newCountryFk[0];
|
|
||||||
}
|
|
||||||
if (Array.isArray(oldValueFk)) {
|
|
||||||
oldValueFk = oldValueFk[0];
|
|
||||||
}
|
|
||||||
if (!!oldValueFk && newCountryFk !== oldValueFk) {
|
|
||||||
postcodeFormData.provinceFk = null;
|
|
||||||
postcodeFormData.townFk = null;
|
|
||||||
}
|
|
||||||
if (oldValueFk !== newCountryFk) {
|
|
||||||
await provincesFetchDataRef.value.fetch({
|
|
||||||
where: {
|
|
||||||
countryFk: newCountryFk,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
await townsFetchDataRef.value.fetch({
|
|
||||||
where: {
|
|
||||||
provinceFk: {
|
|
||||||
inq: provincesOptions.value.map(({ id }) => id),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => postcodeFormData.provinceFk,
|
|
||||||
async (newProvinceFk, oldValueFk) => {
|
|
||||||
if (Array.isArray(newProvinceFk)) {
|
|
||||||
newProvinceFk = newProvinceFk[0];
|
|
||||||
}
|
|
||||||
if (newProvinceFk !== oldValueFk) {
|
|
||||||
await townsFetchDataRef.value.fetch({
|
|
||||||
where: { provinceFk: newProvinceFk },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
async function handleProvinces(data) {
|
|
||||||
provincesOptions.value = data;
|
|
||||||
}
|
|
||||||
async function handleTowns(data) {
|
|
||||||
townsOptions.value = data;
|
|
||||||
}
|
|
||||||
async function handleCountries(data) {
|
|
||||||
countriesOptions.value = data;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -143,10 +143,20 @@ async function handleCountries(data) {
|
||||||
ref="townsFetchDataRef"
|
ref="townsFetchDataRef"
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
:limit="30"
|
:limit="30"
|
||||||
|
:filter="townFilter"
|
||||||
@on-fetch="handleTowns"
|
@on-fetch="handleTowns"
|
||||||
auto-load
|
auto-load
|
||||||
url="Towns/location"
|
url="Towns/location"
|
||||||
/>
|
/>
|
||||||
|
<FetchData
|
||||||
|
ref="countriesFetchDataRef"
|
||||||
|
:limit="30"
|
||||||
|
:filter="countryFilter"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
@on-fetch="handleCountries"
|
||||||
|
auto-load
|
||||||
|
url="Countries"
|
||||||
|
/>
|
||||||
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
url-create="postcodes"
|
url-create="postcodes"
|
||||||
|
@ -168,6 +178,7 @@ async function handleCountries(data) {
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('City')"
|
:label="t('City')"
|
||||||
@update:model-value="(value) => setTown(value, data)"
|
@update:model-value="(value) => setTown(value, data)"
|
||||||
|
@filter="filterTowns"
|
||||||
:tooltip="t('Create city')"
|
:tooltip="t('Create city')"
|
||||||
v-model="data.townFk"
|
v-model="data.townFk"
|
||||||
:options="townsOptions"
|
:options="townsOptions"
|
||||||
|
@ -193,7 +204,6 @@ async function handleCountries(data) {
|
||||||
<CreateNewCityForm
|
<CreateNewCityForm
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
:provinces="provincesOptions"
|
|
||||||
@on-data-saved="
|
@on-data-saved="
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onCityCreated(requestResponse, data)
|
onCityCreated(requestResponse, data)
|
||||||
|
@ -208,20 +218,20 @@ async function handleCountries(data) {
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
@update:model-value="(value) => setProvince(value, data)"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:clearable="true"
|
@on-province-fetched="handleProvinces"
|
||||||
:provinces="provincesOptions"
|
|
||||||
@on-province-created="onProvinceCreated"
|
@on-province-created="onProvinceCreated"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Countries"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
@update:options="handleCountries"
|
@update:options="handleCountries"
|
||||||
|
:options="countriesOptions"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@filter="filterCountries"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.countryFk"
|
v-model="data.countryFk"
|
||||||
:rules="validate('postcode.countryFk')"
|
:rules="validate('postcode.countryFk')"
|
||||||
|
@update:model-value="(value) => setCountry(value, data)"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -34,6 +34,12 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
);
|
);
|
||||||
emit('onDataSaved', dataSaved, requestResponse);
|
emit('onDataSaved', dataSaved, requestResponse);
|
||||||
};
|
};
|
||||||
|
const where = computed(() => {
|
||||||
|
if (!$props.countryFk) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return { countryFk: $props.countryFk };
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -41,9 +47,7 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
:filter="{
|
:filter="{
|
||||||
where: {
|
where,
|
||||||
countryFk: $props.countryFk,
|
|
||||||
},
|
|
||||||
}"
|
}"
|
||||||
url="Autonomies/location"
|
url="Autonomies/location"
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
|
|
|
@ -94,6 +94,7 @@ defineExpose({
|
||||||
saveChanges,
|
saveChanges,
|
||||||
getChanges,
|
getChanges,
|
||||||
formData,
|
formData,
|
||||||
|
originalData,
|
||||||
vnPaginateRef,
|
vnPaginateRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,6 @@ const rotateRight = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
try {
|
|
||||||
if (!newPhoto.files && !newPhoto.url) {
|
if (!newPhoto.files && !newPhoto.url) {
|
||||||
notify(t('Select an image'), 'negative');
|
notify(t('Select an image'), 'negative');
|
||||||
return;
|
return;
|
||||||
|
@ -173,9 +172,6 @@ const onSubmit = () => {
|
||||||
newPhoto.blob = file;
|
newPhoto.blob = file;
|
||||||
})
|
})
|
||||||
.then(() => makeRequest());
|
.then(() => makeRequest());
|
||||||
} catch (err) {
|
|
||||||
console.error('Error uploading image');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const makeRequest = async () => {
|
const makeRequest = async () => {
|
||||||
|
|
|
@ -51,7 +51,6 @@ const onDataSaved = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||||
const payload = {
|
const payload = {
|
||||||
|
@ -63,9 +62,6 @@ const onSubmit = async () => {
|
||||||
await axios.post($props.editUrl, payload);
|
await axios.post($props.editUrl, payload);
|
||||||
onDataSaved();
|
onDataSaved();
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error submitting table cell edit');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -84,7 +84,6 @@ const tableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
let filter = itemFilter;
|
let filter = itemFilter;
|
||||||
const params = itemFilterParams;
|
const params = itemFilterParams;
|
||||||
const where = {};
|
const where = {};
|
||||||
|
@ -109,9 +108,6 @@ const onSubmit = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
tableRows.value = data;
|
tableRows.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching entries items');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -86,7 +86,6 @@ const tableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
let filter = travelFilter;
|
let filter = travelFilter;
|
||||||
const params = travelFilterParams;
|
const params = travelFilterParams;
|
||||||
const where = {};
|
const where = {};
|
||||||
|
@ -109,9 +108,6 @@ const onSubmit = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
tableRows.value = data;
|
tableRows.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching travels');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -91,6 +91,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
maxWidth: {
|
||||||
|
type: [String, Boolean],
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
|
@ -283,6 +287,7 @@ defineExpose({
|
||||||
@submit="save"
|
@submit="save"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
|
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
||||||
id="formModel"
|
id="formModel"
|
||||||
>
|
>
|
||||||
<QCard>
|
<QCard>
|
||||||
|
@ -371,7 +376,6 @@ defineExpose({
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
#formModel {
|
#formModel {
|
||||||
max-width: 800px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const emit = defineEmits(['onSubmit']);
|
const emit = defineEmits(['onSubmit']);
|
||||||
|
|
||||||
defineProps({
|
const $props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -25,16 +25,21 @@ defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
submitOnEnter: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
if ($props.submitOnEnter) {
|
||||||
emit('onSubmit');
|
emit('onSubmit');
|
||||||
closeForm();
|
closeForm();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -88,7 +88,6 @@ const applyTags = (params, search) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchItemTypes = async (id) => {
|
const fetchItemTypes = async (id) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'name', 'categoryFk'],
|
fields: ['id', 'name', 'categoryFk'],
|
||||||
where: { categoryFk: id },
|
where: { categoryFk: id },
|
||||||
|
@ -99,9 +98,6 @@ const fetchItemTypes = async (id) => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
itemTypesOptions.value = data;
|
itemTypesOptions.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching item types', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryClass = (category, params) => {
|
const getCategoryClass = (category, params) => {
|
||||||
|
@ -111,7 +107,6 @@ const getCategoryClass = (category, params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag?.selectedTag?.id) return;
|
if (!tag?.selectedTag?.id) return;
|
||||||
tag.value = null;
|
tag.value = null;
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -125,9 +120,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tag.valueOptions = data;
|
tag.valueOptions = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTag = (index, params, search) => {
|
const removeTag = (index, params, search) => {
|
||||||
|
|
|
@ -39,14 +39,10 @@ const refund = async () => {
|
||||||
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
||||||
notify(t('Refunded invoice'), 'positive');
|
notify(t('Refunded invoice'), 'positive');
|
||||||
const [id] = data?.refundId || [];
|
const [id] = data?.refundId || [];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error refunding invoice', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ const makeInvoice = async () => {
|
||||||
makeInvoice: checked.value,
|
makeInvoice: checked.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
if (checked.value && hasToInvoiceByAddress) {
|
if (checked.value && hasToInvoiceByAddress) {
|
||||||
const response = await new Promise((resolve) => {
|
const response = await new Promise((resolve) => {
|
||||||
quasar
|
quasar
|
||||||
|
@ -76,9 +75,6 @@ const makeInvoice = async () => {
|
||||||
notify(t('Transferred invoice'), 'positive');
|
notify(t('Transferred invoice'), 'positive');
|
||||||
const id = data?.[0];
|
const id = data?.[0];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error transfering invoice', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onProvinceCreated']);
|
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
countryFk: {
|
countryFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -17,20 +17,23 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const provinceFk = defineModel({ type: Number, default: null });
|
const provinceFk = defineModel({ type: Number, default: null });
|
||||||
|
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const filter = ref({
|
||||||
|
include: { relation: 'country' },
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
});
|
||||||
const provincesOptions = ref($props.provinces);
|
const provincesOptions = ref($props.provinces);
|
||||||
provinceFk.value = $props.provinceSelected;
|
|
||||||
const provincesFetchDataRef = ref();
|
const provincesFetchDataRef = ref();
|
||||||
|
provinceFk.value = $props.provinceSelected;
|
||||||
|
if (!$props.countryFk) {
|
||||||
|
filter.value.where = {};
|
||||||
|
}
|
||||||
async function onProvinceCreated(_, data) {
|
async function onProvinceCreated(_, data) {
|
||||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||||
provinceFk.value = data.id;
|
provinceFk.value = data.id;
|
||||||
|
@ -39,25 +42,33 @@ async function onProvinceCreated(_, data) {
|
||||||
async function handleProvinces(data) {
|
async function handleProvinces(data) {
|
||||||
provincesOptions.value = data;
|
provincesOptions.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => $props.countryFk,
|
||||||
|
async () => {
|
||||||
|
if ($props.countryFk) {
|
||||||
|
filter.value.where.countryFk = $props.countryFk;
|
||||||
|
} else filter.value.where = {};
|
||||||
|
await provincesFetchDataRef.value.fetch({});
|
||||||
|
emit('onProvinceFetched', provincesOptions.value);
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="provincesFetchDataRef"
|
ref="provincesFetchDataRef"
|
||||||
:filter="{
|
:filter="filter"
|
||||||
include: { relation: 'country' },
|
|
||||||
where: {
|
|
||||||
countryFk: $props.countryFk,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
@on-fetch="handleProvinces"
|
@on-fetch="handleProvinces"
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
:options="$props.provinces"
|
:options="provincesOptions"
|
||||||
:tooltip="t('Create province')"
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
:clearable="true"
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
:rules="validate && validate('postcode.provinceFk')"
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
|
|
|
@ -58,7 +58,6 @@ const getConfig = async (url, filter) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchViewConfigData = async () => {
|
const fetchViewConfigData = async () => {
|
||||||
try {
|
|
||||||
const userConfigFilter = {
|
const userConfigFilter = {
|
||||||
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
||||||
};
|
};
|
||||||
|
@ -83,13 +82,9 @@ const fetchViewConfigData = async () => {
|
||||||
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
||||||
setUserConfigViewData(defaultColumns);
|
setUserConfigViewData(defaultColumns);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching config view data', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveConfig = async () => {
|
const saveConfig = async () => {
|
||||||
try {
|
|
||||||
const params = {};
|
const params = {};
|
||||||
const configuration = {};
|
const configuration = {};
|
||||||
|
|
||||||
|
@ -128,9 +123,6 @@ const saveConfig = async () => {
|
||||||
emitSavedConfig();
|
emitSavedConfig();
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
popupProxyRef.value.hide();
|
popupProxyRef.value.hide();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error saving user view config', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const emitSavedConfig = () => {
|
const emitSavedConfig = () => {
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { nextTick, ref, watch } from 'vue';
|
||||||
import { QInput } from 'quasar';
|
import { QInput } from 'quasar';
|
||||||
|
|
||||||
const props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
insertable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||||
|
|
||||||
let internalValue = ref(props.modelValue);
|
let internalValue = ref($props.modelValue);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => $props.modelValue,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
internalValue.value = newVal;
|
internalValue.value = newVal;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +32,46 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleKeydown = (e) => {
|
||||||
|
if (e.key === 'Backspace') return;
|
||||||
|
if (e.key === '.') {
|
||||||
|
accountShortToStandard();
|
||||||
|
// TODO: Fix this setTimeout, with nextTick doesn't work
|
||||||
|
setTimeout(() => {
|
||||||
|
setCursorPosition(0, e.target);
|
||||||
|
}, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($props.insertable && e.key.match(/[0-9]/)) {
|
||||||
|
handleInsertMode(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function setCursorPosition(pos, el = vnInputRef.value) {
|
||||||
|
el.focus();
|
||||||
|
el.setSelectionRange(pos, pos);
|
||||||
|
}
|
||||||
|
const vnInputRef = ref(false);
|
||||||
|
const handleInsertMode = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = e.target;
|
||||||
|
const cursorPos = input.selectionStart;
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
let currentValue = internalValue.value;
|
||||||
|
if (!currentValue) currentValue = e.key;
|
||||||
|
const newValue = e.key;
|
||||||
|
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
||||||
|
internalValue.value =
|
||||||
|
currentValue.substring(0, cursorPos) +
|
||||||
|
newValue +
|
||||||
|
currentValue.substring(cursorPos + 1);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
function accountShortToStandard() {
|
function accountShortToStandard() {
|
||||||
internalValue.value = internalValue.value.replace(
|
internalValue.value = internalValue.value?.replace(
|
||||||
'.',
|
'.',
|
||||||
'0'.repeat(11 - internalValue.value.length)
|
'0'.repeat(11 - internalValue.value.length)
|
||||||
);
|
);
|
||||||
|
@ -37,5 +79,5 @@ function accountShortToStandard() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-input v-model="internalValue" />
|
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, useAttrs } from 'vue';
|
import { computed, ref, useAttrs, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
|
@ -34,6 +34,14 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
insertable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
maxlength: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const vnInputRef = ref(null);
|
const vnInputRef = ref(null);
|
||||||
|
@ -69,6 +77,9 @@ const mixinRules = [
|
||||||
requiredFieldRule,
|
requiredFieldRule,
|
||||||
...($attrs.rules ?? []),
|
...($attrs.rules ?? []),
|
||||||
(val) => {
|
(val) => {
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
if (maxlength && +val.length > maxlength)
|
||||||
|
return t(`maxLength`, { value: maxlength });
|
||||||
const { min, max } = vnInputRef.value.$attrs;
|
const { min, max } = vnInputRef.value.$attrs;
|
||||||
if (!min) return null;
|
if (!min) return null;
|
||||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
||||||
|
@ -78,6 +89,33 @@ const mixinRules = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const handleKeydown = (e) => {
|
||||||
|
if (e.key === 'Backspace') return;
|
||||||
|
|
||||||
|
if ($props.insertable && e.key.match(/[0-9]/)) {
|
||||||
|
handleInsertMode(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInsertMode = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = e.target;
|
||||||
|
const cursorPos = input.selectionStart;
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
let currentValue = value.value;
|
||||||
|
if (!currentValue) currentValue = e.key;
|
||||||
|
const newValue = e.key;
|
||||||
|
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
||||||
|
value.value =
|
||||||
|
currentValue.substring(0, cursorPos) +
|
||||||
|
newValue +
|
||||||
|
currentValue.substring(cursorPos + 1);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -89,10 +127,12 @@ const mixinRules = [
|
||||||
:type="$attrs.type"
|
:type="$attrs.type"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
|
@keydown="handleKeydown"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
:lazy-rules="true"
|
:lazy-rules="true"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||||
>
|
>
|
||||||
<template v-if="$slots.prepend" #prepend>
|
<template v-if="$slots.prepend" #prepend>
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
|
@ -129,9 +169,11 @@ const mixinRules = [
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
inputMin: Must be more than {value}
|
inputMin: Must be more than {value}
|
||||||
|
maxLength: The value exceeds {value} characters
|
||||||
inputMax: Must be less than {value}
|
inputMax: Must be less than {value}
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
|
maxLength: El valor excede los {value} carácteres
|
||||||
inputMax: Debe ser menor a {value}
|
inputMax: Debe ser menor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -306,6 +306,7 @@ function handleKeyDown(event) {
|
||||||
:input-debounce="useURL ? '300' : '0'"
|
:input-debounce="useURL ? '300' : '0'"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
>
|
>
|
||||||
<template v-if="isClearable" #append>
|
<template v-if="isClearable" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -74,6 +74,9 @@ const arrayData = useArrayData($props.dataKey, {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const userParams = ref({});
|
const userParams = ref({});
|
||||||
|
|
||||||
|
defineExpose({ search, sanitizer, params: userParams });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
userParams.value = $props.modelValue ?? {};
|
userParams.value = $props.modelValue ?? {};
|
||||||
emit('init', { params: userParams.value });
|
emit('init', { params: userParams.value });
|
||||||
|
@ -197,7 +200,7 @@ const customTags = computed(() =>
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
userParams.value[key] = undefined;
|
userParams.value[key] = undefined;
|
||||||
search();
|
await search();
|
||||||
emit('remove', key);
|
emit('remove', key);
|
||||||
emit('update:modelValue', userParams.value);
|
emit('update:modelValue', userParams.value);
|
||||||
}
|
}
|
||||||
|
@ -223,8 +226,6 @@ function sanitizer(params) {
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ search, sanitizer, userParams });
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -132,10 +132,24 @@ const addFilter = async (filter, params) => {
|
||||||
|
|
||||||
async function fetch(params) {
|
async function fetch(params) {
|
||||||
useArrayData(props.dataKey, params);
|
useArrayData(props.dataKey, params);
|
||||||
arrayData.reset(['filter.skip', 'skip']);
|
arrayData.reset(['filter.skip', 'skip', 'page']);
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
if (!store.hasMoreData) isLoading.value = false;
|
return emitStoreData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(params) {
|
||||||
|
useArrayData(props.dataKey, params);
|
||||||
|
const { limit, skip } = store;
|
||||||
|
store.limit = limit + skip;
|
||||||
|
store.skip = 0;
|
||||||
|
await arrayData.fetch({ append: false });
|
||||||
|
store.limit = limit;
|
||||||
|
store.skip = skip;
|
||||||
|
return emitStoreData();
|
||||||
|
}
|
||||||
|
|
||||||
|
function emitStoreData() {
|
||||||
|
if (!store.hasMoreData) isLoading.value = false;
|
||||||
emit('onFetch', store.data);
|
emit('onFetch', store.data);
|
||||||
return store.data;
|
return store.data;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +195,7 @@ async function onLoad(index, done) {
|
||||||
done(isDone);
|
done(isDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ fetch, addFilter, paginate });
|
defineExpose({ fetch, update, addFilter, paginate });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { getUrl } from './getUrl';
|
import { getUrl } from './getUrl';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { exportFile } from 'quasar';
|
||||||
|
|
||||||
const { getTokenMultimedia } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
|
|
||||||
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
||||||
let appUrl = await getUrl('', 'lilium');
|
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
|
||||||
appUrl = appUrl.replace('/#/', '');
|
const response = await axios.get(
|
||||||
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
|
url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`,
|
||||||
|
{ responseType: 'blob' }
|
||||||
|
);
|
||||||
|
|
||||||
|
const contentDisposition = response.headers['content-disposition'];
|
||||||
|
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
|
||||||
|
const filename =
|
||||||
|
matches != null && matches[1]
|
||||||
|
? matches[1].replace(/['"]/g, '')
|
||||||
|
: 'downloaded-file';
|
||||||
|
|
||||||
|
exportFile(filename, response.data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const params = { filter };
|
const params = { filter };
|
||||||
|
|
||||||
Object.assign(params, userParams);
|
Object.assign(params, userParams);
|
||||||
params.filter.skip = store.skip;
|
if (params.filter) params.filter.skip = store.skip;
|
||||||
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||||
if (store.order?.length) params.filter.order = [...store.order];
|
if (store.order?.length) params.filter.order = [...store.order];
|
||||||
else delete params.filter.order;
|
else delete params.filter.order;
|
||||||
|
|
|
@ -60,7 +60,7 @@ globals:
|
||||||
reference: Reference
|
reference: Reference
|
||||||
agency: Agency
|
agency: Agency
|
||||||
warehouseOut: Warehouse Out
|
warehouseOut: Warehouse Out
|
||||||
wareHouseIn: Warehouse In
|
warehouseIn: Warehouse In
|
||||||
landed: Landed
|
landed: Landed
|
||||||
shipped: Shipped
|
shipped: Shipped
|
||||||
totalEntries: Total entries
|
totalEntries: Total entries
|
||||||
|
@ -298,6 +298,7 @@ globals:
|
||||||
clientsActionsMonitor: Clients and actions
|
clientsActionsMonitor: Clients and actions
|
||||||
serial: Serial
|
serial: Serial
|
||||||
medical: Mutual
|
medical: Mutual
|
||||||
|
pit: IRPF
|
||||||
RouteExtendedList: Router
|
RouteExtendedList: Router
|
||||||
wasteRecalc: Waste recaclulate
|
wasteRecalc: Waste recaclulate
|
||||||
operator: Operator
|
operator: Operator
|
||||||
|
|
|
@ -303,6 +303,7 @@ globals:
|
||||||
clientsActionsMonitor: Clientes y acciones
|
clientsActionsMonitor: Clientes y acciones
|
||||||
serial: Facturas por serie
|
serial: Facturas por serie
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
|
pit: IRPF
|
||||||
wasteRecalc: Recalcular mermas
|
wasteRecalc: Recalcular mermas
|
||||||
operator: Operario
|
operator: Operario
|
||||||
parking: Parking
|
parking: Parking
|
||||||
|
|
|
@ -11,21 +11,13 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const onSynchronizeAll = async () => {
|
const onSynchronizeAll = async () => {
|
||||||
try {
|
|
||||||
notify(t('Synchronizing in the background'), 'positive');
|
notify(t('Synchronizing in the background'), 'positive');
|
||||||
await axios.patch(`Accounts/syncAll`);
|
await axios.patch(`Accounts/syncAll`);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error synchronizing all accounts', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSynchronizeRoles = async () => {
|
const onSynchronizeRoles = async () => {
|
||||||
try {
|
|
||||||
await axios.patch(`RoleInherits/sync`);
|
await axios.patch(`RoleInherits/sync`);
|
||||||
notify(t('Roles synchronized!'), 'positive');
|
notify(t('Roles synchronized!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error synchronizing roles', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const deleteAcl = async ({ id }) => {
|
const deleteAcl = async ({ id }) => {
|
||||||
try {
|
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
|
@ -131,9 +130,6 @@ const deleteAcl = async ({ id }) => {
|
||||||
await axios.delete(`ACLs/${id}`);
|
await axios.delete(`ACLs/${id}`);
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
notify('ACL removed', 'positive');
|
notify('ACL removed', 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error deleting Acl: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,9 @@ const refresh = () => paginateRef.value.fetch();
|
||||||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||||
|
|
||||||
const killSession = async ({ userId, created }) => {
|
const killSession = async ({ userId, created }) => {
|
||||||
try {
|
|
||||||
await axios.post(`${urlPath}/killSession`, { userId, created });
|
await axios.post(`${urlPath}/killSession`, { userId, created });
|
||||||
paginateRef.value.fetch();
|
paginateRef.value.fetch();
|
||||||
notify(t('Session killed'), 'positive');
|
notify(t('Session killed'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error killing session', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,8 @@ const formUrlCreate = ref(null);
|
||||||
const formUrlUpdate = ref(null);
|
const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
try {
|
|
||||||
await axios.get(`LdapConfigs/test`);
|
await axios.get(`LdapConfigs/test`);
|
||||||
notify(t('LDAP connection established!'), 'positive');
|
notify(t('LDAP connection established!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error testing connection', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const getInitialLdapConfig = async () => {
|
const getInitialLdapConfig = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -72,14 +68,10 @@ const getInitialLdapConfig = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialLdapConfig());
|
onMounted(async () => await getInitialLdapConfig());
|
||||||
|
|
|
@ -46,12 +46,8 @@ const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
|
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
try {
|
|
||||||
await axios.get(`SambaConfigs/test`);
|
await axios.get(`SambaConfigs/test`);
|
||||||
notify(t('Samba connection established!'), 'positive');
|
notify(t('Samba connection established!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error testing connection', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInitialSambaConfig = async () => {
|
const getInitialSambaConfig = async () => {
|
||||||
|
@ -79,14 +75,10 @@ const getInitialSambaConfig = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialSambaConfig());
|
onMounted(async () => await getInitialSambaConfig());
|
||||||
|
|
|
@ -44,13 +44,9 @@ const removeAlias = () => {
|
||||||
cancel: true,
|
cancel: true,
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
try {
|
|
||||||
await axios.delete(`MailAliases/${entityId.value}`);
|
await axios.delete(`MailAliases/${entityId.value}`);
|
||||||
notify(t('Alias removed'), 'positive');
|
notify(t('Alias removed'), 'positive');
|
||||||
router.push({ name: 'AccountAlias' });
|
router.push({ name: 'AccountAlias' });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing alias');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -41,35 +41,22 @@ const fetchAccountExistence = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchMailForwards = async () => {
|
const fetchMailForwards = async () => {
|
||||||
try {
|
|
||||||
const response = await axios.get(`MailForwards/${route.params.id}`);
|
const response = await axios.get(`MailForwards/${route.params.id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching mail forwards', err);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(`MailForwards/${route.params.id}`);
|
await axios.delete(`MailForwards/${route.params.id}`);
|
||||||
formData.value.forwardTo = null;
|
formData.value.forwardTo = null;
|
||||||
initialData.value.forwardTo = null;
|
initialData.value.forwardTo = null;
|
||||||
initialData.value.hasData = hasData.value;
|
initialData.value.hasData = hasData.value;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMailForward = async () => {
|
const updateMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.patch('MailForwards', formData.value);
|
await axios.patch('MailForwards', formData.value);
|
||||||
initialData.value = { ...formData.value };
|
initialData.value = { ...formData.value };
|
||||||
initialData.value.hasData = hasData.value;
|
initialData.value.hasData = hasData.value;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error creating mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -32,12 +32,8 @@ const filter = {
|
||||||
where: { id: entityId },
|
where: { id: entityId },
|
||||||
};
|
};
|
||||||
const removeRole = async () => {
|
const removeRole = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(`VnRoles/${entityId.value}`);
|
await axios.delete(`VnRoles/${entityId.value}`);
|
||||||
notify(t('Role removed'), 'positive');
|
notify(t('Role removed'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error deleting role', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ const columns = computed(() => [
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
orderBy: 'priority',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
|
|
@ -167,7 +167,7 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
<div>{{ item.street }}</div>
|
<div>{{ item.street }}</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.postalCode }} - {{ item.city }},
|
{{ item.postalCode }} - {{ item.city }},
|
||||||
{{ item.province.name }}
|
{{ item.province?.name }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.phone }}
|
{{ item.phone }}
|
||||||
|
|
|
@ -106,7 +106,6 @@ const setParams = (params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPreview = async () => {
|
const getPreview = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
recipientId: entityId,
|
recipientId: entityId,
|
||||||
};
|
};
|
||||||
|
@ -125,9 +124,6 @@ const getPreview = async () => {
|
||||||
htmlContent: data,
|
htmlContent: data,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
notify('Errors getting preview', 'negative');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -42,13 +42,9 @@ const setData = (entity) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeDepartment = async () => {
|
const removeDepartment = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
||||||
router.push({ name: 'WorkerDepartment' });
|
router.push({ name: 'WorkerDepartment' });
|
||||||
notify('department.departmentRemoved', 'positive');
|
notify('department.departmentRemoved', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing department');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
|
@ -236,13 +236,9 @@ const copyOriginalRowsData = (rows) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveChange = async (field, { rowIndex, row }) => {
|
const saveChange = async (field, { rowIndex, row }) => {
|
||||||
try {
|
|
||||||
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
||||||
await axios.patch(`Buys/${row.id}`, row);
|
await axios.patch(`Buys/${row.id}`, row);
|
||||||
originalRowDataCopy.value[rowIndex][field] = row[field];
|
originalRowDataCopy.value[rowIndex][field] = row[field];
|
||||||
} catch (err) {
|
|
||||||
console.error('Error saving changes', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openRemoveDialog = async () => {
|
const openRemoveDialog = async () => {
|
||||||
|
@ -260,15 +256,11 @@ const openRemoveDialog = async () => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
try {
|
|
||||||
await deleteBuys();
|
await deleteBuys();
|
||||||
const notifyMessage = t(
|
const notifyMessage = t(
|
||||||
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
||||||
);
|
);
|
||||||
notify(notifyMessage, 'positive');
|
notify(notifyMessage, 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting buys');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -282,7 +274,6 @@ const importBuys = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleGroupingMode = async (buy, mode) => {
|
const toggleGroupingMode = async (buy, mode) => {
|
||||||
try {
|
|
||||||
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
||||||
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -290,9 +281,6 @@ const toggleGroupingMode = async (buy, mode) => {
|
||||||
};
|
};
|
||||||
await axios.patch(`Buys/${buy.id}`, params);
|
await axios.patch(`Buys/${buy.id}`, params);
|
||||||
buy.groupingMode = newGroupingMode;
|
buy.groupingMode = newGroupingMode;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error toggling grouping mode');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const lockIconType = (groupingMode, mode) => {
|
const lockIconType = (groupingMode, mode) => {
|
||||||
|
|
|
@ -123,20 +123,15 @@ const fillData = async (rawData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchBuys = async (buys) => {
|
const fetchBuys = async (buys) => {
|
||||||
try {
|
|
||||||
const params = { buys };
|
const params = { buys };
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(
|
||||||
`Entries/${route.params.id}/importBuysPreview`,
|
`Entries/${route.params.id}/importBuysPreview`,
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
importData.value.buys = data;
|
importData.value.buys = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching buys');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
const params = importData.value;
|
const params = importData.value;
|
||||||
const hasAnyEmptyRow = params.buys.some((buy) => {
|
const hasAnyEmptyRow = params.buys.some((buy) => {
|
||||||
return buy.itemFk === null;
|
return buy.itemFk === null;
|
||||||
|
@ -150,9 +145,6 @@ const onSubmit = async () => {
|
||||||
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
redirectToBuysView();
|
redirectToBuysView();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error importing buys', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const redirectToBuysView = () => {
|
const redirectToBuysView = () => {
|
||||||
|
|
|
@ -147,12 +147,9 @@ async function setEntryData(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchEntryBuys = async () => {
|
const fetchEntryBuys = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
||||||
if (data) entryBuys.value = data;
|
if (data) entryBuys.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching entry buys');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ const recalc = async () => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
await axios.post('Applications/waste_addSales/execute-proc', params);
|
await axios.post('Applications/waste_addSales/execute-proc', params);
|
||||||
notify('wasteRecalc.recalcOk', 'positive');
|
notify('wasteRecalc.recalcOk', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ const showSendInvoiceDialog = (type) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendEmailInvoice = async ({ address }) => {
|
const sendEmailInvoice = async ({ address }) => {
|
||||||
try {
|
|
||||||
if (!address) notify(`The email can't be empty`, 'negative');
|
if (!address) notify(`The email can't be empty`, 'negative');
|
||||||
|
|
||||||
if (invoiceFormType.value === 'pdf') {
|
if (invoiceFormType.value === 'pdf') {
|
||||||
|
@ -70,16 +69,10 @@ const sendEmailInvoice = async ({ address }) => {
|
||||||
recipient: address,
|
recipient: address,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return sendEmail(
|
return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, {
|
||||||
`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`,
|
|
||||||
{
|
|
||||||
recipientId: $props.invoiceOutData.client.id,
|
recipientId: $props.invoiceOutData.client.id,
|
||||||
recipient: address,
|
recipient: address,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error sending email', err);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,34 +81,21 @@ const redirectToInvoiceOutList = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteInvoice = async () => {
|
const deleteInvoice = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
|
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
|
||||||
notify(t('InvoiceOut deleted'), 'positive');
|
notify(t('InvoiceOut deleted'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting invoice out', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const bookInvoice = async () => {
|
const bookInvoice = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
|
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
|
||||||
notify(t('InvoiceOut booked'), 'positive');
|
notify(t('InvoiceOut booked'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error booking invoice out', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateInvoicePdf = async () => {
|
const generateInvoicePdf = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
|
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
|
||||||
notify(t('The invoice PDF document has been regenerated'), 'positive');
|
notify(t('The invoice PDF document has been regenerated'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error generating invoice out pdf', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const refundInvoice = async (withWarehouse) => {
|
const refundInvoice = async (withWarehouse) => {
|
||||||
try {
|
|
||||||
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
|
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
|
||||||
const { data } = await axios.post('InvoiceOuts/refund', params);
|
const { data } = await axios.post('InvoiceOuts/refund', params);
|
||||||
location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
|
location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
|
||||||
|
@ -125,9 +105,6 @@ const refundInvoice = async (withWarehouse) => {
|
||||||
}),
|
}),
|
||||||
'positive'
|
'positive'
|
||||||
);
|
);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error generating invoice out pdf', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showTransferInvoiceForm = async () => {
|
const showTransferInvoiceForm = async () => {
|
||||||
|
|
|
@ -135,15 +135,10 @@ onMounted(() => (stateStore.rightDrawer = true));
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
function openPdf(id) {
|
function openPdf(id) {
|
||||||
try {
|
|
||||||
openReport(`${MODEL}/${id}/download`);
|
openReport(`${MODEL}/${id}/download`);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error opening PDF', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadPdf() {
|
function downloadPdf() {
|
||||||
try {
|
|
||||||
if (selectedRows.value.size === 0) return;
|
if (selectedRows.value.size === 0) return;
|
||||||
const selectedCardsArray = Array.from(selectedRows.value.values());
|
const selectedCardsArray = Array.from(selectedRows.value.values());
|
||||||
|
|
||||||
|
@ -162,9 +157,7 @@ function downloadPdf() {
|
||||||
|
|
||||||
openReport(`${MODEL}/downloadZip`, params);
|
openReport(`${MODEL}/downloadZip`, params);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error opening PDF');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(selectedRows);
|
watchEffect(selectedRows);
|
||||||
|
|
|
@ -45,13 +45,9 @@ const arrayData = useArrayData('ItemShelvings', {
|
||||||
const rows = computed(() => arrayData.store.data || []);
|
const rows = computed(() => arrayData.store.data || []);
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
const applyColumnFilter = async (col) => {
|
||||||
try {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||||
params[paramKey] = col.columnFilter.filterValue;
|
params[paramKey] = col.columnFilter.filterValue;
|
||||||
await arrayData.addFilter({ filter: null, params });
|
await arrayData.addFilter({ filter: null, params });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error applying column filter', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInputEvents = (col) => {
|
const getInputEvents = (col) => {
|
||||||
|
@ -173,15 +169,11 @@ const totalLabels = computed(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const removeLines = async () => {
|
const removeLines = async () => {
|
||||||
try {
|
|
||||||
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
||||||
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
||||||
rowsSelected.value = [];
|
rowsSelected.value = [];
|
||||||
notify('shelvings.shelvingsRemoved', 'positive');
|
notify('shelvings.shelvingsRemoved', 'positive');
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing lines', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
|
|
|
@ -19,7 +19,6 @@ const tagOptions = ref([]);
|
||||||
const valueOptionsMap = ref(new Map());
|
const valueOptionsMap = ref(new Map());
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag.tagFk && tag.tag.isFree) return;
|
if (!tag.tagFk && tag.tag.isFree) return;
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['value'],
|
fields: ['value'],
|
||||||
|
@ -32,9 +31,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
valueOptionsMap.value.set(tag.tagFk, data);
|
valueOptionsMap.value.set(tag.tagFk, data);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onItemTagsFetched = async (itemTags) => {
|
const onItemTagsFetched = async (itemTags) => {
|
||||||
|
|
|
@ -32,7 +32,6 @@ const ItemTaxRef = ref(null);
|
||||||
const taxesOptions = ref([]);
|
const taxesOptions = ref([]);
|
||||||
|
|
||||||
const submitTaxes = async (data) => {
|
const submitTaxes = async (data) => {
|
||||||
try {
|
|
||||||
let payload = data.map((tax) => ({
|
let payload = data.map((tax) => ({
|
||||||
id: tax.id,
|
id: tax.id,
|
||||||
taxClassFk: tax.taxClassFk,
|
taxClassFk: tax.taxClassFk,
|
||||||
|
@ -40,9 +39,6 @@ const submitTaxes = async (data) => {
|
||||||
|
|
||||||
await axios.post(`Items/updateTaxes`, payload);
|
await axios.post(`Items/updateTaxes`, payload);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error saving taxes', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -221,24 +221,16 @@ const updateMinPrice = async (value, props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const upsertPrice = async (props, resetMinPrice = false) => {
|
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
try {
|
|
||||||
const { row } = props;
|
const { row } = props;
|
||||||
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
if (resetMinPrice) row.hasMinPrice = 0;
|
||||||
await upsertFixedPrice(row);
|
await upsertFixedPrice(row);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error editing price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
async function upsertFixedPrice(row) {
|
||||||
try {
|
|
||||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||||
return data;
|
return data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error editing price', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveOnRowChange(row) {
|
async function saveOnRowChange(row) {
|
||||||
|
@ -321,14 +313,10 @@ const onEditCellDataSaved = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeFuturePrice = async () => {
|
const removeFuturePrice = async () => {
|
||||||
try {
|
|
||||||
rowsSelected.value.forEach(({ id }) => {
|
rowsSelected.value.forEach(({ id }) => {
|
||||||
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
||||||
removePrice(id, rowIndex);
|
removePrice(id, rowIndex);
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function confirmRemove(item, isFuture) {
|
function confirmRemove(item, isFuture) {
|
||||||
|
@ -345,13 +333,9 @@ function confirmRemove(item, isFuture) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const removePrice = async (id) => {
|
const removePrice = async (id) => {
|
||||||
try {
|
|
||||||
await axios.delete(`FixedPrices/${id}`);
|
await axios.delete(`FixedPrices/${id}`);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
tableRef.value.reload({});
|
tableRef.value.reload({});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const dateStyle = (date) =>
|
const dateStyle = (date) =>
|
||||||
date
|
date
|
||||||
|
|
|
@ -55,7 +55,6 @@ const onCategoryChange = async (categoryFk, search) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag?.selectedTag?.id) return;
|
if (!tag?.selectedTag?.id) return;
|
||||||
tag.value = null;
|
tag.value = null;
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -68,9 +67,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tag.valueOptions = data;
|
tag.valueOptions = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyTags = (params, search) => {
|
const applyTags = (params, search) => {
|
||||||
|
|
|
@ -173,7 +173,6 @@ const getBadgeColor = (date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeQuantity = async (request) => {
|
const changeQuantity = async (request) => {
|
||||||
try {
|
|
||||||
if (request.saleFk) {
|
if (request.saleFk) {
|
||||||
const params = {
|
const params = {
|
||||||
quantity: request.saleQuantity,
|
quantity: request.saleQuantity,
|
||||||
|
@ -183,13 +182,9 @@ const changeQuantity = async (request) => {
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
confirmRequest(request);
|
confirmRequest(request);
|
||||||
} else confirmRequest(request);
|
} else confirmRequest(request);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error changing quantity:: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const confirmRequest = async (request) => {
|
const confirmRequest = async (request) => {
|
||||||
try {
|
|
||||||
if (request.itemFk && request.saleQuantity) {
|
if (request.itemFk && request.saleQuantity) {
|
||||||
const params = {
|
const params = {
|
||||||
itemFk: request.itemFk,
|
itemFk: request.itemFk,
|
||||||
|
@ -197,17 +192,11 @@ const confirmRequest = async (request) => {
|
||||||
attenderFk: request.attenderFk,
|
attenderFk: request.attenderFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(`TicketRequests/${request.id}/confirm`, params);
|
||||||
`TicketRequests/${request.id}/confirm`,
|
|
||||||
params
|
|
||||||
);
|
|
||||||
request.itemDescription = data.concept;
|
request.itemDescription = data.concept;
|
||||||
request.isOk = true;
|
request.isOk = true;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('Error confirming request:: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getState = (isOk) => {
|
const getState = (isOk) => {
|
||||||
|
|
|
@ -103,15 +103,11 @@ const getBadgeColor = (date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeOrders = async () => {
|
const removeOrders = async () => {
|
||||||
try {
|
|
||||||
const selectedIds = selectedRows.value.map((row) => row.id);
|
const selectedIds = selectedRows.value.map((row) => row.id);
|
||||||
const params = { deletes: selectedIds };
|
const params = { deletes: selectedIds };
|
||||||
await axios.post('SalesMonitors/deleteOrders', params);
|
await axios.post('SalesMonitors/deleteOrders', params);
|
||||||
selectedRows.value = [];
|
selectedRows.value = [];
|
||||||
await table.value.reload();
|
await table.value.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting orders', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTab = (id) =>
|
const openTab = (id) =>
|
||||||
|
|
|
@ -18,7 +18,7 @@ const groupedStates = ref();
|
||||||
const handleScopeDays = (params, days, callback) => {
|
const handleScopeDays = (params, days, callback) => {
|
||||||
const [from, to] = dateRange(Date.vnNew());
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
if (!days) {
|
if (!days) {
|
||||||
Object.assign(params, { from, to, scopeDays: 1 });
|
Object.assign(params, { from, to, scopeDays: 0 });
|
||||||
} else {
|
} else {
|
||||||
params.from = from;
|
params.from = from;
|
||||||
to.setDate(to.getDate() + days);
|
to.setDate(to.getDate() + days);
|
||||||
|
@ -59,7 +59,7 @@ const getLocale = (label) => {
|
||||||
</template>
|
</template>
|
||||||
<template #customTags="{ params, searchFn, formatFn }">
|
<template #customTags="{ params, searchFn, formatFn }">
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-if="params.scopeDays"
|
v-if="params.scopeDays !== null"
|
||||||
removable
|
removable
|
||||||
@remove="handleScopeDays(params, null, searchFn)"
|
@remove="handleScopeDays(params, null, searchFn)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -25,11 +25,8 @@ const provinceOpts = ref([]);
|
||||||
const stateOpts = ref([]);
|
const stateOpts = ref([]);
|
||||||
const zoneOpts = ref([]);
|
const zoneOpts = ref([]);
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const from = Date.vnNew();
|
|
||||||
from.setHours(0, 0, 0, 0);
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
const to = new Date(from.getTime());
|
|
||||||
to.setDate(to.getDate() + 1);
|
|
||||||
to.setHours(23, 59, 59, 999);
|
|
||||||
const stateColors = {
|
const stateColors = {
|
||||||
notice: 'info',
|
notice: 'info',
|
||||||
success: 'positive',
|
success: 'positive',
|
||||||
|
@ -340,7 +337,7 @@ const openTab = (id) =>
|
||||||
auto-load
|
auto-load
|
||||||
:row-click="({ id }) => openTab(id)"
|
:row-click="({ id }) => openTab(id)"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
:user-params="{ from, to, scopeDays: 1 }"
|
:user-params="{ from, to, scopeDays: 0 }"
|
||||||
>
|
>
|
||||||
<template #top-left>
|
<template #top-left>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -350,7 +347,7 @@ const openTab = (id) =>
|
||||||
class="q-mr-sm"
|
class="q-mr-sm"
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
@click="$refs.tableRef.reload()"
|
@click="tableRef.CrudModelRef.vnPaginateRef.update()"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
|
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -36,7 +36,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['value'],
|
fields: ['value'],
|
||||||
order: 'value ASC',
|
order: 'value ASC',
|
||||||
limit: 30,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const url = `Tags/${tag?.id}/filterValue`;
|
const url = `Tags/${tag?.id}/filterValue`;
|
||||||
|
|
|
@ -22,7 +22,6 @@ const agencyList = ref([]);
|
||||||
const addressList = ref([]);
|
const addressList = ref([]);
|
||||||
|
|
||||||
const fetchAddressList = async (addressId) => {
|
const fetchAddressList = async (addressId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get('addresses', {
|
const { data } = await axios.get('addresses', {
|
||||||
params: {
|
params: {
|
||||||
filter: JSON.stringify({
|
filter: JSON.stringify({
|
||||||
|
@ -35,17 +34,12 @@ const fetchAddressList = async (addressId) => {
|
||||||
if (addressList.value?.length === 1) {
|
if (addressList.value?.length === 1) {
|
||||||
state.get(ORDER_MODEL).addressFk = addressList.value[0].id;
|
state.get(ORDER_MODEL).addressFk = addressList.value[0].id;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAgencyList = async (landed, addressFk) => {
|
const fetchAgencyList = async (landed, addressFk) => {
|
||||||
if (!landed || !addressFk) {
|
if (!landed || !addressFk) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
params: {
|
params: {
|
||||||
addressFk,
|
addressFk,
|
||||||
|
@ -53,10 +47,6 @@ const fetchAgencyList = async (landed, addressFk) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching agencies`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchOrderDetails = (order) => {
|
const fetchOrderDetails = (order) => {
|
||||||
|
@ -92,12 +82,8 @@ const orderFilter = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClientChange = async (clientId) => {
|
const onClientChange = async (clientId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
await fetchAddressList(data.defaultAddressFk);
|
await fetchAddressList(data.defaultAddressFk);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error al cambiar el cliente:', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
import { onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import CatalogItem from 'src/components/ui/CatalogItem.vue';
|
import CatalogItem from 'src/components/ui/CatalogItem.vue';
|
||||||
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import getParamWhere from 'src/filters/getParamWhere';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -18,7 +17,6 @@ const { t } = useI18n();
|
||||||
const dataKey = 'OrderCatalogList';
|
const dataKey = 'OrderCatalogList';
|
||||||
const arrayData = useArrayData(dataKey);
|
const arrayData = useArrayData(dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const showFilter = ref(null);
|
|
||||||
const tags = ref([]);
|
const tags = ref([]);
|
||||||
|
|
||||||
let catalogParams = {
|
let catalogParams = {
|
||||||
|
@ -26,27 +24,6 @@ let catalogParams = {
|
||||||
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
|
||||||
const whereParams = getParamWhere(route);
|
|
||||||
if (whereParams) {
|
|
||||||
const formattedWhereParams = {};
|
|
||||||
if (whereParams.and) {
|
|
||||||
whereParams.and.forEach((item) => {
|
|
||||||
Object.assign(formattedWhereParams, item);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Object.assign(formattedWhereParams, whereParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
catalogParams = {
|
|
||||||
...catalogParams,
|
|
||||||
...formattedWhereParams,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
showFilter.value = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
checkOrderConfirmation();
|
checkOrderConfirmation();
|
||||||
|
@ -90,7 +67,7 @@ function extractValueTags(items) {
|
||||||
);
|
);
|
||||||
tagValue.value = resultValueTags;
|
tagValue.value = resultValueTags;
|
||||||
}
|
}
|
||||||
const autoLoad = computed(() => !!catalogParams.categoryFk);
|
const autoLoad = computed(() => !!JSON.parse(route?.query.table ?? '{}')?.categoryFk);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => store.data,
|
() => store.data,
|
||||||
|
@ -112,7 +89,7 @@ watch(
|
||||||
:info="t('You can search items by name or id')"
|
:info="t('You can search items by name or id')"
|
||||||
/>
|
/>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea v-if="showFilter" class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<OrderCatalogFilter
|
<OrderCatalogFilter
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
:tag-value="tagValue"
|
:tag-value="tagValue"
|
||||||
|
@ -128,8 +105,6 @@ watch(
|
||||||
url="Orders/CatalogFilter"
|
url="Orders/CatalogFilter"
|
||||||
:limit="50"
|
:limit="50"
|
||||||
:user-params="catalogParams"
|
:user-params="catalogParams"
|
||||||
@on-fetch="showFilter = true"
|
|
||||||
:update-router="false"
|
|
||||||
:auto-load="autoLoad"
|
:auto-load="autoLoad"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -8,7 +8,6 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import getParamWhere from 'src/filters/getParamWhere';
|
|
||||||
import CatalogFilterValueDialog from 'src/pages/Order/Card/CatalogFilterValueDialog.vue';
|
import CatalogFilterValueDialog from 'src/pages/Order/Card/CatalogFilterValueDialog.vue';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
|
||||||
|
@ -32,11 +31,8 @@ const route = useRoute();
|
||||||
|
|
||||||
const arrayData = useArrayData(props.dataKey);
|
const arrayData = useArrayData(props.dataKey);
|
||||||
|
|
||||||
const currentParams = ref({});
|
|
||||||
const categoryList = ref(null);
|
const categoryList = ref(null);
|
||||||
const selectedCategoryFk = ref(null);
|
|
||||||
const typeList = ref([]);
|
const typeList = ref([]);
|
||||||
const selectedTypeFk = ref(null);
|
|
||||||
const searchByTag = ref(null);
|
const searchByTag = ref(null);
|
||||||
|
|
||||||
const vnFilterPanelRef = ref();
|
const vnFilterPanelRef = ref();
|
||||||
|
@ -53,50 +49,32 @@ const orderWayList = ref([
|
||||||
const orderBySelected = ref('relevancy DESC, name');
|
const orderBySelected = ref('relevancy DESC, name');
|
||||||
const orderWaySelected = ref('ASC');
|
const orderWaySelected = ref('ASC');
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
|
|
||||||
selectedTypeFk.value = getParamWhere(route, 'typeFk');
|
|
||||||
});
|
|
||||||
|
|
||||||
const resetCategory = (params, search) => {
|
const resetCategory = (params, search) => {
|
||||||
selectedCategoryFk.value = null;
|
|
||||||
typeList.value = null;
|
typeList.value = null;
|
||||||
params.categoryFk = null;
|
params.categoryFk = null;
|
||||||
params.typeFk = null;
|
params.typeFk = null;
|
||||||
arrayData.store.userFilter = null;
|
arrayData.store.userFilter = null;
|
||||||
removeTagGroupParam(search);
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectCategory = (params, category, search) => {
|
|
||||||
if (params.categoryFk === category?.id) {
|
|
||||||
resetCategory(params, search);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selectedCategoryFk.value = category?.id;
|
|
||||||
params.categoryFk = category?.id;
|
|
||||||
params.typeFk = null;
|
|
||||||
selectedTypeFk.value = null;
|
|
||||||
loadTypes(category?.id);
|
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadTypes = async (categoryFk = selectedCategoryFk.value) => {
|
const selectCategory = async (params, category, search) => {
|
||||||
|
if (vnFilterPanelRef.value.params.categoryFk === category?.id) {
|
||||||
|
resetCategory(params, search);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.typeFk = null;
|
||||||
|
params.categoryFk = category.id;
|
||||||
|
await loadTypes(category?.id);
|
||||||
|
await search();
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadTypes = async (id) => {
|
||||||
const { data } = await axios.get(`Orders/${route.params.id}/getItemTypeAvailable`, {
|
const { data } = await axios.get(`Orders/${route.params.id}/getItemTypeAvailable`, {
|
||||||
params: { itemCategoryId: categoryFk },
|
params: { itemCategoryId: id },
|
||||||
});
|
});
|
||||||
typeList.value = data;
|
typeList.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectedCategory = computed(() => {
|
|
||||||
return (categoryList.value || []).find(
|
|
||||||
(category) => category?.id === selectedCategoryFk.value
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const selectedType = computed(() => {
|
|
||||||
return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'categoryFk':
|
case 'categoryFk':
|
||||||
|
@ -122,21 +100,21 @@ const applyTags = (tagInfo, params, search) => {
|
||||||
|
|
||||||
async function onSearchByTag(value) {
|
async function onSearchByTag(value) {
|
||||||
if (!value.target.value) return;
|
if (!value.target.value) return;
|
||||||
if (!currentParams.value?.tagGroups) {
|
if (!vnFilterPanelRef.value.params?.tagGroups) {
|
||||||
currentParams.value.tagGroups = [];
|
vnFilterPanelRef.value.params.tagGroups = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
currentParams.value.tagGroups.push({
|
vnFilterPanelRef.value.params.tagGroups.push({
|
||||||
values: [{ value: value.target.value }],
|
values: [{ value: value.target.value }],
|
||||||
});
|
});
|
||||||
searchByTag.value = null;
|
searchByTag.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeTagGroupParam = (search, valIndex) => {
|
const removeTagGroupParam = (params, search, valIndex) => {
|
||||||
if (!valIndex && valIndex !== 0) {
|
if (!valIndex && valIndex !== 0) {
|
||||||
currentParams.value.tagGroups = null;
|
params.tagGroups = null;
|
||||||
} else {
|
} else {
|
||||||
currentParams.value.tagGroups.splice(valIndex, 1);
|
params.tagGroups.splice(valIndex, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,7 +126,8 @@ const setCategoryList = (data) => {
|
||||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
selectedCategoryFk.value && loadTypes();
|
vnFilterPanelRef.value.params.categoryFk &&
|
||||||
|
loadTypes(vnFilterPanelRef.value.params.categoryFk);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryClass = (category, params) => {
|
const getCategoryClass = (category, params) => {
|
||||||
|
@ -157,12 +136,6 @@ const getCategoryClass = (category, params) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearFilter = (key) => {
|
|
||||||
if (key === 'categoryFk') {
|
|
||||||
resetCategory();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function addOrder(value, field, params) {
|
function addOrder(value, field, params) {
|
||||||
let { orderBy } = params;
|
let { orderBy } = params;
|
||||||
orderBy = JSON.parse(orderBy);
|
orderBy = JSON.parse(orderBy);
|
||||||
|
@ -170,11 +143,6 @@ function addOrder(value, field, params) {
|
||||||
params.orderBy = JSON.stringify(orderBy);
|
params.orderBy = JSON.stringify(orderBy);
|
||||||
vnFilterPanelRef.value.search();
|
vnFilterPanelRef.value.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
|
|
||||||
selectedTypeFk.value = getParamWhere(route, 'typeFk');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -182,24 +150,22 @@ onMounted(() => {
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
ref="vnFilterPanelRef"
|
ref="vnFilterPanelRef"
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:hidden-tags="['orderFk', 'orderBy']"
|
:hidden-tags="['filter', 'orderFk', 'orderBy']"
|
||||||
:un-removable-params="['orderFk', 'orderBy']"
|
:unremovable-params="['orderFk', 'orderBy']"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:custom-tags="['tagGroups', 'categoryFk']"
|
:custom-tags="['tagGroups', 'categoryFk']"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
@remove="clearFilter"
|
|
||||||
v-model="currentParams"
|
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<strong v-if="tag.label === 'typeFk'">
|
<strong v-if="tag.label === 'typeFk' && typeList">
|
||||||
{{ t(selectedType?.name || '') }}
|
{{ t(typeList.find((t) => t.id == tag.value)?.name || '') }}
|
||||||
</strong>
|
</strong>
|
||||||
<div v-else class="q-gutter-x-xs">
|
<div v-else class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #customTags="{ tags: customTags, params, searchFn }">
|
<template #customTags="{ params, tags: customTags, searchFn }">
|
||||||
<template v-for="customTag in customTags" :key="customTag.label">
|
<template v-for="customTag in customTags" :key="customTag.label">
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-for="(tag, valIndex) in Array.isArray(customTag.value)
|
v-for="(tag, valIndex) in Array.isArray(customTag.value)
|
||||||
|
@ -210,11 +176,16 @@ onMounted(() => {
|
||||||
@remove="
|
@remove="
|
||||||
customTag.label === 'categoryFk'
|
customTag.label === 'categoryFk'
|
||||||
? resetCategory(params, searchFn)
|
? resetCategory(params, searchFn)
|
||||||
: removeTagGroupParam(searchFn, valIndex)
|
: removeTagGroupParam(params, searchFn, valIndex)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk'">
|
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
||||||
{{ t(selectedCategory?.name || '') }}
|
{{
|
||||||
|
t(
|
||||||
|
categoryList.find((c) => c.id == customTag.value)?.name ||
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}}
|
||||||
</strong>
|
</strong>
|
||||||
<strong v-if="tag?.tagSelection?.name" class="q-mr-xs">
|
<strong v-if="tag?.tagSelection?.name" class="q-mr-xs">
|
||||||
{{ tag.tagSelection.name }}:
|
{{ tag.tagSelection.name }}:
|
||||||
|
@ -261,13 +232,8 @@ onMounted(() => {
|
||||||
emit-value
|
emit-value
|
||||||
use-input
|
use-input
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
:disable="!selectedCategoryFk"
|
:disable="!params.categoryFk"
|
||||||
@update:model-value="
|
@update:model-value="searchFn()"
|
||||||
(value) => {
|
|
||||||
selectedTypeFk = value;
|
|
||||||
searchFn();
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -337,7 +303,7 @@ onMounted(() => {
|
||||||
style="display: inline-block"
|
style="display: inline-block"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
@apply-tags="
|
@apply-tags="
|
||||||
($event) => applyTags($event, currentParams, searchFn)
|
($event) => applyTags($event, params, searchFn)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
|
|
|
@ -20,7 +20,6 @@ const addressList = ref([]);
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
const fetchAddressList = async (addressId) => {
|
const fetchAddressList = async (addressId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get('addresses', {
|
const { data } = await axios.get('addresses', {
|
||||||
params: {
|
params: {
|
||||||
filter: JSON.stringify({
|
filter: JSON.stringify({
|
||||||
|
@ -33,17 +32,12 @@ const fetchAddressList = async (addressId) => {
|
||||||
if (addressList.value?.length === 1) {
|
if (addressList.value?.length === 1) {
|
||||||
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAgencyList = async (landed, addressFk) => {
|
const fetchAgencyList = async (landed, addressFk) => {
|
||||||
if (!landed || !addressFk) {
|
if (!landed || !addressFk) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
params: {
|
params: {
|
||||||
addressFk,
|
addressFk,
|
||||||
|
@ -51,10 +45,6 @@ const fetchAgencyList = async (landed, addressFk) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching agencies`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -70,12 +60,8 @@ const initialFormState = reactive({
|
||||||
});
|
});
|
||||||
|
|
||||||
const onClientChange = async (clientId = $props.clientFk) => {
|
const onClientChange = async (clientId = $props.clientFk) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
await fetchAddressList(data.defaultAddressFk);
|
await fetchAddressList(data.defaultAddressFk);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error al cambiar el cliente:', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function onDataSaved(_, id) {
|
async function onDataSaved(_, id) {
|
||||||
|
|
|
@ -47,7 +47,6 @@ const onChangesSaved = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const setWireTransfer = async () => {
|
const setWireTransfer = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
id: route.params.id,
|
id: route.params.id,
|
||||||
payMethodFk: wireTransferFk.value,
|
payMethodFk: wireTransferFk.value,
|
||||||
|
@ -55,9 +54,6 @@ const setWireTransfer = async () => {
|
||||||
|
|
||||||
await axios.patch(`Suppliers/${route.params.id}`, params);
|
await axios.patch(`Suppliers/${route.params.id}`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error setting wire transfer', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
|
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -100,10 +101,13 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnAccountNumber
|
||||||
v-model="data.account"
|
v-model="data.account"
|
||||||
:label="t('supplier.fiscalData.account')"
|
:label="t('supplier.fiscalData.account')"
|
||||||
clearable
|
clearable
|
||||||
|
data-cy="supplierFiscalDataAccount"
|
||||||
|
insertable
|
||||||
|
:maxlength="10"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('supplier.fiscalData.sageTaxTypeFk')"
|
:label="t('supplier.fiscalData.sageTaxTypeFk')"
|
||||||
|
|
|
@ -49,13 +49,7 @@ async function handleSave() {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="
|
@on-fetch="(data) => (observationTypes = data)"
|
||||||
(data) =>
|
|
||||||
(observationTypes = data.map((type) => {
|
|
||||||
type.label = t(`ticketNotes.observationTypes.${type.description}`);
|
|
||||||
return type;
|
|
||||||
}))
|
|
||||||
"
|
|
||||||
auto-load
|
auto-load
|
||||||
url="ObservationTypes"
|
url="ObservationTypes"
|
||||||
/>
|
/>
|
||||||
|
@ -82,7 +76,7 @@ async function handleSave() {
|
||||||
:label="t('ticketNotes.observationType')"
|
:label="t('ticketNotes.observationType')"
|
||||||
:options="observationTypes"
|
:options="observationTypes"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="label"
|
option-label="description"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.observationTypeFk"
|
v-model="row.observationTypeFk"
|
||||||
:disable="!!row.id"
|
:disable="!!row.id"
|
||||||
|
|
|
@ -172,13 +172,9 @@ const getRequestState = (state) => {
|
||||||
const isEditable = (isOk) => isOk !== null;
|
const isEditable = (isOk) => isOk !== null;
|
||||||
|
|
||||||
async function removeLine(id) {
|
async function removeLine(id) {
|
||||||
try {
|
|
||||||
await axios.delete(`TicketRequests/${id}`);
|
await axios.delete(`TicketRequests/${id}`);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
location.reload();
|
location.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error ', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = false));
|
onMounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
|
@ -156,15 +156,11 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getConfig = async () => {
|
const getConfig = async () => {
|
||||||
try {
|
|
||||||
let filter = {
|
let filter = {
|
||||||
fields: ['daysForWarningClaim'],
|
fields: ['daysForWarningClaim'],
|
||||||
};
|
};
|
||||||
const { data } = await axios.get(`TicketConfigs`, { filter });
|
const { data } = await axios.get(`TicketConfigs`, { filter });
|
||||||
ticketConfig.value = data;
|
ticketConfig.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting ticket config', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSalesFetched = (salesData) => {
|
const onSalesFetched = (salesData) => {
|
||||||
|
@ -187,23 +183,25 @@ const resetChanges = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateQuantity = async (sale) => {
|
const updateQuantity = async (sale) => {
|
||||||
|
const params = { quantity: sale.quantity };
|
||||||
try {
|
try {
|
||||||
const payload = { quantity: sale.quantity };
|
await axios.post(`Sales/${sale.id}/updateQuantity`, params);
|
||||||
await axios.post(`Sales/${sale.id}/updateQuantity`, payload);
|
} catch (e) {
|
||||||
notify('globals.dataSaved', 'positive');
|
sale.quantity = tableRef.value.CrudModelRef.originalData.find(
|
||||||
} catch (err) {
|
(s) => s.id === sale.id
|
||||||
console.error('Error updating quantity', err);
|
).quantity;
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
notify('globals.dataSaved', 'positive');
|
||||||
};
|
};
|
||||||
|
|
||||||
const addSale = async (sale) => {
|
const addSale = async (sale) => {
|
||||||
try {
|
const params = {
|
||||||
const payload = {
|
|
||||||
barcode: sale.itemFk,
|
barcode: sale.itemFk,
|
||||||
quantity: sale.quantity,
|
quantity: sale.quantity,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post(`tickets/${route.params.id}/addSale`, payload);
|
const { data } = await axios.post(`tickets/${route.params.id}/addSale`, params);
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|
||||||
|
@ -219,9 +217,6 @@ const addSale = async (sale) => {
|
||||||
|
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error adding sale', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeQuantity = async (sale) => {
|
const changeQuantity = async (sale) => {
|
||||||
|
@ -234,19 +229,15 @@ const changeQuantity = async (sale) => {
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
if (!sale.id) return addSale(sale);
|
if (!sale.id) return addSale(sale);
|
||||||
updateQuantity(sale);
|
await updateQuantity(sale);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateConcept = async (sale) => {
|
const updateConcept = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
canProceed.value = await isSalePrepared(sale);
|
||||||
if (!canProceed.value) return;
|
if (!canProceed.value) return;
|
||||||
try {
|
|
||||||
const data = { newConcept: sale.concept };
|
const data = { newConcept: sale.concept };
|
||||||
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error updating concept', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_EDIT = {
|
const DEFAULT_EDIT = {
|
||||||
|
@ -302,7 +293,6 @@ const onOpenEditDiscountPopover = async (sale) => {
|
||||||
const updatePrice = async (sale) => {
|
const updatePrice = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
canProceed.value = await isSalePrepared(sale);
|
||||||
if (!canProceed.value) return;
|
if (!canProceed.value) return;
|
||||||
try {
|
|
||||||
const newPrice = edit.value.price;
|
const newPrice = edit.value.price;
|
||||||
if (newPrice != null && newPrice != sale.price) {
|
if (newPrice != null && newPrice != sale.price) {
|
||||||
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
||||||
|
@ -310,10 +300,8 @@ const updatePrice = async (sale) => {
|
||||||
edit.value = { ...DEFAULT_EDIT };
|
edit.value = { ...DEFAULT_EDIT };
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
}
|
}
|
||||||
|
|
||||||
await getMana();
|
await getMana();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error updating price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeDiscount = async (sale) => {
|
const changeDiscount = async (sale) => {
|
||||||
|
@ -360,15 +348,11 @@ const getNewPrice = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const newOrderFromTicket = async () => {
|
const newOrderFromTicket = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.post(`Orders/newFromTicket`, {
|
const { data } = await axios.post(`Orders/newFromTicket`, {
|
||||||
ticketFk: Number(route.params.id),
|
ticketFk: Number(route.params.id),
|
||||||
});
|
});
|
||||||
const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } });
|
const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } });
|
||||||
window.open(routeData.href, '_blank');
|
window.open(routeData.href, '_blank');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error creating new order', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const goToLog = (saleId) => {
|
const goToLog = (saleId) => {
|
||||||
|
@ -383,15 +367,11 @@ const goToLog = (saleId) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeTicketState = async (val) => {
|
const changeTicketState = async (val) => {
|
||||||
try {
|
|
||||||
stateBtnDropdownRef.value.hide();
|
stateBtnDropdownRef.value.hide();
|
||||||
const params = { ticketFk: route.params.id, code: val };
|
const params = { ticketFk: route.params.id, code: val };
|
||||||
await axios.post('Tickets/state', params);
|
await axios.post('Tickets/state', params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
await resetChanges();
|
await resetChanges();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error changing ticket state', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeSelectedSales = () => {
|
const removeSelectedSales = () => {
|
||||||
|
@ -402,29 +382,22 @@ const removeSelectedSales = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeSales = async () => {
|
const removeSales = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
sales: selectedRows.value.filter((sale) => sale.id),
|
sales: selectedRows.value.filter((sale) => sale.id),
|
||||||
ticketId: store.data.id,
|
ticketId: store.data.id,
|
||||||
};
|
};
|
||||||
selectedRows.value
|
selectedRows.value
|
||||||
.filter((sale) => !sale.id)
|
.filter((sale) => !sale.id)
|
||||||
.forEach((sale) =>
|
.forEach((sale) => tableRef.value.CrudModelRef.formData.splice(sale.$index, 1));
|
||||||
tableRef.value.CrudModelRef.formData.splice(sale.$index, 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (params.sales.length == 0) return;
|
if (params.sales.length == 0) return;
|
||||||
await axios.post('Sales/deleteSales', params);
|
await axios.post('Sales/deleteSales', params);
|
||||||
removeSelectedSales();
|
removeSelectedSales();
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting sales', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setTransferParams = async () => {
|
const setTransferParams = async () => {
|
||||||
try {
|
|
||||||
selectedSales.value = selectedValidSales.value;
|
selectedSales.value = selectedValidSales.value;
|
||||||
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
|
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
|
||||||
transfer.value = {
|
transfer.value = {
|
||||||
|
@ -433,16 +406,10 @@ const setTransferParams = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = { ticketId: store.data.id };
|
const params = { ticketId: store.data.id };
|
||||||
const { data } = await axios.get(
|
const { data } = await axios.get(`clients/${store.data.clientFk}/lastActiveTickets`, {
|
||||||
`clients/${store.data.clientFk}/lastActiveTickets`,
|
|
||||||
{
|
|
||||||
params,
|
params,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
transfer.value.lastActiveTickets = data;
|
transfer.value.lastActiveTickets = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error setting transfer params', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -140,13 +140,9 @@ const createClaim = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCreateClaimAccepted = async () => {
|
const onCreateClaimAccepted = async () => {
|
||||||
try {
|
|
||||||
const params = { ticketId: ticket.value.id, sales: props.sales };
|
const params = { ticketId: ticket.value.id, sales: props.sales };
|
||||||
const { data } = await axios.post(`Claims/createFromSales`, params);
|
const { data } = await axios.post(`Claims/createFromSales`, params);
|
||||||
push({ name: 'ClaimBasicData', params: { id: data.id } });
|
push({ name: 'ClaimBasicData', params: { id: data.id } });
|
||||||
} catch (error) {
|
|
||||||
console.error('Error creating claim: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setReserved = async (reserved) => {
|
const setReserved = async (reserved) => {
|
||||||
|
|
|
@ -69,7 +69,6 @@ function isEditable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeState(value) {
|
async function changeState(value) {
|
||||||
try {
|
|
||||||
stateBtnDropdownRef.value?.hide();
|
stateBtnDropdownRef.value?.hide();
|
||||||
const formData = {
|
const formData = {
|
||||||
ticketFk: entityId.value,
|
ticketFk: entityId.value,
|
||||||
|
@ -79,9 +78,6 @@ async function changeState(value) {
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
summaryRef.value?.fetch();
|
summaryRef.value?.fetch();
|
||||||
descriptorData.fetch({});
|
descriptorData.fetch({});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error changing ticket state', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toTicketUrl(section) {
|
function toTicketUrl(section) {
|
||||||
|
@ -280,13 +276,8 @@ function toTicketUrl(section) {
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<span class="label" style="margin-right: 4px">
|
<span class="label" style="margin-right: 4px">
|
||||||
({{
|
({{ item.observationType.description }}):
|
||||||
t(
|
|
||||||
`ticketNotes.observationTypes.${item.observationType.description}`
|
|
||||||
)
|
|
||||||
}}):
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>{{ item.description }}</span>
|
<span>{{ item.description }}</span>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QVirtualScroll>
|
</QVirtualScroll>
|
||||||
|
|
|
@ -37,7 +37,6 @@ onBeforeMount(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchClient = async (formData) => {
|
const fetchClient = async (formData) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'defaultAddress',
|
relation: 'defaultAddress',
|
||||||
|
@ -51,13 +50,9 @@ const fetchClient = async (formData) => {
|
||||||
const { data } = await axios.get('Clients', { params });
|
const { data } = await axios.get('Clients', { params });
|
||||||
const [client] = data;
|
const [client] = data;
|
||||||
selectedClient.value = client;
|
selectedClient.value = client;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching client');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAddresses = async (formData) => {
|
const fetchAddresses = async (formData) => {
|
||||||
try {
|
|
||||||
if (!formData.clientId) return;
|
if (!formData.clientId) return;
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -73,10 +68,6 @@ const fetchAddresses = async (formData) => {
|
||||||
|
|
||||||
const { defaultAddress } = selectedClient.value;
|
const { defaultAddress } = selectedClient.value;
|
||||||
formData.addressId = defaultAddress.id;
|
formData.addressId = defaultAddress.id;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClientSelected = async (formData) => {
|
const onClientSelected = async (formData) => {
|
||||||
|
|
|
@ -37,7 +37,6 @@ onBeforeMount(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchClient = async (formData) => {
|
const fetchClient = async (formData) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'defaultAddress',
|
relation: 'defaultAddress',
|
||||||
|
@ -51,13 +50,9 @@ const fetchClient = async (formData) => {
|
||||||
const { data } = await axios.get('Clients', { params });
|
const { data } = await axios.get('Clients', { params });
|
||||||
const [client] = data;
|
const [client] = data;
|
||||||
selectedClient.value = client;
|
selectedClient.value = client;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching client');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAddresses = async (formData) => {
|
const fetchAddresses = async (formData) => {
|
||||||
try {
|
|
||||||
if (!formData.clientId) return;
|
if (!formData.clientId) return;
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -73,10 +68,6 @@ const fetchAddresses = async (formData) => {
|
||||||
|
|
||||||
const { defaultAddress } = selectedClient.value;
|
const { defaultAddress } = selectedClient.value;
|
||||||
formData.addressId = defaultAddress.id;
|
formData.addressId = defaultAddress.id;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClientSelected = async (formData) => {
|
const onClientSelected = async (formData) => {
|
||||||
|
|
|
@ -68,13 +68,9 @@ const params = reactive({
|
||||||
});
|
});
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
const applyColumnFilter = async (col) => {
|
||||||
try {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||||
params[paramKey] = col.columnFilter.filterValue;
|
params[paramKey] = col.columnFilter.filterValue;
|
||||||
await arrayData.addFilter({ params });
|
await arrayData.addFilter({ params });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error applying column filter', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInputEvents = (col) => {
|
const getInputEvents = (col) => {
|
||||||
|
@ -248,7 +244,6 @@ const totalPriceColor = (totalWithVat) =>
|
||||||
isLessThan50(totalWithVat) ? 'warning' : 'transparent';
|
isLessThan50(totalWithVat) ? 'warning' : 'transparent';
|
||||||
|
|
||||||
const moveTicketsFuture = async () => {
|
const moveTicketsFuture = async () => {
|
||||||
try {
|
|
||||||
const ticketsToMove = selectedTickets.value.map((ticket) => ({
|
const ticketsToMove = selectedTickets.value.map((ticket) => ({
|
||||||
originId: ticket.id,
|
originId: ticket.id,
|
||||||
destinationId: ticket.futureId,
|
destinationId: ticket.futureId,
|
||||||
|
@ -262,9 +257,6 @@ const moveTicketsFuture = async () => {
|
||||||
notify(t('advanceTickets.moveTicketSuccess'), 'positive');
|
notify(t('advanceTickets.moveTicketSuccess'), 'positive');
|
||||||
selectedTickets.value = [];
|
selectedTickets.value = [];
|
||||||
arrayData.fetch({ append: false });
|
arrayData.fetch({ append: false });
|
||||||
} catch (error) {
|
|
||||||
console.error('Error moving tickets to future', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
|
|
|
@ -254,7 +254,6 @@ const fetchAvailableAgencies = async (formData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchClient = async (formData) => {
|
const fetchClient = async (formData) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'defaultAddress',
|
relation: 'defaultAddress',
|
||||||
|
@ -268,13 +267,9 @@ const fetchClient = async (formData) => {
|
||||||
const { data } = await axios.get('Clients', { params });
|
const { data } = await axios.get('Clients', { params });
|
||||||
const [client] = data;
|
const [client] = data;
|
||||||
selectedClient.value = client;
|
selectedClient.value = client;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching client');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAddresses = async (formData) => {
|
const fetchAddresses = async (formData) => {
|
||||||
try {
|
|
||||||
if (!formData.clientId) return;
|
if (!formData.clientId) return;
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -287,13 +282,12 @@ const fetchAddresses = async (formData) => {
|
||||||
});
|
});
|
||||||
addressesOptions.value = data;
|
addressesOptions.value = data;
|
||||||
|
|
||||||
|
addressesOptions.value = data;
|
||||||
|
|
||||||
const { defaultAddress } = selectedClient.value;
|
const { defaultAddress } = selectedClient.value;
|
||||||
formData.addressId = defaultAddress.id;
|
formData.addressId = defaultAddress.id;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getColor = (row) => {
|
const getColor = (row) => {
|
||||||
if (row.alertLevelCode === 'OK') return 'bg-success';
|
if (row.alertLevelCode === 'OK') return 'bg-success';
|
||||||
else if (row.alertLevelCode === 'FREE') return 'bg-notice';
|
else if (row.alertLevelCode === 'FREE') return 'bg-notice';
|
||||||
|
|
|
@ -153,24 +153,16 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const deleteWeekly = async (ticketFk) => {
|
const deleteWeekly = async (ticketFk) => {
|
||||||
try {
|
|
||||||
await axios.delete(`TicketWeeklies/${ticketFk}`);
|
await axios.delete(`TicketWeeklies/${ticketFk}`);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
const ticketIndex = store.data.findIndex((e) => e.ticketFk == ticketFk);
|
const ticketIndex = store.data.findIndex((e) => e.ticketFk == ticketFk);
|
||||||
store.data.splice(ticketIndex, 1);
|
store.data.splice(ticketIndex, 1);
|
||||||
location.reload();
|
location.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting weekly', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdate = async (ticketFk, field, value) => {
|
const onUpdate = async (ticketFk, field, value) => {
|
||||||
try {
|
|
||||||
const params = { ticketFk, [field]: value };
|
const params = { ticketFk, [field]: value };
|
||||||
await axios.patch('TicketWeeklies', params);
|
await axios.patch('TicketWeeklies', params);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error updating weekly', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -10,16 +10,6 @@ ticketNotes:
|
||||||
observationType: Observation type
|
observationType: Observation type
|
||||||
removeNote: Remove note
|
removeNote: Remove note
|
||||||
addNote: Add note
|
addNote: Add note
|
||||||
observationTypes:
|
|
||||||
ItemPicker: Item picker
|
|
||||||
Packager: Packager
|
|
||||||
Delivery: Delivery
|
|
||||||
SalesPerson: Sales person
|
|
||||||
Administrative: Administrative
|
|
||||||
Weight: Weight
|
|
||||||
InvoiceOut: Invoice Out
|
|
||||||
DropOff: Drop Off
|
|
||||||
Sustitución: Sustitution
|
|
||||||
ticketSale:
|
ticketSale:
|
||||||
visible: Visible
|
visible: Visible
|
||||||
available: Available
|
available: Available
|
||||||
|
|
|
@ -19,18 +19,6 @@ ticketNotes:
|
||||||
observationType: Tipo de observación
|
observationType: Tipo de observación
|
||||||
removeNote: Quitar nota
|
removeNote: Quitar nota
|
||||||
addNote: Añadir nota
|
addNote: Añadir nota
|
||||||
observationTypes:
|
|
||||||
ItemPicker: Sacador
|
|
||||||
Packager: Encajador
|
|
||||||
Delivery: Envío
|
|
||||||
SalesPerson: Comercial
|
|
||||||
Administrative: Administrativa
|
|
||||||
Weight: Peso
|
|
||||||
InvoiceOut: Facturas
|
|
||||||
DropOff: Despacho
|
|
||||||
Sustitución: Sustitución
|
|
||||||
Accepted: Aceptado
|
|
||||||
Denied: Denegado
|
|
||||||
purchaseRequest:
|
purchaseRequest:
|
||||||
requester: Solicitante
|
requester: Solicitante
|
||||||
atender: Comprador
|
atender: Comprador
|
||||||
|
|
|
@ -14,6 +14,8 @@ const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
|
const warehousesOptionsOut = ref([]);
|
||||||
|
const warehousesOptionsIn = ref([]);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -21,6 +23,18 @@ const agenciesOptions = ref([]);
|
||||||
@on-fetch="(data) => (agenciesOptions = data)"
|
@on-fetch="(data) => (agenciesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Warehouses"
|
||||||
|
@on-fetch="(data) => (warehousesOptionsOut = data)"
|
||||||
|
auto-load
|
||||||
|
:filter="{ where: { isOrigin: TRUE } }"
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Warehouses"
|
||||||
|
@on-fetch="(data) => (warehousesOptionsIn = data)"
|
||||||
|
auto-load
|
||||||
|
:filter="{ where: { isDestiny: TRUE } }"
|
||||||
|
/>
|
||||||
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel" auto-load>
|
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel" auto-load>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
@ -39,11 +53,12 @@ const agenciesOptions = ref([]);
|
||||||
<VnInputDate v-model="data.shipped" :label="t('globals.shipped')" />
|
<VnInputDate v-model="data.shipped" :label="t('globals.shipped')" />
|
||||||
<VnInputDate v-model="data.landed" :label="t('globals.landed')" />
|
<VnInputDate v-model="data.landed" :label="t('globals.landed')" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('globals.warehouseOut')"
|
:label="t('globals.warehouseOut')"
|
||||||
v-model="data.warehouseOutFk"
|
v-model="data.warehouseOutFk"
|
||||||
:options="agenciesOptions"
|
:options="warehousesOptionsOut"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
map-options
|
map-options
|
||||||
|
@ -52,7 +67,7 @@ const agenciesOptions = ref([]);
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('globals.warehouseIn')"
|
:label="t('globals.warehouseIn')"
|
||||||
v-model="data.warehouseInFk"
|
v-model="data.warehouseInFk"
|
||||||
:options="agenciesOptions"
|
:options="warehousesOptionsIn"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
map-options
|
map-options
|
||||||
|
@ -89,7 +104,7 @@ const agenciesOptions = ref([]);
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados (incluido 0). Si se deja vacio, la fecha no cambiará
|
raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados.
|
||||||
en:
|
en:
|
||||||
raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days (including 0). If left empty, the date will stay the same.
|
raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days.
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -44,8 +44,8 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
|
||||||
<TravelDescriptorMenuItems :travel="entity" />
|
<TravelDescriptorMenuItems :travel="entity" />
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('globals.warehouseIn')" :value="entity.warehouseIn.name" />
|
<VnLv :label="t('globals.warehouseIn')" :value="entity.warehouseIn?.name" />
|
||||||
<VnLv :label="t('globals.warehouseOut')" :value="entity.warehouseOut.name" />
|
<VnLv :label="t('globals.warehouseOut')" :value="entity.warehouseOut?.name" />
|
||||||
<VnLv :label="t('globals.shipped')" :value="toDate(entity.shipped)" />
|
<VnLv :label="t('globals.shipped')" :value="toDate(entity.shipped)" />
|
||||||
<VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" />
|
<VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" />
|
||||||
<VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" />
|
<VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" />
|
||||||
|
|
|
@ -32,16 +32,12 @@ const cloneTravel = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const cloneTravelWithEntries = async () => {
|
const cloneTravelWithEntries = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
|
const { data } = await axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
router.push({ name: 'TravelBasicData', params: { id: data.id } });
|
router.push({ name: 'TravelBasicData', params: { id: data.id } });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error cloning travel with entries');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const canDelete = computed(() => useAcl().hasAny('Travel','*','WRITE'));
|
const canDelete = computed(() => useAcl().hasAny('Travel', '*', 'WRITE'));
|
||||||
|
|
||||||
const openDeleteEntryDialog = (id) => {
|
const openDeleteEntryDialog = (id) => {
|
||||||
quasar
|
quasar
|
||||||
|
@ -58,13 +54,9 @@ const openDeleteEntryDialog = (id) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteTravel = async (id) => {
|
const deleteTravel = async (id) => {
|
||||||
try {
|
|
||||||
await axios.delete(`Travels/${id}`);
|
await axios.delete(`Travels/${id}`);
|
||||||
router.push({ name: 'TravelList' });
|
router.push({ name: 'TravelList' });
|
||||||
notify('globals.dataDeleted', 'positive');
|
notify('globals.dataDeleted', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting travel');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -193,16 +193,11 @@ const entriesTotalM3 = computed(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const getTravelEntries = async (id) => {
|
const getTravelEntries = async (id) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Travels/${id}/getEntries`);
|
const { data } = await axios.get(`Travels/${id}/getEntries`);
|
||||||
entries.value = data;
|
entries.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching travel entries');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTravelThermographs = async (id) => {
|
const getTravelThermographs = async (id) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'warehouse',
|
relation: 'warehouse',
|
||||||
|
@ -217,21 +212,14 @@ const getTravelThermographs = async (id) => {
|
||||||
params: { filter: JSON.parse(JSON.stringify(filter)) },
|
params: { filter: JSON.parse(JSON.stringify(filter)) },
|
||||||
});
|
});
|
||||||
thermographs.value = data;
|
thermographs.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching travel thermographs');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function setTravelData(travelData) {
|
async function setTravelData(travelData) {
|
||||||
try {
|
|
||||||
if (travelData) {
|
if (travelData) {
|
||||||
travel.value = travelData;
|
travel.value = travelData;
|
||||||
await getTravelEntries(travel.value.id);
|
await getTravelEntries(travel.value.id);
|
||||||
await getTravelThermographs(travel.value.id);
|
await getTravelThermographs(travel.value.id);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error setting travel data`, err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
|
|
|
@ -122,13 +122,9 @@ const redirectToThermographForm = (action, id) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeThermograph = async (id) => {
|
const removeThermograph = async (id) => {
|
||||||
try {
|
|
||||||
await axios.delete(`Travels/deleteThermograph?id=${id}`);
|
await axios.delete(`Travels/deleteThermograph?id=${id}`);
|
||||||
await thermographPaginateRef.value.fetch();
|
await thermographPaginateRef.value.fetch();
|
||||||
notify(t('Thermograph removed'), 'positive');
|
notify(t('Thermograph removed'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing termograph');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ onBeforeMount(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchDmsTypes = async () => {
|
const fetchDmsTypes = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
filter: {
|
filter: {
|
||||||
where: { code: 'thermograph' },
|
where: { code: 'thermograph' },
|
||||||
|
@ -64,9 +63,6 @@ const fetchDmsTypes = async () => {
|
||||||
};
|
};
|
||||||
const { data } = await axios.get('DmsTypes/findOne', { params });
|
const { data } = await axios.get('DmsTypes/findOne', { params });
|
||||||
return data;
|
return data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching Dms Types');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCreateDefaultParams = async () => {
|
const setCreateDefaultParams = async () => {
|
||||||
|
|
|
@ -293,7 +293,6 @@ const openReportPdf = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveFieldValue = async (val, field, index) => {
|
const saveFieldValue = async (val, field, index) => {
|
||||||
try {
|
|
||||||
// Evitar la solicitud de guardado si el valor no ha cambiado
|
// Evitar la solicitud de guardado si el valor no ha cambiado
|
||||||
if (originalRowDataCopy.value[index][field] == val) return;
|
if (originalRowDataCopy.value[index][field] == val) return;
|
||||||
|
|
||||||
|
@ -304,9 +303,6 @@ const saveFieldValue = async (val, field, index) => {
|
||||||
originalRowDataCopy.value[index][field] = val;
|
originalRowDataCopy.value[index][field] = val;
|
||||||
|
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error updating travel');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopEventPropagation = (event, col) => {
|
const stopEventPropagation = (event, col) => {
|
||||||
|
|
|
@ -19,16 +19,10 @@ const createTrayFormDialogRef = ref();
|
||||||
const selectedEntityId = ref();
|
const selectedEntityId = ref();
|
||||||
|
|
||||||
async function loadTrays() {
|
async function loadTrays() {
|
||||||
try {
|
|
||||||
const res = await axios.get('WagonTypeTrays');
|
const res = await axios.get('WagonTypeTrays');
|
||||||
const filteredTrays = res.data.filter(
|
const filteredTrays = res.data.filter((tray) => tray.wagonTypeFk === entityId.value);
|
||||||
(tray) => tray.wagonTypeFk === entityId.value
|
|
||||||
);
|
|
||||||
wagonTrays.value = filteredTrays;
|
wagonTrays.value = filteredTrays;
|
||||||
return;
|
return;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error loading trays:', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addTray(newTray) {
|
async function addTray(newTray) {
|
||||||
|
|
|
@ -60,26 +60,18 @@ const updateSelectedDate = (year) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const createEvent = async (date) => {
|
const createEvent = async (date) => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
dated: date,
|
dated: date,
|
||||||
absenceTypeId: props.absenceType.id,
|
absenceTypeId: props.absenceType.id,
|
||||||
businessFk: props.businessFk,
|
businessFk: props.businessFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(`Workers/${route.params.id}/createAbsence`, params);
|
||||||
`Workers/${route.params.id}/createAbsence`,
|
|
||||||
params
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data) emit('refresh');
|
if (data) emit('refresh');
|
||||||
} catch (error) {
|
|
||||||
console.error('error creating event:: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const editEvent = async (event) => {
|
const editEvent = async (event) => {
|
||||||
try {
|
|
||||||
const absenceType = props.absenceType;
|
const absenceType = props.absenceType;
|
||||||
const params = {
|
const params = {
|
||||||
absenceId: event.absenceId,
|
absenceId: event.absenceId,
|
||||||
|
@ -91,9 +83,6 @@ const editEvent = async (event) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (data) emit('refresh');
|
if (data) emit('refresh');
|
||||||
} catch (error) {
|
|
||||||
console.error('error editing event:: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteEvent = async (event, date) => {
|
const deleteEvent = async (event, date) => {
|
||||||
|
|
|
@ -39,15 +39,9 @@ const entityId = computed(() => {
|
||||||
const workerExcluded = ref(false);
|
const workerExcluded = ref(false);
|
||||||
|
|
||||||
const getIsExcluded = async () => {
|
const getIsExcluded = async () => {
|
||||||
try {
|
const { data } = await axios.get(`WorkerDisableExcludeds/${entityId.value}/exists`);
|
||||||
const { data } = await axios.get(
|
|
||||||
`WorkerDisableExcludeds/${entityId.value}/exists`
|
|
||||||
);
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
workerExcluded.value = data.exists;
|
workerExcluded.value = data.exists;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting worker excluded: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExcluded = async () => {
|
const handleExcluded = async () => {
|
||||||
|
|
|
@ -32,14 +32,11 @@ const initialData = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const deallocatePDA = async (deviceProductionFk) => {
|
const deallocatePDA = async (deviceProductionFk) => {
|
||||||
try {
|
|
||||||
await axios.post(`Workers/${route.params.id}/deallocatePDA`, {
|
await axios.post(`Workers/${route.params.id}/deallocatePDA`, {
|
||||||
pda: deviceProductionFk,
|
pda: deviceProductionFk,
|
||||||
});
|
});
|
||||||
notify(t('PDA deallocated'), 'positive');
|
notify(t('PDA deallocated'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deallocating PDA');
|
|
||||||
}
|
|
||||||
paginate.value.fetch();
|
paginate.value.fetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,263 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const route = useRoute();
|
||||||
|
const { t } = useI18n();
|
||||||
|
const disabilityGradesOptions = ref();
|
||||||
|
const workerPitCrudRef = ref({});
|
||||||
|
const insertTag = () => {
|
||||||
|
workerPitCrudRef.value.insert();
|
||||||
|
};
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const deleteRelative = async (id) => {
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Remove Relative'),
|
||||||
|
message: t('Do you want to remove this relative?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
await axios.delete(`WorkerRelatives/${id}`);
|
||||||
|
workerPitCrudRef.value.reload();
|
||||||
|
notify('Relative removed', 'positive');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="DisabilityGrades"
|
||||||
|
@on-fetch="(data) => (disabilityGradesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormModel
|
||||||
|
url="WorkerIrpfs"
|
||||||
|
:filter="{ where: { workerFk: route.params.id } }"
|
||||||
|
auto-load
|
||||||
|
data-key="workerIrpfs"
|
||||||
|
:max-width="false"
|
||||||
|
>
|
||||||
|
<template #form="{ data }">
|
||||||
|
<QCard class="q-px-lg q-py-lg">
|
||||||
|
<VnTitle :text="t('IRPF')" />
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="t('familySituation')"
|
||||||
|
clearable
|
||||||
|
v-model="data.familySituation"
|
||||||
|
/>
|
||||||
|
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('disabilityGrades')"
|
||||||
|
:options="disabilityGradesOptions"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="data.disabilityGradeFk"
|
||||||
|
id="disabilityGrades"
|
||||||
|
data-cy="disabilityGrades"
|
||||||
|
hide-selected
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnInputDate
|
||||||
|
:label="t('geographicMobilityDate')"
|
||||||
|
v-model="data.geographicMobilityDate"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
clearable
|
||||||
|
v-model="data.childPension"
|
||||||
|
:label="t(`childPension`)"
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
clearable
|
||||||
|
v-model="data.spousePension"
|
||||||
|
:label="t(`spousePension`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<QCheckbox v-model="data.isDependend" :label="t(`isDependend`)" />
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasHousingPaymentBefore"
|
||||||
|
:label="t(`hasHousingPaymentBefore`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasHousingPaymentAfter"
|
||||||
|
:label="t(`hasHousingPaymentAfter`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.hasExtendedWorking"
|
||||||
|
:label="t(`hasExtendedWorking`)"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
|
||||||
|
<CrudModel
|
||||||
|
ref="workerPitCrudRef"
|
||||||
|
data-key="workerPit"
|
||||||
|
url="WorkerRelatives"
|
||||||
|
auto-load
|
||||||
|
:filter="{
|
||||||
|
where: { workerFk: route.params.id },
|
||||||
|
}"
|
||||||
|
:data-required="{ workerFk: route.params.id }"
|
||||||
|
:has-sub-toolbar="false"
|
||||||
|
>
|
||||||
|
<template #body="{ rows }">
|
||||||
|
<QCard class="q-px-lg q-py-lg" flat>
|
||||||
|
<div class="row no-wrap justify-between q-pb-md">
|
||||||
|
<VnTitle :text="t('Relatives')" />
|
||||||
|
<QBtnGroup push style="column-gap: 10px">
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon="restart_alt"
|
||||||
|
flat
|
||||||
|
@click="workerPitCrudRef.reset"
|
||||||
|
:disable="!workerPitCrudRef.hasChanges"
|
||||||
|
:title="t('globals.reset')"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
ref="saveButtonRef"
|
||||||
|
color="primary"
|
||||||
|
icon="save"
|
||||||
|
@click="workerPitCrudRef.onSubmit"
|
||||||
|
:disable="!workerPitCrudRef.hasChanges"
|
||||||
|
:title="t('globals.save')"
|
||||||
|
data-cy="workerPitRelativeSaveBtn"
|
||||||
|
/>
|
||||||
|
</QBtnGroup>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-for="(row, index) in rows"
|
||||||
|
:key="index"
|
||||||
|
class="row no-wrap q-mb-lg q-gutter-lg"
|
||||||
|
padding="none"
|
||||||
|
>
|
||||||
|
<VnSelect
|
||||||
|
:options="[
|
||||||
|
{ id: 0, name: 'Ascendiente' },
|
||||||
|
{ id: 1, name: 'Descendiente' },
|
||||||
|
]"
|
||||||
|
:label="t('isDescendant')"
|
||||||
|
v-model="row.isDescendant"
|
||||||
|
class="q-gutter-xs q-mb-xs"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('disabilityGrades')"
|
||||||
|
:options="disabilityGradesOptions"
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="row.disabilityGradeFk"
|
||||||
|
class="q-gutter-xs q-mb-xs"
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
type="number"
|
||||||
|
v-model="row.birthed"
|
||||||
|
:label="t(`birthed`)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnInput
|
||||||
|
type="number"
|
||||||
|
v-model="row.adoptionYear"
|
||||||
|
:label="t(`adoptionYear`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="row.isDependend"
|
||||||
|
:label="t(`isDependend`)"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="row.isJointCustody"
|
||||||
|
:label="t(`isJointCustody`)"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
@click="deleteRelative(rows[0].id)"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon="delete"
|
||||||
|
style="flex: 0"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<VnRow class="justify-left items-center">
|
||||||
|
<QBtn
|
||||||
|
@click="insertTag(rows)"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
style="flex: 0"
|
||||||
|
data-cy="addRelative"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
</template>
|
||||||
|
</CrudModel>
|
||||||
|
</template>
|
||||||
|
</FormModel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
familySituation: Situación familiar
|
||||||
|
disabilityGrades: Discapacidad
|
||||||
|
geographicMobilityDate: Movilidad geografica
|
||||||
|
childPension: Pensión hijos
|
||||||
|
spousePension: Pensión cónyuge
|
||||||
|
isDependend: Ayuda / Movilidad reducida
|
||||||
|
spouseNif: NIF cónyuge
|
||||||
|
hasHousingPaymentBefore: Pagos vivienda anterior 2011
|
||||||
|
hasHousingPaymentAfter: Pagos vivienda posterior 2011
|
||||||
|
hasExtendedWorking: Prolongación actividad laboral
|
||||||
|
isDescendant: Descen/Ascen
|
||||||
|
disabilityGradeFk: Discapacidad
|
||||||
|
birthed: Año nacimiento
|
||||||
|
adoptionYear: Año adopción
|
||||||
|
isJointCustody: Computo por entero
|
||||||
|
Relatives: Relacionados
|
||||||
|
en:
|
||||||
|
familySituation: Family Situation
|
||||||
|
disabilityGrades: Disability Grades
|
||||||
|
geographicMobilityDate: Geographic Mobility Date
|
||||||
|
childPension: Child Pension
|
||||||
|
spousePension: Spouse Pension
|
||||||
|
isDependend: Dependent Suport / Reduced Mobility
|
||||||
|
spouseNif: Spouse NIF (Tax ID)
|
||||||
|
hasHousingPaymentBefore: Housing Payments Before 2011
|
||||||
|
hasHousingPaymentAfter: Housing Payments After 2011
|
||||||
|
hasExtendedWorking: Extended Work Activity
|
||||||
|
isDescendant: Descendant/Ascendant
|
||||||
|
disabilityGradeFk: Disability Grade
|
||||||
|
birthed: Birth Year
|
||||||
|
adoptionYear: Adoption Year
|
||||||
|
isJointCustody: Joint custody
|
||||||
|
Relatives: Relatives
|
||||||
|
</i18n>
|
|
@ -251,13 +251,9 @@ const addEvents = (data) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchHours = async () => {
|
const fetchHours = async () => {
|
||||||
try {
|
|
||||||
await workerHoursRef.value.fetch();
|
await workerHoursRef.value.fetch();
|
||||||
await getWorkedHours(startOfWeek.value, endOfWeek.value);
|
await getWorkedHours(startOfWeek.value, endOfWeek.value);
|
||||||
await getAbsences();
|
await getAbsences();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching worker hours');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchWeekData = async () => {
|
const fetchWeekData = async () => {
|
||||||
|
@ -265,7 +261,6 @@ const fetchWeekData = async () => {
|
||||||
year: selectedDate.value.getFullYear(),
|
year: selectedDate.value.getFullYear(),
|
||||||
week: selectedWeekNumber.value,
|
week: selectedWeekNumber.value,
|
||||||
};
|
};
|
||||||
try {
|
|
||||||
const mail = (
|
const mail = (
|
||||||
await axiosNoError.get(`Workers/${route.params.id}/mail`, {
|
await axiosNoError.get(`Workers/${route.params.id}/mail`, {
|
||||||
params: { filter: { where } },
|
params: { filter: { where } },
|
||||||
|
@ -281,9 +276,6 @@ const fetchWeekData = async () => {
|
||||||
canResend.value = !!(
|
canResend.value = !!(
|
||||||
await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
|
await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
|
||||||
).data.count;
|
).data.count;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching week data');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setHours = (data) => {
|
const setHours = (data) => {
|
||||||
|
@ -357,7 +349,6 @@ const showReasonForm = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateWorkerTimeControlMail = async (state, reason) => {
|
const updateWorkerTimeControlMail = async (state, reason) => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
year: selectedDate.value.getFullYear(),
|
year: selectedDate.value.getFullYear(),
|
||||||
week: selectedWeekNumber.value,
|
week: selectedWeekNumber.value,
|
||||||
|
@ -371,9 +362,6 @@ const updateWorkerTimeControlMail = async (state, reason) => {
|
||||||
await getMailStates(selectedDate.value);
|
await getMailStates(selectedDate.value);
|
||||||
await fetchWeekData();
|
await fetchWeekData();
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error updating worker time control mail');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isSatisfied = async () => {
|
const isSatisfied = async () => {
|
||||||
|
@ -389,7 +377,6 @@ const isUnsatisfied = async (reason) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const resendEmail = async () => {
|
const resendEmail = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
recipient: worker.value?.user?.email,
|
recipient: worker.value?.user?.email,
|
||||||
week: selectedWeekNumber.value,
|
week: selectedWeekNumber.value,
|
||||||
|
@ -400,9 +387,6 @@ const resendEmail = async () => {
|
||||||
await axios.post('WorkerTimeControls/weekly-hour-record-email', params);
|
await axios.post('WorkerTimeControls/weekly-hour-record-email', params);
|
||||||
await getMailStates(selectedDate.value);
|
await getMailStates(selectedDate.value);
|
||||||
notify(t('Email sended'), 'positive');
|
notify(t('Email sended'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error sending email');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
|
|
|
@ -50,17 +50,11 @@ const directionIconName = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const deleteHourEntry = async () => {
|
const deleteHourEntry = async () => {
|
||||||
try {
|
const { data } = await axios.post(`WorkerTimeControls/${$props.id}/deleteTimeEntry`);
|
||||||
const { data } = await axios.post(
|
|
||||||
`WorkerTimeControls/${$props.id}/deleteTimeEntry`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
emit('onHourEntryDeleted');
|
emit('onHourEntryDeleted');
|
||||||
notify('Entry removed', 'positive');
|
notify('Entry removed', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting hour entry');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showWorkerTimeForm = () => emit('showWorkerTimeForm');
|
const showWorkerTimeForm = () => emit('showWorkerTimeForm');
|
||||||
|
|
|
@ -33,7 +33,6 @@ const onNodeExpanded = (nodeKeysArray) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchNodeLeaves = async (nodeKey) => {
|
const fetchNodeLeaves = async (nodeKey) => {
|
||||||
try {
|
|
||||||
const node = treeRef.value?.getNodeByKey(nodeKey);
|
const node = treeRef.value?.getNodeByKey(nodeKey);
|
||||||
|
|
||||||
if (!node || node.sons === 0) return;
|
if (!node || node.sons === 0) return;
|
||||||
|
@ -51,10 +50,6 @@ const fetchNodeLeaves = async (nodeKey) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
state.set('Tree', node);
|
state.set('Tree', node);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching department leaves', err);
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeNode = (node) => {
|
const removeNode = (node) => {
|
||||||
|
@ -72,15 +67,11 @@ const removeNode = (node) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function remove(id) {
|
async function remove(id) {
|
||||||
try {
|
|
||||||
await axios.post(`/Departments/${id}/removeChild`, { id });
|
await axios.post(`/Departments/${id}/removeChild`, { id });
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
message: t('department.departmentRemoved'),
|
message: t('department.departmentRemoved'),
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing department');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showCreateNodeForm = (nodeId) => {
|
const showCreateNodeForm = (nodeId) => {
|
||||||
|
|
|
@ -43,7 +43,7 @@ const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
const isNew = computed(() => props.isNewMode);
|
const isNew = computed(() => props.isNewMode);
|
||||||
const dated = ref(null);
|
const dated = ref(props.date);
|
||||||
const tickedNodes = ref();
|
const tickedNodes = ref();
|
||||||
|
|
||||||
const _excludeType = ref('all');
|
const _excludeType = ref('all');
|
||||||
|
@ -57,7 +57,6 @@ const excludeType = computed({
|
||||||
const arrayData = useArrayData('ZoneEvents');
|
const arrayData = useArrayData('ZoneEvents');
|
||||||
|
|
||||||
const exclusionGeoCreate = async () => {
|
const exclusionGeoCreate = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
zoneFk: parseInt(route.params.id),
|
zoneFk: parseInt(route.params.id),
|
||||||
date: dated.value,
|
date: dated.value,
|
||||||
|
@ -65,26 +64,16 @@ const exclusionGeoCreate = async () => {
|
||||||
};
|
};
|
||||||
await axios.post('Zones/exclusionGeo', params);
|
await axios.post('Zones/exclusionGeo', params);
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error creating exclusion geo: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const exclusionCreate = async () => {
|
const exclusionCreate = async () => {
|
||||||
try {
|
|
||||||
if (isNew.value)
|
if (isNew.value)
|
||||||
await axios.post(`Zones/${route.params.id}/exclusions`, [
|
await axios.post(`Zones/${route.params.id}/exclusions`, [{ dated: dated.value }]);
|
||||||
{ dated: dated.value },
|
|
||||||
]);
|
|
||||||
else
|
else
|
||||||
await axios.post(`Zones/${route.params.id}/exclusions`, {
|
await axios.post(`Zones/${route.params.id}/exclusions`, {
|
||||||
dated: dated.value,
|
dated: dated.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error creating exclusion: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
@ -93,13 +82,9 @@ const onSubmit = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteEvent = async () => {
|
const deleteEvent = async () => {
|
||||||
try {
|
|
||||||
if (!props.event) return;
|
if (!props.event) return;
|
||||||
await axios.delete(`Zones/${route.params.id}/exclusions`);
|
await axios.delete(`Zones/${route.params.id}/exclusions`);
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting event: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => emit('closeForm');
|
const closeForm = () => emit('closeForm');
|
||||||
|
@ -129,13 +114,14 @@ onMounted(() => {
|
||||||
@on-submit="onSubmit()"
|
@on-submit="onSubmit()"
|
||||||
:default-cancel-button="false"
|
:default-cancel-button="false"
|
||||||
:default-submit-button="false"
|
:default-submit-button="false"
|
||||||
|
:submit-on-enter="false"
|
||||||
>
|
>
|
||||||
<template #form-inputs>
|
<template #form-inputs>
|
||||||
<VnRow class="row q-gutter-md q-mb-lg">
|
<VnRow class="row q-gutter-md q-mb-lg">
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('eventsInclusionForm.day')"
|
:label="t('eventsInclusionForm.day')"
|
||||||
v-model="dated"
|
v-model="dated"
|
||||||
:model-value="props.date"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<div class="column q-gutter-y-sm q-mb-md">
|
<div class="column q-gutter-y-sm q-mb-md">
|
||||||
|
@ -196,6 +182,7 @@ onMounted(() => {
|
||||||
:label="isNew ? t('globals.add') : t('globals.save')"
|
:label="isNew ? t('globals.add') : t('globals.save')"
|
||||||
type="submit"
|
type="submit"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@click="onSubmit()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</FormPopup>
|
</FormPopup>
|
||||||
|
|
|
@ -57,7 +57,6 @@ const inclusionType = computed({
|
||||||
const arrayData = useArrayData('ZoneEvents');
|
const arrayData = useArrayData('ZoneEvents');
|
||||||
|
|
||||||
const createEvent = async () => {
|
const createEvent = async () => {
|
||||||
try {
|
|
||||||
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
|
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
|
||||||
eventInclusionFormData.value.wdays
|
eventInclusionFormData.value.wdays
|
||||||
);
|
);
|
||||||
|
@ -71,10 +70,7 @@ const createEvent = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNew.value)
|
if (isNew.value)
|
||||||
await axios.post(
|
await axios.post(`Zones/${route.params.id}/events`, eventInclusionFormData.value);
|
||||||
`Zones/${route.params.id}/events`,
|
|
||||||
eventInclusionFormData.value
|
|
||||||
);
|
|
||||||
else
|
else
|
||||||
await axios.put(
|
await axios.put(
|
||||||
`Zones/${route.params.id}/events/${props.event?.id}`,
|
`Zones/${route.params.id}/events/${props.event?.id}`,
|
||||||
|
@ -83,19 +79,12 @@ const createEvent = async () => {
|
||||||
|
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
emit('onSubmit');
|
emit('onSubmit');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error creating event', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteEvent = async () => {
|
const deleteEvent = async () => {
|
||||||
try {
|
|
||||||
if (!props.event) return;
|
if (!props.event) return;
|
||||||
await axios.delete(`Zones/${route.params.id}/events/${props.event?.id}`);
|
await axios.delete(`Zones/${route.params.id}/events/${props.event?.id}`);
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting event: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -57,15 +57,11 @@ const arrayData = useArrayData('ZoneEvents', {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
|
||||||
if (!params.value.zoneFk || !params.value.started || !params.value.ended) return;
|
if (!params.value.zoneFk || !params.value.started || !params.value.ended) return;
|
||||||
|
|
||||||
await arrayData.applyFilter({
|
await arrayData.applyFilter({
|
||||||
params: params.value,
|
params: params.value,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching events: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -87,13 +83,9 @@ const formatWdays = (event) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteEvent = async (id) => {
|
const deleteEvent = async (id) => {
|
||||||
try {
|
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
await axios.delete(`Zones/${route.params.id}/events/${id}`);
|
await axios.delete(`Zones/${route.params.id}/events/${id}`);
|
||||||
await fetchData();
|
await fetchData();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting event: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openInclusionForm = (event) => {
|
const openInclusionForm = (event) => {
|
||||||
|
|
|
@ -10,13 +10,9 @@ const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const onSelected = async (val, node) => {
|
const onSelected = async (val, node) => {
|
||||||
try {
|
|
||||||
if (val === null) val = undefined;
|
if (val === null) val = undefined;
|
||||||
const params = { geoId: node.id, isIncluded: val };
|
const params = { geoId: node.id, isIncluded: val };
|
||||||
await axios.post(`Zones/${route.params.id}/toggleIsIncluded`, params);
|
await axios.post(`Zones/${route.params.id}/toggleIsIncluded`, params);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error updating included', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ const datakey = 'ZoneLocations';
|
||||||
const url = computed(() => `Zones/${route.params.id}/getLeaves`);
|
const url = computed(() => `Zones/${route.params.id}/getLeaves`);
|
||||||
const arrayData = useArrayData(datakey, {
|
const arrayData = useArrayData(datakey, {
|
||||||
url: url.value,
|
url: url.value,
|
||||||
|
limit: null,
|
||||||
});
|
});
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ const onNodeExpanded = async (nodeKeysArray) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
node.childs = response.data.map((n) => {
|
node.childs = response.data.map((n) => {
|
||||||
if (n.sons > 0) n.childs = [{}];
|
if (n.sons > 0) n.childs = [{}];
|
||||||
|
n.selected = isSelected(n.selected);
|
||||||
return n;
|
return n;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,21 +92,16 @@ const onNodeExpanded = async (nodeKeysArray) => {
|
||||||
previousExpandedNodes.value = nodeKeysSet;
|
previousExpandedNodes.value = nodeKeysSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatNodeSelected = (node) => {
|
|
||||||
if (node.selected === 1) node.selected = true;
|
|
||||||
else if (node.selected === 0) node.selected = false;
|
|
||||||
|
|
||||||
if (node.sons > 0 && !node.childs) node.childs = [{}];
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchNodeLeaves = async (nodeKey) => {
|
const fetchNodeLeaves = async (nodeKey) => {
|
||||||
if (!treeRef.value) return;
|
if (!treeRef.value) return;
|
||||||
const node = treeRef.value?.getNodeByKey(nodeKey);
|
const node = treeRef.value?.getNodeByKey(nodeKey);
|
||||||
if (node.selected === 1) node.selected = true;
|
if (typeof node.selected === 'number') node.selected = !!node.selected;
|
||||||
else if (node.selected === 0) node.selected = false;
|
if (node.sons > 0 && !node.childs) {
|
||||||
|
node.childs = [{}];
|
||||||
|
const index = expanded.value.indexOf(node.id);
|
||||||
|
expanded.value.splice(index, 1);
|
||||||
|
}
|
||||||
if (!node || node.sons === 0) return;
|
if (!node || node.sons === 0) return;
|
||||||
|
|
||||||
state.set('Tree', node);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getNodeIds(node) {
|
function getNodeIds(node) {
|
||||||
|
@ -119,6 +116,10 @@ function getNodeIds(node) {
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSelected(selected) {
|
||||||
|
if (typeof selected === 'number') return !!selected;
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => store.data,
|
() => store.data,
|
||||||
async (val) => {
|
async (val) => {
|
||||||
|
@ -128,32 +129,21 @@ watch(
|
||||||
nodes.value[0].childs = [...val];
|
nodes.value[0].childs = [...val];
|
||||||
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
||||||
state.set('Tree', [...fetchedNodeKeys]);
|
state.set('Tree', [...fetchedNodeKeys]);
|
||||||
|
expanded.value = [null, ...fetchedNodeKeys];
|
||||||
if (!store.userParams?.search) {
|
|
||||||
val.forEach((n) => {
|
|
||||||
formatNodeSelected(n);
|
|
||||||
});
|
|
||||||
store.data = null;
|
|
||||||
expanded.value = [null];
|
|
||||||
} else {
|
|
||||||
for (let n of state.get('Tree')) {
|
for (let n of state.get('Tree')) {
|
||||||
await fetchNodeLeaves(n);
|
await fetchNodeLeaves(n);
|
||||||
}
|
}
|
||||||
expanded.value = [null, ...fetchedNodeKeys];
|
|
||||||
}
|
|
||||||
previousExpandedNodes.value = new Set(expanded.value);
|
previousExpandedNodes.value = new Set(expanded.value);
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const reFetch = async () => {
|
const reFetch = async () => {
|
||||||
const { data } = await arrayData.fetch({ append: false });
|
await arrayData.fetch({});
|
||||||
nodes.value = data;
|
|
||||||
expanded.value = [null];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (store.userParams?.search) await arrayData.fetch({});
|
await reFetch();
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
@ -167,13 +157,13 @@ onUnmounted(() => {
|
||||||
v-if="showSearchBar"
|
v-if="showSearchBar"
|
||||||
v-model="store.userParams.search"
|
v-model="store.userParams.search"
|
||||||
:placeholder="$t('globals.search')"
|
:placeholder="$t('globals.search')"
|
||||||
@update:model-value="reFetch()"
|
@keydown.enter.stop.prevent="reFetch"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
<VnSearchbar :data-key="datakey" :url="url" :redirect="false" />
|
<VnSearchbar v-if="!showSearchBar" :data-key="datakey" :url="url" :redirect="false" />
|
||||||
<QTree
|
<QTree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
:nodes="nodes"
|
:nodes="nodes"
|
||||||
|
|
|
@ -21,7 +21,6 @@ const arrayData = useArrayData('ZoneDeliveryDays', {
|
||||||
|
|
||||||
const deliveryMethodsConfig = { pickUp: ['PICKUP'], delivery: ['AGENCY', 'DELIVERY'] };
|
const deliveryMethodsConfig = { pickUp: ['PICKUP'], delivery: ['AGENCY', 'DELIVERY'] };
|
||||||
const fetchData = async (params) => {
|
const fetchData = async (params) => {
|
||||||
try {
|
|
||||||
const { data } = params
|
const { data } = params
|
||||||
? await arrayData.applyFilter({
|
? await arrayData.applyFilter({
|
||||||
params,
|
params,
|
||||||
|
@ -29,9 +28,6 @@ const fetchData = async (params) => {
|
||||||
: await arrayData.fetch({ append: false });
|
: await arrayData.fetch({ append: false });
|
||||||
if (!data.events || !data.events.length)
|
if (!data.events || !data.events.length)
|
||||||
notify(t('deliveryPanel.noEventsWarning'), 'warning');
|
notify(t('deliveryPanel.noEventsWarning'), 'warning');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching events: ', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default {
|
||||||
'WorkerDms',
|
'WorkerDms',
|
||||||
'WorkerTimeControl',
|
'WorkerTimeControl',
|
||||||
'WorkerLocker',
|
'WorkerLocker',
|
||||||
|
'WorkerPit',
|
||||||
'WorkerBalance',
|
'WorkerBalance',
|
||||||
'WorkerFormation',
|
'WorkerFormation',
|
||||||
'WorkerMedical',
|
'WorkerMedical',
|
||||||
|
@ -216,6 +217,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
|
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'WorkerPit',
|
||||||
|
path: 'pit',
|
||||||
|
meta: {
|
||||||
|
title: 'pit',
|
||||||
|
icon: 'lock',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Worker/Card/WorkerPit.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'WorkerOperator',
|
name: 'WorkerOperator',
|
||||||
path: 'operator',
|
path: 'operator',
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
describe('VnInput Component', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/supplier/1/fiscal-data');
|
||||||
|
cy.domContentLoad();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should replace character at cursor position in insert mode', () => {
|
||||||
|
// Simula escribir en el input
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').clear();
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('4100000001');
|
||||||
|
// Coloca el cursor en la posición 0
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
|
||||||
|
// Escribe un número y verifica que se reemplace correctamente
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('999');
|
||||||
|
cy.dataCy('supplierFiscalDataAccount')
|
||||||
|
.should('have.value', '9990000001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should replace character at cursor position in insert mode', () => {
|
||||||
|
// Simula escribir en el input
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').clear();
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('4100000001');
|
||||||
|
// Coloca el cursor en la posición 0
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
|
||||||
|
// Escribe un número y verifica que se reemplace correctamente en la posicion incial
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('999');
|
||||||
|
cy.dataCy('supplierFiscalDataAccount')
|
||||||
|
.should('have.value', '9990000001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should respect maxlength prop', () => {
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').clear();
|
||||||
|
cy.dataCy('supplierFiscalDataAccount').type('123456789012345');
|
||||||
|
cy.dataCy('supplierFiscalDataAccount')
|
||||||
|
.should('have.value', '1234567890'); // asumiendo que maxlength es 10
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,3 +1,5 @@
|
||||||
|
const { randomNumber, randomString } = require('../../support');
|
||||||
|
|
||||||
describe('VnLocation', () => {
|
describe('VnLocation', () => {
|
||||||
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
|
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
|
||||||
const dialogInputs = '.q-dialog label input';
|
const dialogInputs = '.q-dialog label input';
|
||||||
|
@ -99,25 +101,26 @@ describe('VnLocation', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create postCode', () => {
|
it('Create postCode', () => {
|
||||||
const postCode = '1234475';
|
const postCode = Math.floor(100000 + Math.random() * 900000);
|
||||||
const province = 'Valencia';
|
const province = 'Valencia';
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
||||||
cy.get(dialogInputs).eq(0).clear();
|
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||||
province
|
province
|
||||||
);
|
);
|
||||||
|
cy.get(dialogInputs).eq(0).clear();
|
||||||
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
cy.get(`${createForm.prefix}`).should('not.exist');
|
cy.get(`${createForm.prefix}`).should('not.exist');
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
|
|
||||||
checkVnLocation(postCode, province);
|
checkVnLocation(postCode, province);
|
||||||
});
|
});
|
||||||
it('Create city', () => {
|
|
||||||
const postCode = '9011';
|
it('Create city without country', () => {
|
||||||
const province = 'Saskatchew';
|
const postCode = randomNumber();
|
||||||
|
const province = randomString({ length: 4 });
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
cy.get(
|
cy.get(
|
||||||
|
@ -131,6 +134,58 @@ describe('VnLocation', () => {
|
||||||
checkVnLocation(postCode, province);
|
checkVnLocation(postCode, province);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Create province without country', () => {
|
||||||
|
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
|
cy.get(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > .q-select > ${createForm.sufix} > :nth-child(2) `
|
||||||
|
)
|
||||||
|
.eq(0)
|
||||||
|
.click();
|
||||||
|
cy.selectOption('#q-portal--dialog--3 .q-select', 'one');
|
||||||
|
cy.countSelectOptions('#q-portal--dialog--3 .q-select', 4);
|
||||||
|
cy.get('#q-portal--dialog--3 .q-input').type(provinceName);
|
||||||
|
|
||||||
|
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Create city with country', () => {
|
||||||
|
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
|
cy.selectOption(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
|
'Italia'
|
||||||
|
);
|
||||||
|
cy.get(
|
||||||
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
||||||
|
).click();
|
||||||
|
cy.selectOption('#q-portal--dialog--4 .q-select', 'Province four');
|
||||||
|
cy.countSelectOptions('#q-portal--dialog--4 .q-select', 1);
|
||||||
|
|
||||||
|
cy.get('#q-portal--dialog--4 .q-input').type(cityName);
|
||||||
|
cy.get('#q-portal--dialog--4 .q-btn--standard').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Create province with country', () => {
|
||||||
|
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
|
cy.selectOption(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
|
'España'
|
||||||
|
);
|
||||||
|
cy.get(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > .q-select > ${createForm.sufix} > :nth-child(2) `
|
||||||
|
)
|
||||||
|
.eq(0)
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.selectOption('#q-portal--dialog--4 .q-select', 'one');
|
||||||
|
cy.countSelectOptions('#q-portal--dialog--4 .q-select', 2);
|
||||||
|
|
||||||
|
cy.get('#q-portal--dialog--4 .q-input').type(provinceName);
|
||||||
|
cy.get('#q-portal--dialog--4 .q-btn--standard').click();
|
||||||
|
});
|
||||||
|
|
||||||
function checkVnLocation(postCode, province) {
|
function checkVnLocation(postCode, province) {
|
||||||
cy.get(`${createForm.prefix}`).should('not.exist');
|
cy.get(`${createForm.prefix}`).should('not.exist');
|
||||||
cy.get('.q-form > .q-card > .vn-row:nth-child(6)')
|
cy.get('.q-form > .q-card > .vn-row:nth-child(6)')
|
|
@ -0,0 +1,40 @@
|
||||||
|
describe('WorkerPit', () => {
|
||||||
|
const familySituationInput = '[data-cy="Family Situation_input"]';
|
||||||
|
const familySituation = '1';
|
||||||
|
const childPensionInput = '[data-cy="Child Pension_input"]';
|
||||||
|
const childPension = '120';
|
||||||
|
const spouseNifInput = '[data-cy="Spouse Pension_input"]';
|
||||||
|
const spouseNif = '65117125P';
|
||||||
|
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
|
||||||
|
const spousePension = '120';
|
||||||
|
const addRelative = '[data-cy="addRelative"]';
|
||||||
|
const isDescendantSelect = '[data-cy="Descendant/Ascendant_select"]';
|
||||||
|
const birthedInput = '[data-cy="Birth Year_input"]';
|
||||||
|
const birthed = '2002';
|
||||||
|
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
|
||||||
|
const adoptionYear = '2004';
|
||||||
|
const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]';
|
||||||
|
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/worker/1107/pit`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('complete PIT', () => {
|
||||||
|
cy.get(familySituationInput).type(familySituation);
|
||||||
|
cy.get(childPensionInput).type(childPension);
|
||||||
|
cy.get(spouseNifInput).type(spouseNif);
|
||||||
|
cy.get(spousePensionInput).type(spousePension);
|
||||||
|
cy.get(savePIT).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('complete relative', () => {
|
||||||
|
cy.get(addRelative).click();
|
||||||
|
cy.get(isDescendantSelect).type('{downArrow}{downArrow}{enter}');
|
||||||
|
cy.get(birthedInput).type(birthed);
|
||||||
|
cy.get(adoptionYearInput).type(adoptionYear);
|
||||||
|
cy.get(saveRelative).click();
|
||||||
|
});
|
||||||
|
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue