Compare commits

..

1 Commits

Author SHA1 Message Date
Alex Moreno 65e2f950b9 chore: try use quasar bus
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2024-11-14 14:54:06 +01:00
218 changed files with 3266 additions and 3838 deletions

View File

@ -1,189 +1,3 @@
# 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 🆕

View File

@ -1,7 +1,4 @@
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: {
@ -19,7 +16,6 @@ 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,

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "24.50.0", "version": "24.44.0",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",
@ -64,4 +64,4 @@
"vite": "^5.1.4", "vite": "^5.1.4",
"vitest": "^0.31.1" "vitest": "^0.31.1"
} }
} }

7
src/boot/removeBus.js Normal file
View File

@ -0,0 +1,7 @@
import { EventBus } from 'quasar';
import { boot } from 'quasar/wrappers';
export default boot(({ app }) => {
const bus = new EventBus();
app.provide('remove', bus);
});

View File

@ -9,6 +9,8 @@ import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from './FormModelPopup.vue'; import FormModelPopup from './FormModelPopup.vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
defineProps({ showEntityField: { type: Boolean, default: true } });
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
const { t } = useI18n(); const { t } = useI18n();
const bicInputRef = ref(null); const bicInputRef = ref(null);
@ -16,16 +18,17 @@ const state = useState();
const customer = computed(() => state.get('customer')); const customer = computed(() => state.get('customer'));
const countriesFilter = {
fields: ['id', 'name', 'code'],
};
const bankEntityFormData = reactive({ const bankEntityFormData = reactive({
name: null, name: null,
bic: null, bic: null,
countryFk: customer.value?.countryFk, countryFk: customer.value?.countryFk,
id: null,
}); });
const countriesFilter = {
fields: ['id', 'name', 'code'],
};
const countriesOptions = ref([]); const countriesOptions = ref([]);
const onDataSaved = (...args) => { const onDataSaved = (...args) => {
@ -41,6 +44,7 @@ onMounted(async () => {
<template> <template>
<FetchData <FetchData
url="Countries" url="Countries"
:filter="countriesFilter"
auto-load auto-load
@on-fetch="(data) => (countriesOptions = data)" @on-fetch="(data) => (countriesOptions = data)"
/> />
@ -50,7 +54,6 @@ onMounted(async () => {
:title="t('title')" :title="t('title')"
:subtitle="t('subtitle')" :subtitle="t('subtitle')"
:form-initial-data="bankEntityFormData" :form-initial-data="bankEntityFormData"
:filter="countriesFilter"
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data, validate }"> <template #form-inputs="{ data, validate }">
@ -82,13 +85,7 @@ onMounted(async () => {
:rules="validate('bankEntity.countryFk')" :rules="validate('bankEntity.countryFk')"
/> />
</div> </div>
<div <div v-if="showEntityField" class="col">
v-if="
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
'ES'
"
class="col"
>
<VnInput <VnInput
:label="t('id')" :label="t('id')"
v-model="data.id" v-model="data.id"

View File

@ -0,0 +1,155 @@
<script setup>
import { reactive, ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
import VnInputDate from './common/VnInputDate.vue';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
const router = useRouter();
const manualInvoiceFormData = reactive({
maxShipped: Date.vnNew(),
});
const formModelPopupRef = ref();
const invoiceOutSerialsOptions = ref([]);
const taxAreasOptions = ref([]);
const ticketsOptions = ref([]);
const clientsOptions = ref([]);
const isLoading = computed(() => formModelPopupRef.value?.isLoading);
const onDataSaved = async (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
if (requestResponse && requestResponse.id)
router.push({ name: 'InvoiceOutSummary', params: { id: requestResponse.id } });
};
</script>
<template>
<FetchData
url="InvoiceOutSerials"
:filter="{ where: { code: { neq: 'R' } }, order: ['code'] }"
@on-fetch="(data) => (invoiceOutSerialsOptions = data)"
auto-load
/>
<FetchData
url="TaxAreas"
:filter="{ order: ['code'] }"
@on-fetch="(data) => (taxAreasOptions = data)"
auto-load
/>
<FormModelPopup
ref="formModelPopupRef"
:title="t('Create manual invoice')"
url-create="InvoiceOuts/createManualInvoice"
model="invoiceOut"
:form-initial-data="manualInvoiceFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<span v-if="isLoading" class="text-primary invoicing-text">
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
{{ t('Invoicing in progress...') }}
</span>
<VnRow>
<VnSelect
:label="t('Ticket')"
:options="ticketsOptions"
hide-selected
option-label="id"
option-value="id"
v-model="data.ticketFk"
@update:model-value="data.clientFk = null"
url="Tickets"
:where="{ refFk: null }"
:fields="['id', 'nickname']"
:filter-options="{ order: 'shipped DESC' }"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<span class="row items-center" style="max-width: max-content">{{
t('Or')
}}</span>
<VnSelect
:label="t('Client')"
:options="clientsOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.clientFk"
@update:model-value="data.ticketFk = null"
url="Clients"
:fields="['id', 'name']"
:filter-options="{ order: 'name ASC' }"
/>
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
</VnRow>
<VnRow>
<VnSelect
:label="t('Serial')"
:options="invoiceOutSerialsOptions"
hide-selected
option-label="description"
option-value="code"
v-model="data.serial"
/>
<VnSelect
:label="t('Area')"
:options="taxAreasOptions"
hide-selected
option-label="code"
option-value="code"
v-model="data.taxArea"
/>
</VnRow>
<VnRow>
<VnInput
:label="t('Reference')"
type="textarea"
v-model="data.reference"
fill-input
autogrow
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<style lang="scss" scoped>
.invoicing-text {
display: flex;
justify-content: center;
align-items: center;
color: $primary;
font-size: 24px;
margin-bottom: 8px;
}
</style>
<i18n>
es:
Create manual invoice: Crear factura manual
Ticket: Ticket
Client: Cliente
Max date: Fecha límite
Serial: Serie
Area: Area
Reference: Referencia
Or: O
Invoicing in progress...: Facturación en progreso...
</i18n>

View File

@ -17,6 +17,10 @@ const $props = defineProps({
type: Number, type: Number,
default: null, default: null,
}, },
provinces: {
type: Array,
default: () => [],
},
}); });
const { t } = useI18n(); const { t } = useI18n();
@ -40,23 +44,19 @@ const onDataSaved = (...args) => {
url-create="towns" url-create="towns"
model="city" model="city"
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
data-cy="newCityForm"
> >
<template #form-inputs="{ data, validate }"> <template #form-inputs="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
:label="t('Name')" :label="t('Names')"
v-model="data.name" v-model="data.name"
:rules="validate('city.name')" :rules="validate('city.name')"
required
data-cy="cityName"
/> />
<VnSelectProvince <VnSelectProvince
:province-selected="$props.provinceSelected" :province-selected="$props.provinceSelected"
:country-fk="$props.countryFk" :country-fk="$props.countryFk"
v-model="data.provinceFk" v-model="data.provinceFk"
required :provinces="$props.provinces"
data-cy="provinceCity"
/> />
</VnRow> </VnRow>
</template> </template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -21,15 +21,13 @@ const postcodeFormData = reactive({
provinceFk: null, provinceFk: null,
townFk: null, townFk: null,
}); });
const townsFetchDataRef = ref(false);
const townFilter = ref({});
const countriesRef = ref(false); const townsFetchDataRef = ref(null);
const provincesFetchDataRef = ref(false); const provincesFetchDataRef = ref(null);
const countriesOptions = ref([]);
const provincesOptions = ref([]); const provincesOptions = ref([]);
const townsOptions = ref([]); const townsOptions = ref([]);
const town = ref({}); const town = ref({});
const countryFilter = ref({});
function onDataSaved(formData) { function onDataSaved(formData) {
const newPostcode = { const newPostcode = {
@ -41,56 +39,13 @@ function onDataSaved(formData) {
({ id }) => id === formData.provinceFk ({ id }) => id === formData.provinceFk
); );
newPostcode.province = provinceObject?.name; newPostcode.province = provinceObject?.name;
const countryObject = countriesRef.value.opts.find( const countryObject = countriesOptions.value.find(
({ id }) => id === formData.countryFk ({ id }) => id === formData.countryFk
); );
newPostcode.country = countryObject?.name; newPostcode.country = countryObject?.name;
emit('onDataSaved', newPostcode); emit('onDataSaved', newPostcode);
} }
async function setCountry(countryFk, data) {
data.townFk = null;
data.provinceFk = null;
data.countryFk = countryFk;
await fetchTowns();
}
// Province
async function handleProvinces(data) {
provincesOptions.value = data;
if (postcodeFormData.countryFk) {
await fetchTowns();
}
}
async function setProvince(id, data) {
if (data.provinceFk === id) return;
const newProvince = provincesOptions.value.find((province) => province.id == id);
if (newProvince) data.countryFk = newProvince.countryFk;
postcodeFormData.provinceFk = id;
await fetchTowns();
}
async function onProvinceCreated(data) {
await provincesFetchDataRef.value.fetch({
where: { countryFk: postcodeFormData.countryFk },
});
postcodeFormData.provinceFk = data.id;
}
function provinceByCountry(countryFk = postcodeFormData.countryFk) {
return provincesOptions.value
.filter((province) => province.countryFk === countryFk)
.map(({ id }) => id);
}
// Town
async function handleTowns(data) {
townsOptions.value = data;
}
function setTown(newTown, data) {
town.value = newTown;
data.provinceFk = newTown?.provinceFk ?? newTown;
data.countryFk = newTown?.province?.countryFk ?? newTown;
}
async function onCityCreated(newTown, formData) { async function onCityCreated(newTown, formData) {
await provincesFetchDataRef.value.fetch(); await provincesFetchDataRef.value.fetch();
newTown.province = provincesOptions.value.find( newTown.province = provincesOptions.value.find(
@ -99,28 +54,79 @@ async function onCityCreated(newTown, formData) {
formData.townFk = newTown; formData.townFk = newTown;
setTown(newTown, formData); setTown(newTown, formData);
} }
async function fetchTowns(countryFk = postcodeFormData.countryFk) {
if (!countryFk) return; function setTown(newTown, data) {
const provinces = postcodeFormData.provinceFk if (!newTown) return;
? [postcodeFormData.provinceFk] town.value = newTown;
: provinceByCountry(); data.provinceFk = newTown.provinceFk;
townFilter.value.where = { data.countryFk = newTown.province.countryFk;
provinceFk: {
inq: provinces,
},
};
await townsFetchDataRef.value?.fetch();
} }
async function filterTowns(name) { async function setProvince(id, data) {
if (name !== '') { const newProvince = provincesOptions.value.find((province) => province.id == id);
townFilter.value.where = { if (!newProvince) return;
name: {
like: `%${name}%`, data.countryFk = newProvince.countryFk;
}, }
};
await townsFetchDataRef.value?.fetch(); async function onProvinceCreated(data) {
await provincesFetchDataRef.value.fetch({
where: { countryFk: postcodeFormData.countryFk },
});
postcodeFormData.provinceFk.value = 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>
@ -137,7 +143,6 @@ async function filterTowns(name) {
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"
@ -159,13 +164,10 @@ async function filterTowns(name) {
v-model="data.code" v-model="data.code"
:rules="validate('postcode.code')" :rules="validate('postcode.code')"
clearable clearable
required
data-cy="locationPostcode"
/> />
<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"
@ -174,8 +176,7 @@ async function filterTowns(name) {
:rules="validate('postcode.city')" :rules="validate('postcode.city')"
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]" :acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:emit-value="false" :emit-value="false"
required :clearable="true"
data-cy="locationTown"
> >
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
<QItem v-bind="itemProps"> <QItem v-bind="itemProps">
@ -192,6 +193,7 @@ async function filterTowns(name) {
<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)
@ -206,25 +208,20 @@ async function filterTowns(name) {
: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"
:provinces="provincesOptions"
@on-province-created="onProvinceCreated" @on-province-created="onProvinceCreated"
required
/> />
<VnSelect <VnSelect
ref="countriesRef"
:limit="30"
:filter="countryFilter"
:sort-by="['name ASC']"
auto-load
url="Countries" url="Countries"
required :sort-by="['name ASC']"
:label="t('Country')" :label="t('Country')"
@update:options="handleCountries"
hide-selected hide-selected
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)"
data-cy="locationCountry"
/> />
</VnRow> </VnRow>
</template> </template>

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { computed, reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
@ -20,24 +21,34 @@ const $props = defineProps({
type: Number, type: Number,
default: null, default: null,
}, },
provinces: {
type: Array,
default: () => [],
},
}); });
const autonomiesRef = ref([]); const autonomiesOptions = ref([]);
const onDataSaved = (dataSaved, requestResponse) => { const onDataSaved = (dataSaved, requestResponse) => {
requestResponse.autonomy = autonomiesRef.value.opts.find( requestResponse.autonomy = autonomiesOptions.value.find(
(autonomy) => autonomy.id == requestResponse.autonomyFk (autonomy) => autonomy.id == requestResponse.autonomyFk
); );
emit('onDataSaved', dataSaved, requestResponse); emit('onDataSaved', dataSaved, requestResponse);
}; };
const where = computed(() => {
if (!$props.countryFk) {
return {};
}
return { countryFk: $props.countryFk };
});
</script> </script>
<template> <template>
<FetchData
@on-fetch="(data) => (autonomiesOptions = data)"
auto-load
:filter="{
where: {
countryFk: $props.countryFk,
},
}"
url="Autonomies/location"
:sort-by="['name ASC']"
:limit="30"
/>
<FormModelPopup <FormModelPopup
:title="t('New province')" :title="t('New province')"
:subtitle="t('Please, ensure you put the correct data!')" :subtitle="t('Please, ensure you put the correct data!')"
@ -52,19 +63,10 @@ const where = computed(() => {
:label="t('Name')" :label="t('Name')"
v-model="data.name" v-model="data.name"
:rules="validate('province.name')" :rules="validate('province.name')"
required
data-cy="provinceName"
/> />
<VnSelect <VnSelect
data-cy="autonomyProvince"
required
ref="autonomiesRef"
auto-load
:where="where"
url="Autonomies/location"
:sort-by="['name ASC']"
:limit="30"
:label="t('Autonomy')" :label="t('Autonomy')"
:options="autonomiesOptions"
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"

View File

@ -10,7 +10,6 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import SkeletonTable from 'components/ui/SkeletonTable.vue'; import SkeletonTable from 'components/ui/SkeletonTable.vue';
import { tMobile } from 'src/composables/tMobile'; import { tMobile } from 'src/composables/tMobile';
import getDifferences from 'src/filters/getDifferences';
const { push } = useRouter(); const { push } = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
@ -78,7 +77,7 @@ const isLoading = ref(false);
const hasChanges = ref(false); const hasChanges = ref(false);
const originalData = ref(); const originalData = ref();
const vnPaginateRef = ref(); const vnPaginateRef = ref();
const formData = ref([]); const formData = ref();
const saveButtonRef = ref(null); const saveButtonRef = ref(null);
const watchChanges = ref(); const watchChanges = ref();
const formUrl = computed(() => $props.url); const formUrl = computed(() => $props.url);
@ -95,7 +94,6 @@ defineExpose({
saveChanges, saveChanges,
getChanges, getChanges,
formData, formData,
originalData,
vnPaginateRef, vnPaginateRef,
}); });
@ -176,13 +174,14 @@ async function saveChanges(data) {
const changes = data || getChanges(); const changes = data || getChanges();
try { try {
await axios.post($props.saveUrl || $props.url + '/crud', changes); await axios.post($props.saveUrl || $props.url + '/crud', changes);
} finally { } catch (e) {
isLoading.value = false; return (isLoading.value = false);
} }
originalData.value = JSON.parse(JSON.stringify(formData.value)); originalData.value = JSON.parse(JSON.stringify(formData.value));
if (changes.creates?.length) await vnPaginateRef.value.fetch(); if (changes.creates?.length) await vnPaginateRef.value.fetch();
hasChanges.value = false; hasChanges.value = false;
isLoading.value = false;
emit('saveChanges', data); emit('saveChanges', data);
quasar.notify({ quasar.notify({
type: 'positive', type: 'positive',
@ -268,6 +267,28 @@ function getChanges() {
return changes; return changes;
} }
function getDifferences(obj1, obj2) {
let diff = {};
delete obj1.$index;
delete obj2.$index;
for (let key in obj1) {
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
diff[key] = obj2[key];
}
}
for (let key in obj2) {
if (
obj1[key] === undefined ||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
) {
diff[key] = obj2[key];
}
}
return diff;
}
function isEmpty(obj) { function isEmpty(obj) {
if (obj == null) return true; if (obj == null) return true;
if (obj === undefined) return true; if (obj === undefined) return true;
@ -373,7 +394,6 @@ watch(formUrl, async () => {
@click="onSubmit" @click="onSubmit"
:disable="!hasChanges" :disable="!hasChanges"
:title="t('globals.save')" :title="t('globals.save')"
data-cy="crudModelDefaultSaveBtn"
/> />
<slot name="moreAfterActions" /> <slot name="moreAfterActions" />
</QBtnGroup> </QBtnGroup>

View File

@ -156,22 +156,26 @@ const rotateRight = () => {
}; };
const onSubmit = () => { const onSubmit = () => {
if (!newPhoto.files && !newPhoto.url) { try {
notify(t('Select an image'), 'negative'); if (!newPhoto.files && !newPhoto.url) {
return; notify(t('Select an image'), 'negative');
return;
}
const options = {
type: 'blob',
};
editor.value
.result(options)
.then((result) => {
const file = new File([result], newPhoto.files?.name || '');
newPhoto.blob = file;
})
.then(() => makeRequest());
} catch (err) {
console.error('Error uploading image');
} }
const options = {
type: 'blob',
};
editor.value
.result(options)
.then((result) => {
const file = new File([result], newPhoto.files?.name || '');
newPhoto.blob = file;
})
.then(() => makeRequest());
}; };
const makeRequest = async () => { const makeRequest = async () => {

View File

@ -51,17 +51,21 @@ const onDataSaved = () => {
}; };
const onSubmit = async () => { const onSubmit = async () => {
isLoading.value = true; try {
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk })); isLoading.value = true;
const payload = { const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
field: selectedField.value.field, const payload = {
newValue: newValue.value, field: selectedField.value.field,
lines: rowsToEdit, newValue: newValue.value,
}; lines: rowsToEdit,
};
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 = () => {

View File

@ -84,30 +84,34 @@ const tableColumns = computed(() => [
]); ]);
const onSubmit = async () => { const onSubmit = async () => {
let filter = itemFilter; try {
const params = itemFilterParams; let filter = itemFilter;
const where = {}; const params = itemFilterParams;
for (let key in params) { const where = {};
const value = params[key]; for (let key in params) {
if (!value) continue; const value = params[key];
if (!value) continue;
switch (key) { switch (key) {
case 'name': case 'name':
where[key] = { like: `%${value}%` }; where[key] = { like: `%${value}%` };
break; break;
case 'producerFk': case 'producerFk':
case 'typeFk': case 'typeFk':
case 'size': case 'size':
case 'inkFk': case 'inkFk':
where[key] = value; where[key] = value;
}
} }
} filter.where = where;
filter.where = where;
const { data } = await axios.get(props.url, { const { data } = await axios.get(props.url, {
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 = () => {

View File

@ -86,28 +86,32 @@ const tableColumns = computed(() => [
]); ]);
const onSubmit = async () => { const onSubmit = async () => {
let filter = travelFilter; try {
const params = travelFilterParams; let filter = travelFilter;
const where = {}; const params = travelFilterParams;
for (let key in params) { const where = {};
const value = params[key]; for (let key in params) {
if (!value) continue; const value = params[key];
if (!value) continue;
switch (key) { switch (key) {
case 'agencyModeFk': case 'agencyModeFk':
case 'warehouseInFk': case 'warehouseInFk':
case 'warehouseOutFk': case 'warehouseOutFk':
case 'shipped': case 'shipped':
case 'landed': case 'landed':
where[key] = value; where[key] = value;
}
} }
}
filter.where = where; filter.where = where;
const { data } = await axios.get('Travels', { const { data } = await axios.get('Travels', {
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 = () => {

View File

@ -91,10 +91,6 @@ 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(
@ -110,7 +106,6 @@ const originalData = ref({});
const formData = computed(() => state.get(modelValue)); const formData = computed(() => state.get(modelValue));
const defaultButtons = computed(() => ({ const defaultButtons = computed(() => ({
save: { save: {
dataCy: 'saveDefaultBtn',
color: 'primary', color: 'primary',
icon: 'save', icon: 'save',
label: 'globals.save', label: 'globals.save',
@ -118,7 +113,6 @@ const defaultButtons = computed(() => ({
type: 'submit', type: 'submit',
}, },
reset: { reset: {
dataCy: 'resetDefaultBtn',
color: 'primary', color: 'primary',
icon: 'restart_alt', icon: 'restart_alt',
label: 'globals.reset', label: 'globals.reset',
@ -209,9 +203,7 @@ async function save() {
isLoading.value = true; isLoading.value = true;
try { try {
formData.value = trimData(formData.value); formData.value = trimData(formData.value);
const body = $props.mapper const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
? $props.mapper(formData.value, originalData.value)
: formData.value;
const method = $props.urlCreate ? 'post' : 'patch'; const method = $props.urlCreate ? 'post' : 'patch';
const url = const url =
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url; $props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
@ -291,7 +283,6 @@ 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>
@ -326,7 +317,6 @@ defineExpose({
:title="t(defaultButtons.reset.label)" :title="t(defaultButtons.reset.label)"
/> />
<QBtnDropdown <QBtnDropdown
data-cy="saveAndContinueDefaultBtn"
v-if="$props.goTo" v-if="$props.goTo"
@click="saveAndGo" @click="saveAndGo"
:label="tMobile('globals.saveAndContinue')" :label="tMobile('globals.saveAndContinue')"
@ -381,6 +371,7 @@ defineExpose({
color: black; color: black;
} }
#formModel { #formModel {
max-width: 800px;
width: 100%; width: 100%;
} }

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
const emit = defineEmits(['onSubmit']); const emit = defineEmits(['onSubmit']);
const $props = defineProps({ defineProps({
title: { title: {
type: String, type: String,
default: '', default: '',
@ -25,21 +25,16 @@ const $props = 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 = () => {

View File

@ -88,16 +88,20 @@ const applyTags = (params, search) => {
}; };
const fetchItemTypes = async (id) => { const fetchItemTypes = async (id) => {
const filter = { try {
fields: ['id', 'name', 'categoryFk'], const filter = {
where: { categoryFk: id }, fields: ['id', 'name', 'categoryFk'],
include: 'category', where: { categoryFk: id },
order: 'name ASC', include: 'category',
}; order: 'name ASC',
const { data } = await axios.get('ItemTypes', { };
params: { filter: JSON.stringify(filter) }, const { data } = await axios.get('ItemTypes', {
}); 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) => {
@ -107,19 +111,23 @@ const getCategoryClass = (category, params) => {
}; };
const getSelectedTagValues = async (tag) => { const getSelectedTagValues = async (tag) => {
if (!tag?.selectedTag?.id) return; try {
tag.value = null; if (!tag?.selectedTag?.id) return;
const filter = { tag.value = null;
fields: ['value'], const filter = {
order: 'value ASC', fields: ['value'],
limit: 30, order: 'value ASC',
}; limit: 30,
};
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, { const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, {
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) => {

View File

@ -22,7 +22,7 @@ const props = defineProps({
default: 'main', default: 'main',
}, },
}); });
const initialized = ref(false);
const items = ref([]); const items = ref([]);
const expansionItemElements = reactive({}); const expansionItemElements = reactive({});
const pinnedModules = computed(() => { const pinnedModules = computed(() => {
@ -34,26 +34,18 @@ const search = ref(null);
const filteredItems = computed(() => { const filteredItems = computed(() => {
if (!search.value) return items.value; if (!search.value) return items.value;
const normalizedSearch = normalize(search.value);
return items.value.filter((item) => { return items.value.filter((item) => {
const locale = normalize(t(item.title)); const locale = t(item.title).toLowerCase();
return locale.includes(normalizedSearch); return locale.includes(search.value.toLowerCase());
}); });
}); });
const filteredPinnedModules = computed(() => { const filteredPinnedModules = computed(() => {
if (!search.value) return pinnedModules.value; if (!search.value) return pinnedModules.value;
const normalizedSearch = search.value
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase();
const map = new Map(); const map = new Map();
for (const [key, pinnedModule] of pinnedModules.value) { for (const [key, pinnedModule] of pinnedModules.value) {
const locale = t(pinnedModule.title) const locale = t(pinnedModule.title).toLowerCase();
.normalize('NFD') if (locale.includes(search.value.toLowerCase())) map.set(key, pinnedModule);
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase();
if (locale.includes(normalizedSearch)) map.set(key, pinnedModule);
} }
return map; return map;
}); });
@ -61,13 +53,11 @@ const filteredPinnedModules = computed(() => {
onMounted(async () => { onMounted(async () => {
await navigation.fetchPinned(); await navigation.fetchPinned();
getRoutes(); getRoutes();
initialized.value = true;
}); });
watch( watch(
() => route.matched, () => route.matched,
() => { () => {
if (!initialized.value) return;
items.value = []; items.value = [];
getRoutes(); getRoutes();
}, },
@ -157,13 +147,6 @@ async function togglePinned(item, event) {
const handleItemExpansion = (itemName) => { const handleItemExpansion = (itemName) => {
expansionItemElements[itemName].scrollToLastElement(); expansionItemElements[itemName].scrollToLastElement();
}; };
function normalize(text) {
return text
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase();
}
</script> </script>
<template> <template>

View File

@ -39,10 +39,14 @@ const refund = async () => {
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk, invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
}; };
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params); try {
notify(t('Refunded invoice'), 'positive'); const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
const [id] = data?.refundId || []; notify(t('Refunded invoice'), 'positive');
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); const [id] = data?.refundId || [];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
} catch (err) {
console.error('Error refunding invoice', err);
}
}; };
</script> </script>

View File

@ -1,40 +0,0 @@
<script setup>
defineProps({ row: { type: Object, required: true } });
</script>
<template>
<span>
<QIcon
v-if="row.isTaxDataChecked === 0"
name="vn:no036"
color="primary"
size="xs"
>
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
</QIcon>
<QIcon v-if="row.hasTicketRequest" name="vn:buyrequest" color="primary" size="xs">
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
</QIcon>
<QIcon v-if="row.itemShortage" name="vn:unavailable" color="primary" size="xs">
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
</QIcon>
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
</QIcon>
<QIcon
v-if="row.risk"
name="vn:risk"
:color="row.hasHighRisk ? 'negative' : 'primary'"
size="xs"
>
<QTooltip>
{{ $t('salesTicketsTable.risk') }}: {{ row.risk - row.credit }}
</QTooltip>
</QIcon>
<QIcon v-if="row.hasComponentLack" name="vn:components" color="primary" size="xs">
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
</QIcon>
<QIcon v-if="row.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
</QIcon>
</span>
</template>

View File

@ -49,32 +49,36 @@ const makeInvoice = async () => {
makeInvoice: checked.value, makeInvoice: checked.value,
}; };
if (checked.value && hasToInvoiceByAddress) { try {
const response = await new Promise((resolve) => { if (checked.value && hasToInvoiceByAddress) {
quasar const response = await new Promise((resolve) => {
.dialog({ quasar
component: VnConfirm, .dialog({
componentProps: { component: VnConfirm,
title: t('Bill destination client'), componentProps: {
message: t('transferInvoiceInfo'), title: t('Bill destination client'),
}, message: t('transferInvoiceInfo'),
}) },
.onOk(() => { })
resolve(true); .onOk(() => {
}) resolve(true);
.onCancel(() => { })
resolve(false); .onCancel(() => {
}); resolve(false);
}); });
if (!response) { });
return; if (!response) {
return;
}
} }
}
const { data } = await axios.post('InvoiceOuts/transfer', params); const { data } = await axios.post('InvoiceOuts/transfer', params);
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>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch } from 'vue'; import { ref } 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', 'onProvinceFetched']); const emit = defineEmits(['onProvinceCreated']);
const $props = defineProps({ const $props = defineProps({
countryFk: { countryFk: {
type: Number, type: Number,
@ -17,23 +17,20 @@ 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);
const provincesFetchDataRef = ref();
provinceFk.value = $props.provinceSelected; provinceFk.value = $props.provinceSelected;
if (!$props.countryFk) { const provincesFetchDataRef = ref();
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;
@ -42,31 +39,23 @@ 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
data-cy="locationProvince"
:label="t('Province')" :label="t('Province')"
:options="provincesOptions" :options="$props.provinces"
:tooltip="t('Create province')" :tooltip="t('Create province')"
hide-selected hide-selected
v-model="provinceFk" v-model="provinceFk"

View File

@ -25,7 +25,7 @@ const $props = defineProps({
}, },
searchUrl: { searchUrl: {
type: String, type: String,
default: 'table', default: 'params',
}, },
}); });
@ -143,10 +143,6 @@ function alignRow() {
const showFilter = computed( const showFilter = computed(
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions' () => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
); );
const onTabPressed = async () => {
if (model.value) enterEvent['keyup.enter']();
};
</script> </script>
<template> <template>
<div <div
@ -161,7 +157,6 @@ const onTabPressed = async () => {
v-model="model" v-model="model"
:components="components" :components="components"
component-prop="columnFilter" component-prop="columnFilter"
@keydown.tab="onTabPressed"
/> />
</div> </div>
</template> </template>

View File

@ -17,7 +17,7 @@ const $props = defineProps({
}, },
searchUrl: { searchUrl: {
type: String, type: String,
default: 'table', default: 'params',
}, },
vertical: { vertical: {
type: Boolean, type: Boolean,

View File

@ -162,7 +162,9 @@ onMounted(() => {
: $props.defaultMode; : $props.defaultMode;
stateStore.rightDrawer = quasar.screen.gt.xs; stateStore.rightDrawer = quasar.screen.gt.xs;
columnsVisibilitySkipped.value = [ columnsVisibilitySkipped.value = [
...splittedColumns.value.columns.filter((c) => !c.visible).map((c) => c.name), ...splittedColumns.value.columns
.filter((c) => c.visible == false)
.map((c) => c.name),
...['tableActions'], ...['tableActions'],
]; ];
createForm.value = $props.create; createForm.value = $props.create;
@ -235,7 +237,7 @@ function splitColumns(columns) {
if (col.create) splittedColumns.value.create.push(col); if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.cardVisible.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false; if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel && col.columnFilter !== false) if ($props.useModel && col.columnFilter != false)
col.columnFilter = { inWhere: true, ...col.columnFilter }; col.columnFilter = { inWhere: true, ...col.columnFilter };
splittedColumns.value.columns.push(col); splittedColumns.value.columns.push(col);
} }
@ -324,8 +326,6 @@ function handleOnDataSaved(_) {
} }
function handleScroll() { function handleScroll() {
if ($props.crudModel.disableInfiniteScroll) return;
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle'); const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
const { scrollHeight, scrollTop, clientHeight } = tMiddle; const { scrollHeight, scrollTop, clientHeight } = tMiddle;
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40; const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
@ -394,7 +394,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
:name="col.orderBy ?? col.name" :name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
:search-url="searchUrl" :search-url="searchUrl"
:vertical="false" :vertical="true"
/> />
</div> </div>
<slot <slot
@ -737,7 +737,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
fab fab
icon="add" icon="add"
shortcut="+" shortcut="+"
data-cy="vnTableCreateBtn"
/> />
<QTooltip self="top right"> <QTooltip self="top right">
{{ createForm?.title }} {{ createForm?.title }}

View File

@ -58,71 +58,79 @@ const getConfig = async (url, filter) => {
}; };
const fetchViewConfigData = async () => { const fetchViewConfigData = async () => {
const userConfigFilter = { try {
where: { tableCode: $props.tableCode, userFk: user.value.id }, const userConfigFilter = {
}; where: { tableCode: $props.tableCode, userFk: user.value.id },
const userConfig = await getConfig('UserConfigViews', userConfigFilter); };
const userConfig = await getConfig('UserConfigViews', userConfigFilter);
if (userConfig) { if (userConfig) {
initialUserConfigViewData.value = userConfig; initialUserConfigViewData.value = userConfig;
setUserConfigViewData(userConfig.configuration); setUserConfigViewData(userConfig.configuration);
return; return;
} }
const defaultConfigFilter = { where: { tableCode: $props.tableCode } }; const defaultConfigFilter = { where: { tableCode: $props.tableCode } };
const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter); const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter);
if (defaultConfig) { if (defaultConfig) {
// Si el backend devuelve una configuración por defecto la usamos // Si el backend devuelve una configuración por defecto la usamos
setUserConfigViewData(defaultConfig.columns); setUserConfigViewData(defaultConfig.columns);
return; return;
} else { } else {
// Si no hay configuración por defecto mostramos todas las columnas // Si no hay configuración por defecto mostramos todas las columnas
const defaultColumns = {}; const defaultColumns = {};
$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 () => {
const params = {}; try {
const configuration = {}; const params = {};
const configuration = {};
formattedCols.value.forEach((col) => { formattedCols.value.forEach((col) => {
const { name, active } = col; const { name, active } = col;
configuration[name] = active; configuration[name] = active;
}); });
// Si existe una view config del usuario hacemos un update si no la creamos // Si existe una view config del usuario hacemos un update si no la creamos
if (initialUserConfigViewData.value) { if (initialUserConfigViewData.value) {
params.updates = [ params.updates = [
{ {
data: { data: {
configuration: configuration,
},
where: {
id: initialUserConfigViewData.value.id,
},
},
];
} else {
params.creates = [
{
userFk: user.value.id,
tableCode: $props.tableCode,
tableConfig: $props.tableCode,
configuration: configuration, configuration: configuration,
}, },
where: { ];
id: initialUserConfigViewData.value.id, }
},
},
];
} else {
params.creates = [
{
userFk: user.value.id,
tableCode: $props.tableCode,
tableConfig: $props.tableCode,
configuration: configuration,
},
];
}
const response = await axios.post('UserConfigViews/crud', params); const response = await axios.post('UserConfigViews/crud', params);
if (response.data && response.data[0]) { if (response.data && response.data[0]) {
initialUserConfigViewData.value = response.data[0]; initialUserConfigViewData.value = response.data[0];
}
emitSavedConfig();
notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide();
} catch (err) {
console.error('Error saving user view config', err);
} }
emitSavedConfig();
notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide();
}; };
const emitSavedConfig = () => { const emitSavedConfig = () => {

View File

@ -1,24 +1,20 @@
<script setup> <script setup>
import { nextTick, ref, watch } from 'vue'; import { 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;
} }
@ -32,46 +28,8 @@ 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)
); );
@ -79,5 +37,5 @@ function accountShortToStandard() {
</script> </script>
<template> <template>
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" /> <q-input v-model="internalValue" />
</template> </template>

View File

@ -1,9 +1,12 @@
<script setup> <script setup>
import { computed, ref, useAttrs, nextTick } from 'vue'; import { computed, ref, useAttrs } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';
const $attrs = useAttrs(); const $attrs = useAttrs();
import { inject } from 'vue';
const bus = inject('bus'); // inside setup()
const { isRequired, requiredFieldRule } = useRequired($attrs); const { isRequired, requiredFieldRule } = useRequired($attrs);
const { t } = useI18n(); const { t } = useI18n();
const emit = defineEmits([ const emit = defineEmits([
@ -34,14 +37,6 @@ 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);
@ -77,9 +72,6 @@ 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 });
@ -89,33 +81,6 @@ 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>
@ -127,12 +92,10 @@ const handleInsertMode = (e) => {
: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" />
@ -141,18 +104,14 @@ const handleInsertMode = (e) => {
<QIcon <QIcon
name="close" name="close"
size="xs" size="xs"
v-if=" v-if="hover && value && !$attrs.disabled && $props.clearable"
hover &&
value &&
!$attrs.disabled &&
!$attrs.readonly &&
$props.clearable
"
@click=" @click="
() => { () => {
value = null; value = null;
vnInputRef.focus(); vnInputRef.focus();
emit('remove'); emit('remove');
console.log('HOLA');
bus.emit('some-event', 'hola');
} }
" "
></QIcon> ></QIcon>
@ -169,11 +128,9 @@ const handleInsertMode = (e) => {
<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">

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { onMounted, watch, computed, ref, useAttrs } from 'vue'; import { onMounted, watch, computed, ref } from 'vue';
import { date } from 'quasar'; import { date } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useAttrs } from 'vue';
import VnDate from './VnDate.vue'; import VnDate from './VnDate.vue';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';

View File

@ -75,6 +75,7 @@ const handleModelValue = (data) => {
:input-debounce="300" :input-debounce="300"
:class="{ required: isRequired }" :class="{ required: isRequired }"
v-bind="$attrs" v-bind="$attrs"
clearable
:emit-value="false" :emit-value="false"
:tooltip="t('Create new location')" :tooltip="t('Create new location')"
:rules="mixinRules" :rules="mixinRules"

View File

@ -2,12 +2,5 @@
const model = defineModel({ type: Boolean, required: true }); const model = defineModel({ type: Boolean, required: true });
</script> </script>
<template> <template>
<QRadio <QRadio v-model="model" v-bind="$attrs" dense :dark="true" class="q-mr-sm" />
v-model="model"
v-bind="$attrs"
dense
:dark="true"
class="q-mr-sm"
size="xs"
/>
</template> </template>

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { ref, toRefs, computed, watch, onMounted, useAttrs } from 'vue'; import { ref, toRefs, computed, watch, onMounted, useAttrs } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData'; import FetchData from 'src/components/FetchData.vue';
import { useRequired } from 'src/composables/useRequired'; import { useRequired } from 'src/composables/useRequired';
import dataByOrder from 'src/utils/dataByOrder'; import dataByOrder from 'src/utils/dataByOrder';
@ -90,10 +90,6 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
dataKey: {
type: String,
default: null,
},
}); });
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])]; const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
@ -102,14 +98,14 @@ const { optionLabel, optionValue, optionFilter, optionFilterValue, options, mode
const myOptions = ref([]); const myOptions = ref([]);
const myOptionsOriginal = ref([]); const myOptionsOriginal = ref([]);
const vnSelectRef = ref(); const vnSelectRef = ref();
const dataRef = ref();
const lastVal = ref(); const lastVal = ref();
const noOneText = t('globals.noOne'); const noOneText = t('globals.noOne');
const noOneOpt = ref({ const noOneOpt = ref({
[optionValue.value]: false, [optionValue.value]: false,
[optionLabel.value]: noOneText, [optionLabel.value]: noOneText,
}); });
const isLoading = ref(false);
const useURL = computed(() => $props.url);
const value = computed({ const value = computed({
get() { get() {
return $props.modelValue; return $props.modelValue;
@ -133,16 +129,11 @@ watch(modelValue, async (newValue) => {
onMounted(() => { onMounted(() => {
setOptions(options.value); setOptions(options.value);
if (useURL.value && $props.modelValue && !findKeyInOptions()) if ($props.url && $props.modelValue && !findKeyInOptions())
fetchFilter($props.modelValue); fetchFilter($props.modelValue);
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300); if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
}); });
const arrayDataKey =
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
const arrayData = useArrayData(arrayDataKey, { url: $props.url, searchUrl: false });
function findKeyInOptions() { function findKeyInOptions() {
if (!$props.options) return; if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length; return filter($props.modelValue, $props.options)?.length;
@ -177,7 +168,7 @@ function filter(val, options) {
} }
async function fetchFilter(val) { async function fetchFilter(val) {
if (!$props.url) return; if (!$props.url || !dataRef.value) return;
const { fields, include, sortBy, limit } = $props; const { fields, include, sortBy, limit } = $props;
const key = const key =
@ -199,11 +190,8 @@ async function fetchFilter(val) {
const fetchOptions = { where, include, limit }; const fetchOptions = { where, include, limit };
if (fields) fetchOptions.fields = fields; if (fields) fetchOptions.fields = fields;
if (sortBy) fetchOptions.order = sortBy; if (sortBy) fetchOptions.order = sortBy;
arrayData.reset(['skip', 'filter.skip', 'page']);
const { data } = await arrayData.applyFilter({ filter: fetchOptions }); return dataRef.value.fetch(fetchOptions);
setOptions(data);
return data;
} }
async function filterHandler(val, update) { async function filterHandler(val, update) {
@ -243,47 +231,20 @@ function nullishToTrue(value) {
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
async function onScroll({ to, direction, from, index }) {
const lastIndex = myOptions.value.length - 1;
if (from === 0 && index === 0) return;
if (!useURL.value && !$props.fetchRef) return;
if (direction === 'decrease') return;
if (to === lastIndex && arrayData.store.hasMoreData && !isLoading.value) {
isLoading.value = true;
await arrayData.loadMore();
setOptions(arrayData.store.data);
vnSelectRef.value.scrollTo(lastIndex);
isLoading.value = false;
}
}
defineExpose({ opts: myOptions }); defineExpose({ opts: myOptions });
function handleKeyDown(event) {
if (event.key === 'Tab') {
event.preventDefault();
const inputValue = vnSelectRef.value?.inputValue;
if (inputValue) {
const matchingOption = myOptions.value.find(
(option) =>
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
);
if (matchingOption) {
emit('update:modelValue', matchingOption[optionValue.value]);
} else {
emit('update:modelValue', inputValue);
}
vnSelectRef.value?.hidePopup();
}
}
}
</script> </script>
<template> <template>
<FetchData
ref="dataRef"
:url="$props.url"
@on-fetch="(data) => setOptions(data)"
:where="where || { [optionValue]: value }"
:limit="limit"
:sort-by="sortBy"
:fields="fields"
:params="params"
/>
<QSelect <QSelect
v-model="value" v-model="value"
:options="myOptions" :options="myOptions"
@ -291,7 +252,6 @@ function handleKeyDown(event) {
:option-value="optionValue" :option-value="optionValue"
v-bind="$attrs" v-bind="$attrs"
@filter="filterHandler" @filter="filterHandler"
@keydown="handleKeyDown"
:emit-value="nullishToTrue($attrs['emit-value'])" :emit-value="nullishToTrue($attrs['emit-value'])"
:map-options="nullishToTrue($attrs['map-options'])" :map-options="nullishToTrue($attrs['map-options'])"
:use-input="nullishToTrue($attrs['use-input'])" :use-input="nullishToTrue($attrs['use-input'])"
@ -303,14 +263,10 @@ function handleKeyDown(event) {
:rules="mixinRules" :rules="mixinRules"
virtual-scroll-slice-size="options.length" virtual-scroll-slice-size="options.length"
hide-bottom-space hide-bottom-space
:input-debounce="useURL ? '300' : '0'"
:loading="isLoading"
@virtual-scroll="onScroll"
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
> >
<template #append> <template v-if="isClearable" #append>
<QIcon <QIcon
v-show="isClearable && value" v-show="value"
name="close" name="close"
@click.stop=" @click.stop="
() => { () => {
@ -323,22 +279,7 @@ function handleKeyDown(event) {
/> />
</template> </template>
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName"> <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<div v-if="slotName == 'append'"> <slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
<QIcon
v-show="isClearable && value"
name="close"
@click.stop="
() => {
value = null;
emit('remove');
}
"
class="cursor-pointer"
size="xs"
/>
<slot name="append" v-if="$slots.append" v-bind="slotData ?? {}" />
</div>
<slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template> </template>
</QSelect> </QSelect>
</template> </template>

View File

@ -43,7 +43,6 @@ const isAllowedToCreate = computed(() => {
> >
<template v-if="isAllowedToCreate" #append> <template v-if="isAllowedToCreate" #append>
<QIcon <QIcon
:data-cy="$attrs.dataCy ?? $attrs.label + '_icon'"
@click.stop.prevent="$refs.dialog.show()" @click.stop.prevent="$refs.dialog.show()"
:name="actionIcon" :name="actionIcon"
:size="actionIcon === 'add' ? 'xs' : 'sm'" :size="actionIcon === 'add' ? 'xs' : 'sm'"

View File

@ -86,7 +86,7 @@ async function send() {
</script> </script>
<template> <template>
<QDialog ref="dialogRef" data-cy="vnSmsDialog"> <QDialog ref="dialogRef">
<QCard class="q-pa-sm"> <QCard class="q-pa-sm">
<QCardSection class="row items-center q-pb-none"> <QCardSection class="row items-center q-pb-none">
<span class="text-h6 text-grey"> <span class="text-h6 text-grey">
@ -161,7 +161,6 @@ async function send() {
:loading="isLoading" :loading="isLoading"
color="primary" color="primary"
unelevated unelevated
data-cy="sendSmsBtn"
/> />
</QCardActions> </QCardActions>
</QCard> </QCard>

View File

@ -83,7 +83,7 @@ async function fetch() {
<slot name="header" :entity="entity" dense> <slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" /> <VnLv :label="`${entity.id} -`" :value="entity.name" />
</slot> </slot>
<slot name="header-right" :entity="entity"> <slot name="header-right">
<span></span> <span></span>
</slot> </slot>
</div> </div>

View File

@ -6,7 +6,7 @@ import { useColor } from 'src/composables/useColor';
import { getCssVar } from 'quasar'; import { getCssVar } from 'quasar';
const $props = defineProps({ const $props = defineProps({
workerId: { type: [Number, undefined], default: null }, workerId: { type: Number, required: true },
description: { type: String, default: null }, description: { type: String, default: null },
title: { type: String, default: null }, title: { type: String, default: null },
color: { type: String, default: null }, color: { type: String, default: null },
@ -38,13 +38,7 @@ watch(src, () => (showLetter.value = false));
<template v-if="showLetter"> <template v-if="showLetter">
{{ title.charAt(0) }} {{ title.charAt(0) }}
</template> </template>
<QImg <QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
v-else-if="workerId"
:src="src"
spinner-color="white"
@error="showLetter = true"
/>
<QIcon v-else name="mood" size="xs" />
</QAvatar> </QAvatar>
<div class="description"> <div class="description">
<slot name="description" v-if="description"> <slot name="description" v-if="description">

View File

@ -5,7 +5,13 @@ import { useArrayData } from 'composables/useArrayData';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import toDate from 'filters/toDate'; import toDate from 'filters/toDate';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue'; import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import { inject } from 'vue';
const bus = inject('bus'); // inside setup()
console.log('bus: ', bus);
bus.on('some-event', (arg1, arg2, arg3) => {
console.log('REMOVED');
});
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {
@ -37,7 +43,7 @@ const $props = defineProps({
}, },
hiddenTags: { hiddenTags: {
type: Array, type: Array,
default: () => ['filter', 'or', 'and'], default: () => ['filter', 'search', 'or', 'and'],
}, },
customTags: { customTags: {
type: Array, type: Array,
@ -49,7 +55,7 @@ const $props = defineProps({
}, },
searchUrl: { searchUrl: {
type: String, type: String,
default: 'table', default: 'params',
}, },
redirect: { redirect: {
type: Boolean, type: Boolean,
@ -61,6 +67,7 @@ const emit = defineEmits([
'update:modelValue', 'update:modelValue',
'refresh', 'refresh',
'clear', 'clear',
'search',
'init', 'init',
'remove', 'remove',
'setUserParams', 'setUserParams',
@ -74,9 +81,6 @@ 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 });
@ -200,7 +204,7 @@ const customTags = computed(() =>
async function remove(key) { async function remove(key) {
userParams.value[key] = undefined; userParams.value[key] = undefined;
await search(); search();
emit('remove', key); emit('remove', key);
emit('update:modelValue', userParams.value); emit('update:modelValue', userParams.value);
} }
@ -226,6 +230,8 @@ function sanitizer(params) {
} }
return params; return params;
} }
defineExpose({ search, sanitizer, userParams });
</script> </script>
<template> <template>
@ -273,7 +279,6 @@ function sanitizer(params) {
:key="chip.label" :key="chip.label"
:removable="!unremovableParams?.includes(chip.label)" :removable="!unremovableParams?.includes(chip.label)"
@remove="remove(chip.label)" @remove="remove(chip.label)"
data-cy="vnFilterPanelChip"
> >
<slot name="tags" :tag="chip" :format-fn="formatValue"> <slot name="tags" :tag="chip" :format-fn="formatValue">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -295,7 +300,12 @@ function sanitizer(params) {
<QSeparator /> <QSeparator />
</QList> </QList>
<QList dense class="list q-gutter-y-sm q-mt-sm"> <QList dense class="list q-gutter-y-sm q-mt-sm">
<slot name="body" :params="sanitizer(userParams)" :search-fn="search"></slot> <slot
name="body"
:params="sanitizer(userParams)"
:search-fn="search"
@remove="(key) => console.log('ASD')"
></slot>
</QList> </QList>
</QForm> </QForm>
<QInnerLoading <QInnerLoading

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue'; import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { parsePhone } from 'src/filters';
const props = defineProps({ const props = defineProps({
phoneNumber: { type: [String, Number], default: null }, phoneNumber: { type: [String, Number], default: null },
channel: { type: Number, default: null }, channel: { type: Number, default: null },
@ -25,9 +24,9 @@ onBeforeMount(async () => {
.data; .data;
if (!channel) channel = defaultChannel; if (!channel) channel = defaultChannel;
config[type].href = `${url}?customerIdentity=%2B${parsePhone( config[
props.phoneNumber type
)}&channelId=${channel}`; ].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`;
} }
}); });
</script> </script>

View File

@ -65,9 +65,13 @@ onBeforeRouteLeave((to, from, next) => {
auto-load auto-load
@on-fetch="(data) => (observationTypes = data)" @on-fetch="(data) => (observationTypes = data)"
/> />
<QCard class="q-pa-xs q-mb-lg full-width" v-if="$props.addNote"> <QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
<QCardSection horizontal> <QCardSection horizontal>
{{ t('New note') }} <VnAvatar :worker-id="currentUser.id" size="md" />
<div class="full-width row justify-between q-pa-xs">
<VnUserLink :name="t('New note')" :worker-id="currentUser.id" />
{{ t('globals.now') }}
</div>
</QCardSection> </QCardSection>
<QCardSection class="q-px-xs q-my-none q-py-none"> <QCardSection class="q-px-xs q-my-none q-py-none">
<VnRow class="full-width"> <VnRow class="full-width">
@ -101,7 +105,6 @@ onBeforeRouteLeave((to, from, next) => {
@click="insert" @click="insert"
class="q-mb-xs" class="q-mb-xs"
dense dense
data-cy="saveNote"
/> />
</template> </template>
</VnInput> </VnInput>
@ -141,7 +144,7 @@ onBeforeRouteLeave((to, from, next) => {
<div class="full-width row justify-between q-pa-xs"> <div class="full-width row justify-between q-pa-xs">
<div> <div>
<VnUserLink <VnUserLink
:name="`${note.worker.user.name}`" :name="`${note.worker.user.nickname}`"
:worker-id="note.worker.id" :worker-id="note.worker.id"
/> />
<QBadge <QBadge

View File

@ -44,7 +44,7 @@ const props = defineProps({
}, },
limit: { limit: {
type: Number, type: Number,
default: 20, default: 10,
}, },
userParams: { userParams: {
type: Object, type: Object,
@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
const store = arrayData.store; const store = arrayData.store;
onMounted(async () => { onMounted(async () => {
if (props.autoLoad && !store.data?.length) await fetch(); if (props.autoLoad) await fetch();
mounted.value = true; mounted.value = true;
}); });
@ -115,11 +115,7 @@ watch(
watch( watch(
() => store.data, () => store.data,
(data) => { (data) => emit('onChange', data)
if (!mounted.value) return;
emit('onChange', data);
},
{ immediate: true }
); );
watch( watch(
@ -132,24 +128,10 @@ 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', 'page']); arrayData.reset(['filter.skip', 'skip']);
await arrayData.fetch({ append: false, updateRouter: mounted.value });
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 }); await arrayData.fetch({ append: false });
store.limit = limit;
store.skip = skip;
return emitStoreData();
}
function emitStoreData() {
if (!store.hasMoreData) isLoading.value = false; if (!store.hasMoreData) isLoading.value = false;
emit('onFetch', store.data); emit('onFetch', store.data);
return store.data; return store.data;
} }
@ -195,7 +177,7 @@ async function onLoad(index, done) {
done(isDone); done(isDone);
} }
defineExpose({ fetch, update, addFilter, paginate }); defineExpose({ fetch, addFilter, paginate });
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="vn-row q-gutter-md"> <div class="vn-row q-gutter-md q-mb-md">
<slot /> <slot />
</div> </div>
</template> </template>
@ -18,9 +18,6 @@
&:not(.wrap) { &:not(.wrap) {
flex-direction: column; flex-direction: column;
} }
&[fixed] {
flex-direction: row;
}
} }
} }
</style> </style>

View File

@ -45,7 +45,7 @@ const props = defineProps({
}, },
limit: { limit: {
type: Number, type: Number,
default: 20, default: 10,
}, },
userParams: { userParams: {
type: Object, type: Object,
@ -130,7 +130,6 @@ async function search() {
dense dense
standout standout
autofocus autofocus
data-cy="vnSearchBar"
> >
<template #prepend> <template #prepend>
<QIcon <QIcon

View File

@ -1,5 +1,6 @@
<script setup> <script setup>
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { defineProps } from 'vue';
const props = defineProps({ const props = defineProps({
routeName: { routeName: {

View File

@ -1,24 +1,11 @@
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) {
const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); let appUrl = await getUrl('', 'lilium');
const response = await axios.get( appUrl = appUrl.replace('/#/', '');
url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`, window.open(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);
} }

View File

@ -75,10 +75,18 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
limit: store.limit, limit: store.limit,
}; };
let exprFilter;
let userParams = { ...store.userParams }; let userParams = { ...store.userParams };
if (store?.exprBuilder) {
const where = buildFilter(userParams, (param, value) => {
const res = store.exprBuilder(param, value);
if (res) delete userParams[param];
return res;
});
exprFilter = where ? { where } : null;
}
Object.assign(filter, store.userFilter); Object.assign(filter, store.userFilter, exprFilter);
let where; let where;
if (filter?.where || store.filter?.where) if (filter?.where || store.filter?.where)
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
@ -87,29 +95,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const params = { filter }; const params = { filter };
Object.assign(params, userParams); Object.assign(params, userParams);
if (params.filter) params.filter.skip = store.skip; params.filter.skip = store.skip;
if (store?.order && typeof store?.order == 'string') store.order = [store.order]; if (store.order && 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;
store.currentFilter = JSON.parse(JSON.stringify(params));
delete store.currentFilter.filter.include;
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
let exprFilter;
if (store?.exprBuilder) {
exprFilter = buildFilter(params, (param, value) => {
if (param == 'filter') return;
const res = store.exprBuilder(param, value);
if (res) delete params[param];
return res;
});
}
if (params.filter.where || exprFilter)
params.filter.where = { ...params.filter.where, ...exprFilter };
params.filter = JSON.stringify(params.filter); params.filter = JSON.stringify(params.filter);
store.currentFilter = params;
store.isLoading = true; store.isLoading = true;
const response = await axios.get(store.url, { const response = await axios.get(store.url, {
signal: canceller.signal, signal: canceller.signal,
@ -280,7 +271,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const pushUrl = { path: to }; const pushUrl = { path: to };
if (to.endsWith('/list') || to.endsWith('/')) if (to.endsWith('/list') || to.endsWith('/'))
pushUrl.query = newUrl.query; pushUrl.query = newUrl.query;
else destroy(); destroy();
return router.push(pushUrl); return router.push(pushUrl);
} }
} }

View File

@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
th, th,
td { td {
padding: 1px 10px 1px 10px; padding: 1px 10px 1px 10px;
max-width: 130px; max-width: 100px;
div span { div span {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;

View File

@ -1,21 +0,0 @@
export default function getDifferences(obj1, obj2) {
let diff = {};
delete obj1.$index;
delete obj2.$index;
for (let key in obj1) {
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
diff[key] = obj2[key];
}
}
for (let key in obj2) {
if (
obj1[key] === undefined ||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
) {
diff[key] = obj2[key];
}
}
return diff;
}

View File

@ -9,7 +9,7 @@ function parseJSON(str, fallback) {
} }
export default function (route, param) { export default function (route, param) {
// catch route query params // catch route query params
const params = parseJSON(route?.query?.table, {}); const params = parseJSON(route?.query?.params, {});
// extract and parse filter from params // extract and parse filter from params
const { filter: filterStr = '{}' } = params; const { filter: filterStr = '{}' } = params;

View File

@ -1,6 +0,0 @@
export default function getUpdatedValues(keys, formData) {
return keys.reduce((acc, key) => {
acc[key] = formData[key];
return acc;
}, {});
}

View File

@ -11,17 +11,11 @@ import dashIfEmpty from './dashIfEmpty';
import dateRange from './dateRange'; import dateRange from './dateRange';
import toHour from './toHour'; import toHour from './toHour';
import dashOrCurrency from './dashOrCurrency'; import dashOrCurrency from './dashOrCurrency';
import getDifferences from './getDifferences';
import getUpdatedValues from './getUpdatedValues';
import getParamWhere from './getParamWhere'; import getParamWhere from './getParamWhere';
import parsePhone from './parsePhone';
import isDialogOpened from './isDialogOpened'; import isDialogOpened from './isDialogOpened';
export { export {
getUpdatedValues,
getDifferences,
isDialogOpened, isDialogOpened,
parsePhone,
toLowerCase, toLowerCase,
toLowerCamel, toLowerCamel,
toDate, toDate,

View File

@ -1,12 +0,0 @@
export default function (phone, prefix = 34) {
if (phone.startsWith('+')) {
return `${phone.slice(1)}`;
}
if (phone.startsWith('00')) {
return `${phone.slice(2)}`;
}
if (phone.startsWith(prefix) && phone.length === prefix.length + 9) {
return `${prefix}${phone.slice(prefix.length)}`;
}
return `${prefix}${phone}`;
}

View File

@ -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,7 +298,6 @@ 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
@ -507,7 +506,6 @@ invoiceOut:
invoiceWithFutureDate: Exists an invoice with a future date invoiceWithFutureDate: Exists an invoice with a future date
noTicketsToInvoice: There are not tickets to invoice noTicketsToInvoice: There are not tickets to invoice
criticalInvoiceError: 'Critical invoicing error, process stopped' criticalInvoiceError: 'Critical invoicing error, process stopped'
invalidSerialTypeForAll: The serial type must be global when invoicing all clients
table: table:
addressId: Address id addressId: Address id
streetAddress: Street streetAddress: Street
@ -585,15 +583,15 @@ worker:
role: Role role: Role
sipExtension: Extension sipExtension: Extension
locker: Locker locker: Locker
fiDueDate: FI due date fiDueDate: Fecha de caducidad del DNI
sex: Sex sex: Sexo
seniority: Seniority seniority: Antigüedad
fi: DNI/NIE/NIF fi: DNI/NIE/NIF
birth: Birth birth: Fecha de nacimiento
isFreelance: Freelance isFreelance: Autónomo
isSsDiscounted: Bonificación SS isSsDiscounted: Bonificación SS
hasMachineryAuthorized: Machinery authorized hasMachineryAuthorized: Autorizado para llevar maquinaria
isDisable: Disable isDisable: Trabajador desactivado
notificationsManager: notificationsManager:
activeNotifications: Active notifications activeNotifications: Active notifications
availableNotifications: Available notifications availableNotifications: Available notifications
@ -709,7 +707,7 @@ supplier:
supplierName: Supplier name supplierName: Supplier name
basicData: basicData:
workerFk: Responsible workerFk: Responsible
isReal: Verified isSerious: Verified
isActive: Active isActive: Active
isPayMethodChecked: PayMethod checked isPayMethodChecked: PayMethod checked
note: Notes note: Notes
@ -768,8 +766,7 @@ travel:
thermographs: Thermographs thermographs: Thermographs
hb: HB hb: HB
basicData: basicData:
daysInForward: Automatic movement (Raid) daysInForward: Days in forward
isRaid: Raid
thermographs: thermographs:
temperature: Temperature temperature: Temperature
destination: Destination destination: Destination
@ -860,7 +857,6 @@ components:
downloadFile: Download file downloadFile: Download file
openCard: View openCard: View
openSummary: Summary openSummary: Summary
viewSummary: Summary
cardDescriptor: cardDescriptor:
mainList: Main list mainList: Main list
summary: Summary summary: Summary

View File

@ -303,7 +303,6 @@ 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
@ -510,7 +509,6 @@ invoiceOut:
invoiceWithFutureDate: Existe una factura con una fecha futura invoiceWithFutureDate: Existe una factura con una fecha futura
noTicketsToInvoice: No existen tickets para facturar noTicketsToInvoice: No existen tickets para facturar
criticalInvoiceError: Error crítico en la facturación proceso detenido criticalInvoiceError: Error crítico en la facturación proceso detenido
invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes
table: table:
addressId: Id dirección addressId: Id dirección
streetAddress: Dirección fiscal streetAddress: Dirección fiscal
@ -581,9 +579,9 @@ worker:
newWorker: Nuevo trabajador newWorker: Nuevo trabajador
summary: summary:
boss: Jefe boss: Jefe
phoneExtension: Ext. de teléfono phoneExtension: Extensión de teléfono
entPhone: Tel. de empresa entPhone: Teléfono de empresa
personalPhone: Tel. personal personalPhone: Teléfono personal
noBoss: Sin jefe noBoss: Sin jefe
userData: Datos de usuario userData: Datos de usuario
userId: ID del usuario userId: ID del usuario
@ -704,7 +702,7 @@ supplier:
supplierName: Nombre del proveedor supplierName: Nombre del proveedor
basicData: basicData:
workerFk: Responsable workerFk: Responsable
isReal: Verificado isSerious: Verificado
isActive: Activo isActive: Activo
isPayMethodChecked: Método de pago validado isPayMethodChecked: Método de pago validado
note: Notas note: Notas
@ -762,8 +760,7 @@ travel:
thermographs: Termógrafos thermographs: Termógrafos
hb: HB hb: HB
basicData: basicData:
daysInForward: Desplazamiento automatico (redada) daysInForward: Días redada
isRaid: Redada
thermographs: thermographs:
temperature: Temperatura temperature: Temperatura
destination: Destino destination: Destino

View File

@ -11,13 +11,21 @@ const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
const onSynchronizeAll = async () => { const onSynchronizeAll = async () => {
notify(t('Synchronizing in the background'), 'positive'); try {
await axios.patch(`Accounts/syncAll`); notify(t('Synchronizing in the background'), 'positive');
await axios.patch(`Accounts/syncAll`);
} catch (error) {
console.error('Error synchronizing all accounts', error);
}
}; };
const onSynchronizeRoles = async () => { const onSynchronizeRoles = async () => {
await axios.patch(`RoleInherits/sync`); try {
notify(t('Roles synchronized!'), 'positive'); await axios.patch(`RoleInherits/sync`);
notify(t('Roles synchronized!'), 'positive');
} catch (error) {
console.error('Error synchronizing roles', error);
}
}; };
</script> </script>

View File

@ -111,25 +111,29 @@ const columns = computed(() => [
}, },
]); ]);
const deleteAcl = async ({ id }) => { const deleteAcl = async ({ id }) => {
await new Promise((resolve) => { try {
quasar await new Promise((resolve) => {
.dialog({ quasar
component: VnConfirm, .dialog({
componentProps: { component: VnConfirm,
title: t('Remove ACL'), componentProps: {
message: t('Do you want to remove this ACL?'), title: t('Remove ACL'),
}, message: t('Do you want to remove this ACL?'),
}) },
.onOk(() => { })
resolve(true); .onOk(() => {
}) resolve(true);
.onCancel(() => { })
resolve(false); .onCancel(() => {
}); resolve(false);
}); });
await axios.delete(`ACLs/${id}`); });
tableRef.value.reload(); await axios.delete(`ACLs/${id}`);
notify('ACL removed', 'positive'); tableRef.value.reload();
notify('ACL removed', 'positive');
} catch (error) {
console.error('Error deleting Acl: ', error);
}
}; };
</script> </script>

View File

@ -34,9 +34,13 @@ 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 }) => {
await axios.post(`${urlPath}/killSession`, { userId, created }); try {
paginateRef.value.fetch(); await axios.post(`${urlPath}/killSession`, { userId, created });
notify(t('Session killed'), 'positive'); paginateRef.value.fetch();
notify(t('Session killed'), 'positive');
} catch (error) {
console.error('Error killing session', error);
}
}; };
</script> </script>

View File

@ -40,8 +40,12 @@ 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 () => {
await axios.get(`LdapConfigs/test`); try {
notify(t('LDAP connection established!'), 'positive'); await axios.get(`LdapConfigs/test`);
notify(t('LDAP connection established!'), 'positive');
} catch (error) {
console.error('Error testing connection', error);
}
}; };
const getInitialLdapConfig = async () => { const getInitialLdapConfig = async () => {
try { try {
@ -68,10 +72,14 @@ const getInitialLdapConfig = async () => {
} }
}; };
const deleteMailForward = async () => { const deleteMailForward = async () => {
await axios.delete(URL_UPDATE); try {
initialData.value = { ...DEFAULT_DATA }; await axios.delete(URL_UPDATE);
hasData.value = false; initialData.value = { ...DEFAULT_DATA };
notify(t('globals.dataSaved'), 'positive'); hasData.value = false;
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error deleting mail forward', err);
}
}; };
onMounted(async () => await getInitialLdapConfig()); onMounted(async () => await getInitialLdapConfig());

View File

@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
data-key="AccountList" data-key="AccountUsers"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('account.search')" :label="t('account.search')"
:info="t('account.searchInfo')" :info="t('account.searchInfo')"
@ -112,12 +112,12 @@ const exprBuilder = (param, value) => {
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<AccountFilter data-key="AccountList" /> <AccountFilter data-key="AccountUsers" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountList" data-key="AccountUsers"
url="VnUsers/preview" url="VnUsers/preview"
:filter="filter" :filter="filter"
order="id DESC" order="id DESC"

View File

@ -46,8 +46,12 @@ const formUrlUpdate = ref(null);
const formCustomFn = ref(null); const formCustomFn = ref(null);
const onTestConection = async () => { const onTestConection = async () => {
await axios.get(`SambaConfigs/test`); try {
notify(t('Samba connection established!'), 'positive'); await axios.get(`SambaConfigs/test`);
notify(t('Samba connection established!'), 'positive');
} catch (error) {
console.error('Error testing connection', error);
}
}; };
const getInitialSambaConfig = async () => { const getInitialSambaConfig = async () => {
@ -75,10 +79,14 @@ const getInitialSambaConfig = async () => {
}; };
const deleteMailForward = async () => { const deleteMailForward = async () => {
await axios.delete(URL_UPDATE); try {
initialData.value = { ...DEFAULT_DATA }; await axios.delete(URL_UPDATE);
hasData.value = false; initialData.value = { ...DEFAULT_DATA };
notify(t('globals.dataSaved'), 'positive'); hasData.value = false;
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error deleting mail forward', err);
}
}; };
onMounted(async () => await getInitialSambaConfig()); onMounted(async () => await getInitialSambaConfig());

View File

@ -44,9 +44,13 @@ const removeAlias = () => {
cancel: true, cancel: true,
}) })
.onOk(async () => { .onOk(async () => {
await axios.delete(`MailAliases/${entityId.value}`); try {
notify(t('Alias removed'), 'positive'); await axios.delete(`MailAliases/${entityId.value}`);
router.push({ name: 'AccountAlias' }); notify(t('Alias removed'), 'positive');
router.push({ name: 'AccountAlias' });
} catch (err) {
console.error('Error removing alias');
}
}); });
}; };
</script> </script>

View File

@ -44,23 +44,32 @@ const fetchMailForwards = async () => {
try { 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 { } catch (err) {
console.error('Error fetching mail forwards', err);
return null; return null;
} }
}; };
const deleteMailForward = async () => { const deleteMailForward = async () => {
await axios.delete(`MailForwards/${route.params.id}`); try {
formData.value.forwardTo = null; await axios.delete(`MailForwards/${route.params.id}`);
initialData.value.forwardTo = null; formData.value.forwardTo = null;
initialData.value.hasData = hasData.value; initialData.value.forwardTo = null;
notify(t('globals.dataSaved'), 'positive'); initialData.value.hasData = hasData.value;
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error deleting mail forward', err);
}
}; };
const updateMailForward = async () => { const updateMailForward = async () => {
await axios.patch('MailForwards', formData.value); try {
initialData.value = { ...formData.value }; await axios.patch('MailForwards', formData.value);
initialData.value.hasData = hasData.value; initialData.value = { ...formData.value };
initialData.value.hasData = hasData.value;
} catch (err) {
console.error('Error creating mail forward', err);
}
}; };
const onSubmit = async () => { const onSubmit = async () => {

View File

@ -82,14 +82,14 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
data-key="AccountRolesList" data-key="Roles"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('role.searchRoles')" :label="t('role.searchRoles')"
:info="t('role.searchInfo')" :info="t('role.searchInfo')"
/> />
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountRolesList" data-key="Roles"
:url="`VnRoles`" :url="`VnRoles`"
:create="{ :create="{
urlCreate: 'VnRoles', urlCreate: 'VnRoles',

View File

@ -9,7 +9,7 @@ const { t } = useI18n();
<VnCard <VnCard
data-key="Role" data-key="Role"
:descriptor="RoleDescriptor" :descriptor="RoleDescriptor"
search-data-key="AccountRolesList" search-data-key="AccountRoles"
:searchbar-props="{ :searchbar-props="{
url: 'VnRoles', url: 'VnRoles',
label: t('role.searchRoles'), label: t('role.searchRoles'),

View File

@ -32,8 +32,12 @@ const filter = {
where: { id: entityId }, where: { id: entityId },
}; };
const removeRole = async () => { const removeRole = async () => {
await axios.delete(`VnRoles/${entityId.value}`); try {
notify(t('Role removed'), 'positive'); await axios.delete(`VnRoles/${entityId.value}`);
notify(t('Role removed'), 'positive');
} catch (error) {
console.error('Error deleting role', error);
}
}; };
</script> </script>

View File

@ -100,7 +100,7 @@ async function remove() {
</QMenu> </QMenu>
</QItem> </QItem>
<QSeparator /> <QSeparator />
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim"> <QItem @click="confirmRemove()" v-ripple clickable>
<QItemSection avatar> <QItemSection avatar>
<QIcon name="delete" /> <QIcon name="delete" />
</QItemSection> </QItemSection>

View File

@ -130,7 +130,7 @@ function cancel() {
<template #body-cell-description="{ row, value }"> <template #body-cell-description="{ row, value }">
<QTd auto-width align="right" class="link"> <QTd auto-width align="right" class="link">
{{ value }} {{ value }}
<ItemDescriptorProxy :id="row.itemFk" /> <ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
</QTd> </QTd>
</template> </template>
</QTable> </QTable>

View File

@ -25,7 +25,7 @@ const claimFilter = computed(() => {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['id', 'nickname', 'name'], fields: ['id', 'nickname'],
}, },
}, },
}, },

View File

@ -23,7 +23,7 @@ defineExpose({ states });
<template> <template>
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -95,7 +95,6 @@ const columns = computed(() => [
optionLabel: 'description', optionLabel: 'description',
}, },
}, },
orderBy: 'priority',
}, },
{ {
align: 'right', align: 'right',

View File

@ -2,7 +2,6 @@
import { onBeforeMount, ref, watch } from 'vue'; import { onBeforeMount, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import axios from 'axios'; import axios from 'axios';
@ -53,6 +52,7 @@ const addressFilter = {
onBeforeMount(() => { onBeforeMount(() => {
const { id } = route.params; const { id } = route.params;
getAddressesData(id);
getClientData(id); getClientData(id);
}); });
@ -60,10 +60,23 @@ watch(
() => route.params.id, () => route.params.id,
(newValue) => { (newValue) => {
if (!newValue) return; if (!newValue) return;
getAddressesData(newValue);
getClientData(newValue); getClientData(newValue);
} }
); );
const getAddressesData = async (id) => {
try {
const { data } = await axios.get(`Clients/${id}/addresses`, {
params: { filter: JSON.stringify(addressFilter) },
});
addresses.value = data;
sortAddresses();
} catch (error) {
return error;
}
};
const getClientData = async (id) => { const getClientData = async (id) => {
try { try {
const { data } = await axios.get(`Clients/${id}`); const { data } = await axios.get(`Clients/${id}`);
@ -88,9 +101,9 @@ const setDefault = (address) => {
}); });
}; };
const sortAddresses = (data) => { const sortAddresses = () => {
if (!client.value || !data) return; if (!client.value || !addresses.value) return;
addresses.value = data.sort((a, b) => { addresses.value = addresses.value.sort((a, b) => {
return isDefaultAddress(b) - isDefaultAddress(a); return isDefaultAddress(b) - isDefaultAddress(a);
}); });
}; };
@ -111,17 +124,8 @@ const toCustomerAddressEdit = (addressId) => {
</script> </script>
<template> <template>
<FetchData
@on-fetch="sortAddresses"
auto-load
data-key="CustomerAddresses"
order="id DESC"
ref="vnPaginateRef"
:filter="addressFilter"
:url="`Clients/${route.params.id}/addresses`"
/>
<div class="full-width flex justify-center"> <div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg"> <QCard class="card-width q-pa-lg" v-if="addresses.length">
<QCardSection> <QCardSection>
<div <div
v-for="(item, index) in addresses" v-for="(item, index) in addresses"
@ -163,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 }}

View File

@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
{{ toCurrency(balances[rowIndex]?.balance) }} {{ toCurrency(balances[rowIndex]?.balance) }}
</template> </template>
<template #column-description="{ row }"> <template #column-description="{ row }">
<span class="link" v-if="row.isInvoice" @click.stop> <div class="link" v-if="row.isInvoice">
{{ t('bill', { ref: row.description }) }} {{ t('bill', { ref: row.description }) }}
<InvoiceOutDescriptorProxy :id="row.id" /> <InvoiceOutDescriptorProxy :id="row.description" />
</span> </div>
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description"> <span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
{{ row.description }} {{ row.description }}
</span> </span>

View File

@ -9,7 +9,6 @@ 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 VnAvatar from 'src/components/ui/VnAvatar.vue'; import VnAvatar from 'src/components/ui/VnAvatar.vue';
import { getDifferences, getUpdatedValues } from 'src/filters';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -31,13 +30,6 @@ const exprBuilder = (param, value) => {
and: [{ active: { neq: false } }, handleSalesModelValue(value)], and: [{ active: { neq: false } }, handleSalesModelValue(value)],
}; };
}; };
function onBeforeSave(formData, originalData) {
return getUpdatedValues(
Object.keys(getDifferences(formData, originalData)),
formData
);
}
</script> </script>
<template> <template>
<FetchData <FetchData
@ -51,12 +43,7 @@ function onBeforeSave(formData, originalData) {
@on-fetch="(data) => (businessTypes = data)" @on-fetch="(data) => (businessTypes = data)"
auto-load auto-load
/> />
<FormModel <FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
:url="`Clients/${route.params.id}`"
auto-load
model="customer"
:mapper="onBeforeSave"
>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
@ -107,7 +94,6 @@ function onBeforeSave(formData, originalData) {
:rules="validate('client.phone')" :rules="validate('client.phone')"
clearable clearable
v-model="data.phone" v-model="data.phone"
data-cy="customerPhone"
/> />
<VnInput <VnInput
:label="t('customer.summary.mobile')" :label="t('customer.summary.mobile')"
@ -169,6 +155,7 @@ function onBeforeSave(formData, originalData) {
url="Clients" url="Clients"
:input-debounce="0" :input-debounce="0"
:label="t('customer.basicData.previousClient')" :label="t('customer.basicData.previousClient')"
:options="clients"
:rules="validate('client.transferorFk')" :rules="validate('client.transferorFk')"
emit-value emit-value
map-options map-options

View File

@ -28,7 +28,12 @@ const getBankEntities = (data, formData) => {
</script> </script>
<template> <template>
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="customer"> <FormModel
:url-update="`Clients/${route.params.id}`"
:url="`Clients/${route.params.id}/getCard`"
auto-load
model="customer"
>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnSelect <VnSelect

View File

@ -93,6 +93,22 @@ const columns = computed(() => [
<WorkerDescriptorProxy :id="row.worker.id" /> <WorkerDescriptorProxy :id="row.worker.id" />
</template> </template>
</VnTable> </VnTable>
<!-- <QTable
:columns="columns"
:pagination="{ rowsPerPage: 0 }"
:rows="rows"
hide-bottom
row-key="id"
v-model:selected="selected"
class="card-width q-px-lg"
>
<template #body-cell-employee="{ row }">
<QTd @click.stop>
<span class="link">{{ row.worker.user.nickname }}</span>
<WorkerDescriptorProxy :id="row.clientFk" />
</QTd>
</template>
</QTable> -->
</template> </template>
<i18n> <i18n>

View File

@ -36,13 +36,7 @@ const entityId = computed(() => {
}); });
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
data.value = useCardDescription(entity?.name, entity?.id);
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
};
const debtWarning = computed(() => {
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
});
</script> </script>
<template> <template>
@ -123,7 +117,7 @@ const debtWarning = computed(() => {
v-if="customer.debt > customer.credit" v-if="customer.debt > customer.credit"
name="vn:risk" name="vn:risk"
size="xs" size="xs"
:color="debtWarning" color="primary"
> >
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip> <QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
</QIcon> </QIcon>

View File

@ -34,6 +34,7 @@ function handleLocation(data, location) {
/> />
<FormModel <FormModel
:url-update="`Clients/${route.params.id}/updateFiscalData`" :url-update="`Clients/${route.params.id}/updateFiscalData`"
:url="`Clients/${route.params.id}/getCard`"
auto-load auto-load
model="customer" model="customer"
> >

View File

@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters'; import { toCurrency, toPercentage, toDate } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
@ -27,16 +27,21 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const customer = computed(() => summary.value.entity); const customer = computed(() => summary.value.entity);
const summary = ref(); const summary = ref();
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount); const clientUrl = ref();
const balanceDue = computed(() => {
const amount = defaulterAmount.value; onMounted(async () => {
if (!amount || amount < 0) { clientUrl.value = (await getUrl('client/')) + entityId.value + '/';
return null;
}
return amount;
}); });
const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : '')); const balanceDue = computed(() => {
return (
customer.value &&
customer.value.defaulters.length &&
customer.value.defaulters[0].amount
);
});
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
const claimRate = computed(() => { const claimRate = computed(() => {
return customer.value.claimsRatio?.claimingRate ?? 0; return customer.value.claimsRatio?.claimingRate ?? 0;
@ -300,7 +305,7 @@ const sumRisk = ({ clientRisks }) => {
<VnLv <VnLv
v-if="entity.defaulters" v-if="entity.defaulters"
:label="t('customer.summary.balanceDue')" :label="t('customer.summary.balanceDue')"
:value="dashOrCurrency(balanceDue)()" :value="toCurrency(balanceDue)"
:class="balanceDueWarning" :class="balanceDueWarning"
:info="t('customer.summary.balanceDueInfo')" :info="t('customer.summary.balanceDueInfo')"
/> />
@ -320,7 +325,7 @@ const sumRisk = ({ clientRisks }) => {
:value="entity.recommendedCredit" :value="entity.recommendedCredit"
/> />
</QCard> </QCard>
<QCard class="vn-max"> <QCard class="vn-one">
<VnTitle :text="t('Latest tickets')" /> <VnTitle :text="t('Latest tickets')" />
<CustomerSummaryTable /> <CustomerSummaryTable />
</QCard> </QCard>

View File

@ -1,82 +1,164 @@
<script setup> <script setup>
import { ref } from 'vue'; import { computed, onBeforeMount, ref, watch, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import FormModel from 'components/FormModel.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
const formModelRef = ref(false); import axios from 'axios';
import useNotify from 'src/composables/useNotify';
import { useStateStore } from 'stores/useStateStore';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const { notify } = useNotify();
const stateStore = useStateStore();
const amountInputRef = ref(null); const amountInputRef = ref(null);
const initialDated = Date.vnNew();
const unpaidClient = ref(false);
const isLoading = ref(false);
const amount = ref(null);
const dated = ref(initialDated);
const initialData = ref({ const initialData = ref({
dated: Date.vnNew(), dated: initialDated,
amount: null,
}); });
const filterClientFindOne = { const hasChanged = computed(() => {
fields: ['unpaid', 'dated', 'amount'], return (
where: { initialData.value.dated !== dated.value ||
clientFk: route.params.id, initialData.value.amount !== amount.value
}, );
});
onBeforeMount(() => {
getData(route.params.id);
});
watch(
() => route.params.id,
(newValue) => {
if (!newValue) return;
getData(newValue);
}
);
const getData = async (id) => {
const filter = { where: { clientFk: id } };
try {
const { data } = await axios.get('ClientUnpaids', {
params: { filter: JSON.stringify(filter) },
});
if (data.length) {
setValues(data[0]);
} else {
defaultValues();
}
} catch (error) {
defaultValues();
}
}; };
const setValues = (data) => {
unpaidClient.value = true;
amount.value = data.amount;
dated.value = data.dated;
initialData.value = data;
};
const defaultValues = () => {
unpaidClient.value = false;
initialData.value.amount = null;
setInitialData();
};
const setInitialData = () => {
amount.value = initialData.value.amount;
dated.value = initialData.value.dated;
};
const onSubmit = async () => {
isLoading.value = true;
const payload = {
amount: amount.value,
clientFk: route.params.id,
dated: dated.value,
};
try {
await axios.patch('ClientUnpaids', payload);
notify('globals.dataSaved', 'positive');
unpaidClient.value = true;
} catch (error) {
notify('errors.writeRequest', 'negative');
} finally {
isLoading.value = false;
}
};
watch(
() => unpaidClient.value,
async (val) => {
await nextTick();
if (val) amountInputRef.value.focus();
}
);
</script> </script>
<template> <template>
<FetchData <Teleport v-if="stateStore?.isSubToolbarShown()" to="#st-actions">
:filter="filterClientFindOne" <QBtnGroup push class="q-gutter-x-sm">
auto-load <QBtn
url="ClientUnpaids" :disabled="!hasChanged"
@on-fetch=" :label="t('globals.reset')"
(data) => { :loading="isLoading"
const unpaid = data.length == 1; @click="setInitialData"
initialData = { ...data[0], unpaid }; color="primary"
} flat
" icon="restart_alt"
/> type="reset"
<QCard> />
<FormModel <QBtn
v-if="'unpaid' in initialData" :disabled="!hasChanged"
:observe-form-changes="false" :label="t('globals.save')"
ref="formModelRef" :loading="isLoading"
model="unpaid" @click="onSubmit"
url-update="ClientUnpaids" color="primary"
:mapper="(formData) => ({ ...formData, clientFk: route.params.id })" icon="save"
:form-initial-data="initialData" />
> </QBtnGroup>
<template #form="{ data }"> </Teleport>
<div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg">
<QForm>
<VnRow> <VnRow>
<QCheckbox :label="t('Unpaid client')" v-model="data.unpaid" /> <div class="col">
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
</div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid"> <VnRow class="row q-gutter-md q-mb-md" v-show="unpaidClient">
<div class="col"> <div class="col">
<VnInputDate <VnInputDate :label="t('Date')" v-model="dated" />
data-cy="customerUnpaidDate"
:label="t('Date')"
v-model="data.dated"
/>
</div> </div>
<div class="col"> <div class="col">
<VnInputNumber <VnInput
data-cy="customerUnpaidAmount"
ref="amountInputRef" ref="amountInputRef"
:label="t('Amount')" :label="t('Amount')"
clearable clearable
v-model="data.amount" type="number"
v-model="amount"
autofocus autofocus
> >
<template #append></template></VnInputNumber <template #append></template></VnInput
> >
</div> </div>
</VnRow> </VnRow>
</template> </QForm>
</FormModel> </QCard>
</QCard> </div>
</template> </template>
<i18n> <i18n>

View File

@ -25,9 +25,10 @@ async function hasCustomerRole() {
</script> </script>
<template> <template>
<FormModel <FormModel
url="VnUsers/preview"
:url-update="`Clients/${route.params.id}/updateUser`" :url-update="`Clients/${route.params.id}/updateUser`"
:filter="filter" :filter="filter"
model="customer" model="webAccess"
:mapper=" :mapper="
({ active, name, email }) => { ({ active, name, email }) => {
return { return {
@ -41,7 +42,7 @@ async function hasCustomerRole() {
auto-load auto-load
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<QCheckbox :label="t('Enable web access')" v-model="data.account.active" /> <QCheckbox :label="t('Enable web access')" v-model="data.active" />
<VnInput :label="t('User')" clearable v-model="data.name" /> <VnInput :label="t('User')" clearable v-model="data.name" />
<VnInput <VnInput
:label="t('Recovery email')" :label="t('Recovery email')"

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, onBeforeMount, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'src/components/FetchData.vue'; import axios from 'axios';
import { toCurrency, toDateHourMin } from 'src/filters'; import { toCurrency, toDateHourMin } from 'src/filters';
@ -20,11 +20,10 @@ const filter = {
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } }, { relation: 'mandateType', scope: { fields: ['id', 'name'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } }, { relation: 'company', scope: { fields: ['id', 'code'] } },
], ],
where: { clientFk: route.params.id }, where: { clientFk: null },
order: ['created DESC'], order: ['created DESC'],
limit: 20, limit: 20,
}; };
const ClientDmsRef = ref(false);
const tableColumnComponents = { const tableColumnComponents = {
state: { state: {
@ -51,7 +50,7 @@ const tableColumnComponents = {
component: CustomerCheckIconTooltip, component: CustomerCheckIconTooltip,
props: ({ row }) => ({ props: ({ row }) => ({
transaction: row, transaction: row,
promise: () => ClientDmsRef.value.fetch(), promise: refreshData,
}), }),
event: () => {}, event: () => {},
}, },
@ -90,45 +89,72 @@ const columns = computed(() => [
name: 'validate', name: 'validate',
}, },
]); ]);
onBeforeMount(() => {
getData(route.params.id);
});
watch(
() => route.params.id,
(newValue) => {
if (!newValue) return;
getData(newValue);
}
);
const getData = async (id) => {
filter.where.clientFk = id;
try {
const { data } = await axios.get('clients/transactions', {
params: { filter: JSON.stringify(filter) },
});
rows.value = data;
} catch (error) {
return error;
}
};
const refreshData = () => {
getData(route.params.id);
};
</script> </script>
<template> <template>
<FetchData <div class="full-width flex justify-center">
ref="ClientDmsRef" <QPage class="card-width q-pa-lg">
:filter="filter" <QTable
@on-fetch="(data) => (rows = data)" :columns="columns"
auto-load :pagination="{ rowsPerPage: 12 }"
url="Clients/transactions" :rows="rows"
/> class="full-width q-mt-md"
<QPage class="card-width q-pa-lg"> row-key="id"
<QTable v-if="rows?.length"
:columns="columns" >
:pagination="{ rowsPerPage: 12 }" <template #body-cell="props">
:rows="rows" <QTd :props="props">
class="full-width q-mt-md" <QTr :props="props">
row-key="id" <component
v-if="rows?.length" :is="tableColumnComponents[props.col.name].component"
> @click="
<template #body-cell="props"> tableColumnComponents[props.col.name].event(props)
<QTd :props="props"> "
<QTr :props="props"> class="rounded-borders q-pa-sm"
<component v-bind="
:is="tableColumnComponents[props.col.name].component" tableColumnComponents[props.col.name].props(props)
@click="tableColumnComponents[props.col.name].event(props)" "
class="rounded-borders q-pa-sm" >
v-bind="tableColumnComponents[props.col.name].props(props)" {{ props.value }}
> </component>
{{ props.value }} </QTr>
</component> </QTd>
</QTr> </template>
</QTd> </QTable>
</template>
</QTable>
<h5 class="flex justify-center color-vn-label" v-else> <h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }} {{ t('globals.noResults') }}
</h5> </h5>
</QPage> </QPage>
</div>
</template> </template>
<i18n> <i18n>

View File

@ -11,24 +11,10 @@ defineProps({
required: true, required: true,
}, },
}); });
const handleSalesModelValue = (val) => ({
or: [
{ id: val },
{ name: val },
{ nickname: { like: '%' + val + '%' } },
{ code: { like: `${val}%` } },
],
});
const exprBuilder = (param, value) => {
return {
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
};
};
</script> </script>
<template> <template>
<VnFilterPanel :data-key="dataKey" :search-button="true"> <VnFilterPanel :data-key="dataKey" :search-button="true" search-url="table">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>
@ -66,18 +52,14 @@ const exprBuilder = (param, value) => {
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
url="Workers/search" url="Workers/activeWithInheritedRole"
:params="{ :filter="{ where: { role: 'salesPerson' } }"
departmentCodes: ['VT'],
}"
auto-load auto-load
:label="t('Salesperson')" :label="t('Salesperson')"
:expr-builder="exprBuilder"
v-model="params.salesPersonFk" v-model="params.salesPersonFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
option-value="id" option-value="id"
option-label="name" option-label="name"
sort-by="nickname ASC"
emit-value emit-value
map-options map-options
use-input use-input
@ -86,23 +68,12 @@ const exprBuilder = (param, value) => {
outlined outlined
rounded rounded
:input-debounce="0" :input-debounce="0"
> />
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel caption>
{{ opt.nickname }},{{ opt.code }}
</QItemLabel>
</QItemSection>
</QItem>
</template></VnSelect
>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection
<VnSelect ><VnSelect
url="Provinces" url="Provinces"
:label="t('Province')" :label="t('Province')"
v-model="params.provinceFk" v-model="params.provinceFk"
@ -120,31 +91,32 @@ const exprBuilder = (param, value) => {
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-md">
<QItemSection> <QItemSection>
<VnInput :label="t('City')" v-model="params.city" is-outlined /> <VnInput :label="t('City')" v-model="params.city" is-outlined />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QSeparator />
<QItemSection> <QExpansionItem :label="t('More options')" expand-separator>
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined> <QItem>
<template #prepend> <QItemSection>
<QIcon name="phone" size="xs" /> <VnInput :label="t('Phone')" v-model="params.phone" is-outlined>
</template> <template #prepend>
</VnInput> <QIcon name="phone" size="xs" />
</QItemSection> </template>
</QItem> </VnInput>
<QItem class="q-mb-sm"> </QItemSection>
<QItemSection> </QItem>
<VnInput :label="t('Email')" v-model="params.email" is-outlined> <QItem>
<template #prepend> <QItemSection>
<QIcon name="email" size="sm" /> <VnInput :label="t('Email')" v-model="params.email" is-outlined>
</template> <template #prepend>
</VnInput> <QIcon name="email" size="sm" />
</QItemSection> </template>
</QItem> </VnInput>
<QItem class="q-mb-sm"> </QItemSection>
<QItemSection> </QItem>
<QItem>
<VnSelect <VnSelect
url="Zones" url="Zones"
:label="t('Zone')" :label="t('Zone')"
@ -159,17 +131,18 @@ const exprBuilder = (param, value) => {
outlined outlined
rounded rounded
auto-load auto-load
/></QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Postcode')"
v-model="params.postcode"
is-outlined
/> />
</QItemSection> </QItem>
</QItem> <QItem>
<QItemSection>
<VnInput
:label="t('Postcode')"
v-model="params.postcode"
is-outlined
/>
</QItemSection>
</QItem>
</QExpansionItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
@ -201,6 +174,7 @@ es:
Salesperson: Comercial Salesperson: Comercial
Province: Provincia Province: Provincia
City: Ciudad City: Ciudad
More options: Más opciones
Phone: Teléfono Phone: Teléfono
Email: Email Email: Email
Zone: Zona Zone: Zona

View File

@ -12,7 +12,6 @@ import RightMenu from 'src/components/common/RightMenu.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import CustomerFilter from './CustomerFilter.vue'; import CustomerFilter from './CustomerFilter.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
@ -395,16 +394,16 @@ function handleLocation(data, location) {
<VnSearchbar <VnSearchbar
:info="t('You can search by customer id or name')" :info="t('You can search by customer id or name')"
:label="t('Search customer')" :label="t('Search customer')"
data-key="CustomerList" data-key="Customer"
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<CustomerFilter data-key="CustomerList" /> <CustomerFilter data-key="Customer" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="CustomerList" data-key="Customer"
url="Clients/filter" url="Clients/filter"
:create="{ :create="{
urlCreate: 'Clients/createWithUser', urlCreate: 'Clients/createWithUser',

View File

@ -1,8 +1,9 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { onBeforeMount, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
import VnLocation from 'src/components/common/VnLocation.vue'; import VnLocation from 'src/components/common/VnLocation.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
@ -24,6 +25,20 @@ const agencyModes = ref([]);
const incoterms = ref([]); const incoterms = ref([]);
const customsAgents = ref([]); const customsAgents = ref([]);
onBeforeMount(() => {
urlCreate.value = `Clients/${route.params.id}/createAddress`;
getCustomsAgents();
});
const getCustomsAgents = async () => {
const { data } = await axios.get('CustomsAgents');
customsAgents.value = data;
};
const refreshData = () => {
getCustomsAgents();
};
const toCustomerAddress = () => { const toCustomerAddress = () => {
router.push({ router.push({
name: 'CustomerAddress', name: 'CustomerAddress',
@ -39,11 +54,6 @@ function handleLocation(data, location) {
data.provinceFk = provinceFk; data.provinceFk = provinceFk;
data.countryFk = countryFk; data.countryFk = countryFk;
} }
function onAgentCreated(requestResponse, data) {
customsAgents.value.push(requestResponse);
data.customsAgentFk = requestResponse.id;
}
</script> </script>
<template> <template>
@ -129,7 +139,6 @@ function onAgentCreated(requestResponse, data) {
/> />
<VnSelectDialog <VnSelectDialog
url="CustomsAgents"
:label="t('Customs agent')" :label="t('Customs agent')"
:options="customsAgents" :options="customsAgents"
hide-selected hide-selected
@ -139,12 +148,7 @@ function onAgentCreated(requestResponse, data) {
:tooltip="t('Create a new expense')" :tooltip="t('Create a new expense')"
> >
<template #form> <template #form>
<CustomerNewCustomsAgent <CustomerNewCustomsAgent @on-data-saved="refreshData()" />
@on-data-saved="
(_, requestResponse) =>
onAgentCreated(requestResponse, data)
"
/>
</template> </template>
</VnSelectDialog> </VnSelectDialog>
</VnRow> </VnRow>

View File

@ -23,7 +23,6 @@ const incoterms = ref([]);
const customsAgents = ref([]); const customsAgents = ref([]);
const observationTypes = ref([]); const observationTypes = ref([]);
const notes = ref([]); const notes = ref([]);
let originalNotes = [];
const deletes = ref([]); const deletes = ref([]);
onBeforeMount(() => { onBeforeMount(() => {
@ -43,8 +42,7 @@ const getData = async (observations) => {
}); });
if (data.length) { if (data.length) {
originalNotes = data; notes.value = data
notes.value = originalNotes
.map((observation) => { .map((observation) => {
const type = observationTypes.value.find( const type = observationTypes.value.find(
(type) => type.id === observation.observationTypeFk (type) => type.id === observation.observationTypeFk
@ -83,24 +81,14 @@ const deleteNote = (id, index) => {
}; };
const onDataSaved = async () => { const onDataSaved = async () => {
let payload = { let payload = {};
creates: notes.value.filter((note) => note.$isNew), const creates = notes.value.filter((note) => note.$isNew);
deletes: deletes.value, if (creates.length) {
updates: notes.value payload.creates = creates;
.filter((note) => }
originalNotes.some( if (deletes.value.length) {
(oNote) => payload.deletes = deletes.value;
oNote.id === note.id && }
(note.description !== oNote.description ||
note.observationTypeFk !== oNote.observationTypeFk)
)
)
.map((note) => ({
data: note,
where: { id: note.id },
})),
};
await axios.post('AddressObservations/crud', payload); await axios.post('AddressObservations/crud', payload);
notes.value = []; notes.value = [];
deletes.value = []; deletes.value = [];
@ -144,7 +132,7 @@ function handleLocation(data, location) {
:url="`Addresses/${route.params.addressId}`" :url="`Addresses/${route.params.addressId}`"
@on-data-saved="onDataSaved()" @on-data-saved="onDataSaved()"
auto-load auto-load
model="customer" model="client"
> >
<template #moreActions> <template #moreActions>
<QBtn <QBtn

View File

@ -106,24 +106,28 @@ const setParams = (params) => {
}; };
const getPreview = async () => { const getPreview = async () => {
const params = { try {
recipientId: entityId, const params = {
}; recipientId: entityId,
const validationMessage = validateMessage(); };
if (validationMessage) return notify(t(validationMessage), 'negative'); const validationMessage = validateMessage();
if (validationMessage) return notify(t(validationMessage), 'negative');
setParams(params); setParams(params);
const path = `${sampleType.value.model}/${entityId.value}/${sampleType.value.code}-html`; const path = `${sampleType.value.model}/${entityId.value}/${sampleType.value.code}-html`;
const { data } = await axios.get(path, { params }); const { data } = await axios.get(path, { params });
if (!data) return; if (!data) return;
quasar.dialog({ quasar.dialog({
component: CustomerSamplesPreview, component: CustomerSamplesPreview,
componentProps: { componentProps: {
htmlContent: data, htmlContent: data,
}, },
}); });
} catch (err) {
notify('Errors getting preview', 'negative');
}
}; };
const onSubmit = async () => { const onSubmit = async () => {

View File

@ -42,9 +42,13 @@ const setData = (entity) => {
}; };
const removeDepartment = async () => { const removeDepartment = async () => {
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value); try {
router.push({ name: 'WorkerDepartment' }); await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
notify('department.departmentRemoved', 'positive'); router.push({ name: 'WorkerDepartment' });
notify('department.departmentRemoved', 'positive');
} catch (err) {
console.error('Error removing department');
}
}; };
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();

View File

@ -236,9 +236,13 @@ const copyOriginalRowsData = (rows) => {
}; };
const saveChange = async (field, { rowIndex, row }) => { const saveChange = async (field, { rowIndex, row }) => {
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return; try {
await axios.patch(`Buys/${row.id}`, row); if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
originalRowDataCopy.value[rowIndex][field] = row[field]; await axios.patch(`Buys/${row.id}`, row);
originalRowDataCopy.value[rowIndex][field] = row[field];
} catch (err) {
console.error('Error saving changes', err);
}
}; };
const openRemoveDialog = async () => { const openRemoveDialog = async () => {
@ -256,11 +260,15 @@ const openRemoveDialog = async () => {
}, },
}) })
.onOk(async () => { .onOk(async () => {
await deleteBuys(); try {
const notifyMessage = t( await deleteBuys();
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted` const notifyMessage = t(
); `Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
notify(notifyMessage, 'positive'); );
notify(notifyMessage, 'positive');
} catch (err) {
console.error('Error deleting buys');
}
}); });
}; };
@ -274,13 +282,17 @@ const importBuys = () => {
}; };
const toggleGroupingMode = async (buy, mode) => { const toggleGroupingMode = async (buy, mode) => {
const groupingMode = mode === 'grouping' ? mode : 'packing'; try {
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode; const groupingMode = mode === 'grouping' ? mode : 'packing';
const params = { const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
groupingMode: newGroupingMode, const params = {
}; groupingMode: newGroupingMode,
await axios.patch(`Buys/${buy.id}`, params); };
buy.groupingMode = newGroupingMode; await axios.patch(`Buys/${buy.id}`, params);
buy.groupingMode = newGroupingMode;
} catch (err) {
console.error('Error toggling grouping mode');
}
}; };
const lockIconType = (groupingMode, mode) => { const lockIconType = (groupingMode, mode) => {

View File

@ -123,28 +123,36 @@ const fillData = async (rawData) => {
}; };
const fetchBuys = async (buys) => { const fetchBuys = async (buys) => {
const params = { buys }; try {
const { data } = await axios.post( const params = { buys };
`Entries/${route.params.id}/importBuysPreview`, const { data } = await axios.post(
params `Entries/${route.params.id}/importBuysPreview`,
); params
importData.value.buys = data; );
importData.value.buys = data;
} catch (err) {
console.error('Error fetching buys');
}
}; };
const onSubmit = async () => { const onSubmit = async () => {
const params = importData.value; try {
const hasAnyEmptyRow = params.buys.some((buy) => { const params = importData.value;
return buy.itemFk === null; const hasAnyEmptyRow = params.buys.some((buy) => {
}); return buy.itemFk === null;
});
if (hasAnyEmptyRow) { if (hasAnyEmptyRow) {
notify(t('Some of the imported buys does not have an item'), 'negative'); notify(t('Some of the imported buys does not have an item'), 'negative');
return; return;
}
await axios.post(`Entries/${route.params.id}/importBuys`, params);
notify('globals.dataSaved', 'positive');
redirectToBuysView();
} catch (err) {
console.error('Error importing buys', err);
} }
await axios.post(`Entries/${route.params.id}/importBuys`, params);
notify('globals.dataSaved', 'positive');
redirectToBuysView();
}; };
const redirectToBuysView = () => { const redirectToBuysView = () => {

View File

@ -147,9 +147,12 @@ 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>

View File

@ -82,11 +82,11 @@ const entriesTableColumns = computed(() => [
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">
<QBtn <QBtn
:label="t('myEntries.printLabels')" :label="t('printLabels')"
color="primary" color="primary"
icon="print" icon="print"
:loading="isLoading" :loading="isLoading"
@click="openReport(`Entries/${entityId}/labelSupplier`)" @click="openReport(`Entries/${entityId}/print`)"
unelevated unelevated
autofocus autofocus
/> />
@ -126,9 +126,7 @@ const entriesTableColumns = computed(() => [
" "
unelevated unelevated
> >
<QTooltip>{{ <QTooltip>{{ t('viewLabel') }}</QTooltip>
t('myEntries.viewLabel')
}}</QTooltip>
</QBtn> </QBtn>
</QTr> </QTr>
</template> </template>

View File

@ -12,7 +12,6 @@ import VnImg from 'src/components/ui/VnImg.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref();
const columns = [ const columns = [
{ {
align: 'center', align: 'center',
@ -235,6 +234,7 @@ const columns = [
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)), format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
}, },
]; ];
const tableRef = ref();
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;

View File

@ -221,7 +221,7 @@ onMounted(async () => {
t('entry.list.tableVisibleColumns.isExcludedFromAvailable') t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
}}</QTooltip> }}</QTooltip>
</QIcon> </QIcon>
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary"> <QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
<QTooltip> <QTooltip>
{{ {{
t('globals.raid', { daysInForward: row.daysInForward }) t('globals.raid', { daysInForward: row.daysInForward })

View File

@ -30,6 +30,8 @@ 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;
} }

View File

@ -101,7 +101,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('myEntries.printLabels'), title: t('printLabels'),
icon: 'print', icon: 'print',
isPrimary: true, isPrimary: true,
action: (row) => printBuys(row.id), action: (row) => printBuys(row.id),

View File

@ -184,4 +184,5 @@ es:
Amount: Importe Amount: Importe
Issued: Fecha factura Issued: Fecha factura
Id or supplier: Id o proveedor Id or supplier: Id o proveedor
More options: Más opciones
</i18n> </i18n>

View File

@ -122,7 +122,7 @@ const cols = computed(() => [
:columns="cols" :columns="cols"
:right-search="false" :right-search="false"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:auto-load="!!$route.query.table" :auto-load="!!$route.query.params"
> >
<template #column-supplierFk="{ row }"> <template #column-supplierFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>

View File

@ -61,18 +61,25 @@ const showSendInvoiceDialog = (type) => {
}; };
const sendEmailInvoice = async ({ address }) => { const sendEmailInvoice = async ({ address }) => {
if (!address) notify(`The email can't be empty`, 'negative'); try {
if (!address) notify(`The email can't be empty`, 'negative');
if (invoiceFormType.value === 'pdf') { if (invoiceFormType.value === 'pdf') {
return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-email`, { return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-email`, {
recipientId: $props.invoiceOutData.client.id, recipientId: $props.invoiceOutData.client.id,
recipient: address, recipient: address,
}); });
} else { } else {
return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, { return sendEmail(
recipientId: $props.invoiceOutData.client.id, `InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`,
recipient: address, {
}); recipientId: $props.invoiceOutData.client.id,
recipient: address,
}
);
}
} catch (err) {
console.error('Error sending email', err);
} }
}; };
@ -81,30 +88,46 @@ const redirectToInvoiceOutList = () => {
}; };
const deleteInvoice = async () => { const deleteInvoice = async () => {
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`); try {
notify(t('InvoiceOut deleted'), 'positive'); await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
notify(t('InvoiceOut deleted'), 'positive');
} catch (err) {
console.error('Error deleting invoice out', err);
}
}; };
const bookInvoice = async () => { const bookInvoice = async () => {
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`); try {
notify(t('InvoiceOut booked'), 'positive'); await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
notify(t('InvoiceOut booked'), 'positive');
} catch (err) {
console.error('Error booking invoice out', err);
}
}; };
const generateInvoicePdf = async () => { const generateInvoicePdf = async () => {
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`); try {
notify(t('The invoice PDF document has been regenerated'), 'positive'); await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
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) => {
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse }; try {
const { data } = await axios.post('InvoiceOuts/refund', params); const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
location.href = window.origin + `/#/ticket/${data[0].id}/sale`; const { data } = await axios.post('InvoiceOuts/refund', params);
notify( location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
t('refundInvoiceSuccessMessage', { notify(
refundTicket: data[0].id, t('refundInvoiceSuccessMessage', {
}), refundTicket: data[0].id,
'positive' }),
); 'positive'
);
} catch (err) {
console.error('Error generating invoice out pdf', err);
}
}; };
const showTransferInvoiceForm = async () => { const showTransferInvoiceForm = async () => {

View File

@ -83,29 +83,36 @@ const states = ref();
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QSeparator />
<QItemSection> <QExpansionItem :label="t('More options')" expand-separator>
<VnInputDate <QItem>
v-model="params.issued" <QItemSection>
:label="t('Issued')" <VnInputDate
is-outlined v-model="params.issued"
/> :label="t('Issued')"
</QItemSection> is-outlined
</QItem> />
<QItem> </QItemSection>
<QItemSection> </QItem>
<VnInputDate <QItem>
v-model="params.created" <QItemSection>
:label="t('Created')" <VnInputDate
is-outlined v-model="params.created"
/> :label="t('Created')"
</QItemSection> is-outlined
</QItem> />
<QItem> </QItemSection>
<QItemSection> </QItem>
<VnInputDate v-model="params.dued" :label="t('Dued')" is-outlined /> <QItem>
</QItemSection> <QItemSection>
</QItem> <VnInputDate
v-model="params.dued"
:label="t('Dued')"
is-outlined
/>
</QItemSection>
</QItem>
</QExpansionItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
@ -142,4 +149,5 @@ es:
Issued: Fecha emisión Issued: Fecha emisión
Created: Fecha creación Created: Fecha creación
Dued: Fecha vencimiento Dued: Fecha vencimiento
More options: Más opciones
</i18n> </i18n>

View File

@ -183,7 +183,7 @@ onMounted(async () => {
<i18n> <i18n>
en: en:
invoiceDate: Invoice date invoiceDate: Invoice date
maxShipped: Max date ticket maxShipped: Max date
allClients: All clients allClients: All clients
oneClient: One client oneClient: One client
company: Company company: Company
@ -195,7 +195,7 @@ en:
es: es:
invoiceDate: Fecha de factura invoiceDate: Fecha de factura
maxShipped: Fecha límite ticket maxShipped: Fecha límite
allClients: Todos los clientes allClients: Todos los clientes
oneClient: Un solo cliente oneClient: Un solo cliente
company: Empresa company: Empresa

View File

@ -6,19 +6,15 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { usePrintService } from 'src/composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue'; import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
import { toCurrency, toDate } from 'src/filters/index'; import { toCurrency, toDate } from 'src/filters/index';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import axios from 'axios'; import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceOutFilter from './InvoiceOutFilter.vue'; import InvoiceOutFilter from './InvoiceOutFilter.vue';
import VnRow from 'src/components/ui/VnRow.vue';
import VnRadio from 'src/components/common/VnRadio.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -30,93 +26,99 @@ const selectedRows = ref([]);
const hasSelectedCards = computed(() => selectedRows.value.length > 0); const hasSelectedCards = computed(() => selectedRows.value.length > 0);
const MODEL = 'InvoiceOuts'; const MODEL = 'InvoiceOuts';
const { openReport } = usePrintService(); const { openReport } = usePrintService();
const addressOptions = ref([]);
const selectedOption = ref('ticket');
async function fetchClientAddress(id) {
const { data } = await axios.get(
`Clients/${id}/addresses?filter[order]=isActive DESC`
);
addressOptions.value = data;
}
const exprBuilder = (_, value) => {
return {
or: [{ code: value }, { description: { like: `%${value}%` } }],
};
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'center', align: 'center',
name: 'id', name: 'id',
label: t('invoiceOutList.tableVisibleColumns.id'), label: t('invoiceOutList.tableVisibleColumns.id'),
chip: { condition: () => true }, chip: {
condition: () => true,
},
isId: true, isId: true,
columnFilter: { name: 'search' }, columnFilter: {
name: 'search',
},
}, },
{ {
align: 'left', align: 'left',
name: 'ref', name: 'ref',
label: t('globals.reference'), label: t('invoiceOutList.tableVisibleColumns.ref'),
isTitle: true, isTitle: true,
component: 'select', component: 'select',
attrs: { attrs: {
url: MODEL, url: MODEL,
optionLabel: 'ref', optionLabel: 'ref',
optionValue: 'ref', optionValue: 'id',
}, },
columnField: { component: null }, columnField: {
columnFilter: { component: null,
inWhere: true,
}, },
}, },
{ {
align: 'left', align: 'left',
name: 'issued', name: 'Issued',
label: t('invoiceOut.summary.issued'), label: t('invoiceOutList.tableVisibleColumns.issued'),
component: 'date', component: 'date',
format: (row) => toDate(row.issued), format: (row) => toDate(row.issued),
columnField: { component: null }, columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
name: 'clientFk', name: 'clientFk',
label: t('globals.client'), label: t('invoiceOutModule.customer'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
attrs: { url: 'Clients', fields: ['id', 'name'] }, attrs: {
columnField: { component: null }, url: 'Clients',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
name: 'companyCode', name: 'companyCode',
label: t('globals.company'), label: t('invoiceOutModule.company'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' }, attrs: {
columnField: { component: null }, url: 'Companies',
optionLabel: 'code',
optionValue: 'id',
},
columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
name: 'amount', name: 'amount',
label: t('globals.amount'), label: t('invoiceOutModule.amount'),
cardVisible: true, cardVisible: true,
format: (row) => toCurrency(row.amount), format: (row) => toCurrency(row.amount),
}, },
{ {
align: 'left', align: 'left',
name: 'created', name: 'created',
label: t('globals.created'), label: t('invoiceOutList.tableVisibleColumns.created'),
component: 'date', component: 'date',
columnField: { component: null }, columnField: {
component: null,
},
format: (row) => toDate(row.created), format: (row) => toDate(row.created),
}, },
{ {
align: 'left', align: 'left',
name: 'dued', name: 'dued',
label: t('invoiceOut.summary.dued'), label: t('invoiceOutList.tableVisibleColumns.dueDate'),
component: 'date', component: 'date',
columnField: { component: null }, columnField: {
component: null,
},
format: (row) => toDate(row.dued), format: (row) => toDate(row.dued),
}, },
{ {
@ -126,12 +128,11 @@ const columns = computed(() => [
{ {
title: t('components.smartCard.viewSummary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
isPrimary: true,
action: (row) => viewSummary(row.id, InvoiceOutSummary), action: (row) => viewSummary(row.id, InvoiceOutSummary),
}, },
{ {
title: t('globals.downloadPdf'), title: t('DownloadPdf'),
icon: 'cloud_download', icon: 'vn:ticket',
isPrimary: true, isPrimary: true,
action: (row) => openPdf(row.id), action: (row) => openPdf(row.id),
}, },
@ -142,25 +143,35 @@ onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
function openPdf(id) { function openPdf(id) {
openReport(`${MODEL}/${id}/download`); try {
openReport(`${MODEL}/${id}/download`);
} catch (err) {
console.error('Error opening PDF', err);
}
} }
function downloadPdf() { function downloadPdf() {
if (selectedRows.value.size === 0) return; try {
const selectedCardsArray = Array.from(selectedRows.value.values()); if (selectedRows.value.size === 0) return;
const selectedCardsArray = Array.from(selectedRows.value.values());
if (selectedRows.value.size === 1) { if (selectedRows.value.size === 1) {
const [invoiceOut] = selectedCardsArray; const [invoiceOut] = selectedCardsArray;
openPdf(invoiceOut.id); openPdf(invoiceOut.id);
} else { } else {
const invoiceOutIdsArray = selectedCardsArray.map((invoiceOut) => invoiceOut.id); const invoiceOutIdsArray = selectedCardsArray.map(
const invoiceOutIds = invoiceOutIdsArray.join(','); (invoiceOut) => invoiceOut.id
);
const invoiceOutIds = invoiceOutIdsArray.join(',');
const params = { const params = {
ids: invoiceOutIds, ids: invoiceOutIds,
}; };
openReport(`${MODEL}/downloadZip`, params); openReport(`${MODEL}/downloadZip`, params);
}
} catch (err) {
console.error('Error opening PDF');
} }
} }
@ -170,12 +181,12 @@ watchEffect(selectedRows);
<template> <template>
<VnSearchbar <VnSearchbar
:info="t('youCanSearchByInvoiceReference')" :info="t('youCanSearchByInvoiceReference')"
:label="t('Search invoice')" :label="t('searchInvoice')"
data-key="invoiceOutList" data-key="invoiceOut"
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<InvoiceOutFilter data-key="invoiceOutList" /> <InvoiceOutFilter data-key="invoiceOut" />
</template> </template>
</RightMenu> </RightMenu>
<VnSubToolbar> <VnSubToolbar>
@ -186,19 +197,21 @@ watchEffect(selectedRows);
@click="downloadPdf()" @click="downloadPdf()"
:disable="!hasSelectedCards" :disable="!hasSelectedCards"
> >
<QTooltip>{{ t('downloadPdf') }}</QTooltip> <QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="invoiceOutList" data-key="invoiceOut"
:url="`${MODEL}/filter`" :url="`${MODEL}/filter`"
:create="{ :create="{
urlCreate: 'InvoiceOuts/createManualInvoice', urlCreate: 'InvoiceOuts/createManualInvoice',
title: t('createManualInvoice'), title: t('Create manual invoice'),
onDataSaved: ({ id }) => tableRef.redirect(id), onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: { active: true }, formInitialData: {
active: true,
},
}" }"
:right-search="false" :right-search="false"
v-model:selected="selectedRows" v-model:selected="selectedRows"
@ -218,199 +231,74 @@ watchEffect(selectedRows);
</span> </span>
</template> </template>
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<div class="row q-col-gutter-xs"> <div class="flex no-wrap flex-center">
<div class="col-12"> <VnSelect
<div class="q-col-gutter-xs"> url="Tickets"
<VnRow fixed> v-model="data.ticketFk"
<VnRadio :label="t('invoiceOutList.tableVisibleColumns.ticket')"
v-model="selectedOption" option-label="id"
val="ticket" option-value="id"
:label="t('globals.ticket')" >
class="q-my-none q-mr-md" <template #option="scope">
/> <QItem v-bind="scope.itemProps">
<QItemSection>
<VnInput <QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
v-show="selectedOption === 'ticket'" <QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
v-model="data.ticketFk" </QItemSection>
:label="t('globals.ticket')" </QItem>
style="flex: 1" </template>
/> </VnSelect>
<span class="q-ml-md">O</span>
<div
class="row q-col-gutter-xs q-ml-none"
v-show="selectedOption !== 'ticket'"
>
<div class="col">
<VnSelect
v-model="data.clientFk"
:label="t('globals.client')"
url="Clients"
:options="customerOptions"
option-label="name"
option-value="id"
@update:model-value="fetchClientAddress"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} -
{{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
<div class="col">
<VnSelect
v-model="data.addressFk"
:label="t('ticket.summary.consignee')"
:options="addressOptions"
option-label="nickname"
option-value="id"
v-if="
data.clientFk &&
selectedOption === 'consignatario'
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
:class="{
'color-vn-label':
!scope.opt?.isActive,
}"
>
{{
`${
!scope.opt?.isActive
? t('inactive')
: ''
} `
}}
<span>{{
scope.opt?.nickname
}}</span>
<span
v-if="
scope.opt?.province ||
scope.opt?.city ||
scope.opt?.street
"
>
, {{ scope.opt?.street }},
{{ scope.opt?.city }},
{{
scope.opt?.province?.name
}}
-
{{
scope.opt?.agencyMode
?.name
}}
</span>
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
</div>
</VnRow>
<VnRow fixed>
<VnRadio
v-model="selectedOption"
val="cliente"
:label="t('globals.client')"
class="q-my-none q-mr-md"
/>
</VnRow>
<VnRow fixed>
<VnRadio
v-model="selectedOption"
val="consignatario"
:label="t('ticket.summary.consignee')"
class="q-my-none q-mr-md"
/>
</VnRow>
</div>
</div>
<div class="full-width">
<VnRow class="row q-col-gutter-xs">
<VnSelect
url="InvoiceOutSerials"
v-model="data.serial"
:label="t('invoiceIn.serial')"
:options="invoiceOutSerialsOptions"
option-label="description"
option-value="code"
option-filter
:expr-builder="exprBuilder"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }} -
{{ scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnInputDate
:label="t('invoiceOut.summary.dued')"
v-model="data.maxShipped"
/>
</VnRow>
<VnRow class="row q-col-gutter-xs">
<VnSelect
url="TaxAreas"
v-model="data.taxArea"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>
<VnInput
v-model="data.reference"
:label="t('globals.reference')"
/>
</VnRow>
</div>
</div> </div>
<VnSelect
url="Clients"
v-model="data.clientFk"
:label="t('invoiceOutModule.customer')"
:options="customerOptions"
option-label="name"
option-value="id"
/>
<VnSelect
url="InvoiceOutSerials"
v-model="data.serial"
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
:options="invoiceOutSerialsOptions"
option-label="description"
option-value="code"
/>
<VnInputDate
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
v-model="data.maxShipped"
/>
<VnSelect
url="TaxAreas"
v-model="data.taxArea"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>
<QInput
v-model="data.reference"
:label="t('invoiceOutList.tableVisibleColumns.ref')"
/>
</template> </template>
</VnTable> </VnTable>
</template> </template>
<style lang="scss" scoped>
#formModel .vn-row {
min-height: 45px;
.q-radio {
align-self: flex-end;
flex: 0.3;
}
> .q-input,
> .q-select {
flex: 0.75;
}
}
</style>
<i18n> <i18n>
en: en:
invoiceId: Invoice ID searchInvoice: Search issued invoice
youCanSearchByInvoiceReference: You can search by invoice reference fileDenied: Browser denied file download...
createManualInvoice: Create Manual Invoice fileAllowed: Successful download of CSV file
inactive: (Inactive) youCanSearchByInvoiceReference: You can search by invoice reference
createInvoice: Make invoice
es: Create manual invoice: Create manual invoice
invoiceId: ID de factura es:
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura searchInvoice: Buscar factura emitida
createManualInvoice: Crear factura manual fileDenied: El navegador denegó la descarga de archivos...
inactive: (Inactivo) fileAllowed: Descarga exitosa de archivo CSV
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
createInvoice: Crear factura
Create manual invoice: Crear factura manual
</i18n> </i18n>

Some files were not shown because too many files have changed in this diff Show More