0
0
Fork 0

Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into 7909-hotfix-addScroll

This commit is contained in:
Jorge Penadés 2024-09-09 13:03:39 +02:00
commit 5ce3ef8bea
113 changed files with 2101 additions and 1544 deletions

View File

@ -1,3 +1,120 @@
# Version 24.36 - 2024-09-03
### Added 🆕
- Cesta → Se añaden notas
- Trabajadore → Se puede modificar la foto
- General → Recuperar y restaurar contraseña
### Changed 📦
- (General) Modificado filtro lateral
### Fixed 🛠️
- Cesta → Mejoras varias
- Reclamaciones → Mejoras varias
- Usuarios → Mejoras varias
# Version 24.34 - 2024-08-20
### Added 🆕
## Changed 📦
- General → Trabajadores: Migrado de Salix a Lilium
## Fixed 🛠️
- Artículos → General: Arreglados fallos de interfaz
- Fact. Recibidas → General: Arreglados fallos de interfaz
- Trabajadores → General: Arreglados fallos de interfaz
- Usuarios → General: Arreglados fallos de interfaz
- chore: #6900 order params by:jorgep
- chore: refs #6900 drop console log by:jorgep
- chore: refs #6900 drop vnCurrency by:jorgep
- chore: refs #6900 fix e2e tests by:jorgep
- chore: refs #6900 mv rectificative logic by:jorgep
- chore: refs #6900 responsive code by:jorgep
- chore: refs #7283 drop array types by:jorgep
- chore: refs #7283 drop import by:jorgep
- chore: refs #7283 fix e2e logout by:jorgep
- chore: refs #7283 update VnAvatar title handling by:jorgep
- chore: refs #7323 fix test by:jorgep
- chore: refs #7323 remove unused import by:jorgep
- chore: refs #7323drop commented code by:jorgep
- feat(VnCard): use props searchbar by:alexm
- feat(customer): improve basicData to balance by:alexm
- feat(customer_balance): refs #6943 add functionality from salix by:alexm
- feat(customer_balance): refs #6943 translations by:alexm
- feat: refs #6130 husky commitLint config by:pablone
- feat: refs #6130 husky hooks by:pablone
- feat: refs #6900 add InvoiceInSerial by:jorgep
- feat: refs #6900 add locale by:jorgep
- feat: refs #6900 use VnTable & sort filter fields by:jorgep
- feat: refs #7323 add flex-wrap by:jorgep
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
- feat: refs #7323 improve test by:jorgep
### Changed 📦
- refactor(customer_log: use VnLog by:alexm
- refactor(customer_recovery): to vnTable by:alexm
- refactor(customer_webAccess): FormModel by:alexm
- refactor: refs #7283 update avatar size and color by:jorgep
### Fixed 🛠️
- chore: refs #6900 fix e2e tests by:jorgep
- chore: refs #7283 fix e2e logout by:jorgep
- chore: refs #7323 fix test by:jorgep
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
- fix #7355 fix acls list by:carlossa
- fix(VnFilterPanel): emit userParams better by:alexm
- fix(claim_summary): url links (HEAD -> 7864_testToMaster_2434, origin/test, origin/7864_testToMaster_2434, test) by:alexm
- fix(customer_sms: fix reload by:alexm
- fix(twoFactor): unify code login and twoFactor by:alexm
- fix: VnCard VnSearchbar props by:alexm
- fix: accountMailAlias by:alexm
- fix: refs #6130 add commit lint modules by:pablone
- fix: refs #6130 pnpm-lock.yml by:pablone
- fix: refs #6900 improve loading by:jorgep
- fix: refs #6900 improve logic (origin/6900-addSerial) by:jorgep
- fix: refs #6900 improve logic by:jorgep
- fix: refs #6900 rectificative btn reactivity by:jorgep
- fix: refs #6900 use type number by:jorgep
- fix: refs #6900 vat & dueday by:jorgep
- fix: refs #6900 vat, dueday & intrastat by:jorgep
- fix: refs #6989 show entity name & default time from config table by:jorgep
- fix: refs #7283 basicData locale by:jorgep
- fix: refs #7283 itemLastEntries filter by:jorgep
- fix: refs #7283 itemTags & VnImg by:jorgep
- fix: refs #7283 locale by:jorgep
- fix: refs #7283 min-width vnImg by:jorgep
- fix: refs #7283 use vnAvatar & add optional zoom by:jorgep
- fix: refs #7283 userPanel pic by:jorgep
- fix: refs #7323 add department popup by:jorgep
- fix: refs #7323 add locale by:jorgep
- fix: refs #7323 css righ menu by:jorgep
- fix: refs #7323 data-key & add select by:jorgep
- fix: refs #7323 load all opts by:jorgep
- fix: refs #7323 righ menu bug by:jorgep
- fix: refs #7323 use global locale by:jorgep
- fix: refs #7323 use workerFilter (origin/7323-warmfix-fixErrors) by:jorgep
- fix: refs #7323 vnsubtoolbar css by:jorgep
- fix: refs #7323 wrong css by:jorgep
- refs #7355 fix Rol, alias by:carlossa
- refs #7355 fix accountAlias by:carlossa
- refs #7355 fix alias summary by:carlossa
- refs #7355 fix conflicts by:carlossa
- refs #7355 fix create Rol by:carlossa
- refs #7355 fix list by:carlossa
- refs #7355 fix lists redirects summary by:carlossa
- refs #7355 fix roles by:carlossa
- refs #7355 fix search exprBuilder by:carlossa
- refs #7355 fix vnTable by:carlos
# Version 24.32 - 2024-08-06 # Version 24.32 - 2024-08-06
### Added 🆕 ### Added 🆕

View File

@ -0,0 +1,50 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
</script>
<template>
<FormModelPopup
url-create="Expenses"
model="Expense"
:title="t('New expense')"
:form-initial-data="{ id: null, isWithheld: false, name: null }"
@on-data-saved="emit('onDataSaved', $event)"
>
<template #form-inputs="{ data, validate }">
<VnRow>
<VnInput
:label="`${t('globals.code')}`"
v-model="data.id"
:required="true"
:rules="validate('expense.code')"
/>
<QCheckbox
dense
size="sm"
:label="`${t('It\'s a withholding')}`"
v-model="data.isWithheld"
:rules="validate('expense.isWithheld')"
/>
</VnRow>
<VnRow>
<VnInput
:label="`${t('globals.description')}`"
v-model="data.name"
:required="true"
:rules="validate('expense.description')"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New expense: Nuevo gasto
It's a withholding: Es una retención
</i18n>

View File

@ -87,6 +87,10 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
defaultTrim: {
type: Boolean,
default: true,
},
}); });
const emit = defineEmits(['onFetch', 'onDataSaved']); const emit = defineEmits(['onFetch', 'onDataSaved']);
const modelValue = computed( const modelValue = computed(
@ -195,6 +199,7 @@ async function save() {
isLoading.value = true; isLoading.value = true;
try { try {
formData.value = trimData(formData.value);
const body = $props.mapper ? $props.mapper(formData.value) : formData.value; const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
const method = $props.urlCreate ? 'post' : 'patch'; const method = $props.urlCreate ? 'post' : 'patch';
const url = const url =
@ -253,6 +258,14 @@ function updateAndEmit(evt, val, res) {
emit(evt, state.get(modelValue), res); emit(evt, state.get(modelValue), res);
} }
function trimData(data) {
if (!$props.defaultTrim) return data;
for (const key in data) {
if (typeof data[key] == 'string') data[key] = data[key].trim();
}
return data;
}
defineExpose({ defineExpose({
save, save,
isLoading, isLoading,

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { onMounted, ref, reactive } from 'vue'; import { onMounted, watch, ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QSeparator, useQuasar } from 'quasar'; import { QSeparator, useQuasar } from 'quasar';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -29,6 +29,15 @@ onMounted(async () => {
getRoutes(); getRoutes();
}); });
watch(
() => route.matched,
() => {
items.value = [];
getRoutes();
},
{ deep: true }
);
function findMatches(search, item) { function findMatches(search, item) {
const matches = []; const matches = [];
function findRoute(search, item) { function findRoute(search, item) {

View File

@ -315,7 +315,7 @@ defineExpose({
col?.columnFilter !== false && col?.columnFilter !== false &&
col?.name !== 'tableActions' col?.name !== 'tableActions'
" "
v-model="orders[col.name]" v-model="orders[col.orderBy ?? col.name]"
: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"
@ -409,7 +409,7 @@ defineExpose({
style="height: 30px" style="height: 30px"
> >
<VnTableOrder <VnTableOrder
v-model="orders[col.name]" v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name" :name="col.orderBy ?? col.name"
:label="col?.label" :label="col?.label"
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"

View File

@ -26,7 +26,10 @@ const url = computed(() => {
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`; if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
return props.customUrl; return props.customUrl;
}); });
const searchRightDataKey = computed(() => {
if (!props.searchDataKey) return route.name;
return props.searchDataKey;
});
const arrayData = useArrayData(props.dataKey, { const arrayData = useArrayData(props.dataKey, {
url: url.value, url: url.value,
filter: props.filter, filter: props.filter,
@ -62,10 +65,9 @@ if (props.baseUrl) {
<slot name="searchbar" v-if="props.searchDataKey"> <slot name="searchbar" v-if="props.searchDataKey">
<VnSearchbar :data-key="props.searchDataKey" v-bind="props.searchbarProps" /> <VnSearchbar :data-key="props.searchDataKey" v-bind="props.searchbarProps" />
</slot> </slot>
<slot v-else name="searchbar" />
<RightMenu> <RightMenu>
<template #right-panel v-if="props.filterPanel"> <template #right-panel v-if="props.filterPanel">
<component :is="props.filterPanel" :data-key="props.searchDataKey" /> <component :is="props.filterPanel" :data-key="searchRightDataKey" />
</template> </template>
</RightMenu> </RightMenu>
<QPageContainer> <QPageContainer>

View File

@ -37,7 +37,7 @@ const $props = defineProps({
}, },
hiddenTags: { hiddenTags: {
type: Array, type: Array,
default: () => ['filter'], default: () => ['filter', 'search', 'or', 'and'],
}, },
customTags: { customTags: {
type: Array, type: Array,
@ -111,24 +111,23 @@ watch(
const isLoading = ref(false); const isLoading = ref(false);
async function search(evt) { async function search(evt) {
if (evt && $props.disableSubmitEvent) return;
store.filter.where = {};
isLoading.value = true;
const filter = { ...userParams.value, ...$props.modelValue };
store.userParamsChanged = true;
try { try {
if (evt && $props.disableSubmitEvent) return;
store.filter.where = {};
isLoading.value = true;
const filter = { ...userParams.value, ...$props.modelValue };
store.userParamsChanged = true;
const { params: newParams } = await arrayData.addFilter({ const { params: newParams } = await arrayData.addFilter({
params: filter, params: filter,
}); });
userParams.value = newParams; userParams.value = newParams;
if (!$props.showAll && !Object.values(filter).length) store.data = []; if (!$props.showAll && !Object.values(filter).length) store.data = [];
emit('search');
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
emit('search');
} }
async function reload() { async function reload() {
@ -143,29 +142,31 @@ async function reload() {
} }
async function clearFilters() { async function clearFilters() {
isLoading.value = true; try {
store.userParamsChanged = true; isLoading.value = true;
arrayData.reset(['skip', 'filter.skip', 'page']); store.userParamsChanged = true;
// Filtrar los params no removibles arrayData.reset(['skip', 'filter.skip', 'page']);
const removableFilters = Object.keys(userParams.value).filter((param) => // Filtrar los params no removibles
$props.unRemovableParams.includes(param) const removableFilters = Object.keys(userParams.value).filter((param) =>
); $props.unRemovableParams.includes(param)
const newParams = {}; );
// Conservar solo los params que no son removibles const newParams = {};
for (const key of removableFilters) { // Conservar solo los params que no son removibles
newParams[key] = userParams.value[key]; for (const key of removableFilters) {
} newParams[key] = userParams.value[key];
userParams.value = {}; }
userParams.value = { ...newParams }; // Actualizar los params con los removibles userParams.value = {};
await arrayData.applyFilter({ params: userParams.value }); userParams.value = { ...newParams }; // Actualizar los params con los removibles
await arrayData.applyFilter({ params: userParams.value });
if (!$props.showAll) { if (!$props.showAll) {
store.data = []; store.data = [];
}
emit('clear');
emit('update:modelValue', userParams.value);
} finally {
isLoading.value = false;
} }
isLoading.value = false;
emit('clear');
emit('update:modelValue', userParams.value);
} }
const tagsList = computed(() => { const tagsList = computed(() => {
@ -201,8 +202,11 @@ function formatValue(value) {
function sanitizer(params) { function sanitizer(params) {
for (const [key, value] of Object.entries(params)) { for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object') if (typeof value === 'object' && value !== null) {
params[key] = Object.values(value)[0].replaceAll('%', ''); sanitizer(value);
} else if (typeof value === 'string') {
params[key] = value.replaceAll('%', '');
}
} }
return params; return params;
} }

View File

@ -0,0 +1,32 @@
<script setup>
const emit = defineEmits(['submit']);
defineProps({
icon: { type: String, required: false, default: 'phonelink_lock' },
title: { type: String, required: true },
});
</script>
<template>
<QForm @submit="emit('submit')" class="q-gutter-y-md q-pa-lg formCard">
<div class="column items-center">
<QIcon v-if="icon != false" :name="icon" size="xl" color="primary" />
<h5 class="text-center q-my-md">
{{ title }}
</h5>
</div>
<slot></slot>
<div class="q-mt-lg">
<slot name="buttons"></slot>
</div>
</QForm>
</template>
<style lang="scss" scoped>
.formCard {
max-width: 350px;
min-width: 300px;
}
@media (max-width: $breakpoint-xs-max) {
.formCard {
min-width: 100%;
}
}
</style>

View File

@ -104,9 +104,7 @@ onMounted(() => {
}); });
async function search() { async function search() {
const staticParams = Object.entries(store.userParams).filter( const staticParams = Object.entries(store.userParams);
([key, value]) => value && (props.staticParams || []).includes(key)
);
arrayData.reset(['skip', 'page']); arrayData.reset(['skip', 'page']);
if (props.makeFetch) if (props.makeFetch)

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { watch, computed } from 'vue'; import { computed } from 'vue';
import { date } from 'quasar'; import { date } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnAvatar from '../ui/VnAvatar.vue'; import VnAvatar from '../ui/VnAvatar.vue';

View File

@ -0,0 +1,10 @@
import { toCurrency } from 'src/filters';
export function getTotal(rows, key, opts = {}) {
const { currency, cb } = opts;
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
return currency
? toCurrency(total, currency == 'default' ? undefined : currency)
: total;
}

View File

@ -103,10 +103,6 @@ select:-webkit-autofill {
border-radius: 8px; border-radius: 8px;
} }
.card-width {
width: 770px;
}
.vn-card-list { .vn-card-list {
width: 100%; width: 100%;
max-width: 60em; max-width: 60em;
@ -268,3 +264,10 @@ input::-webkit-inner-spin-button {
max-width: 400px; max-width: 400px;
} }
} }
.edit-photo-btn {
position: absolute;
right: 12px;
bottom: 12px;
z-index: 1;
cursor: pointer;
}

View File

@ -0,0 +1,21 @@
// parsing JSON safely
function parseJSON(str, fallback) {
try {
return JSON.parse(str ?? '{}');
} catch (e) {
console.error('Error parsing JSON:', e);
return fallback;
}
}
export default function (route, param) {
// catch route query params
const params = parseJSON(route?.query?.params, {});
// extract and parse filter from params
const { filter: filterStr = '{}' } = params;
const where = parseJSON(filterStr, {})?.where;
if (where && where[param] !== undefined) {
return where[param];
}
return null;
}

View File

@ -11,6 +11,7 @@ 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 getParamWhere from './getParamWhere';
export { export {
toLowerCase, toLowerCase,
@ -26,4 +27,5 @@ export {
toPercentage, toPercentage,
dashIfEmpty, dashIfEmpty,
dateRange, dateRange,
getParamWhere,
}; };

View File

@ -93,6 +93,7 @@ globals:
since: Since since: Since
from: From from: From
to: To to: To
notes: Notes
pageTitles: pageTitles:
logIn: Login logIn: Login
summary: Summary summary: Summary
@ -251,7 +252,11 @@ globals:
privileges: Privileges privileges: Privileges
ldap: LDAP ldap: LDAP
samba: Samba samba: Samba
twoFactor: Two factor
recoverPassword: Recover password
resetPassword: Reset password
serial: Serial serial: Serial
supplier: Supplier
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now
@ -290,14 +295,17 @@ twoFactor:
explanation: >- explanation: >-
Please, enter the verification code that we have sent to your email in the Please, enter the verification code that we have sent to your email in the
next 5 minutes next 5 minutes
pageTitles:
twoFactor: Two-Factor
verifyEmail: verifyEmail:
pageTitles: pageTitles:
verifyEmail: Email verification verifyEmail: Email verification
dashboard: recoverPassword:
pageTitles: userOrEmail: User or recovery email
explanation: >-
We will sent you an email to recover your password
resetPassword:
repeatPassword: Repeat password
passwordNotMatch: Passwords don't match
passwordChanged: Password changed
customer: customer:
list: list:
phone: Phone phone: Phone
@ -684,6 +692,7 @@ invoiceOut:
chooseValidClient: Choose a valid client chooseValidClient: Choose a valid client
chooseValidCompany: Choose a valid company chooseValidCompany: Choose a valid company
chooseValidPrinter: Choose a valid printer chooseValidPrinter: Choose a valid printer
chooseValidSerialType: Choose a serial type
fillDates: Invoice date and the max date should be filled fillDates: Invoice date and the max date should be filled
invoiceDateLessThanMaxDate: Invoice date can not be less than max date invoiceDateLessThanMaxDate: Invoice date can not be less than max date
invoiceWithFutureDate: Exists an invoice with a future date invoiceWithFutureDate: Exists an invoice with a future date
@ -738,56 +747,6 @@ parking:
searchBar: searchBar:
info: You can search by parking code info: You can search by parking code
label: Search parking... label: Search parking...
invoiceIn:
list:
ref: Reference
supplier: Supplier
supplierRef: Supplier ref.
serialNumber: Serial number
serial: Serial
file: File
issued: Issued
isBooked: Is booked
awb: AWB
amount: Amount
card:
issued: Issued
amount: Amount
client: Client
company: Company
customerCard: Customer card
ticketList: Ticket List
vat: Vat
dueDay: Due day
intrastat: Intrastat
summary:
supplier: Supplier
supplierRef: Supplier ref.
currency: Currency
docNumber: Doc number
issued: Expedition date
operated: Operation date
bookEntried: Entry date
bookedDate: Booked date
sage: Sage withholding
vat: Undeductible VAT
company: Company
booked: Booked
expense: Expense
taxableBase: Taxable base
rate: Rate
sageVat: Sage vat
sageTransaction: Sage transaction
dueDay: Date
bank: Bank
amount: Amount
foreignValue: Foreign value
dueTotal: Due day
noMatch: Do not match
code: Code
net: Net
stems: Stems
country: Country
order: order:
field: field:
salesPersonFk: Sales Person salesPersonFk: Sales Person

View File

@ -93,6 +93,7 @@ globals:
since: Desde since: Desde
from: Desde from: Desde
to: Hasta to: Hasta
notes: Notas
pageTitles: pageTitles:
logIn: Inicio de sesión logIn: Inicio de sesión
summary: Resumen summary: Resumen
@ -253,7 +254,11 @@ globals:
packages: Bultos packages: Bultos
ldap: LDAP ldap: LDAP
samba: Samba samba: Samba
twoFactor: Doble factor
recoverPassword: Recuperar contraseña
resetPassword: Restablecer contraseña
serial: Facturas por serie serial: Facturas por serie
supplier: Proveedor
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora
@ -290,14 +295,17 @@ twoFactor:
validate: Validar validate: Validar
insert: Introduce el código de verificación insert: Introduce el código de verificación
explanation: Por favor introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos explanation: Por favor introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos
pageTitles:
twoFactor: Doble factor
verifyEmail: verifyEmail:
pageTitles: pageTitles:
verifyEmail: Verificación de correo verifyEmail: Verificación de correo
dashboard: recoverPassword:
pageTitles: userOrEmail: Usuario o correo de recuperación
explanation: >-
Te enviaremos un correo para restablecer tu contraseña
resetPassword:
repeatPassword: Repetir contraseña
passwordNotMatch: Las contraseñas no coinciden
passwordChanged: Contraseña cambiada
customer: customer:
list: list:
phone: Teléfono phone: Teléfono
@ -690,6 +698,7 @@ invoiceOut:
chooseValidClient: Selecciona un cliente válido chooseValidClient: Selecciona un cliente válido
chooseValidCompany: Selecciona una empresa válida chooseValidCompany: Selecciona una empresa válida
chooseValidPrinter: Selecciona una impresora válida chooseValidPrinter: Selecciona una impresora válida
chooseValidSerialType: Selecciona una tipo de serie válida
fillDates: La fecha de la factura y la fecha máxima deben estar completas fillDates: La fecha de la factura y la fecha máxima deben estar completas
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
invoiceWithFutureDate: Existe una factura con una fecha futura invoiceWithFutureDate: Existe una factura con una fecha futura
@ -782,54 +791,6 @@ parking:
searchBar: searchBar:
info: Puedes buscar por código de parking info: Puedes buscar por código de parking
label: Buscar parking... label: Buscar parking...
invoiceIn:
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
serialNumber: Num. serie
shortIssued: F. emisión
serial: Serie
file: Fichero
issued: Fecha emisión
isBooked: Conciliada
awb: AWB
amount: Importe
card:
issued: Fecha emisión
amount: Importe
client: Cliente
company: Empresa
customerCard: Ficha del cliente
ticketList: Listado de tickets
vat: Iva
dueDay: Fecha de vencimiento
summary:
supplier: Proveedor
supplierRef: Ref. proveedor
currency: Divisa
docNumber: Número documento
issued: Fecha de expedición
operated: Fecha operación
bookEntried: Fecha asiento
bookedDate: Fecha contable
sage: Retención sage
vat: Iva no deducible
company: Empresa
booked: Contabilizada
expense: Gasto
taxableBase: Base imp.
rate: Tasa
sageTransaction: Sage transación
dueDay: Fecha
bank: Caja
amount: Importe
foreignValue: Divisa
dueTotal: Vencimiento
code: Código
net: Neto
stems: Tallos
country: País
department: department:
pageTitles: pageTitles:
basicData: Basic data basicData: Basic data
@ -877,7 +838,7 @@ worker:
card: card:
workerId: ID Trabajador workerId: ID Trabajador
name: Nombre name: Nombre
email: Email email: Correo personal
phone: Teléfono phone: Teléfono
mobile: Móvil mobile: Móvil
active: Activo active: Activo

View File

@ -6,7 +6,6 @@ import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import FetchData from 'components/FetchData.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
@ -24,7 +23,6 @@ const stateStore = useStateStore();
const quasar = useQuasar(); const quasar = useQuasar();
const tableRef = ref(); const tableRef = ref();
const rolesOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -41,14 +39,12 @@ const columns = computed(() => [
name: 'id', name: 'id',
label: t('id'), label: t('id'),
isId: true, isId: true,
field: 'id',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
name: 'model', name: 'model',
label: t('model'), label: t('model'),
field: 'model',
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -56,15 +52,19 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'principalId', name: 'principalId',
label: t('principalId'), label: t('principalId'),
field: 'principalId',
cardVisible: true, cardVisible: true,
component: 'select',
attrs: {
url: 'VnRoles',
optionLabel: 'name',
optionValue: 'name',
},
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'property', name: 'property',
label: t('property'), label: t('property'),
field: 'property',
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -72,7 +72,10 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'accessType', name: 'accessType',
label: t('accessType'), label: t('accessType'),
field: 'accessType', component: 'select',
attrs: {
options: ['READ', 'WRITE', '*'],
},
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -118,13 +121,6 @@ const deleteAcl = async ({ id }) => {
</script> </script>
<template> <template>
<FetchData
url="VnRoles"
:filter="{ fields: ['name'], order: 'name ASC' }"
@on-fetch="(data) => (rolesOptions = data)"
auto-load
/>
<VnSearchbar <VnSearchbar
data-key="AccountAcls" data-key="AccountAcls"
url="ACLs" url="ACLs"
@ -147,7 +143,6 @@ const deleteAcl = async ({ id }) => {
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
:right-search="true" :right-search="true"
:is-editable="true" :is-editable="true"
:use-model="true" :use-model="true"
@ -162,4 +157,15 @@ es:
Are you sure you want to continue?: ¿Seguro que quieres continuar? Are you sure you want to continue?: ¿Seguro que quieres continuar?
Remove ACL: Eliminar Acl Remove ACL: Eliminar Acl
Do you want to remove this ACL?: ¿Quieres eliminar este ACL? Do you want to remove this ACL?: ¿Quieres eliminar este ACL?
principalId: Rol
model: Modelo
en:
New ACL: New ACL
ACL removed: ACL removed
ACL will be removed: ACL will be removed
Are you sure you want to continue?: Are you sure you want to continue?
Remove ACL: Remove ACL
Do you want to remove this ACL?: Do you want to remove this ACL?
principalId: Rol
model: Models
</i18n> </i18n>

View File

@ -60,7 +60,7 @@ const columns = computed(() => [
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountAliasList" data-key="AccountAliasList"
:url="`MailAliases`" url="MailAliases"
:create="{ :create="{
urlCreate: 'MailAliases', urlCreate: 'MailAliases',
title: 'Create MailAlias', title: 'Create MailAlias',
@ -70,7 +70,6 @@ const columns = computed(() => [
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
redirect="account/alias" redirect="account/alias"
:is-editable="true" :is-editable="true"
:use-model="true" :use-model="true"

View File

@ -48,6 +48,14 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'left',
name: 'email',
label: t('email'),
component: 'input',
create: true,
visible: false,
},
{ {
align: 'right', align: 'right',
label: '', label: '',
@ -83,9 +91,9 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
:label="t('account.search')"
data-key="AccountUsers" data-key="AccountUsers"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('account.search')"
:info="t('account.searchInfo')" :info="t('account.searchInfo')"
/> />
@ -96,7 +104,6 @@ const exprBuilder = (param, value) => {
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
redirect="account" redirect="account"
:use-model="true" :use-model="true"
/> />

View File

@ -1,22 +1,8 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import AliasDescriptor from './AliasDescriptor.vue'; import AliasDescriptor from './AliasDescriptor.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
return routeName.value;
});
const searchBarDataKeys = {
AliasBasicData: 'AliasBasicData',
AliasUsers: 'AliasUsers',
};
</script> </script>
<template> <template>
@ -24,12 +10,12 @@ const searchBarDataKeys = {
data-key="Alias" data-key="Alias"
base-url="MailAliases" base-url="MailAliases"
:descriptor="AliasDescriptor" :descriptor="AliasDescriptor"
:search-data-key="searchBarDataKeys[routeName]" search-data-key="AccountAliasList"
:searchbar-props="{ :searchbar-props="{
redirect: !!customRouteRedirectName, url: 'MailAliases',
customRouteRedirectName,
info: t('mailAlias.searchInfo'), info: t('mailAlias.searchInfo'),
label: t('mailAlias.search'), label: t('mailAlias.search'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -37,9 +37,11 @@ watch(
<VnInput v-model="data.nickname" :label="t('account.card.alias')" /> <VnInput v-model="data.nickname" :label="t('account.card.alias')" />
<VnInput v-model="data.email" :label="t('account.card.email')" /> <VnInput v-model="data.email" :label="t('account.card.email')" />
<VnSelect <VnSelect
url="Languages"
v-model="data.lang" v-model="data.lang"
:options="['es', 'en']"
:label="t('account.card.lang')" :label="t('account.card.lang')"
option-value="code"
option-label="code"
/> />
</div> </div>
</template> </template>

View File

@ -1,36 +1,21 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import AccountDescriptor from './AccountDescriptor.vue'; import AccountDescriptor from './AccountDescriptor.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => routeName.value);
const searchBarDataKeys = {
AccountSummary: 'AccountSummary',
AccountInheritedRoles: 'AccountInheritedRoles',
AccountMailForwarding: 'AccountMailForwarding',
AccountMailAlias: 'AccountMailAlias',
AccountPrivileges: 'AccountPrivileges',
AccountLog: 'AccountLog',
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Account" data-key="Account"
:descriptor="AccountDescriptor" :descriptor="AccountDescriptor"
:search-data-key="searchBarDataKeys[routeName]" search-data-key="AccountUsers"
:searchbar-props="{ :searchbar-props="{
redirect: !!customRouteRedirectName, url: 'VnUsers/preview',
customRouteRedirectName,
label: t('account.search'), label: t('account.search'),
info: t('account.searchInfo'), info: t('account.searchInfo'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -1,15 +1,12 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { computed, ref, toRefs } from 'vue'; import { computed, ref, toRefs } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnConfirm from 'src/components/ui/VnConfirm.vue';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
const quasar = useQuasar();
const $props = defineProps({ const $props = defineProps({
hasAccount: { hasAccount: {
type: Boolean, type: Boolean,
@ -35,7 +32,7 @@ async function updateStatusAccount(active) {
account.value.hasAccount = active; account.value.hasAccount = active;
const status = active ? 'enable' : 'disable'; const status = active ? 'enable' : 'disable';
quasar.notify({ notify({
message: t(`account.card.${status}Account.success`), message: t(`account.card.${status}Account.success`),
type: 'positive', type: 'positive',
}); });
@ -44,19 +41,11 @@ async function updateStatusUser(active) {
await axios.patch(`VnUsers/${entityId.value}`, { active }); await axios.patch(`VnUsers/${entityId.value}`, { active });
account.value.active = active; account.value.active = active;
const status = active ? 'activate' : 'deactivate'; const status = active ? 'activate' : 'deactivate';
quasar.notify({ notify({
message: t(`account.card.actions.${status}User.success`), message: t(`account.card.actions.${status}User.success`),
type: 'positive', type: 'positive',
}); });
} }
function setPassword() {
quasar.dialog({
component: CustomerChangePassword,
componentProps: {
id: entityId.value,
},
});
}
const showSyncDialog = ref(false); const showSyncDialog = ref(false);
const syncPassword = ref(null); const syncPassword = ref(null);
const shouldSyncPassword = ref(false); const shouldSyncPassword = ref(false);
@ -66,22 +55,43 @@ async function sync() {
await axios.patch(`Accounts/${account.value.name}/sync`, { await axios.patch(`Accounts/${account.value.name}/sync`, {
params, params,
}); });
quasar.notify({ notify({
message: t('account.card.actions.sync.success'), message: t('account.card.actions.sync.success'),
type: 'positive', type: 'positive',
}); });
} }
const removeAccount = async () => {
try {
await axios.delete(`VnUsers/${account.value.id}`);
notify(t('Account removed'), 'positive');
} catch (error) {
console.error('Error deleting user', error);
}
};
</script> </script>
<template> <template>
<VnConfirm
v-model="showSyncDialog"
:message="t('account.card.actions.sync.message')"
:title="t('account.card.actions.sync.title')"
:promise="sync"
>
<template #customHTML>
{{ shouldSyncPassword }}
<QCheckbox
:label="t('account.card.actions.sync.checkbox')"
v-model="shouldSyncPassword"
class="full-width"
clearable
clear-icon="close"
>
<QIcon style="padding-left: 10px" color="primary" name="info" size="sm">
<QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip>
</QIcon></QCheckbox
>
<QInput
v-if="shouldSyncPassword"
:label="t('login.password')"
v-model="syncPassword"
class="full-width"
clearable
clear-icon="close"
type="password"
/>
</template>
</VnConfirm>
<QItem <QItem
v-if="account.hasAccount" v-if="account.hasAccount"
v-ripple v-ripple
@ -130,10 +140,4 @@ const removeAccount = async () => {
</QItem> </QItem>
<QSeparator /> <QSeparator />
<!-- <QItem @click="removeAccount(id)" v-ripple clickable>
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>
<QItemSection>{{ t('account.card.actions.delete.name') }}</QItemSection>
</QItem> -->
</template> </template>

View File

@ -14,16 +14,11 @@ const rolesOptions = ref([]);
const formModelRef = ref(); const formModelRef = ref();
</script> </script>
<template> <template>
<FetchData <FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
url="VnRoles"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (rolesOptions = data)"
/>
<FormModel <FormModel
ref="formModelRef" ref="formModelRef"
model="AccountPrivileges" model="AccountPrivileges"
:url="`VnUsers/${route.params.id}`" :url="`VnUsers/${route.params.id}/privileges`"
:url-create="`VnUsers/${route.params.id}/privileges`" :url-create="`VnUsers/${route.params.id}/privileges`"
auto-load auto-load
@on-data-saved="formModelRef.fetch()" @on-data-saved="formModelRef.fetch()"

View File

@ -4,9 +4,9 @@ import { computed, ref } from 'vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RoleSummary from './Card/RoleSummary.vue';
const route = useRoute(); const route = useRoute();
const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -16,7 +16,7 @@ const $props = defineProps({
}); });
const tableRef = ref(); const tableRef = ref();
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const { viewSummary } = useSummaryDialog();
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -42,6 +42,18 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('View Summary'),
icon: 'preview',
action: (row) => viewSummary(row.id, RoleSummary),
},
],
},
]); ]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -62,16 +74,12 @@ const exprBuilder = (param, value) => {
</script> </script>
<template> <template>
<template v-if="stateStore.isHeaderMounted()"> <VnSearchbar
<Teleport to="#searchbar"> data-key="Roles"
<VnSearchbar :expr-builder="exprBuilder"
data-key="Roles" :label="t('role.searchRoles')"
:expr-builder="exprBuilder" :info="t('role.searchInfo')"
:label="t('role.searchRoles')" />
:info="t('role.searchInfo')"
/>
</Teleport>
</template>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Roles" data-key="Roles"
@ -87,8 +95,6 @@ const exprBuilder = (param, value) => {
order="id ASC" order="id ASC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
redirect="account/role" redirect="account/role"
:is-editable="true"
/> />
</template> </template>

View File

@ -23,11 +23,6 @@ const { t } = useI18n();
/> />
</div> </div>
</VnRow> </VnRow>
<VnRow>
<div class="col">
<QCheckbox :label="t('mailAlias.isPublic')" v-model="data.isPublic" />
</div>
</VnRow>
</template> </template>
</FormModel> </FormModel>
</template> </template>

View File

@ -1,33 +1,20 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import RoleDescriptor from './RoleDescriptor.vue'; import RoleDescriptor from './RoleDescriptor.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => routeName.value);
const searchBarDataKeys = {
RoleSummary: 'RoleSummary',
RoleBasicData: 'RoleBasicData',
SubRoles: 'SubRoles',
InheritedRoles: 'InheritedRoles',
RoleLog: 'RoleLog',
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Role" data-key="Role"
:descriptor="RoleDescriptor" :descriptor="RoleDescriptor"
:search-data-key="searchBarDataKeys[routeName]" search-data-key="AccountRoles"
:searchbar-props="{ :searchbar-props="{
redirect: !!customRouteRedirectName, url: 'VnRoles',
customRouteRedirectName,
label: t('role.searchRoles'), label: t('role.searchRoles'),
info: t('role.searchInfo'), info: t('role.searchInfo'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -50,7 +50,7 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('claim.attendedBy'), label: t('claim.attendedBy'),
name: 'attendedBy', name: 'attendedBy',
cardVisible: true, orderBy: 'workerFk',
columnFilter: { columnFilter: {
component: 'select', component: 'select',
attrs: { attrs: {
@ -63,6 +63,7 @@ const columns = computed(() => [
optionFilter: 'firstName', optionFilter: 'firstName',
}, },
}, },
cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
@ -77,6 +78,9 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
label: t('claim.state'), label: t('claim.state'),
format: ({ stateCode }) =>
claimFilterRef.value?.states.find(({code}) => code === stateCode)
?.description,
name: 'stateCode', name: 'stateCode',
chip: { chip: {
condition: () => true, condition: () => true,

View File

@ -42,7 +42,7 @@ claim:
pickup: Recoger pickup: Recoger
null: No null: No
agency: Agencia agency: Agencia
delivery: Entrega delivery: Reparto
fileDescription: 'ID de reclamación {claimId} del cliente {clientName} con ID {clientId}' fileDescription: 'ID de reclamación {claimId} del cliente {clientName} con ID {clientId}'
noData: 'No hay imágenes/videos, haz clic aquí o arrastra y suelta el archivo' noData: 'No hay imágenes/videos, haz clic aquí o arrastra y suelta el archivo'
dragDrop: Arrastra y suelta aquí dragDrop: Arrastra y suelta aquí

View File

@ -97,7 +97,12 @@ const title = ref();
:rules="validate('client.salesPersonFk')" :rules="validate('client.salesPersonFk')"
:use-like="false" :use-like="false"
:emit-value="false" :emit-value="false"
@update:model-value="(val) => (title = val?.nickname)" @update:model-value="
(val) => {
title = val?.nickname;
data.salesPersonFk = val?.id;
}
"
> >
<template #prepend> <template #prepend>
<VnAvatar <VnAvatar

View File

@ -1,8 +1,6 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n';
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue'; import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
const { t } = useI18n();
</script> </script>
<template> <template>

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { usePrintService } from 'composables/usePrintService';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
@ -27,7 +28,7 @@ const router = useRouter();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { sendEmail } = usePrintService();
const client = ref({}); const client = ref({});
const hasChanged = ref(false); const hasChanged = ref(false);
const isLoading = ref(false); const isLoading = ref(false);
@ -156,22 +157,33 @@ const onSubmit = async () => {
} }
}; };
const onDataSaved = async ({ const getSamples = async () => {
addressId, try {
companyFk, const filter = { where: { id: initialData.typeFk } };
companyId, let { data } = await axios.get('Samples', {
from, params: { filter: JSON.stringify(filter) },
recipient, });
replyTo, return data[0];
}) => { } catch (error) {
await axios.post(`Clients/${route.params.id}/incoterms-authorization-email`, { notify('errors.create', 'negative');
addressId, }
companyFk, };
companyId,
from, getSamples();
recipient, const onDataSaved = async () => {
replyTo, try {
}); const params = {
recipientId: initialData.recipientId,
recipient: initialData.recipient,
replyTo: initialData.replyTo,
};
setParams(params);
const samplesData = await getSamples();
const path = `${samplesData.model}/${route.params.id}/${samplesData.code}-email`;
await sendEmail(path, params);
} catch (error) {
notify('errors.create', 'negative');
}
toCustomerSamples(); toCustomerSamples();
}; };

View File

@ -19,8 +19,6 @@ const { t } = useI18n();
const { hasAny } = useRole(); const { hasAny } = useRole();
const isAdministrative = () => hasAny(['administrative']); const isAdministrative = () => hasAny(['administrative']);
const suppliersOptions = ref([]);
const travelsOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const currenciesOptions = ref([]); const currenciesOptions = ref([]);
@ -29,20 +27,6 @@ const onFilterTravelSelected = (formData, id) => {
}; };
</script> </script>
<template> <template>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Travels/filter"
:filter="{ fields: ['id', 'warehouseInName'] }"
order="id"
@on-fetch="(data) => (travelsOptions = data)"
auto-load
/>
<FetchData <FetchData
ref="companiesRef" ref="companiesRef"
url="Companies" url="Companies"
@ -71,9 +55,10 @@ const onFilterTravelSelected = (formData, id) => {
<VnSelect <VnSelect
:label="t('entry.basicData.supplier')" :label="t('entry.basicData.supplier')"
v-model="data.supplierFk" v-model="data.supplierFk"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:fields="['id', 'nickname']"
hide-selected hide-selected
:required="true" :required="true"
map-options map-options
@ -92,7 +77,8 @@ const onFilterTravelSelected = (formData, id) => {
<VnSelectDialog <VnSelectDialog
:label="t('entry.basicData.travel')" :label="t('entry.basicData.travel')"
v-model="data.travelFk" v-model="data.travelFk"
:options="travelsOptions" url="Travels/filter"
:fields="['id', 'warehouseInName']"
option-value="id" option-value="id"
option-label="warehouseInName" option-label="warehouseInName"
map-options map-options

View File

@ -26,7 +26,6 @@ const { notify } = useNotify();
const rowsSelected = ref([]); const rowsSelected = ref([]);
const entryBuysPaginateRef = ref(null); const entryBuysPaginateRef = ref(null);
const packagingsOptions = ref(null);
const originalRowDataCopy = ref(null); const originalRowDataCopy = ref(null);
const getInputEvents = (colField, props) => { const getInputEvents = (colField, props) => {
@ -66,7 +65,10 @@ const tableColumnComponents = computed(() => ({
'map-options': true, 'map-options': true,
'use-input': true, 'use-input': true,
'hide-selected': true, 'hide-selected': true,
options: packagingsOptions.value, url: 'Packagings',
fields: ['id'],
where: { freightItemFk: true },
'sort-by': 'id ASC',
dense: true, dense: true,
}, },
event: getInputEvents, event: getInputEvents,
@ -304,13 +306,6 @@ const lockIconType = (groupingMode, mode) => {
</script> </script>
<template> <template>
<FetchData
ref="expensesRef"
url="Packagings"
:filter="{ fields: ['id'], where: { freightItemFk: true }, order: 'id ASC' }"
auto-load
@on-fetch="(data) => (packagingsOptions = data)"
/>
<VnSubToolbar> <VnSubToolbar>
<template #st-actions> <template #st-actions>
<QBtnGroup push style="column-gap: 10px"> <QBtnGroup push style="column-gap: 10px">

View File

@ -20,7 +20,6 @@ const props = defineProps({
const currenciesOptions = ref([]); const currenciesOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const suppliersOptions = ref([]);
const stateStore = useStateStore(); const stateStore = useStateStore();
onMounted(async () => { onMounted(async () => {
@ -45,14 +44,6 @@ onMounted(async () => {
@on-fetch="(data) => (currenciesOptions = data)" @on-fetch="(data) => (currenciesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname', 'name'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -135,9 +126,11 @@ onMounted(async () => {
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
v-model="params.supplierFk" v-model="params.supplierFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="nickname"
hide-selected hide-selected
dense dense
outlined outlined

View File

@ -223,6 +223,10 @@ async function onSubmit() {
autofocus autofocus
/> />
</VnRow> </VnRow>
<VnRow>
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
</VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('Undeductible VAT')" :label="t('Undeductible VAT')"
@ -285,10 +289,6 @@ async function onSubmit() {
</template> </template>
</VnInput> </VnInput>
</VnRow> </VnRow>
<VnRow>
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
</VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('Currency')" :label="t('Currency')"

View File

@ -3,6 +3,8 @@ import VnCard from 'components/common/VnCard.vue';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import InvoiceInFilter from '../InvoiceInFilter.vue'; import InvoiceInFilter from '../InvoiceInFilter.vue';
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue'; import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
import { onBeforeRouteUpdate } from 'vue-router';
import { setRectificative } from '../composables/setRectificative';
const filter = { const filter = {
include: [ include: [
@ -20,6 +22,8 @@ const filter = {
{ relation: 'currency' }, { relation: 'currency' },
], ],
}; };
onBeforeRouteUpdate(async (to) => await setRectificative(to));
</script> </script>
<template> <template>
<VnCard <VnCard

View File

@ -356,10 +356,7 @@ const createInvoiceInCorrection = async () => {
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" /> <VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" /> <VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
<VnLv <VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
:label="t('invoiceIn.card.amount')"
:value="toCurrency(totalAmount, entity.currency?.code)"
/>
<VnLv :label="t('invoiceIn.summary.supplier')"> <VnLv :label="t('invoiceIn.summary.supplier')">
<template #value> <template #value>
<span class="link"> <span class="link">

View File

@ -5,10 +5,10 @@ import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { toCurrency } from 'src/filters';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
@ -71,7 +71,6 @@ async function insert() {
await invoiceInFormRef.value.reload(); await invoiceInFormRef.value.reload();
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
} }
const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, 0);
</script> </script>
<template> <template>
<FetchData <FetchData
@ -154,11 +153,17 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ {{ getTotal(rows, 'amount', { currency: 'default' }) }}
toCurrency(getTotalAmount(rows), invoiceIn.currency.code) </QTd>
}} <QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)">
{{
getTotal(rows, 'foreignValue', {
currency: invoiceIn.currency.code,
})
}}
</template>
</QTd> </QTd>
<QTd />
</QTr> </QTr>
</template> </template>
<template #item="props"> <template #item="props">

View File

@ -2,18 +2,15 @@
import { computed, ref } 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 { toCurrency } from 'src/filters'; import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const arrayData = useArrayData();
const currency = computed(() => arrayData.store.data?.currency?.code);
const invoceInIntrastat = ref([]); const invoceInIntrastat = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const countries = ref([]); const countries = ref([]);
@ -72,9 +69,6 @@ const columns = computed(() => [
}, },
]); ]);
const getTotal = (data, key) =>
data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
const formatOpt = (row, { model, options }, prop) => { const formatOpt = (row, { model, options }, prop) => {
const obj = row[model]; const obj = row[model];
const option = options.find(({ id }) => id == obj); const option = options.find(({ id }) => id == obj);
@ -154,7 +148,7 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ toCurrency(getTotal(rows, 'amount'), currency) }} {{ getTotal(rows, 'amount', { currency: 'default' }) }}
</QTd> </QTd>
<QTd> <QTd>
{{ getTotal(rows, 'net') }} {{ getTotal(rows, 'net') }}

View File

@ -35,7 +35,7 @@ const vatColumns = ref([
name: 'landed', name: 'landed',
label: 'invoiceIn.summary.taxableBase', label: 'invoiceIn.summary.taxableBase',
field: (row) => row.taxableBase, field: (row) => row.taxableBase,
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -64,7 +64,7 @@ const vatColumns = ref([
name: 'rate', name: 'rate',
label: 'invoiceIn.summary.rate', label: 'invoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate), field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -72,7 +72,7 @@ const vatColumns = ref([
name: 'currency', name: 'currency',
label: 'invoiceIn.summary.currency', label: 'invoiceIn.summary.currency',
field: (row) => row.foreignValue, field: (row) => row.foreignValue,
format: (value) => value, format: (val) => val && toCurrency(val, currency.value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -97,7 +97,7 @@ const dueDayColumns = ref([
name: 'amount', name: 'amount',
label: 'invoiceIn.summary.amount', label: 'invoiceIn.summary.amount',
field: (row) => row.amount, field: (row) => row.amount,
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -105,7 +105,7 @@ const dueDayColumns = ref([
name: 'landed', name: 'landed',
label: 'invoiceIn.summary.foreignValue', label: 'invoiceIn.summary.foreignValue',
field: (row) => row.foreignValue, field: (row) => row.foreignValue,
format: (value) => value, format: (val) => val && toCurrency(val, currency.value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -124,7 +124,7 @@ const intrastatColumns = ref([
{ {
name: 'amount', name: 'amount',
label: 'invoiceIn.summary.amount', label: 'invoiceIn.summary.amount',
field: (row) => toCurrency(row.amount, currency.value), field: (row) => toCurrency(row.amount),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -179,7 +179,6 @@ const getTotalTax = (tax) =>
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`; const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</script> </script>
<template> <template>
<CardSummary <CardSummary
data-key="InvoiceInSummary" data-key="InvoiceInSummary"
@ -229,10 +228,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
:label="t('invoiceIn.summary.currency')" :label="t('invoiceIn.summary.currency')"
:value="entity.currency?.code" :value="entity.currency?.code"
/> />
<VnLv <VnLv :label="t('invoiceIn.serial')" :value="`${entity.serial}`" />
:label="t('invoiceIn.summary.docNumber')"
:value="`${entity.serial}/${entity.serialNumber}`"
/>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
@ -293,12 +289,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
<VnLv <VnLv
:label="t('invoiceIn.summary.taxableBase')" :label="t('invoiceIn.summary.taxableBase')"
:value="toCurrency(entity.totals.totalTaxableBase, currency)" :value="toCurrency(entity.totals.totalTaxableBase)"
/>
<VnLv
label="Total"
:value="toCurrency(entity.totals.totalVat, currency)"
/> />
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
<VnLv :label="t('invoiceIn.summary.dueTotal')"> <VnLv :label="t('invoiceIn.summary.dueTotal')">
<template #value> <template #value>
<QChip <QChip
@ -311,7 +304,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
: t('invoiceIn.summary.dueTotal') : t('invoiceIn.summary.dueTotal')
" "
> >
{{ toCurrency(entity.totals.totalDueDay, currency) }} {{ toCurrency(entity.totals.totalDueDay) }}
</QChip> </QChip>
</template> </template>
</VnLv> </VnLv>
@ -350,15 +343,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row> <template #bottom-row>
<QTr class="bg"> <QTr class="bg">
<QTd></QTd> <QTd></QTd>
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
<QTd>{{ <QTd>{{
toCurrency(entity.totals.totalTaxableBase, currency) entity.totals.totalTaxableBaseForeignValue &&
toCurrency(
entity.totals.totalTaxableBaseForeignValue,
currency
)
}}</QTd> }}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{
toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd>
<QTd></QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
@ -384,9 +379,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QTd></QTd> <QTd></QTd>
<QTd></QTd> <QTd></QTd>
<QTd> <QTd>
{{ toCurrency(entity.totals.totalDueDay, currency) }} {{ toCurrency(entity.totals.totalDueDay) }}
</QTd>
<QTd>
{{
entity.totals.totalDueDayForeignValue &&
toCurrency(
entity.totals.totalDueDayForeignValue,
currency
)
}}
</QTd> </QTd>
<QTd></QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
@ -421,7 +424,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row> <template #bottom-row>
<QTr class="bg"> <QTr class="bg">
<QTd></QTd> <QTd></QTd>
<QTd>{{ toCurrency(intrastatTotals.amount, currency) }}</QTd> <QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
<QTd>{{ intrastatTotals.net }}</QTd> <QTd>{{ intrastatTotals.net }}</QTd>
<QTd>{{ intrastatTotals.stems }}</QTd> <QTd>{{ intrastatTotals.stems }}</QTd>
<QTd></QTd> <QTd></QTd>

View File

@ -2,18 +2,17 @@
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { getTotal } from 'src/composables/getTotal';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar();
const arrayData = useArrayData(); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
@ -23,15 +22,7 @@ const expenses = ref([]);
const sageTaxTypes = ref([]); const sageTaxTypes = ref([]);
const sageTransactionTypes = ref([]); const sageTransactionTypes = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const newExpense = ref({
code: undefined,
isWithheld: false,
description: undefined,
});
const invoiceInFormRef = ref(); const invoiceInFormRef = ref();
const expensesRef = ref();
const newExpenseRef = ref();
defineProps({ defineProps({
actionIcon: { actionIcon: {
@ -56,7 +47,7 @@ const columns = computed(() => [
{ {
name: 'taxablebase', name: 'taxablebase',
label: t('Taxable base'), label: t('Taxable base'),
field: (row) => toCurrency(row.taxableBase, currency.value), field: (row) => row.taxableBase,
model: 'taxableBase', model: 'taxableBase',
sortable: true, sortable: true,
tabIndex: 2, tabIndex: 2,
@ -91,7 +82,7 @@ const columns = computed(() => [
label: t('Rate'), label: t('Rate'),
sortable: true, sortable: true,
tabIndex: 5, tabIndex: 5,
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value), field: (row) => taxRate(row, row.taxTypeSageFk),
align: 'left', align: 'left',
}, },
{ {
@ -132,40 +123,6 @@ function taxRate(invoiceInTax) {
return (taxTypeSage / 100) * taxableBase; return (taxTypeSage / 100) * taxableBase;
} }
async function addExpense() {
try {
if (!newExpense.value.code) throw new Error(t(`The code can't be empty`));
if (isNaN(newExpense.value.code))
throw new Error(t(`The code have to be a number`));
if (!newExpense.value.description)
throw new Error(t(`The description can't be empty`));
const data = [
{
id: newExpense.value.code,
isWithheld: newExpense.value.isWithheld,
name: newExpense.value.description,
},
];
await axios.post(`Expenses`, data);
await expensesRef.value.fetch();
quasar.notify({
type: 'positive',
message: t('globals.dataSaved'),
});
newExpenseRef.value.hide();
} catch (error) {
quasar.notify({
type: 'negative',
message: t(`${error.message}`),
});
}
}
const getTotalTaxableBase = (rows) =>
rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
const formatOpt = (row, { model, options }, prop) => { const formatOpt = (row, { model, options }, prop) => {
const obj = row[model]; const obj = row[model];
const option = options.find(({ id }) => id == obj); const option = options.find(({ id }) => id == obj);
@ -207,37 +164,25 @@ const formatOpt = (row, { model, options }, prop) => {
> >
<template #body-cell-expense="{ row, col }"> <template #body-cell-expense="{ row, col }">
<QTd> <QTd>
<VnSelect <VnSelectDialog
v-model="row[col.model]" v-model="row[col.model]"
:options="col.options" :options="col.options"
:option-value="col.optionValue" :option-value="col.optionValue"
:option-label="col.optionLabel" :option-label="col.optionLabel"
:filter-options="['id', 'name']" :filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
{{ `${scope.opt.id}: ${scope.opt.name}` }} {{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItem> </QItem>
</template> </template>
<template #append> <template #form>
<QIcon <CreateNewExpenseForm
name="close" @on-data-saved="$refs.expensesRef.fetch()"
@click.stop="value = null"
class="cursor-pointer"
size="xs"
/> />
<QIcon
@click.stop.prevent="newExpenseRef.show()"
:name="actionIcon"
size="xs"
class="default-icon"
>
<QTooltip>
{{ t('Create expense') }}
</QTooltip>
</QIcon>
</template> </template>
</VnSelect> </VnSelectDialog>
</QTd> </QTd>
</template> </template>
<template #body-cell-taxablebase="{ row }"> <template #body-cell-taxablebase="{ row }">
@ -324,12 +269,24 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ toCurrency(getTotalTaxableBase(rows), currency) }} {{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
</QTd> </QTd>
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> {{ toCurrency(getTotalRate(rows), currency) }}</QTd> <QTd>
<QTd /> {{
getTotal(rows, null, { cb: taxRate, currency: 'default' })
}}</QTd
>
<QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)">
{{
getTotal(rows, 'foreignValue', {
currency: invoiceIn.currency.code,
})
}}
</template>
</QTd>
</QTr> </QTr>
</template> </template>
<template #item="props"> <template #item="props">
@ -341,7 +298,7 @@ const formatOpt = (row, { model, options }, prop) => {
<QSeparator /> <QSeparator />
<QList> <QList>
<QItem> <QItem>
<VnSelect <VnSelectDialog
:label="t('Expense')" :label="t('Expense')"
class="full-width" class="full-width"
v-model="props.row['expenseFk']" v-model="props.row['expenseFk']"
@ -349,13 +306,17 @@ const formatOpt = (row, { model, options }, prop) => {
option-value="id" option-value="id"
option-label="name" option-label="name"
:filter-options="['id', 'name']" :filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
{{ `${scope.opt.id}: ${scope.opt.name}` }} {{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItem> </QItem>
</template> </template>
</VnSelect> <template #form>
<CreateNewExpenseForm />
</template>
</VnSelectDialog>
</QItem> </QItem>
<QItem> <QItem>
<VnInputNumber <VnInputNumber
@ -442,44 +403,6 @@ const formatOpt = (row, { model, options }, prop) => {
</QTable> </QTable>
</template> </template>
</CrudModel> </CrudModel>
<QDialog ref="newExpenseRef">
<QCard>
<QCardSection class="q-pb-none">
<QItem class="q-pa-none">
<span class="text-primary text-h6 full-width">
<QIcon name="edit" class="q-mr-xs" />
{{ t('New expense') }}
</span>
<QBtn icon="close" flat round dense v-close-popup />
</QItem>
</QCardSection>
<QCardSection class="q-pt-none">
<QItem>
<VnInput
:label="`${t('Code')}*`"
v-model="newExpense.code"
:required="true"
/>
<QCheckbox
dense
size="sm"
:label="`${t('It\'s a withholding')}`"
v-model="newExpense.isWithheld"
/>
</QItem>
<QItem>
<VnInput
:label="`${t('Descripction')}*`"
v-model="newExpense.description"
/>
</QItem>
</QCardSection>
<QCardActions class="justify-end">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
<QBtn :label="t('globals.save')" color="primary" @click="addExpense" />
</QCardActions>
</QCard>
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn <QBtn
color="primary" color="primary"
@ -487,7 +410,9 @@ const formatOpt = (row, { model, options }, prop) => {
size="lg" size="lg"
round round
@click="invoiceInFormRef.insert()" @click="invoiceInFormRef.insert()"
/> >
<QTooltip>{{ t('Add tax') }}</QTooltip>
</QBtn>
</QPageSticky> </QPageSticky>
</template> </template>
@ -527,18 +452,11 @@ const formatOpt = (row, { model, options }, prop) => {
<i18n> <i18n>
es: es:
Expense: Gasto Expense: Gasto
Create expense: Crear gasto Create a new expense: Crear nuevo gasto
Add tax: Crear gasto Add tax: Crear gasto
Taxable base: Base imp. Taxable base: Base imp.
Sage tax: Sage iva Sage tax: Sage iva
Sage transaction: Sage transacción Sage transaction: Sage transacción
Rate: Tasa Rate: Tasa
Foreign value: Divisa Foreign value: Divisa
New expense: Nuevo gasto
Code: Código
It's a withholding: Es una retención
Descripction: Descripción
The code can't be empty: El código no puede estar vacío
The description can't be empty: La descripción no puede estar vacía
The code have to be a number: El código debe ser un número.
</i18n> </i18n>

View File

@ -28,6 +28,16 @@ const activities = ref([]);
</div> </div>
</template> </template>
<template #body="{ params, searchFn }"> <template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
@ -64,16 +74,6 @@ const activities = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.serialNumber')"
v-model="params.serialNumber"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -84,15 +84,6 @@ const activities = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('Issued')"
v-model="params.issued"
is-outlined
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -140,22 +131,6 @@ const activities = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QExpansionItem :label="t('More options')" expand-separator>
<QItem>
<QItemSection>
<VnInputDate
:label="t('From')"
v-model="params.from"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
</QExpansionItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
@ -179,6 +154,7 @@ en:
correctedFk: Rectified correctedFk: Rectified
issued: Issued issued: Issued
to: To to: To
from: From
awbCode: AWB awbCode: AWB
correctingFk: Rectificative correctingFk: Rectificative
supplierActivityFk: Supplier activity supplierActivityFk: Supplier activity
@ -201,6 +177,8 @@ es:
correctedFk: Rectificada correctedFk: Rectificada
correctingFk: Rectificativa correctingFk: Rectificativa
supplierActivityFk: Actividad proveedor supplierActivityFk: Actividad proveedor
from: Desde
to: Hasta
From: Desde From: Desde
To: Hasta To: Hasta
Amount: Importe Amount: Importe

View File

@ -47,12 +47,6 @@ const cols = computed(() => [
name: 'supplierRef', name: 'supplierRef',
label: t('invoiceIn.list.supplierRef'), label: t('invoiceIn.list.supplierRef'),
}, },
{
align: 'left',
name: 'serialNumber',
label: t('invoiceIn.list.serialNumber'),
},
{ {
align: 'left', align: 'left',
name: 'serial', name: 'serial',
@ -141,7 +135,7 @@ const cols = computed(() => [
v-model="data.supplierFk" v-model="data.supplierFk"
url="Suppliers" url="Suppliers"
:fields="['id', 'nickname']" :fields="['id', 'nickname']"
:label="t('Supplier')" :label="t('globals.supplier')"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:filter-options="['id', 'name']" :filter-options="['id', 'name']"
@ -162,7 +156,7 @@ const cols = computed(() => [
/> />
<VnSelect <VnSelect
url="Companies" url="Companies"
:label="t('Company')" :label="t('globals.company')"
:fields="['id', 'code']" :fields="['id', 'code']"
v-model="data.companyFk" v-model="data.companyFk"
option-value="id" option-value="id"

View File

@ -0,0 +1,14 @@
import axios from 'axios';
export async function setRectificative(route) {
const card = route.matched.find((route) => route.name === 'InvoiceInCard');
const corrective = card.children.find(
(route) => route.name === 'InvoiceInCorrective'
);
corrective.meta.hidden = !(
await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctingFk: route.params.id } } },
})
).data.length;
}

View File

@ -0,0 +1,49 @@
invoiceIn:
serial: Serial
list:
ref: Reference
supplier: Supplier
supplierRef: Supplier ref.
serial: Serial
file: File
issued: Issued
isBooked: Is booked
awb: AWB
amount: Amount
card:
issued: Issued
amount: Amount
client: Client
company: Company
customerCard: Customer card
ticketList: Ticket List
vat: Vat
dueDay: Due day
intrastat: Intrastat
summary:
supplier: Supplier
supplierRef: Supplier ref.
currency: Currency
issued: Expedition date
operated: Operation date
bookEntried: Entry date
bookedDate: Booked date
sage: Sage withholding
vat: Undeductible VAT
company: Company
booked: Booked
expense: Expense
taxableBase: Taxable base
rate: Rate
sageVat: Sage vat
sageTransaction: Sage transaction
dueDay: Date
bank: Bank
amount: Amount
foreignValue: Foreign value
dueTotal: Due day
noMatch: Do not match
code: Code
net: Net
stems: Stems
country: Country

View File

@ -0,0 +1,47 @@
invoiceIn:
serial: Serie
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
shortIssued: F. emisión
file: Fichero
issued: Fecha emisión
isBooked: Conciliada
awb: AWB
amount: Importe
card:
issued: Fecha emisión
amount: Importe
client: Cliente
company: Empresa
customerCard: Ficha del cliente
ticketList: Listado de tickets
vat: Iva
dueDay: Fecha de vencimiento
summary:
supplier: Proveedor
supplierRef: Ref. proveedor
currency: Divisa
docNumber: Número documento
issued: Fecha de expedición
operated: Fecha operación
bookEntried: Fecha asiento
bookedDate: Fecha contable
sage: Retención sage
vat: Iva no deducible
company: Empresa
booked: Contabilizada
expense: Gasto
taxableBase: Base imp.
rate: Tasa
sageTransaction: Sage transación
dueDay: Fecha
bank: Caja
amount: Importe
foreignValue: Divisa
dueTotal: Vencimiento
code: Código
net: Neto
stems: Tallos
country: País

View File

@ -222,7 +222,7 @@ const showTransferInvoiceForm = async () => {
<QItemSection>{{ t('Generate PDF invoice') }}</QItemSection> <QItemSection>{{ t('Generate PDF invoice') }}</QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable> <QItem v-ripple clickable>
<QItemSection>{{ t('Refund...') }}</QItemSection> <QItemSection>{{ t('Refund') }}</QItemSection>
<QItemSection side> <QItemSection side>
<QIcon name="keyboard_arrow_right" /> <QIcon name="keyboard_arrow_right" />
</QItemSection> </QItemSection>
@ -250,7 +250,7 @@ es:
Delete invoice: Eliminar factura Delete invoice: Eliminar factura
Book invoice: Asentar factura Book invoice: Asentar factura
Generate PDF invoice: Generar PDF factura Generate PDF invoice: Generar PDF factura
Refund...: Abono Refund: Abono
As PDF: como PDF As PDF: como PDF
As CSV: como CSV As CSV: como CSV
Send PDF: Enviar PDF Send PDF: Enviar PDF

View File

@ -176,7 +176,7 @@ const ticketsColumns = ref([
<QTd> <QTd>
<QBtn class="no-uppercase link" flat dense> <QBtn class="no-uppercase link" flat dense>
{{ value }} {{ value }}
<CustomerDescriptorProxy :id="row.id" /> <CustomerDescriptorProxy :id="row.clientFk" />
</QBtn> </QBtn>
</QTd> </QTd>
</template> </template>

View File

@ -94,11 +94,13 @@ const selectCustomerId = (id) => {
}; };
const statusText = computed(() => { const statusText = computed(() => {
return status.value === 'invoicing' const baseStatus = t(`status.${status.value}`);
? `${t(`status.${status.value}`)} ${ const clientId =
addresses.value[getAddressNumber.value]?.clientId status.value === 'invoicing'
}` ? addresses.value[getAddressNumber.value]?.clientId || ''
: t(`status.${status.value}`); : '';
return clientId ? `${baseStatus} ${clientId}`.trim() : baseStatus;
}); });
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => (stateStore.rightDrawer = true));

View File

@ -20,21 +20,25 @@ const { initialDataLoading, formInitialData, invoicing, status } =
const { makeInvoice, setStatusValue } = invoiceOutGlobalStore; const { makeInvoice, setStatusValue } = invoiceOutGlobalStore;
const clientsToInvoice = ref('all'); const clientsToInvoice = ref('all');
const companiesOptions = ref([]); const companiesOptions = ref([]);
const printersOptions = ref([]); const printersOptions = ref([]);
const serialTypesOptions = ref([]);
const clientsOptions = ref([]); const handleInvoiceOutSerialsFetch = (data) => {
serialTypesOptions.value = Array.from(
new Set(data.map((item) => item.type).filter((type) => type))
);
};
const formData = ref({}); const formData = ref({});
const optionsInitialData = computed(() => { const optionsInitialData = computed(() => {
return ( const optionsArrays = [
companiesOptions.value.length > 0 && companiesOptions.value,
printersOptions.value.length > 0 && printersOptions.value,
clientsOptions.value.length > 0 serialTypesOptions.value,
); ];
return optionsArrays.every((arr) => arr.length > 0);
}); });
const getStatus = computed({ const getStatus = computed({
@ -59,8 +63,11 @@ onMounted(async () => {
auto-load auto-load
/> />
<FetchData url="Printers" @on-fetch="(data) => (printersOptions = data)" auto-load /> <FetchData url="Printers" @on-fetch="(data) => (printersOptions = data)" auto-load />
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load /> <FetchData
url="invoiceOutSerials"
@on-fetch="handleInvoiceOutSerialsFetch"
auto-load
/>
<QForm <QForm
v-if="!initialDataLoading && optionsInitialData" v-if="!initialDataLoading && optionsInitialData"
@submit="makeInvoice(formData, clientsToInvoice)" @submit="makeInvoice(formData, clientsToInvoice)"
@ -87,7 +94,21 @@ onMounted(async () => {
v-if="clientsToInvoice === 'one'" v-if="clientsToInvoice === 'one'"
:label="t('client')" :label="t('client')"
v-model="formData.clientId" v-model="formData.clientId"
:options="clientsOptions" url="Clients"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/>
<VnSelect
:label="t('invoiceOutSerialType')"
v-model="formData.serialType"
:options="serialTypesOptions"
option-value="type"
option-label="type"
hide-selected
dense dense
outlined outlined
rounded rounded
@ -160,6 +181,7 @@ en:
printer: Printer printer: Printer
invoiceOut: Invoice out invoiceOut: Invoice out
client: Client client: Client
invoiceOutSerialType: Serial Type
stop: Stop stop: Stop
es: es:
@ -171,5 +193,6 @@ es:
printer: Impresora printer: Impresora
invoiceOut: Facturar invoiceOut: Facturar
client: Cliente client: Cliente
invoiceOutSerialType: Tipo de Serie
stop: Parar stop: Parar
</i18n> </i18n>

View File

@ -198,14 +198,14 @@ watchEffect(selectedRows);
:url="`${MODEL}/filter`" :url="`${MODEL}/filter`"
:create="{ :create="{
urlCreate: 'InvoiceOuts/createManualInvoice', urlCreate: 'InvoiceOuts/createManualInvoice',
title: t('Create Manual Invoice'), title: t('Create manual invoice'),
onDataSaved: ({ id }) => tableRef.redirect(id), onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: { formInitialData: {
active: true, active: true,
}, },
}" }"
v-model:selected="selectedRows" v-model:selected="selectedRows"
order="id DESC" order="issued DESC, id DESC"
:columns="columns" :columns="columns"
redirect="invoice-out" redirect="invoice-out"
auto-load auto-load
@ -242,7 +242,7 @@ watchEffect(selectedRows);
/> />
<VnSelect <VnSelect
url="InvoiceOutSerials" url="InvoiceOutSerials"
v-model="data.invoiceOutSerial" v-model="data.serial"
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')" :label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
:options="invoiceOutSerialsOptions" :options="invoiceOutSerialsOptions"
option-label="description" option-label="description"
@ -254,7 +254,7 @@ watchEffect(selectedRows);
/> />
<VnSelect <VnSelect
url="TaxAreas" url="TaxAreas"
v-model="data.area" v-model="data.taxArea"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')" :label="t('invoiceOutList.tableVisibleColumns.taxArea')"
:options="taxAreasOptions" :options="taxAreasOptions"
option-label="code" option-label="code"
@ -275,10 +275,12 @@ en:
fileAllowed: Successful download of CSV file fileAllowed: Successful download of CSV file
youCanSearchByInvoiceReference: You can search by invoice reference youCanSearchByInvoiceReference: You can search by invoice reference
createInvoice: Make invoice createInvoice: Make invoice
Create manual invoice: Create manual invoice
es: es:
searchInvoice: Buscar factura emitida searchInvoice: Buscar factura emitida
fileDenied: El navegador denegó la descarga de archivos... fileDenied: El navegador denegó la descarga de archivos...
fileAllowed: Descarga exitosa de archivo CSV 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 createInvoice: Crear factura
Create manual invoice: Crear factura manual
</i18n> </i18n>

View File

@ -19,7 +19,7 @@ const props = defineProps({
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
:unremovable-params="['from', 'to']" :un-removable-params="['from', 'to']"
:hidden-tags="['from', 'to']" :hidden-tags="['from', 'to']"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">

View File

@ -16,7 +16,6 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const itemsWithNameOptions = ref([]);
const intrastatsOptions = ref([]); const intrastatsOptions = ref([]);
const expensesOptions = ref([]); const expensesOptions = ref([]);

View File

@ -19,15 +19,6 @@ const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]); const itemBotanicals = ref([]);
let itemBotanicalsForm = reactive({ itemFk: null }); let itemBotanicalsForm = reactive({ itemFk: null });
const onGenusCreated = (response, formData) => {
itemGenusOptions.value = [...itemGenusOptions.value, response];
formData.genusFk = response.id;
};
const onSpecieCreated = (response, formData) => {
itemSpeciesOptions.value = [...itemSpeciesOptions.value, response];
formData.specieFk = response.id;
};
const entityId = computed(() => { const entityId = computed(() => {
return route.params.id; return route.params.id;
}); });
@ -47,18 +38,6 @@ onMounted(async () => {
}" }"
@on-fetch="(data) => (itemBotanicals = data)" @on-fetch="(data) => (itemBotanicals = data)"
/> />
<FetchData
url="Genera"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemGenusOptions = data)"
auto-load
/>
<FetchData
url="Species"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemSpeciesOptions = data)"
auto-load
/>
<FormModel <FormModel
url-update="ItemBotanicals" url-update="ItemBotanicals"
model="entry" model="entry"
@ -69,36 +48,35 @@ onMounted(async () => {
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnSelectDialog <VnSelectDialog
ref="genusRef"
:label="t('Genus')" :label="t('Genus')"
v-model="data.genusFk" v-model="data.genusFk"
:options="itemGenusOptions" url="Genera"
option-label="name" option-label="name"
option-value="id" option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
> >
<template #form> <template #form>
<CreateGenusForm <CreateGenusForm
@on-data-saved=" @on-data-saved="(_, res) => (data.genusFk = res.id)"
(_, requestResponse) =>
onGenusCreated(requestResponse, data)
"
/> />
</template> </template>
</VnSelectDialog> </VnSelectDialog>
<VnSelectDialog <VnSelectDialog
:label="t('Species')" :label="t('Species')"
v-model="data.specieFk" v-model="data.specieFk"
:options="itemSpeciesOptions" url="Species"
option-label="name" option-label="name"
option-value="id" option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
> >
<template #form> <template #form>
<CreateSpecieForm <CreateSpecieForm
@on-data-saved=" @on-data-saved="(_, res) => (data.specieFk = res.id)"
(_, requestResponse) =>
onSpecieCreated(requestResponse, data)
"
/> />
</template> </template>
</VnSelectDialog> </VnSelectDialog>

View File

@ -12,7 +12,7 @@ import ItemListFilter from '../ItemListFilter.vue';
search-data-key="ItemList" search-data-key="ItemList"
:searchbar-props="{ :searchbar-props="{
url: 'Items/filter', url: 'Items/filter',
label: 'searchbar.labelr', label: 'searchbar.label',
info: 'searchbar.info', info: 'searchbar.info',
}" }"
/> />

View File

@ -138,14 +138,6 @@ en:
</i18n> </i18n>
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-photo-btn {
position: absolute;
right: 12px;
bottom: 12px;
z-index: 1;
cursor: pointer;
}
.separation-borders { .separation-borders {
border-left: 1px solid $white; border-left: 1px solid $white;
border-right: 1px solid $white; border-right: 1px solid $white;

View File

@ -42,6 +42,7 @@ const to = ref();
const arrayData = useArrayData('ItemLastEntries', { const arrayData = useArrayData('ItemLastEntries', {
url: 'Items/lastEntriesFilter', url: 'Items/lastEntriesFilter',
order: ['landed DESC', 'buyFk DESC'], order: ['landed DESC', 'buyFk DESC'],
searchUrl: 'itemLastEntries',
exprBuilder: exprBuilder, exprBuilder: exprBuilder,
userFilter: { userFilter: {
where: { where: {

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.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 ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
@ -24,8 +23,6 @@ const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const rowsSelected = ref([]); const rowsSelected = ref([]);
const parkingsOptions = ref([]);
const shelvingsOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -104,7 +101,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: parkingsOptions.value, url: 'parkings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code', 'option-value': 'code',
'option-label': 'code', 'option-label': 'code',
dense: true, dense: true,
@ -124,7 +123,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: shelvingsOptions.value, url: 'shelvings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code', 'option-value': 'code',
'option-label': 'code', 'option-label': 'code',
dense: true, dense: true,
@ -188,18 +189,6 @@ onMounted(async () => {
</script> </script>
<template> <template>
<FetchData
url="parkings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (parkingsOptions = data)"
/>
<FetchData
url="shelvings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<template v-if="stateStore.isHeaderMounted()"> <template v-if="stateStore.isHeaderMounted()">
<Teleport to="#st-data"> <Teleport to="#st-data">
<div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222"> <div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222">
@ -237,7 +226,6 @@ onMounted(async () => {
</QBtn> </QBtn>
</Teleport> </Teleport>
</template> </template>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:rows="rows" :rows="rows"

View File

@ -24,6 +24,7 @@ const getSelectedTagValues = async (tag) => {
const filter = { const filter = {
fields: ['value'], fields: ['value'],
order: 'value ASC', order: 'value ASC',
limit: 30,
}; };
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
@ -126,7 +127,7 @@ const insertTag = (rows) => {
:key="row.tagFk" :key="row.tagFk"
:label="t('Value')" :label="t('Value')"
v-model="row.value" v-model="row.value"
:options="valueOptionsMap.get(row.tagFk)" :url="`Tags/${row.tagFk}/filterValue`"
option-label="value" option-label="value"
option-value="value" option-value="value"
emit-value emit-value
@ -135,6 +136,7 @@ const insertTag = (rows) => {
:is-clearable="false" :is-clearable="false"
:required="false" :required="false"
:rules="validate('itemTag.tagFk')" :rules="validate('itemTag.tagFk')"
:use-like="false"
/> />
<VnInput <VnInput
v-else-if=" v-else-if="

View File

@ -30,7 +30,7 @@ const itemTypesRef = ref(null);
const categoriesOptions = ref([]); const categoriesOptions = ref([]);
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const buyersOptions = ref([]); const buyersOptions = ref([]);
const suppliersOptions = ref([]); const tagOptions = ref([]);
const tagValues = ref([]); const tagValues = ref([]);
const fieldFiltersValues = ref([]); const fieldFiltersValues = ref([]);
const moreFields = ref([]); const moreFields = ref([]);
@ -161,12 +161,6 @@ onMounted(async () => {
@on-fetch="(data) => (buyersOptions = data)" @on-fetch="(data) => (buyersOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Tags" url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }" :filter="{ fields: ['id', 'name', 'isFree'] }"
@ -261,9 +255,11 @@ onMounted(async () => {
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
v-model="params.supplierFk" v-model="params.supplierFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="name ASC"
hide-selected hide-selected
dense dense
outlined outlined

View File

@ -22,7 +22,6 @@ import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
const stateStore = useStateStore(); const stateStore = useStateStore();
const workersOptions = ref([]);
let filterParams = ref({}); let filterParams = ref({});
const denyFormRef = ref(null); const denyFormRef = ref(null);
const denyRequestId = ref(null); const denyRequestId = ref(null);
@ -208,13 +207,6 @@ onBeforeMount(() => {
</script> </script>
<template> <template>
<FetchData
url="Workers"
:filter="{ where: { role: 'buyer' } }"
order="id"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnSearchbar <VnSearchbar
data-key="ItemRequests" data-key="ItemRequests"
url="TicketRequests/filter" url="TicketRequests/filter"
@ -268,7 +260,9 @@ onBeforeMount(() => {
<QTd> <QTd>
<VnSelect <VnSelect
v-model="row.attenderFk" v-model="row.attenderFk"
:options="workersOptions" :where="{ role: 'buyer' }"
sort-by="id"
url="Workers"
hide-selected hide-selected
option-label="firstName" option-label="firstName"
option-value="id" option-value="id"

View File

@ -24,7 +24,6 @@ const stateOptions = [
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const workersOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -72,18 +71,6 @@ const decrement = (paramsObj, key) => {
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Workers/search"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
:params="{
departmentCodes: ['VT'],
}"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
@ -162,7 +149,10 @@ const decrement = (paramsObj, key) => {
:label="t('params.requesterFk')" :label="t('params.requesterFk')"
v-model="params.requesterFk" v-model="params.requesterFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="workersOptions" url="Workers/search"
:fields="['id', 'name']"
order="name ASC"
:params="{ departmentCodes: ['VT'] }"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { Notify, useQuasar } from 'quasar'; import { Notify } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -11,7 +11,6 @@ import VnLogo from 'components/ui/VnLogo.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import axios from 'axios'; import axios from 'axios';
const quasar = useQuasar();
const session = useSession(); const session = useSession();
const loginCache = useLogin(); const loginCache = useLogin();
const router = useRouter(); const router = useRouter();
@ -72,7 +71,8 @@ async function onSubmit() {
:rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]" :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
class="red" class="red"
/> />
<div> <QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
<div class="column flex-center q-mt-lg">
<QBtn <QBtn
:label="t('login.submit')" :label="t('login.submit')"
type="submit" type="submit"
@ -81,11 +81,15 @@ async function onSubmit() {
rounded rounded
unelevated unelevated
/> />
<RouterLink
class="q-mt-md text-primary"
:to="`/recoverPassword?user=${username}`"
>
{{ t('I do not remember my password') }}
</RouterLink>
</div> </div>
<QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
</QForm> </QForm>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.formCard { .formCard {
max-width: 350px; max-width: 350px;
@ -101,3 +105,7 @@ async function onSubmit() {
} }
} }
</style> </style>
<i18n>
es:
I do not remember my password: No recuerdo mi contraseña
</i18n>

View File

@ -0,0 +1,59 @@
<script setup>
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import VnInput from 'src/components/common/VnInput.vue';
import VnOutForm from 'src/components/ui/VnOutForm.vue';
const quasar = useQuasar();
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
const user = ref(route.query.user);
async function onSubmit() {
try {
await axios.post('VnUsers/recoverPassword', { user: user.value, app: 'lilium' });
router.push('Login');
quasar.notify({
message: t('globals.notificationSent'),
type: 'positive',
});
} catch (e) {
quasar.notify({
message: e.response?.data?.error.message,
type: 'negative',
});
}
}
</script>
<template>
<VnOutForm @submit="onSubmit" :title="t('globals.pageTitles.recoverPassword')">
<template #default>
<VnInput
v-model="user"
:label="t('recoverPassword.userOrEmail')"
:hint="t('recoverPassword.explanation')"
autofocus
required
>
<template #prepend>
<QIcon name="contact_mail" />
</template>
</VnInput>
</template>
<template #buttons>
<QBtn
:label="t('globals.pageTitles.recoverPassword')"
type="submit"
color="primary"
class="full-width q-mt-md"
rounded
unelevated
/>
</template>
</VnOutForm>
</template>

View File

@ -0,0 +1,98 @@
<script setup>
import { ref, onMounted } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import VnInput from 'components/common/VnInput.vue';
import VnOutForm from 'components/ui/VnOutForm.vue';
const quasar = useQuasar();
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
const newPassword = ref();
const repeatPassword = ref();
const passRequirements = ref({});
onMounted(async () => {
passRequirements.value = (await axios('UserPasswords/findOne')).data;
});
async function onSubmit() {
if (newPassword.value != repeatPassword.value)
return quasar.notify({
message: t('resetPassword.passwordNotMatch'),
type: 'negative',
});
const headers = {
Authorization: route.query.access_token,
};
try {
await axios.post(
'VnUsers/reset-password',
{ newPassword: newPassword.value },
{ headers }
);
router.push('Login');
quasar.notify({
message: t('resetPassword.passwordChanged'),
type: 'positive',
});
} catch (e) {
quasar.notify({
message: e.response?.data?.error.message,
type: 'negative',
});
}
}
</script>
<template>
<VnOutForm @submit="onSubmit" :title="t('globals.pageTitles.resetPassword')">
<template #default>
<VnInput
type="password"
:label="t('login.password')"
v-model="newPassword"
:info="
t('passwordRequirements', {
length: passRequirements.length,
nAlpha: passRequirements.nAlpha,
nUpper: passRequirements.nUpper,
nDigits: passRequirements.nDigits,
nPunct: passRequirements.nPunct,
})
"
required
>
<template #prepend>
<QIcon name="password" />
</template>
</VnInput>
<VnInput
type="password"
:label="t('resetPassword.repeatPassword')"
v-model="repeatPassword"
required
>
<template #prepend>
<QIcon name="password" />
</template>
</VnInput>
</template>
<template #buttons>
<QBtn
:label="t('globals.pageTitles.resetPassword')"
type="submit"
color="primary"
class="full-width q-mt-md"
rounded
unelevated
/>
</template>
</VnOutForm>
</template>

View File

@ -8,6 +8,7 @@ import axios from 'axios';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin'; import { useLogin } from 'src/composables/useLogin';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnOutForm from 'src/components/ui/VnOutForm.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const session = useSession(); const session = useSession();
@ -38,24 +39,22 @@ async function onSubmit() {
} }
</script> </script>
<template> <template>
<QForm @submit="onSubmit" class="q-gutter-y-md q-pa-lg formCard"> <VnOutForm @submit="onSubmit" :title="t('twoFactor.insert')">
<div class="column items-center"> <template #default>
<QIcon name="phonelink_lock" size="xl" color="primary" /> <VnInput
<h5 class="text-center q-my-md">{{ t('twoFactor.insert') }}</h5> v-model="code"
</div> :hint="t('twoFactor.explanation')"
<VnInput mask="# # # # # #"
v-model="code" fill-mask
:hint="t('twoFactor.explanation')" unmasked-value
mask="# # # # # #" autofocus
fill-mask >
unmasked-value <template #prepend>
autofocus <QIcon name="lock" />
> </template>
<template #prepend> </VnInput>
<QIcon name="lock" /> </template>
</template> <template #buttons>
</VnInput>
<div class="q-mt-xl">
<QBtn <QBtn
:label="t('twoFactor.validate')" :label="t('twoFactor.validate')"
type="submit" type="submit"
@ -64,18 +63,6 @@ async function onSubmit() {
rounded rounded
unelevated unelevated
/> />
</div> </template>
</QForm> </VnOutForm>
</template> </template>
<style lang="scss" scoped>
.formCard {
max-width: 350px;
min-width: 300px;
}
@media (max-width: $breakpoint-xs-max) {
.formCard {
min-width: 100%;
}
}
</style>

View File

@ -1,8 +1,6 @@
<script setup> <script setup>
import { ref, computed, onMounted, reactive } from 'vue'; import { ref, computed, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
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';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -11,18 +9,14 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue'; import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toDateFormat, toTimeFormat } from 'src/filters/date.js'; import { toDateFormat, toTimeFormat } from 'src/filters/date.js';
import { toCurrency, dateRange } from 'src/filters'; import { toCurrency, dateRange } from 'src/filters';
const DEFAULT_AUTO_REFRESH = 1000; const DEFAULT_AUTO_REFRESH = 1000;
const { t } = useI18n(); const { t } = useI18n();
const autoRefresh = ref(false); const autoRefresh = ref(false);
const router = useRouter();
const paginateRef = ref(null); const paginateRef = ref(null);
const workersActiveOptions = ref([]); const workersActiveOptions = ref([]);
const provincesOptions = ref([]); const provincesOptions = ref([]);
@ -57,46 +51,6 @@ function exprBuilder(param, value) {
const filter = { order: ['totalProblems DESC'] }; const filter = { order: ['totalProblems DESC'] };
let params = reactive({}); let params = reactive({});
const applyColumnFilter = async (col) => {
try {
const paramKey = col.columnFilter?.filterParamKey || col.field;
params[paramKey] = col.columnFilter.filterValue;
await paginateRef.value.addFilter(null, params);
} catch (err) {
console.error('Error applying column filter', err);
}
};
const getInputEvents = (col) => {
return col.columnFilter.type === 'select' || col.columnFilter.type === 'date'
? { 'update:modelValue': () => applyColumnFilter(col) }
: {
'keyup.enter': () => applyColumnFilter(col),
};
};
const fetchParams = ($params = {}) => {
const excludedParams = ['search', 'clientFk', 'orderFk', 'refFk', 'scopeDays'];
const hasExcludedParams = excludedParams.some((param) => {
return $params && $params[param] != undefined;
});
const hasParams = Object.entries($params).length;
if (!hasParams || !hasExcludedParams) $params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
const to = new Date(from.getTime());
to.setDate(to.getDate() + $params.scopeDays);
to.setHours(23, 59, 59, 999);
Object.assign($params, { from, to });
}
return { tableOrder: 'totalProblems DESC', ...$params };
};
const columns = computed(() => [ const columns = computed(() => [
{ {
label: t('salesTicketsTable.problems'), label: t('salesTicketsTable.problems'),
@ -379,13 +333,6 @@ const redirectToSales = (id) => {
const url = `#/ticket/${id}/sale`; const url = `#/ticket/${id}/sale`;
window.open(url, '_blank'); window.open(url, '_blank');
}; };
// onMounted(async () => {
// const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions');
// allColumnNames.value = filteredColumns.map((col) => col.name);
// params = fetchParams();
// await paginateRef.value.addFilter(null, params);
// });
</script> </script>
<template> <template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
@ -7,6 +7,7 @@ import { useState } from 'composables/useState';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnInput from 'components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
@ -15,7 +16,6 @@ const route = useRoute();
const state = useState(); const state = useState();
const ORDER_MODEL = 'order'; const ORDER_MODEL = 'order';
const router = useRouter();
const isNew = Boolean(!route.params.id); const isNew = Boolean(!route.params.id);
const clientList = ref([]); const clientList = ref([]);
const agencyList = ref([]); const agencyList = ref([]);
@ -64,13 +64,6 @@ const fetchOrderDetails = (order) => {
fetchAgencyList(order?.landed, order?.addressFk); fetchAgencyList(order?.landed, order?.addressFk);
}; };
const orderMapper = (order) => {
return {
addressId: order.addressFk,
agencyModeId: order.agencyModeFk,
landed: new Date(order.landed).toISOString(),
};
};
const orderFilter = { const orderFilter = {
include: [ include: [
{ relation: 'agencyMode', scope: { fields: ['name'] } }, { relation: 'agencyMode', scope: { fields: ['name'] } },
@ -106,10 +99,6 @@ const onClientChange = async (clientId) => {
console.error('Error al cambiar el cliente:', error); console.error('Error al cambiar el cliente:', error);
} }
}; };
async function onDataSaved({ id }) {
await router.push({ path: `/order/${id}/catalog` });
}
</script> </script>
<template> <template>
@ -117,9 +106,8 @@ async function onDataSaved({ id }) {
<div class="q-pa-md"> <div class="q-pa-md">
<FormModel <FormModel
:url="`Orders/${route.params.id}`" :url="`Orders/${route.params.id}`"
@on-data-saved="onDataSaved" :url-update="`Orders/${route.params.id}/updateBasicData`"
:model="ORDER_MODEL" :model="ORDER_MODEL"
:mapper="orderMapper"
:filter="orderFilter" :filter="orderFilter"
@on-fetch="fetchOrderDetails" @on-fetch="fetchOrderDetails"
auto-load auto-load
@ -180,8 +168,6 @@ async function onDataSaved({ id }) {
() => fetchAgencyList(data.landed, data.addressFk) () => fetchAgencyList(data.landed, data.addressFk)
" "
/> />
</VnRow>
<VnRow>
<VnSelect <VnSelect
:label="t('order.form.agencyModeFk')" :label="t('order.form.agencyModeFk')"
v-model="data.agencyModeFk" v-model="data.agencyModeFk"
@ -189,9 +175,29 @@ async function onDataSaved({ id }) {
option-value="agencyModeFk" option-value="agencyModeFk"
option-label="agencyMode" option-label="agencyMode"
hide-selected hide-selected
:disable="!agencyList?.length" :disable="!agencyList?.length && data.isConfirmed === 1"
> clearable
</VnSelect> emit-value
map-options
:model-value="
!data.isConfirmed &&
agencyList?.length &&
agencyList.some(
(agency) => agency.agencyModeFk === data.agency_id
)
? data.agencyModeFk
: null
"
/>
</VnRow>
<VnRow>
<VnInput
:label="t('globals.notes')"
type="textarea"
v-model="data.note"
fill-input
autogrow
/>
</VnRow> </VnRow>
</template> </template>
</FormModel> </FormModel>

View File

@ -1,16 +1,35 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue'; import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
import OrderFilter from './OrderFilter.vue'; import OrderFilter from './OrderFilter.vue';
import OrderSearchbar from './OrderSearchbar.vue'; import OrderSearchbar from './OrderSearchbar.vue';
import OrderCatalogFilter from './OrderCatalogFilter.vue';
const config = {
OrderCatalog: OrderCatalogFilter,
};
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
const route = config[routeName.value];
if (route) return null;
return 'OrderList';
});
const customFilterPanel = computed(() => {
const filterPanel = config[routeName.value] ?? OrderFilter;
return filterPanel;
});
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Order" data-key="Order"
base-url="Orders" base-url="Orders"
:descriptor="OrderDescriptor" :descriptor="OrderDescriptor"
:filter-panel="OrderFilter" :filter-panel="customFilterPanel"
search-data-key="OrderList" :search-data-key="customRouteRedirectName"
> >
<template #searchbar> <template #searchbar>
<OrderSearchbar /> <OrderSearchbar />

View File

@ -1,17 +1,24 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import axios from 'axios';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import CatalogItem from 'components/ui/CatalogItem.vue'; import CatalogItem from 'components/ui/CatalogItem.vue';
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue'; import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
const route = useRoute(); const route = useRoute();
const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const tags = ref([]);
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => {
stateStore.rightDrawer = true;
checkOrderConfirmation();
});
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
const catalogParams = { const catalogParams = {
@ -19,7 +26,12 @@ const catalogParams = {
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }), orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
}; };
const tags = ref([]); async function checkOrderConfirmation() {
const response = await axios.get(`Orders/${route.params.id}`);
if (response.data.isConfirmed === 1) {
router.push(`/order/${route.params.id}/line`);
}
}
function extractTags(items) { function extractTags(items) {
const resultTags = []; const resultTags = [];
@ -52,6 +64,15 @@ function extractValueTags(items) {
</script> </script>
<template> <template>
<VnSearchbar
data-key="OrderCatalogList"
:user-params="catalogParams"
:static-params="['orderFk', 'orderBy']"
:redirect="false"
url="Orders/CatalogFilter"
:label="t('Search items')"
:info="t('You can search items by name or id')"
/>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<OrderCatalogFilter <OrderCatalogFilter
@ -68,7 +89,6 @@ function extractValueTags(items) {
url="Orders/CatalogFilter" url="Orders/CatalogFilter"
:limit="50" :limit="50"
:user-params="catalogParams" :user-params="catalogParams"
auto-load
@on-fetch="extractTags" @on-fetch="extractTags"
:update-router="false" :update-router="false"
> >
@ -106,3 +126,8 @@ function extractValueTags(items) {
text-align: center; text-align: center;
} }
</style> </style>
<i18n>
es:
You can search items by name or id: Puedes buscar items por nombre o id
</i18n>

View File

@ -7,8 +7,8 @@ import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue'; import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import { useValidator } from 'src/composables/useValidator';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import getParamWhere from 'src/filters/getParamWhere';
const { t } = useI18n(); const { t } = useI18n();
@ -27,19 +27,26 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const categoryList = ref(null); const categoryList = ref(null);
const selectedCategoryFk = ref(null); const selectedCategoryFk = ref(getParamWhere(route, 'categoryFk'));
const typeList = ref(null); const typeList = ref([]);
const selectedTypeFk = ref(null); const selectedTypeFk = ref(null);
const validationsStore = useValidator();
const selectedOrder = ref(null);
const selectedOrderField = ref(null);
const moreFields = ref([]);
const moreFieldsOrder = ref([]);
const selectedTag = ref(null); const selectedTag = ref(null);
const tagValues = ref([{}]); const tagValues = ref([{}]);
const tagOptions = ref([]); const tagOptions = ref([]);
const vnFilterPanelRef = ref();
const orderByList = ref([
{ id: 'relevancy DESC, name', name: t('params.relevancy'), priority: 999 },
{ id: 'showOrder, price', name: t('params.colorAndPrice'), priority: 999 },
{ id: 'name', name: t('params.name'), priority: 999 },
{ id: 'price', name: t('params.price'), priority: 999 },
]);
const orderWayList = ref([
{ id: 'ASC', name: t('params.ASC') },
{ id: 'DESC', name: t('params.DESC') },
]);
const orderBySelected = ref('relevancy DESC, name');
const orderWaySelected = ref('ASC');
const createValue = (val, done) => { const createValue = (val, done) => {
if (val.length > 2) { if (val.length > 2) {
@ -72,7 +79,7 @@ const selectCategory = (params, category, search) => {
search(); search();
}; };
const loadTypes = async (categoryFk) => { const loadTypes = async (categoryFk = selectedCategoryFk.value) => {
const { data } = await axios.get(`Orders/${route.params.id}/getItemTypeAvailable`, { const { data } = await axios.get(`Orders/${route.params.id}/getItemTypeAvailable`, {
params: { itemCategoryId: categoryFk }, params: { itemCategoryId: categoryFk },
}); });
@ -84,7 +91,14 @@ const selectedCategory = computed(() =>
(category) => category?.id === selectedCategoryFk.value (category) => category?.id === selectedCategoryFk.value
) )
); );
function filterFn(val, update) {
update(() => {
const needle = val.toLowerCase();
tagOptions.value = props.tagValue.filter(
(v) => v.toLowerCase().indexOf(needle) > -1
);
});
}
const selectedType = computed(() => { const selectedType = computed(() => {
return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value); return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value);
}); });
@ -95,7 +109,8 @@ function exprBuilder(param, value) {
case 'typeFk': case 'typeFk':
return { [param]: value }; return { [param]: value };
case 'search': case 'search':
return { 'i.name': { like: `%${value}%` } }; if (/^\d+$/.test(value)) return { 'i.id': value };
else return { 'i.name': { like: `%${value}%` } };
} }
} }
@ -132,36 +147,6 @@ const removeTagChip = (selection, params, search) => {
search(); search();
}; };
const onOrderChange = (value, params) => {
const tagObj = JSON.parse(params.orderBy);
tagObj.way = value.name;
params.orderBy = JSON.stringify(tagObj);
};
const onOrderFieldChange = (value, params) => {
const tagObj = JSON.parse(params.orderBy);
switch (value) {
case 'Relevancy':
tagObj.name = value + ' DESC, name';
params.orderBy = JSON.stringify(tagObj);
break;
case 'ColorAndPrice':
tagObj.name = 'showOrder, price';
params.orderBy = JSON.stringify(tagObj);
break;
case 'Name':
tagObj.name = 'name';
params.orderBy = JSON.stringify(tagObj);
break;
case 'Price':
tagObj.name = 'price';
params.orderBy = JSON.stringify(tagObj);
break;
}
};
const _moreFields = ['ASC', 'DESC'];
const _moreFieldsTypes = ['Relevancy', 'ColorAndPrice', 'Name', 'Price'];
const setCategoryList = (data) => { const setCategoryList = (data) => {
categoryList.value = (data || []) categoryList.value = (data || [])
.filter((category) => category.display) .filter((category) => category.display)
@ -169,8 +154,8 @@ const setCategoryList = (data) => {
...category, ...category,
icon: `vn:${(category.icon || '').split('-')[1]}`, icon: `vn:${(category.icon || '').split('-')[1]}`,
})); }));
moreFields.value = useLang(_moreFields);
moreFieldsOrder.value = useLang(_moreFieldsTypes); selectedCategoryFk.value && loadTypes();
}; };
const getCategoryClass = (category, params) => { const getCategoryClass = (category, params) => {
@ -179,27 +164,22 @@ const getCategoryClass = (category, params) => {
} }
}; };
const useLang = (values) => { function addOrder(value, field, params) {
const { models } = validationsStore; let { orderBy } = params;
const properties = models.Item?.properties || {}; orderBy = JSON.parse(orderBy);
return values.map((name) => { orderBy[field] = value;
let prop = properties[name]; params.orderBy = JSON.stringify(orderBy);
const label = t(`params.${name}`); vnFilterPanelRef.value.search();
return { }
name,
label,
type: prop ? prop.type : null,
};
});
};
</script> </script>
<template> <template>
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" /> <FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
<VnFilterPanel <VnFilterPanel
ref="vnFilterPanelRef"
:data-key="props.dataKey" :data-key="props.dataKey"
:hidden-tags="['orderFk', 'orderBy']" :hidden-tags="['orderFk', 'orderBy']"
:unremovable-params="['orderFk', 'orderBy']" :un-removable-params="['orderFk', 'orderBy']"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:custom-tags="['tagGroups']" :custom-tags="['tagGroups']"
@remove="clearFilter" @remove="clearFilter"
@ -289,33 +269,29 @@ const useLang = (values) => {
</QItemSection> </QItemSection>
</QItem> </QItem>
<QSeparator /> <QSeparator />
<QItem class="q-my-md">
<QItemSection>
<VnSelect
:label="t('Order')"
v-model="selectedOrder"
:options="moreFields"
option-label="label"
option-value="way"
dense
outlined
rounded
@update:model-value="(value) => onOrderChange(value, params)"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-md"> <QItem class="q-mb-md">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Order by')" :label="t('Order by')"
v-model="selectedOrderField" v-model="orderBySelected"
:options="moreFieldsOrder" :options="orderByList"
option-label="label"
option-value="name"
dense dense
outlined outlined
rounded rounded
@update:model-value="(value) => onOrderFieldChange(value, params)" @update:model-value="(value) => addOrder(value, 'field', params)"
/>
</QItemSection>
</QItem>
<QItem class="q-my-md">
<QItemSection>
<VnSelect
:label="t('Order')"
v-model="orderWaySelected"
:options="orderWayList"
dense
outlined
rounded
@update:model-value="(value) => addOrder(value, 'way', params)"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -352,7 +328,7 @@ const useLang = (values) => {
v-if="!selectedTag" v-if="!selectedTag"
:label="t('params.value')" :label="t('params.value')"
v-model="value.value" v-model="value.value"
:options="tagValue || []" :options="tagOptions || []"
option-value="value" option-value="value"
option-label="value" option-label="value"
dense dense
@ -362,6 +338,8 @@ const useLang = (values) => {
use-input use-input
class="filter-input" class="filter-input"
@new-value="createValue" @new-value="createValue"
@filter="filterFn"
@update:model-value="applyTagFilter(params, searchFn)"
/> />
<VnSelect <VnSelect
v-else-if="selectedTag === 1" v-else-if="selectedTag === 1"
@ -377,6 +355,7 @@ const useLang = (values) => {
use-input use-input
class="filter-input" class="filter-input"
@new-value="createValue" @new-value="createValue"
@update:model-value="applyTagFilter(params, searchFn)"
/> />
<VnInput <VnInput
v-else v-else
@ -386,6 +365,7 @@ const useLang = (values) => {
outlined outlined
rounded rounded
class="filter-input" class="filter-input"
@keyup.enter="applyTagFilter(params, searchFn)"
/> />
<QIcon <QIcon
name="delete" name="delete"
@ -400,7 +380,7 @@ const useLang = (values) => {
@click="tagValues.push({})" @click="tagValues.push({})"
/> />
</QItem> </QItem>
<QItem> <!-- <QItem>
<QItemSection class="q-py-sm"> <QItemSection class="q-py-sm">
<QBtn <QBtn
:label="t('Search')" :label="t('Search')"
@ -414,7 +394,7 @@ const useLang = (values) => {
@click.stop="applyTagFilter(params, searchFn)" @click.stop="applyTagFilter(params, searchFn)"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem> -->
<QSeparator /> <QSeparator />
</template> </template>
</VnFilterPanel> </VnFilterPanel>
@ -477,10 +457,10 @@ en:
order: Order order: Order
ASC: Ascendant ASC: Ascendant
DESC: Descendant DESC: Descendant
Relevancy: Relevancy relevancy: Relevancy
ColorAndPrice: Color and price colorAndPrice: Color and price
Name: Name name: Name
Price: Price price: Price
es: es:
params: params:
type: Tipo type: Tipo
@ -490,10 +470,10 @@ es:
order: Orden order: Orden
ASC: Ascendiente ASC: Ascendiente
DESC: Descendiente DESC: Descendiente
Relevancy: Relevancia relevancy: Relevancia
ColorAndPrice: Color y precio colorAndPrice: Color y precio
Name: Nombre name: Nombre
Price: Precio price: Precio
Order: Orden Order: Orden
Order by: Ordenar por Order by: Ordenar por
Plant: Planta Plant: Planta

View File

@ -5,10 +5,12 @@ 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';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const { notify } = useNotify(); const { notify } = useNotify();
const emit = defineEmits(['added']);
const route = useRoute();
const props = defineProps({ const props = defineProps({
prices: { prices: {
type: Array, type: Array,
@ -16,9 +18,8 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(['added']);
const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 }))); const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 })));
const descriptorData = useArrayData('orderData');
const addToOrder = async () => { const addToOrder = async () => {
const items = (fields.value || []).filter((item) => Number(item.quantity) > 0); const items = (fields.value || []).filter((item) => Number(item.quantity) > 0);
@ -28,19 +29,20 @@ const addToOrder = async () => {
}); });
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
emit('added'); emit('added');
descriptorData.fetch({});
}; };
</script> </script>
<template> <template>
<div class="container order-catalog-item q-pb-md"> <div class="container order-catalog-item q-pa-md">
<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="item in fields" :key="item.warehouse">
<td class="text-bold q-py-lg"> <td class="text-bold q-pr-md td" style="width: 35%">
{{ item.warehouse }} {{ item.warehouse }}
</td> </td>
<td class="text-right"> <td class="text-right" style="width: 35%">
<span <span
class="link" class="link"
@click=" @click="
@ -75,8 +77,11 @@ const addToOrder = async () => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { // .container {
max-width: 448px; // max-width: 768px;
width: 100%; // width: 100%;
// }
.td {
width: 200px;
} }
</style> </style>

View File

@ -4,13 +4,13 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency, toDate } from 'src/filters';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import OrderDescriptorMenu from 'pages/Order/Card/OrderDescriptorMenu.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import OrderDescriptorMenu from 'pages/Order/Card/OrderDescriptorMenu.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const DEFAULT_ITEMS = 0; const DEFAULT_ITEMS = 0;
@ -25,6 +25,8 @@ const $props = defineProps({
const route = useRoute(); const route = useRoute();
const state = useState(); const state = useState();
const { t } = useI18n(); const { t } = useI18n();
const data = ref(useCardDescription());
const getTotalRef = ref();
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
@ -57,11 +59,11 @@ const filter = {
], ],
}; };
const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
getTotalRef.value && getTotalRef.value.fetch();
data.value = useCardDescription(entity?.client?.name, entity?.id); data.value = useCardDescription(entity?.client?.name, entity?.id);
state.set('OrderDescriptor', entity); state.set('orderData', entity);
}; };
const getConfirmationValue = (isConfirmed) => { const getConfirmationValue = (isConfirmed) => {
@ -69,13 +71,17 @@ const getConfirmationValue = (isConfirmed) => {
}; };
const total = ref(null); const total = ref(null);
function ticketFilter(order) {
return JSON.stringify({ id: order.id });
}
</script> </script>
<template> <template>
<FetchData <FetchData
ref="getTotalRef"
:url="`Orders/${entityId}/getTotal`" :url="`Orders/${entityId}/getTotal`"
@on-fetch="(response) => (total = response)" @on-fetch="(response) => (total = response)"
auto-load
/> />
<CardDescriptor <CardDescriptor
ref="descriptor" ref="descriptor"
@ -120,7 +126,7 @@ const total = ref(null);
color="primary" color="primary"
:to="{ :to="{
name: 'TicketList', name: 'TicketList',
query: { params: JSON.stringify({ orderFk: entity.id }) }, query: { table: ticketFilter(entity) },
}" }"
> >
<QTooltip>{{ t('order.summary.orderTicketList') }}</QTooltip> <QTooltip>{{ t('order.summary.orderTicketList') }}</QTooltip>

View File

@ -21,15 +21,13 @@ const salesPersonFilter = {
fields: ['id', 'nickname'], fields: ['id', 'nickname'],
}; };
const salesPersonList = ref(null); const salesPersonList = ref(null);
const sourceFilter = { fields: ['value'] }; const sourceList = ref([]);
const sourceList = ref(null);
</script> </script>
<template> <template>
<FetchData <FetchData
url="AgencyModes/isActive" url="AgencyModes/isActive"
:filter="agencyFilter" :filter="agencyFilter"
limit="30"
sort-by="name ASC" sort-by="name ASC"
auto-load auto-load
@on-fetch="(data) => (agencyList = data)" @on-fetch="(data) => (agencyList = data)"
@ -37,7 +35,6 @@ const sourceList = ref(null);
<FetchData <FetchData
url="Workers/search" url="Workers/search"
:filter="salesPersonFilter" :filter="salesPersonFilter"
limit="30"
sort-by="nickname ASC" sort-by="nickname ASC"
@on-fetch="(data) => (salesPersonList = data)" @on-fetch="(data) => (salesPersonList = data)"
:params="{ departmentCodes: ['VT'] }" :params="{ departmentCodes: ['VT'] }"
@ -45,8 +42,7 @@ const sourceList = ref(null);
/> />
<FetchData <FetchData
url="Orders/getSourceValues" url="Orders/getSourceValues"
:filter="sourceFilter" :filter="{ fields: ['value'] }"
limit="30"
sort-by="value ASC" sort-by="value ASC"
@on-fetch="(data) => (sourceList = data)" @on-fetch="(data) => (sourceList = data)"
auto-load auto-load
@ -59,148 +55,88 @@ const sourceList = ref(null);
</div> </div>
</template> </template>
<template #body="{ params }"> <template #body="{ params }">
<QItem> <div class="q-px-md q-gutter-y-sm">
<QItemSection> <VnInput
<VnInput :label="t('customerId')"
is-outlined v-model="params.clientFk"
:label="t('customerId')" lazy-rules
v-model="params.clientFk" dense
lazy-rules outlined
> rounded
<template #prepend> />
<QIcon name="badge" size="sm"></QIcon> <VnSelect
</template> :label="t('agency')"
</VnInput> v-model="params.agencyModeFk"
</QItemSection> :options="agencyList"
</QItem> :input-debounce="0"
<QItem> dense
<QItemSection v-if="agencyList"> outlined
<VnSelect rounded
:label="t('agency')" />
v-model="params.agencyModeFk" <VnSelect
:options="agencyList" :label="t('salesPerson')"
option-value="id" v-model="params.workerFk"
option-label="name" url="Workers/search"
dense :filter="{ departmentCodes: ['VT'] }"
outlined sort-by="nickname ASC"
rounded option-label="nickname"
emit-value dense
map-options outlined
use-input rounded
:input-debounce="0" >
/> <template #option="{ itemProps, opt }">
</QItemSection> <QItem v-bind="itemProps">
<QItemSection v-else> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <QItemLabel>{{ opt.name }}</QItemLabel>
</QItemSection> <QItemLabel caption>
</QItem> {{ opt.nickname }},{{ opt.code }}
<QItem> </QItemLabel>
<QItemSection v-if="salesPersonList"> </QItemSection>
<VnSelect </QItem>
:label="t('salesPerson')" </template>
v-model="params.workerFk" </VnSelect>
:options="salesPersonList" <VnInputDate
option-value="id" v-model="params.from"
option-label="name" :label="t('fromLanded')"
dense dense
outlined outlined
rounded rounded
emit-value />
map-options <VnInputDate
use-input v-model="params.to"
:input-debounce="0" :label="t('toLanded')"
> dense
<template #option="{ itemProps, opt }"> outlined
<QItem v-bind="itemProps"> rounded
<QItemSection> />
<QItemLabel>{{ opt.name }}</QItemLabel> <VnInput
<QItemLabel caption> :label="t('orderId')"
{{ opt.nickname }},{{ opt.code }} v-model="params.orderFk"
</QItemLabel> lazy-rules
</QItemSection> is-outlined
</QItem> />
</template> <VnSelect
</VnSelect> :label="t('application')"
</QItemSection> v-model="params.sourceApp"
<QItemSection v-else> :options="sourceList"
<QSkeleton type="QInput" class="full-width" /> option-label="value"
</QItemSection> dense
</QItem> outlined
<QItem> rounded
<QItemSection> :input-debounce="0"
<VnInputDate />
v-model="params.from" <QCheckbox
:label="t('fromLanded')" v-model="params.myTeam"
dense :label="t('myTeam')"
outlined toggle-indeterminate
rounded />
/> <QCheckbox
</QItemSection> v-model="params.isConfirmed"
</QItem> :label="t('isConfirmed')"
<QItem> toggle-indeterminate
<QItemSection> />
<VnInputDate <QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" />
v-model="params.to" </div>
:label="t('toLanded')"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('orderId')"
v-model="params.orderFk"
lazy-rules
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="sourceList">
<VnSelect
:label="t('application')"
v-model="params.sourceApp"
:options="sourceList"
option-label="value"
emit-value
map-options
use-input
dense
outlined
rounded
:input-debounce="0"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('myTeam')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.isConfirmed"
:label="t('isConfirmed')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" />
</QItemSection>
</QItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>

View File

@ -1,23 +1,26 @@
<script setup> <script setup>
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref, computed } from 'vue'; import { ref, computed, watch } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import axios from 'axios';
import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData';
import { toCurrency, toDate } from 'src/filters';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import { toCurrency, toDate } from 'src/filters';
import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import FetchedTags from 'src/components/ui/FetchedTags.vue'; import FetchedTags from 'src/components/ui/FetchedTags.vue';
import { useStateStore } from 'stores/useStateStore';
const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
const descriptorData = useArrayData('orderData');
const componentKey = ref(0); const componentKey = ref(0);
const tableLinesRef = ref(); const tableLinesRef = ref();
const order = ref(); const order = ref();
@ -25,6 +28,8 @@ const orderSummary = ref({
total: null, total: null,
vat: null, vat: null,
}); });
const getTotalRef = ref();
const getVATRef = ref();
const lineFilter = ref({ const lineFilter = ref({
include: [ include: [
@ -59,6 +64,13 @@ const lineFilter = ref({
fields: ['id', 'name'], fields: ['id', 'name'],
}, },
}, },
{
relation: 'order',
scope: {
fields: ['id', 'isConfirmed'],
where: { id: route.params.id },
},
},
], ],
where: { orderFk: route.params.id }, where: { orderFk: route.params.id },
}); });
@ -104,6 +116,7 @@ const columns = computed(() => [
component: null, component: null,
}, },
format: (row) => row?.item?.name, format: (row) => row?.item?.name,
columnClass: 'expand',
}, },
{ {
align: 'left', align: 'left',
@ -147,7 +160,6 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'amount', name: 'amount',
label: t('lines.amount'), label: t('lines.amount'),
format: (row) => toCurrency(row.amount),
}, },
{ {
align: 'right', align: 'right',
@ -155,8 +167,9 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('delete'), title: t('Delete'),
icon: 'delete', icon: 'delete',
show: (row) => !row.order.isConfirmed,
action: (row) => confirmRemove(row), action: (row) => confirmRemove(row),
isPrimary: true, isPrimary: true,
}, },
@ -185,6 +198,9 @@ async function remove(item) {
type: 'positive', type: 'positive',
}); });
tableLinesRef.value.reload(); tableLinesRef.value.reload();
descriptorData.fetch({});
getTotalRef.value.fetch();
getVATRef.value.fetch();
} }
async function confirmOrder() { async function confirmOrder() {
@ -193,7 +209,22 @@ async function confirmOrder() {
message: t('globals.confirm'), message: t('globals.confirm'),
type: 'positive', type: 'positive',
}); });
router.push({
name: 'TicketList',
query: {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
},
});
} }
watch(
() => router.currentRoute.value.params.id,
() => {
lineFilter.value.where.orderFk = router.currentRoute.value.params.id;
tableLinesRef.value.reload();
}
);
</script> </script>
<template> <template>
@ -204,78 +235,80 @@ async function confirmOrder() {
auto-load auto-load
/> />
<FetchData <FetchData
ref="getTotalRef"
:key="componentKey" :key="componentKey"
:url="`Orders/${route.params.id}/getTotal`" :url="`Orders/${route.params.id}/getTotal`"
@on-fetch="(data) => (orderSummary.total = data)" @on-fetch="(data) => (orderSummary.total = data)"
auto-load auto-load
/> />
<FetchData <FetchData
ref="getVATRef"
:key="componentKey" :key="componentKey"
:url="`Orders/${route.params.id}/getVAT`" :url="`Orders/${route.params.id}/getVAT`"
@on-fetch="(data) => (orderSummary.vat = data)" @on-fetch="(data) => (orderSummary.vat = data)"
auto-load auto-load
/> />
<QDrawer side="right" :width="270" v-model="stateStore.rightDrawer"> <QDrawer side="right" :width="270" v-model="stateStore.rightDrawer">
<QCard class="order-lines-summary q-pa-lg"> <QCard
class="order-lines-summary q-pa-lg"
v-if="orderSummary.vat && orderSummary.total"
>
<p class="header text-right block"> <p class="header text-right block">
{{ t('summary') }} {{ t('summary') }}
</p> </p>
<VnLv <VnLv
v-if="orderSummary.vat && orderSummary.total"
:label="t('subtotal') + ': '" :label="t('subtotal') + ': '"
:value="toCurrency(orderSummary.total - orderSummary.vat)" :value="toCurrency(orderSummary.total - orderSummary.vat)"
/> />
<VnLv <VnLv :label="t('VAT') + ': '" :value="toCurrency(orderSummary?.vat)" />
v-if="orderSummary.vat" <VnLv :label="t('total') + ': '" :value="toCurrency(orderSummary?.total)" />
:label="t('VAT') + ': '"
:value="toCurrency(orderSummary?.vat)"
/>
<VnLv
v-if="orderSummary.total"
:label="t('total') + ': '"
:value="toCurrency(orderSummary?.total)"
/>
</QCard> </QCard>
</QDrawer> </QDrawer>
<QPage :key="componentKey" class="column items-center">
<div class="order-list full-width">
<div v-if="!orderSummary.total" class="no-result">
{{ t('globals.noResults') }}
</div>
<VnTable
ref="tableLinesRef"
data-key="OrderLines"
url="OrderRows"
:columns="columns"
:right-search="false"
:use-model="true"
auto-load
:user-filter="lineFilter"
>
<template #column-image="{ row }">
<div class="image-wrapper">
<VnImg :id="parseInt(row?.item?.image)" class="rounded" />
</div>
</template>
<template #column-itemFk="{ row }"> <VnTable
<div class="row column full-width justify-between items-start"> ref="tableLinesRef"
{{ row?.item?.name }} data-key="OrderLines"
<div v-if="row?.item?.subName" class="subName"> url="OrderRows"
{{ row?.item?.subName.toUpperCase() }} :columns="columns"
</div> :right-search="false"
</div> :use-model="true"
<FetchedTags :item="row?.item" :max-length="6" /> auto-load
</template> :user-filter="lineFilter"
</VnTable> >
</div> <template #column-image="{ row }">
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2"> <div class="image-wrapper">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" /> <VnImg :id="parseInt(row?.item?.image)" class="rounded" />
<QTooltip> </div>
{{ t('confirm') }} </template>
</QTooltip>
</QPageSticky> <template #column-itemFk="{ row }">
</QPage> <div class="row column full-width justify-between items-start">
{{ row?.item?.name }}
<div v-if="row?.item?.subName" class="subName">
{{ row?.item?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags :item="row?.item" :max-length="6" />
</template>
<template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }}
</template>
<template #column-tableActions="{ row }">
<QIcon
v-if="row.order?.isConfirmed === 0"
name="delete"
icon="delete"
@click="confirmRemove(row)"
class="cursor-pointer"
/>
</template>
</VnTable>
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QTooltip>
{{ t('confirm') }}
</QTooltip>
</QPageSticky>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -180,15 +180,17 @@ const detailsColumns = ref([
<ItemDescriptorProxy :id="props.row.item?.id" /> <ItemDescriptorProxy :id="props.row.item?.id" />
</span> </span>
</QTd> </QTd>
<QTd key="description" :props="props" class="description"> <QTd key="description" :props="props">
<div class="name"> <div class="description">
<span>{{ props.row.item.name }}</span> <div class="name">
<span {{ props.row.item.name }}
v-if="props.row.item.subName" <span
class="subName" v-if="props.row.item.subName"
> class="subName"
{{ props.row.item.subName }} >
</span> {{ props.row.item.subName }}
</span>
</div>
</div> </div>
<FetchedTags :item="props.row.item" :max-length="5" /> <FetchedTags :item="props.row.item" :max-length="5" />
</QTd> </QTd>
@ -228,24 +230,13 @@ const detailsColumns = ref([
} }
.description { .description {
display: flex;
flex-direction: column;
justify-content: center;
text-align: left; text-align: left;
height: auto; padding-top: 15px;
padding-top: 12px; padding-bottom: 15px;
padding-bottom: 12px;
.name { .name {
display: flex;
align-items: center;
padding-bottom: 8px;
& > * {
flex: 1;
}
.subName { .subName {
margin-left: 5%;
text-transform: uppercase; text-transform: uppercase;
color: var(--vn-label-color); color: var(--vn-label-color);
} }

View File

@ -0,0 +1,140 @@
<script setup>
import axios from 'axios';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { dashIfEmpty } from 'src/filters';
import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import ItemDescriptorProxy from 'pages/Item/Card/ItemDescriptorProxy.vue';
import VnLv from 'components/ui/VnLv.vue';
import VnTable from 'components/VnTable/VnTable.vue';
const route = useRoute();
const { t } = useI18n();
const volumeSummary = ref(null);
const volumeRef = ref();
const volumes = ref([]);
const volumeFilter = ref({
include: [
{
relation: 'item',
},
],
where: { orderFk: route.params.id },
});
const columns = [
{
name: 'itemFk',
label: t('item'),
align: 'left',
},
{
name: 'description',
label: t('globals.description'),
align: 'left',
},
{
name: 'quantity',
label: t('quantity'),
align: 'left',
},
{
name: 'volume',
label: t('volume'),
align: 'left',
},
];
const loadVolumes = async (rows) => {
if (!rows) return;
const { data } = await axios.get(`Orders/${route.params.id}/getVolumes`);
rows.forEach((order) => {
(data.volumes || []).forEach((volume) => {
if (order.itemFk === volume.itemFk) order.volume = volume.volume;
});
});
volumes.value = rows;
};
</script>
<template>
<FetchData
:url="`Orders/${route.params.id}/getTotalVolume`"
@on-fetch="(data) => (volumeSummary = data)"
auto-load
/>
<QCard v-if="volumeSummary" class="order-volume-summary q-pa-lg">
<VnLv :label="t('total')" :value="`${volumeSummary?.totalVolume} m³`" />
<VnLv
:label="t('boxes')"
:value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`"
/>
</QCard>
<VnTable
ref="volumeRef"
data-key="OrderCatalogVolume"
url="OrderRows"
:columns="columns"
auto-load
:user-filter="volumeFilter"
order="itemFk"
@on-fetch="(data) => loadVolumes(data)"
:right-search="false"
:column-search="false"
>
<template #column-itemFk="{ row }">
<span class="link">
{{ row.itemFk }}
<ItemDescriptorProxy :id="row.itemFk" />
</span>
</template>
<template #column-description="{ row }">
<FetchedTags :item="row.item" :max-length="5" />
</template>
<template #column-volume="{ rowIndex }">
{{ volumes?.[rowIndex]?.volume }}
</template>
</VnTable>
</template>
<style lang="scss">
.order-volume-summary {
.vn-label-value {
display: flex;
justify-content: flex-end;
gap: 2%;
.label {
color: var(--vn-label-color);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>
<i18n>
en:
summary: Summary
total: Total
boxes: Boxes
item: Item
quantity: Quantity
volume: per quantity
es:
summary: Resumen
total: Total
boxes: Cajas
item: Artículo
quantity: Cantidad
volume: por cantidad
</i18n>

View File

@ -3,19 +3,21 @@ import axios from 'axios';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { dashIfEmpty, toCurrency, toDate } from 'src/filters'; import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import OrderSummary from 'pages/Order/Card/OrderSummary.vue'; import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import OrderSearchbar from './Card/OrderSearchbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import OrderFilter from './Card/OrderFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const tableRef = ref(); const tableRef = ref();
const clientList = ref([]);
const agencyList = ref([]); const agencyList = ref([]);
const selectedAddress = ref(); const addressesList = ref([]);
const clientId = ref();
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -29,7 +31,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'clientName', name: 'clientFk',
label: t('module.customer'), label: t('module.customer'),
isTitle: true, isTitle: true,
cardVisible: true, cardVisible: true,
@ -41,20 +43,26 @@ const columns = computed(() => [
columnField: { columnField: {
component: null, component: null,
}, },
format: (row) => row?.clientName,
}, },
{ {
align: 'left', align: 'left',
name: 'name', name: 'salesPersonFk',
label: t('module.salesPerson'), label: t('module.salesPerson'),
component: 'select', columnFilter: {
attrs: { component: 'select',
url: 'Workers/activeWithInheritedRole', inWhere: true,
fields: ['id', 'name'], attrs: {
where: { role: 'salesPerson' }, url: 'Workers/activeWithInheritedRole',
}, fields: ['id', 'name'],
columnField: { where: { role: 'salesPerson' },
component: null, useLike: false,
optionValue: 'id',
optionLabel: 'name',
optionFilter: 'firstName',
},
}, },
format: (row) => row?.name,
}, },
{ {
align: 'left', align: 'left',
@ -92,17 +100,21 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'agencyName', name: 'agencyModeFk',
label: t('module.agency'), label: t('module.agency'),
component: 'select', format: (row) => row?.agencyName,
columnFilter: {
component: 'select',
attrs: {
url: 'agencyModes',
fields: ['id', 'name'],
find: {
value: 'agencyModeFk',
label: 'agencyName',
},
},
},
cardVisible: true, cardVisible: true,
attrs: {
url: 'Agencies',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
@ -125,22 +137,36 @@ const columns = computed(() => [
}, },
]); ]);
async function fetchClientAddress(id, data) { async function fetchClientAddress(id, formData) {
const clientData = await axios.get(`Clients/${id}`); const { data } = await axios.get(`Clients/${id}`, {
selectedAddress.value = clientData.data.defaultAddressFk; params: { filter: { include: { relation: 'addresses' } } },
data.addressId = selectedAddress.value; });
addressesList.value = data.addresses;
formData.addressId = data.defaultAddressFk;
fetchAgencies(formData);
}
async function fetchAgencies({ landed, addressId }) {
if (!landed || !addressId) return (agencyList.value = []);
const { data } = await axios.get('Agencies/landsThatDay', {
params: { addressFk: addressId, landed },
});
agencyList.value = data;
} }
</script> </script>
<template> <template>
<VnSearchbar <OrderSearchbar />
data-key="OrderList" <RightMenu>
:label="t('Search order')" <template #right-panel>
:info="t('You can search orders by reference')" <OrderFilter data-key="OrderList" />
/> </template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="OrderList" data-key="OrderList"
url="Orders/filter" url="Orders/filter"
:order="['landed DESC', 'clientFk ASC', 'id DESC']"
:create="{ :create="{
urlCreate: 'Orders/new', urlCreate: 'Orders/new',
title: 'Create Order', title: 'Create Order',
@ -152,36 +178,49 @@ async function fetchClientAddress(id, data) {
addressId: null, addressId: null,
}, },
}" }"
:user-params="{ showEmpty: false }"
:right-search="false"
:columns="columns" :columns="columns"
redirect="order" redirect="order"
auto-load
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnSelect <VnSelect
url="Clients" url="Clients"
v-model="data.id" :include="{ relation: 'addresses' }"
v-model="clientId"
:label="t('module.customer')" :label="t('module.customer')"
:options="clientList"
option-value="id"
option-label="name"
@update:model-value="(id) => fetchClientAddress(id, data)" @update:model-value="(id) => fetchClientAddress(id, data)"
/> />
<VnSelect <VnSelect
url="Clients" v-model="data.addressId"
v-model="selectedAddress" :options="addressesList"
:label="t('module.address')" :label="t('module.address')"
:options="selectedAddress" option-value="id"
option-value="defaultAddressFk" option-label="nickname"
option-label="street" @update:model-value="() => fetchAgencies(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnInputDate
v-model="data.landed"
:label="t('module.landed')"
@update:model-value="() => fetchAgencies(data)"
/> />
<VnInputDate v-model="data.landed" :label="t('module.landed')" />
<VnSelect <VnSelect
url="Agencies"
v-model="data.agencyModeId" v-model="data.agencyModeId"
:label="t('module.agency')" :label="t('module.agency')"
:options="agencyList" :options="agencyList"
option-value="id" option-value="agencyModeFk"
option-label="name" option-label="agencyMode"
/> />
</template> </template>
</VnTable> </VnTable>

View File

@ -1,156 +0,0 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue';
import VnLv from 'components/ui/VnLv.vue';
import CardList from 'components/ui/CardList.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import { dashIfEmpty } from 'src/filters';
import axios from 'axios';
const route = useRoute();
const { t } = useI18n();
const volumeSummary = ref(null);
const loadVolumes = async (rows) => {
const { data } = await axios.get(`Orders/${route.params.id}/getVolumes`);
(rows || []).forEach((order) => {
(data.volumes || []).forEach((volume) => {
if (order.itemFk === volume.itemFk) {
order.volume = volume.volume;
}
});
});
};
</script>
<template>
<FetchData
:url="`Orders/${route.params.id}/getTotalVolume`"
@on-fetch="(data) => (volumeSummary = data)"
auto-load
/>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<div
v-if="!volumeSummary?.totalVolume && !volumeSummary?.totalBoxes"
class="no-result"
>
{{ t('globals.noResults') }}
</div>
<QCard v-else class="order-volume-summary q-pa-lg">
<p class="header text-right block">
{{ t('summary') }}
</p>
<VnLv :label="t('total')" :value="`${volumeSummary?.totalVolume} m³`" />
<VnLv
:label="t('boxes')"
:value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`"
/>
</QCard>
<VnPaginate
data-key="OrderCatalogVolume"
url="OrderRows"
:limit="20"
auto-load
:filter="{
include: {
relation: 'item',
},
where: { orderFk: route.params.id },
}"
order="itemFk"
@on-fetch="(data) => loadVolumes(data)"
>
<template #body="{ rows }">
<div class="catalog-list q-mt-xl">
<CardList
v-for="row in rows"
:key="row.id"
:id="row.id"
:title="row?.item?.name"
class="cursor-inherit"
>
<template #list-items>
<div class="q-mb-sm">
<FetchedTags :item="row.item" :max-length="5" />
</div>
<VnLv :label="t('item')" :value="row.item.id" />
<VnLv :label="t('subName')">
<template #value>
<span class="text-uppercase">
{{ row.item.subName }}
</span>
</template>
</VnLv>
<VnLv :label="t('quantity')" :value="row.quantity" />
<VnLv :label="t('volume')" :value="row.volume" />
</template>
</CardList>
</div>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<style lang="scss">
.order-volume-summary {
.vn-label-value {
display: flex;
justify-content: flex-end;
gap: 2%;
.label {
color: var(--vn-label-color);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>
<style lang="scss" scoped>
.header {
color: $primary;
font-weight: bold;
margin-bottom: 25px;
font-size: 20px;
display: inline-block;
}
.no-result {
font-size: 24px;
font-weight: bold;
color: var(--vn-label-color);
text-align: center;
}
</style>
<i18n>
en:
summary: Summary
total: Total
boxes: Boxes
item: Item
subName: Subname
quantity: Quantity
volume: per quantity
es:
summary: Resumen
total: Total
boxes: Cajas
item: Artículo
subName: Subname
quantity: Cantidad
volume: por cantidad
</i18n>

View File

@ -3,6 +3,7 @@ import { 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';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -15,25 +16,13 @@ const props = defineProps({
const emit = defineEmits(['search']); const emit = defineEmits(['search']);
const workers = ref(); const workers = ref();
const parkings = ref();
function setWorkers(data) { function setWorkers(data) {
workers.value = data; workers.value = data;
} }
function setParkings(data) {
parkings.value = data;
}
</script> </script>
<template> <template>
<FetchData
url="Parkings"
:filter="{ fields: ['id', 'code'] }"
sort-by="code ASC"
@on-fetch="setParkings"
auto-load
/>
<FetchData <FetchData
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }" :filter="{ where: { role: 'salesPerson' } }"
@ -54,44 +43,36 @@ function setParkings(data) {
</template> </template>
<template #body="{ params }"> <template #body="{ params }">
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection v-if="!parkings"> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <VnSelect
</QItemSection> v-model="params.parkingFk"
<QItemSection v-if="parkings"> url="Parkings"
<QSelect :fields="['id', 'code']"
:label="t('params.parkingFk')"
option-value="id"
option-label="code"
:filter-options="['id', 'code']"
dense dense
outlined outlined
rounded rounded
:label="t('params.parkingFk')" sort-by="code ASC"
v-model="params.parkingFk"
:options="parkings"
option-value="id"
option-label="code"
emit-value
map-options
use-input
:input-debounce="0"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection v-if="!workers"> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <VnSelect
</QItemSection>
<QItemSection v-if="workers">
<QSelect
dense dense
outlined outlined
rounded rounded
:label="t('params.userFk')" :label="t('params.userFk')"
v-model="params.userFk" v-model="params.userFk"
:options="workers" url="Workers/activeWithInheritedRole"
option-value="id" option-value="id"
option-label="name" option-label="firstName"
emit-value :where="{ role: 'salesPerson' }"
map-options sort-by="firstName ASC"
use-input :use-like="false"
:input-debounce="0"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -1,12 +1,11 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -20,30 +19,6 @@ const defaultInitialData = {
isRecyclable: false, isRecyclable: false,
}; };
const parkingFilter = { fields: ['id', 'code'] };
const parkingList = ref([]);
const parkingListCopy = ref([]);
const setParkingList = (data) => {
parkingList.value = data;
parkingListCopy.value = data;
};
const parkingSelectFilter = {
options: parkingList,
filterFn: (options, value) => {
const search = value.trim().toLowerCase();
if (!search || search === '') {
return parkingListCopy.value;
}
return options.value.filter((option) =>
option.code.toLowerCase().startsWith(search)
);
},
};
const shelvingFilter = { const shelvingFilter = {
include: [ include: [
{ {
@ -68,12 +43,6 @@ const onSave = (shelving, newShelving) => {
</script> </script>
<template> <template>
<VnSubToolbar /> <VnSubToolbar />
<FetchData
url="Parkings"
:filter="parkingFilter"
@on-fetch="setParkingList"
auto-load
/>
<FormModel <FormModel
:url="isNew ? null : `Shelvings/${shelvingId}`" :url="isNew ? null : `Shelvings/${shelvingId}`"
:url-create="isNew ? 'Shelvings' : null" :url-create="isNew ? 'Shelvings' : null"
@ -84,27 +53,22 @@ const onSave = (shelving, newShelving) => {
:form-initial-data="defaultInitialData" :form-initial-data="defaultInitialData"
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
v-model="data.code" v-model="data.code"
:label="t('shelving.basicData.code')" :label="t('shelving.basicData.code')"
:rules="validate('Shelving.code')" :rules="validate('Shelving.code')"
/> />
<QSelect <VnSelect
v-model="data.parkingFk" v-model="data.parkingFk"
:options="parkingList" url="Parkings"
option-value="id" option-value="id"
option-label="code" option-label="code"
emit-value :filter-options="['id', 'code']"
:fields="['id', 'code']"
:label="t('shelving.basicData.parking')" :label="t('shelving.basicData.parking')"
map-options
use-input
@filter="
(value, update) => filter(value, update, parkingSelectFilter)
"
:rules="validate('Shelving.parkingFk')" :rules="validate('Shelving.parkingFk')"
:input-debounce="0"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>

View File

@ -30,7 +30,6 @@ const { t } = useI18n();
const agencyFetchRef = ref(null); const agencyFetchRef = ref(null);
const zonesFetchRef = ref(null); const zonesFetchRef = ref(null);
const clientsOptions = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
@ -273,15 +272,6 @@ const redirectToCustomerAddress = () => {
onMounted(() => onFormModelInit()); onMounted(() => onFormModelInit());
</script> </script>
<template> <template>
<FetchData
url="Clients"
:filter="{
fields: ['id', 'name'],
order: 'id',
}"
@on-fetch="(data) => (clientsOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
@ -317,7 +307,9 @@ onMounted(() => onFormModelInit());
v-model="clientId" v-model="clientId"
option-value="id" option-value="id"
option-label="name" option-label="name"
:options="clientsOptions" url="Clients"
:fields="['id', 'name']"
sort-by="id"
hide-selected hide-selected
map-options map-options
:required="true" :required="true"

View File

@ -17,9 +17,7 @@ const { t } = useI18n();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const stateFetchDataRef = ref(null); const stateFetchDataRef = ref(null);
const statesOptions = ref([]); const statesOptions = ref([]);
const workersOptions = ref([]);
const onStateFkChange = (formData) => (formData.userFk = user.value.id); const onStateFkChange = (formData) => (formData.userFk = user.value.id);
</script> </script>
@ -30,12 +28,6 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
auto-load auto-load
@on-fetch="(data) => (statesOptions = data)" @on-fetch="(data) => (statesOptions = data)"
/> />
<FetchData
url="Workers/search"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (workersOptions = data)"
/>
<FormModelPopup <FormModelPopup
:title="t('Create tracking')" :title="t('Create tracking')"
url-create="Tickets/state" url-create="Tickets/state"
@ -57,7 +49,9 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
<VnSelect <VnSelect
:label="t('tracking.worker')" :label="t('tracking.worker')"
v-model="data.userFk" v-model="data.userFk"
:options="workersOptions" url="Workers/search"
fields=" ['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"

View File

@ -30,10 +30,13 @@ const actions = {
let clonedTicketId; let clonedTicketId;
try { try {
const { data } = await axios.post(`Tickets/${ticketId}/clone`, { const { data } = await axios.post(`Tickets/cloneAll`, {
shipped: ticket.value.shipped, shipped: ticket.value.shipped,
ticketsIds: [ticket.value.id],
withWarehouse: true,
negative: false,
}); });
clonedTicketId = data; clonedTicketId = data[0].id;
} catch (e) { } catch (e) {
opts.message = t('It was not able to clone the ticket'); opts.message = t('It was not able to clone the ticket');
opts.type = 'negative'; opts.type = 'negative';

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, onUnmounted, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketEditManaProxy from './TicketEditMana.vue'; import TicketEditManaProxy from './TicketEditMana.vue';
@ -35,7 +34,6 @@ const selectedExpeditions = ref([]);
const allColumnNames = ref([]); const allColumnNames = ref([]);
const visibleColumns = ref([]); const visibleColumns = ref([]);
const newTicketWithRoute = ref(false); const newTicketWithRoute = ref(false);
const itemsOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -139,7 +137,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: itemsOptions.value, url: 'Items',
fields: ['id', 'name'],
'sort-by': 'name ASC',
'option-value': 'id', 'option-value': 'id',
'option-label': 'name', 'option-label': 'name',
dense: true, dense: true,
@ -268,19 +268,12 @@ onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
const filteredColumns = columns.value.filter((col) => col.name !== 'history'); const filteredColumns = columns.value.filter((col) => col.name !== 'history');
allColumnNames.value = filteredColumns.map((col) => col.name); allColumnNames.value = filteredColumns.map((col) => col.name);
// await expeditionsArrayData.fetch({ append: false });
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
<FetchData
url="Items"
auto-load
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemsOptions = data)"
/>
<VnSubToolbar> <VnSubToolbar>
<template #st-data> <template #st-data>
<TableVisibleColumns <TableVisibleColumns

View File

@ -11,7 +11,6 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketEditManaProxy from './TicketEditMana.vue'; import TicketEditManaProxy from './TicketEditMana.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import TicketSaleMoreActions from './TicketSaleMoreActions.vue'; import TicketSaleMoreActions from './TicketSaleMoreActions.vue';
import TicketTransfer from './TicketTransfer.vue'; import TicketTransfer from './TicketTransfer.vue';
@ -39,7 +38,6 @@ const ticketConfig = ref(null);
const isLocked = ref(false); const isLocked = ref(false);
const isTicketEditable = ref(false); const isTicketEditable = ref(false);
const sales = ref([]); const sales = ref([]);
const itemsWithNameOptions = ref([]);
const editableStatesOptions = ref([]); const editableStatesOptions = ref([]);
const selectedSales = ref([]); const selectedSales = ref([]);
const mana = ref(null); const mana = ref(null);
@ -436,12 +434,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
auto-load auto-load
@on-fetch="(data) => (isLocked = data)" @on-fetch="(data) => (isLocked = data)"
/> />
<FetchData
url="Items/withName"
:filter="{ fields: ['id', 'name'], order: 'id DESC' }"
auto-load
@on-fetch="(data) => (itemsWithNameOptions = data)"
/>
<FetchData <FetchData
url="States/editableStates" url="States/editableStates"
:filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }" :filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
@ -627,10 +619,12 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</div> </div>
<VnSelect <VnSelect
v-else v-else
:options="itemsWithNameOptions"
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"
url="Items/withName"
:fields="['id', 'name']"
sort-by="id DESC"
@update:model-value="changeQuantity(row)" @update:model-value="changeQuantity(row)"
v-model="row.itemFk" v-model="row.itemFk"
> >

View File

@ -153,14 +153,22 @@ const setReserved = async (reserved) => {
}; };
const createRefund = async (withWarehouse) => { const createRefund = async (withWarehouse) => {
if (!props.sales) return; if (!props.ticket) return;
const salesIds = props.sales.map((sale) => sale.id); const params = {
const params = { salesIds: salesIds, withWarehouse: withWarehouse, negative: true }; ticketsIds: [props.ticket.id],
const { data } = await axios.post('Sales/clone', params); withWarehouse: withWarehouse,
const [refundTicket] = data; negative: true,
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive'); };
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
try {
const { data } = await axios.post('Tickets/cloneAll', params);
const [refundTicket] = data;
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
} catch (error) {
console.error(error);
}
}; };
</script> </script>
@ -244,7 +252,7 @@ const createRefund = async (withWarehouse) => {
</QItem> </QItem>
<QItem clickable v-ripple> <QItem clickable v-ripple>
<QItemSection> <QItemSection>
<QItemLabel>{{ t('Refund...') }}</QItemLabel> <QItemLabel>{{ t('Refund') }}</QItemLabel>
</QItemSection> </QItemSection>
<QItemSection side> <QItemSection side>
<QIcon name="keyboard_arrow_right" /> <QIcon name="keyboard_arrow_right" />
@ -279,7 +287,7 @@ es:
Add claim: Crear reclamación Add claim: Crear reclamación
Mark as reserved: Marcar como reservado Mark as reserved: Marcar como reservado
Unmark as reserved: Desmarcar como reservado Unmark as reserved: Desmarcar como reservado
Refund...: Abono... Refund: Abono
with warehouse: con almacén with warehouse: con almacén
without warehouse: sin almacén without warehouse: sin almacén
Claim out of time: Reclamación fuera de plazo Claim out of time: Reclamación fuera de plazo

View File

@ -26,8 +26,6 @@ const saleTrackingFetchDataRef = ref(null);
const sales = ref([]); const sales = ref([]);
const saleTrackings = ref([]); const saleTrackings = ref([]);
const itemShelvignsSales = ref([]); const itemShelvignsSales = ref([]);
const shelvingsOptions = ref([]);
const parkingsOptions = ref([]);
const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`); const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`);
const oldQuantity = ref(null); const oldQuantity = ref(null);
@ -330,12 +328,6 @@ const qCheckBoxController = (sale, action) => {
auto-load auto-load
@on-fetch="(data) => (sales = data)" @on-fetch="(data) => (sales = data)"
/> />
<FetchData
url="Shelvings"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<FetchData url="Parkings" auto-load @on-fetch="(data) => (parkingsOptions = data)" />
<QTable <QTable
:rows="sales" :rows="sales"
:columns="columns" :columns="columns"
@ -500,7 +492,7 @@ const qCheckBoxController = (sale, action) => {
<template #body-cell-shelving="{ row }"> <template #body-cell-shelving="{ row }">
<QTd auto-width> <QTd auto-width>
<VnSelect <VnSelect
:options="shelvingsOptions" url="Shelvings"
hide-selected hide-selected
option-label="code" option-label="code"
option-value="code" option-value="code"
@ -513,7 +505,7 @@ const qCheckBoxController = (sale, action) => {
<template #body-cell-parking="{ row }"> <template #body-cell-parking="{ row }">
<QTd auto-width> <QTd auto-width>
<VnSelect <VnSelect
:options="parkingsOptions" url="Parkings"
hide-selected hide-selected
option-label="code" option-label="code"
option-value="id" option-value="id"

View File

@ -448,7 +448,7 @@ const handleCloseProgressDialog = () => {
const handleCancelProgress = () => (cancelProgress.value = true); const handleCancelProgress = () => (cancelProgress.value = true);
onMounted(async () => { onMounted(async () => {
let today = Date.vnNew(); let today = Date.vnNew().toISOString();
const tomorrow = new Date(today); const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1); tomorrow.setDate(tomorrow.getDate() + 1);
userParams.dateFuture = tomorrow; userParams.dateFuture = tomorrow;

View File

@ -55,7 +55,7 @@ onMounted(async () => await getItemPackingTypes());
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
:hidden-tags="['search']" :hidden-tags="['search']"
:unremovable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']" :un-removable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -70,7 +70,6 @@ onMounted(async () => await getItemPackingTypes());
v-model="params.dateFuture" v-model="params.dateFuture"
:label="t('params.dateFuture')" :label="t('params.dateFuture')"
is-outlined is-outlined
@update:model-value="searchFn()"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -80,7 +79,6 @@ onMounted(async () => await getItemPackingTypes());
v-model="params.dateToAdvance" v-model="params.dateToAdvance"
:label="t('params.dateToAdvance')" :label="t('params.dateToAdvance')"
is-outlined is-outlined
@update:model-value="searchFn()"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -8,6 +8,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import TicketFutureFilter from './TicketFutureFilter.vue';
import { dashIfEmpty, toCurrency } from 'src/filters'; import { dashIfEmpty, toCurrency } from 'src/filters';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
@ -37,9 +39,9 @@ const exprBuilder = (param, value) => {
return { liters: value }; return { liters: value };
case 'lines': case 'lines':
return { lines: value }; return { lines: value };
case 'ipt': case 'iptColFilter':
return { ipt: { like: `%${value}%` } }; return { ipt: { like: `%${value}%` } };
case 'futureIpt': case 'futureIptColFilter':
return { futureIpt: { like: `%${value}%` } }; return { futureIpt: { like: `%${value}%` } };
case 'totalWithVat': case 'totalWithVat':
return { totalWithVat: value }; return { totalWithVat: value };
@ -47,8 +49,8 @@ const exprBuilder = (param, value) => {
}; };
const userParams = reactive({ const userParams = reactive({
futureDated: Date.vnNew(), futureDated: Date.vnNew().toISOString(),
originDated: Date.vnNew(), originDated: Date.vnNew().toISOString(),
warehouseFk: user.value.warehouseFk, warehouseFk: user.value.warehouseFk,
}); });
@ -83,6 +85,8 @@ const getInputEvents = (col) => {
}; };
}; };
const tickets = computed(() => store.data);
const ticketColumns = computed(() => [ const ticketColumns = computed(() => [
{ {
label: t('futureTickets.problems'), label: t('futureTickets.problems'),
@ -121,7 +125,7 @@ const ticketColumns = computed(() => [
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnSelect, component: VnSelect,
filterParamKey: 'ipt', filterParamKey: 'iptColFilter',
type: 'select', type: 'select',
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
@ -214,7 +218,7 @@ const ticketColumns = computed(() => [
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnSelect, component: VnSelect,
filterParamKey: 'futureIpt', filterParamKey: 'futureIptColFilter',
type: 'select', type: 'select',
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
@ -305,9 +309,14 @@ onMounted(async () => {
</QBtn> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<RightMenu>
<template #right-panel>
<TicketFutureFilter data-key="FutureTickets" />
</template>
</RightMenu>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:rows="store.data" :rows="tickets"
:columns="ticketColumns" :columns="ticketColumns"
row-key="id" row-key="id"
selection="multiple" selection="multiple"

View File

@ -0,0 +1,242 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInput from 'src/components/common/VnInput.vue';
import axios from 'axios';
import { onMounted } from 'vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const warehousesOptions = ref([]);
const itemPackingTypes = ref([]);
const stateOptions = ref([]);
const getItemPackingTypes = async () => {
try {
const filter = {
where: { isActive: true },
};
const { data } = await axios.get('ItemPackingTypes', {
params: { filter: JSON.stringify(filter) },
});
itemPackingTypes.value = data.map((ipt) => ({
description: t(ipt.description),
code: ipt.code,
}));
} catch (error) {
console.error(error);
}
};
const getGroupedStates = async () => {
try {
const { data } = await axios.get('AlertLevels');
stateOptions.value = data.map((state) => ({
id: state.id,
name: t(`futureTickets.${state.code}`),
code: state.code,
}));
} catch (error) {
console.error(error);
}
};
onMounted(async () => {
getItemPackingTypes();
getGroupedStates();
});
</script>
<template>
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
auto-load
/>
<VnFilterPanel
:data-key="props.dataKey"
:hidden-tags="['search']"
:un-removable-params="['warehouseFk', 'originDated', 'futureDated']"
>
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem class="q-my-sm">
<QItemSection>
<VnInputDate
v-model="params.originDated"
:label="t('params.originDated')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem class="q-my-sm">
<QItemSection>
<VnInputDate
v-model="params.futureDated"
:label="t('params.futureDated')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem class="q-my-sm">
<QItemSection>
<VnInput
:label="t('params.litersMax')"
v-model="params.litersMax"
is-outlined
/>
</QItemSection>
</QItem>
<QItem class="q-my-sm">
<QItemSection>
<VnInput
:label="t('params.linesMax')"
v-model="params.linesMax"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.ipt')"
v-model="params.ipt"
:options="itemPackingTypes"
option-value="code"
option-label="description"
:info="t('iptInfo')"
@update:model-value="searchFn()"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.futureIpt')"
v-model="params.futureIpt"
:options="itemPackingTypes"
option-value="code"
option-label="description"
:info="t('iptInfo')"
@update:model-value="searchFn()"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.state')"
v-model="params.state"
:options="stateOptions"
option-value="code"
option-label="name"
@update:model-value="searchFn()"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.futureState')"
v-model="params.futureState"
:options="stateOptions"
option-value="code"
option-label="name"
@update:model-value="searchFn()"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.problems')"
v-model="params.problems"
:toggle-indeterminate="false"
@update:model-value="searchFn()"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.warehouseFk')"
v-model="params.warehouseFk"
:options="warehousesOptions"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
iptInfo: IPT
params:
originDated: Origin date
futureDated: Destination date
futureIpt: Destination IPT
ipt: Origin IPT
warehouseFk: Warehouse
litersMax: Max liters
linesMax: Max lines
state: Origin grouped state
futureState: Destination grouped state
problems: With problems
es:
Horizontal: Horizontal
Vertical: Vertical
iptInfo: Encajado
params:
originDated: Fecha origen
futureDated: Fecha destino
futureIpt: IPT destino
ipt: IPT Origen
warehouseFk: Almacén
litersMax: Litros máx.
linesMax: Líneas máx.
state: Estado agrupado origen
futureState: Estado agrupado destino
problems: Con problemas
</i18n>

View File

@ -93,6 +93,11 @@ futureTickets:
moveTicketSuccess: Tickets moved successfully! moveTicketSuccess: Tickets moved successfully!
searchInfo: Search future tickets by date searchInfo: Search future tickets by date
futureTicket: Future tickets futureTicket: Future tickets
FREE: Free
ON_PREVIOUS: ON_PREVIOUS
ON_PREPARATION: On preparation
PACKED: Packed
DELIVERED: Delivered
expedition: expedition:
id: Expedition id: Expedition
item: Item item: Item

View File

@ -140,6 +140,11 @@ futureTickets:
moveTicketSuccess: Tickets movidos correctamente moveTicketSuccess: Tickets movidos correctamente
searchInfo: Buscar tickets por fecha searchInfo: Buscar tickets por fecha
futureTicket: Tickets a futuro futureTicket: Tickets a futuro
FREE: Libre
ON_PREVIOUS: ON_PREVIOUS
ON_PREPARATION: En preparación
PACKED: Encajado
DELIVERED: Servido
ticketSale: ticketSale:
id: Id id: Id
visible: Visible visible: Visible

View File

@ -20,7 +20,6 @@ const props = defineProps({
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const continentsOptions = ref([]); const continentsOptions = ref([]);
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
const suppliersOptions = ref([]);
const warehousesByContinent = ref({}); const warehousesByContinent = ref({});
const add = (paramsObj, key) => { const add = (paramsObj, key) => {
@ -76,12 +75,6 @@ warehouses();
@on-fetch="(data) => (agenciesOptions = data)" @on-fetch="(data) => (agenciesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -220,7 +213,7 @@ warehouses();
<VnSelect <VnSelect
:label="t('globals.pageTitles.supplier')" :label="t('globals.pageTitles.supplier')"
v-model="params.cargoSupplierFk" v-model="params.cargoSupplierFk"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

@ -10,6 +10,7 @@ import useCardDescription from 'src/composables/useCardDescription';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios'; import axios from 'axios';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import EditPictureForm from 'components/EditPictureForm.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -18,6 +19,7 @@ const $props = defineProps({
default: null, default: null,
}, },
}); });
const image = ref(null);
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -25,6 +27,10 @@ const state = useState();
const user = state.getUser(); const user = state.getUser();
const changePasswordFormDialog = ref(null); const changePasswordFormDialog = ref(null);
const cardDescriptorRef = ref(null); const cardDescriptorRef = ref(null);
const showEditPhotoForm = ref(false);
const toggleEditPictureForm = () => {
showEditPhotoForm.value = !showEditPhotoForm.value;
};
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
@ -99,7 +105,9 @@ const handleExcluded = async () => {
workerExcluded.value = !workerExcluded.value; workerExcluded.value = !workerExcluded.value;
}; };
const handlePhotoUpdated = (evt = false) => {
image.value.reload(evt);
};
const refetch = async () => await cardDescriptorRef.value.getData(); const refetch = async () => await cardDescriptorRef.value.getData();
</script> </script>
<template> <template>
@ -144,27 +152,49 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</QItem> </QItem>
</template> </template>
<template #before> <template #before>
<VnImg <div class="relative-position">
:id="parseInt(entityId)" <VnImg
collection="user" ref="image"
resolution="520x520" :id="parseInt(entityId)"
class="photo" collection="user"
> resolution="520x520"
<template #error> class="photo"
<div >
class="absolute-full picture text-center q-pa-md flex flex-center" <template #error>
> <div
<div> class="absolute-full picture text-center q-pa-md flex flex-center"
<div class="text-grey-5" style="opacity: 0.4; font-size: 5vh"> >
<QIcon name="vn:claims" /> <div>
</div> <div
<div class="text-grey-5" style="opacity: 0.4"> class="text-grey-5"
{{ t('worker.imageNotFound') }} style="opacity: 0.4; font-size: 5vh"
>
<QIcon name="vn:claims" />
</div>
<div class="text-grey-5" style="opacity: 0.4">
{{ t('worker.imageNotFound') }}
</div>
</div> </div>
</div> </div>
</div> </template> </VnImg
</template> ><QBtn
</VnImg> color="primary"
size="lg"
round
class="edit-photo-btn"
@click="toggleEditPictureForm()"
>
<QIcon name="edit" size="sm" />
<QDialog ref="editPhotoFormDialog" v-model="showEditPhotoForm">
<EditPictureForm
collection="user"
:id="entityId"
@close-form="toggleEditPictureForm()"
@on-photo-uploaded="handlePhotoUpdated"
/>
</QDialog>
</QBtn>
</div>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" /> <VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />

View File

@ -10,11 +10,6 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const routeName = computed(() => route.name); const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
if (routeName.value === 'ZoneLocations') return null;
return routeName.value;
});
const searchbarMakeFetch = computed(() => routeName.value !== 'ZoneEvents');
const searchBarDataKeys = { const searchBarDataKeys = {
ZoneWarehouses: 'ZoneWarehouses', ZoneWarehouses: 'ZoneWarehouses',
ZoneSummary: 'ZoneSummary', ZoneSummary: 'ZoneSummary',

View File

@ -46,7 +46,7 @@ export { Router };
export default route(function (/* { store, ssrContext } */) { export default route(function (/* { store, ssrContext } */) {
Router.beforeEach(async (to, from, next) => { Router.beforeEach(async (to, from, next) => {
const { isLoggedIn } = session; const { isLoggedIn } = session;
const outLayout = ['Login', 'TwoFactor', 'VerifyEmail']; const outLayout = Router.options.routes[0].children.map((r) => r.name);
if (!isLoggedIn() && !outLayout.includes(to.name)) { if (!isLoggedIn() && !outLayout.includes(to.name)) {
return next({ name: 'Login', query: { redirect: to.fullPath } }); return next({ name: 'Login', query: { redirect: to.fullPath } });
} }

View File

@ -65,13 +65,13 @@ export default {
component: () => import('src/pages/Account/AccountAliasList.vue'), component: () => import('src/pages/Account/AccountAliasList.vue'),
}, },
{ {
path: 'connections', path: 'acls',
name: 'AccountConnections', name: 'AccountAcls',
meta: { meta: {
title: 'connections', title: 'acls',
icon: 'check', icon: 'check',
}, },
component: () => import('src/pages/Account/AccountConnections.vue'), component: () => import('src/pages/Account/AccountAcls.vue'),
}, },
{ {
path: 'accounts', path: 'accounts',
@ -104,13 +104,13 @@ export default {
component: () => import('src/pages/Account/AccountSamba.vue'), component: () => import('src/pages/Account/AccountSamba.vue'),
}, },
{ {
path: 'acls', path: 'connections',
name: 'AccountAcls', name: 'AccountConnections',
meta: { meta: {
title: 'acls', title: 'connections',
icon: 'check', icon: 'share',
}, },
component: () => import('src/pages/Account/AccountAcls.vue'), component: () => import('src/pages/Account/AccountConnections.vue'),
}, },
{ {
path: 'acl-form', path: 'acl-form',

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