Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6767-deleteDivCol

This commit is contained in:
Jon Elias 2024-05-03 08:56:38 +02:00
commit 8f0af24f50
92 changed files with 3996 additions and 297 deletions

View File

@ -124,11 +124,16 @@ async function onSubmit() {
});
}
isLoading.value = true;
await saveChanges();
await saveChanges($props.saveFn ? formData.value : null);
}
async function saveChanges(data) {
if ($props.saveFn) return $props.saveFn(data, getChanges);
if ($props.saveFn) {
$props.saveFn(data, getChanges);
isLoading.value = false;
hasChanges.value = false;
return;
}
const changes = data || getChanges();
try {
await axios.post($props.saveUrl || $props.url + '/crud', changes);

View File

@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import axios from 'axios';
@ -207,7 +207,7 @@ const removeTag = (index, params, search) => {
</QItem>
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.typeFk')"
v-model="params.typeFk"
:options="itemTypesOptions"
@ -235,7 +235,7 @@ const removeTag = (index, params, search) => {
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</VnSelect>
</QItemSection>
</QItem>
<QSeparator />
@ -246,7 +246,7 @@ const removeTag = (index, params, search) => {
class="q-mt-md filter-value"
>
<QItemSection class="col">
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.tag')"
v-model="value.selectedTag"
:options="tagOptions"
@ -261,7 +261,7 @@ const removeTag = (index, params, search) => {
/>
</QItemSection>
<QItemSection class="col">
<VnSelectFilter
<VnSelect
v-if="!value?.selectedTag?.isFree && value.valueOptions"
:label="t('components.itemsFilterPanel.value')"
v-model="value.value"

View File

@ -181,12 +181,21 @@ function copyUserToken() {
/>
<VnSelect
:label="t('components.userPanel.localBank')"
hide-selected
v-model="user.localBankFk"
:options="accountBankData"
option-label="bank"
option-value="id"
></VnSelect>
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>
{{ `${opt.id}: ${opt.bank}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow>
<VnRow>
<VnSelect

View File

@ -15,6 +15,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
emitDateFormat: {
type: Boolean,
default: false,
},
});
const hover = ref(false);
@ -37,7 +41,10 @@ const value = computed({
return props.modelValue;
},
set(value) {
emit('update:modelValue', joinDateAndTime(value, time.value));
emit(
'update:modelValue',
props.emitDateFormat ? new Date(value) : joinDateAndTime(value, time.value)
);
},
});

View File

@ -421,12 +421,13 @@ setLogTree();
>
<div class="timeline">
<div class="user-avatar">
<VnUserLink :worker-id="userLog.user.id">
<VnUserLink :worker-id="userLog?.user?.id">
<template #link>
<VnAvatar
:class="{ 'cursor-pointer': userLog.user.id }"
:worker-id="userLog.user.id"
:title="userLog.user.nickname"
:class="{ 'cursor-pointer': userLog?.user?.id }"
:worker-id="userLog?.user?.id"
:title="userLog?.user?.nickname"
:show-letter="!userLog?.user"
size="lg"
/>
</template>

View File

@ -169,6 +169,7 @@ watch(modelValue, (newValue) => {
ref="vnSelectRef"
:class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null"
virtual-scroll-slice-size="options.length"
>
<template v-if="isClearable" #append>
<QIcon

View File

@ -199,8 +199,9 @@ es:
templates:
pendingPayment: 'Su pedido está pendiente de pago.
Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias.'
minAmount: 'Es necesario un importe mínimo de 50 (Sin IVA) en su pedido
{ orderId } con llegada { landing } para recibirlo sin portes adicionales.'
minAmount: 'Te recordamos que tu pedido {orderId} es inferior a 50.
Te recomendamos amplíes para no generar costes extra, provocarán un incremento de tu tarifa.
¡Un saludo!'
orderChanges: 'Pedido {orderId} con llegada estimada día { landing }: { changes }'
en: Inglés
es: Español

View File

@ -79,6 +79,7 @@ watch(
const isLoading = ref(false);
async function search() {
store.filter.where = {};
isLoading.value = true;
const params = { ...userParams.value };
store.userParamsChanged = true;

View File

@ -95,6 +95,8 @@ const addFilter = async (filter, params) => {
};
async function fetch() {
store.filter.skip = 0;
store.skip = 0;
await arrayData.fetch({ append: false });
if (!store.hasMoreData) {
isLoading.value = false;

View File

@ -81,8 +81,10 @@ async function search() {
const staticParams = Object.entries(store.userParams).filter(
([key, value]) => value && (props.staticParams || []).includes(key)
);
// const filter =props?.where? { where: JSON.parse(props.where) }: {}
await arrayData.applyFilter({
params: {
// filter ,
...Object.fromEntries(staticParams),
search: searchText.value,
},
@ -106,6 +108,7 @@ async function search() {
let targetUrl;
if (path.endsWith('/list')) targetUrl = path.replace('/list', `/${targetId}/summary`);
if (path.endsWith('-list')) targetUrl = path.replace('-list', `/${targetId}/summary`);
else if (path.includes(':id')) targetUrl = path.replace(':id', targetId);
await router.push({ path: targetUrl });

View File

@ -1,6 +1,5 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({

View File

@ -3,11 +3,14 @@ import { useRole } from './useRole';
import { useUserConfig } from './useUserConfig';
import axios from 'axios';
import useNotify from './useNotify';
import { useTokenConfig } from './useTokenConfig';
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
const TOKEN = 'token';
export function useSession() {
const { notify } = useNotify();
let isCheckingToken = false;
let intervalId = null;
function getToken() {
const localToken = localStorage.getItem(TOKEN);
@ -22,10 +25,24 @@ export function useSession() {
return localTokenMultimedia || sessionTokenMultimedia || '';
}
function setToken(data) {
const storage = data.keepLogin ? localStorage : sessionStorage;
function setSession(data) {
let keepLogin = data.keepLogin;
const storage = keepLogin ? localStorage : sessionStorage;
storage.setItem(TOKEN, data.token);
storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);
storage.setItem('created', data.created);
storage.setItem('ttl', data.ttl);
sessionStorage.setItem('keepLogin', keepLogin);
}
function keepLogin() {
return sessionStorage.getItem('keepLogin');
}
function setToken({ token, tokenMultimedia }) {
const storage = keepLogin() ? localStorage : sessionStorage;
storage.setItem(TOKEN, token);
storage.setItem(TOKEN_MULTIMEDIA, tokenMultimedia);
}
async function destroyToken(url, storage, key) {
if (storage.getItem(key)) {
@ -45,11 +62,15 @@ export function useSession() {
tokenMultimedia: 'Accounts/logout',
token: 'VnUsers/logout',
};
const storage = keepLogin() ? localStorage : sessionStorage;
for (const [key, url] of Object.entries(tokens)) {
await destroyToken(url, localStorage, key);
await destroyToken(url, sessionStorage, key);
await destroyToken(url, storage, key);
}
localStorage.clear();
sessionStorage.clear();
const { setUser } = useState();
setUser({
@ -59,22 +80,75 @@ export function useSession() {
lang: '',
darkMode: null,
});
stopRenewer();
}
async function login(token, tokenMultimedia, keepLogin) {
setToken({ token, tokenMultimedia, keepLogin });
async function login(data) {
setSession(data);
await useRole().fetch();
await useUserConfig().fetch();
await useTokenConfig().fetch();
startInterval();
}
function isLoggedIn() {
const localToken = localStorage.getItem(TOKEN);
const sessionToken = sessionStorage.getItem(TOKEN);
startInterval();
return !!(localToken || sessionToken);
}
function startInterval() {
stopRenewer();
const renewPeriod = +sessionStorage.getItem('renewPeriod');
if (!renewPeriod) return;
intervalId = setInterval(() => checkValidity(), renewPeriod * 1000);
}
function stopRenewer() {
clearInterval(intervalId);
}
async function renewToken() {
const _token = getToken();
const token = await axios.post('VnUsers/renewToken', {
headers: { Authorization: _token },
});
const _tokenMultimedia = getTokenMultimedia();
const tokenMultimedia = await axios.post('VnUsers/renewToken', {
headers: { Authorization: _tokenMultimedia },
});
setToken({ token: token.data.id, tokenMultimedia: tokenMultimedia.data.id });
}
async function checkValidity() {
const { getTokenConfig } = useState();
const tokenConfig = getTokenConfig() ?? sessionStorage.getItem('tokenConfig');
const storage = keepLogin() ? localStorage : sessionStorage;
const created = +storage.getItem('created');
const ttl = +storage.getItem('ttl');
if (isCheckingToken || !created) return;
isCheckingToken = true;
const renewPeriodInSeconds = Math.min(ttl, tokenConfig.value.renewPeriod) * 1000;
const maxDate = created + renewPeriodInSeconds;
const now = new Date().getTime();
if (isNaN(renewPeriodInSeconds) || now <= maxDate) {
return (isCheckingToken = false);
}
await renewToken();
isCheckingToken = false;
}
return {
getToken,
getTokenMultimedia,
@ -82,5 +156,8 @@ export function useSession() {
destroy,
login,
isLoggedIn,
checkValidity,
setSession,
renewToken,
};
}

View File

@ -13,6 +13,7 @@ const user = ref({
});
const roles = ref([]);
const tokenConfig = ref({});
const drawer = ref(true);
const headerMounted = ref(false);
@ -52,6 +53,15 @@ export function useState() {
function setRoles(data) {
roles.value = data;
}
function getTokenConfig() {
return computed(() => {
return tokenConfig.value;
});
}
function setTokenConfig(data) {
tokenConfig.value = data;
}
function set(name, data) {
state.value[name] = ref(data);
@ -70,6 +80,8 @@ export function useState() {
setUser,
getRoles,
setRoles,
getTokenConfig,
setTokenConfig,
set,
get,
unset,

View File

@ -0,0 +1,28 @@
import axios from 'axios';
import { useState } from './useState';
import useNotify from './useNotify';
export function useTokenConfig() {
const state = useState();
const { notify } = useNotify();
async function fetch() {
try {
const { data } = await axios.get('AccessTokenConfigs/findOne', {
filter: { fields: ['renewInterval', 'renewPeriod'] },
});
if (!data) return;
state.setTokenConfig(data);
sessionStorage.setItem('renewPeriod', data.renewPeriod);
return data;
} catch (error) {
notify('errors.tokenConfig', 'negative');
console.error('Error fetching token config:', error);
}
}
return {
fetch,
state,
};
}

View File

@ -141,15 +141,6 @@ select:-webkit-autofill {
background-color: var(--vn-section-color);
}
.q-checkbox {
& .q-checkbox__label {
color: var(--vn-text-color);
}
& .q-checkbox__inner {
color: var(--vn-label-color);
}
}
.tr-header {
color: var(--vn-label-color);
}

View File

@ -91,15 +91,22 @@ globals:
basicData: Basic data
log: Logs
parkingList: Parkings list
agencyList: Agencies list
agency: Agency
workCenters: Work centers
modes: Modes
created: Created
worker: Worker
now: Now
name: Name
new: New
errors:
statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred
statusBadGateway: It seems that the server has fall down
statusGatewayTimeout: Could not contact the server
userConfig: Error fetching user config
tokenConfig: Error fetching token config
writeRequest: The requested operation could not be completed
login:
title: Login
@ -514,7 +521,7 @@ claim:
records: records
card:
claimId: Claim ID
assignedTo: Assigned
attendedBy: Attended by
created: Created
state: State
ticketId: Ticket ID
@ -552,6 +559,7 @@ claim:
responsible: Responsible
worker: Worker
redelivery: Redelivery
changeState: Change state
basicData:
customer: Customer
assignedTo: Assigned
@ -983,7 +991,7 @@ supplier:
billingData: Billing data
payMethod: Pay method
payDeadline: Pay deadline
payDay: Día de pago
payDay: Pay day
account: Account
fiscalData: Fiscal data
sageTaxType: Sage tax type
@ -1125,7 +1133,13 @@ item:
fixedPrice: Fixed prices
wasteBreakdown: Waste breakdown
itemCreate: New item
barcode: Barcodes
tax: Tax
log: Log
botanical: Botanical
itemTypeCreate: New item type
family: Item Type
lastEntries: Last entries
descriptor:
item: Item
buyer: Buyer
@ -1210,6 +1224,17 @@ item:
minSalesQuantity: 'Cantidad mínima de venta'
genus: 'Genus'
specie: 'Specie'
item/itemType:
pageTitles:
itemType: Item type
basicData: Basic data
summary: Summary
zone:
pageTitles:
zones: Zone
zonesList: Zones
deliveryList: Delivery days
upcomingList: Upcoming deliveries
components:
topbar: {}
itemsFilterPanel:

View File

@ -91,15 +91,22 @@ globals:
basicData: Datos básicos
log: Historial
parkingList: Listado de parkings
agencyList: Listado de agencias
agency: Agencia
workCenters: Centros de trabajo
modes: Modos
created: Fecha creación
worker: Trabajador
now: Ahora
name: Nombre
new: Nuevo
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
statusBadGateway: Parece ser que el servidor ha caído
statusGatewayTimeout: No se ha podido contactar con el servidor
userConfig: Error al obtener configuración de usuario
tokenConfig: Error al obtener configuración de token
writeRequest: No se pudo completar la operación solicitada
login:
title: Inicio de sesión
@ -512,7 +519,7 @@ claim:
records: registros
card:
claimId: ID reclamación
assignedTo: Asignada a
attendedBy: Atendida por
created: Creada
state: Estado
ticketId: ID ticket
@ -550,6 +557,7 @@ claim:
responsible: Responsable
worker: Trabajador
redelivery: Devolución
changeState: Cambiar estado
basicData:
customer: Cliente
assignedTo: Asignada a
@ -1128,6 +1136,9 @@ item:
botanical: 'Botánico'
barcode: 'Código de barras'
log: Historial
itemTypeCreate: Nueva familia
family: Familia
lastEntries: Últimas entradas
descriptor:
item: Artículo
buyer: Comprador
@ -1212,6 +1223,17 @@ item:
achieved: 'Conseguido'
concept: 'Concepto'
state: 'Estado'
item/itemType:
pageTitles:
itemType: Familia
basicData: Datos básicos
summary: Resumen
zone:
pageTitles:
zones: Zona
zonesList: Zonas
deliveryList: Días de entrega
upcomingList: Próximos repartos
components:
topbar: {}
itemsFilterPanel:

View File

@ -0,0 +1,79 @@
<script setup>
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CardList from 'src/components/ui/CardList.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const router = useRouter();
const stateStore = useStateStore();
function navigate(id) {
router.push({ path: `/agency/${id}` });
}
function exprBuilder(param, value) {
if (!value) return;
if (param !== 'search') return;
if (!isNaN(value)) return { id: value };
return { name: { like: `%${value}%` } };
}
</script>
<template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
:info="t('You can search by name')"
:label="t('Search agency')"
data-key="AgencyList"
url="Agencies"
/>
</Teleport>
</template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="AgencyList"
url="Agencies"
order="name"
:expr-builder="exprBuilder"
auto-load
>
<template #body="{ rows }">
<CardList
:id="row.id"
:key="row.id"
:title="row.name"
@click="navigate(row.id)"
v-for="row of rows"
>
<template #list-items>
<QCheckbox
:label="t('isOwn')"
v-model="row.isOwn"
:disable="true"
/>
<QCheckbox
:label="t('isAnyVolumeAllowed')"
v-model="row.isAnyVolumeAllowed"
:disable="true"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -0,0 +1,52 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
const routeId = route.params?.id || null;
const warehouses = ref([]);
</script>
<template>
<FetchData
url="warehouses"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<FormModel :url="`Agencies/${routeId}`" model="agency" auto-load>
<template #form="{ data }">
<VnRow>
<VnInput v-model="data.name" :label="t('globals.name')" />
</VnRow>
<VnRow>
<VnSelect
v-model="data.warehouseFk"
option-value="id"
option-label="name"
:label="t('globals.warehouse')"
:options="warehouses"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
<VnRow>
<QCheckbox :label="t('agency.isOwn')" v-model="data.isOwn" />
</VnRow>
<VnRow>
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="data.isAnyVolumeAllowed"
/>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -0,0 +1,35 @@
<script setup>
import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import AgencyDescriptor from 'pages/Agency/Card/AgencyDescriptor.vue';
import VnCard from 'components/common/VnCard.vue';
const route = useRoute();
const arrayData = useArrayData('Agency', {
url: `Agencies/${route.params.id}`,
});
const { store } = arrayData;
onMounted(async () => await arrayData.fetch({ append: false }));
watch(
() => route.params.id,
async (newId) => {
if (newId) {
store.url = `Agencies/${newId}`;
await arrayData.fetch({ append: false });
}
}
);
</script>
<template>
<VnCard
data-key="Agency"
base-url="Agencies"
:descriptor="AgencyDescriptor"
searchbar-data-key="AgencyList"
searchbar-url="Agencies"
searchbar-label="agency.searchBar.label"
searchbar-info="agency.searchBar.info"
/>
</template>

View File

@ -0,0 +1,35 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';
const props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const { t } = useI18n();
const { params } = useRoute();
const entityId = computed(() => props.id || params.id);
const { store } = useArrayData('Parking');
const card = computed(() => store.data);
</script>
<template>
<CardDescriptor
module="Agency"
data-key="Agency"
:url="`Agencies/${entityId}`"
:title="card?.name"
:subtitle="props.id"
>
<template #body="{ entity: agency }">
<VnLv :label="t('globals.name')" :value="agency.name" />
</template>
</CardDescriptor>
</template>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Agency" url="/AgencyLogs" />
</template>

View File

@ -0,0 +1,60 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
const { t } = useI18n();
const route = useRoute();
const routeId = route.params.id;
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="AgencyModes"
:url="`AgencyModes`"
:filter="{ where: { agencyFk: routeId } }"
order="name"
auto-load
>
<template #body="{ rows }">
<CardList
:id="row.id"
:key="row.id"
:title="row.name"
v-for="row of rows"
>
<template #list-items>
<VnLv
:label="t('globals.description')"
:value="row?.description"
/>
<VnLv
:label="t('deliveryMethod')"
:value="row?.deliveryMethodFk"
/>
<VnLv label="m3" :value="row?.m3" />
<VnLv :label="t('inflation')" :value="row?.inflation" />
<VnLv :label="t('globals.code')" :value="row?.code" />
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
deliveryMethod: Método de entrega
inflation: Inflación
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -0,0 +1,55 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const $props = defineProps({
id: {
type: Number,
default: 0,
},
});
const { params } = useRoute();
const { t } = useI18n();
const entityId = computed(() => $props.id || params.id);
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
</script>
<template>
<div class="q-pa-md">
<CardSummary :url="`Agencies/${entityId}`">
<template #header="{ entity: agency }">{{ agency.name }}</template>
<template #body="{ entity: agency }">
<QCard class="vn-one">
<QCardSection class="q-pa-none">
<VnTitle
:url="`#/agency/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')"
/>
</QCardSection>
<VnLv :label="t('globals.name')" :value="agency.name" />
<QCheckbox
:label="t('agency.isOwn')"
v-model="agency.isOwn"
:disable="true"
/>
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="agency.isAnyVolumeAllowed"
:disable="true"
/>
</QCard>
</template>
</CardSummary>
</div>
</template>

View File

@ -0,0 +1,136 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
const paginate = ref();
const dialog = ref();
const routeId = computed(() => route.params.id);
const quasar = useQuasar();
const initialData = computed(() => {
return {
agencyFk: routeId.value,
workCenterFk: null,
};
});
async function deleteWorCenter(id) {
try {
await axios.delete(`AgencyWorkCenters/${id}`).then(async () => {
quasar.notify({
message: t('agency.notification.removeItem'),
type: 'positive',
});
});
} catch (error) {
quasar.notify({
message: t('agency.notification.removeItemError'),
type: 'error',
});
}
paginate.value.fetch();
}
</script>
<template>
<div class="centerCard">
<FetchData
url="workCenters"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<VnPaginate
ref="paginate"
data-key="AgencyWorkCenters"
url="AgencyWorkCenters"
:filter="{ where: { agencyFk: routeId } }"
order="id"
auto-load
>
<template #body="{ rows }">
<QCard
flat
bordered
:key="row.id"
v-for="row of rows"
class="card q-pa-md q-mb-sm"
>
<QItem>
<QItemSection side-left>
<VnLv :value="row?.workCenter?.name" icon="delete" />
</QItemSection>
<QItemSection side>
<QBtn
@click.stop="deleteWorCenter(row.id)"
icon="delete"
color="primary"
round
flat
/>
</QItemSection>
</QItem>
</QCard>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add">
<QDialog ref="dialog">
<FormModelPopup
:title="t('Add work center')"
url-create="AgencyWorkCenters"
model="AgencyWorkCenter"
:form-initial-data="initialData"
@on-data-saved="paginate.fetch()"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
v-model="data.workCenterFk"
option-value="id"
option-label="name"
:label="t('workCenter')"
:options="warehouses"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
</template>
</FormModelPopup>
</QDialog>
</QBtn>
<QTooltip>
{{ t('globals.new') }}
</QTooltip>
</QPageSticky>
</template>
<style lang="scss" scoped>
.centerCard {
padding: 5%;
width: 100%;
max-width: 50%;
margin: 0 auto;
}
</style>
<i18n>
es:
workCenter removed successfully: Centro de trabajo eliminado correctamente
This workCenter is already assigned to this agency: Este workCenter ya está asignado a esta agencia
Add work center: Añadir centro de trabajo
workCenter: Centro de trabajo
</i18n>

View File

@ -0,0 +1,11 @@
agency:
isOwn: Own
isAnyVolumeAllowed: Any volume allowed
notification:
removeItemError: Error removing agency
removeItem: WorkCenter removed successfully
pageTitles:
agency: Agency
searchBar:
info: You can search by agency code
label: Search agency...

View File

@ -0,0 +1,12 @@
agency:
isOwn: Propio
isAnyVolumeAllowed: Cualquier volumen
removeItem: Agencia eliminada correctamente
notification:
removeItemError: Error al eliminar la agencia
removeItem: Centro de trabajo eliminado correctamente
pageTitles:
agency: Agencia
searchBar:
info: Puedes buscar por nombre o id
label: Buscar agencia...

View File

@ -2,7 +2,7 @@
import { ref, computed, onMounted } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
import axios from 'axios';
import { useStateStore } from 'src/stores/useStateStore';
import { toDate, toPercentage, toCurrency } from 'filters/index';
@ -10,14 +10,13 @@ import { tMobile } from 'src/composables/tMobile';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import { useArrayData } from 'composables/useArrayData';
const { t } = useI18n();
const quasar = useQuasar();
const route = useRoute();
const router = useRouter();
const stateStore = computed(() => useStateStore());
const claim = ref(null);
const claimRef = ref();
@ -38,10 +37,11 @@ const marker_labels = [
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') },
];
const multiplicatorValue = ref();
const loading = ref(false);
const columns = computed(() => [
{
name: 'Id',
name: 'id',
label: t('Id item'),
field: (row) => row.itemFk,
},
@ -119,7 +119,7 @@ async function updateDestinations(claimDestinationFk) {
async function updateDestination(claimDestinationFk, row, options = {}) {
if (claimDestinationFk) {
await axios.post('Claims/updateClaimDestination', {
await post('Claims/updateClaimDestination', {
claimDestinationFk,
rows: Array.isArray(row) ? row : [row],
});
@ -128,7 +128,7 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
}
async function regularizeClaim() {
await axios.post(`Claims/${claimId}/regularizeClaim`);
await post(`Claims/${claimId}/regularizeClaim`);
await claimRef.value.fetch();
await arrayData.fetch({ append: false });
quasar.notify({
@ -147,7 +147,7 @@ async function onUpdateGreugeAccept() {
const freightPickUpPrice =
(await axios.get(`GreugeConfigs/findOne`)).data.freightPickUpPrice *
multiplicatorValue.value;
await axios.post(`Greuges`, {
await post(`Greuges`, {
clientFk: claim.value.clientFk,
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
amount: freightPickUpPrice,
@ -166,14 +166,22 @@ async function save(data) {
}
async function importToNewRefundTicket() {
const query = `ClaimBeginnings/${claimId}/importToNewRefundTicket`;
await axios.post(query);
claimActionsForm.value.reload();
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
await claimActionsForm.value.reload();
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
}
async function post(query, params) {
loading.value = true;
try {
await axios.post(query, params);
} finally {
loading.value = false;
}
}
</script>
<template>
<FetchData
@ -280,6 +288,7 @@ async function importToNewRefundTicket() {
:default-save="false"
:default-reset="false"
@on-fetch="setData"
:limit="0"
auto-load
>
<template #body>
@ -292,6 +301,14 @@ async function importToNewRefundTicket() {
v-model:selected="selectedRows"
:grid="$q.screen.lt.md"
>
<template #body-cell-id="{ value }">
<QTd align="center">
<span class="link">
{{ value }}
<ItemDescriptorProxy :id="value" />
</span>
</QTd>
</template>
<template #body-cell-ticket="{ value }">
<QTd align="center">
<span class="link">
@ -383,6 +400,7 @@ async function importToNewRefundTicket() {
icon="check"
@click="regularizeClaim"
:disable="claim.claimStateFk == resolvedStateId"
:loading="loading"
/>
<QBtn
@ -394,6 +412,7 @@ async function importToNewRefundTicket() {
:title="t('Change destination')"
icon="swap_horiz"
@click="dialogDestination = !dialogDestination"
:loading="loading"
/>
<QBtn
color="primary"
@ -404,6 +423,7 @@ async function importToNewRefundTicket() {
icon="Upload"
@click="importToNewRefundTicket"
:disable="claim.claimStateFk == resolvedStateId"
:loading="loading"
/>
</template>
</CrudModel>

View File

@ -2,7 +2,7 @@
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
@ -37,23 +37,19 @@ const claimFilter = {
],
};
const workers = ref([]);
const workersCopy = ref([]);
const claimStates = ref([]);
const claimStatesCopy = ref([]);
const optionsList = ref([]);
function setWorkers(data) {
workers.value = data;
workersCopy.value = data;
}
const workersOptions = ref([]);
function setClaimStates(data) {
claimStates.value = data;
claimStatesCopy.value = data;
}
let optionsList;
async function getEnumValues() {
optionsList = [{ id: null, description: t('claim.basicData.null') }];
optionsList.value = [{ id: null, description: t('claim.basicData.null') }];
const { data } = await axios.get(`Applications/get-enum-values`, {
params: {
schema: 'vn',
@ -62,29 +58,11 @@ async function getEnumValues() {
},
});
for (let value of data)
optionsList.push({ id: value, description: t(`claim.basicData.${value}`) });
optionsList.value.push({ id: value, description: t(`claim.basicData.${value}`) });
}
getEnumValues();
const workerFilter = {
options: workers,
filterFn: (options, value) => {
const search = value.toLowerCase();
if (value === '') return workersCopy.value;
return options.value.filter((row) => {
const id = row.id;
const name = row.name.toLowerCase();
const idMatches = id == search;
const nameMatches = name.indexOf(search) > -1;
return idMatches || nameMatches;
});
},
};
const statesFilter = {
options: claimStates,
filterFn: (options, value) => {
@ -104,7 +82,7 @@ const statesFilter = {
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="setWorkers"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
@ -128,18 +106,15 @@ const statesFilter = {
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<QSelect
<VnSelect
:label="t('claim.basicData.assignedTo')"
v-model="data.workerFk"
:options="workers"
:options="workersOptions"
option-value="id"
option-label="name"
emit-value
:label="t('claim.basicData.assignedTo')"
map-options
use-input
@filter="(value, update) => filter(value, update, workerFilter)"
auto-load
:rules="validate('claim.claimStateFk')"
:input-debounce="0"
>
<template #before>
<QAvatar color="orange">
@ -150,7 +125,7 @@ const statesFilter = {
/>
</QAvatar>
</template>
</QSelect>
</VnSelect>
<QSelect
v-model="data.claimStateFk"
:options="claimStates"

View File

@ -11,6 +11,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { getUrl } from 'src/composables/getUrl';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
const $props = defineProps({
id: {
@ -73,8 +74,9 @@ const filter = {
const STATE_COLOR = {
pending: 'warning',
managed: 'info',
incomplete: 'info',
resolved: 'positive',
canceled: 'negative',
};
function stateColor(code) {
return STATE_COLOR[code];
@ -127,17 +129,24 @@ onMounted(async () => {
</VnLv>
<VnLv
v-if="entity.worker"
:label="t('claim.card.assignedTo')"
:label="t('claim.card.attendedBy')"
:value="entity.worker.user.name"
>
<template #value>
<VnUserLink
:name="entity.worker.user.name"
:name="entity.worker.user.nickname"
:worker-id="entity.worker.id"
/>
</template>
</VnLv>
<VnLv :label="t('claim.card.zone')" :value="entity.ticket?.zone?.name" />
<VnLv :label="t('claim.card.zone')">
<template #value>
<span class="link">
{{ entity.ticket?.zone?.name }}
<ZoneDescriptorProxy :id="entity.ticket?.zone?.id" />
</span>
</template>
</VnLv>
<VnLv
:label="t('claim.card.province')"
:value="entity.ticket?.address?.province?.name"

View File

@ -45,20 +45,25 @@ async function onFetchClaim(data) {
const amount = ref();
const amountClaimed = ref();
async function onFetch(rows) {
async function onFetch(rows, newRows) {
if (newRows) rows = newRows;
amount.value = 0;
amountClaimed.value = 0;
if (!rows || !rows.length) return;
amount.value = rows.reduce(
(accumulator, { sale }) => accumulator + sale.price * sale.quantity,
0
);
for (const row of rows) {
const { sale } = row;
amount.value = amount.value + totalRow(sale);
const price = row.quantity * sale.price;
const discount = (sale.discount * price) / 100;
amountClaimed.value = amountClaimed.value + (price - discount);
}
}
amountClaimed.value = rows.reduce(
(accumulator, line) => accumulator + line.sale.price * line.quantity,
0
);
function totalRow({ price, quantity, discount }) {
const amount = price * quantity;
const appliedDiscount = (discount * amount) / 100;
return amount - appliedDiscount;
}
const columns = computed(() => [
@ -102,12 +107,7 @@ const columns = computed(() => [
{
name: 'total',
label: t('Total'),
field: ({ sale }) => {
const amount = sale.price * sale.quantity;
const appliedDiscount = (sale.discount * amount) / 100;
return amount - appliedDiscount;
},
field: ({ sale }) => totalRow(sale),
format: (value) => toCurrency(value),
sortable: true,
},
@ -129,6 +129,7 @@ async function updateDiscount({ saleFk, discount, canceller }) {
await axios.post(query, body, {
signal: canceller.signal,
});
await claimLinesForm.value.reload();
}
function onUpdateDiscount(response) {
@ -151,8 +152,11 @@ function showImportDialog() {
.onOk(() => claimLinesForm.value.reload());
}
function saveWhenHasChanges() {
claimLinesForm.value.getChanges().updates && claimLinesForm.value.onSubmit();
async function saveWhenHasChanges() {
if (claimLinesForm.value.getChanges().updates) {
await claimLinesForm.value.onSubmit();
await claimLinesForm.value.reload();
}
}
</script>
<template>
@ -188,7 +192,6 @@ function saveWhenHasChanges() {
save-url="ClaimBeginnings/crud"
:filter="linesFilter"
@on-fetch="onFetch"
@save-changes="onFetch"
v-model:selected="selected"
:default-save="false"
:default-reset="false"

View File

@ -1,6 +1,6 @@
<script setup>
import { onMounted, ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue';
@ -13,8 +13,11 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import axios from 'axios';
import dashIfEmpty from 'src/filters/dashIfEmpty';
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
@ -27,7 +30,7 @@ const $props = defineProps({
});
const entityId = computed(() => $props.id || route.params.id);
const ClaimStates = ref([]);
const claimUrl = ref();
const salixUrl = ref();
const claimDmsRef = ref();
@ -99,8 +102,9 @@ const detailsColumns = ref([
const STATE_COLOR = {
pending: 'warning',
managed: 'info',
incomplete: 'info',
resolved: 'positive',
canceled: 'negative',
};
function stateColor(code) {
return STATE_COLOR[code];
@ -162,6 +166,10 @@ function openDialog(dmsId) {
multimediaSlide.value = dmsId;
multimediaDialog.value = true;
}
async function changeState(value) {
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
router.go(route.fullPath);
}
</script>
<template>
@ -171,6 +179,7 @@ function openDialog(dmsId) {
@on-fetch="(data) => setClaimDms(data)"
ref="claimDmsRef"
/>
<FetchData url="ClaimStates" @on-fetch="(data) => (ClaimStates = data)" auto-load />
<CardSummary
ref="summary"
:url="`Claims/${entityId}/getSummary`"
@ -180,6 +189,36 @@ function openDialog(dmsId) {
<template #header="{ entity: { claim } }">
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
</template>
<template #header-right>
<QBtnDropdown
side
top
color="black"
text-color="white"
:label="t('ticket.summary.changeState')"
>
<QList>
<QVirtualScroll
style="max-height: 300px"
:items="ClaimStates"
separator
v-slot="{ item, index }"
>
<QItem
:key="index"
dense
clickable
v-close-popup
@click="changeState(item.id)"
>
<QItemSection>
<QItemLabel>{{ item.description }}</QItemLabel>
</QItemSection>
</QItem>
</QVirtualScroll>
</QList>
</QBtnDropdown>
</template>
<template #body="{ entity: { claim, salesClaimed, developments } }">
<QCard class="vn-one">
<VnTitle
@ -223,7 +262,7 @@ function openDialog(dmsId) {
</VnLv>
<VnLv
:label="t('claim.basicData.pickup')"
:value="t(`claim.basicData.${claim.pickup}`)"
:value="`${dashIfEmpty(claim.pickup)}`"
/>
</QCard>
<QCard class="vn-three">
@ -447,4 +486,8 @@ function openDialog(dmsId) {
.zindex {
z-index: 1;
}
.change-state {
width: 10%;
}
</style>

View File

@ -149,6 +149,15 @@ const states = ref();
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('myTeam')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QSeparator />
<QExpansionItem :label="t('More options')" expand-separator>
<!-- <QItem>
@ -192,6 +201,7 @@ en:
claimResponsibleFk: Responsible
claimStateFk: State
created: Created
myTeam: My team
es:
params:
search: Contiene
@ -211,4 +221,5 @@ es:
Item: Artículo
Created: Creada
More options: Más opciones
myTeam: Mi equipo
</i18n>

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -11,10 +11,6 @@ const route = useRoute();
const { t } = useI18n();
const customerContactsRef = ref(null);
onMounted(() => {
if (customerContactsRef.value) customerContactsRef.value.reload();
});
</script>
<template>
<div class="full-width flex justify-center">
@ -30,6 +26,7 @@ onMounted(() => {
model="CustomerContacts"
ref="customerContactsRef"
url="ClientContacts"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pl-lg q-py-md">

View File

@ -180,10 +180,13 @@ function handleLocation(data, location) {
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
v-model="data.postalCode"
@update:model-value="(location) => handleLocation(data, location)"
></VnLocation>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelect
:label="t('Agency')"
@ -202,7 +205,6 @@ function handleLocation(data, location) {
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelect
@ -229,7 +231,6 @@ function handleLocation(data, location) {
</VnSelectDialog>
</div>
</VnRow>
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
<VnRow
:key="index"

View File

@ -13,7 +13,6 @@ const router = useRouter();
const initialData = ref({});
const setClient = (data) => {
console.log(data.credit);
initialData.value.credit = data.credit;
};

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -21,10 +21,6 @@ const sortEntryObservationOptions = (data) => {
);
};
onMounted(() => {
if (entryObservationsRef.value) entryObservationsRef.value.reload();
});
const columns = computed(() => [
{
name: 'observationType',
@ -65,6 +61,7 @@ const columns = computed(() => [
ref="entryObservationsRef"
:data-required="{ entryFk: params.id }"
v-model:selected="selected"
auto-load
>
<template #body="{ rows, validate }">
<QTable

View File

@ -70,7 +70,7 @@ const columns = computed(() => [
const isNotEuro = (code) => code != 'EUR';
async function insert() {
await axios.post('/InvoiceInDueDays/new ', { id: +invoiceId });
await axios.post('/InvoiceInDueDays/new', { id: +invoiceId });
await invoiceInFormRef.value.reload();
}
</script>

View File

@ -0,0 +1,50 @@
<script setup>
import { reactive, ref, onMounted, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue';
import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from 'components/FormModelPopup.vue';
const { t } = useI18n();
const emit = defineEmits(['onDataSaved']);
const genusInputRef = ref(null);
const genusFormData = reactive({});
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
};
onMounted(async () => {
await nextTick();
genusInputRef.value.focus();
});
</script>
<template>
<FormModelPopup
url-create="genera"
model="itemGenus"
:title="t('New genus')"
:form-initial-data="genusFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
ref="genusInputRef"
:label="t('Latin genus name')"
v-model="data.name"
:required="true"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New genus: Nuevo genus
Latin genus name: Nombre del genus en latín
</i18n>

View File

@ -0,0 +1,50 @@
<script setup>
import { reactive, ref, onMounted, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue';
import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from 'components/FormModelPopup.vue';
const { t } = useI18n();
const emit = defineEmits(['onDataSaved']);
const specieInputRef = ref(null);
const specieFormData = reactive({});
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
};
onMounted(async () => {
await nextTick();
specieInputRef.value.focus();
});
</script>
<template>
<FormModelPopup
url-create="species"
model="itemSpecie"
:title="t('New species')"
:form-initial-data="specieFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
ref="specieInputRef"
:label="t('Latin species name')"
v-model="data.name"
:required="true"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New species: Nueva especie
Latin species name: Nombre de la especie en latín
</i18n>

View File

@ -1 +1,91 @@
<template>Item barcode</template>
<script setup>
import { ref, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CrudModel from 'src/components/CrudModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
const route = useRoute();
const { t } = useI18n();
const itemBarcodeRef = ref(null);
const insertRow = () => {
itemBarcodeRef.value.insert();
focusLastInput();
};
const focusLastInput = () => {
nextTick(() => {
const inputs = document.querySelectorAll('[focusable-input]');
const lastInput = inputs[inputs.length - 1];
if (lastInput) lastInput.focus();
});
};
</script>
<template>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<CrudModel
:data-required="{ itemFk: route.params.id }"
:default-remove="false"
:filter="{
fields: ['id', 'itemFk', 'code'],
where: { itemFk: route.params.id },
}"
data-key="ItemBarcodes"
model="ItemBarcodes"
ref="itemBarcodeRef"
url="ItemBarcodes"
auto-load
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">
<div
v-for="(row, index) in rows"
:key="index"
class="q-mb-md full-width row items-center no-wrap"
>
<VnInput
:label="t('Code')"
v-model="row.code"
class="full-width"
focusable-input
/>
<QIcon
@click="itemBarcodeRef.remove([row])"
class="cursor-pointer q-ml-md"
color="primary"
name="delete"
size="sm"
>
<QTooltip class="text-no-wrap">
{{ t('Remove barcode') }}
</QTooltip>
</QIcon>
</div>
<QIcon
@click="insertRow()"
class="cursor-pointer fill-icon-on-hover"
color="primary"
name="add_circle"
size="sm"
>
<QTooltip>
{{ t('Add barcode') }}
</QTooltip>
</QIcon>
</QCard>
</template>
</CrudModel>
</QPage>
</div>
</template>
<i18n>
es:
Code: Código
Remove barcode: Quitar código de barras
Add barcode: Añadir código de barras
</i18n>

View File

@ -1 +1,114 @@
<template>Item Botanical</template>
<script setup>
import { ref, onMounted, reactive, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateGenusForm from './CreateGenusForm.vue';
import CreateSpecieForm from './CreateSpecieForm.vue';
const route = useRoute();
const { t } = useI18n();
const itemBotanicalsRef = ref(null);
const itemGenusOptions = ref([]);
const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]);
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(() => {
return route.params.id;
});
onMounted(async () => {
itemBotanicalsForm.itemFk = entityId.value;
itemBotanicals.value = await itemBotanicalsRef.value.fetch();
if (itemBotanicals.value.length > 0)
Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
});
</script>
<template>
<FetchData
ref="itemBotanicalsRef"
url="ItemBotanicals"
:filter="{
where: { itemFk: entityId },
}"
@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
url-update="ItemBotanicals"
model="entry"
auto-load
:form-initial-data="itemBotanicalsForm"
:clear-store-on-unmount="false"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectDialog
:label="t('Genus')"
v-model="data.genusFk"
:options="itemGenusOptions"
option-label="name"
option-value="id"
hide-selected
>
<template #form>
<CreateGenusForm
@on-data-saved="
(_, requestResponse) =>
onGenusCreated(requestResponse, data)
"
/>
</template>
</VnSelectDialog>
<VnSelectDialog
:label="t('Species')"
v-model="data.specieFk"
:options="itemSpeciesOptions"
option-label="name"
option-value="id"
hide-selected
>
<template #form>
<CreateSpecieForm
@on-data-saved="
(_, requestResponse) =>
onSpecieCreated(requestResponse, data)
"
/>
</template>
</VnSelectDialog>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Genus: Genus
Species: Especie
</i18n>

View File

@ -177,14 +177,27 @@ const openCloneDialog = async () => {
<VnLv :label="t('item.descriptor.buyer')">
<template #value>
<span class="link">
{{ t('item.descriptor.buyer') }}
{{ entity.itemType?.worker?.user?.name }}
<WorkerDescriptorProxy :id="entity.itemType?.worker?.id" />
</span>
</template>
</VnLv>
<VnLv :label="t('item.descriptor.color')" :value="entity.value5"> </VnLv>
<VnLv :label="t('item.descriptor.color')" :value="entity.value6" />
<VnLv :label="t('item.descriptor.stems')" :value="entity.value7" />
<VnLv
v-if="entity.value5"
:label="t('item.descriptor.color')"
:value="entity.value5"
>
</VnLv>
<VnLv
v-if="entity.value6"
:label="t('item.descriptor.category')"
:value="entity.value6"
/>
<VnLv
v-if="entity.value7"
:label="t('item.descriptor.stems')"
:value="entity.value7"
/>
</template>
<template #actions="{}">
<QCardActions class="row justify-center">

View File

@ -1 +1,277 @@
<template>Item diary (CREAR CUANDO SE DESARROLLE EL MODULO DE ITEMS)</template>
<script setup>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { date } from 'quasar';
import { useState } from 'src/composables/useState';
const { t } = useI18n();
const route = useRoute();
const stateStore = useStateStore();
const state = useState();
const user = state.getUser();
const today = ref(Date.vnNew());
const warehousesOptions = ref([]);
const itemBalancesRef = ref(null);
const itemsBalanceFilter = reactive({
where: { itemFk: route.params.id, warehouseFk: null, date: null },
});
const itemBalances = ref([]);
const warehouseFk = ref(null);
const _showWhatsBeforeInventory = ref(false);
const columns = computed(() => [
{
name: 'claim',
align: 'left',
field: 'itemFk',
},
{
label: t('itemDiary.date'),
name: 'date',
field: 'shipped',
align: 'left',
},
{
label: t('itemDiary.id'),
name: 'id',
align: 'left',
},
{
label: t('itemDiary.state'),
field: 'stateName',
name: 'state',
align: 'left',
format: (val) => dashIfEmpty(val),
},
{
label: t('itemDiary.reference'),
field: 'reference',
name: 'reference',
align: 'left',
format: (val) => dashIfEmpty(val),
},
{
label: t('itemDiary.client'),
name: 'client',
align: 'left',
format: (val) => dashIfEmpty(val),
},
{
label: t('itemDiary.in'),
field: 'invalue',
name: 'in',
align: 'left',
format: (val) => dashIfEmpty(val),
},
{
label: t('itemDiary.out'),
field: 'out',
name: 'out',
align: 'left',
format: (val) => dashIfEmpty(val),
},
{
label: t('itemDiary.balance'),
name: 'balance',
align: 'left',
},
]);
const showWhatsBeforeInventory = computed({
get: () => _showWhatsBeforeInventory.value,
set: (val) => {
_showWhatsBeforeInventory.value = val;
if (!val) itemsBalanceFilter.where.date = null;
else itemsBalanceFilter.where.date = new Date();
},
});
const fetchItemBalances = async () => await itemBalancesRef.value.fetch();
const getBadgeAttrs = (_date) => {
const isSameDate = date.isSameDate(today.value, _date);
const attrs = {
'text-color': isSameDate ? 'black' : 'white',
color: isSameDate ? 'warning' : 'transparent',
};
return attrs;
};
const getIdDescriptor = (row) => {
let descriptor = EntryDescriptorProxy;
if (row.isTicket) descriptor = TicketDescriptorProxy;
return descriptor;
};
onMounted(async () => {
today.value.setHours(0, 0, 0, 0);
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk;
else if (user.value) warehouseFk.value = user.value.warehouseFk;
itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
await fetchItemBalances();
});
onUnmounted(() => (stateStore.rightDrawer = false));
</script>
<template>
<FetchData
ref="itemBalancesRef"
url="Items/getBalance"
:filter="itemsBalanceFilter"
@on-fetch="(data) => (itemBalances = data)"
/>
<FetchData
url="Warehouses"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (warehousesOptions = data)"
/>
<QToolbar class="justify-end">
<div id="st-data" class="row">
<VnSelect
:label="t('itemDiary.warehouse')"
:options="warehousesOptions"
hide-selected
option-label="name"
option-value="id"
dense
v-model="itemsBalanceFilter.where.warehouseFk"
@update:model-value="fetchItemBalances"
class="q-mr-lg"
/>
<QCheckbox
:label="t('itemDiary.showBefore')"
v-model="showWhatsBeforeInventory"
@update:model-value="fetchItemBalances"
class="q-mr-lg"
/>
<VnInputDate
v-if="showWhatsBeforeInventory"
:label="t('itemDiary.since')"
dense
v-model="itemsBalanceFilter.where.date"
@update:model-value="fetchItemBalances"
/>
</div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md">
<QTable
:rows="itemBalances"
:columns="columns"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
>
<template #body-cell-claim="{ row }">
<QTd @click.stop>
<QBtn
v-show="row.claimFk"
flat
color="primary"
:to="{ name: 'ClaimSummary', params: { id: row.claimFk } }"
icon="vn:claims"
dense
>
<QTooltip>
{{ t('itemDiary.claim') }}: {{ row.claimFk }}
</QTooltip>
</QBtn>
</QTd>
</template>
<template #body-cell-date="{ row }">
<QTd @click.stop>
<QBadge
v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ toDateFormat(row.shipped) }}
</QBadge>
</QTd>
</template>
<template #body-cell-id="{ row }">
<QTd @click.stop>
<component
:is="getIdDescriptor(row)"
:id="row.origin"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ row.origin }}
</component>
<span class="link">{{ row.origin }}</span>
</QTd>
</template>
<template #body-cell-client="{ row }">
<QTd @click.stop>
<QBadge
:color="row.highlighted ? 'warning' : 'transparent'"
:text-color="row.highlighted ? 'black' : 'white'"
dense
style="font-size: 14px"
>
<span v-if="row.isTicket" class="link">
{{ dashIfEmpty(row.name) }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
<span v-else>{{ dashIfEmpty(row.name) }}</span>
</QBadge>
</QTd>
</template>
<template #body-cell-in="{ row }">
<QTd @click.stop>
<span :class="{ 'is-in': row.invalue }">
{{ dashIfEmpty(row.invalue) }}
</span>
</QTd>
</template>
<template #body-cell-balance="{ row }">
<QTd @click.stop>
<QBadge
class="balance-negative"
:color="
row.lineFk == row.lastPreparedLineFk
? 'grey-13'
: 'transparent'
"
:text-color="
row.lineFk == row.lastPreparedLineFk
? 'black'
: row.balance < 0
? 'negative'
: ''
"
dense
style="font-size: 14px"
>
<span>{{ dashIfEmpty(row.balance) }}</span>
</QBadge>
</QTd>
</template>
</QTable>
</QPage>
</template>
<style lang="scss" scoped>
.is-in {
color: $positive;
}
</style>

View File

@ -0,0 +1,317 @@
<script setup>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateTimeFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { toCurrency } from 'filters/index';
import { useArrayData } from 'composables/useArrayData';
const { t } = useI18n();
const route = useRoute();
const stateStore = useStateStore();
const exprBuilder = (param, value) => {
switch (param) {
case 'id':
case 'quantity':
case 'packagingFk':
return { [`b.${param}`]: value };
case 'supplierFk':
return { [`s.id`]: value };
case 'warehouseFk':
return { 'tr.warehouseInFk': value };
case 'landed':
return {
'tr.landed': {
between: getDateRange(value),
},
};
}
};
const dateRange = reactive({
from: null,
to: null,
});
const getDateRange = (val) => {
const minHour = new Date(val);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(val);
maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour];
};
const from = computed({
get: () => dateRange.from,
set: (val) => {
updateFrom(val);
updateFilter();
},
});
const to = computed({
get: () => dateRange.to,
set: (val) => {
updateTo(val);
updateFilter();
},
});
const arrayData = useArrayData('ItemLastEntries', {
url: 'Items/lastEntriesFilter',
order: ['landed DESC', 'buyFk DESC'],
exprBuilder: exprBuilder,
userFilter: {
where: {
itemFk: route.params.id,
},
},
});
const itemLastEntries = ref([]);
const columns = computed(() => [
{
label: t('lastEntries.ig'),
name: 'ig',
align: 'center',
},
{
label: t('lastEntries.warehouse'),
name: 'warehouse',
field: 'warehouse',
align: 'left',
},
{
label: t('lastEntries.landed'),
name: 'id',
field: 'landed',
align: 'left',
format: (val) => toDateTimeFormat(val),
},
{
label: t('lastEntries.entry'),
name: 'entry',
field: 'stateName',
align: 'left',
format: (val) => dashIfEmpty(val),
},
{
label: t('lastEntries.pvp'),
name: 'pvp',
field: 'reference',
align: 'left',
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
},
{
label: t('lastEntries.label'),
name: 'label',
field: 'stickers',
align: 'center',
format: (val) => dashIfEmpty(val),
},
{
label: t('lastEntries.packing'),
name: 'packing',
align: 'center',
},
{
label: t('lastEntries.grouping'),
name: 'grouping',
align: 'center',
},
{
label: t('lastEntries.stems'),
name: 'stems',
field: 'stems',
align: 'center',
},
{
label: t('lastEntries.quantity'),
name: 'stems',
field: 'quantity',
align: 'center',
},
{
label: t('lastEntries.cost'),
name: 'cost',
align: 'left',
},
{
label: t('lastEntries.kg'),
name: 'stems',
field: 'weight',
align: 'center',
},
{
label: t('lastEntries.cube'),
name: 'cube',
field: 'packagingFk',
align: 'center',
},
{
label: t('lastEntries.supplier'),
name: 'stems',
field: 'supplier',
align: 'left',
},
]);
const fetchItemLastEntries = async () => {
const { data } = await arrayData.fetch({ append: false });
itemLastEntries.value = data;
};
const updateFrom = async (date) => {
date.setHours(0, 0, 0, 0);
dateRange.from = date.toISOString();
};
const updateTo = async (date) => {
date.setHours(23, 59, 59, 59);
dateRange.to = date.toISOString();
};
const updateFilter = async () => {
arrayData.store.userFilter.where.landed = {
between: [dateRange.from, dateRange.to],
};
await fetchItemLastEntries();
};
onMounted(async () => {
const _from = Date.vnNew();
_from.setDate(_from.getDate() - 75);
updateFrom(_from);
const _to = Date.vnNew();
_to.setDate(_to.getDate() + 10);
updateTo(_to);
updateFilter();
});
onUnmounted(() => (stateStore.rightDrawer = false));
</script>
<template>
<QToolbar class="justify-end">
<div id="st-data" class="row">
<VnInputDate
:label="t('lastEntries.since')"
dense
emit-date-format
v-model="from"
class="q-mr-lg"
/>
<VnInputDate
:label="t('lastEntries.to')"
dense
emit-date-format
v-model="to"
/>
</div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md">
<QTable
:rows="itemLastEntries"
:columns="columns"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
>
<template #body-cell-ig="{ row }">
<QTd @click.stop>
<QCheckbox
v-model="row.isIgnored"
:disable="true"
:false-value="0"
:true-value="1"
/>
</QTd>
</template>
<template #body-cell-entry="{ row }">
<QTd @click.stop>
<div class="full-width flex justify-center">
<EntryDescriptorProxy :id="row.entryFk" class="q-ma-none" dense />
<span class="link">{{ row.entryFk }}</span>
</div>
</QTd>
</template>
<template #body-cell-packing="{ row }">
<QTd @click.stop>
<QBadge
class="center-content"
rounded
:color="row.groupingMode == 'packing' ? 'grey-13' : 'black'"
>
{{ dashIfEmpty(row.packing) }}
<QTooltip>{{ t('lastEntries.packing') }}</QTooltip>
</QBadge>
</QTd>
</template>
<template #body-cell-pvp="{ value }">
<QTd @click.stop
><span> {{ value }}</span>
<QTooltip>
{{ t('lastEntries.grouping') }}/{{ t('lastEntries.packing') }}
</QTooltip></QTd
>
</template>
<template #body-cell-grouping="{ row }">
<QTd @click.stop>
<QBadge
class="center-content"
rounded
:color="row.groupingMode == 'grouping' ? 'grey-13' : 'black'"
>
{{ dashIfEmpty(row.grouping) }}
<QTooltip>{{ t('lastEntries.grouping') }}</QTooltip>
</QBadge>
</QTd>
</template>
<template #body-cell-cost="{ row }">
<QTd @click.stop>
<span>
{{ toCurrency(row.cost, 'EUR', 3) }}
<QTooltip>
{{ t('lastEntries.cost') }}:
{{ toCurrency(dashIfEmpty(row.buyingValue), 'EUR', 3) }}<br />
{{ t('lastEntries.package') }}:
{{ toCurrency(dashIfEmpty(row.packageValue), 'EUR', 3)
}}<br />
{{ $t('lastEntries.freight') }}:
{{ toCurrency(dashIfEmpty(row.freightValue), 'EUR', 3)
}}<br />
{{ t('lastEntries.comission') }}:
{{ toCurrency(dashIfEmpty(row.comissionValue), 'EUR', 3) }}
</QTooltip>
</span>
</QTd>
</template>
</QTable>
</QPage>
</template>
<style lang="scss" scoped>
.q-badge--rounded {
border-radius: 50%;
}
.center-content {
display: flex;
max-width: max-content;
margin: auto;
padding: 0 11px;
height: 28px;
}
</style>

View File

@ -1 +1,91 @@
<template>Item tax</template>
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnRow from 'components/ui/VnRow.vue';
import CrudModel from 'components/CrudModel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const route = useRoute();
const { t } = useI18n();
const { notify } = useNotify();
const taxesFilter = {
fields: ['id', 'countryFk', 'taxClassFk'],
include: [
{
relation: 'country',
scope: {
fields: ['country'],
},
},
],
};
const ItemTaxRef = ref(null);
const taxesOptions = ref([]);
const submitTaxes = async (data) => {
try {
let payload = data.map((tax) => ({
id: tax.id,
taxClassFk: tax.taxClassFk,
}));
await axios.post(`Items/updateTaxes`, payload);
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error saving taxes', err);
}
};
</script>
<template>
<FetchData
url="TaxClasses"
:filter="{
fields: ['id', 'description', 'code'],
}"
@on-fetch="(data) => (taxesOptions = data)"
auto-load
/>
<CrudModel
:url="`items/${route.params.id}/taxes`"
:save-fn="submitTaxes"
:filter="taxesFilter"
:default-remove="false"
data-key="ItemTax"
model="ItemTax"
ref="ItemTaxRef"
auto-load
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">
<VnRow
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<VnInput
:label="t('tax.country')"
v-model="row.country.country"
disable
/>
<VnSelect
:label="t('tax.class')"
v-model="row.taxClassFk"
:options="taxesOptions"
option-label="description"
option-value="id"
hide-selected
/>
</VnRow>
</QCard>
</template>
</CrudModel>
</template>

View File

@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
@ -178,7 +178,7 @@ const columns = computed(() => [
name: 'warehouse',
...defaultColumnAttrs,
columnFilter: {
component: VnSelectFilter,
component: VnSelect,
type: 'select',
filterValue: null,
event: getColumnInputEvents,
@ -434,7 +434,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template #body-cell-itemId="props">
<QTd>
<VnSelectFilter
<VnSelect
:options="itemsWithNameOptions"
hide-selected
option-label="id"
@ -450,7 +450,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</VnSelect>
</QTd>
</template>
<template #body-cell-description="{ row }">
@ -531,7 +531,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</template>
<template #body-cell-warehouse="props">
<QTd class="col">
<VnSelectFilter
<VnSelect
:options="warehousesOptions"
hide-selected
option-label="name"

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnSelect from 'components/common/VnSelect.vue';
import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
const { t } = useI18n();
@ -35,7 +35,7 @@ const itemTypeWorkersOptions = ref([]);
<template #body="{ params, searchFn }">
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.buyerFk')"
v-model="params.buyerFk"
:options="itemTypeWorkersOptions"
@ -51,7 +51,7 @@ const itemTypeWorkersOptions = ref([]);
</QItem>
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.warehouseFk')"
v-model="params.warehouseFk"
:options="warehousesOptions"

View File

@ -12,6 +12,7 @@ import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import ItemSummary from '../Item/Card/ItemSummary.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import ItemListFilter from './ItemListFilter.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateFormat } from 'src/filters/date.js';
@ -69,7 +70,7 @@ const exprBuilder = (param, value) => {
}
};
const params = reactive({});
const params = reactive({ isFloramondo: false, isActive: true });
const applyColumnFilter = async (col) => {
try {
@ -442,6 +443,11 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ItemListFilter data-key="ItemList" />
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md">
<VnPaginate
ref="paginateRef"

View File

@ -0,0 +1,460 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { onMounted } from 'vue';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QCheckbox } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import { useValidator } from 'src/composables/useValidator';
import axios from 'axios';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const stateStore = useStateStore();
const validationsStore = useValidator();
const itemTypesRef = ref(null);
const categoriesOptions = ref([]);
const itemTypesOptions = ref([]);
const buyersOptions = ref([]);
const suppliersOptions = ref([]);
const tagValues = ref([]);
const fieldFiltersValues = ref([]);
const moreFields = ref([]);
const arrayData = useArrayData(props.dataKey);
const itemTypesFilter = {
fields: ['id', 'name', 'categoryFk'],
include: 'category',
order: 'name ASC',
where: {},
};
const onCategoryChange = async (categoryFk, search) => {
if (!categoryFk) {
itemTypesFilter.where.categoryFk = null;
delete itemTypesFilter.where.categoryFk;
} else {
itemTypesFilter.where.categoryFk = categoryFk;
}
search();
await itemTypesRef.value.fetch();
};
const getSelectedTagValues = async (tag) => {
try {
tag.value = null;
const filter = {
fields: ['value'],
order: 'value ASC',
};
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, {
params,
});
tag.valueOptions = data;
} catch (err) {
console.error('Error getting selected tag values');
}
};
const applyTags = (params, search) => {
params.tags = tagValues.value
.filter((tag) => tag.selectedTag && tag.value)
.map((tag) => ({
tagFk: tag.selectedTag.id,
tagName: tag.selectedTag.name,
value: tag.value,
}));
search();
};
const removeTag = (index, params, search) => {
(tagValues.value || []).splice(index, 1);
applyTags(params, search);
};
const applyFieldFilters = (params) => {
fieldFiltersValues.value.forEach((fieldFilter) => {
if (
fieldFilter.selectedField &&
(fieldFilter.value !== null ||
fieldFilter.value !== '' ||
fieldFilter.value !== undefined)
) {
params[fieldFilter.name] = fieldFilter.value;
}
});
arrayData.applyFilter({ params });
};
const removeFieldFilter = (index, params, search) => {
delete params[fieldFiltersValues.value[index].name];
(fieldFiltersValues.value || []).splice(index, 1);
applyFieldFilters(params, search);
};
onMounted(async () => {
stateStore.rightDrawer = true;
if (arrayData.store?.userParams?.categoryFk)
itemTypesFilter.where.categoryFk = arrayData.store?.userParams?.categoryFk;
await itemTypesRef.value.fetch();
const { models } = validationsStore;
const properties = models.Item?.properties || {};
const _moreFields = ['id', 'description', 'name', 'isActive'];
_moreFields.forEach((field) => {
let prop = properties[field];
const label = t(`params.${field}`);
moreFields.value.push({
name: field,
label,
type: prop ? prop.type : null,
});
});
// Fill fieldFiltersValues with existent userParams
if (arrayData.store?.userParams) {
fieldFiltersValues.value = Object.entries(arrayData.store?.userParams)
.filter(([key, value]) => value && _moreFields.includes(key))
.map(([key, value]) => ({
name: key,
value,
selectedField: moreFields.value.find((field) => field.name === key),
}));
}
});
</script>
<template>
<FetchData
url="ItemCategories"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (categoriesOptions = data)"
auto-load
/>
<FetchData
ref="itemTypesRef"
url="ItemTypes"
:filter="itemTypesFilter"
@on-fetch="(data) => (itemTypesOptions = data)"
/>
<FetchData
url="TicketRequests/getItemTypeWorker"
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC' }"
@on-fetch="(data) => (buyersOptions = data)"
auto-load
/>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }"
auto-load
@on-fetch="(data) => (tagOptions = data)"
/>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:hidden-tags="tagValues.length === 0 ? ['tags'] : []"
>
<template #tags="{ tag, formatFn }">
<div>
<strong>{{ t(`params.${tag.label}`) }}</strong>
<span v-if="tag.label !== 'tags'">: {{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
v-model="params.search"
:label="t('params.search')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.categoryFk')"
v-model="params.categoryFk"
@update:model-value="
($event) => onCategoryChange($event, searchFn)
"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.typeFk')"
v-model="params.typeFk"
@update:model-value="searchFn()"
:options="itemTypesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.buyerFk')"
v-model="params.buyerFk"
@update:model-value="searchFn()"
:options="buyersOptions"
option-value="id"
option-label="nickname"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.supplierFk')"
v-model="params.supplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
scope.opt?.name + ': ' + scope.opt?.nickname
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<!-- Tags filter -->
<QItem class="row items-center">
<QItemLabel>
{{ t('params.tags') }}
</QItemLabel>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="tagValues.push({})"
/>
</QItem>
<QItem
v-for="(tag, index) in tagValues"
:key="index"
class="row items-center"
>
<QItemSection class="col">
<VnSelect
:label="t('params.tag')"
v-model="tag.selectedTag"
:options="tagOptions"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="getSelectedTagValues(tag)"
/>
</QItemSection>
<QItemSection class="col">
<VnSelect
v-if="!tag?.selectedTag?.isFree && tag.valueOptions"
:label="t('params.tag')"
v-model="tag.value"
:options="tag.valueOptions || []"
option-value="value"
option-label="value"
dense
outlined
rounded
emit-value
use-input
:disable="!tag"
:is-clearable="false"
@update:model-value="applyTags(params, searchFn)"
/>
<VnInput
v-else
v-model="tag.value"
:label="t('params.value')"
:disable="!tag"
is-outlined
:is-clearable="false"
@keydown.enter.prevent="applyTags(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeTag(index, params, searchFn)"
/>
</QItem>
<!-- Filter fields -->
<QItem class="row items-center">
<QItemLabel>
{{ t('More fields') }}
</QItemLabel>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="fieldFiltersValues.push({})"
/>
</QItem>
<QItem
v-for="(fieldFilter, index) in fieldFiltersValues"
:key="index"
class="row items-center"
>
<QItemSection class="col">
<VnSelect
:label="t('params.tag')"
:model-value="fieldFilter.selectedField"
:options="moreFields"
option-label="label"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
($event) => {
fieldFilter.name = $event.name;
fieldFilter.value = null;
fieldFilter.selectedField = $event;
}
"
/>
</QItemSection>
<QItemSection class="col">
<QCheckbox
v-if="fieldFilter.selectedField?.type === 'boolean'"
v-model="fieldFilter.value"
:label="t('params.value')"
@update:model-value="applyFieldFilters(params, searchFn)"
/>
<VnInput
v-else
v-model="fieldFilter.value"
:label="t('params.value')"
:disable="!fieldFilter.selectedField"
is-outlined
@keydown.enter="applyFieldFilters(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeFieldFilter(index, params, searchFn)"
/>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.isFloramondo')"
v-model="params.isFloramondo"
toggle-indeterminate
@update:model-value="searchFn()"
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
search: General search
categoryFk: Category
typeFk: Type
buyerFk: Buyer
supplierFk: Supplier
tags: Tags
tag: Tag
value: Value
isFloramondo: Floramondo
isActive: Active
description: Description
name: Name
id: Id
es:
More fields: Más campos
params:
search: Búsqueda general
categoryFk: Reino
typeFk: Tipo
buyerFk: Comprador
supplierFk: Proveedor
tags: Etiquetas
tag: Etiqueta
value: Valor
isFloramondo: Floramondo
isActive: Activo
description: Descripción
name: Nombre
id: Id
</i18n>

View File

@ -3,7 +3,7 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
@ -126,7 +126,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
v-model="params.attenderFk"
:label="t('params.attenderFk')"
@update:model-value="searchFn()"
@ -151,7 +151,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('params.warehouseFk')"
v-model="params.warehouseFk"
@update:model-value="searchFn()"
@ -167,7 +167,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('params.requesterFk')"
v-model="params.requesterFk"
@update:model-value="searchFn()"
@ -190,7 +190,7 @@ const decrement = (paramsObj, key) => {
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</VnSelect>
</QItemSection>
</QItem>
<QCard bordered>
@ -261,7 +261,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('params.state')"
v-model="params.state"
@update:model-value="searchFn()"

View File

@ -0,0 +1,91 @@
<script setup>
import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n();
const router = useRouter();
const newItemTypeForm = reactive({});
const workersOptions = ref([]);
const categoriesOptions = ref([]);
const temperaturesOptions = ref([]);
const redirectToItemTypeBasicData = (_, { id }) => {
router.push({ name: 'ItemTypeBasicData', params: { id } });
};
</script>
<template>
<FetchData
url="Workers"
@on-fetch="(data) => (workersOptions = data)"
:filter="{ order: 'firstName ASC', fields: ['id', 'firstName'] }"
auto-load
/>
<FetchData
url="ItemCategories"
@on-fetch="(data) => (categoriesOptions = data)"
:filter="{ order: 'name ASC', fields: ['id', 'name'] }"
auto-load
/>
<FetchData
url="Temperatures"
@on-fetch="(data) => (temperaturesOptions = data)"
:filter="{ order: 'name ASC', fields: ['code', 'name'] }"
auto-load
/>
<QPage>
<VnSubToolbar />
<FormModel
url-create="ItemTypes"
model="itemTypeCreate"
:form-initial-data="newItemTypeForm"
observe-form-changes
@on-data-saved="redirectToItemTypeBasicData"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.code" :label="t('itemType.shared.code')" />
<VnInput v-model="data.name" :label="t('itemType.shared.name')" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
v-model="data.workerFk"
:label="t('itemType.shared.worker')"
:options="workersOptions"
option-value="id"
option-label="firstName"
hide-selected
/>
<VnSelect
v-model="data.categoryFk"
:label="t('itemType.shared.category')"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
v-model="data.temperatureFk"
:label="t('itemType.shared.temperature')"
:options="temperaturesOptions"
option-value="code"
option-label="name"
hide-selected
/>
</VnRow>
</template>
</FormModel>
</QPage>
</template>

View File

@ -0,0 +1,142 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
import ItemTypeSummary from 'src/pages/ItemType/Card/ItemTypeSummary.vue';
import ItemTypeFilter from 'src/pages/ItemType/ItemTypeFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
const stateStore = useStateStore();
const router = useRouter();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const redirectToItemTypeSummary = (id) => {
router.push({ name: 'ItemTypeSummary', params: { id } });
};
const redirectToCreateView = () => {
router.push({ name: 'ItemTypeCreate' });
};
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'search':
if (value) {
if (!isNaN(value)) {
return { id: value };
} else {
return {
or: [
{
name: {
like: `%${value}%`,
},
},
{
code: {
like: `%${value}%`,
},
},
],
};
}
}
}
};
</script>
<template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
data-key="ItemTypeList"
url="ItemTypes"
:label="t('Search item type')"
:info="t('Search itemType by id, name or code')"
:expr-builder="exprBuilder"
/>
</Teleport>
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ItemTypeFilter data-key="ItemTypeList" />
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="ItemTypeList"
url="ItemTypes"
:order="['name']"
auto-load
:expr-builder="exprBuilder"
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="row.code"
@click="redirectToItemTypeSummary(row.id)"
:id="row.id"
>
<template #list-items>
<VnLv :label="t('Name')" :value="row.name" />
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ItemTypeSummary)"
color="primary"
type="submit"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
<QTooltip>
{{ t('New item type') }}
</QTooltip>
</QPageSticky>
</template>
<i18n>
es:
New item type: Nueva familia
Name: Nombre
Search item type: Buscar familia
Search itemType by id, name or code: Buscar familia por id, nombre o código
</i18n>

View File

@ -0,0 +1,36 @@
itemDiary:
date: Date
id: Id
state: State
reference: Reference
client: Client
in: In
out: Out
balance: Balance
claim: Claim
showBefore: Show what's before the inventory
since: Since
warehouse: Warehouse
tax:
country: Country
class: Class
lastEntries:
since: Since
to: To
ig: Ig
warehouse: Warehouse
landed: Landed
entry: Entry
pvp: PVP
label: Label
packing: Packing
grouping: Grouping
stems: Stems
quantity: Quantity
cost: Cost
kg: Kg.
cube: Cube
supplier: Supplier
package: Package
freight: Freight
comission: Comission

View File

@ -0,0 +1,36 @@
itemDiary:
date: Fecha
id: Id
state: Estado
reference: Referencia
client: Cliente
in: Entrada
out: Salida
balance: Balance
claim: Reclamación
showBefore: Mostrar lo anterior al inventario
since: Desde
warehouse: Almacén
tax:
country: País
class: Clase
lastEntries:
since: Desde
to: Hasta
ig: Ig
warehouse: Almacén
landed: F. Entrega
entry: Entrada
pvp: PVP
label: Etiquetas
packing: Packing
grouping: Grouping
stems: Tallos
quantity: Cantidad
cost: Coste
kg: Kg.
cube: Cubo
supplier: Proveedor
package: Embalaje
freight: Porte
comission: Comisión

View File

@ -0,0 +1,79 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
const categoriesOptions = ref([]);
const temperaturesOptions = ref([]);
</script>
<template>
<FetchData
url="Workers"
@on-fetch="(data) => (workersOptions = data)"
:filter="{ order: 'firstName ASC', fields: ['id', 'firstName'] }"
auto-load
/>
<FetchData
url="ItemCategories"
@on-fetch="(data) => (categoriesOptions = data)"
:filter="{ order: 'name ASC', fields: ['id', 'name'] }"
auto-load
/>
<FetchData
url="Temperatures"
@on-fetch="(data) => (temperaturesOptions = data)"
:filter="{ order: 'name ASC', fields: ['code', 'name'] }"
auto-load
/>
<FormModel
:url="`ItemTypes/${route.params.id}`"
:url-update="`ItemTypes/${route.params.id}`"
model="itemTypeBasicData"
auto-load
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.code" :label="t('shared.code')" />
<VnInput v-model="data.name" :label="t('shared.name')" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
v-model="data.workerFk"
:label="t('shared.worker')"
:options="workersOptions"
option-value="id"
option-label="firstName"
hide-selected
/>
<VnSelect
v-model="data.categoryFk"
:label="t('shared.category')"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
v-model="data.temperatureFk"
:label="t('shared.temperature')"
:options="temperaturesOptions"
option-value="code"
option-label="name"
hide-selected
/>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -0,0 +1,12 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import ItemTypeDescriptor from 'src/pages/ItemType/Card/ItemTypeDescriptor.vue';
</script>
<template>
<VnCard
data-key="ItemTypeSummary"
base-url="ItemTypes"
:descriptor="ItemTypeDescriptor"
/>
</template>

View File

@ -0,0 +1,85 @@
<script setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
summary: {
type: Object,
default: null,
},
});
const route = useRoute();
const { t } = useI18n();
const itemTypeFilter = {
include: [
{ relation: 'worker' },
{ relation: 'category' },
{ relation: 'itemPackingType' },
{ relation: 'temperature' },
],
};
const entityId = computed(() => {
return $props.id || route.params.id;
});
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
</script>
<template>
<CardDescriptor
module="ItemType"
:url="`ItemTypes/${entityId}`"
:filter="itemTypeFilter"
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
data-key="entry"
>
<template #header-extra-action>
<QBtn
round
flat
size="sm"
icon="vn:item"
color="white"
:to="{ name: 'ItemTypeList' }"
>
<QTooltip>
{{ t('Go to module index') }}
</QTooltip>
</QBtn>
</template>
<template #body="{ entity }">
<VnLv :label="t('shared.code')" :value="entity.code" />
<VnLv :label="t('shared.name')" :value="entity.name" />
<VnLv :label="t('shared.worker')">
<template #value>
<span class="link">{{ entity.worker?.firstName }}</span>
<WorkerDescriptorProxy :id="entity.worker?.id" />
</template>
</VnLv>
<VnLv :label="t('shared.category')" :value="entity.category?.name" />
</template>
</CardDescriptor>
</template>
<i18n>
es:
Go to module index: Ir al índice del módulo
</i18n>

View File

@ -0,0 +1,109 @@
<script setup>
import { ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
onUpdated(() => summaryRef.value.fetch());
const route = useRoute();
const { t } = useI18n();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const itemTypeFilter = {
include: [
{ relation: 'worker' },
{ relation: 'category' },
{ relation: 'itemPackingType' },
{ relation: 'temperature' },
],
};
const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const itemType = ref();
async function setItemTypeData(data) {
if (data) itemType.value = data;
}
</script>
<template>
<CardSummary
ref="summaryRef"
:url="`ItemTypes/${entityId}`"
data-key="ItemTypeSummary"
:filter="itemTypeFilter"
@on-fetch="(data) => setItemTypeData(data)"
class="full-width"
>
<template #header-left>
<router-link
v-if="route.name !== 'ItemTypeSummary'"
:to="{ name: 'ItemTypeSummary', params: { id: entityId } }"
class="header link"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>
</template>
<template #header>
<span>
{{ itemType.id }} - {{ itemType.name }} -
{{ itemType.worker?.firstName }}
{{ itemType.worker?.lastName }}
</span>
</template>
<template #body>
<QCard class="vn-one">
<router-link
:to="{ name: 'ItemTypeBasicData', params: { id: entityId } }"
class="header header-link"
>
{{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" />
</router-link>
<VnLv :label="t('summary.id')" :value="itemType.id" />
<VnLv :label="t('shared.code')" :value="itemType.code" />
<VnLv :label="t('shared.name')" :value="itemType.name" />
<VnLv :label="t('shared.worker')">
<template #value>
<span class="link">{{ itemType.worker?.firstName }}</span>
<WorkerDescriptorProxy :id="itemType.worker?.id" />
</template>
</VnLv>
<VnLv :label="t('shared.category')" :value="itemType.category?.name" />
<VnLv
:label="t('shared.temperature')"
:value="itemType.temperature?.name"
/>
<VnLv :label="t('summary.life')" :value="itemType.life" />
<VnLv :label="t('summary.promo')" :value="itemType.promo" />
<VnLv
:label="t('summary.itemPackingType')"
:value="itemType.itemPackingType?.description"
/>
<VnLv
class="large-label"
:label="t('summary.isUnconventionalSize')"
:value="itemType.isUnconventionalSize"
/>
</QCard>
</template>
</CardSummary>
</template>
<style lang="scss">
.large-label > div.label {
width: 15em !important;
}
</style>

View File

@ -0,0 +1,55 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const emit = defineEmits(['search']);
</script>
<template>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
@search="emit('search')"
>
<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 }">
<QItem>
<QItemSection>
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput v-model="params.code" :label="t('Code')" is-outlined />
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
name: Name
code: Code
es:
params:
name: Nombre
code: Código
Name: Nombre
Code: Código
</i18n>

View File

@ -0,0 +1,12 @@
shared:
code: Code
name: Name
worker: Worker
category: Category
temperature: Temperature
summary:
id: id
life: Life
promo: Promo
itemPackingType: Item packing type
isUnconventionalSize: Is unconventional size

View File

@ -0,0 +1,17 @@
shared:
code: Código
name: Nombre
worker: Trabajador
category: Reino
temperature: Temperatura
summary:
id: id
code: Código
name: Nombre
worker: Trabajador
category: Reino
temperature: Temperatura
life: Vida
promo: Promoción
itemPackingType: Tipo de embalaje
isUnconventionalSize: Es de tamaño poco convencional

View File

@ -38,7 +38,13 @@ async function onSubmit() {
if (!multimediaToken) return;
await session.login(data.token, multimediaToken.id, keepLogin.value);
const login = {
...data,
created: Date.now(),
tokenMultimedia: multimediaToken.id,
keepLogin: keepLogin.value,
};
await session.login(login);
quasar.notify({
message: t('login.loginSuccess'),

View File

@ -3,9 +3,9 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import FetchData from 'components/FetchData.vue';
import { onMounted, ref } from 'vue';
import { ref } from 'vue';
import CrudModel from 'components/CrudModel.vue';
import RoadmapAddStopForm from "pages/Route/Roadmap/RoadmapAddStopForm.vue";
import RoadmapAddStopForm from 'pages/Route/Roadmap/RoadmapAddStopForm.vue';
const { t } = useI18n();
const route = useRoute();
@ -21,10 +21,6 @@ const updateDefaultStop = (data) => {
eta.setDate(eta.getDate() + 1);
defaultStop.value.eta = eta.toISOString();
};
onMounted(() => {
if (roadmapStopsCrudRef.value) roadmapStopsCrudRef.value.reload();
});
</script>
<template>
<VnSubToolbar />
@ -43,6 +39,7 @@ onMounted(() => {
:filter="{ where: { roadmapFk: route.params?.id } }"
:default-remove="false"
:data-required="defaultStop"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">
@ -51,7 +48,10 @@ onMounted(() => {
:key="index"
class="row no-wrap"
>
<RoadmapAddStopForm :roadmap-fk="route.params?.id" :form-data="row" />
<RoadmapAddStopForm
:roadmap-fk="route.params?.id"
:form-data="row"
/>
<div class="col-1 row justify-center items-center">
<QIcon
name="delete"

View File

@ -20,14 +20,14 @@ const router = useRouter();
const { t } = useI18n();
const entityId = computed(() => $props.id || route.params.id);
const isDialog = Boolean($props.id);
const hideRightDrawer = () => {
if (!isDialog) {
stateStore.rightDrawer = false;
}
};
onMounted(hideRightDrawer);
onUnmounted(hideRightDrawer);
const isDialog = false;
// const hideRightDrawer = () => {
// if (!isDialog) {
// stateStore.rightDrawer = false;
// }
// };
// onMounted(hideRightDrawer);
// onUnmounted(hideRightDrawer);
const filter = {
include: [
{
@ -46,23 +46,6 @@ const filter = {
</script>
<template>
<template v-if="!isDialog && stateStore.isHeaderMounted()">
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<div class="q-pa-md">
<CardSummary ref="summary" :url="`Shelvings/${entityId}`" :filter="filter">
<template #header="{ entity }">
@ -102,18 +85,4 @@ const filter = {
</template>
</CardSummary>
</div>
<QDrawer
v-if="!isDialog"
v-model="stateStore.rightDrawer"
side="right"
:width="256"
show-if-above
>
<QScrollArea class="fit text-grey-8">
<ShelvingFilter
data-key="ShelvingList"
@search="router.push({ name: 'ShelvingList' })"
/>
</QScrollArea>
</QDrawer>
</template>

View File

@ -72,7 +72,6 @@ function exprBuilder(param, value) {
:filter="filter"
:expr-builder="exprBuilder"
:limit="20"
auto-load
>
<template #body="{ rows }">
<CardList

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -59,10 +59,6 @@ const setWireTransfer = async () => {
console.error('Error setting wire transfer', err);
}
};
onMounted(() => {
if (supplierAccountRef.value) supplierAccountRef.value.reload();
});
</script>
<template>
<FetchData
@ -94,6 +90,7 @@ onMounted(() => {
:default-remove="false"
:data-required="{ supplierFk: route.params.id }"
@save-changes="onChangesSaved()"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -26,10 +26,6 @@ const supplierAgencyFilter = {
const redirectToCreateView = () => {
router.push({ name: 'SupplierAgencyTermCreate' });
};
onMounted(() => {
if (supplierAgencyTermRef.value) supplierAgencyTermRef.value.reload();
});
</script>
<template>
<FetchData
@ -49,6 +45,7 @@ onMounted(() => {
:data-required="{
supplierFk: route.params.id,
}"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">

View File

@ -1,9 +1,8 @@
<script setup>
import { computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { computed, onMounted, watch, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import FetchedTags from 'components/ui/FetchedTags.vue';
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
@ -15,15 +14,17 @@ import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
import { useStateStore } from 'stores/useStateStore';
import { useState } from 'src/composables/useState';
import { useArrayData } from 'composables/useArrayData';
const state = useState();
const stateStore = useStateStore();
const { t } = useI18n();
const route = useRoute();
const { openReport, sendEmail } = usePrintService();
const quasar = useQuasar();
const { notify } = useNotify();
const totalRows = ref({});
const arrayData = useArrayData('SupplierConsumption', {
url: 'Suppliers/consumption',
order: ['itemTypeFk', 'itemName', 'itemSize'],
@ -32,6 +33,7 @@ const arrayData = useArrayData('SupplierConsumption', {
const store = arrayData.store;
onUnmounted(() => state.unset('SupplierConsumption'));
const dateRanges = computed(() => {
const { from, to } = arrayData.store?.userParams || {};
return { from, to };
@ -46,7 +48,9 @@ async function getSupplierConsumptionData() {
await arrayData.fetch({ append: false });
}
const rows = computed(() => store.data || []);
const rows = computed(() => {
return totalEntryPrice(store.data) || [];
});
const openReportPdf = () => {
openReport(`Suppliers/${route.params.id}/campaign-metrics-pdf`, reportParams.value);
@ -93,8 +97,25 @@ const sendCampaignMetricsEmail = ({ address }) => {
});
};
const calculateTotal = (buysArray = []) =>
buysArray.reduce((accumulator, { total }) => accumulator + total, 0);
const totalEntryPrice = (rows) => {
let totalPrice = 0;
let totalQuantity = 0;
if (!rows) return totalPrice;
for (const row of rows) {
let total = 0;
let quantity = 0;
for (const buy of row.buys) {
total = total + buy.total;
quantity = quantity + buy.quantity;
}
row.total = total;
row.quantity = quantity;
totalPrice = totalPrice + total;
totalQuantity = totalQuantity + quantity;
}
totalRows.value = { totalPrice, totalQuantity };
return rows;
};
onMounted(async () => {
stateStore.rightDrawer = true;
@ -128,6 +149,23 @@ onMounted(async () => {
</QTooltip>
</QBtn>
</Teleport>
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
<div class="row q-gutter-md">
<div>
{{ t('Total entries') }}:
<QChip :dense="$q.screen.lt.sm" text-color="white">
{{ totalRows.totalPrice }}
</QChip>
</div>
<QSeparator dark vertical />
<div>
{{ t('Total stems entries') }}:
<QChip :dense="$q.screen.lt.sm" text-color="white">
{{ totalRows.totalQuantity }}
</QChip>
</div>
</div>
</Teleport>
<QPage class="column items-center q-pa-md">
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
@ -143,20 +181,24 @@ onMounted(async () => {
>
<template #body="{ row }">
<QTr>
<QTd no-hover class="label">{{
t('supplier.consumption.entry')
}}</QTd>
<QTd no-hover>{{ row.id }}</QTd>
<QTd no-hover class="label">{{ t('supplier.consumption.date') }}</QTd>
<QTd no-hover>{{ toDate(row.shipped) }}</QTd>
<QTd no-hover class="label">{{
t('supplier.consumption.reference')
}}</QTd>
<QTd no-hover>{{ row.invoiceNumber }}</QTd>
<QTd no-hover>
<span class="label">{{ t('supplier.consumption.entry') }}: </span>
<span>{{ row.id }}</span>
</QTd>
<QTd no-hover>
<span class="label">{{ t('supplier.consumption.date') }}: </span>
<span>{{ toDate(row.shipped) }}</span></QTd
>
<QTd colspan="6" no-hover>
<span class="label"
>{{ t('supplier.consumption.reference') }}:
</span>
<span>{{ row.invoiceNumber }}</span>
</QTd>
</QTr>
<QTr v-for="(buy, index) in row.buys" :key="index">
<QTd no-hover>
<QBtn flat color="blue" dense>{{ buy.itemName }}</QBtn>
<QBtn flat color="blue" dense no-caps>{{ buy.itemName }}</QBtn>
<ItemDescriptorProxy :id="buy.itemFk" />
</QTd>
@ -169,9 +211,13 @@ onMounted(async () => {
<QTd colspan="2" no-hover> {{ dashIfEmpty(buy.total) }}</QTd>
</QTr>
<QTr>
<QTd colspan="6" no-hover>
<QTd colspan="5" no-hover>
<span class="label">{{ t('Total entry') }}: </span>
<span>{{ calculateTotal(row.buys) }}</span>
<span>{{ row.total }} </span>
</QTd>
<QTd no-hover>
<span class="label">{{ t('Total stems') }}: </span>
<span>{{ row.quantity }}</span>
</QTd>
</QTr>
</template>
@ -188,6 +234,9 @@ onMounted(async () => {
<i18n>
es:
Total entry: Total entrada
Total entries: Total de las entradas
Total stems entries: Total de tallos de las entradas
Total stems: Total tallos
Open as PDF: Abrir como PDF
Send to email: Enviar por email
This supplier does not have a contact with an email address: Este proveedor no tiene un email de contacto

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { ref, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -19,10 +19,6 @@ const insertRow = () => {
if (lastInput) lastInput.focus();
});
};
onMounted(() => {
if (supplierContactRef.value) supplierContactRef.value.reload();
});
</script>
<template>
@ -36,6 +32,7 @@ onMounted(() => {
ref="supplierContactRef"
:default-remove="false"
:data-required="{ supplierFk: route.params.id }"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">

View File

@ -188,7 +188,7 @@ async function changeState(value) {
:label="t('ticket.summary.landed')"
:value="toDate(ticket.landed)"
/>
<VnLv :label="t('global.packages')" :value="ticket.packages" />
<VnLv :label="t('globals.packages')" :value="ticket.packages" />
<VnLv :value="ticket.address.phone">
<template #label>
{{ t('ticket.summary.consigneePhone') }}

View File

@ -73,7 +73,6 @@ const fetchAddresses = async (formData) => {
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
console.log();
} catch (err) {
console.error(`Error fetching addresses`, err);
return err.response;

View File

@ -0,0 +1,6 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
</script>
<template>
<VnCard data-key="Zone" base-url="Zones" />
</template>

View File

@ -0,0 +1,103 @@
<script setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import ZoneDescriptorMenuItems from './ZoneDescriptorMenuItems.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const route = useRoute();
const { t } = useI18n();
const filter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['name', 'id'],
},
},
],
};
const entityId = computed(() => {
return $props.id || route.params.id;
});
const data = ref(useCardDescription());
const setData = (entity) => {
data.value = useCardDescription(entity.ref, entity.id);
};
function extractHour(dateTime) {
const date = new Date(dateTime);
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
return `${hours}:${minutes}`;
}
</script>
<template>
<CardDescriptor
module="Zone"
:url="`Zones/${entityId}`"
:title="data.title"
:subtitle="data.subtitle"
:filter="filter"
@on-fetch="setData"
data-key="zoneData"
>
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="preview"
color="white"
class="link"
:to="{ name: 'ZoneList' }"
>
<QTooltip>
{{ t('Summary') }}
</QTooltip>
</QBtn>
</template>
<!-- <template #menu="{ entity }">
<ZoneDescriptorMenuItems :zone="entity" />
</template> -->
<template #body="{ entity }">
{{ console.log('entity', entity) }}
<VnLv :label="t('Agency')" :value="entity.agencyMode.name" />
<VnLv :label="t('Closing hour')" :value="extractHour(entity.hour)" />
<VnLv :label="t('zoneing days')" :value="entity.zoneingDays" />
<VnLv :label="t('Price')" :value="entity.price" />
<VnLv :label="t('Bonus')" :value="entity.bonus" />
</template>
</CardDescriptor>
</template>
<i18n>
es:
Summary: Detalles
The zone will be deleted: El envío será eliminado
Do you want to delete this zone?: ¿Quieres eliminar este envío?
All zones with current agency: Todos los envíos con la agencia actual
Agency: Agencia
Closing hour: Hora de cierre
zoneing days: Días de viaje
Price: Precio
Bonus: Bonificación
</i18n>

View File

@ -0,0 +1,93 @@
<script setup>
import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
const { dialog, notify } = useQuasar();
import VnConfirm from 'components/ui/VnConfirm.vue';
import axios from 'axios';
const $props = defineProps({
zone: {
type: Object,
default: () => {},
},
});
const { t } = useI18n();
const { push, currentRoute } = useRouter();
const zoneId = currentRoute.value.params.id;
const actions = {
clone: async () => {
const opts = { message: t('Zone cloned'), type: 'positive' };
let clonedZoneId;
try {
const { data } = await axios.post(`Zones/${zoneId}/clone`, {
shipped: $props.zone.value.shipped,
});
clonedZoneId = data;
} catch (e) {
opts.message = t('It was not able to clone the zone');
opts.type = 'negative';
} finally {
notify(opts);
if (clonedZoneId) push({ name: 'ZoneSummary', params: { id: clonedZoneId } });
}
},
remove: async () => {
try {
await axios.post(`Zones/${zoneId}/setDeleted`);
notify({ message: t('Zone deleted'), type: 'positive' });
notify({
message: t('You can undo this action within the first hour'),
icon: 'info',
});
push({ name: 'ZoneList' });
} catch (e) {
notify({ message: e.message, type: 'negative' });
}
},
};
function openConfirmDialog(callback) {
dialog({
component: VnConfirm,
componentProps: {
promise: actions[callback],
},
});
}
</script>
<template>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>
<QItemSection>{{ t('To clone zone') }}</QItemSection>
</QItem>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>
<QItemSection>{{ t('deleteOrder') }}</QItemSection>
</QItem>
</template>
<i18n>
en:
deleteOrder: Delete order
confirmDeletion: Confirm deletion
confirmDeletionMessage: Are you sure you want to delete this order?
es:
To clone zone: Clonar zone
deleteOrder: Eliminar pedido
confirmDeletion: Confirmar eliminación
confirmDeletionMessage: Seguro que quieres eliminar este pedido?
</i18n>

View File

@ -0,0 +1,16 @@
<script setup>
import ZoneDescriptor from './ZoneDescriptor.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
});
</script>
<template>
<QPopupProxy>
<ZoneDescriptor v-if="$props.id" :id="$props.id" />
</QPopupProxy>
</template>

View File

@ -0,0 +1,94 @@
<script setup>
import { ref, onMounted, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { dashIfEmpty } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const { t } = useI18n();
const $props = defineProps({
id: {
type: Number,
default: 0,
},
});
const entityId = computed(() => $props.id || route.params.id);
const zoneUrl = ref();
onMounted(async () => {
zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`;
});
const filter = computed(() => {
return { where: { id: entityId.value } };
});
</script>
<template>
<CardSummary
data-key="zoneData"
ref="summary"
:url="`Zones/summary`"
:filter="filter"
>
<template #header="{ entity }">
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
</template>
<template #body="{ entity: zone }">
<QCard class="vn-one">
<VnTitle
:url="zoneUrl + `basic-data`"
:text="t('zone.summary.basicData')"
/>
<VnLv :label="t('zone.card.name')" :value="zone.user?.nickname" />
<VnLv
:label="t('zone.list.department')"
:value="zone.department?.department?.name"
/>
<VnLv :label="t('zone.list.email')" :value="zone.user.email" copy />
<VnLv :label="t('zone.summary.boss')" link>
<template #value>
<VnUserLink
v-if="zone.boss"
:name="dashIfEmpty(zone.boss?.name)"
:zone-id="zone.bossFk"
/>
</template>
</VnLv>
<VnLv :value="zone.mobileExtension">
<template #label>
{{ t('zone.summary.phoneExtension') }}
<VnLinkPhone :phone-number="zone.mobileExtension" />
</template>
</VnLv>
<VnLv :value="zone.phone">
<template #label>
{{ t('zone.summary.entPhone') }}
<VnLinkPhone :phone-number="zone.phone" />
</template>
</VnLv>
<VnLv :label="t('zone.summary.locker')" :value="zone.locker" />
</QCard>
<QCard class="vn-one">
<VnTitle :text="t('zone.summary.userData')" />
<VnLv :label="t('zone.summary.userId')" :value="zone.user.id" />
<VnLv :label="t('zone.card.name')" :value="zone.user.nickname" />
<VnLv :label="t('zone.summary.role')" :value="zone.user.role.name" />
<VnLv :value="zone?.sip?.extension">
<template #label>
{{ t('zone.summary.sipExtension') }}
<VnLinkPhone :phone-number="zone?.sip?.extension" />
</template>
</VnLv>
</QCard>
</template>
</CardSummary>
</template>

View File

@ -12,6 +12,7 @@ import { useSession } from 'src/composables/useSession';
import { useRole } from 'src/composables/useRole';
import { useUserConfig } from 'src/composables/useUserConfig';
import { toLowerCamel } from 'src/filters';
import { useTokenConfig } from 'src/composables/useTokenConfig';
const state = useState();
const session = useSession();
@ -55,6 +56,7 @@ export default route(function (/* { store, ssrContext } */) {
if (stateRoles.length === 0) {
await useRole().fetch();
await useUserConfig().fetch();
await useTokenConfig().fetch();
}
const matches = to.matched;
const hasRequiredRoles = matches.every((route) => {

View File

@ -0,0 +1,88 @@
import { RouterView } from 'vue-router';
export default {
path: '/agency',
name: 'Agency',
meta: {
title: 'agency',
icon: 'garage_home',
moduleName: 'Agency',
},
component: RouterView,
redirect: { name: 'AgencyCard' },
menus: {
main: [],
card: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'],
},
children: [
{
path: '/agency/:id',
name: 'AgencyCard',
component: () => import('src/pages/Agency/Card/AgencyCard.vue'),
redirect: { name: 'AgencySummary' },
children: [
{
name: 'AgencySummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'view_list',
},
component: () => import('src/pages/Agency/Card/AgencySummary.vue'),
},
{
name: 'AgencyBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Agency/Card/AgencyBasicData.vue'),
},
{
path: 'workCenter',
name: 'AgencyWorkCenterCard',
redirect: { name: 'AgencyWorkCenters' },
children: [
{
path: '',
name: 'AgencyWorkCenters',
meta: {
icon: 'apartment',
title: 'workCenters',
},
component: () =>
import('src/pages/Agency/Card/AgencyWorkcenter.vue'),
},
],
},
{
path: 'modes',
name: 'AgencyModesCard',
redirect: { name: 'AgencyModes' },
children: [
{
path: '',
name: 'AgencyModes',
meta: {
icon: 'format_list_bulleted',
title: 'modes',
},
component: () =>
import('src/pages/Agency/Card/AgencyModes.vue'),
},
],
},
{
name: 'AgencyLog',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Agency/Card/AgencyLog.vue'),
},
],
},
],
};

View File

@ -6,6 +6,7 @@ export default {
meta: {
title: 'department',
icon: 'vn:greuge',
moduleName: 'Department',
},
component: RouterView,
redirect: { name: 'DepartmentCard' },

View File

@ -15,6 +15,9 @@ import Department from './department';
import Entry from './entry';
import roadmap from './roadmap';
import Parking from './parking';
import Agency from './agency';
import ItemType from './itemType';
import Zone from './zone';
export default [
Item,
@ -34,4 +37,7 @@ export default [
Entry,
roadmap,
Parking,
Agency,
ItemType,
Zone,
];

View File

@ -11,7 +11,13 @@ export default {
component: RouterView,
redirect: { name: 'ItemMain' },
menus: {
main: ['ItemList', 'WasteBreakdown', 'ItemFixedPrice', 'ItemRequest'],
main: [
'ItemList',
'WasteBreakdown',
'ItemFixedPrice',
'ItemRequest',
'ItemTypeList',
],
card: [
'ItemBasicData',
'ItemLog',
@ -20,6 +26,7 @@ export default {
'ItemTax',
'ItemBotanical',
'ItemBarcode',
'ItemLastEntries',
],
},
children: [
@ -68,6 +75,23 @@ export default {
'https://grafana.verdnatura.es/d/TTNXQAxVk';
},
},
{
path: 'item-type-list',
name: 'ItemTypeList',
meta: {
title: 'family',
icon: 'contact_support',
},
component: () => import('src/pages/Item/ItemTypeList.vue'),
},
{
path: 'item-type-list/create',
name: 'ItemTypeCreate',
meta: {
title: 'itemTypeCreate',
},
component: () => import('src/pages/Item/ItemTypeCreate.vue'),
},
{
path: 'request',
name: 'ItemRequest',
@ -112,6 +136,15 @@ export default {
},
component: () => import('src/pages/Item/Card/ItemTags.vue'),
},
{
path: 'last-entries',
name: 'ItemLastEntries',
meta: {
title: 'lastEntries',
icon: 'vn:regentry',
},
component: () => import('src/pages/Item/Card/ItemLastEntries.vue'),
},
{
path: 'tax',
name: 'ItemTax',
@ -126,7 +159,7 @@ export default {
name: 'ItemBotanical',
meta: {
title: 'botanical',
icon: 'vn:botanical',
icon: 'local_florist',
},
component: () => import('src/pages/Item/Card/ItemBotanical.vue'),
},
@ -143,8 +176,8 @@ export default {
path: 'diary',
name: 'ItemDiary',
meta: {
title: 'basicData',
icon: 'vn:settings',
title: 'diary',
icon: 'vn:transaction',
},
component: () => import('src/pages/Item/Card/ItemDiary.vue'),
},
@ -153,7 +186,7 @@ export default {
name: 'ItemLog',
meta: {
title: 'log',
icon: 'history',
icon: 'vn:History',
},
component: () => import('src/pages/Item/Card/ItemLog.vue'),
},

View File

@ -0,0 +1,46 @@
import { RouterView } from 'vue-router';
export default {
path: '/item/item-type',
name: 'ItemType',
meta: {
title: 'itemType',
icon: 'contact_support',
moduleName: 'ItemType',
},
component: RouterView,
redirect: { name: 'ItemTypeList' },
menus: {
main: [],
card: ['ItemTypeBasicData'],
},
children: [
{
name: 'ItemTypeCard',
path: ':id',
component: () => import('src/pages/ItemType/Card/ItemTypeCard.vue'),
redirect: { name: 'ItemTypeSummary' },
children: [
{
name: 'ItemTypeSummary',
path: 'summary',
meta: {
title: 'summary',
},
component: () =>
import('src/pages/ItemType/Card/ItemTypeSummary.vue'),
},
{
name: 'ItemTypeBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () =>
import('src/pages/ItemType/Card/ItemTypeBasicData.vue'),
},
],
},
],
};

View File

@ -6,6 +6,7 @@ export default {
meta: {
title: 'roadmap',
icon: 'vn:troncales',
moduleName: 'Roadmap',
},
component: RouterView,
redirect: { name: 'RouteMain' },

View File

@ -11,7 +11,7 @@ export default {
component: RouterView,
redirect: { name: 'RouteMain' },
menus: {
main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList'],
main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'],
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
},
children: [
@ -75,6 +75,21 @@ export default {
},
component: () => import('src/pages/Route/Cmr/CmrList.vue'),
},
{
path: '/agency',
redirect: { name: 'AgencyList' },
children: [
{
path: 'list',
name: 'AgencyList',
meta: {
title: 'agencyList',
icon: 'view_list',
},
component: () => import('src/pages/Agency/AgencyList.vue'),
},
],
},
],
},
{

160
src/router/modules/zone.js Normal file
View File

@ -0,0 +1,160 @@
import { RouterView } from 'vue-router';
export default {
path: '/zone',
name: 'Zone',
meta: {
title: 'zones',
icon: 'vn:zone',
moduleName: 'Zone',
},
component: RouterView,
redirect: { name: 'ZoneMain' },
menus: {
main: [
/*'ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'*/
],
card: [
//
],
},
children: [
// {
// path: '/zone',
// name: 'ZoneMain',
// component: () => import('src/pages/Zone/ZoneMain.vue'),
// redirect: { name: 'ZoneList' },
// children: [
// {
// path: 'list',
// name: 'ZoneList',
// meta: {
// title: 'zonesList',
// icon: 'vn:zone',
// },
// component: () => import('src/pages/Zone/ZoneList.vue'),
// },
// {
// path: 'create',
// name: 'ZoneCreate',
// meta: {
// title: 'zoneCreate',
// icon: 'create',
// },
// component: () => import('src/pages/Zone/ZoneCreate.vue'),
// },
// {
// path: ':id/edit',
// name: 'ZoneEdit',
// meta: {
// title: 'zoneEdit',
// icon: 'edit',
// },
// component: () => import('src/pages/Zone/ZoneCreate.vue'),
// },
// {
// path: 'counter',
// name: 'ZoneCounter',
// meta: {
// title: 'zoneCounter',
// icon: 'add_circle',
// },
// component: () => import('src/pages/Zone/ZoneCounter.vue'),
// },
// ],
// },
{
name: 'ZoneCard',
path: ':id',
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
redirect: { name: 'ZoneSummary' },
children: [
{
name: 'ZoneSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
},
// {
// path: '/zone/delivery',
// name: 'ZoneDeliveryMain',
// component: () => import('src/pages/Zone/ZoneMain.vue'),
// redirect: { name: 'ZoneDeliveryList' },
// children: [
// {
// path: 'list',
// name: 'ZoneDeliveryList',
// meta: {
// title: 'deliveryList',
// icon: 'today',
// },
// component: () =>
// import('src/pages/Zone/Delivery/ZoneDeliveryList.vue'),
// },
// {
// path: 'create',
// name: 'ZoneDeliveryCreate',
// meta: {
// title: 'deliveryCreate',
// icon: 'create',
// },
// component: () =>
// import('src/pages/Zone/Delivery/ZoneDeliveryCreate.vue'),
// },
// {
// path: ':id/edit',
// name: 'ZoneDeliveryEdit',
// meta: {
// title: 'deliveryEdit',
// icon: 'edit',
// },
// component: () =>
// import('src/pages/Zone/Delivery/ZoneDeliveryCreate.vue'),
// },
// ],
// },
// {
// path: '/zone/upcoming',
// name: 'ZoneUpcomingMain',
// component: () => import('src/pages/Zone/ZoneMain.vue'),
// redirect: { name: 'ZoneUpcomingList' },
// children: [
// {
// path: 'list',
// name: 'ZoneUpcomingList',
// meta: {
// title: 'upcomingList',
// icon: 'today',
// },
// component: () =>
// import('src/pages/Zone/Upcoming/ZoneUpcomingList.vue'),
// },
// {
// path: 'create',
// name: 'ZoneUpcomingCreate',
// meta: {
// title: 'upcomingCreate',
// icon: 'create',
// },
// component: () =>
// import('src/pages/Zone/Upcoming/ZoneUpcomingCreate.vue'),
// },
// {
// path: ':id/edit',
// name: 'ZoneUpcomingEdit',
// meta: {
// title: 'upcomingEdit',
// icon: 'edit',
// },
// component: () =>
// import('src/pages/Zone/Upcoming/ZoneUpcomingCreate.vue'),
// },
// ],
// },
],
},
],
};

View File

@ -10,11 +10,14 @@ import supplier from './modules/Supplier';
import route from './modules/route';
import travel from './modules/travel';
import department from './modules/department';
import ItemType from './modules/itemType';
import shelving from 'src/router/modules/shelving';
import order from 'src/router/modules/order';
import entry from 'src/router/modules/entry';
import roadmap from 'src/router/modules/roadmap';
import parking from 'src/router/modules/parking';
import agency from 'src/router/modules/agency';
import zone from 'src/router/modules/zone';
const routes = [
{
@ -71,6 +74,9 @@ const routes = [
roadmap,
entry,
parking,
agency,
ItemType,
zone,
{
path: '/:catchAll(.*)*',
name: 'NotFound',

View File

@ -21,6 +21,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
'ticket',
'worker',
'wagon',
'zone',
];
const pinnedModules = ref([]);
const role = useRole();

View File

@ -0,0 +1,50 @@
describe('AgencyWorkCenter', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/agency`);
});
it('assign workCenter', () => {
cy.visit(`/#/agency`);
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click();
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-btn--standard > .q-btn__content > .block').click();
cy.get('.q-notification__message').should('have.text', 'Data created');
});
it('delete workCenter', () => {
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click();
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
cy.get('.q-notification__message').should(
'have.text',
'WorkCenter removed successfully'
);
});
it('error on duplicate workCenter', () => {
cy.visit(`/#/agency`);
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click();
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-btn--standard > .q-btn__content > .block').click();
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-btn--standard > .q-btn__content > .block').click();
cy.get(
':nth-child(2) > .q-notification__wrapper > .q-notification__content > .q-notification__message'
).should('have.text', 'This workCenter is already assigned to this agency');
});
});

View File

@ -1,5 +1,5 @@
import { vi, describe, expect, it } from 'vitest';
import { axios } from 'app/test/vitest/helper';
import { vi, describe, expect, it, beforeAll, beforeEach } from 'vitest';
import { axios, flushPromises } from 'app/test/vitest/helper';
import { useSession } from 'composables/useSession';
import { useState } from 'composables/useState';
@ -63,73 +63,148 @@ describe('session', () => {
});
});
describe('login', () => {
const expectedUser = {
id: 999,
name: `T'Challa`,
nickname: 'Black Panther',
lang: 'en',
userConfig: {
darkMode: false,
},
};
const rolesData = [
{
role: {
name: 'salesPerson',
describe(
'login',
() => {
const expectedUser = {
id: 999,
name: `T'Challa`,
nickname: 'Black Panther',
lang: 'en',
userConfig: {
darkMode: false,
},
},
{
role: {
name: 'admin',
};
const rolesData = [
{
role: {
name: 'salesPerson',
},
},
},
];
{
role: {
name: 'admin',
},
},
];
it('should fetch the user roles and then set token in the sessionStorage', async () => {
const expectedRoles = ['salesPerson', 'admin'];
vi.spyOn(axios, 'get').mockResolvedValue({
data: { roles: rolesData, user: expectedUser },
it('should fetch the user roles and then set token in the sessionStorage', async () => {
const expectedRoles = ['salesPerson', 'admin'];
vi.spyOn(axios, 'get').mockResolvedValue({
data: { roles: rolesData, user: expectedUser },
});
const expectedToken = 'mySessionToken';
const expectedTokenMultimedia = 'mySessionTokenMultimedia';
const keepLogin = false;
await session.login({
token: expectedToken,
tokenMultimedia: expectedTokenMultimedia,
keepLogin,
});
const roles = state.getRoles();
const localToken = localStorage.getItem('token');
const sessionToken = sessionStorage.getItem('token');
expect(roles.value).toEqual(expectedRoles);
expect(localToken).toBeNull();
expect(sessionToken).toEqual(expectedToken);
await session.destroy(); // this clears token and user for any other test
});
const expectedToken = 'mySessionToken';
const expectedTokenMultimedia = 'mySessionTokenMultimedia';
const keepLogin = false;
it('should fetch the user roles and then set token in the localStorage', async () => {
const expectedRoles = ['salesPerson', 'admin'];
vi.spyOn(axios, 'get').mockResolvedValue({
data: { roles: rolesData, user: expectedUser },
});
await session.login(expectedToken,expectedTokenMultimedia, keepLogin);
const expectedToken = 'myLocalToken';
const expectedTokenMultimedia = 'myLocalTokenMultimedia';
const keepLogin = true;
const roles = state.getRoles();
const localToken = localStorage.getItem('token');
const sessionToken = sessionStorage.getItem('token');
await session.login({
token: expectedToken,
tokenMultimedia: expectedTokenMultimedia,
keepLogin,
});
expect(roles.value).toEqual(expectedRoles);
expect(localToken).toBeNull();
expect(sessionToken).toEqual(expectedToken);
const roles = state.getRoles();
const localToken = localStorage.getItem('token');
const sessionToken = sessionStorage.getItem('token');
await session.destroy(); // this clears token and user for any other test
expect(roles.value).toEqual(expectedRoles);
expect(localToken).toEqual(expectedToken);
expect(sessionToken).toBeNull();
await session.destroy(); // this clears token and user for any other test
});
},
{}
);
describe('RenewToken', () => {
const expectedToken = 'myToken';
const expectedTokenMultimedia = 'myTokenMultimedia';
const currentDate = new Date();
beforeAll(() => {
const tokenConfig = {
id: 1,
renewPeriod: 21600,
courtesyTime: 60,
renewInterval: 300,
};
state.setTokenConfig(tokenConfig);
sessionStorage.setItem('renewPeriod', 1);
});
it('NOT Should renewToken', async () => {
const data = {
token: expectedToken,
tokenMultimedia: expectedTokenMultimedia,
keepLogin: false,
ttl: 1,
created: Date.now(),
};
session.setSession(data);
expect(sessionStorage.getItem('keepLogin')).toBeFalsy();
expect(sessionStorage.getItem('created')).toBeDefined();
expect(sessionStorage.getItem('ttl')).toEqual(1);
await session.checkValidity();
expect(sessionStorage.getItem('token')).toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).toEqual(
expectedTokenMultimedia
);
});
it('Should renewToken', async () => {
currentDate.setMinutes(currentDate.getMinutes() - 100);
const data = {
token: expectedToken,
tokenMultimedia: expectedTokenMultimedia,
keepLogin: false,
ttl: 1,
created: currentDate,
};
session.setSession(data);
it('should fetch the user roles and then set token in the localStorage', async () => {
const expectedRoles = ['salesPerson', 'admin'];
vi.spyOn(axios, 'get').mockResolvedValue({
data: { roles: rolesData, user: expectedUser },
});
const expectedToken = 'myLocalToken';
const expectedTokenMultimedia = 'myLocalTokenMultimedia';
const keepLogin = true;
await session.login(expectedToken, expectedTokenMultimedia, keepLogin);
const roles = state.getRoles();
const localToken = localStorage.getItem('token');
const sessionToken = sessionStorage.getItem('token');
expect(roles.value).toEqual(expectedRoles);
expect(localToken).toEqual(expectedToken);
expect(sessionToken).toBeNull();
await session.destroy(); // this clears token and user for any other test
vi.spyOn(axios, 'post')
.mockResolvedValueOnce({
data: { id: '' },
})
.mockResolvedValueOnce({
data: {
id: '',
},
});
expect(sessionStorage.getItem('keepLogin')).toBeFalsy();
expect(sessionStorage.getItem('created')).toBeDefined();
expect(sessionStorage.getItem('ttl')).toEqual(1);
await session.checkValidity();
expect(sessionStorage.getItem('token')).not.toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).not.toEqual(
expectedTokenMultimedia
);
});
});
});

View File

@ -0,0 +1,31 @@
import { vi, describe, expect, it } from 'vitest';
import { axios, flushPromises } from 'app/test/vitest/helper';
import { useTokenConfig } from 'composables/useTokenConfig';
const tokenConfig = useTokenConfig();
describe('useTokenConfig', () => {
describe('fetch', () => {
it('should call setTokenConfig of the state with the expected data', async () => {
const data = {
id: 1,
renewPeriod: 21600,
courtesyTime: 60,
renewInterval: 300,
};
vi.spyOn(axios, 'get').mockResolvedValueOnce({
data,
});
vi.spyOn(tokenConfig.state, 'setTokenConfig');
tokenConfig.fetch();
await flushPromises();
expect(tokenConfig.state.setTokenConfig).toHaveBeenCalledWith(data);
const renewPeriod = sessionStorage.getItem('renewPeriod');
expect(renewPeriod).toEqual(data.renewPeriod);
});
});
});

View File

@ -1 +1 @@
// This file will be run before each test file
// This file will be run before each test file, don't delete or vitest will not work.