Merge branch 'master' into hotfix_checbox_css
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
9ae43244d9
84
CHANGELOG.md
84
CHANGELOG.md
|
@ -1,3 +1,87 @@
|
||||||
|
# Version 24.50 - 2024-12-10
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- feat: add reportFileName option by:Javier Segarra
|
||||||
|
- feat: all clients just with global series by:jgallego
|
||||||
|
- feat: improve Merge branch 'test' into dev by:Javier Segarra
|
||||||
|
- feat: manual invoice in two lines by:jgallego
|
||||||
|
- feat: manualInvoice with address by:jgallego
|
||||||
|
- feat: randomize functions and example by:Javier Segarra
|
||||||
|
- feat: refs #6999 added search when user tabs on a filter with value by:Jon
|
||||||
|
- feat: refs #6999 added tab to search in VnTable filter by:Jon
|
||||||
|
- feat: refs #7346 #7346 improve form by:Javier Segarra
|
||||||
|
- feat: refs #7346 address ordered by:jgallego
|
||||||
|
- feat: refs #7346 radioButton by:jgallego
|
||||||
|
- feat: refs #7346 style radioButton by:jgallego
|
||||||
|
- feat: refs #7346 traducciones en cammelCase (7346-manualInvoice) by:jgallego
|
||||||
|
- feat: refs #8038 added new functionality in VnSelect and refactor styles by:Jon
|
||||||
|
- feat: refs #8061 #8061 updates by:Javier Segarra
|
||||||
|
- feat: refs #8087 reactive data by:jorgep
|
||||||
|
- feat: refs #8087 refs#8087 Redadas en travel by:Carlos Andrés
|
||||||
|
- feat: refs #8138 add component ticket problems by:pablone
|
||||||
|
- feat: refs #8163 add max length and more tests by:wbuezas
|
||||||
|
- feat: refs #8163 add prop by:wbuezas
|
||||||
|
- feat: refs #8163 add VnInput insert functionality and e2e test by:wbuezas
|
||||||
|
- feat: refs #8163 limit with maxLength by:Javier Segarra
|
||||||
|
- feat: refs #8163 maxLength SupplierFD account by:Javier Segarra
|
||||||
|
- feat: refs #8163 maxLengthVnInput by:Javier Segarra
|
||||||
|
- feat: refs #8163 use VnAccountNumber in VnAccountNumber by:Javier Segarra
|
||||||
|
- feat: refs #8166 show notification by:jorgep
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- feat: refs #8038 added new functionality in VnSelect and refactor styles by:Jon
|
||||||
|
- perf: add dataCy by:Javier Segarra
|
||||||
|
- perf: refs #7346 #7346 Imrpove interface dialog by:Javier Segarra
|
||||||
|
- perf: refs #7346 #7346 use v-show instead v-if by:Javier Segarra
|
||||||
|
- perf: refs #8036 currentFilter by:alexm
|
||||||
|
- perf: refs #8061 filter autonomy by:Javier Segarra
|
||||||
|
- perf: refs #8061 solve conflicts and random posCode it by:Javier Segarra
|
||||||
|
- perf: refs #8061 use opts from VnSelect by:Javier Segarra
|
||||||
|
- perf: refs #8163 #8061 createNewPostCodeForm by:Javier Segarra
|
||||||
|
- perf: remove console by:Javier Segarra
|
||||||
|
- perf: remove timeout by:Javier Segarra
|
||||||
|
- perf: test command fillInForm by:Javier Segarra
|
||||||
|
- refactor: refs #8162 remove comment by:wbuezas
|
||||||
|
- refactor: remove unnecesary things by:wbuezas
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- fix: #8016 fetching data by:Javier Segarra
|
||||||
|
- fix: icons by:jgallego
|
||||||
|
- fix: refs #7229 download file by:jorgep
|
||||||
|
- fix: refs #7229 remove catch by:jorgep
|
||||||
|
- fix: refs #7229 set url by:jorgep
|
||||||
|
- fix: refs #7229 test by:jorgep
|
||||||
|
- fix: refs #7229 url by:jorgep
|
||||||
|
- fix: refs #7229 url + test by:jorgep
|
||||||
|
- fix: refs #7304 7304 clean warning by:carlossa
|
||||||
|
- fix: refs #7304 fix list by:carlossa
|
||||||
|
- fix: refs #7304 fix warning by:carlossa
|
||||||
|
- fix: refs #7346 traslations by:jgallego
|
||||||
|
- fix: refs #7529 add save by:carlossa
|
||||||
|
- fix: refs #7529 fix e2e by:carlossa
|
||||||
|
- fix: refs #7529 fix front by:carlossa
|
||||||
|
- fix: refs #7529 fix scss by:carlossa
|
||||||
|
- fix: refs #7529 fix te2e by:carlossa
|
||||||
|
- fix: refs #7529 fix workerPit e2e by:carlossa
|
||||||
|
- fix: refs #7529 front by:carlossa
|
||||||
|
- fix: refs #8036 apply exprBuilder after save filters by:alexm
|
||||||
|
- fix: refs #8036 only add where when required by:alexm
|
||||||
|
- fix: refs #8038 solve conflicts by:Jon
|
||||||
|
- fix: refs #8061 improve code dependencies (origin/8061_improve_newCP) by:Javier Segarra
|
||||||
|
- fix: refs #8138 move component from ui folder by:pablone
|
||||||
|
- fix: refs #8138 sme minor issues by:pablone
|
||||||
|
- fix: refs #8163 #8061 createNewPostCodeForm by:Javier Segarra
|
||||||
|
- fix: refs #8163 minor problem when keypress by:Javier Segarra
|
||||||
|
- fix: refs #8166 show zone error by:jorgep
|
||||||
|
- fix: removed selectedClient by:jgallego
|
||||||
|
- refs #7529 fix workerPit by:carlossa
|
||||||
|
- revert: refs #8061 test #8061 updates by:Javier Segarra
|
||||||
|
- test: fix own test by:Javier Segarra
|
||||||
|
- test: refs #8162 #8162 fix TicketList spec by:Javier Segarra
|
||||||
|
|
||||||
# Version 24.48 - 2024-11-25
|
# Version 24.48 - 2024-11-25
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -4,7 +4,8 @@ def PROTECTED_BRANCH
|
||||||
|
|
||||||
def BRANCH_ENV = [
|
def BRANCH_ENV = [
|
||||||
test: 'test',
|
test: 'test',
|
||||||
master: 'production'
|
master: 'production',
|
||||||
|
beta: 'production'
|
||||||
]
|
]
|
||||||
|
|
||||||
node {
|
node {
|
||||||
|
@ -15,7 +16,8 @@ node {
|
||||||
PROTECTED_BRANCH = [
|
PROTECTED_BRANCH = [
|
||||||
'dev',
|
'dev',
|
||||||
'test',
|
'test',
|
||||||
'master'
|
'master',
|
||||||
|
'beta'
|
||||||
].contains(env.BRANCH_NAME)
|
].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
const { defineConfig } = require('cypress');
|
const { defineConfig } = require('cypress');
|
||||||
|
// https://docs.cypress.io/app/tooling/reporters
|
||||||
|
// https://docs.cypress.io/app/references/configuration
|
||||||
|
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
|
@ -16,6 +19,7 @@ module.exports = defineConfig({
|
||||||
reporterOptions: {
|
reporterOptions: {
|
||||||
charts: true,
|
charts: true,
|
||||||
reportPageTitle: 'Cypress Inline Reporter',
|
reportPageTitle: 'Cypress Inline Reporter',
|
||||||
|
reportFilename: '[status]_[datetime]-report',
|
||||||
embeddedScreenshots: true,
|
embeddedScreenshots: true,
|
||||||
reportDir: 'test/cypress/reports',
|
reportDir: 'test/cypress/reports',
|
||||||
inlineAssets: true,
|
inlineAssets: true,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.48.0",
|
"version": "24.50.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default {
|
||||||
// TODO: AUTOFOCUS IS NOT FOCUSING
|
// TODO: AUTOFOCUS IS NOT FOCUSING
|
||||||
const that = this;
|
const that = this;
|
||||||
this.$el.addEventListener('keyup', function (evt) {
|
this.$el.addEventListener('keyup', function (evt) {
|
||||||
if (evt.key === 'Enter') {
|
if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
|
||||||
const input = evt.target;
|
const input = evt.target;
|
||||||
if (input.type == 'textarea' && evt.shiftKey) {
|
if (input.type == 'textarea' && evt.shiftKey) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
<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>
|
|
|
@ -17,10 +17,6 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -44,19 +40,23 @@ 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('Names')"
|
:label="t('Name')"
|
||||||
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"
|
||||||
:provinces="$props.provinces"
|
required
|
||||||
|
data-cy="provinceCity"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -21,13 +21,14 @@ const postcodeFormData = reactive({
|
||||||
provinceFk: null,
|
provinceFk: null,
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
|
const townsFetchDataRef = ref(false);
|
||||||
|
const townFilter = ref({});
|
||||||
|
|
||||||
const townsFetchDataRef = ref(null);
|
const countriesRef = 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 = {
|
||||||
|
@ -39,110 +40,91 @@ function onDataSaved(formData) {
|
||||||
({ id }) => id === formData.provinceFk
|
({ id }) => id === formData.provinceFk
|
||||||
);
|
);
|
||||||
newPostcode.province = provinceObject?.name;
|
newPostcode.province = provinceObject?.name;
|
||||||
const countryObject = countriesOptions.value.find(
|
const countryObject = countriesRef.value.opts.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) {
|
||||||
|
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();
|
|
||||||
newTown.province = provincesOptions.value.find(
|
newTown.province = provincesOptions.value.find(
|
||||||
(province) => province.id === newTown.provinceFk
|
(province) => province.id === newTown.provinceFk
|
||||||
);
|
);
|
||||||
formData.townFk = newTown;
|
formData.townFk = newTown;
|
||||||
setTown(newTown, formData);
|
setTown(newTown, formData);
|
||||||
}
|
}
|
||||||
|
async function fetchTowns(countryFk = postcodeFormData.countryFk) {
|
||||||
function setTown(newTown, data) {
|
if (!countryFk) return;
|
||||||
if (!newTown) return;
|
const provinces = postcodeFormData.provinceFk
|
||||||
town.value = newTown;
|
? [postcodeFormData.provinceFk]
|
||||||
data.provinceFk = newTown.provinceFk;
|
: provinceByCountry();
|
||||||
data.countryFk = newTown.province.countryFk;
|
townFilter.value.where = {
|
||||||
}
|
|
||||||
|
|
||||||
async function setProvince(id, data) {
|
|
||||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
|
||||||
if (!newProvince) return;
|
|
||||||
|
|
||||||
data.countryFk = newProvince.countryFk;
|
|
||||||
}
|
|
||||||
|
|
||||||
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: {
|
provinceFk: {
|
||||||
inq: provincesOptions.value.map(({ id }) => id),
|
inq: provinces,
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
});
|
await townsFetchDataRef.value?.fetch();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
async function filterTowns(name) {
|
||||||
() => postcodeFormData.provinceFk,
|
if (name !== '') {
|
||||||
async (newProvinceFk, oldValueFk) => {
|
townFilter.value.where = {
|
||||||
if (Array.isArray(newProvinceFk)) {
|
name: {
|
||||||
newProvinceFk = newProvinceFk[0];
|
like: `%${name}%`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await townsFetchDataRef.value?.fetch();
|
||||||
}
|
}
|
||||||
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>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="provincesFetchDataRef"
|
|
||||||
@on-fetch="handleProvinces"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
auto-load
|
|
||||||
url="Provinces/location"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
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"
|
||||||
|
@ -164,10 +146,13 @@ async function handleCountries(data) {
|
||||||
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"
|
||||||
|
@ -176,7 +161,8 @@ async function handleCountries(data) {
|
||||||
: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"
|
||||||
:clearable="true"
|
required
|
||||||
|
data-cy="locationTown"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -193,7 +179,6 @@ async function handleCountries(data) {
|
||||||
<CreateNewCityForm
|
<CreateNewCityForm
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
:provinces="provincesOptions"
|
|
||||||
@on-data-saved="
|
@on-data-saved="
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onCityCreated(requestResponse, data)
|
onCityCreated(requestResponse, data)
|
||||||
|
@ -207,21 +192,31 @@ async function handleCountries(data) {
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
@update:model-value="(value) => setProvince(value, data)"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
|
@update:options="
|
||||||
|
(data) => {
|
||||||
|
provincesOptions = data;
|
||||||
|
}
|
||||||
|
"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:clearable="true"
|
|
||||||
:provinces="provincesOptions"
|
|
||||||
@on-province-created="onProvinceCreated"
|
@on-province-created="onProvinceCreated"
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Countries"
|
ref="countriesRef"
|
||||||
|
:limit="30"
|
||||||
|
:filter="countryFilter"
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
|
auto-load
|
||||||
|
url="Countries"
|
||||||
|
required
|
||||||
: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>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { computed, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import 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';
|
||||||
|
@ -21,34 +20,24 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const autonomiesOptions = ref([]);
|
const autonomiesRef = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved, requestResponse) => {
|
const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
requestResponse.autonomy = autonomiesOptions.value.find(
|
requestResponse.autonomy = autonomiesRef.value.opts.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!')"
|
||||||
|
@ -63,10 +52,19 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
: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"
|
||||||
|
|
|
@ -10,6 +10,7 @@ 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();
|
||||||
|
@ -175,14 +176,13 @@ 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);
|
||||||
} catch (e) {
|
} finally {
|
||||||
return (isLoading.value = false);
|
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',
|
||||||
|
@ -249,7 +249,7 @@ function getChanges() {
|
||||||
for (const [i, row] of formData.value.entries()) {
|
for (const [i, row] of formData.value.entries()) {
|
||||||
if (!row[pk]) {
|
if (!row[pk]) {
|
||||||
creates.push(row);
|
creates.push(row);
|
||||||
} else if (originalData.value) {
|
} else if (originalData.value[i]) {
|
||||||
const data = getDifferences(originalData.value[i], row);
|
const data = getDifferences(originalData.value[i], row);
|
||||||
if (!isEmpty(data)) {
|
if (!isEmpty(data)) {
|
||||||
updates.push({
|
updates.push({
|
||||||
|
@ -268,28 +268,6 @@ 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;
|
||||||
|
@ -395,6 +373,7 @@ 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>
|
||||||
|
|
|
@ -85,12 +85,14 @@ const closeForm = () => {
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="label"
|
option-label="label"
|
||||||
v-model="selectedField"
|
v-model="selectedField"
|
||||||
|
data-cy="field-to-edit"
|
||||||
/>
|
/>
|
||||||
<component
|
<component
|
||||||
:is="inputs[selectedField?.component || 'input']"
|
:is="inputs[selectedField?.component || 'input']"
|
||||||
v-bind="selectedField?.attrs || {}"
|
v-bind="selectedField?.attrs || {}"
|
||||||
v-model="newValue"
|
v-model="newValue"
|
||||||
:label="t('Value')"
|
:label="t('Value')"
|
||||||
|
data-cy="value-to-edit"
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -91,6 +91,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
maxWidth: {
|
||||||
|
type: [String, Boolean],
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
|
@ -106,6 +110,7 @@ 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',
|
||||||
|
@ -113,6 +118,7 @@ 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',
|
||||||
|
@ -203,7 +209,9 @@ 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 ? $props.mapper(formData.value) : formData.value;
|
const body = $props.mapper
|
||||||
|
? $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;
|
||||||
|
@ -283,7 +291,9 @@ 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"
|
||||||
|
:prevent-submit="$attrs['prevent-submit']"
|
||||||
>
|
>
|
||||||
<QCard>
|
<QCard>
|
||||||
<slot
|
<slot
|
||||||
|
@ -317,6 +327,7 @@ 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')"
|
||||||
|
@ -371,7 +382,6 @@ defineExpose({
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
#formModel {
|
#formModel {
|
||||||
max-width: 800px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ defineExpose({
|
||||||
@click="emit('onDataCanceled')"
|
@click="emit('onDataCanceled')"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
data-cy="FormModelPopup_cancel"
|
data-cy="FormModelPopup_cancel"
|
||||||
|
z-max
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
|
@ -72,6 +73,7 @@ defineExpose({
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
data-cy="FormModelPopup_save"
|
data-cy="FormModelPopup_save"
|
||||||
|
z-max
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -9,6 +9,8 @@ import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { getParamWhere } from 'src/filters';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -26,28 +28,21 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemCategories = ref([]);
|
const route = useRoute();
|
||||||
const selectedCategoryFk = ref(null);
|
|
||||||
const selectedTypeFk = ref(null);
|
|
||||||
const itemTypesOptions = ref([]);
|
const itemTypesOptions = ref([]);
|
||||||
const suppliersOptions = ref([]);
|
const suppliersOptions = ref([]);
|
||||||
const tagOptions = ref([]);
|
const tagOptions = ref([]);
|
||||||
const tagValues = ref([]);
|
const tagValues = ref([]);
|
||||||
|
const categoryList = ref(null);
|
||||||
|
const selectedCategoryFk = ref(getParamWhere(route.query.table, 'categoryFk', false));
|
||||||
|
const selectedTypeFk = ref(getParamWhere(route.query.table, 'typeFk', false));
|
||||||
|
|
||||||
const categoryList = computed(() => {
|
const selectedCategory = computed(() => {
|
||||||
return (itemCategories.value || [])
|
return (categoryList.value || []).find(
|
||||||
.filter((category) => category.display)
|
|
||||||
.map((category) => ({
|
|
||||||
...category,
|
|
||||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
const selectedCategory = computed(() =>
|
|
||||||
(itemCategories.value || []).find(
|
|
||||||
(category) => category?.id === selectedCategoryFk.value
|
(category) => category?.id === selectedCategoryFk.value
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const selectedType = computed(() => {
|
const selectedType = computed(() => {
|
||||||
return (itemTypesOptions.value || []).find(
|
return (itemTypesOptions.value || []).find(
|
||||||
|
@ -87,7 +82,7 @@ const applyTags = (params, search) => {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchItemTypes = async (id) => {
|
const fetchItemTypes = async (id = selectedCategoryFk.value) => {
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'name', 'categoryFk'],
|
fields: ['id', 'name', 'categoryFk'],
|
||||||
where: { categoryFk: id },
|
where: { categoryFk: id },
|
||||||
|
@ -126,15 +121,19 @@ const removeTag = (index, params, search) => {
|
||||||
(tagValues.value || []).splice(index, 1);
|
(tagValues.value || []).splice(index, 1);
|
||||||
applyTags(params, search);
|
applyTags(params, search);
|
||||||
};
|
};
|
||||||
|
const setCategoryList = (data) => {
|
||||||
|
categoryList.value = (data || [])
|
||||||
|
.filter((category) => category.display)
|
||||||
|
.map((category) => ({
|
||||||
|
...category,
|
||||||
|
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||||
|
}));
|
||||||
|
fetchItemTypes();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
||||||
url="ItemCategories"
|
|
||||||
limit="30"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (itemCategories = data)"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Suppliers"
|
url="Suppliers"
|
||||||
limit="30"
|
limit="30"
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<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>
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onProvinceCreated']);
|
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched', 'update:options']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
countryFk: {
|
countryFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -17,20 +17,23 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
provinces: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const provinceFk = defineModel({ type: Number, default: null });
|
const provinceFk = defineModel({ type: Number, default: null });
|
||||||
|
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const filter = ref({
|
||||||
|
include: { relation: 'country' },
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
});
|
||||||
const provincesOptions = ref($props.provinces);
|
const provincesOptions = ref($props.provinces);
|
||||||
provinceFk.value = $props.provinceSelected;
|
|
||||||
const provincesFetchDataRef = ref();
|
const provincesFetchDataRef = ref();
|
||||||
|
provinceFk.value = $props.provinceSelected;
|
||||||
|
if (!$props.countryFk) {
|
||||||
|
filter.value.where = {};
|
||||||
|
}
|
||||||
async function onProvinceCreated(_, data) {
|
async function onProvinceCreated(_, data) {
|
||||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||||
provinceFk.value = data.id;
|
provinceFk.value = data.id;
|
||||||
|
@ -38,24 +41,33 @@ async function onProvinceCreated(_, data) {
|
||||||
}
|
}
|
||||||
async function handleProvinces(data) {
|
async function handleProvinces(data) {
|
||||||
provincesOptions.value = data;
|
provincesOptions.value = data;
|
||||||
|
emit('update:options', 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="$props.provinces"
|
:options="provincesOptions"
|
||||||
:tooltip="t('Create province')"
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
|
|
|
@ -143,6 +143,10 @@ 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
|
||||||
|
@ -157,6 +161,7 @@ const showFilter = computed(
|
||||||
v-model="model"
|
v-model="model"
|
||||||
:components="components"
|
:components="components"
|
||||||
component-prop="columnFilter"
|
component-prop="columnFilter"
|
||||||
|
@keydown.tab="onTabPressed"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -163,7 +163,7 @@ onMounted(() => {
|
||||||
stateStore.rightDrawer = quasar.screen.gt.xs;
|
stateStore.rightDrawer = quasar.screen.gt.xs;
|
||||||
columnsVisibilitySkipped.value = [
|
columnsVisibilitySkipped.value = [
|
||||||
...splittedColumns.value.columns
|
...splittedColumns.value.columns
|
||||||
.filter((c) => c.visible == false)
|
.filter((c) => c.visible === false)
|
||||||
.map((c) => c.name),
|
.map((c) => c.name),
|
||||||
...['tableActions'],
|
...['tableActions'],
|
||||||
];
|
];
|
||||||
|
@ -237,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);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,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="true"
|
:vertical="false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<slot
|
<slot
|
||||||
|
@ -739,6 +739,7 @@ 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 }}
|
||||||
|
|
|
@ -152,7 +152,7 @@ onMounted(async () => {
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-for="col in localColumns"
|
v-for="col in localColumns"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:label="col.label"
|
:label="col.label ?? col.name"
|
||||||
v-model="col.visible"
|
v-model="col.visible"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { nextTick, ref, watch } from 'vue';
|
||||||
import { QInput } from 'quasar';
|
import { QInput } from 'quasar';
|
||||||
|
|
||||||
const props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
insertable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||||
|
|
||||||
let internalValue = ref(props.modelValue);
|
let internalValue = ref($props.modelValue);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => $props.modelValue,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
internalValue.value = newVal;
|
internalValue.value = newVal;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +32,46 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleKeydown = (e) => {
|
||||||
|
if (e.key === 'Backspace') return;
|
||||||
|
if (e.key === '.') {
|
||||||
|
accountShortToStandard();
|
||||||
|
// TODO: Fix this setTimeout, with nextTick doesn't work
|
||||||
|
setTimeout(() => {
|
||||||
|
setCursorPosition(0, e.target);
|
||||||
|
}, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($props.insertable && e.key.match(/[0-9]/)) {
|
||||||
|
handleInsertMode(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function setCursorPosition(pos, el = vnInputRef.value) {
|
||||||
|
el.focus();
|
||||||
|
el.setSelectionRange(pos, pos);
|
||||||
|
}
|
||||||
|
const vnInputRef = ref(false);
|
||||||
|
const handleInsertMode = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = e.target;
|
||||||
|
const cursorPos = input.selectionStart;
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
let currentValue = internalValue.value;
|
||||||
|
if (!currentValue) currentValue = e.key;
|
||||||
|
const newValue = e.key;
|
||||||
|
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
||||||
|
internalValue.value =
|
||||||
|
currentValue.substring(0, cursorPos) +
|
||||||
|
newValue +
|
||||||
|
currentValue.substring(cursorPos + 1);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
function accountShortToStandard() {
|
function accountShortToStandard() {
|
||||||
internalValue.value = internalValue.value.replace(
|
internalValue.value = internalValue.value?.replace(
|
||||||
'.',
|
'.',
|
||||||
'0'.repeat(11 - internalValue.value.length)
|
'0'.repeat(11 - internalValue.value.length)
|
||||||
);
|
);
|
||||||
|
@ -37,5 +79,5 @@ function accountShortToStandard() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-input v-model="internalValue" />
|
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, useAttrs } from 'vue';
|
import { computed, ref, useAttrs, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
|
@ -34,6 +34,14 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
insertable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
maxlength: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const vnInputRef = ref(null);
|
const vnInputRef = ref(null);
|
||||||
|
@ -69,6 +77,9 @@ const mixinRules = [
|
||||||
requiredFieldRule,
|
requiredFieldRule,
|
||||||
...($attrs.rules ?? []),
|
...($attrs.rules ?? []),
|
||||||
(val) => {
|
(val) => {
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
if (maxlength && +val.length > maxlength)
|
||||||
|
return t(`maxLength`, { value: maxlength });
|
||||||
const { min, max } = vnInputRef.value.$attrs;
|
const { min, max } = vnInputRef.value.$attrs;
|
||||||
if (!min) return null;
|
if (!min) return null;
|
||||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
||||||
|
@ -78,6 +89,33 @@ const mixinRules = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const handleKeydown = (e) => {
|
||||||
|
if (e.key === 'Backspace') return;
|
||||||
|
|
||||||
|
if ($props.insertable && e.key.match(/[0-9]/)) {
|
||||||
|
handleInsertMode(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInsertMode = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const input = e.target;
|
||||||
|
const cursorPos = input.selectionStart;
|
||||||
|
const { maxlength } = vnInputRef.value;
|
||||||
|
let currentValue = value.value;
|
||||||
|
if (!currentValue) currentValue = e.key;
|
||||||
|
const newValue = e.key;
|
||||||
|
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
||||||
|
value.value =
|
||||||
|
currentValue.substring(0, cursorPos) +
|
||||||
|
newValue +
|
||||||
|
currentValue.substring(cursorPos + 1);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -89,10 +127,12 @@ const mixinRules = [
|
||||||
:type="$attrs.type"
|
:type="$attrs.type"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
|
@keydown="handleKeydown"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
:lazy-rules="true"
|
:lazy-rules="true"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||||
>
|
>
|
||||||
<template v-if="$slots.prepend" #prepend>
|
<template v-if="$slots.prepend" #prepend>
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
|
@ -129,9 +169,11 @@ const mixinRules = [
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
inputMin: Must be more than {value}
|
inputMin: Must be more than {value}
|
||||||
|
maxLength: The value exceeds {value} characters
|
||||||
inputMax: Must be less than {value}
|
inputMax: Must be less than {value}
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
|
maxLength: El valor excede los {value} carácteres
|
||||||
inputMax: Debe ser menor a {value}
|
inputMax: Debe ser menor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, computed, ref } from 'vue';
|
import { onMounted, watch, computed, ref, useAttrs } 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';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useAttrs } from 'vue';
|
import { useAttrs } from 'vue';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -43,7 +43,7 @@ const formatLocation = (obj, properties) => {
|
||||||
return filteredParts.join(', ');
|
return filteredParts.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
const modelValue = ref(
|
const modelValue = computed(() =>
|
||||||
props.location ? formatLocation(props.location, locationProperties) : null
|
props.location ? formatLocation(props.location, locationProperties) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ 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"
|
||||||
|
|
|
@ -2,5 +2,12 @@
|
||||||
const model = defineModel({ type: Boolean, required: true });
|
const model = defineModel({ type: Boolean, required: true });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QRadio v-model="model" v-bind="$attrs" dense :dark="true" class="q-mr-sm" />
|
<QRadio
|
||||||
|
v-model="model"
|
||||||
|
v-bind="$attrs"
|
||||||
|
dense
|
||||||
|
:dark="true"
|
||||||
|
class="q-mr-sm"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -8,7 +8,14 @@ import dataByOrder from 'src/utils/dataByOrder';
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||||
const $attrs = useAttrs();
|
const $attrs = useAttrs();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { isRequired, requiredFieldRule } = useRequired($attrs);
|
|
||||||
|
const isRequired = computed(() => {
|
||||||
|
return useRequired($attrs).isRequired;
|
||||||
|
});
|
||||||
|
const requiredFieldRule = computed(() => {
|
||||||
|
return useRequired($attrs).requiredFieldRule;
|
||||||
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [String, Number, Object],
|
type: [String, Number, Object],
|
||||||
|
@ -138,8 +145,6 @@ onMounted(() => {
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ opts: myOptions });
|
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
|
@ -259,6 +264,41 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ opts: myOptions });
|
||||||
|
|
||||||
|
function handleKeyDown(event) {
|
||||||
|
if (event.key === 'Tab' && !event.shiftKey) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
const focusableElements = document.querySelectorAll(
|
||||||
|
'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
||||||
|
);
|
||||||
|
const currentIndex = Array.prototype.indexOf.call(
|
||||||
|
focusableElements,
|
||||||
|
event.target
|
||||||
|
);
|
||||||
|
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
|
||||||
|
focusableElements[currentIndex + 1].focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -269,6 +309,7 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
: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'])"
|
||||||
|
@ -283,10 +324,11 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
:input-debounce="useURL ? '300' : '0'"
|
:input-debounce="useURL ? '300' : '0'"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
>
|
>
|
||||||
<template v-if="isClearable" #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-show="value"
|
v-show="isClearable && value"
|
||||||
name="close"
|
name="close"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
() => {
|
() => {
|
||||||
|
@ -299,7 +341,22 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
<div v-if="slotName == 'append'">
|
||||||
|
<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>
|
||||||
|
|
|
@ -43,6 +43,7 @@ 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'"
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef">
|
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||||
<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,6 +161,7 @@ async function send() {
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
unelevated
|
unelevated
|
||||||
|
data-cy="sendSmsBtn"
|
||||||
/>
|
/>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -67,7 +67,7 @@ const dialog = ref(null);
|
||||||
<QTooltip>{{ t('globals.add') }}</QTooltip>
|
<QTooltip>{{ t('globals.add') }}</QTooltip>
|
||||||
<QPopupProxy ref="dialog">
|
<QPopupProxy ref="dialog">
|
||||||
<OrderCatalogItemDialog
|
<OrderCatalogItemDialog
|
||||||
:prices="item.prices"
|
:item="item"
|
||||||
@added="() => dialog.hide()"
|
@added="() => dialog.hide()"
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
|
|
|
@ -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, required: true },
|
workerId: { type: [Number, undefined], default: null },
|
||||||
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,7 +38,13 @@ watch(src, () => (showLetter.value = false));
|
||||||
<template v-if="showLetter">
|
<template v-if="showLetter">
|
||||||
{{ title.charAt(0) }}
|
{{ title.charAt(0) }}
|
||||||
</template>
|
</template>
|
||||||
<QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
|
<QImg
|
||||||
|
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">
|
||||||
|
|
|
@ -37,7 +37,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['filter', 'search', 'or', 'and'],
|
default: () => ['filter', 'or', 'and'],
|
||||||
},
|
},
|
||||||
customTags: {
|
customTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -61,7 +61,6 @@ const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
'clear',
|
'clear',
|
||||||
'search',
|
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
'setUserParams',
|
'setUserParams',
|
||||||
|
@ -79,7 +78,7 @@ const userParams = ref({});
|
||||||
defineExpose({ search, sanitizer, params: userParams });
|
defineExpose({ search, sanitizer, params: userParams });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
userParams.value = $props.modelValue ?? {};
|
if (!userParams.value) userParams.value = $props.modelValue ?? {};
|
||||||
emit('init', { params: userParams.value });
|
emit('init', { params: userParams.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,7 +104,8 @@ watch(
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => arrayData.store.userParams,
|
() => arrayData.store.userParams,
|
||||||
(val, oldValue) => (val || oldValue) && setUserParams(val)
|
(val, oldValue) => (val || oldValue) && setUserParams(val),
|
||||||
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -274,6 +274,7 @@ 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">
|
||||||
|
|
|
@ -1,23 +1,28 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
import { ref, reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { parsePhone } from 'src/filters';
|
import { parsePhone } from 'src/filters';
|
||||||
|
import useOpenURL from 'src/composables/useOpenURL';
|
||||||
|
|
||||||
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 },
|
||||||
|
country: { type: String, default: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const phone = ref(props.phoneNumber);
|
||||||
const config = reactive({
|
const config = reactive({
|
||||||
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
|
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
|
||||||
'say-simple': {
|
'say-simple': {
|
||||||
icon: 'vn:saysimple',
|
icon: 'vn:saysimple',
|
||||||
href: null,
|
url: null,
|
||||||
channel: props.channel,
|
channel: props.channel,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
|
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
if (!phone.value) return;
|
||||||
let { channel } = config[type];
|
let { channel } = config[type];
|
||||||
|
|
||||||
if (type === 'say-simple') {
|
if (type === 'say-simple') {
|
||||||
|
@ -25,23 +30,28 @@ onBeforeMount(async () => {
|
||||||
.data;
|
.data;
|
||||||
if (!channel) channel = defaultChannel;
|
if (!channel) channel = defaultChannel;
|
||||||
|
|
||||||
config[type].href = `${url}?customerIdentity=%2B${parsePhone(
|
phone.value = await parsePhone(props.phoneNumber, props.country.toLowerCase());
|
||||||
props.phoneNumber
|
config[
|
||||||
)}&channelId=${channel}`;
|
type
|
||||||
|
].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
if (config[type].url) useOpenURL(config[type].url);
|
||||||
|
else if (config[type].href) window.location.href = config[type].href;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="phoneNumber"
|
v-if="phone"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
:icon="config[type].icon"
|
:icon="config[type].icon"
|
||||||
size="sm"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
padding="none"
|
padding="none"
|
||||||
:href="config[type].href"
|
@click.stop="handleClick"
|
||||||
@click.stop
|
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ capitalize(type).replace('-', '') }}
|
{{ capitalize(type).replace('-', '') }}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import { toDateHourMin } from 'src/filters';
|
import { toDateHourMin } from 'src/filters';
|
||||||
import { useState } from 'src/composables/useState';
|
|
||||||
|
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||||
|
@ -26,9 +25,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const currentUser = ref(state.getUser());
|
|
||||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||||
const observationTypes = ref([]);
|
const observationTypes = ref([]);
|
||||||
const vnPaginateRef = ref();
|
const vnPaginateRef = ref();
|
||||||
|
@ -101,6 +98,7 @@ 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>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="vn-row q-gutter-md q-mb-md">
|
<div class="vn-row q-gutter-md">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
&:not(.wrap) {
|
&:not(.wrap) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
&[fixed] {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -51,10 +51,6 @@ const props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
staticParams: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
exprBuilder: {
|
exprBuilder: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -130,6 +126,7 @@ async function search() {
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
autofocus
|
autofocus
|
||||||
|
data-cy="vnSearchBar"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { getUrl } from './getUrl';
|
import { getUrl } from './getUrl';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { exportFile } from 'quasar';
|
||||||
|
|
||||||
const { getTokenMultimedia } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
|
|
||||||
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
||||||
let appUrl = await getUrl('', 'lilium');
|
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
|
||||||
appUrl = appUrl.replace('/#/', '');
|
const response = await axios.get(
|
||||||
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
|
url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`,
|
||||||
|
{ responseType: 'blob' }
|
||||||
|
);
|
||||||
|
|
||||||
|
const contentDisposition = response.headers['content-disposition'];
|
||||||
|
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
|
||||||
|
const filename =
|
||||||
|
matches != null && matches[1]
|
||||||
|
? matches[1].replace(/['"]/g, '')
|
||||||
|
: 'downloaded-file';
|
||||||
|
|
||||||
|
exportFile(filename, response.data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,14 @@ import { useValidator } from 'src/composables/useValidator';
|
||||||
|
|
||||||
export function useRequired($attrs) {
|
export function useRequired($attrs) {
|
||||||
const { validations } = useValidator();
|
const { validations } = useValidator();
|
||||||
|
const hasRequired = Object.keys($attrs).includes('required');
|
||||||
const isRequired = Object.keys($attrs).includes('required');
|
let isRequired = false;
|
||||||
|
if (hasRequired) {
|
||||||
|
const required = $attrs['required'];
|
||||||
|
if (typeof required === 'boolean') {
|
||||||
|
isRequired = required;
|
||||||
|
}
|
||||||
|
}
|
||||||
const requiredFieldRule = (val) => validations().required(isRequired, val);
|
const requiredFieldRule = (val) => validations().required(isRequired, val);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function useRole() {
|
||||||
|
|
||||||
function hasAny(roles) {
|
function hasAny(roles) {
|
||||||
const roleStore = state.getRoles();
|
const roleStore = state.getRoles();
|
||||||
|
if (typeof roles === 'string') roles = [roles];
|
||||||
for (const role of roles) {
|
for (const role of roles) {
|
||||||
if (roleStore.value.indexOf(role) !== -1) return true;
|
if (roleStore.value.indexOf(role) !== -1) return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: 100px;
|
max-width: 130px;
|
||||||
div span {
|
div span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -264,6 +264,10 @@ input::-webkit-inner-spin-button {
|
||||||
.shrink {
|
.shrink {
|
||||||
max-width: 75px;
|
max-width: 75px;
|
||||||
}
|
}
|
||||||
|
.number {
|
||||||
|
text-align: right;
|
||||||
|
width: 96px;
|
||||||
|
}
|
||||||
.expand {
|
.expand {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
// parsing JSON safely
|
|
||||||
function parseJSON(str, fallback) {
|
function parseJSON(str, fallback) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(str ?? '{}');
|
return JSON.parse(str ?? '{}');
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
export default function getUpdatedValues(keys, formData) {
|
||||||
|
return keys.reduce((acc, key) => {
|
||||||
|
acc[key] = formData[key];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
}
|
|
@ -11,11 +11,15 @@ 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 parsePhone from './parsePhone';
|
||||||
import isDialogOpened from './isDialogOpened';
|
import isDialogOpened from './isDialogOpened';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
getUpdatedValues,
|
||||||
|
getDifferences,
|
||||||
isDialogOpened,
|
isDialogOpened,
|
||||||
parsePhone,
|
parsePhone,
|
||||||
toLowerCase,
|
toLowerCase,
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
export default function (phone, prefix = 34) {
|
import axios from 'axios';
|
||||||
if (phone.startsWith('+')) {
|
|
||||||
return `${phone.slice(1)}`;
|
export default async function parsePhone(phone, country) {
|
||||||
}
|
if (!phone) return;
|
||||||
if (phone.startsWith('00')) {
|
if (phone.startsWith('+')) return `${phone.slice(1)}`;
|
||||||
return `${phone.slice(2)}`;
|
if (phone.startsWith('00')) return `${phone.slice(2)}`;
|
||||||
}
|
|
||||||
if (phone.startsWith(prefix) && phone.length === prefix.length + 9) {
|
let prefix;
|
||||||
return `${prefix}${phone.slice(prefix.length)}`;
|
try {
|
||||||
|
prefix = (await axios.get(`Prefixes/${country.toLowerCase()}`)).data?.prefix;
|
||||||
|
} catch (e) {
|
||||||
|
prefix = (await axios.get('PbxConfigs/findOne')).data?.defaultPrefix;
|
||||||
}
|
}
|
||||||
|
prefix = prefix.replace(/^0+/, '');
|
||||||
|
|
||||||
|
if (phone.startsWith(prefix)) return phone;
|
||||||
return `${prefix}${phone}`;
|
return `${prefix}${phone}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,6 +298,7 @@ globals:
|
||||||
clientsActionsMonitor: Clients and actions
|
clientsActionsMonitor: Clients and actions
|
||||||
serial: Serial
|
serial: Serial
|
||||||
medical: Mutual
|
medical: Mutual
|
||||||
|
pit: IRPF
|
||||||
RouteExtendedList: Router
|
RouteExtendedList: Router
|
||||||
wasteRecalc: Waste recaclulate
|
wasteRecalc: Waste recaclulate
|
||||||
operator: Operator
|
operator: Operator
|
||||||
|
@ -330,6 +331,7 @@ globals:
|
||||||
fi: FI
|
fi: FI
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
departmentFk: Department
|
departmentFk: Department
|
||||||
|
countryFk: Country
|
||||||
changePass: Change password
|
changePass: Change password
|
||||||
deleteConfirmTitle: Delete selected elements
|
deleteConfirmTitle: Delete selected elements
|
||||||
changeState: Change state
|
changeState: Change state
|
||||||
|
@ -506,6 +508,7 @@ 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
|
||||||
|
@ -766,7 +769,7 @@ travel:
|
||||||
thermographs: Thermographs
|
thermographs: Thermographs
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Days in forward
|
daysInForward: Automatic movement (Raid)
|
||||||
isRaid: Raid
|
isRaid: Raid
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperature
|
temperature: Temperature
|
||||||
|
@ -858,9 +861,11 @@ 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
|
||||||
|
moreOptions: More options
|
||||||
leftMenu:
|
leftMenu:
|
||||||
addToPinned: Add to pinned
|
addToPinned: Add to pinned
|
||||||
removeFromPinned: Remove from pinned
|
removeFromPinned: Remove from pinned
|
||||||
|
|
|
@ -303,6 +303,7 @@ globals:
|
||||||
clientsActionsMonitor: Clientes y acciones
|
clientsActionsMonitor: Clientes y acciones
|
||||||
serial: Facturas por serie
|
serial: Facturas por serie
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
|
pit: IRPF
|
||||||
wasteRecalc: Recalcular mermas
|
wasteRecalc: Recalcular mermas
|
||||||
operator: Operario
|
operator: Operario
|
||||||
parking: Parking
|
parking: Parking
|
||||||
|
@ -334,6 +335,7 @@ globals:
|
||||||
SSN: NSS
|
SSN: NSS
|
||||||
fi: NIF
|
fi: NIF
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
|
countryFk: País
|
||||||
changePass: Cambiar contraseña
|
changePass: Cambiar contraseña
|
||||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||||
changeState: Cambiar estado
|
changeState: Cambiar estado
|
||||||
|
@ -509,6 +511,7 @@ 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
|
||||||
|
@ -760,7 +763,7 @@ travel:
|
||||||
thermographs: Termógrafos
|
thermographs: Termógrafos
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Días redada
|
daysInForward: Desplazamiento automatico (redada)
|
||||||
isRaid: Redada
|
isRaid: Redada
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperatura
|
temperature: Temperatura
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
hasAccount: {
|
hasAccount: {
|
||||||
|
@ -21,7 +21,7 @@ const { t } = useI18n();
|
||||||
const { hasAccount } = toRefs($props);
|
const { hasAccount } = toRefs($props);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { notify } = useNotify();
|
const { notify } = useQuasar();
|
||||||
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
||||||
account.value.hasAccount = hasAccount.value;
|
account.value.hasAccount = hasAccount.value;
|
||||||
const entityId = computed(() => +route.params.id);
|
const entityId = computed(() => +route.params.id);
|
||||||
|
|
|
@ -41,8 +41,12 @@ const fetchAccountExistence = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchMailForwards = async () => {
|
const fetchMailForwards = async () => {
|
||||||
|
try {
|
||||||
const response = await axios.get(`MailForwards/${route.params.id}`);
|
const response = await axios.get(`MailForwards/${route.params.id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
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';
|
||||||
|
|
||||||
|
@ -52,7 +53,6 @@ const addressFilter = {
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
const { id } = route.params;
|
const { id } = route.params;
|
||||||
getAddressesData(id);
|
|
||||||
getClientData(id);
|
getClientData(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,23 +60,10 @@ 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}`);
|
||||||
|
@ -101,9 +88,9 @@ const setDefault = (address) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortAddresses = () => {
|
const sortAddresses = (data) => {
|
||||||
if (!client.value || !addresses.value) return;
|
if (!client.value || !data) return;
|
||||||
addresses.value = addresses.value.sort((a, b) => {
|
addresses.value = data.sort((a, b) => {
|
||||||
return isDefaultAddress(b) - isDefaultAddress(a);
|
return isDefaultAddress(b) - isDefaultAddress(a);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -124,8 +111,17 @@ 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" v-if="addresses.length">
|
<QCard class="card-width q-pa-lg">
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in addresses"
|
v-for="(item, index) in addresses"
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import 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();
|
||||||
|
@ -30,6 +31,13 @@ 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
|
||||||
|
@ -43,7 +51,12 @@ const exprBuilder = (param, value) => {
|
||||||
@on-fetch="(data) => (businessTypes = data)"
|
@on-fetch="(data) => (businessTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
|
<FormModel
|
||||||
|
:url="`Clients/${route.params.id}`"
|
||||||
|
auto-load
|
||||||
|
model="customer"
|
||||||
|
:mapper="onBeforeSave"
|
||||||
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -94,6 +107,7 @@ const exprBuilder = (param, value) => {
|
||||||
: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')"
|
||||||
|
@ -155,7 +169,6 @@ const exprBuilder = (param, value) => {
|
||||||
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
|
||||||
|
|
|
@ -28,12 +28,7 @@ const getBankEntities = (data, formData) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="customer">
|
||||||
: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
|
||||||
|
|
|
@ -93,22 +93,6 @@ 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>
|
||||||
|
|
|
@ -36,7 +36,10 @@ const entityId = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
|
const setData = (entity) => {
|
||||||
|
data.value = useCardDescription(entity?.name, entity?.id);
|
||||||
|
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
||||||
|
};
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,6 @@ 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"
|
||||||
>
|
>
|
||||||
|
@ -68,6 +67,7 @@ function handleLocation(data, location) {
|
||||||
option-label="vat"
|
option-label="vat"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.sageTaxTypeFk"
|
v-model="data.sageTaxTypeFk"
|
||||||
|
data-cy="sageTaxTypeFk"
|
||||||
:required="data.isTaxDataChecked"
|
:required="data.isTaxDataChecked"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -76,6 +76,7 @@ function handleLocation(data, location) {
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="transaction"
|
option-label="transaction"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
data-cy="sageTransactionTypeFk"
|
||||||
v-model="data.sageTransactionTypeFk"
|
v-model="data.sageTransactionTypeFk"
|
||||||
:required="data.isTaxDataChecked"
|
:required="data.isTaxDataChecked"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
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, dashOrCurrency } from 'src/filters';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
||||||
|
@ -95,13 +94,14 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:phone-number="entity.mobile"
|
:phone-number="entity.mobile"
|
||||||
:channel="entity.country?.saySimpleCountry?.channel"
|
:channel="entity.country?.saySimpleCountry?.channel"
|
||||||
class="q-ml-xs"
|
class="q-ml-xs"
|
||||||
|
:country="entity.country?.code"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :value="entity.email" copy
|
<VnLv :value="entity.email" copy
|
||||||
><template #label>
|
><template #label>
|
||||||
{{ t('globals.params.email') }}
|
{{ t('globals.params.email') }}
|
||||||
<VnLinkMail email="entity.email"></VnLinkMail> </template
|
<VnLinkMail :email="entity.email"></VnLinkMail> </template
|
||||||
></VnLv>
|
></VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
|
|
|
@ -1,164 +1,82 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeMount, ref, watch, nextTick } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import FormModel from 'components/FormModel.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';
|
||||||
import axios from 'axios';
|
const formModelRef = ref(false);
|
||||||
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: initialDated,
|
dated: Date.vnNew(),
|
||||||
|
amount: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasChanged = computed(() => {
|
const filterClientFindOne = {
|
||||||
return (
|
fields: ['unpaid', 'dated', 'amount'],
|
||||||
initialData.value.dated !== dated.value ||
|
where: {
|
||||||
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,
|
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>
|
||||||
<Teleport v-if="stateStore?.isSubToolbarShown()" to="#st-actions">
|
<FetchData
|
||||||
<QBtnGroup push class="q-gutter-x-sm">
|
:filter="filterClientFindOne"
|
||||||
<QBtn
|
auto-load
|
||||||
:disabled="!hasChanged"
|
url="ClientUnpaids"
|
||||||
:label="t('globals.reset')"
|
@on-fetch="
|
||||||
:loading="isLoading"
|
(data) => {
|
||||||
@click="setInitialData"
|
const unpaid = data.length == 1;
|
||||||
color="primary"
|
initialData = { ...data[0], unpaid };
|
||||||
flat
|
}
|
||||||
icon="restart_alt"
|
"
|
||||||
type="reset"
|
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QCard>
|
||||||
:disabled="!hasChanged"
|
<FormModel
|
||||||
:label="t('globals.save')"
|
v-if="'unpaid' in initialData"
|
||||||
:loading="isLoading"
|
:observe-form-changes="false"
|
||||||
@click="onSubmit"
|
ref="formModelRef"
|
||||||
color="primary"
|
model="unpaid"
|
||||||
icon="save"
|
url-update="ClientUnpaids"
|
||||||
/>
|
:mapper="(formData) => ({ ...formData, clientFk: route.params.id })"
|
||||||
</QBtnGroup>
|
:form-initial-data="initialData"
|
||||||
</Teleport>
|
>
|
||||||
|
<template #form="{ data }">
|
||||||
<div class="full-width flex justify-center">
|
|
||||||
<QCard class="card-width q-pa-lg">
|
|
||||||
<QForm>
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<QCheckbox :label="t('Unpaid client')" v-model="data.unpaid" />
|
||||||
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md" v-show="unpaidClient">
|
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInputDate :label="t('Date')" v-model="dated" />
|
<VnInputDate
|
||||||
|
data-cy="customerUnpaidDate"
|
||||||
|
:label="t('Date')"
|
||||||
|
v-model="data.dated"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInputNumber
|
||||||
|
data-cy="customerUnpaidAmount"
|
||||||
ref="amountInputRef"
|
ref="amountInputRef"
|
||||||
:label="t('Amount')"
|
:label="t('Amount')"
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
v-model="data.amount"
|
||||||
v-model="amount"
|
|
||||||
autofocus
|
autofocus
|
||||||
>
|
>
|
||||||
<template #append>€</template></VnInput
|
<template #append>€</template></VnInputNumber
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QForm>
|
</template>
|
||||||
|
</FormModel>
|
||||||
</QCard>
|
</QCard>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -25,12 +25,12 @@ 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="webAccess"
|
model="customer"
|
||||||
:mapper="
|
:mapper="
|
||||||
({ active, name, email }) => {
|
({ account }) => {
|
||||||
|
const { name, email, active } = account;
|
||||||
return {
|
return {
|
||||||
active,
|
active,
|
||||||
name,
|
name,
|
||||||
|
@ -42,14 +42,14 @@ async function hasCustomerRole() {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<QCheckbox :label="t('Enable web access')" v-model="data.active" />
|
<QCheckbox :label="t('Enable web access')" v-model="data.account.active" />
|
||||||
<VnInput :label="t('User')" clearable v-model="data.name" />
|
<VnInput :label="t('User')" clearable v-model="data.account.name" />
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Recovery email')"
|
:label="t('Recovery email')"
|
||||||
:rules="validate('client.email')"
|
:rules="validate('client.email')"
|
||||||
clearable
|
clearable
|
||||||
type="email"
|
type="email"
|
||||||
v-model="data.email"
|
v-model="data.account.email"
|
||||||
class="q-mt-sm"
|
class="q-mt-sm"
|
||||||
:info="t('This email is used for user to regain access their account')"
|
:info="t('This email is used for user to regain access their account')"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeMount, ref, watch } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import axios from 'axios';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||||
|
|
||||||
|
@ -20,10 +20,11 @@ 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: null },
|
where: { clientFk: route.params.id },
|
||||||
order: ['created DESC'],
|
order: ['created DESC'],
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
const ClientDmsRef = ref(false);
|
||||||
|
|
||||||
const tableColumnComponents = {
|
const tableColumnComponents = {
|
||||||
state: {
|
state: {
|
||||||
|
@ -50,7 +51,7 @@ const tableColumnComponents = {
|
||||||
component: CustomerCheckIconTooltip,
|
component: CustomerCheckIconTooltip,
|
||||||
props: ({ row }) => ({
|
props: ({ row }) => ({
|
||||||
transaction: row,
|
transaction: row,
|
||||||
promise: refreshData,
|
promise: () => ClientDmsRef.value.fetch(),
|
||||||
}),
|
}),
|
||||||
event: () => {},
|
event: () => {},
|
||||||
},
|
},
|
||||||
|
@ -89,38 +90,16 @@ 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>
|
||||||
<div class="full-width flex justify-center">
|
<FetchData
|
||||||
|
ref="ClientDmsRef"
|
||||||
|
:filter="filter"
|
||||||
|
@on-fetch="(data) => (rows = data)"
|
||||||
|
auto-load
|
||||||
|
url="Clients/transactions"
|
||||||
|
/>
|
||||||
<QPage class="card-width q-pa-lg">
|
<QPage class="card-width q-pa-lg">
|
||||||
<QTable
|
<QTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -135,13 +114,9 @@ const refreshData = () => {
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
<component
|
<component
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
:is="tableColumnComponents[props.col.name].component"
|
||||||
@click="
|
@click="tableColumnComponents[props.col.name].event(props)"
|
||||||
tableColumnComponents[props.col.name].event(props)
|
|
||||||
"
|
|
||||||
class="rounded-borders q-pa-sm"
|
class="rounded-borders q-pa-sm"
|
||||||
v-bind="
|
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||||
tableColumnComponents[props.col.name].props(props)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
</component>
|
</component>
|
||||||
|
@ -154,7 +129,6 @@ const refreshData = () => {
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -12,6 +12,7 @@ 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();
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, reactive, ref } from 'vue';
|
import { 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';
|
||||||
|
@ -19,26 +18,10 @@ const router = useRouter();
|
||||||
|
|
||||||
const formInitialData = reactive({ isDefaultAddress: false });
|
const formInitialData = reactive({ isDefaultAddress: false });
|
||||||
|
|
||||||
const urlCreate = ref('');
|
|
||||||
|
|
||||||
const agencyModes = ref([]);
|
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',
|
||||||
|
@ -54,9 +37,19 @@ function handleLocation(data, location) {
|
||||||
data.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
data.countryFk = countryFk;
|
data.countryFk = countryFk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onAgentCreated({ id, fiscalName }, data) {
|
||||||
|
customsAgents.value.push({ id, fiscalName });
|
||||||
|
data.customsAgentFk = id;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
@on-fetch="(data) => (customsAgents = data)"
|
||||||
|
auto-load
|
||||||
|
url="CustomsAgents"
|
||||||
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="(data) => (agencyModes = data)"
|
@on-fetch="(data) => (agencyModes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -67,7 +60,7 @@ function handleLocation(data, location) {
|
||||||
<FormModel
|
<FormModel
|
||||||
:form-initial-data="formInitialData"
|
:form-initial-data="formInitialData"
|
||||||
:observe-form-changes="false"
|
:observe-form-changes="false"
|
||||||
:url-create="urlCreate"
|
:url-create="`Clients/${route.params.id}/createAddress`"
|
||||||
@on-data-saved="toCustomerAddress()"
|
@on-data-saved="toCustomerAddress()"
|
||||||
model="client"
|
model="client"
|
||||||
>
|
>
|
||||||
|
@ -139,6 +132,7 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
url="CustomsAgents"
|
||||||
:label="t('Customs agent')"
|
:label="t('Customs agent')"
|
||||||
:options="customsAgents"
|
:options="customsAgents"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -148,7 +142,11 @@ function handleLocation(data, location) {
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CustomerNewCustomsAgent @on-data-saved="refreshData()" />
|
<CustomerNewCustomsAgent
|
||||||
|
@on-data-saved="
|
||||||
|
(requestResponse) => onAgentCreated(requestResponse, data)
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -144,7 +144,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="client"
|
model="customer"
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #moreActions>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
|
@ -189,6 +189,7 @@ async function getAmountPaid() {
|
||||||
:url-create="urlCreate"
|
:url-create="urlCreate"
|
||||||
:mapper="onBeforeSave"
|
:mapper="onBeforeSave"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
|
:prevent-submit="true"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||||
|
@ -303,7 +304,7 @@ async function getAmountPaid() {
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
:loading="formModelRef.isLoading"
|
:loading="formModelRef.isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
@click="formModelRef.save()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -12,6 +12,7 @@ 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',
|
||||||
|
@ -234,7 +235,6 @@ 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;
|
||||||
|
|
|
@ -183,7 +183,7 @@ onMounted(async () => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
invoiceDate: Invoice date
|
invoiceDate: Invoice date
|
||||||
maxShipped: Max date
|
maxShipped: Max date ticket
|
||||||
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
|
maxShipped: Fecha límite ticket
|
||||||
allClients: Todos los clientes
|
allClients: Todos los clientes
|
||||||
oneClient: Un solo cliente
|
oneClient: Un solo cliente
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
|
|
@ -6,15 +6,19 @@ 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 'composables/usePrintService';
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'src/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 CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import axios from 'axios';
|
||||||
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();
|
||||||
|
@ -26,18 +30,30 @@ 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: {
|
chip: { condition: () => true },
|
||||||
condition: () => true,
|
|
||||||
},
|
|
||||||
isId: true,
|
isId: true,
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'search',
|
name: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -58,68 +74,58 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'Issued',
|
name: 'issued',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.issued'),
|
label: t('invoiceOut.summary.issued'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
format: (row) => toDate(row.issued),
|
format: (row) => toDate(row.issued),
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'clientFk',
|
name: 'clientFk',
|
||||||
label: t('invoiceOutModule.customer'),
|
label: t('globals.client'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Clients',
|
url: 'Clients',
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'socialName'],
|
||||||
},
|
optionLabel: 'socialName',
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'companyCode',
|
|
||||||
label: t('invoiceOutModule.company'),
|
|
||||||
cardVisible: true,
|
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'Companies',
|
|
||||||
optionLabel: 'code',
|
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
},
|
},
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'companyCode',
|
||||||
|
label: t('globals.company'),
|
||||||
|
cardVisible: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' },
|
||||||
|
columnField: { component: null },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: t('invoiceOutModule.amount'),
|
label: t('globals.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('invoiceOutList.tableVisibleColumns.created'),
|
label: t('globals.created'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row) => toDate(row.created),
|
format: (row) => toDate(row.created),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'dued',
|
name: 'dued',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.dueDate'),
|
label: t('invoiceOut.summary.dued'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row) => toDate(row.dued),
|
format: (row) => toDate(row.dued),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -129,11 +135,12 @@ 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('DownloadPdf'),
|
title: t('globals.downloadPdf'),
|
||||||
icon: 'vn:ticket',
|
icon: 'cloud_download',
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
action: (row) => openPdf(row.id),
|
action: (row) => openPdf(row.id),
|
||||||
},
|
},
|
||||||
|
@ -172,7 +179,7 @@ watchEffect(selectedRows);
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
:info="t('youCanSearchByInvoiceReference')"
|
:info="t('youCanSearchByInvoiceReference')"
|
||||||
:label="t('searchInvoice')"
|
:label="t('Search invoice')"
|
||||||
data-key="invoiceOutList"
|
data-key="invoiceOutList"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
|
@ -188,7 +195,7 @@ watchEffect(selectedRows);
|
||||||
@click="downloadPdf()"
|
@click="downloadPdf()"
|
||||||
:disable="!hasSelectedCards"
|
:disable="!hasSelectedCards"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
|
<QTooltip>{{ t('downloadPdf') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
@ -198,11 +205,9 @@ watchEffect(selectedRows);
|
||||||
:url="`${MODEL}/filter`"
|
:url="`${MODEL}/filter`"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||||
title: t('Create manual invoice'),
|
title: t('createManualInvoice'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {
|
formInitialData: { active: true },
|
||||||
active: true,
|
|
||||||
},
|
|
||||||
}"
|
}"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
|
@ -222,45 +227,154 @@ watchEffect(selectedRows);
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<div class="flex no-wrap flex-center">
|
<div class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<div class="col-12">
|
||||||
url="Tickets"
|
<div class="q-col-gutter-xs">
|
||||||
|
<VnRow fixed>
|
||||||
|
<VnRadio
|
||||||
|
v-model="selectedOption"
|
||||||
|
val="ticket"
|
||||||
|
:label="t('globals.ticket')"
|
||||||
|
class="q-my-none q-mr-md"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnInput
|
||||||
|
v-show="selectedOption === 'ticket'"
|
||||||
v-model="data.ticketFk"
|
v-model="data.ticketFk"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
|
:label="t('globals.ticket')"
|
||||||
option-label="id"
|
style="flex: 1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<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"
|
option-value="id"
|
||||||
|
@update:model-value="fetchClientAddress"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
<QItemLabel>
|
||||||
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
|
#{{ scope.opt?.id }} -
|
||||||
|
{{ scope.opt?.name }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<span class="q-ml-md">O</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
v-model="data.addressFk"
|
||||||
v-model="data.clientFk"
|
:label="t('ticket.summary.consignee')"
|
||||||
:label="t('invoiceOutModule.customer')"
|
:options="addressOptions"
|
||||||
:options="customerOptions"
|
option-label="nickname"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
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
|
<VnSelect
|
||||||
url="InvoiceOutSerials"
|
url="InvoiceOutSerials"
|
||||||
v-model="data.serial"
|
v-model="data.serial"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
|
:label="t('invoiceIn.serial')"
|
||||||
:options="invoiceOutSerialsOptions"
|
:options="invoiceOutSerialsOptions"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
option-value="code"
|
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
|
<VnInputDate
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
|
:label="t('invoiceOut.summary.dued')"
|
||||||
v-model="data.maxShipped"
|
v-model="data.maxShipped"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="TaxAreas"
|
url="TaxAreas"
|
||||||
v-model="data.taxArea"
|
v-model="data.taxArea"
|
||||||
|
@ -269,27 +383,43 @@ watchEffect(selectedRows);
|
||||||
option-label="code"
|
option-label="code"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
/>
|
/>
|
||||||
<QInput
|
<VnInput
|
||||||
v-model="data.reference"
|
v-model="data.reference"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.ref')"
|
:label="t('globals.reference')"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</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:
|
||||||
searchInvoice: Search issued invoice
|
invoiceId: Invoice ID
|
||||||
fileDenied: Browser denied file download...
|
|
||||||
fileAllowed: Successful download of CSV file
|
|
||||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||||
createInvoice: Make invoice
|
createManualInvoice: Create Manual Invoice
|
||||||
Create manual invoice: Create manual invoice
|
inactive: (Inactive)
|
||||||
|
|
||||||
es:
|
es:
|
||||||
searchInvoice: Buscar factura emitida
|
invoiceId: ID de factura
|
||||||
fileDenied: El navegador denegó la descarga de archivos...
|
|
||||||
fileAllowed: Descarga exitosa de archivo CSV
|
|
||||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||||
createInvoice: Crear factura
|
createManualInvoice: Crear factura manual
|
||||||
Create manual invoice: Crear factura manual
|
inactive: (Inactivo)
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -2,6 +2,7 @@ invoiceOutModule:
|
||||||
customer: Client
|
customer: Client
|
||||||
amount: Amount
|
amount: Amount
|
||||||
company: Company
|
company: Company
|
||||||
|
address: Address
|
||||||
invoiceOutList:
|
invoiceOutList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: ID
|
id: ID
|
||||||
|
|
|
@ -4,13 +4,14 @@ invoiceOutModule:
|
||||||
customer: Cliente
|
customer: Cliente
|
||||||
amount: Importe
|
amount: Importe
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
address: Consignatario
|
||||||
invoiceOutList:
|
invoiceOutList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: ID
|
id: ID
|
||||||
ref: Referencia
|
ref: Referencia
|
||||||
issued: Fecha emisión
|
issued: Fecha emisión
|
||||||
created: F. creación
|
created: F. creación
|
||||||
dueDate: F. máxima
|
dueDate: Fecha vencimiento
|
||||||
invoiceOutSerial: Serial
|
invoiceOutSerial: Serial
|
||||||
ticket: Ticket
|
ticket: Ticket
|
||||||
taxArea: Area
|
taxArea: Area
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, computed, onUnmounted, reactive, ref, nextTick, watch } from 'vue';
|
import { onMounted, computed, reactive, ref, nextTick, 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';
|
||||||
|
|
||||||
|
@ -12,20 +12,18 @@ import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const today = ref(Date.vnNew());
|
const today = ref(Date.vnNew());
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
|
@ -145,8 +143,6 @@ onMounted(async () => {
|
||||||
await updateWarehouse(warehouseFk.value);
|
await updateWarehouse(warehouseFk.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => router.currentRoute.value.params.id,
|
() => router.currentRoute.value.params.id,
|
||||||
(newId) => {
|
(newId) => {
|
||||||
|
@ -205,8 +201,8 @@ async function updateWarehouse(warehouseFk) {
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (warehousesOptions = data)"
|
@on-fetch="(data) => (warehousesOptions = data)"
|
||||||
/>
|
/>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
<VnSubToolbar class="q-mb-md">
|
||||||
<Teleport to="#st-data">
|
<template #st-data>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('itemDiary.warehouse')"
|
:label="t('itemDiary.warehouse')"
|
||||||
|
@ -235,9 +231,8 @@ async function updateWarehouse(warehouseFk) {
|
||||||
@update:model-value="fetchItemBalances"
|
@update:model-value="fetchItemBalances"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
|
||||||
<Teleport to="#st-actions"> </Teleport>
|
|
||||||
</template>
|
</template>
|
||||||
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="itemBalances"
|
:rows="itemBalances"
|
||||||
|
|
|
@ -66,6 +66,7 @@ const insertTag = (rows) => {
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Tags"
|
url="Tags"
|
||||||
:filter="{ fields: ['id', 'name', 'isFree', 'sourceTable'] }"
|
:filter="{ fields: ['id', 'name', 'isFree', 'sourceTable'] }"
|
||||||
|
sort-by="name"
|
||||||
@on-fetch="(data) => (tagOptions = data)"
|
@on-fetch="(data) => (tagOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -137,6 +138,7 @@ const insertTag = (rows) => {
|
||||||
:required="false"
|
:required="false"
|
||||||
:rules="validate('itemTag.tagFk')"
|
:rules="validate('itemTag.tagFk')"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
|
sort-by="value"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-else-if="
|
v-else-if="
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, reactive, onUnmounted, nextTick, computed } from 'vue';
|
import { onMounted, ref, onUnmounted, nextTick, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
|
@ -37,11 +37,9 @@ const fixedPrices = ref([]);
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const itemFixedPriceFilterRef = ref();
|
const itemFixedPriceFilterRef = ref();
|
||||||
const params = reactive({});
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
params.warehouseFk = user.value.warehouseFk;
|
|
||||||
});
|
});
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
|
@ -137,8 +135,17 @@ const columns = computed(() => [
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnClass: 'shrink',
|
columnClass: 'shrink',
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
|
||||||
options: warehousesOptions,
|
options: warehousesOptions,
|
||||||
|
columnFilter: {
|
||||||
|
name: 'warehouseFk',
|
||||||
|
inWhere: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
options: warehousesOptions,
|
||||||
|
'option-label': 'name',
|
||||||
|
'option-value': 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -210,8 +217,6 @@ const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMinPrice = async (value, props) => {
|
const updateMinPrice = async (value, props) => {
|
||||||
// El checkbox hasMinPrice se encuentra en la misma columna que el input hasMinPrice
|
|
||||||
// Por lo tanto le mandamos otro objeto con las mismas propiedades pero con el campo 'field' cambiado
|
|
||||||
props.row.hasMinPrice = value;
|
props.row.hasMinPrice = value;
|
||||||
await upsertPrice({
|
await upsertPrice({
|
||||||
row: props.row,
|
row: props.row,
|
||||||
|
@ -220,12 +225,33 @@ const updateMinPrice = async (value, props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const validations = ({ row }) => {
|
||||||
|
const requiredFields = [
|
||||||
|
'itemFk',
|
||||||
|
'started',
|
||||||
|
'ended',
|
||||||
|
'rate2',
|
||||||
|
'rate3',
|
||||||
|
'warehouseFk',
|
||||||
|
];
|
||||||
|
const isValid = requiredFields.every(
|
||||||
|
(field) => row[field] !== null && row[field] !== undefined
|
||||||
|
);
|
||||||
|
return isValid;
|
||||||
|
};
|
||||||
const upsertPrice = async (props, resetMinPrice = false) => {
|
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
const { row } = props;
|
const isValid = validations({ ...props });
|
||||||
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
if (!isValid) {
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
return;
|
||||||
await upsertFixedPrice(row);
|
|
||||||
}
|
}
|
||||||
|
const { row } = props;
|
||||||
|
const changes = tableRef.value.CrudModelRef.getChanges();
|
||||||
|
if (changes?.updates?.length > 0) {
|
||||||
|
if (resetMinPrice) row.hasMinPrice = 0;
|
||||||
|
}
|
||||||
|
if (!changes.updates && !changes.creates) return;
|
||||||
|
const data = await upsertFixedPrice(row);
|
||||||
|
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
async function upsertFixedPrice(row) {
|
||||||
|
@ -233,13 +259,6 @@ async function upsertFixedPrice(row) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveOnRowChange(row) {
|
|
||||||
if (rowsSelected.value.length > 1) return;
|
|
||||||
if (rowsSelected.value[0]?.id === row.id) return;
|
|
||||||
else if (rowsSelected.value.length === 1) await upsertPrice(rowsSelected.value[0]);
|
|
||||||
rowsSelected.value = [row];
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkLastVisibleRow() {
|
function checkLastVisibleRow() {
|
||||||
let lastVisibleRow = null;
|
let lastVisibleRow = null;
|
||||||
|
|
||||||
|
@ -255,7 +274,6 @@ function checkLastVisibleRow() {
|
||||||
|
|
||||||
const addRow = (original = null) => {
|
const addRow = (original = null) => {
|
||||||
let copy = null;
|
let copy = null;
|
||||||
if (!original) {
|
|
||||||
const today = Date.vnNew();
|
const today = Date.vnNew();
|
||||||
const millisecsInDay = 86400000;
|
const millisecsInDay = 86400000;
|
||||||
const daysInWeek = 7;
|
const daysInWeek = 7;
|
||||||
|
@ -268,26 +286,6 @@ const addRow = (original = null) => {
|
||||||
hasMinPrice: 0,
|
hasMinPrice: 0,
|
||||||
$index: 0,
|
$index: 0,
|
||||||
};
|
};
|
||||||
} else
|
|
||||||
copy = {
|
|
||||||
$index: original.$index - 1,
|
|
||||||
itemFk: original.itemFk,
|
|
||||||
name: original.name,
|
|
||||||
subName: original.subName,
|
|
||||||
value5: original.value5,
|
|
||||||
value6: original.value6,
|
|
||||||
value7: original.value7,
|
|
||||||
value8: original.value8,
|
|
||||||
value9: original.value9,
|
|
||||||
value10: original.value10,
|
|
||||||
warehouseFk: original.warehouseFk,
|
|
||||||
rate2: original.rate2,
|
|
||||||
rate3: original.rate3,
|
|
||||||
hasMinPrice: original.hasMinPrice,
|
|
||||||
minPrice: original.minPrice,
|
|
||||||
started: Date.vnNew(),
|
|
||||||
ended: Date.vnNew(),
|
|
||||||
};
|
|
||||||
return { original, copy };
|
return { original, copy };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -300,7 +298,7 @@ function highlightNewRow({ $index: index }) {
|
||||||
row.classList.add('highlight');
|
row.classList.add('highlight');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
row.classList.remove('highlight');
|
row.classList.remove('highlight');
|
||||||
}, 3000); // Duración de la animación en milisegundos
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const openEditTableCellDialog = () => {
|
const openEditTableCellDialog = () => {
|
||||||
|
@ -411,9 +409,13 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
url="FixedPrices/filter"
|
url="FixedPrices/filter"
|
||||||
:order="['itemFk DESC', 'name DESC']"
|
:order="['itemFk DESC', 'name DESC']"
|
||||||
save-url="FixedPrices/crud"
|
save-url="FixedPrices/crud"
|
||||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
dense
|
dense
|
||||||
|
:filter="{
|
||||||
|
where: {
|
||||||
|
warehouseFk: user.warehouseFk,
|
||||||
|
},
|
||||||
|
}"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -427,7 +429,6 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
disableInfiniteScroll: true,
|
disableInfiniteScroll: true,
|
||||||
}"
|
}"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="rowsSelected"
|
||||||
:row-click="saveOnRowChange"
|
|
||||||
:create-as-dialog="false"
|
:create-as-dialog="false"
|
||||||
:create="{
|
:create="{
|
||||||
onDataSaved: handleOnDataSave,
|
onDataSaved: handleOnDataSave,
|
||||||
|
|
|
@ -78,29 +78,32 @@ async function setItemTypeData(data) {
|
||||||
{{ t('globals.summary.basicData') }}
|
{{ t('globals.summary.basicData') }}
|
||||||
<QIcon name="open_in_new" />
|
<QIcon name="open_in_new" />
|
||||||
</router-link>
|
</router-link>
|
||||||
<VnLv :label="t('summary.id')" :value="itemType.id" />
|
<VnLv :label="t('itemType.summary.id')" :value="itemType.id" />
|
||||||
<VnLv :label="t('shared.code')" :value="itemType.code" />
|
<VnLv :label="t('itemType.shared.code')" :value="itemType.code" />
|
||||||
<VnLv :label="t('shared.name')" :value="itemType.name" />
|
<VnLv :label="t('itemType.shared.name')" :value="itemType.name" />
|
||||||
<VnLv :label="t('shared.worker')">
|
<VnLv :label="t('itemType.shared.worker')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">{{ itemType.worker?.firstName }}</span>
|
<span class="link">{{ itemType.worker?.firstName }}</span>
|
||||||
<WorkerDescriptorProxy :id="itemType.worker?.id" />
|
<WorkerDescriptorProxy :id="itemType.worker?.id" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('shared.category')" :value="itemType.category?.name" />
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('shared.temperature')"
|
:label="t('itemType.shared.category')"
|
||||||
|
:value="itemType.category?.name"
|
||||||
|
/>
|
||||||
|
<VnLv
|
||||||
|
:label="t('itemType.shared.temperature')"
|
||||||
:value="itemType.temperature?.name"
|
:value="itemType.temperature?.name"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('summary.life')" :value="itemType.life" />
|
<VnLv :label="t('itemType.summary.life')" :value="itemType.life" />
|
||||||
<VnLv :label="t('summary.promo')" :value="itemType.promo" />
|
<VnLv :label="t('itemType.summary.promo')" :value="itemType.promo" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('summary.itemPackingType')"
|
:label="t('itemType.summary.itemPackingType')"
|
||||||
:value="itemType.itemPackingType?.description"
|
:value="itemType.itemPackingType?.description"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
class="large-label"
|
class="large-label"
|
||||||
:label="t('summary.isUnconventionalSize')"
|
:label="t('itemType.summary.isUnconventionalSize')"
|
||||||
:value="itemType.isUnconventionalSize"
|
:value="itemType.isUnconventionalSize"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
itemType:
|
||||||
shared:
|
shared:
|
||||||
code: Code
|
code: Code
|
||||||
name: Name
|
name: Name
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
itemType:
|
||||||
shared:
|
shared:
|
||||||
code: Código
|
code: Código
|
||||||
name: Nombre
|
name: Nombre
|
||||||
|
|
|
@ -59,7 +59,11 @@ const getLocale = (label) => {
|
||||||
</template>
|
</template>
|
||||||
<template #customTags="{ params, searchFn, formatFn }">
|
<template #customTags="{ params, searchFn, formatFn }">
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-if="params.scopeDays !== null"
|
v-if="
|
||||||
|
params.scopeDays !== undefined ||
|
||||||
|
params.scopeDays !== '' ||
|
||||||
|
params.scopeDays !== null
|
||||||
|
"
|
||||||
removable
|
removable
|
||||||
@remove="handleScopeDays(params, null, searchFn)"
|
@remove="handleScopeDays(params, null, searchFn)"
|
||||||
>
|
>
|
||||||
|
@ -197,6 +201,18 @@ const getLocale = (label) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelect
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
rounded
|
||||||
|
:label="t('globals.params.countryFk')"
|
||||||
|
v-model="params.countryFk"
|
||||||
|
url="Countries"
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
@ -15,6 +15,8 @@ import { toCurrency, dateRange, dashIfEmpty } from 'src/filters';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
||||||
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
||||||
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
|
import { useStateStore } from 'src/stores/useStateStore';
|
||||||
|
|
||||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -23,9 +25,21 @@ const tableRef = ref(null);
|
||||||
const provinceOpts = ref([]);
|
const provinceOpts = ref([]);
|
||||||
const stateOpts = ref([]);
|
const stateOpts = ref([]);
|
||||||
const zoneOpts = ref([]);
|
const zoneOpts = ref([]);
|
||||||
const visibleColumns = ref([]);
|
const stateStore = useStateStore();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
|
||||||
const [from, to] = dateRange(Date.vnNew());
|
const [from, to] = dateRange(Date.vnNew());
|
||||||
|
const stateColors = {
|
||||||
|
notice: 'info',
|
||||||
|
success: 'positive',
|
||||||
|
warning: 'warning',
|
||||||
|
alert: 'negative',
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
stateStore.leftDrawer = false;
|
||||||
|
stateStore.rightDrawer = false;
|
||||||
|
});
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -220,7 +234,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('salesTicketsTable.goToLines'),
|
title: t('salesTicketsTable.goToLines'),
|
||||||
icon: 'vn:lines',
|
icon: 'vn:lines',
|
||||||
color: 'priamry',
|
color: 'primary',
|
||||||
action: (row) => openTab(row.id),
|
action: (row) => openTab(row.id),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -231,7 +245,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('salesTicketsTable.preview'),
|
title: t('salesTicketsTable.preview'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
color: 'priamry',
|
color: 'primary',
|
||||||
action: (row) => viewSummary(row.id, TicketSummary),
|
action: (row) => viewSummary(row.id, TicketSummary),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -249,10 +263,10 @@ const getBadgeAttrs = (date) => {
|
||||||
let timeTicket = new Date(date);
|
let timeTicket = new Date(date);
|
||||||
timeTicket.setHours(0, 0, 0, 0);
|
timeTicket.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
let comparation = today - timeTicket;
|
let timeDiff = today - timeTicket;
|
||||||
|
|
||||||
if (comparation == 0) return { color: 'warning', 'text-color': 'black' };
|
if (timeDiff == 0) return { color: 'warning', 'text-color': 'black' };
|
||||||
if (comparation < 0) return { color: 'success', 'text-color': 'black' };
|
if (timeDiff < 0) return { color: 'success', 'text-color': 'black' };
|
||||||
return { color: 'transparent', 'text-color': 'white' };
|
return { color: 'transparent', 'text-color': 'white' };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -267,13 +281,6 @@ const autoRefreshHandler = (value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stateColors = {
|
|
||||||
notice: 'info',
|
|
||||||
success: 'positive',
|
|
||||||
warning: 'warning',
|
|
||||||
alert: 'negative',
|
|
||||||
};
|
|
||||||
|
|
||||||
const totalPriceColor = (ticket) => {
|
const totalPriceColor = (ticket) => {
|
||||||
const total = parseInt(ticket.totalWithVat);
|
const total = parseInt(ticket.totalWithVat);
|
||||||
if (total > 0 && total < 50) return 'warning';
|
if (total > 0 && total < 50) return 'warning';
|
||||||
|
@ -281,10 +288,10 @@ const totalPriceColor = (ticket) => {
|
||||||
|
|
||||||
const formatShippedDate = (date) => {
|
const formatShippedDate = (date) => {
|
||||||
if (!date) return '-';
|
if (!date) return '-';
|
||||||
const split1 = date.split('T');
|
const dateSplit = date.split('T');
|
||||||
const [year, month, day] = split1[0].split('-');
|
const [year, month, day] = dateSplit[0].split('-');
|
||||||
const _date = new Date(year, month - 1, day);
|
const newDate = new Date(year, month - 1, day);
|
||||||
return toDateFormat(_date);
|
return toDateFormat(newDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTab = (id) =>
|
const openTab = (id) =>
|
||||||
|
@ -332,7 +339,6 @@ const openTab = (id) =>
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:offset="50"
|
:offset="50"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:visible-columns="visibleColumns"
|
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -362,61 +368,7 @@ const openTab = (id) =>
|
||||||
</QCheckbox>
|
</QCheckbox>
|
||||||
</template>
|
</template>
|
||||||
<template #column-totalProblems="{ row }">
|
<template #column-totalProblems="{ row }">
|
||||||
<span>
|
<TicketProblems :row="row" />
|
||||||
<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 }}</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>
|
</template>
|
||||||
<template #column-id="{ row }">
|
<template #column-id="{ row }">
|
||||||
<span class="link" @click.stop.prevent>
|
<span class="link" @click.stop.prevent>
|
||||||
|
@ -471,7 +423,7 @@ const openTab = (id) =>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
<template #column-zoneFk="{ row }">
|
<template #column-zoneFk="{ row }">
|
||||||
<div @click.stop.prevent :title="row.zoneName">
|
<div v-if="row.zoneFk" @click.stop.prevent :title="row.zoneName">
|
||||||
<span class="link">{{ row.zoneName }}</span>
|
<span class="link">{{ row.zoneName }}</span>
|
||||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -49,7 +49,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QForm @submit="applyTags()" class="all-pointer-events">
|
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||||
<QCard class="q-pa-sm column q-pa-lg">
|
<QCard class="q-pa-sm column q-pa-lg" data-cy="catalogFilterValueDialog">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.tag')"
|
:label="t('params.tag')"
|
||||||
v-model="selectedTag"
|
v-model="selectedTag"
|
||||||
|
@ -63,6 +63,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
use-input
|
use-input
|
||||||
@update:model-value="getSelectedTagValues"
|
@update:model-value="getSelectedTagValues"
|
||||||
|
data-cy="catalogFilterValueDialogTagSelect"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in tagValues"
|
v-for="(value, index) in tagValues"
|
||||||
|
@ -93,6 +94,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:disable="!value"
|
:disable="!value"
|
||||||
is-outlined
|
is-outlined
|
||||||
class="col"
|
class="col"
|
||||||
|
data-cy="catalogFilterValueDialogValueInput"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="delete"
|
icon="delete"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
import { onMounted, onUnmounted, ref, computed, watch, provide, nextTick } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
|
@ -18,6 +18,7 @@ const dataKey = 'OrderCatalogList';
|
||||||
const arrayData = useArrayData(dataKey);
|
const arrayData = useArrayData(dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const tags = ref([]);
|
const tags = ref([]);
|
||||||
|
const itemRefs = ref({});
|
||||||
|
|
||||||
let catalogParams = {
|
let catalogParams = {
|
||||||
orderFk: route.params.id,
|
orderFk: route.params.id,
|
||||||
|
@ -76,6 +77,19 @@ watch(
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
const onItemSaved = (updatedItem) => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
scrollToItem(updatedItem.items[0].itemFk);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollToItem = async (id) => {
|
||||||
|
const element = itemRefs.value[id]?.$el;
|
||||||
|
if (element) {
|
||||||
|
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
provide('onItemSaved', onItemSaved);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -98,7 +112,7 @@ watch(
|
||||||
/>
|
/>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md" data-cy="orderCatalogPage">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
|
@ -115,9 +129,11 @@ watch(
|
||||||
<CatalogItem
|
<CatalogItem
|
||||||
v-for="row in rows"
|
v-for="row in rows"
|
||||||
:key="row.id"
|
:key="row.id"
|
||||||
|
:ref="(el) => (itemRefs[row.id] = el)"
|
||||||
:item="row"
|
:item="row"
|
||||||
is-catalog
|
is-catalog
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
|
data-cy="orderCatalogItem"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -178,6 +178,7 @@ function addOrder(value, field, params) {
|
||||||
? resetCategory(params, searchFn)
|
? resetCategory(params, searchFn)
|
||||||
: removeTagGroupParam(params, searchFn, valIndex)
|
: removeTagGroupParam(params, searchFn, valIndex)
|
||||||
"
|
"
|
||||||
|
data-cy="catalogFilterCustomTag"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
||||||
{{
|
{{
|
||||||
|
@ -211,6 +212,7 @@ function addOrder(value, field, params) {
|
||||||
:name="category.icon"
|
:name="category.icon"
|
||||||
class="category-icon"
|
class="category-icon"
|
||||||
@click="selectCategory(params, category, searchFn)"
|
@click="selectCategory(params, category, searchFn)"
|
||||||
|
data-cy="catalogFilterCategory"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t(category.name) }}
|
{{ t(category.name) }}
|
||||||
|
@ -234,6 +236,7 @@ function addOrder(value, field, params) {
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
:disable="!params.categoryFk"
|
:disable="!params.categoryFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
data-cy="catalogFilterType"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -285,6 +288,7 @@ function addOrder(value, field, params) {
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
v-model="searchByTag"
|
v-model="searchByTag"
|
||||||
@keyup.enter="(val) => onSearchByTag(val, params)"
|
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||||
|
data-cy="catalogFilterValueInput"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" />
|
<QIcon name="search" />
|
||||||
|
@ -297,6 +301,7 @@ function addOrder(value, field, params) {
|
||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
dense
|
dense
|
||||||
|
data-cy="catalogFilterValueDialogBtn"
|
||||||
/>
|
/>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<CatalogFilterValueDialog
|
<CatalogFilterValueDialog
|
||||||
|
|
|
@ -1,41 +1,53 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import toCurrency from '../../../filters/toCurrency';
|
import toCurrency from 'src/filters/toCurrency';
|
||||||
import { ref } from 'vue';
|
import { inject, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import useNotify from 'composables/useNotify';
|
import useNotify from 'composables/useNotify';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const emit = defineEmits(['added']);
|
const emit = defineEmits(['added']);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
prices: {
|
item: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const onItemSaved = inject('onItemSaved');
|
||||||
const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
const prices = ref((props.item.prices || []).map((item) => ({ ...item, quantity: 0 })));
|
||||||
const descriptorData = useArrayData('orderData');
|
const descriptorData = useArrayData('orderData');
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const addToOrder = async () => {
|
const addToOrder = async () => {
|
||||||
if (isLoading.value) return;
|
if (isLoading.value) return;
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const items = (fields.value || []).filter((item) => Number(item.quantity) > 0);
|
const items = (prices.value || []).filter((item) => Number(item.quantity) > 0);
|
||||||
await axios.post('/OrderRows/addToOrder', {
|
await axios.post('/OrderRows/addToOrder', {
|
||||||
items,
|
items,
|
||||||
orderFk: Number(route.params.id),
|
orderFk: Number(route.params.id),
|
||||||
});
|
});
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
emit('added');
|
await descriptorData.fetch({});
|
||||||
descriptorData.fetch({});
|
onItemSaved({ ...props, items, saved: true });
|
||||||
|
emit('added', items);
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
};
|
};
|
||||||
const canAddToOrder = () => {
|
const canAddToOrder = () => {
|
||||||
return (fields.value || []).some((item) => Number(item.quantity) > 0);
|
let canAddToOrder = (prices.value || []).some((price) => Number(price.quantity) > 0);
|
||||||
|
if (canAddToOrder) {
|
||||||
|
const excedQuantity = prices.value.reduce(
|
||||||
|
(acc, { quantity }) => acc + quantity,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
if (excedQuantity > props.item.available) {
|
||||||
|
canAddToOrder = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return canAddToOrder;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -44,30 +56,33 @@ const canAddToOrder = () => {
|
||||||
<QForm @submit="addToOrder">
|
<QForm @submit="addToOrder">
|
||||||
<QMarkupTable class="shadow-0">
|
<QMarkupTable class="shadow-0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="item in fields" :key="item.warehouse">
|
<tr v-for="price in prices" :key="price.warehouse">
|
||||||
<td class="text-bold q-pr-md td" style="width: 35%">
|
<td class="text-bold q-pr-md td" style="width: 35%">
|
||||||
{{ item.warehouse }}
|
{{ price.warehouse }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right" style="width: 35%">
|
<td class="text-right" style="width: 35%">
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
@click="
|
@click.shift="
|
||||||
() => {
|
() => {
|
||||||
item.quantity += item.grouping;
|
price.quantity -= price.grouping;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@click.exact="
|
||||||
|
() => {
|
||||||
|
price.quantity += price.grouping;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ item.grouping }}
|
{{ price.grouping }}
|
||||||
</span>
|
</span>
|
||||||
x {{ toCurrency(item.price) }}
|
x {{ toCurrency(price.price) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<QInput
|
<VnInputNumber
|
||||||
v-model.number="item.quantity"
|
v-model.number="price.quantity"
|
||||||
type="number"
|
:step="price.grouping"
|
||||||
:step="item.grouping"
|
|
||||||
min="0"
|
min="0"
|
||||||
dense
|
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { onMounted, ref } from 'vue';
|
import { reactive, onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
|
@ -9,7 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
import { reactive } from 'vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -48,10 +47,6 @@ const fetchAgencyList = async (landed, addressFk) => {
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const fetchOrderDetails = (order) => {
|
|
||||||
// fetchAddressList(order?.addressFk);
|
|
||||||
// fetchAgencyList(order?.landed, order?.addressFk);
|
|
||||||
// };
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
clientFk: {
|
clientFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -63,39 +58,6 @@ const initialFormState = reactive({
|
||||||
addressId: null,
|
addressId: null,
|
||||||
clientFk: $props.clientFk,
|
clientFk: $props.clientFk,
|
||||||
});
|
});
|
||||||
// const orderMapper = (order) => {
|
|
||||||
// return {
|
|
||||||
// addressId: order.addressFk,
|
|
||||||
// agencyModeId: order.agencyModeFk,
|
|
||||||
// landed: new Date(order.landed).toISOString(),
|
|
||||||
// };
|
|
||||||
// };
|
|
||||||
// const orderFilter = {
|
|
||||||
// include: [
|
|
||||||
// { relation: 'agencyMode', scope: { fields: ['name'] } },
|
|
||||||
// {
|
|
||||||
// relation: 'address',
|
|
||||||
// scope: { fields: ['nickname'] },
|
|
||||||
// },
|
|
||||||
// { relation: 'rows', scope: { fields: ['id'] } },
|
|
||||||
// {
|
|
||||||
// relation: 'client',
|
|
||||||
// scope: {
|
|
||||||
// fields: [
|
|
||||||
// 'salesPersonFk',
|
|
||||||
// 'name',
|
|
||||||
// 'isActive',
|
|
||||||
// 'isFreezed',
|
|
||||||
// 'isTaxDataChecked',
|
|
||||||
// ],
|
|
||||||
// include: {
|
|
||||||
// relation: 'salesPersonUser',
|
|
||||||
// scope: { fields: ['id', 'name'] },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// };
|
|
||||||
|
|
||||||
const onClientChange = async (clientId = $props.clientFk) => {
|
const onClientChange = async (clientId = $props.clientFk) => {
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
|
|
|
@ -223,10 +223,10 @@ function navigate(id) {
|
||||||
router.push({ path: `/route/${id}` });
|
router.push({ path: `/route/${id}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
const cloneRoutes = () => {
|
const cloneRoutes = async () => {
|
||||||
if (!selectedRows.value.length || !startingDate.value) return;
|
if (!selectedRows.value.length || !startingDate.value) return;
|
||||||
axios.post('Routes/clone', {
|
await axios.post('Routes/clone', {
|
||||||
created: startingDate.value,
|
dated: startingDate.value,
|
||||||
ids: selectedRows.value.map((row) => row?.id),
|
ids: selectedRows.value.map((row) => row?.id),
|
||||||
});
|
});
|
||||||
startingDate.value = null;
|
startingDate.value = null;
|
||||||
|
@ -274,7 +274,6 @@ const openTicketsDialog = (id) => {
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p>
|
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
|
||||||
<QCardSection class="q-pt-none">
|
<QCardSection class="q-pt-none">
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('route.Stating date')"
|
:label="t('route.Stating date')"
|
||||||
|
|
|
@ -24,13 +24,14 @@ const supplier = ref(null);
|
||||||
const supplierAccountRef = ref(null);
|
const supplierAccountRef = ref(null);
|
||||||
const wireTransferFk = ref(null);
|
const wireTransferFk = ref(null);
|
||||||
const bankEntitiesOptions = ref([]);
|
const bankEntitiesOptions = ref([]);
|
||||||
|
const filteredBankEntitiesOptions = ref([]);
|
||||||
|
|
||||||
const onBankEntityCreated = async (dataSaved, rowData) => {
|
const onBankEntityCreated = async (dataSaved, rowData) => {
|
||||||
await bankEntitiesRef.value.fetch();
|
await bankEntitiesRef.value.fetch();
|
||||||
rowData.bankEntityFk = dataSaved.id;
|
rowData.bankEntityFk = dataSaved.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChangesSaved = () => {
|
const onChangesSaved = async () => {
|
||||||
if (supplier.value.payMethodFk !== wireTransferFk.value)
|
if (supplier.value.payMethodFk !== wireTransferFk.value)
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
|
@ -55,12 +56,35 @@ const setWireTransfer = async () => {
|
||||||
await axios.patch(`Suppliers/${route.params.id}`, params);
|
await axios.patch(`Suppliers/${route.params.id}`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function findBankFk(value, row) {
|
||||||
|
row.bankEntityFk = null;
|
||||||
|
if (!value) return;
|
||||||
|
|
||||||
|
const bankEntityFk = bankEntitiesOptions.value.find((b) => b.id == value.slice(4, 8));
|
||||||
|
if (bankEntityFk) row.bankEntityFk = bankEntityFk.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bankEntityFilter(val, update) {
|
||||||
|
update(() => {
|
||||||
|
const needle = val.toLowerCase();
|
||||||
|
filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
|
||||||
|
(bank) =>
|
||||||
|
bank.bic.toLowerCase().startsWith(needle) ||
|
||||||
|
bank.name.toLowerCase().includes(needle)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="bankEntitiesRef"
|
ref="bankEntitiesRef"
|
||||||
url="BankEntities"
|
url="BankEntities"
|
||||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
@on-fetch="
|
||||||
|
(data) => {
|
||||||
|
(bankEntitiesOptions = data), (filteredBankEntitiesOptions = data);
|
||||||
|
}
|
||||||
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -98,6 +122,7 @@ const setWireTransfer = async () => {
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('supplier.accounts.iban')"
|
:label="t('supplier.accounts.iban')"
|
||||||
v-model="row.iban"
|
v-model="row.iban"
|
||||||
|
@update:model-value="(value) => findBankFk(value, row)"
|
||||||
:required="true"
|
:required="true"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
|
@ -109,7 +134,9 @@ const setWireTransfer = async () => {
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('worker.create.bankEntity')"
|
:label="t('worker.create.bankEntity')"
|
||||||
v-model="row.bankEntityFk"
|
v-model="row.bankEntityFk"
|
||||||
:options="bankEntitiesOptions"
|
:options="filteredBankEntitiesOptions"
|
||||||
|
:default-filter="false"
|
||||||
|
@filter="(val, update) => bankEntityFilter(val, update)"
|
||||||
option-label="bic"
|
option-label="bic"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
|
|
@ -8,7 +8,7 @@ import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||||
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
|
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
|
||||||
import { toDate } from 'src/filters';
|
import { dateRange, toDate } from 'src/filters';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
@ -35,14 +35,17 @@ const store = arrayData.store;
|
||||||
|
|
||||||
onUnmounted(() => state.unset('SupplierConsumption'));
|
onUnmounted(() => state.unset('SupplierConsumption'));
|
||||||
const dateRanges = computed(() => {
|
const dateRanges = computed(() => {
|
||||||
const { from, to } = arrayData.store?.userParams || {};
|
let { from, to } = arrayData.store?.userParams || {};
|
||||||
return { from, to };
|
return { from, to };
|
||||||
});
|
});
|
||||||
|
|
||||||
const reportParams = computed(() => ({
|
const reportParams = computed(() => {
|
||||||
|
return {
|
||||||
recipientId: Number(route.params.id),
|
recipientId: Number(route.params.id),
|
||||||
...dateRanges.value,
|
to: dateRange(dateRanges.value.to)[1],
|
||||||
}));
|
from: dateRange(dateRanges.value.from)[1],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
async function getSupplierConsumptionData() {
|
async function getSupplierConsumptionData() {
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
|
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -100,10 +101,13 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnAccountNumber
|
||||||
v-model="data.account"
|
v-model="data.account"
|
||||||
:label="t('supplier.fiscalData.account')"
|
:label="t('supplier.fiscalData.account')"
|
||||||
clearable
|
clearable
|
||||||
|
data-cy="supplierFiscalDataAccount"
|
||||||
|
insertable
|
||||||
|
:maxlength="10"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('supplier.fiscalData.sageTaxTypeFk')"
|
:label="t('supplier.fiscalData.sageTaxTypeFk')"
|
||||||
|
|
|
@ -124,8 +124,7 @@ const columns = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
|
||||||
Search suppliers: Search suppliers
|
|
||||||
es:
|
es:
|
||||||
Search suppliers: Buscar proveedores
|
Search suppliers: Buscar proveedores
|
||||||
|
Create Supplier: Crear proveedor
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
|
import { ref, computed, onMounted, onUnmounted, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
@ -10,37 +10,15 @@ import { useStateStore } from 'stores/useStateStore';
|
||||||
import { toCurrency } from 'filters/index';
|
import { toCurrency } from 'filters/index';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
|
||||||
const $props = defineProps({
|
const haveNegatives = defineModel('haveNegatives', { type: Boolean, required: true });
|
||||||
formData: {
|
const formData = defineModel({ type: Object, required: true });
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
haveNegatives: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const emit = defineEmits(['updateForm', 'update:haveNegatives']);
|
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { hasAny } = useRole();
|
const { hasAny } = useRole();
|
||||||
|
|
||||||
const _ticketData = ref($props.formData);
|
|
||||||
const ticketUpdateActions = ref(null);
|
const ticketUpdateActions = ref(null);
|
||||||
const haveNegatives = computed({
|
const rows = computed(() => formData.value?.sale?.items || []);
|
||||||
get: () => $props.haveNegatives,
|
|
||||||
set: (val) => emit('update:haveNegatives', val),
|
|
||||||
});
|
|
||||||
const rows = computed(() => _ticketData.value?.sale?.items || []);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => _ticketData.value,
|
|
||||||
(val) => emit('updateForm', val),
|
|
||||||
{ deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -57,24 +35,28 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'subName',
|
||||||
|
align: 'left',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('basicData.movable'),
|
label: t('basicData.movable'),
|
||||||
name: 'movable',
|
name: 'movable',
|
||||||
align: 'left',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
label: t('basicData.quantity'),
|
label: t('basicData.quantity'),
|
||||||
name: 'quantity',
|
name: 'quantity',
|
||||||
field: 'quantity',
|
field: 'quantity',
|
||||||
align: 'left',
|
classes: 'number',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
label: t('basicData.pricePPU'),
|
label: t('basicData.pricePPU'),
|
||||||
name: 'price',
|
name: 'price',
|
||||||
field: 'price',
|
field: 'price',
|
||||||
align: 'left',
|
classes: 'number',
|
||||||
format: (val) => toCurrency(val),
|
format: (val) => toCurrency(val),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -82,7 +64,7 @@ const columns = computed(() => [
|
||||||
label: t('basicData.newPricePPU'),
|
label: t('basicData.newPricePPU'),
|
||||||
name: 'newPrice',
|
name: 'newPrice',
|
||||||
field: (row) => row.component.newPrice,
|
field: (row) => row.component.newPrice,
|
||||||
align: 'left',
|
classes: 'number',
|
||||||
format: (val) => toCurrency(val),
|
format: (val) => toCurrency(val),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -90,14 +72,15 @@ const columns = computed(() => [
|
||||||
label: t('basicData.difference'),
|
label: t('basicData.difference'),
|
||||||
name: 'difference',
|
name: 'difference',
|
||||||
field: (row) => row.component.difference,
|
field: (row) => row.component.difference,
|
||||||
align: 'left',
|
classes: 'number',
|
||||||
format: (val) => toCurrency(val),
|
format: (val) => toCurrency(val),
|
||||||
|
autoWidth: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const loadDefaultTicketAction = () => {
|
const loadDefaultTicketAction = () => {
|
||||||
const isSalesAssistant = hasAny(['salesAssistant']);
|
const isSalesAssistant = hasAny(['salesAssistant']);
|
||||||
_ticketData.value.option = isSalesAssistant ? 'mana' : 'renewPrices';
|
formData.value.option = isSalesAssistant ? 'mana' : 'renewPrices';
|
||||||
};
|
};
|
||||||
|
|
||||||
const totalPrice = computed(() => {
|
const totalPrice = computed(() => {
|
||||||
|
@ -115,24 +98,25 @@ const totalDifference = computed(() => {
|
||||||
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
|
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
|
||||||
});
|
});
|
||||||
const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||||
const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
|
const haveDifferences = computed(() => formData.value.sale?.haveDifferences);
|
||||||
const ticketHaveNegatives = () => {
|
async function ticketHaveNegatives() {
|
||||||
let _haveNegatives = false;
|
let _haveNegatives = false;
|
||||||
let haveNotNegatives = false;
|
let haveNotNegatives = false;
|
||||||
_ticketData.value.withoutNegatives = false;
|
formData.value.withoutNegatives = false;
|
||||||
_ticketData.value?.sale?.items.forEach((item) => {
|
formData.value?.sale?.items.forEach((item) => {
|
||||||
if (item.quantity > item.movable) _haveNegatives = true;
|
if (item.quantity > item.movable) _haveNegatives = true;
|
||||||
else haveNotNegatives = true;
|
else haveNotNegatives = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences.value;
|
haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences.value;
|
||||||
if (haveNegatives.value) _ticketData.value.withoutNegatives = true;
|
await nextTick();
|
||||||
};
|
if (haveNegatives.value) formData.value.withoutNegatives = true;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
loadDefaultTicketAction();
|
loadDefaultTicketAction();
|
||||||
ticketHaveNegatives();
|
await ticketHaveNegatives();
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
@ -191,7 +175,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
horizontal
|
horizontal
|
||||||
>
|
>
|
||||||
<QRadio
|
<QRadio
|
||||||
v-model="_ticketData.option"
|
v-model="formData.option"
|
||||||
:val="action.code"
|
:val="action.code"
|
||||||
:label="action.description"
|
:label="action.description"
|
||||||
dense
|
dense
|
||||||
|
@ -208,7 +192,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
<QCardSection horizontal class="flex row items-center">
|
<QCardSection horizontal class="flex row items-center">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('basicData.withoutNegatives')"
|
:label="t('basicData.withoutNegatives')"
|
||||||
v-model="_ticketData.withoutNegatives"
|
v-model="formData.withoutNegatives"
|
||||||
:toggle-indeterminate="false"
|
:toggle-indeterminate="false"
|
||||||
/>
|
/>
|
||||||
<QIcon name="info" size="xs" class="q-ml-sm">
|
<QIcon name="info" size="xs" class="q-ml-sm">
|
||||||
|
@ -225,7 +209,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
class="full-width q-mt-md"
|
class="full-width"
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
flat
|
flat
|
||||||
>
|
>
|
||||||
|
@ -238,21 +222,27 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-description="{ row }">
|
<template #body-cell-description="{ row }">
|
||||||
<QTd style="display: contents">
|
<QTd style="min-width: 120px; max-width: 120px">
|
||||||
<div class="column">
|
<div class="column q-pb-xs" style="min-width: 120px">
|
||||||
<span>{{ row.item.name }}</span>
|
<span>{{ row.item.name }}</span>
|
||||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
<FetchedTags :item="row.item" class="full-width" />
|
||||||
<FetchedTags :item="row.item" />
|
|
||||||
</div>
|
</div>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-movable="{ row }">
|
<template #body-cell-subName="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBadge
|
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||||
v-if="_ticketData?.sale?.haveDifferences"
|
</QTd>
|
||||||
|
</template>
|
||||||
|
<template #body-cell-movable="{ row }">
|
||||||
|
<QTd class="number">
|
||||||
|
<QChip
|
||||||
|
v-if="formData?.sale?.haveDifferences"
|
||||||
:text-color="row.quantity > row.movable ? 'black' : 'white'"
|
:text-color="row.quantity > row.movable ? 'black' : 'white'"
|
||||||
:color="row.quantity > row.movable ? 'negative' : 'transparent'"
|
:color="row.quantity > row.movable ? 'negative' : 'transparent'"
|
||||||
:label="row.movable"
|
:label="row.movable"
|
||||||
|
dense
|
||||||
|
square
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -21,7 +21,6 @@ const formData = defineModel({
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['updateForm']);
|
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -38,12 +37,6 @@ const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
const zoneSelectRef = ref();
|
const zoneSelectRef = ref();
|
||||||
|
|
||||||
watch(
|
|
||||||
() => formData.value,
|
|
||||||
(val) => emit('updateForm', val),
|
|
||||||
{ deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => onFormModelInit());
|
onMounted(() => onFormModelInit());
|
||||||
|
|
||||||
const agencyByWarehouseFilter = computed(() => ({
|
const agencyByWarehouseFilter = computed(() => ({
|
||||||
|
|
|
@ -155,18 +155,10 @@ onBeforeMount(async () => await getTicketData());
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
|
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
|
||||||
<TicketBasicDataForm
|
<TicketBasicDataForm v-if="initialDataLoaded" v-model="formData" />
|
||||||
v-if="initialDataLoaded"
|
|
||||||
@update-form="($event) => (formData = $event)"
|
|
||||||
v-model="formData"
|
|
||||||
/>
|
|
||||||
</QStep>
|
</QStep>
|
||||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||||
<TicketBasicData
|
<TicketBasicData v-model="formData" v-model:have-negatives="haveNegatives" />
|
||||||
:form-data="formData"
|
|
||||||
v-model:haveNegatives="haveNegatives"
|
|
||||||
@update-form="($event) => (formData = $event)"
|
|
||||||
/>
|
|
||||||
</QStep>
|
</QStep>
|
||||||
<template #navigation>
|
<template #navigation>
|
||||||
<QStepperNavigation class="flex justify-between">
|
<QStepperNavigation class="flex justify-between">
|
||||||
|
|
|
@ -321,10 +321,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||||
{{ toCurrency(saleComponent.value * row.quantity, 'EUR', 3) }}
|
{{ toCurrency(saleComponent.value * row.quantity, 'EUR', 3) }}
|
||||||
<!-- <QTooltip>
|
|
||||||
{{ saleComponent.component?.name }}:
|
|
||||||
{{ toCurrency(saleComponent.value, 'EUR', 3) }}
|
|
||||||
</QTooltip> -->
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -130,6 +130,7 @@ function ticketFilter(ticket) {
|
||||||
<QBadge
|
<QBadge
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="entity.ticketState.state.classColor"
|
:color="entity.ticketState.state.classColor"
|
||||||
|
data-cy="ticketDescriptorStateBadge"
|
||||||
>
|
>
|
||||||
{{ entity.ticketState.state.name }}
|
{{ entity.ticketState.state.name }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
@ -174,7 +175,7 @@ function ticketFilter(ticket) {
|
||||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="entity.problem.includes('hasRisk')"
|
v-if="entity?.problem?.includes('hasRisk')"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
|
@ -676,7 +676,7 @@ async function uploadDocuware(force) {
|
||||||
<VnConfirm
|
<VnConfirm
|
||||||
ref="weightDialog"
|
ref="weightDialog"
|
||||||
:title="t('Set weight')"
|
:title="t('Set weight')"
|
||||||
:message="t('This ticket may be invoiced, do you want to continue?')"
|
:message="false"
|
||||||
:promise="actions.setWeight"
|
:promise="actions.setWeight"
|
||||||
>
|
>
|
||||||
<template #customHTML>
|
<template #customHTML>
|
||||||
|
@ -741,7 +741,6 @@ es:
|
||||||
Ticket invoiced: Ticket facturado
|
Ticket invoiced: Ticket facturado
|
||||||
Set weight: Establecer peso
|
Set weight: Establecer peso
|
||||||
Weight set: Peso establecido
|
Weight set: Peso establecido
|
||||||
This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar?
|
|
||||||
invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}"
|
invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}"
|
||||||
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
|
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
|
||||||
You are going to delete this ticket: Vas a eliminar este ticket
|
You are going to delete this ticket: Vas a eliminar este ticket
|
||||||
|
|
|
@ -75,6 +75,7 @@ const cancel = () => {
|
||||||
dense
|
dense
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@click="save()"
|
@click="save()"
|
||||||
|
data-cy="saveManaBtn"
|
||||||
>
|
>
|
||||||
{{ t('globals.save') }}
|
{{ t('globals.save') }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -80,12 +80,14 @@ async function handleSave() {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.observationTypeFk"
|
v-model="row.observationTypeFk"
|
||||||
:disable="!!row.id"
|
:disable="!!row.id"
|
||||||
|
data-cy="ticketNotesObservationType"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('basicData.description')"
|
:label="t('basicData.description')"
|
||||||
v-model="row.description"
|
v-model="row.description"
|
||||||
class="col"
|
class="col"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
|
data-cy="ticketNotesDescription"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -93,6 +95,7 @@ async function handleSave() {
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="handleDelete(row)"
|
@click="handleDelete(row)"
|
||||||
|
data-cy="ticketNotesRemoveNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.removeNote') }}
|
{{ t('ticketNotes.removeNote') }}
|
||||||
|
@ -107,6 +110,7 @@ async function handleSave() {
|
||||||
class="fill-icon-on-hover q-ml-md"
|
class="fill-icon-on-hover q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="ticketNotesCrudRef.insert()"
|
@click="ticketNotesCrudRef.insert()"
|
||||||
|
data-cy="ticketNotesAddNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.addNote') }}
|
{{ t('ticketNotes.addNote') }}
|
||||||
|
|
|
@ -181,17 +181,34 @@ const resetChanges = async () => {
|
||||||
arrayData.fetch({ append: false });
|
arrayData.fetch({ append: false });
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
|
const rowToUpdate = ref(null);
|
||||||
|
const changeQuantity = async (sale) => {
|
||||||
|
canProceed.value = await isSalePrepared(sale);
|
||||||
|
if (!canProceed.value) return;
|
||||||
|
if (
|
||||||
|
!sale.itemFk ||
|
||||||
|
sale.quantity == null ||
|
||||||
|
edit.value?.oldQuantity === sale.quantity
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
if (!sale.id) return addSale(sale);
|
||||||
|
|
||||||
const updateQuantity = async (sale) => {
|
|
||||||
const params = { quantity: sale.quantity };
|
|
||||||
try {
|
try {
|
||||||
await axios.post(`Sales/${sale.id}/updateQuantity`, params);
|
if (!rowToUpdate.value) return;
|
||||||
|
rowToUpdate.value = null;
|
||||||
|
await updateQuantity(sale);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sale.quantity = tableRef.value.CrudModelRef.originalData.find(
|
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
||||||
(s) => s.id === sale.id
|
(s) => s.id === sale.id
|
||||||
).quantity;
|
);
|
||||||
|
sale.quantity = quantity;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateQuantity = async ({ quantity, id }) => {
|
||||||
|
const params = { quantity: quantity };
|
||||||
|
await axios.post(`Sales/${id}/updateQuantity`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -219,19 +236,6 @@ const addSale = async (sale) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeQuantity = async (sale) => {
|
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
if (
|
|
||||||
!sale.itemFk ||
|
|
||||||
sale.quantity == null ||
|
|
||||||
edit.value?.oldQuantity === sale.quantity
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
if (!sale.id) return addSale(sale);
|
|
||||||
await updateQuantity(sale);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateConcept = async (sale) => {
|
const updateConcept = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
canProceed.value = await isSalePrepared(sale);
|
||||||
if (!canProceed.value) return;
|
if (!canProceed.value) return;
|
||||||
|
@ -551,6 +555,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:disable="!isTicketEditable || ticketState === 'OK'"
|
:disable="!isTicketEditable || ticketState === 'OK'"
|
||||||
@click="changeTicketState('OK')"
|
@click="changeTicketState('OK')"
|
||||||
|
data-cy="ticketSaleOkStateBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -559,6 +564,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketList.state')"
|
:label="t('ticketList.state')"
|
||||||
:disable="!isTicketEditable"
|
:disable="!isTicketEditable"
|
||||||
|
data-cy="ticketSaleStateDropdown"
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:options="editableStatesOptions"
|
:options="editableStatesOptions"
|
||||||
|
@ -568,6 +574,7 @@ watch(
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="changeTicketState"
|
@update:model-value="changeTicketState"
|
||||||
|
data-cy="ticketSaleStateSelect"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
<TicketSaleMoreActions
|
<TicketSaleMoreActions
|
||||||
|
@ -600,6 +607,7 @@ watch(
|
||||||
icon="vn:splitline"
|
icon="vn:splitline"
|
||||||
:disable="!isTicketEditable || !hasSelectedRows"
|
:disable="!isTicketEditable || !hasSelectedRows"
|
||||||
@click="setTransferParams()"
|
@click="setTransferParams()"
|
||||||
|
data-cy="ticketSaleTransferBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||||
<TicketTransfer
|
<TicketTransfer
|
||||||
|
@ -679,7 +687,13 @@ watch(
|
||||||
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs">
|
<QIcon
|
||||||
|
v-if="row.reserved"
|
||||||
|
color="primary"
|
||||||
|
name="vn:reserva"
|
||||||
|
size="xs"
|
||||||
|
data-cy="ticketSaleReservedIcon"
|
||||||
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketSale.reserved') }}
|
{{ t('ticketSale.reserved') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
@ -756,7 +770,7 @@ watch(
|
||||||
</template>
|
</template>
|
||||||
<template #column-item="{ row }">
|
<template #column-item="{ row }">
|
||||||
<div class="row column full-width justify-between items-start">
|
<div class="row column full-width justify-between items-start">
|
||||||
{{ row?.item?.name }}
|
{{ row?.concept }}
|
||||||
<div v-if="row?.item?.subName" class="subName">
|
<div v-if="row?.item?.subName" class="subName">
|
||||||
{{ row?.item?.subName.toUpperCase() }}
|
{{ row?.item?.subName.toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -768,16 +782,12 @@ watch(
|
||||||
</template>
|
</template>
|
||||||
<template #column-quantity="{ row }">
|
<template #column-quantity="{ row }">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-if="row.isNew"
|
v-if="row.isNew || isTicketEditable"
|
||||||
v-model.number="row.quantity"
|
|
||||||
type="number"
|
type="number"
|
||||||
@blur="changeQuantity(row)"
|
|
||||||
@focus="edit.oldQuantity = row.quantity"
|
|
||||||
/>
|
|
||||||
<VnInput
|
|
||||||
v-else-if="isTicketEditable"
|
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
@blur="changeQuantity(row)"
|
@blur="changeQuantity(row)"
|
||||||
|
@keyup.enter="changeQuantity(row)"
|
||||||
|
@update:model-value="() => (rowToUpdate = row)"
|
||||||
@focus="edit.oldQuantity = row.quantity"
|
@focus="edit.oldQuantity = row.quantity"
|
||||||
/>
|
/>
|
||||||
<span v-else>{{ row.quantity }}</span>
|
<span v-else>{{ row.quantity }}</span>
|
||||||
|
@ -832,7 +842,14 @@ watch(
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" shortcut="+" />
|
<QBtn
|
||||||
|
@click="newOrderFromTicket()"
|
||||||
|
color="primary"
|
||||||
|
fab
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
data-cy="ticketSaleAddToBasketBtn"
|
||||||
|
/>
|
||||||
<QTooltip class="text-no-wrap">
|
<QTooltip class="text-no-wrap">
|
||||||
{{ t('Add item to basket') }}
|
{{ t('Add item to basket') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
|
|
@ -11,7 +11,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { toDateFormat } from 'src/filters/date';
|
import { toDateFormat } from 'src/filters/date';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
|
||||||
const emit = defineEmits(['updateDiscounts', 'getMana', 'refreshTable']);
|
const emit = defineEmits(['updateDiscounts', 'getMana', 'refreshTable']);
|
||||||
|
@ -48,7 +48,7 @@ const { push } = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { dialog } = useQuasar();
|
const { dialog } = useQuasar();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const role = useRole();
|
const acl = useAcl();
|
||||||
const btnDropdownRef = ref(null);
|
const btnDropdownRef = ref(null);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
|
@ -58,8 +58,10 @@ const isClaimable = computed(() => {
|
||||||
if (ticket.value) {
|
if (ticket.value) {
|
||||||
const landedPlusWeek = new Date(ticket.value.landed);
|
const landedPlusWeek = new Date(ticket.value.landed);
|
||||||
landedPlusWeek.setDate(landedPlusWeek.getDate() + 7);
|
landedPlusWeek.setDate(landedPlusWeek.getDate() + 7);
|
||||||
const hasClaimManagerRole = role.hasAny('claimManager');
|
const createAfterDeadline = acl.hasAny([
|
||||||
return landedPlusWeek >= Date.vnNew() || hasClaimManagerRole;
|
{ model: 'Claim', props: 'createAfterDeadline', accessType: 'WRITE' },
|
||||||
|
]);
|
||||||
|
return landedPlusWeek >= Date.vnNew() || createAfterDeadline;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -175,6 +177,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketSale.more')"
|
:label="t('ticketSale.more')"
|
||||||
:disable="disable"
|
:disable="disable"
|
||||||
|
data-cy="ticketSaleMoreActionsDropdown"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||||
|
@ -186,6 +189,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="showSmsDialog('productNotAvailable')"
|
@click="showSmsDialog('productNotAvailable')"
|
||||||
|
data-cy="sendShortageSMSItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
||||||
|
@ -197,12 +201,18 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="calculateSalePrice()"
|
@click="calculateSalePrice()"
|
||||||
|
data-cy="recalculatePriceItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple @click="emit('getMana')">
|
<QItem
|
||||||
|
clickable
|
||||||
|
v-ripple
|
||||||
|
@click="emit('getMana')"
|
||||||
|
data-cy="updateDiscountItem"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -211,6 +221,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-model.number="newDiscount"
|
v-model.number="newDiscount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
|
data-cy="ticketSaleDiscountInput"
|
||||||
/>
|
/>
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -220,6 +231,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="createClaim()"
|
@click="createClaim()"
|
||||||
|
data-cy="createClaimItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
||||||
|
@ -231,6 +243,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(true)"
|
@click="setReserved(true)"
|
||||||
|
data-cy="markAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||||
|
@ -242,12 +255,13 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(false)"
|
@click="setReserved(false)"
|
||||||
|
data-cy="unmarkAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple>
|
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -256,12 +270,22 @@ const createRefund = async (withWarehouse) => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||||
<QList>
|
<QList>
|
||||||
<QItem v-ripple clickable @click="createRefund(true)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(true)"
|
||||||
|
data-cy="ticketSaleRefundWithWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('with warehouse') }}
|
{{ t('with warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="createRefund(false)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(false)"
|
||||||
|
data-cy="ticketSaleRefundWithoutWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('without warehouse') }}
|
{{ t('without warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -471,7 +471,7 @@ const qCheckBoxController = (sale, action) => {
|
||||||
url="Shelvings"
|
url="Shelvings"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="code"
|
option-label="code"
|
||||||
option-value="code"
|
option-value="id"
|
||||||
v-model="row.shelvingFk"
|
v-model="row.shelvingFk"
|
||||||
@update:model-value="updateShelving(row)"
|
@update:model-value="updateShelving(row)"
|
||||||
style="max-width: 120px"
|
style="max-width: 120px"
|
||||||
|
|
|
@ -96,6 +96,7 @@ function toTicketUrl(section) {
|
||||||
ref="summaryRef"
|
ref="summaryRef"
|
||||||
:url="`Tickets/${entityId}/summary`"
|
:url="`Tickets/${entityId}/summary`"
|
||||||
data-key="TicketSummary"
|
data-key="TicketSummary"
|
||||||
|
data-cy="ticketSummary"
|
||||||
>
|
>
|
||||||
<template #header-left>
|
<template #header-left>
|
||||||
<VnToSummary
|
<VnToSummary
|
||||||
|
@ -257,7 +258,7 @@ function toTicketUrl(section) {
|
||||||
<QCard class="vn-one" v-if="entity.notes.length">
|
<QCard class="vn-one" v-if="entity.notes.length">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="toTicketUrl('observation')"
|
:url="toTicketUrl('observation')"
|
||||||
:text="t('ticket.pageTitles.notes')"
|
:text="t('globals.pageTitles.notes')"
|
||||||
/>
|
/>
|
||||||
<QVirtualScroll
|
<QVirtualScroll
|
||||||
:items="entity.notes"
|
:items="entity.notes"
|
||||||
|
|
|
@ -91,7 +91,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
|
||||||
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="transfer.sales"
|
:rows="transfer.sales"
|
||||||
|
|
|
@ -57,6 +57,7 @@ defineExpose({ transferSales });
|
||||||
v-model.number="_transfer.ticketId"
|
v-model.number="_transfer.ticketId"
|
||||||
:label="t('Transfer to ticket')"
|
:label="t('Transfer to ticket')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
data-cy="ticketTransferDestinationTicketInput"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -64,6 +65,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="transferSales(_transfer.ticketId)"
|
@click="transferSales(_transfer.ticketId)"
|
||||||
style="width: 30px"
|
style="width: 30px"
|
||||||
|
data-cy="ticketTransferTransferBtn"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
|
@ -72,6 +74,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
class="full-width q-my-lg"
|
class="full-width q-my-lg"
|
||||||
@click="transferSales()"
|
@click="transferSales()"
|
||||||
|
data-cy="ticketTransferNewTicketBtn"
|
||||||
/>
|
/>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue