Merge branch 'dev' into 6321_negative_tickets
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-05-08 12:30:01 +02:00
commit 61519595a9
64 changed files with 3697 additions and 106 deletions

View File

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "24.20.0",
"version": "24.22.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",

View File

@ -81,6 +81,7 @@ defineExpose({
hasChanges,
saveChanges,
getChanges,
formData,
});
async function fetch(data) {
@ -124,11 +125,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

@ -1,7 +1,6 @@
<script setup>
import { ref, reactive, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
@ -12,10 +11,16 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import axios from 'axios';
import { dashIfEmpty } from 'src/filters';
const props = defineProps({
url: {
type: String,
required: true,
},
});
const emit = defineEmits(['itemSelected']);
const { t } = useI18n();
const route = useRoute();
const itemFilter = {
include: [
@ -73,7 +78,7 @@ const tableColumns = computed(() => [
{
label: t('entry.buys.color'),
name: 'ink',
field: 'inkName',
field: (row) => row?.ink?.name,
align: 'left',
},
]);
@ -100,7 +105,7 @@ const fetchResults = async () => {
}
filter.where = where;
const { data } = await axios.get(`Entries/${route.params.id}/lastItemBuys`, {
const { data } = await axios.get(props.url, {
params: { filter: JSON.stringify(filter) },
});
tableRows.value = data;

View File

@ -52,6 +52,11 @@ const focus = () => {
defineExpose({
focus,
});
const inputRules = (val) => {
const { min } = vnInputRef.value.$attrs;
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
};
</script>
<template>
@ -68,6 +73,8 @@ defineExpose({
:class="{ required: $attrs.required }"
@keyup.enter="onEnterPress()"
:clearable="false"
:rules="[inputRules]"
:lazy-rules="true"
>
<template v-if="$slots.prepend" #prepend>
<slot name="prepend" />
@ -85,3 +92,9 @@ defineExpose({
</QInput>
</div>
</template>
<i18n>
en:
inputMin: Must be more than {value}
es:
inputMin: Debe ser mayor a {value}
</i18n>

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

@ -61,7 +61,7 @@ const $props = defineProps({
});
const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired');
const { optionLabel, optionValue, options, modelValue } = toRefs($props);
const myOptions = ref([]);
@ -171,6 +171,7 @@ watch(modelValue, (newValue) => {
hide-selected
fill-input
ref="vnSelectRef"
lazy-rules
:class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null"
virtual-scroll-slice-size="options.length"

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

@ -97,6 +97,10 @@ globals:
agency: Agency
workCenters: Work centers
modes: Modes
zones: Zones
zonesList: Zones
deliveryList: Delivery days
upcomingList: Upcoming deliveries
created: Created
worker: Worker
now: Now
@ -524,7 +528,7 @@ claim:
records: records
card:
claimId: Claim ID
assignedTo: Assigned
attendedBy: Attended by
created: Created
state: State
ticketId: Ticket ID
@ -562,6 +566,7 @@ claim:
responsible: Responsible
worker: Worker
redelivery: Redelivery
changeState: Change state
basicData:
customer: Customer
assignedTo: Assigned
@ -993,7 +998,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
@ -1135,12 +1140,14 @@ item:
fixedPrice: Fixed prices
wasteBreakdown: Waste breakdown
itemCreate: New item
log: Log
barcode: Barcodes
tax: Tax
barcode: Barcode
log: Log
botanical: Botanical
shelving: Shelving
itemTypeCreate: New item type
family: Item Type
lastEntries: Last entries
descriptor:
item: Item
buyer: Buyer
@ -1230,6 +1237,12 @@ item/itemType:
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

@ -97,6 +97,10 @@ globals:
agency: Agencia
workCenters: Centros de trabajo
modes: Modos
zones: Zonas
zonesList: Zonas
deliveryList: Días de entrega
upcomingList: Próximos repartos
created: Fecha creación
worker: Trabajador
now: Ahora
@ -522,7 +526,7 @@ claim:
records: registros
card:
claimId: ID reclamación
assignedTo: Asignada a
attendedBy: Atendida por
created: Creada
state: Estado
ticketId: ID ticket
@ -560,6 +564,7 @@ claim:
responsible: Responsable
worker: Trabajador
redelivery: Devolución
changeState: Cambiar estado
basicData:
customer: Cliente
assignedTo: Asignada a
@ -1138,8 +1143,10 @@ item:
botanical: 'Botánico'
barcode: 'Código de barras'
log: Historial
shelving: Carros
itemTypeCreate: Nueva familia
family: Familia
lastEntries: Últimas entradas
descriptor:
item: Artículo
buyer: Comprador
@ -1229,6 +1236,12 @@ item/itemType:
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

@ -41,10 +41,6 @@ const claimStates = ref([]);
const claimStatesCopy = ref([]);
const optionsList = ref([]);
function setWorkers(data) {
workers.value = data;
workersCopy.value = data;
}
const workersOptions = ref([]);
function setClaimStates(data) {

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

@ -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

@ -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

@ -251,6 +251,7 @@ const redirectToBuysView = () => {
>
<template #form>
<FilterItemForm
:url="`Entries/${route.params.id}/lastItemBuys`"
@item-selected="row[col.field] = $event"
/>
</template>

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,52 @@
<script setup>
import { reactive, ref, onMounted, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
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 route = useRoute();
const identifierInputRef = ref(null);
const intrastatFormData = reactive({});
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
};
onMounted(async () => {
await nextTick();
identifierInputRef.value.focus();
});
</script>
<template>
<FormModelPopup
:url-update="`Items/${route.params.id}/createIntrastat`"
model="itemGenus"
:title="t('createIntrastatForm.title')"
:form-initial-data="intrastatFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
ref="identifierInputRef"
:label="t('createIntrastatForm.identifier')"
type="number"
v-model.number="data.intrastatId"
:required="true"
/>
<VnInput
:label="t('createIntrastatForm.description')"
v-model="data.description"
:required="true"
/>
</VnRow>
</template>
</FormModelPopup>
</template>

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';
@ -23,10 +23,6 @@ const focusLastInput = () => {
if (lastInput) lastInput.focus();
});
};
onMounted(async () => {
if (itemBarcodeRef.value) itemBarcodeRef.value.reload();
});
</script>
<template>
<div class="full-width flex justify-center">
@ -42,6 +38,7 @@ onMounted(async () => {
model="ItemBarcodes"
ref="itemBarcodeRef"
url="ItemBarcodes"
auto-load
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">

View File

@ -1 +1,233 @@
<template>Item basic data</template>
<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';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import FilterItemForm from 'src/components/FilterItemForm.vue';
import CreateIntrastatForm from './CreateIntrastatForm.vue';
const route = useRoute();
const { t } = useI18n();
const itemTypesOptions = ref([]);
const itemsWithNameOptions = ref([]);
const intrastatsOptions = ref([]);
const expensesOptions = ref([]);
const onIntrastatCreated = (response, formData) => {
intrastatsOptions.value = [...intrastatsOptions.value, response];
formData.intrastatFk = response.id;
};
</script>
<template>
<FetchData
url="ItemTypes"
:filter="{
fields: ['id', 'name', 'categoryFk'],
include: 'category',
order: 'name ASC',
}"
@on-fetch="(data) => (itemTypesOptions = data)"
auto-load
/>
<FetchData
url="Items/withName"
:filter="{
fields: ['id', 'name'],
order: 'id DESC',
}"
@on-fetch="(data) => (itemsWithNameOptions = data)"
auto-load
/>
<FetchData
url="Intrastats"
:filter="{
fields: ['id', 'description'],
order: 'description ASC',
}"
@on-fetch="(data) => (intrastatsOptions = data)"
auto-load
/>
<FetchData
url="Expenses"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
@on-fetch="(data) => (expensesOptions = data)"
auto-load
/>
<FormModel
:url="`Items/${route.params.id}`"
:url-update="`Items/${route.params.id}`"
model="item"
auto-load
:clear-store-on-unmount="false"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
:label="t('basicData.type')"
v-model="data.typeFk"
:options="itemTypesOptions"
option-value="id"
option-label="name"
hide-selected
map-options
>
<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>
<VnInput :label="t('basicData.reference')" v-model="data.comment" />
<VnInput :label="t('basicData.relevancy')" v-model="data.relevancy" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput :label="t('basicData.stems')" v-model="data.stems" />
<VnInput
:label="t('basicData.multiplier')"
v-model="data.stemMultiplier"
/>
<VnSelectDialog
:label="t('basicData.generic')"
v-model="data.genericFk"
:options="itemsWithNameOptions"
option-value="id"
option-label="name"
map-options
hide-selected
action-icon="filter_alt"
>
<template #form>
<FilterItemForm
url="Items/withName"
@item-selected="data.genericFk = $event"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectDialog
:label="t('basicData.intrastat')"
v-model="data.intrastatFk"
:options="intrastatsOptions"
option-value="id"
option-label="description"
map-options
hide-selected
>
<template #form>
<CreateIntrastatForm
@on-data-saved="
(_, requestResponse) =>
onIntrastatCreated(requestResponse, data)
"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.description }}</QItemLabel>
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectDialog>
<div class="col">
<VnSelect
:label="t('basicData.expense')"
v-model="data.expenseFk"
:options="expensesOptions"
option-value="id"
option-label="name"
hide-selected
map-options
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
:label="t('basicData.weightByPiece')"
v-model.number="data.weightByPiece"
:min="0"
type="number"
/>
<VnInput
:label="t('basicData.boxUnits')"
v-model.number="data.packingOut"
:min="0"
type="number"
/>
<VnInput
:label="t('basicData.recycledPlastic')"
v-model.number="data.recycledPlastic"
:min="0"
type="number"
/>
<VnInput
:label="t('basicData.nonRecycledPlastic')"
v-model.number="data.nonRecycledPlastic"
:min="0"
type="number"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<QCheckbox v-model="data.isActive" :label="t('basicData.isActive')" />
<QCheckbox v-model="data.hasKgPrice" :label="t('basicData.hasKgPrice')" />
<div>
<QCheckbox
v-model="data.isFragile"
:label="t('basicData.isFragile')"
class="q-mr-sm"
/>
<QIcon name="info" class="cursor-pointer" size="xs">
<QTooltip max-width="300px">
{{ t('basicData.isFragileTooltip') }}
</QTooltip>
</QIcon>
</div>
<div>
<QCheckbox
v-model="data.isPhotoRequested"
:label="t('basicData.isPhotoRequested')"
class="q-mr-sm"
/>
<QIcon name="info" class="cursor-pointer" size="xs">
<QTooltip>
{{ t('basicData.isPhotoRequestedTooltip') }}
</QTooltip>
</QIcon>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<QInput
:label="t('basicData.description')"
type="textarea"
v-model="data.description"
fill-input
/>
</VnRow>
</template>
</FormModel>
</template>

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

@ -0,0 +1,279 @@
<script setup>
import { onMounted, ref, computed, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData';
import useNotify from 'src/composables/useNotify.js';
import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
const route = useRoute();
const { t } = useI18n();
const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm();
const rowsSelected = ref([]);
const parkingsOptions = ref([]);
const shelvingsOptions = ref([]);
const exprBuilder = (param, value) => {
switch (param) {
case 'parking':
case 'shelving':
case 'label':
case 'packing':
case 'itemFk':
return { [param]: value };
}
};
const params = reactive({ itemFk: route.params.id });
const arrayData = useArrayData('ItemShelvings', {
url: 'ItemShelvingPlacementSupplyStocks',
userParams: params,
exprBuilder: exprBuilder,
});
const rows = computed(() => arrayData.store.data || []);
const applyColumnFilter = async (col) => {
try {
const paramKey = col.columnFilter?.filterParamKey || col.field;
params[paramKey] = col.columnFilter.filterValue;
await arrayData.addFilter({ filter: null, params });
} catch (err) {
console.error('Error applying column filter', err);
}
};
const getInputEvents = (col) => {
return col.columnFilter.type === 'select'
? { 'update:modelValue': () => applyColumnFilter(col) }
: {
'keyup.enter': () => applyColumnFilter(col),
};
};
const columns = computed(() => [
{
label: t('shelvings.created'),
name: 'created',
field: 'created',
align: 'left',
sortable: true,
columnFilter: null,
format: (val) => toDateFormat(val),
},
{
label: t('shelvings.item'),
name: 'item',
field: 'itemFk',
align: 'left',
sortable: true,
columnFilter: null,
},
{
label: t('shelvings.concept'),
name: 'concept',
align: 'left',
sortable: true,
columnFilter: null,
},
{
label: t('shelvings.parking'),
name: 'parking',
field: 'parking',
align: 'left',
sortable: true,
format: (val) => dashIfEmpty(val),
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: parkingsOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
},
{
label: t('shelvings.shelving'),
name: 'shelving',
field: 'shelving',
align: 'left',
sortable: true,
format: (val) => dashIfEmpty(val),
columnFilter: {
component: VnSelect,
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: {
options: shelvingsOptions.value,
'option-value': 'code',
'option-label': 'code',
dense: true,
},
},
},
{
label: t('shelvings.label'),
name: 'label',
align: 'left',
sortable: true,
format: (_, row) => (row.stock / row.packing).toFixed(2),
columnFilter: {
component: VnInput,
type: 'text',
filterParamKey: 'label',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
},
{
label: t('shelvings.packing'),
field: 'packing',
name: 'packing',
align: 'left',
sortable: true,
columnFilter: {
component: VnInput,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
},
},
format: (val) => dashIfEmpty(val),
},
]);
const totalLabels = computed(() =>
rows.value.reduce((acc, row) => acc + row.stock / row.packing, 0).toFixed(2)
);
const removeLines = async () => {
try {
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
rowsSelected.value = [];
notify('shelvings.shelvingsRemoved', 'positive');
await arrayData.fetch({ append: false });
} catch (err) {
console.error('Error removing lines', err);
}
};
onMounted(async () => {
await arrayData.fetch({ append: false });
});
</script>
<template>
<FetchData
url="parkings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (parkingsOptions = data)"
/>
<FetchData
url="shelvings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#st-data">
<div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222">
<QCardSection horizontal>
<span class="text-weight-bold text-subtitle1 text-center full-width">
{{ t('shelvings.total') }}
</span>
</QCardSection>
<QCardSection class="column items-center" horizontal>
<div>
<span class="details-label"
>{{ t('shelvings.totalLabels') }}
</span>
<span>: {{ totalLabels }}</span>
</div></QCardSection
>
</div>
</Teleport>
<Teleport to="#st-actions">
<QBtn
color="primary"
icon="delete"
:disabled="!rowsSelected.length"
@click="
openConfirmationModal(
t('shelvings.removeConfirmTitle'),
t('shelvings.removeConfirmSubtitle'),
removeLines
)
"
>
<QTooltip>
{{ t('shelvings.removeLines') }}
</QTooltip>
</QBtn>
</Teleport>
</template>
<QPage class="column items-center q-pa-md">
<QTable
:rows="rows"
:columns="columns"
row-key="id"
:pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md"
selection="multiple"
v-model:selected="rowsSelected"
:no-data-label="t('globals.noResults')"
>
<template #top-row="{ cols }">
<QTr>
<QTd />
<QTd
v-for="(col, index) in cols"
:key="index"
style="max-width: 100px"
>
<component
:is="col.columnFilter.component"
v-if="col.columnFilter"
v-model="col.columnFilter.filterValue"
v-bind="col.columnFilter.attrs"
v-on="col.columnFilter.event(col)"
dense
/>
</QTd>
</QTr>
</template>
<template #body-cell-concept="{ row }">
<QTd @click.stop>
<span class="link">{{ row.longName }}</span>
<ItemDescriptorProxy :id="row.itemFk" />
</QTd>
</template>
</QTable>
</QPage>
</template>

View File

@ -1 +1,191 @@
<template>Item tags (CREAR CUANDO SE DESARROLLE EL MODULO DE ITEMS)</template>
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CrudModel from 'components/CrudModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import axios from 'axios';
const route = useRoute();
const { t } = useI18n();
const itemTagsRef = ref(null);
const tagOptions = ref([]);
const valueOptionsMap = ref(new Map());
const getSelectedTagValues = async (tag) => {
try {
if (!tag.tagFk && tag.tag.isFree) return;
const filter = {
fields: ['value'],
order: 'value ASC',
};
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`Tags/${tag.tagFk}/filterValue`, {
params,
});
valueOptionsMap.value.set(tag.tagFk, data);
} catch (err) {
console.error('Error getting selected tag values');
}
};
const onItemTagsFetched = async (itemTags) => {
(itemTags || []).forEach((tag) => {
getSelectedTagValues(tag);
});
};
const handleTagSelected = (rows, index, tag) => {
rows[index].tag = tag;
rows[index].tagFk = tag.id;
rows[index].value = null;
getSelectedTagValues(rows[index]);
};
const getHighestPriority = (rows) => {
let max = 0;
rows.forEach((tag) => {
if (tag.priority > max) max = tag.priority;
});
return max + 1;
};
const insertTag = (rows) => {
itemTagsRef.value.insert();
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
getHighestPriority(rows);
};
</script>
<template>
<FetchData
url="Tags"
:filter="{ fields: ['id', 'name', 'isFree', 'sourceTable'] }"
@on-fetch="(data) => (tagOptions = data)"
auto-load
/>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<CrudModel
ref="itemTagsRef"
data-key="ItemTags"
model="ItemTags"
url="ItemTags"
update-url="Tags/onSubmit"
:data-required="{
$index: undefined,
itemFk: route.params.id,
priority: undefined,
tag: {
isFree: undefined,
value: undefined,
name: undefined,
},
tagFk: undefined,
}"
:default-remove="false"
:filter="{
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
where: { itemFk: route.params.id },
order: 'priority ASC',
include: {
relation: 'tag',
scope: {
fields: ['id', 'name', 'isFree', 'sourceTable'],
},
},
}"
auto-load
@on-fetch="onItemTagsFetched"
>
<template #body="{ rows, validate }">
<QCard class="q-pl-lg q-py-md">
<VnRow
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<VnSelect
:label="t('itemTags.tag')"
:options="tagOptions"
:model-value="row.tag"
option-label="name"
hide-selected
@update:model-value="
($event) => handleTagSelected(rows, index, $event)
"
:required="true"
:rules="validate('itemTag.tagFk')"
/>
<VnSelect
v-if="row.tag?.isFree === false"
:key="row.tagFk"
:label="t('Value')"
v-model="row.value"
:options="valueOptionsMap.get(row.tagFk)"
option-label="value"
option-value="value"
emit-value
use-input
class="col"
:is-clearable="false"
:required="false"
:rules="validate('itemTag.tagFk')"
/>
<VnInput
v-else-if="
row.tag?.isFree || row.tag?.isFree == undefined
"
v-model="row.value"
:label="t('itemTags.value')"
:is-clearable="false"
style="width: 100%"
/>
<VnInput
:label="t('itemTags.relevancy')"
type="number"
v-model="row.priority"
:required="true"
:rules="validate('itemTag.priority')"
/>
<div class="col-1 row justify-center items-center">
<QIcon
@click="itemTagsRef.remove([row])"
class="fill-icon-on-hover"
color="primary"
name="delete"
size="sm"
>
<QTooltip>
{{ t('itemTags.removeTag') }}
</QTooltip>
</QIcon>
</div>
</VnRow>
<VnRow>
<QIcon
@click="insertTag(rows)"
class="cursor-pointer"
:disable="!validRow"
color="primary"
name="add"
size="sm"
>
<QTooltip>
{{ t('itemTags.addTag') }}
</QTooltip>
</QIcon>
</VnRow>
</QCard>
</template>
</CrudModel>
</QPage>
</div>
</template>

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

@ -1,3 +1,17 @@
shelvings:
created: Created
item: Item
concept: Concept
parking: Parking
shelving: Shelving
label: Label
packing: Packing
total: Total
totalLabels: Total labels
removeLines: Remove selected lines
shelvingsRemoved: ItemShelvings removed
removeConfirmTitle: Selected lines will be deleted
removeConfirmSubtitle: Are you sure you want to continue?
itemDiary:
date: Date
id: Id
@ -11,6 +25,59 @@ itemDiary:
showBefore: Show what's before the inventory
since: Since
warehouse: Warehouse
basicData:
type: Type
reference: Reference
relevancy: Relevancy
stems: Stems
multiplier: Multiplier
generic: Generic
intrastat: Intrastat
expense: Expense
weightByPiece: Weight/Piece
boxUnits: Units/Box
recycledPlastic: Recycled plastic
nonRecycledPlastic: Non recycled plastic
description: Description
isActive: Active
hasKgPrice: Price in kg
isFragile: Fragile
isFragileTooltip: Is shown at website, app that this item cannot travel (wreath, palms, ...)
isPhotoRequested: Do photo
isPhotoRequestedTooltip: This item does need a photo
createIntrastatForm:
title: New intrastat
identifier: Identifier
description: Description
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
itemTags:
removeTag: Remove tag
addTag: Add tag
tag: Tag
value: Value
relevancy: Relevancy
proposal:
itemFk: Item
longName: Name

View File

@ -1,3 +1,17 @@
shelvings:
created: Creado
item: Artículo
concept: Concepto
parking: Parking
shelving: Matrícula
label: Etiqueta
packing: Packing
total: Total
totalLabels: Total etiquetas
removeLines: Eliminar líneas seleccionadas
shelvingsRemoved: Carros eliminados
removeConfirmTitle: Las líneas seleccionadas serán eliminadas
removeConfirmSubtitle: ¿Seguro que quieres continuar?
itemDiary:
date: Fecha
id: Id
@ -11,6 +25,59 @@ itemDiary:
showBefore: Mostrar lo anterior al inventario
since: Desde
warehouse: Almacén
basicData:
type: Tipo
reference: Referencia
relevancy: Relevancia
stems: Tallos
multiplier: Multiplicador
generic: Genérico
intrastat: Intrastat
expense: Gasto
weightByPiece: Peso (gramos)/tallo
boxUnits: Unidades/caja
recycledPlastic: Plástico reciclado
nonRecycledPlastic: Plástico no reciclado
description: Descripción
isActive: Activo
hasKgPrice: Precio en kg
isFragile: Frágil
isFragileTooltip: Se muestra en la web app, que este artículo no puede viajar (coronas, palmas, ...)
isPhotoRequested: Hacer foto
isPhotoRequestedTooltip: Este artículo necesita una foto
createIntrastatForm:
title: Nuevo intrastat
identifier: Identificador
description: Descripció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
itemTags:
removeTag: Quitar etiqueta
addTag: Añadir etiqueta
tag: Etiqueta
value: Valor
relevancy: Relevancia
proposal:
itemFk: Item
longName: Nombre

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

@ -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,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

@ -27,7 +27,6 @@ const workerFilter = {
},
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } },
{ relation: 'client', scope: { fields: ['phone'] } },
],
};
const workersFilter = {
@ -87,11 +86,6 @@ const maritalStatus = [
:label="t('Mobile extension')"
clearable
/>
<VnInput
v-model="data.client.phone"
:label="t('Personal phone')"
clearable
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
@ -163,7 +157,6 @@ es:
Last name: Apellidos
Business phone: Teléfono de empresa
Mobile extension: Extensión móvil
Personal phone: Teléfono personal
Boss: Jefe
Marital status: Estado civil
Married: Casado/a

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, watch } from 'vue';
import { nextTick, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@ -10,10 +10,13 @@ import WorkerCalendarItem from 'pages/Worker/Card/WorkerCalendarItem.vue';
import { useStateStore } from 'stores/useStateStore';
import axios from 'axios';
import { useRouter } from 'vue-router';
const router = useRouter();
const stateStore = useStateStore();
const route = useRoute();
const { t } = useI18n();
const workerIsFreelance = ref();
const WorkerFreelanceRef = ref();
const workerCalendarFilterRef = ref(null);
const workerCalendarRef = ref(null);
const absenceType = ref(null);
@ -128,6 +131,7 @@ const refreshData = () => {
updateYearHolidays();
updateContractHolidays();
getAbsences();
WorkerFreelanceRef.value.fetch();
};
const onDeletedEvent = (timestamp) => {
@ -136,12 +140,21 @@ const onDeletedEvent = (timestamp) => {
if (festiveEventsMap.value[timestamp])
eventsMap.value[timestamp] = festiveEventsMap.value[timestamp];
};
const activeContractRef = ref(null);
watch(
() => router.currentRoute.value.params.id,
async () => {
await nextTick();
await activeContractRef.value.fetch();
}
);
watch([year, businessFk], () => refreshData());
</script>
<template>
<FetchData
ref="activeContractRef"
:url="`Workers/${route.params.id}/activeContract`"
@on-fetch="onFetchActiveContract"
auto-load
@ -151,6 +164,12 @@ watch([year, businessFk], () => refreshData());
@on-fetch="(data) => (isSubordinate = data)"
auto-load
/>
<FetchData
:url="`Workers/${route.params.id}`"
@on-fetch="(data) => (workerIsFreelance = data.isFreelance)"
ref="WorkerFreelanceRef"
auto-load
/>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
@ -181,7 +200,7 @@ watch([year, businessFk], () => refreshData());
</QScrollArea>
</QDrawer>
<QPage class="column items-center">
<QCard v-if="!hasWorkCenter">
<QCard v-if="workerIsFreelance">
<QCardSection class="text-center">
{{ t('Autonomous worker') }}
</QCardSection>

View File

@ -1,15 +1,12 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import WorkerDescriptor from './WorkerDescriptor.vue';
const filter = { where: {} };
</script>
<template>
<VnCard
data-key="Worker"
custom-url="Workers/Summary"
base-url="Workers"
:descriptor="WorkerDescriptor"
:filter="filter"
searchbar-data-key="WorkerList"
searchbar-url="Workers/filter"
searchbar-label="Search worker"

View File

@ -31,12 +31,31 @@ const entityId = computed(() => {
});
const worker = ref();
const filter = computed(() => {
return { where: { id: entityId.value } };
});
const filter = {
include: [
{
relation: 'user',
scope: {
fields: ['email', 'name', 'nickname'],
},
},
{
relation: 'department',
scope: {
include: [
{
relation: 'department',
},
],
},
},
{
relation: 'sip',
},
],
};
const sip = ref(null);
watch(
() => [worker.value?.sip?.extension, state.get('extension')],
([newWorkerSip, newStateExtension], [oldWorkerSip, oldStateExtension]) => {
@ -62,7 +81,7 @@ const setData = (entity) => {
<CardDescriptor
module="Worker"
data-key="workerData"
url="Workers/summary"
:url="`Workers/${entityId}`"
:filter="filter"
:title="data.title"
:subtitle="data.subtitle"

View File

@ -27,18 +27,46 @@ onMounted(async () => {
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
});
const filter = computed(() => {
return { where: { id: entityId.value } };
});
const filter = {
include: [
{
relation: 'user',
scope: {
fields: ['email', 'name', 'nickname', 'roleFk'],
include: {
relation: 'role',
scope: {
fields: ['name'],
},
},
},
},
{
relation: 'department',
scope: {
include: {
relation: 'department',
scope: {
fields: ['name'],
},
},
},
},
{
relation: 'boss',
},
{
relation: 'client',
},
{
relation: 'sip',
},
],
};
</script>
<template>
<CardSummary
data-key="workerData"
ref="summary"
:url="`Workers/summary`"
:filter="filter"
>
<CardSummary ref="summary" :url="`Workers/${entityId}`" :filter="filter">
<template #header="{ entity }">
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
</template>
@ -75,6 +103,12 @@ const filter = computed(() => {
<VnLinkPhone :phone-number="worker.phone" />
</template>
</VnLv>
<VnLv :value="worker.client?.phone">
<template #label>
{{ t('worker.summary.personalPhone') }}
<VnLinkPhone :phone-number="worker.client?.phone" />
</template>
</VnLv>
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
</QCard>
<QCard class="vn-one">

View File

@ -0,0 +1,103 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QCheckbox } from 'quasar';
const route = useRoute();
const { t } = useI18n();
const zoneFilter = {
include: [
{
relation: 'agency',
scope: {
fields: ['name'],
include: { relation: 'agencyModeFk', scope: { fields: ['id'] } },
},
},
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } },
{ relation: 'client', scope: { fields: ['phone'] } },
],
};
const agencyFilter = {
fields: ['id', 'name'],
order: 'name ASC',
limit: 30,
};
</script>
<template>
<FetchData
:filter="agencyFilter"
@on-fetch="(data) => (agencyOptions = data)"
auto-load
url="agencies"
/>
<FetchData
:filter="zoneFilter"
@on-fetch="(data) => (zoneOptions = data)"
auto-load
url="zones"
/>
<FormModel
:filter="zoneFilter"
:url="`zone/${route.params.id}/basic-data`"
auto-load
model="Zone"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput :label="t('Name')" clearable v-model="data.zone.name" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.agency.name" :label="t('Agency')" clearable />
<VnInput v-model="data.zone.itemMaxSize" :label="t('Max m³')" clearable />
<VnInput v-model="data.zone.m3Max" :label="t('Maximum m³')" clearable />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
v-model="data.zone.travelingDays"
:label="t('Traveling days')"
clearable
/>
<VnInput v-model="data.zone.hour" :label="t('Closing')" clearable />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.zone.price" :label="t('Price')" clearable />
<VnInput v-model="data.zone.bonus" :label="t('Bonus')" clearable />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
v-model="data.zone.inflation"
:label="t('Inflation')"
clearable
/>
<QCheckbox v-model="data.zone.isVolumetric" :label="t('Volumetric')" />
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Name: Nombre
Agency: Agencia
Max : Medida máxima
Maximum : maximo
Traveling days: Dias de viaje
Closing: Cierre
Price: Precio
Bonus: Bonificación
Inflation: Inflación
Volumetric: Volumétrico
</i18n>

View File

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,96 @@
<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 { toTimeFormat } from 'src/filters/date';
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);
};
</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="toTimeFormat(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 @@
<template>Zone Locations</template>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Zone" url="/ZoneLogs"></VnLog>
</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

@ -0,0 +1,53 @@
<script setup>
import { useRoute } from 'vue-router';
import VnPaginate from 'components/ui/VnPaginate.vue';
import CardList from 'components/CardList.vue';
import VnLv from 'components/ui/VnLv.vue';
const route = useRoute();
const deleteWarehouse = () => {
return true;
};
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="ZoneWarehouses"
:url="`Zones/${route.params.id}/warehouses`"
auto-load
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="row.name"
:id="row.id"
>
<template #list-items>
<VnLv :value="row.name" />
<QIcon
name="delete"
size="sm"
class="cursor-pointer"
color="primary"
@click="deleteWarehouse()"
>
<QTooltip>
{{ t('Remove row') }}
</QTooltip>
</QIcon>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
Remove row: Eliminar fila
</i18n>

View File

@ -0,0 +1,432 @@
<script setup>
import { computed, ref, onMounted, onUpdated } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import VnInput from 'src/components/common/VnInput.vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
onMounted(() => fetch());
onUpdated(() => fetch());
const { t } = useI18n();
const route = useRoute();
const quasar = useQuasar();
const router = useRouter();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => $props.id || route.params.id);
const zone = ref([]);
const divisible = ref(false);
const name = ref('');
const colorPickerActive = ref(false);
let originalData = { trays: [] };
let zoneConfig;
let zoneDeliveryColors;
let currentTrayColorPicked;
async function fetch() {
try {
await axios.get('ZoneConfigs').then(async (res) => {
if (res.data) {
zoneConfig = res.data[0];
}
});
await axios.get(`ZoneDeliveryColors`).then(async (res) => {
if (res.data) {
zoneDeliveryColors = res.data;
if (!entityId.value)
zone.value.push({
id: 0,
position: 0,
color: { ...zoneDeliveryColors[0] },
action: 'add',
});
else {
await axios
.get(`ZoneDeliveryTrays`, {
params: { filter: { where: { typeFk: entityId.value } } },
})
.then(async (res) => {
if (res.data) {
for (let i = 0; i < res.data.length; i++) {
const tray = res.data[i];
zone.value.push({
id: res.data.length - i - 1,
position: tray.height,
color: {
...zoneDeliveryColors.find((color) => {
return color.id === tray.colorFk;
}),
},
action: tray.height == 0 ? 'add' : 'delete',
});
}
zone.value.forEach((value) => {
originalData.trays.push({ ...value });
});
}
});
}
}
});
if (entityId.value) {
await axios.get(`ZoneDeliverys/${entityId.value}`).then((res) => {
if (res.data) {
originalData.name = name.value = res.data.name;
originalData.divisible = divisible.value = res.data.divisible;
}
});
}
} catch (e) {
//
}
}
function addTray() {
if (
zone.value.find((tray) => {
return tray.position == null;
})
) {
quasar.notify({
message: t('zone.warnings.uncompleteTrays'),
type: 'warning',
});
return;
}
if (zone.value.length < zoneConfig.maxTrays) {
zone.value.unshift({
id: zone.value.length,
position: null,
color: { ...zoneDeliveryColors[0] },
action: 'delete',
});
} else {
quasar.notify({
message: t('zone.warnings.maxTrays'),
type: 'warning',
});
}
}
function deleteTray(trayToDelete) {
zone.value = zone.value.filter((tray) => tray.id !== trayToDelete.id);
reorderIds();
}
function reorderIds() {
for (let index = zone.value.length - 1; index >= 0; index--) {
zone.value[index].id = index;
}
}
async function onSubmit() {
try {
const path = entityId.value
? 'ZoneDeliverys/editZoneDelivery'
: 'ZoneDeliverys/createZoneDelivery';
const params = {
id: entityId.value,
name: name.value,
divisible: divisible.value,
trays: zone.value,
};
await axios.patch(path, params).then((res) => {
if (res.status == 204) router.push({ path: `/zone/type/list` });
});
} catch (error) {
//
}
}
function onReset() {
name.value = entityId.value ? originalData.name : null;
divisible.value = entityId.value ? originalData.divisible : false;
zone.value = entityId.value
? [...originalData.trays]
: [
{
id: 0,
position: 0,
color: { ...zoneDeliveryColors[0] },
action: 'add',
},
];
}
function doAction(tray) {
if (tray.action == 'add') {
addTray();
} else {
deleteTray(tray);
}
}
function showColorPicker(tray) {
colorPickerActive.value = true;
currentTrayColorPicked = zone.value.findIndex((val) => {
return val.id === tray.id;
});
}
function updateColor(newColor) {
zone.value[currentTrayColorPicked].color = {
...zoneDeliveryColors.find((color) => {
return color.rgb === newColor;
}),
};
}
function onPositionBlur(tray) {
if (tray.position) {
if (tray.position == '' || tray.position < 0) {
tray.position = null;
return;
}
tray.position = parseInt(tray.position);
zone.value.sort((a, b) => b.position - a.position);
reorderIds();
for (let index = zone.value.length - 1; index > 0; index--) {
if (exceedMaxHeight(index - 1)) continue;
if (
zone.value[index - 1].position - zone.value[index].position >=
zoneConfig.minHeightBetweenTrays
) {
continue;
} else {
zone.value[index - 1].position +=
zoneConfig.minHeightBetweenTrays -
(zone.value[index - 1].position - zone.value[index].position);
quasar.notify({
message:
t('zone.warnings.minHeightBetweenTrays') +
zoneConfig.minHeightBetweenTrays +
' cm',
type: 'warning',
});
exceedMaxHeight(index - 1);
}
}
}
}
function exceedMaxHeight(pos) {
if (zone.value[pos].position > zoneConfig.maxZoneHeight) {
zone.value.splice(pos, 1);
quasar.notify({
message: t('zone.warnings.maxZoneHeight') + zoneConfig.maxZoneHeight + ' cm',
type: 'warning',
});
return true;
}
return false;
}
</script>
<template>
<QPage class="q-pa-sm q-mx-xl">
<QForm @submit="onSubmit()" @reset="onReset()" class="q-pa-sm">
<QCard class="q-pa-md">
<VnInput
filled
v-model="name"
:label="t('zone.delivery.name')"
:rules="[(val) => !!val || t('zone.warnings.nameNotEmpty')]"
/>
<QCheckbox class="q-mb-sm" v-model="divisible" label="Divisible" />
<div class="zone-tray q-mx-lg" v-for="tray in zone" :key="tray.id">
<div class="position">
<QInput
autofocus
filled
type="number"
:class="{ isVisible: tray.action == 'add' }"
v-model="tray.position"
@blur="onPositionBlur(tray)"
>
<QTooltip :delay="2000">
{{
t('zone.warnings.minHeightBetweenTrays') +
zoneConfig.minHeightBetweenTrays +
' cm'
}}
<QSpace />
{{
t('zone.warnings.maxZoneHeight') +
zoneConfig.maxZoneHeight +
' cm'
}}
</QTooltip>
</QInput>
</div>
<div class="shelving">
<div class="shelving-half">
<div class="shelving-up"></div>
<div
class="shelving-down"
:style="{ backgroundColor: tray.color.rgb }"
@click="showColorPicker(tray)"
></div>
</div>
<div
class="shelving-divisible"
:class="{ isVisible: !divisible }"
></div>
<div class="shelving-half">
<div class="shelving-up"></div>
<div
class="shelving-down"
:style="{ backgroundColor: tray.color.rgb }"
@click="showColorPicker(tray)"
></div>
</div>
</div>
<div class="action-button">
<QBtn
flat
round
color="primary"
:icon="tray.action"
@click="doAction(tray)"
/>
</div>
</div>
<div class="q-mb-sm wheels">
<QIcon color="grey-6" name="trip_origin" size="xl" />
<QIcon color="grey-6" name="trip_origin" size="xl" />
</div>
<QDialog
v-model="colorPickerActive"
position="right"
:no-backdrop-dismiss="false"
>
<QCard>
<QCardSection>
<div class="text-h6">{{ t('zone.delivery.trayColor') }}</div>
</QCardSection>
<QCardSection class="row items-center no-wrap">
<QColor
flat
v-model="zone[currentTrayColorPicked].color.rgb"
no-header
no-footer
default-view="palette"
:palette="
zoneDeliveryColors.map((color) => {
return color.rgb;
})
"
@change="updateColor($event)"
/>
<QBtn flat round icon="close" v-close-popup />
</QCardSection>
</QCard>
</QDialog>
</QCard>
<div class="q-mt-md">
<QBtn :label="t('zone.delivery.submit')" type="submit" color="primary" />
<QBtn
:label="t('zone.delivery.reset')"
type="reset"
color="primary"
flat
class="q-ml-sm"
/>
</div>
</QForm>
</QPage>
</template>
<style lang="scss" scoped>
.q-page {
display: flex;
justify-content: center;
align-items: flex-start;
}
.q-form {
width: 70%;
}
.q-dialog {
.q-card {
width: 100%;
}
}
.wheels {
margin-left: 5%;
display: flex;
justify-content: space-around;
}
.zone-tray {
display: flex;
height: 6rem;
.position {
width: 20%;
border-right: 1rem solid gray;
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding-right: 1rem;
}
.shelving {
display: flex;
width: 75%;
.shelving-half {
width: 50%;
height: 100%;
.shelving-up {
height: 80%;
width: 100%;
}
.shelving-down {
height: 20%;
width: 100%;
}
}
.shelving-divisible {
width: 1%;
height: 100%;
border-left: 0.5rem dashed grey;
border-right: 0.5rem dashed grey;
}
}
.action-button {
width: 10%;
border-left: 1rem solid gray;
display: flex;
align-items: flex-end;
justify-content: flex-start;
padding-left: 1rem;
}
.isVisible {
display: none;
}
}
</style>

View File

@ -0,0 +1,80 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import CardList from 'components/ui/CardList.vue';
const quasar = useQuasar();
const arrayData = useArrayData('ZoneDeliveryList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
function navigate(id) {
router.push({ path: `/zone/type/${id}/edit` });
}
function create() {
router.push({ path: `/zone/type/create` });
}
async function remove(row) {
try {
const id = row.id;
await axios
.delete(`ZoneDeliverys/deleteZoneDelivery`, { params: { id } })
.then(async () => {
quasar.notify({
message: t('zone.delivery.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
});
} catch (error) {
//
}
}
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="ZoneDeliveryList"
url="/Zones/getEvents"
order="id DESC"
auto-load
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="(row.name || '').toString()"
:id="row.id"
@click="navigate(row.id)"
>
<template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
outline
/>
<QBtn
:label="t('zone.list.remove')"
@click.stop="remove(row)"
color="primary"
style="margin-top: 15px"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary" />
</QPageSticky>
</QPage>
</template>

View File

@ -0,0 +1,432 @@
<script setup>
import { computed, ref, onMounted, onUpdated } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import VnInput from 'src/components/common/VnInput.vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
onMounted(() => fetch());
onUpdated(() => fetch());
const { t } = useI18n();
const route = useRoute();
const quasar = useQuasar();
const router = useRouter();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => $props.id || route.params.id);
const zone = ref([]);
const divisible = ref(false);
const name = ref('');
const colorPickerActive = ref(false);
let originalData = { trays: [] };
let zoneConfig;
let zoneUpcomingColors;
let currentTrayColorPicked;
async function fetch() {
try {
await axios.get('ZoneConfigs').then(async (res) => {
if (res.data) {
zoneConfig = res.data[0];
}
});
await axios.get(`ZoneUpcomingColors`).then(async (res) => {
if (res.data) {
zoneUpcomingColors = res.data;
if (!entityId.value)
zone.value.push({
id: 0,
position: 0,
color: { ...zoneUpcomingColors[0] },
action: 'add',
});
else {
await axios
.get(`ZoneUpcomingTrays`, {
params: { filter: { where: { typeFk: entityId.value } } },
})
.then(async (res) => {
if (res.data) {
for (let i = 0; i < res.data.length; i++) {
const tray = res.data[i];
zone.value.push({
id: res.data.length - i - 1,
position: tray.height,
color: {
...zoneUpcomingColors.find((color) => {
return color.id === tray.colorFk;
}),
},
action: tray.height == 0 ? 'add' : 'delete',
});
}
zone.value.forEach((value) => {
originalData.trays.push({ ...value });
});
}
});
}
}
});
if (entityId.value) {
await axios.get(`ZoneUpcomings/${entityId.value}`).then((res) => {
if (res.data) {
originalData.name = name.value = res.data.name;
originalData.divisible = divisible.value = res.data.divisible;
}
});
}
} catch (e) {
//
}
}
function addTray() {
if (
zone.value.find((tray) => {
return tray.position == null;
})
) {
quasar.notify({
message: t('zone.warnings.uncompleteTrays'),
type: 'warning',
});
return;
}
if (zone.value.length < zoneConfig.maxTrays) {
zone.value.unshift({
id: zone.value.length,
position: null,
color: { ...zoneUpcomingColors[0] },
action: 'delete',
});
} else {
quasar.notify({
message: t('zone.warnings.maxTrays'),
type: 'warning',
});
}
}
function deleteTray(trayToDelete) {
zone.value = zone.value.filter((tray) => tray.id !== trayToDelete.id);
reorderIds();
}
function reorderIds() {
for (let index = zone.value.length - 1; index >= 0; index--) {
zone.value[index].id = index;
}
}
async function onSubmit() {
try {
const path = entityId.value
? 'ZoneUpcomings/editZoneUpcoming'
: 'ZoneUpcomings/createZoneUpcoming';
const params = {
id: entityId.value,
name: name.value,
divisible: divisible.value,
trays: zone.value,
};
await axios.patch(path, params).then((res) => {
if (res.status == 204) router.push({ path: `/zone/type/list` });
});
} catch (error) {
//
}
}
function onReset() {
name.value = entityId.value ? originalData.name : null;
divisible.value = entityId.value ? originalData.divisible : false;
zone.value = entityId.value
? [...originalData.trays]
: [
{
id: 0,
position: 0,
color: { ...zoneUpcomingColors[0] },
action: 'add',
},
];
}
function doAction(tray) {
if (tray.action == 'add') {
addTray();
} else {
deleteTray(tray);
}
}
function showColorPicker(tray) {
colorPickerActive.value = true;
currentTrayColorPicked = zone.value.findIndex((val) => {
return val.id === tray.id;
});
}
function updateColor(newColor) {
zone.value[currentTrayColorPicked].color = {
...zoneUpcomingColors.find((color) => {
return color.rgb === newColor;
}),
};
}
function onPositionBlur(tray) {
if (tray.position) {
if (tray.position == '' || tray.position < 0) {
tray.position = null;
return;
}
tray.position = parseInt(tray.position);
zone.value.sort((a, b) => b.position - a.position);
reorderIds();
for (let index = zone.value.length - 1; index > 0; index--) {
if (exceedMaxHeight(index - 1)) continue;
if (
zone.value[index - 1].position - zone.value[index].position >=
zoneConfig.minHeightBetweenTrays
) {
continue;
} else {
zone.value[index - 1].position +=
zoneConfig.minHeightBetweenTrays -
(zone.value[index - 1].position - zone.value[index].position);
quasar.notify({
message:
t('zone.warnings.minHeightBetweenTrays') +
zoneConfig.minHeightBetweenTrays +
' cm',
type: 'warning',
});
exceedMaxHeight(index - 1);
}
}
}
}
function exceedMaxHeight(pos) {
if (zone.value[pos].position > zoneConfig.maxZoneHeight) {
zone.value.splice(pos, 1);
quasar.notify({
message: t('zone.warnings.maxZoneHeight') + zoneConfig.maxZoneHeight + ' cm',
type: 'warning',
});
return true;
}
return false;
}
</script>
<template>
<QPage class="q-pa-sm q-mx-xl">
<QForm @submit="onSubmit()" @reset="onReset()" class="q-pa-sm">
<QCard class="q-pa-md">
<VnInput
filled
v-model="name"
:label="t('zone.upcoming.name')"
:rules="[(val) => !!val || t('zone.warnings.nameNotEmpty')]"
/>
<QCheckbox class="q-mb-sm" v-model="divisible" label="Divisible" />
<div class="zone-tray q-mx-lg" v-for="tray in zone" :key="tray.id">
<div class="position">
<QInput
autofocus
filled
type="number"
:class="{ isVisible: tray.action == 'add' }"
v-model="tray.position"
@blur="onPositionBlur(tray)"
>
<QTooltip :delay="2000">
{{
t('zone.warnings.minHeightBetweenTrays') +
zoneConfig.minHeightBetweenTrays +
' cm'
}}
<QSpace />
{{
t('zone.warnings.maxZoneHeight') +
zoneConfig.maxZoneHeight +
' cm'
}}
</QTooltip>
</QInput>
</div>
<div class="shelving">
<div class="shelving-half">
<div class="shelving-up"></div>
<div
class="shelving-down"
:style="{ backgroundColor: tray.color.rgb }"
@click="showColorPicker(tray)"
></div>
</div>
<div
class="shelving-divisible"
:class="{ isVisible: !divisible }"
></div>
<div class="shelving-half">
<div class="shelving-up"></div>
<div
class="shelving-down"
:style="{ backgroundColor: tray.color.rgb }"
@click="showColorPicker(tray)"
></div>
</div>
</div>
<div class="action-button">
<QBtn
flat
round
color="primary"
:icon="tray.action"
@click="doAction(tray)"
/>
</div>
</div>
<div class="q-mb-sm wheels">
<QIcon color="grey-6" name="trip_origin" size="xl" />
<QIcon color="grey-6" name="trip_origin" size="xl" />
</div>
<QDialog
v-model="colorPickerActive"
position="right"
:no-backdrop-dismiss="false"
>
<QCard>
<QCardSection>
<div class="text-h6">{{ t('zone.upcoming.trayColor') }}</div>
</QCardSection>
<QCardSection class="row items-center no-wrap">
<QColor
flat
v-model="zone[currentTrayColorPicked].color.rgb"
no-header
no-footer
default-view="palette"
:palette="
zoneUpcomingColors.map((color) => {
return color.rgb;
})
"
@change="updateColor($event)"
/>
<QBtn flat round icon="close" v-close-popup />
</QCardSection>
</QCard>
</QDialog>
</QCard>
<div class="q-mt-md">
<QBtn :label="t('zone.upcoming.submit')" type="submit" color="primary" />
<QBtn
:label="t('zone.upcoming.reset')"
type="reset"
color="primary"
flat
class="q-ml-sm"
/>
</div>
</QForm>
</QPage>
</template>
<style lang="scss" scoped>
.q-page {
display: flex;
justify-content: center;
align-items: flex-start;
}
.q-form {
width: 70%;
}
.q-dialog {
.q-card {
width: 100%;
}
}
.wheels {
margin-left: 5%;
display: flex;
justify-content: space-around;
}
.zone-tray {
display: flex;
height: 6rem;
.position {
width: 20%;
border-right: 1rem solid gray;
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding-right: 1rem;
}
.shelving {
display: flex;
width: 75%;
.shelving-half {
width: 50%;
height: 100%;
.shelving-up {
height: 80%;
width: 100%;
}
.shelving-down {
height: 20%;
width: 100%;
}
}
.shelving-divisible {
width: 1%;
height: 100%;
border-left: 0.5rem dashed grey;
border-right: 0.5rem dashed grey;
}
}
.action-button {
width: 10%;
border-left: 1rem solid gray;
display: flex;
align-items: flex-end;
justify-content: flex-start;
padding-left: 1rem;
}
.isVisible {
display: none;
}
}
</style>

View File

@ -0,0 +1,80 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import CardList from 'components/ui/CardList.vue';
const quasar = useQuasar();
const arrayData = useArrayData('ZoneUpcomingList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
function navigate(id) {
router.push({ path: `/zone/type/${id}/edit` });
}
function create() {
router.push({ path: `/zone/type/create` });
}
async function remove(row) {
try {
const id = row.id;
await axios
.delete(`ZoneUpcomings/deleteZoneUpcoming`, { params: { id } })
.then(async () => {
quasar.notify({
message: t('zone.upcoming.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
});
} catch (error) {
//
}
}
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="ZoneUpcomingList"
url="/Zones/getUpcomingDeliveries"
order="id DESC"
auto-load
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="(row.name || '').toString()"
:id="row.id"
@click="navigate(row.id)"
>
<template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
outline
/>
<QBtn
:label="t('zone.list.remove')"
@click.stop="remove(row)"
color="primary"
style="margin-top: 15px"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary" />
</QPageSticky>
</QPage>
</template>

View File

@ -0,0 +1,184 @@
<script setup>
import { computed, onMounted, onUpdated, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { QIcon, QInput, QItem, QItemSection, QSelect } from 'quasar';
import VnInput from 'src/components/common/VnInput.vue';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
onMounted(() => fetch());
onUpdated(() => fetch());
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => $props.id || route.params.id);
let zoneTypes = [];
let originalData = {};
const zone = ref({});
const filteredZoneTypes = ref(zoneTypes);
async function onSubmit() {
try {
const params = {
id: entityId.value,
label: zone.value.label,
plate: zone.value.plate,
volume: zone.value.volume,
typeFk: zone.value.typeFk,
};
await axios.patch('Zones', params).then((res) => {
if (res.status == 200) router.push({ path: `/zone/list` });
});
} catch (error) {
//
}
}
async function onReset() {
if (entityId.value) {
zone.value = { ...originalData };
} else {
zone.value = {};
}
}
async function fetch() {
try {
await axios.get('ZoneTypes').then(async (res) => {
if (res.data) {
filteredZoneTypes.value = zoneTypes = res.data;
}
});
if (entityId.value) {
await axios.get(`Zones/${entityId.value}`).then(async (res) => {
const data = res.data;
if (data) {
zone.value.label = data.label;
zone.value.plate = data.plate;
zone.value.volume = data.volume;
zone.value.typeFk = data.typeFk;
originalData = { ...zone.value };
}
});
}
} catch (e) {
//
}
}
function filterType(val, update) {
update(() => {
const needle = val.toLowerCase();
filteredZoneTypes.value = zoneTypes.filter(
(v) => v.name.toLowerCase().indexOf(needle) > -1
);
});
}
</script>
<template>
<QPage class="q-pa-sm q-mx-xl">
<QForm @submit="onSubmit()" @reset="onReset()" class="q-pa-sm">
<QCard class="q-pa-md">
<div class="row q-col-gutter-md">
<div class="col">
<QInput
filled
v-model="zone.label"
:label="t('zone.create.name')"
type="number"
min="0"
:rules="[(val) => !!val || t('zone.warnings.labelNotEmpty')]"
/>
</div>
<div class="col">
<VnInput
filled
v-model="zone.plate"
:label="t('zone.create.agency')"
:rules="[(val) => !!val || t('zone.warnings.plateNotEmpty')]"
/>
</div>
</div>
<div class="row q-col-gutter-md">
<div class="col">
<QInput
filled
v-model="zone.volume"
:label="t('zone.create.close')"
type="number"
min="0"
:rules="[(val) => !!val || t('zone.warnings.volumeNotEmpty')]"
/>
</div>
<div class="col">
<QSelect
filled
v-model="zone.typeFk"
use-input
fill-input
hide-selected
input-debounce="0"
option-label="name"
option-value="id"
emit-value
map-options
:label="t('zone.create.price')"
:options="filteredZoneTypes"
:rules="[(val) => !!val || t('zone.warnings.typeNotEmpty')]"
@filter="filterType"
>
<template v-if="zone.typeFk" #append>
<QIcon
name="cancel"
@click.stop.prevent="zone.typeFk = null"
class="cursor-pointer"
/>
</template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('zone.warnings.noData') }}
</QItemSection>
</QItem>
</template>
</QSelect>
</div>
</div>
</QCard>
<div class="q-mt-md">
<QBtn :label="t('zone.type.submit')" type="submit" color="primary" />
<QBtn
:label="t('zone.type.reset')"
type="reset"
color="primary"
flat
class="q-ml-sm"
/>
</div>
</QForm>
</QPage>
</template>
<style lang="scss" scoped>
.q-page {
display: flex;
justify-content: center;
align-items: flex-start;
}
.q-form {
width: 70%;
}
</style>

View File

@ -0,0 +1 @@
<template>Zone Delivery days</template>

View File

@ -0,0 +1,55 @@
<script setup>
import { ref } from 'vue';
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';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
exprBuilder: {
type: Function,
default: null,
},
});
const agencies = ref([]);
</script>
<template>
<FetchData
url="agencies"
limit="30"
@on-fetch="(data) => (agencies = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
:label="t('Agency')"
v-model="params.agencyModefK"
:options="agencies"
option-value="id"
option-label="name"
@input-value="agencies.fetch()"
dense
outlined
rounded
>
</VnSelectFilter>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>

112
src/pages/Zone/ZoneList.vue Normal file
View File

@ -0,0 +1,112 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import CardList from 'components/ui/CardList.vue';
import VnLv from 'components/ui/VnLv.vue';
import FetchData from 'src/components/FetchData.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toTimeFormat } from 'src/filters/date';
const quasar = useQuasar();
const arrayData = useArrayData('ZoneList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
function navigate(id) {
router.push({ path: `/zone/${id}/edit` });
}
function create() {
router.push({ path: `/zone/create` });
}
async function remove(row) {
try {
await axios.delete(`Zones/${row.id}`).then(async () => {
quasar.notify({
message: t('zone.list.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
});
} catch (error) {
//
}
}
</script>
<template>
<FetchData
url="/Agencies"
@on-fetch="(data) => (agencyOptions = data)"
:filter="{ fields: ['id', 'name'] }"
auto-load
/>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate data-key="ZoneList" url="/Zones" order="id DESC" auto-load>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="(row.label || '').toString()"
:id="row.id"
@click="navigate(row.id)"
>
<template #list-items>
<VnLv
:label="t('zone.list.id')"
:title-label="t('zone.list.id')"
:value="row.id"
/>
<VnLv :label="t('zone.list.name')" :value="row?.name" />
<VnLv
:label="t('zone.list.agency')"
:options="agencyOptions"
option-value="id"
option-label="name"
:value="row?.agencyFk"
/>
<VnLv
:label="t('zone.list.close')"
:value="toTimeFormat(row?.hour)"
/>
<VnLv :label="t('zone.list.price')" :value="row?.price" />
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
outline
/>
<QBtn
:label="t('zone.list.openSummary')"
@click.stop="viewSummary(row.id, ZoneSummary)"
color="primary"
style="margin-top: 15px"
/>
<!--AQUI PONER BOTÓN CLONAR-->
<QBtn
:label="t('zone.list.clone')"
@click.stop="remove(row)"
color="primary"
style="margin-top: 15px"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary">
<QTooltip>{{ t('zone.list.create') }}</QTooltip>
</QBtn>
</QPageSticky>
</QPage>
</template>

View File

@ -0,0 +1,17 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -0,0 +1,53 @@
<script setup>
import { ref, computed } from 'vue';
import ZoneFilterPanel from 'components/InvoiceOutNegativeFilter.vue';
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const arrayData = ref(null);
const rows = computed(() => arrayData.value.store.data);
const columns = computed(() => [
{
label: t('Province'),
//field: '',
//name: '',
align: 'left',
},
{
label: t('Closing'),
//field: '',
//name: '',
align: 'left',
},
{
label: t('Id'),
//field: '',
//name: '',
align: 'left',
},
]);
function getWeekDay(jsonDate) {
const weekDay = new Date(jsonDate).getDay();
return this.days[weekDay].locale;
}
</script>
<template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ZoneFilterPanel data-key="ZoneUpcoming" />
</QScrollArea>
</QDrawer>
<VnSubToolbar />
<QPage class="column items-center q-pa-md">
<span>
{{ t(`${getWeekDay(/*detail.shipped*/)}`) }} -
{{ t /*'detail.shipped'*/() }}
</span>
<QTable :columns="columns" :rows="rows" class="full-width q-mt-md"> </QTable>
</QPage>
</template>

View File

@ -0,0 +1,19 @@
zone:
list:
volume: Volume
clone: Clone
id: Id
name: Name
agency: Agency
close: Close
price: Price
create: Create zone
openSummary: Details
create:
name: Name
agency: Agency
close: Close
price: Price
type:
submit: Save
reset: Reset

View File

@ -0,0 +1,19 @@
zone:
list:
volume: Volumen
clone: Clonar
id: Id
name: Nombre
agency: Agencia
close: Cierre
price: Precio
create: Crear zona
openSummary: Detalles
create:
name: Nombre
agency: Agencia
close: Cierre
price: Precio
type:
submit: Guardar
reset: Reiniciar

View File

@ -17,6 +17,7 @@ import roadmap from './roadmap';
import Parking from './parking';
import Agency from './agency';
import ItemType from './itemType';
import Zone from './zone';
export default [
Item,
@ -38,4 +39,5 @@ export default [
Parking,
Agency,
ItemType,
Zone,
];

View File

@ -26,6 +26,9 @@ export default {
'ItemTax',
'ItemBotanical',
'ItemBarcode',
'ItemShelving',
'ItemLastEntries',
'ItemTags',
],
},
children: [
@ -135,6 +138,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',
@ -144,6 +156,24 @@ export default {
},
component: () => import('src/pages/Item/Card/ItemTax.vue'),
},
{
path: 'botanical',
name: 'ItemBotanical',
meta: {
title: 'botanical',
icon: 'local_florist',
},
component: () => import('src/pages/Item/Card/ItemBotanical.vue'),
},
{
path: 'shelving',
name: 'ItemShelving',
meta: {
title: 'shelving',
icon: 'vn:inventory',
},
component: () => import('src/pages/Item/Card/ItemShelving.vue'),
},
{
path: 'barcode',
name: 'ItemBarcode',

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

@ -17,6 +17,7 @@ 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 = [
{
@ -75,6 +76,7 @@ const routes = [
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

@ -38,6 +38,15 @@ Cypress.Commands.add('login', (user) => {
},
}).then((response) => {
window.localStorage.setItem('token', response.body.token);
cy.request({
method: 'GET',
url: '/api/VnUsers/ShareToken',
headers: {
Authorization: window.localStorage.getItem('token'),
},
}).then(({ body }) => {
window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
});
});
});