Merge branch 'dev' into fix_orderCatalog_reload
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
f4aa30c43e
|
@ -0,0 +1,31 @@
|
|||
<script setup>
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
|
||||
defineProps({ date: { type: [Date, String], required: true } });
|
||||
|
||||
function getBadgeAttrs(date) {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
let timeDiff = today - timeTicket;
|
||||
|
||||
if (timeDiff == 0) return { color: 'warning', 'text-color': 'black' };
|
||||
if (timeDiff < 0) return { color: 'success', 'text-color': 'black' };
|
||||
return { color: 'transparent', 'text-color': 'white' };
|
||||
}
|
||||
|
||||
function formatShippedDate(date) {
|
||||
if (!date) return '-';
|
||||
const dateSplit = date.split('T');
|
||||
const [year, month, day] = dateSplit[0].split('-');
|
||||
const newDate = new Date(year, month - 1, day);
|
||||
return toDateFormat(newDate);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<QBadge v-bind="getBadgeAttrs(date)" class="q-pa-sm" style="font-size: 14px">
|
||||
{{ formatShippedDate(date) }}
|
||||
</QBadge>
|
||||
</template>
|
|
@ -222,8 +222,8 @@ const toModule = computed(() =>
|
|||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.body {
|
||||
<style lang="scss" scoped>
|
||||
:deep(.body) {
|
||||
background-color: var(--vn-section-color);
|
||||
.text-h5 {
|
||||
font-size: 20px;
|
||||
|
@ -262,9 +262,7 @@ const toModule = computed(() =>
|
|||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -129,6 +129,7 @@ globals:
|
|||
small: Small
|
||||
medium: Medium
|
||||
big: Big
|
||||
email: Email
|
||||
pageTitles:
|
||||
logIn: Login
|
||||
addressEdit: Update address
|
||||
|
@ -329,6 +330,7 @@ globals:
|
|||
email: Email
|
||||
SSN: SSN
|
||||
fi: FI
|
||||
packing: ITP
|
||||
myTeam: My team
|
||||
departmentFk: Department
|
||||
countryFk: Country
|
||||
|
|
|
@ -131,6 +131,7 @@ globals:
|
|||
small: Pequeño/a
|
||||
medium: Mediano/a
|
||||
big: Grande
|
||||
email: Correo
|
||||
pageTitles:
|
||||
logIn: Inicio de sesión
|
||||
addressEdit: Modificar consignatario
|
||||
|
@ -335,6 +336,7 @@ globals:
|
|||
SSN: NSS
|
||||
fi: NIF
|
||||
myTeam: Mi equipo
|
||||
packing: ITP
|
||||
countryFk: País
|
||||
changePass: Cambiar contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
|
@ -497,7 +499,7 @@ invoiceOut:
|
|||
ticketList: Listado de tickets
|
||||
summary:
|
||||
issued: Fecha
|
||||
dued: Vencimiento
|
||||
dued: Fecha límite
|
||||
booked: Contabilizada
|
||||
taxBreakdown: Desglose impositivo
|
||||
taxableBase: Base imp.
|
||||
|
|
|
@ -83,7 +83,7 @@ const { openConfirmationModal } = useVnConfirm();
|
|||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('department.chat')" :value="entity.chatName" />
|
||||
<VnLv :label="t('department.email')" :value="entity.notificationEmail" copy />
|
||||
<VnLv :label="t('globals.email')" :value="entity.notificationEmail" copy />
|
||||
<VnLv
|
||||
:label="t('department.selfConsumptionCustomer')"
|
||||
:value="entity.client?.name"
|
||||
|
|
|
@ -58,7 +58,7 @@ onMounted(async () => {
|
|||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('department.email')"
|
||||
:label="t('globals.email')"
|
||||
:value="department.notificationEmail"
|
||||
dash
|
||||
/>
|
||||
|
|
|
@ -16,7 +16,7 @@ import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
|||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
|
@ -29,7 +29,7 @@ const $props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
saleFk: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
},
|
||||
warehouseFk: {
|
||||
|
@ -61,7 +61,7 @@ onMounted(async () => {
|
|||
const data = ref(useCardDescription());
|
||||
const setData = async (entity) => {
|
||||
if (!entity) return;
|
||||
data.value = useCardDescription(entity.name, entity.id);
|
||||
data.value = useCardDescription(entity?.name, entity?.id);
|
||||
await updateStock();
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ const $props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
entityId: {
|
||||
type: String,
|
||||
type: [String, Number],
|
||||
default: null,
|
||||
},
|
||||
showEditButton: {
|
||||
|
|
|
@ -5,14 +5,26 @@ import { useRoute } from 'vue-router';
|
|||
import { dateRange } from 'src/filters';
|
||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import axios from 'axios';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const from = ref();
|
||||
const to = ref();
|
||||
const hideInventory = ref(true);
|
||||
const inventorySupplierFk = ref();
|
||||
|
||||
async function getInventorySupplier() {
|
||||
inventorySupplierFk.value = (
|
||||
await axios.get(`InventoryConfigs`)
|
||||
)?.data[0]?.supplierFk;
|
||||
}
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
|
@ -33,25 +45,27 @@ const exprBuilder = (param, value) => {
|
|||
}
|
||||
};
|
||||
|
||||
const from = ref();
|
||||
const to = ref();
|
||||
const where = {
|
||||
itemFk: route.params.id,
|
||||
};
|
||||
|
||||
if (hideInventory.value) {
|
||||
where.supplierFk = { neq: inventorySupplierFk };
|
||||
}
|
||||
|
||||
const arrayData = useArrayData('ItemLastEntries', {
|
||||
url: 'Items/lastEntriesFilter',
|
||||
order: ['landed DESC', 'buyFk DESC'],
|
||||
exprBuilder: exprBuilder,
|
||||
userFilter: {
|
||||
where: {
|
||||
itemFk: route.params.id,
|
||||
},
|
||||
where: where,
|
||||
},
|
||||
});
|
||||
|
||||
const itemLastEntries = ref([]);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('lastEntries.ig'),
|
||||
label: 'Nv',
|
||||
name: 'ig',
|
||||
align: 'center',
|
||||
},
|
||||
|
@ -59,33 +73,38 @@ const columns = computed(() => [
|
|||
label: t('itemDiary.warehouse'),
|
||||
name: 'warehouse',
|
||||
field: 'warehouse',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.landed'),
|
||||
name: 'id',
|
||||
name: 'date',
|
||||
field: 'landed',
|
||||
align: 'left',
|
||||
format: (val) => toDateTimeFormat(val),
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.entry'),
|
||||
name: 'entry',
|
||||
field: 'stateName',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.pvp'),
|
||||
name: 'pvp',
|
||||
field: 'reference',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
|
||||
},
|
||||
|
||||
{
|
||||
label: t('lastEntries.printedStickers'),
|
||||
name: 'printedStickers',
|
||||
field: 'printedStickers',
|
||||
align: 'center',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.label'),
|
||||
name: 'label',
|
||||
name: 'stickers',
|
||||
field: 'stickers',
|
||||
align: 'center',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
|
@ -93,11 +112,13 @@ const columns = computed(() => [
|
|||
{
|
||||
label: t('shelvings.packing'),
|
||||
name: 'packing',
|
||||
field: 'packing',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.grouping'),
|
||||
name: 'grouping',
|
||||
field: 'grouping',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
|
@ -108,18 +129,19 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('lastEntries.quantity'),
|
||||
name: 'stems',
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.cost'),
|
||||
name: 'cost',
|
||||
align: 'left',
|
||||
field: 'cost',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: t('lastEntries.kg'),
|
||||
name: 'stems',
|
||||
label: 'Kg',
|
||||
name: 'weight',
|
||||
field: 'weight',
|
||||
align: 'center',
|
||||
},
|
||||
|
@ -131,9 +153,9 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('lastEntries.supplier'),
|
||||
name: 'stems',
|
||||
name: 'supplier',
|
||||
field: 'supplier',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -157,11 +179,18 @@ const updateFilter = async () => {
|
|||
else if (from.value && !to.value) filter = { gte: from.value };
|
||||
else if (from.value && to.value) filter = { between: [from.value, to.value] };
|
||||
|
||||
arrayData.store.userFilter.where.landed = filter;
|
||||
const userFilter = arrayData.store.userFilter.where;
|
||||
|
||||
userFilter.landed = filter;
|
||||
if (hideInventory.value) userFilter.supplierFk = { neq: inventorySupplierFk };
|
||||
else delete userFilter.supplierFk;
|
||||
|
||||
await fetchItemLastEntries();
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await getInventorySupplier();
|
||||
|
||||
const _from = Date.vnNew();
|
||||
_from.setDate(_from.getDate() - 75);
|
||||
from.value = getDate(_from, 'from');
|
||||
|
@ -171,14 +200,13 @@ onMounted(async () => {
|
|||
|
||||
updateFilter();
|
||||
|
||||
watch([from, to], ([nFrom, nTo], [oFrom, oTo]) => {
|
||||
watch([from, to, hideInventory], ([nFrom, nTo], [oFrom, oTo]) => {
|
||||
if (nFrom && nFrom != oFrom) nFrom = getDate(new Date(nFrom), 'from');
|
||||
if (nTo && nTo != oTo) nTo = getDate(new Date(nTo), 'to');
|
||||
updateFilter();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
|
@ -187,27 +215,45 @@ onMounted(async () => {
|
|||
dense
|
||||
v-model="from"
|
||||
class="q-mr-lg"
|
||||
data-cy="from"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('lastEntries.to')"
|
||||
v-model="to"
|
||||
dense
|
||||
class="q-mr-lg"
|
||||
data-cy="to"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('Hide inventory supplier')"
|
||||
v-model="hideInventory"
|
||||
dense
|
||||
class="q-mr-lg"
|
||||
data-cy="hideInventory"
|
||||
/>
|
||||
<VnInputDate :label="t('lastEntries.to')" dense v-model="to" />
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QPage class="column items-center q-pa-xd">
|
||||
<QTable
|
||||
:rows="itemLastEntries"
|
||||
:columns="columns"
|
||||
class="full-width q-mt-md"
|
||||
class="table 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 class="text-center">
|
||||
<QIcon
|
||||
:name="row.isIgnored ? 'check_box' : 'check_box_outline_blank'"
|
||||
style="color: var(--vn-label-color)"
|
||||
size="sm"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-date="{ row }">
|
||||
<QTd class="text-center">
|
||||
<VnDateBadge :date="row.landed" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-entry="{ row }">
|
||||
<QTd @click.stop>
|
||||
<div class="full-width flex justify-center">
|
||||
|
@ -229,8 +275,8 @@ onMounted(async () => {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-pvp="{ value }">
|
||||
<QTd @click.stop
|
||||
><span> {{ value }}</span>
|
||||
<QTd @click.stop class="text-center">
|
||||
<span> {{ value }}</span>
|
||||
<QTooltip>
|
||||
{{ t('lastEntries.grouping') }}/{{ t('lastEntries.packing') }}
|
||||
</QTooltip></QTd
|
||||
|
@ -249,7 +295,7 @@ onMounted(async () => {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-cost="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QTd @click.stop class="text-center">
|
||||
<span>
|
||||
{{ toCurrency(row.cost, 'EUR', 3) }}
|
||||
<QTooltip>
|
||||
|
@ -267,10 +313,25 @@ onMounted(async () => {
|
|||
</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-supplier="{ row }">
|
||||
<QTd @click.stop>
|
||||
<div class="full-width flex justify-center">
|
||||
<SupplierDescriptorProxy
|
||||
:id="row.supplierFk"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
/>
|
||||
<span class="link">{{ row.supplier }}</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Hide inventory supplier: Ocultar proveedor inventario
|
||||
</i18n>
|
||||
<style lang="scss" scoped>
|
||||
.q-badge--rounded {
|
||||
border-radius: 50%;
|
||||
|
@ -282,4 +343,10 @@ onMounted(async () => {
|
|||
padding: 0 11px;
|
||||
height: 28px;
|
||||
}
|
||||
.th :first-child {
|
||||
.td {
|
||||
text-align: center;
|
||||
background-color: red;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -46,7 +46,7 @@ const getUrl = (id, param) => `#/Item/${id}/${param}`;
|
|||
<template #body="{ entity: { item, tags, visible, available, botanical } }">
|
||||
<QCard class="vn-one photo">
|
||||
<ItemDescriptorImage
|
||||
:entity-id="entityId"
|
||||
:entity-id="Number(entityId)"
|
||||
:visible="visible"
|
||||
:available="available"
|
||||
:show-edit-button="false"
|
||||
|
|
|
@ -66,6 +66,7 @@ lastEntries:
|
|||
package: Package
|
||||
freight: Freight
|
||||
comission: Comission
|
||||
printedStickers: Pri.
|
||||
itemTags:
|
||||
removeTag: Remove tag
|
||||
addTag: Add tag
|
||||
|
|
|
@ -56,7 +56,7 @@ lastEntries:
|
|||
landed: F. Entrega
|
||||
entry: Entrada
|
||||
pvp: PVP
|
||||
label: Etiquetas
|
||||
label: Eti.
|
||||
grouping: Grouping
|
||||
quantity: Cantidad
|
||||
cost: Coste
|
||||
|
@ -66,6 +66,7 @@ lastEntries:
|
|||
package: Embalaje
|
||||
freight: Porte
|
||||
comission: Comisión
|
||||
printedStickers: Imp.
|
||||
itemTags:
|
||||
removeTag: Quitar etiqueta
|
||||
addTag: Añadir etiqueta
|
||||
|
|
|
@ -134,6 +134,7 @@ const getLocale = (label) => {
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
|
@ -209,6 +210,34 @@ const getLocale = (label) => {
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('globals.params.departmentFk')"
|
||||
v-model="params.department"
|
||||
option-label="name"
|
||||
option-value="name"
|
||||
url="Departments"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('globals.params.packing')"
|
||||
v-model="params.packing"
|
||||
url="ItemPackingTypes"
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
|
@ -258,7 +287,7 @@ en:
|
|||
ON_PREVIOUS: On previous
|
||||
PACKED: Packed
|
||||
No one: No one
|
||||
|
||||
|
||||
es:
|
||||
params:
|
||||
orderFk: Id cesta
|
||||
|
|
|
@ -10,20 +10,23 @@ import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
|||
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { toCurrency, dateRange, dashIfEmpty } from 'src/filters';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
||||
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||
|
||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000;
|
||||
const { t } = useI18n();
|
||||
const autoRefresh = ref(false);
|
||||
const tableRef = ref(null);
|
||||
const provinceOpts = ref([]);
|
||||
const stateOpts = ref([]);
|
||||
const zoneOpts = ref([]);
|
||||
const DepartmentOpts = ref([]);
|
||||
const ItemPackingTypeOpts = ref([]);
|
||||
const visibleColumns = ref([]);
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
||||
const [from, to] = dateRange(Date.vnNew());
|
||||
|
@ -51,6 +54,8 @@ function exprBuilder(param, value) {
|
|||
case 'nickname':
|
||||
return { [`t.nickname`]: { like: `%${value}%` } };
|
||||
case 'zoneFk':
|
||||
case 'department':
|
||||
return { 'd.name': value };
|
||||
case 'totalWithVat':
|
||||
return { [`t.${param}`]: value };
|
||||
}
|
||||
|
@ -137,6 +142,7 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
format: (row) => row.practicalHour,
|
||||
columnFilter: false,
|
||||
dense: true,
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.preparation'),
|
||||
|
@ -190,6 +196,7 @@ const columns = computed(() => [
|
|||
'false-value': 0,
|
||||
'true-value': 1,
|
||||
},
|
||||
component: false,
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.zone'),
|
||||
|
@ -206,6 +213,12 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.payMethod'),
|
||||
name: 'payMethod',
|
||||
align: 'left',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.total'),
|
||||
name: 'totalWithVat',
|
||||
|
@ -219,6 +232,36 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.department'),
|
||||
name: 'department',
|
||||
align: 'left',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
url: 'Departments',
|
||||
attrs: {
|
||||
options: DepartmentOpts.value,
|
||||
optionValue: 'name',
|
||||
optionLabel: 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.packing'),
|
||||
name: 'packing',
|
||||
align: 'left',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
url: 'ItemPackingTypes',
|
||||
attrs: {
|
||||
options: ItemPackingTypeOpts.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
|
@ -250,19 +293,6 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
const getBadgeAttrs = (date) => {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
let timeDiff = today - timeTicket;
|
||||
|
||||
if (timeDiff == 0) return { color: 'warning', 'text-color': 'black' };
|
||||
if (timeDiff < 0) return { color: 'success', 'text-color': 'black' };
|
||||
return { color: 'transparent', 'text-color': 'white' };
|
||||
};
|
||||
|
||||
let refreshTimer = null;
|
||||
|
||||
const autoRefreshHandler = (value) => {
|
||||
|
@ -279,14 +309,6 @@ const totalPriceColor = (ticket) => {
|
|||
if (total > 0 && total < 50) return 'warning';
|
||||
};
|
||||
|
||||
const formatShippedDate = (date) => {
|
||||
if (!date) return '-';
|
||||
const dateSplit = date.split('T');
|
||||
const [year, month, day] = dateSplit[0].split('-');
|
||||
const newDate = new Date(year, month - 1, day);
|
||||
return toDateFormat(newDate);
|
||||
};
|
||||
|
||||
const openTab = (id) =>
|
||||
window.open(`#/ticket/${id}/sale`, '_blank', 'noopener, noreferrer');
|
||||
</script>
|
||||
|
@ -318,6 +340,24 @@ const openTab = (id) =>
|
|||
auto-load
|
||||
@on-fetch="(data) => (zoneOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="ItemPackingTypes"
|
||||
:filter="{
|
||||
fields: ['code'],
|
||||
order: 'code ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (ItemPackingTypeOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Departments"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'id ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (DepartmentOpts = data)"
|
||||
/>
|
||||
<MonitorTicketSearchbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
@ -337,7 +377,7 @@ const openTab = (id) =>
|
|||
auto-load
|
||||
:row-click="({ id }) => openTab(id)"
|
||||
:disable-option="{ card: true }"
|
||||
:user-params="{ from, to, scopeDays: 0 }"
|
||||
:user-params="{ from, to, scopeDays: 0, packing }"
|
||||
>
|
||||
<template #top-left>
|
||||
<QBtn
|
||||
|
@ -382,13 +422,7 @@ const openTab = (id) =>
|
|||
</div>
|
||||
</template>
|
||||
<template #column-shippedDate="{ row }">
|
||||
<QBadge
|
||||
v-bind="getBadgeAttrs(row.shippedDate)"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ formatShippedDate(row.shippedDate) }}
|
||||
</QBadge>
|
||||
<VnDateBadge :date="row.shippedDate" />
|
||||
</template>
|
||||
<template #column-provinceFk="{ row }">
|
||||
<span :title="row.province" v-text="row.province" />
|
||||
|
|
|
@ -26,8 +26,8 @@ salesTicketsTable:
|
|||
componentLack: Component lack
|
||||
tooLittle: Ticket too little
|
||||
identifier: Identifier
|
||||
theoretical: Theoretical
|
||||
practical: Practical
|
||||
theoretical: H.Theor
|
||||
practical: H.Prac
|
||||
province: Province
|
||||
state: State
|
||||
isFragile: Is fragile
|
||||
|
@ -35,7 +35,10 @@ salesTicketsTable:
|
|||
goToLines: Go to lines
|
||||
preview: Preview
|
||||
total: Total
|
||||
preparation: Preparation
|
||||
preparation: H.Prep
|
||||
payMethod: Pay method
|
||||
department: Department
|
||||
packing: ITP
|
||||
searchBar:
|
||||
label: Search tickets
|
||||
info: Search tickets by id or alias
|
||||
|
|
|
@ -26,8 +26,8 @@ salesTicketsTable:
|
|||
componentLack: Faltan componentes
|
||||
tooLittle: Ticket demasiado pequeño
|
||||
identifier: Identificador
|
||||
theoretical: Teórica
|
||||
practical: Práctica
|
||||
theoretical: H.Teór
|
||||
practical: H.Prác
|
||||
province: Provincia
|
||||
state: Estado
|
||||
isFragile: Es frágil
|
||||
|
@ -35,7 +35,10 @@ salesTicketsTable:
|
|||
goToLines: Ir a líneas
|
||||
preview: Vista previa
|
||||
total: Total
|
||||
preparation: Preparación
|
||||
preparation: H.Prep
|
||||
payMethod: Método de pago
|
||||
department: Departamento
|
||||
packing: ITP
|
||||
searchBar:
|
||||
label: Buscar tickets
|
||||
info: Buscar tickets por identificador o alias
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
import { computed, onMounted, ref, toRefs, watch } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
@ -24,6 +24,15 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
restoreTicket();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.ticket,
|
||||
() => restoreTicket
|
||||
);
|
||||
|
||||
const { push, currentRoute } = useRouter();
|
||||
const { dialog, notify } = useQuasar();
|
||||
const { t } = useI18n();
|
||||
|
@ -42,6 +51,7 @@ const hasPdf = ref();
|
|||
const weight = ref();
|
||||
const hasDocuwareFile = ref();
|
||||
const quasar = useQuasar();
|
||||
const canRestoreTicket = ref(false);
|
||||
const actions = {
|
||||
clone: async () => {
|
||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||
|
@ -373,6 +383,54 @@ async function uploadDocuware(force) {
|
|||
|
||||
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
||||
}
|
||||
|
||||
const restoreTicket = async () => {
|
||||
const filter = {
|
||||
fields: ['id', 'originFk', 'creationDate', 'newInstance'],
|
||||
where: {
|
||||
originFk: ticketId.value,
|
||||
newInstance: { like: '%"isDeleted":true%' },
|
||||
},
|
||||
order: 'creationDate DESC',
|
||||
limit: 1,
|
||||
};
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
|
||||
const { data } = await axios.get(`TicketLogs`, { params });
|
||||
|
||||
if (data && data.length) {
|
||||
const now = Date.vnNew();
|
||||
const maxDate = new Date(data[0].creationDate);
|
||||
maxDate.setHours(maxDate.getHours() + 1);
|
||||
if (now <= maxDate) {
|
||||
return (canRestoreTicket.value = true);
|
||||
}
|
||||
return (canRestoreTicket.value = false);
|
||||
}
|
||||
return (canRestoreTicket.value = false);
|
||||
};
|
||||
|
||||
async function openRestoreConfirmation(force) {
|
||||
if (!force)
|
||||
return quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Are you sure you want to restore the ticket?'),
|
||||
message: t('You are going to restore this ticket'),
|
||||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
ticketToRestore();
|
||||
});
|
||||
}
|
||||
|
||||
async function ticketToRestore() {
|
||||
const { data } = await axios.post(`Tickets/${ticketId.value}/restore`);
|
||||
if (data) {
|
||||
notify({ message: t('Ticket restored'), type: 'positive' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -560,6 +618,12 @@ async function uploadDocuware(force) {
|
|||
</QItemSection>
|
||||
<QItemSection>{{ t('Show Proforma') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-if="canRestoreTicket" @click="openRestoreConfirmation()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="restore" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Restore ticket') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isEditable"
|
||||
@click="showChangeTimeDialog = !showChangeTimeDialog"
|
||||
|
@ -746,4 +810,8 @@ es:
|
|||
You are going to delete this ticket: Vas a eliminar este ticket
|
||||
as PDF signed: como PDF firmado
|
||||
Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán?
|
||||
Restore ticket: Restaurar ticket
|
||||
Are you sure you want to restore the ticket?: ¿Seguro que quieres restaurar el ticket?
|
||||
You are going to restore this ticket: Vas a restaurar este ticket
|
||||
Ticket restored: Ticket restaurado
|
||||
</i18n>
|
||||
|
|
|
@ -10,6 +10,7 @@ import { useState } from 'src/composables/useState';
|
|||
import axios from 'axios';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
import EditPictureForm from 'components/EditPictureForm.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -143,10 +144,14 @@ const handlePhotoUpdated = (evt = false) => {
|
|||
:value="entity.user?.emailUser?.email"
|
||||
copy
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.list.department')"
|
||||
:value="entity.department ? entity.department.department.name : null"
|
||||
/>
|
||||
<VnLv :label="t('worker.list.department')">
|
||||
<template #value>
|
||||
<span class="link" v-text="entity.department?.department?.name" />
|
||||
<DepartmentDescriptorProxy
|
||||
:id="entity.department?.department?.id"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="entity.phone">
|
||||
<template #label>
|
||||
{{ t('globals.phone') }}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
describe('ItemLastEntries', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('buyer');
|
||||
cy.visit('/#/item/1/last-entries');
|
||||
cy.intercept('GET', /.*lastEntriesFilter/).as('item');
|
||||
cy.waitForElement('tbody');
|
||||
});
|
||||
|
||||
it('should filter by agency', () => {
|
||||
cy.get('tbody > tr')
|
||||
.its('length')
|
||||
.then((rowCount) => {
|
||||
cy.get('[data-cy="hideInventory"]').click();
|
||||
cy.wait('@item');
|
||||
cy.waitForElement('tbody');
|
||||
cy.get('tbody > tr').should('have.length.greaterThan', rowCount);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,6 @@
|
|||
describe('ZoneBasicData', () => {
|
||||
const notification = '.q-notification__message';
|
||||
const priceBasicData = '[data-cy="Price_input"]';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
|
@ -13,9 +14,15 @@ describe('ZoneBasicData', () => {
|
|||
cy.get(notification).should('contains.text', "can't be blank");
|
||||
});
|
||||
|
||||
it('should throw an error if the price is empty', () => {
|
||||
cy.get(priceBasicData).clear();
|
||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||
cy.get(notification).should('contains.text', 'cannot be blank');
|
||||
});
|
||||
|
||||
it("should edit the basicData's zone", () => {
|
||||
cy.get('.q-card > :nth-child(1)').type(' modified');
|
||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||
cy.get(notification).should('contains.text', 'Data saved');
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnDiscount from 'components/common/vnDiscount.vue';
|
||||
|
||||
describe('VnDiscount', () => {
|
||||
let vm;
|
||||
|
||||
beforeAll(() => {
|
||||
vm = createWrapper(VnDiscount, {
|
||||
props: {
|
||||
data: {},
|
||||
price: 100,
|
||||
quantity: 2,
|
||||
discount: 10,
|
||||
}
|
||||
}).vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('total', () => {
|
||||
it('should calculate total correctly', () => {
|
||||
expect(vm.total).toBe(180);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue