0
0
Fork 0

Merge branch 'dev' into 6943-fixCustomer

This commit is contained in:
Alex Moreno 2024-07-18 06:26:19 +00:00
commit 71d6e57ea5
18 changed files with 588 additions and 492 deletions

View File

@ -1,3 +1,169 @@
# Version 24.28 - 2024-07-09
### Added 🆕
- Change header titles style by:wbuezas
- chore: refs #7436 fix e2e (origin/7436-showQCheckbox) by:jorgep
- feat: #7196 eslint (origin/7196-cjsToEsm) by:jgallego
- feat: adapt tu VnTable → CrudModel by:alexm
- feat(CustomerFIlter): use correct table by:alexm
- feat(customerList): add searchbar by:alexm
- feat: customerList is customerExtendedList by:alexm
- feat: fixes #7196 by:jgallego
- feat: refs #6739 transferInvoice new checkbox and functionality by:Jon
- feat: refs #6825 create vnTable and add in CustomerExtendedList by:alexm
- feat: refs #6825 create vnTableColumn, cardActions by:alexm
- feat: refs #6825 fix modes by:alexm
- feat: refs #6825 qchip color by:alexm
- feat: refs #6825 right filter panel (6825-vnTable) by:alexm
- feat: refs #6825 scroll for table mode by:alexm
- feat: refs #6825 share filters, create popup by:alexm
- feat: refs #6825 VnComponent mix component and attrs Form to create new row by:alexm
- feat: refs #6825 VnTableFilter and VnPanelFilter init by:alexm
- feat: refs #6826 added rol summary link by:Jon
- feat: refs #6896 created VnImg and added to order module by:Jon
- feat: refs #6896 new filters by:Jon
- feat: refs #7129 fix some code and add order by:pablone
- feat: refs #7436 show checkbox by:jorgep
- feat: refs #7545 Deleted hasIncoterms client column (origin/7545-hasIncoterms) by:guillermo
- feat(TicketService): use correct format by:alexm
- feat(url): sepate filters by:alexm
- feat(VnFilter): merge objects by:alexm
- feat(VnTable): is-editable and use-model. fix: checkbox by:alexm
- feat(VnTable): refs #6825 actions sticky by:alexm
- feat(VnTable): refs #6825 addInWhere by:alexm
- feat(VnTable): refs #6825 dinamic columns by:alexm
- feat(VnTable): refs #6825 execute function when create by:alexm
- feat(VnTable): refs #6825 fix ellipsis and add titles by:alexm
- feat(VnTable): refs #6825 merge where's by:alexm
- feat(VnTable): refs #6825 move to folder. fix checkboxs by:alexm
- feat(VnTable): refs #6825 remove field prop. Add actions in table by:alexm
- feat(VnTable): refs #6825 use checkbox if startsWith 'is' or 'has' by:alexm
- feat(VnTable): refs #6825 VnTableChip component by:alexm
- feat(vnTable): reload data when change url by:alexm
- feat(WorkerFormation): add columnFilter by:alexm
- feat(WorkerFormation): is-editable and use-model by:alexm
- fix: notify icon style by:Javier Segarra
- refactor: refs #6896 fixed styles by:Jon
- Revert "feat: fixes #7196" by:alexm
- style: refs #6464 changed checkbox and qbtn styles by:Jon
### Changed 📦
- perf: Remove div.col by:Javier Segarra
- perf: remove ItemPicture by:Javier Segarra
- perf: replace ItemPicture in favour of VnImg by:Javier Segarra
- refactor by:wbuezas
- refactor: refs #5447 changed warehouse filter by:Jon
- refactor: refs #5447 changed warehouse out filter behavior by:Jon
- refactor: refs #5447 fixed filter if continent not selected by:Jon
- refactor: refs #5447 fix request by:Jon
- refactor: refs #5447 refactor filters by:Jon
- refactor: refs #6739 changed invoice functions' name by:Jon
- refactor: refs #6739 changed router.push by:Jon
- refactor: refs #6739 deleted useless const by:Jon
- refactor: refs #6739 fix redirect transferInvoice by:Jon
- refactor: refs #6739 new confirmation window by:Jon
- refactor: refs #6739 requested changes by:Jon
- refactor: refs #6739 updated transferInvoice function by:Jon
- refactor: refs #6896 changes requested in PR by:Jon
- refactor: refs #6896 end migration orders by:Jon
- refactor: refs #6896 fixed styles by:Jon
- refactor: refs #6896 fix qdrawer by:Jon
- refactor: refs #6896 refactor VnImg by:Jon
- refactor: refs #6896 requested changes by:Jon
- refactor: refs #6977 fix VnImg props (origin/6977-ClonedURL) by:Jon
- refactor: refs #6977 refactor VnImg by:Jon
- refactor: refs #6977 use VnImg by:Jon
- refactors by:alexm
### Fixed 🛠️
- chore: refs #7436 fix e2e (origin/7436-showQCheckbox) by:jorgep
- feat: fixes #7196 by:jgallego
- feat: refs #6825 fix modes by:alexm
- feat: refs #7129 fix some code and add order by:pablone
- feat(VnTable): is-editable and use-model. fix: checkbox by:alexm
- feat(VnTable): refs #6825 fix ellipsis and add titles by:alexm
- feat(VnTable): refs #6825 move to folder. fix checkboxs by:alexm
- fix(ArrayData): refs #6825 router.replace and use filter.where by:alexm
- fix: bug replace by:alexm
- fix: column hidden v-if by:Javier Segarra
- fix: comment 4 by:Javier Segarra
- fix: comments by:Javier Segarra
- fix: cypress.config to mjs by:alexm
- fix(EntryBuys): fix VnSubtoolbar by:alexm
- fixes: fix vnFilter params and redirect by:alexm
- fix: fix warnings by:alexm
- fix: invoiceDueDay test by:alexm
- fix log view not refreshing when changing id param by:wbuezas
- fix: map selected by:Javier Segarra
- fix: merge dev by:Javier Segarra
- fix: notify icon style by:Javier Segarra
- fix: point 1 by:Javier Segarra
- fix: point 3 by:Javier Segarra
- fix: refs #5447 deleted console.log by:Jon
- fix: refs 6464 deleted useless class in checkbox by:Jon
- fix: refs #6464 fix error isLoading by:Jon
- fix: refs #6739 changed checkbox field by:Jon
- fix: refs #6825 css by:carlossa
- fix: refs #6826 fix redirect by:Jon
- fix: refs #6826 fix roleDescriptor by:Jon
- fix: refs #7129 fix e2e by:pablone
- fix: refs #7129 fix module routes by:pablone
- fix: refs #7129 fix some issues on load and tools by:pablone
- fix: refs #7129 remove consoleLog by:pablone
- fix: refs #7129 remove fix from claim lines by:pablone
- fix: refs #7274 fix duplicate rows by:jorgep
- fix: refs #7433 skeleton by:jorgep
- fix: refs #7623 bugs & tests by:jorgep
- fix: refs #7623 disable router update by:jorgep
- fix: refs #7623 redirect by:jorgep
- fix: refs #7623 test by:jorgep
- fix: refs #7623 update add updateRoute prop in VnPaginate by:jorgep
- fix: refs #7623 updating skip param by:jorgep
- fix: revert cypress mjs by:alexm
- fix: SkeletonTable by:alexm
- fix: state translations by:Javier Segarra
- fix: ticket order by:Javier Segarra
- fix(ticket router): typo by:alexm
- fix(TicketService): pay use selected by:alexm
- fix: TravelLog by:Javier Segarra
- fix(url): filter by:alexm
- fix(url): redirect by:alexm
- fix(VnFilter): filter with params by:alexm
- fix(VnFilterPanel): remove key by:alexm
- fix(VnTable): create scss by:alexm
- fix(VnTable): duplicate fetch by:alexm
- fix(VnTable): Qtable v-bind by:alexm
- fix(VnTable): refs #6825 checkbox align and color by:alexm
- fix(VnTable): refs #6825 fix click sticky column by:alexm
- fix(VnTable): refs #6825 fix events and css by:alexm
- fix(VnTable): refs #6825 VnInputDate by:alexm
- fix(VnTable): showLabel by:alexm
- fix(VnTable): warns by:alexm
- fix: WorkerNotificationsManager test by:alexm
- fix: WorkerSelect option format by:Javier Segarra
- refactor: refs #5447 fixed filter if continent not selected by:Jon
- refactor: refs #5447 fix request by:Jon
- refactor: refs #6739 fix redirect transferInvoice by:Jon
- refactor: refs #6896 fixed styles by:Jon
- refactor: refs #6896 fix qdrawer by:Jon
- refactor: refs #6977 fix VnImg props (origin/6977-ClonedURL) by:Jon
- refs #6504 fix formModel claimFilter claimCard (origin/6504-fixCardClaim) by:carlossa
- refs #7406 fix components by:carlossa
- refs #7406 fix pr by:carlossa
- refs #7406 fix props by:carlossa
- refs #7406 fix Tb components create by:carlossa
- refs #7406 fix trad by:carlossa
- refs #7406 fix url by:carlossa
- refs #7406 fix VnTable columns by:carlossa
- refs #7409 fix balance and formation by:carlossa
- refs #7409 fix trad by:carlossa
- Revert "feat: fixes #7196" by:alexm
- test: fix intermitent e2e by:alexm
- test: fix vnSearchbar adapt to vnTable (origin/7648_dev_customerEntries) by:alexm
# Version 24.24 - 2024-06-11 # Version 24.24 - 2024-06-11
### Added 🆕 ### Added 🆕

View File

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

View File

@ -78,7 +78,7 @@ const defaultComponents = {
date: { date: {
component: markRaw(VnInputDate), component: markRaw(VnInputDate),
attrs: { attrs: {
readonly: true, readonly: !$props.isEditable,
disable: !$props.isEditable, disable: !$props.isEditable,
style: 'min-width: 125px', style: 'min-width: 125px',
class: 'fit', class: 'fit',

View File

@ -412,7 +412,7 @@ defineExpose({
<VnTableColumn <VnTableColumn
:column="col" :column="col"
:row="row" :row="row"
:is-editable="false" :is-editable="col.isEditable ?? isEditable"
v-model="row[col.name]" v-model="row[col.name]"
component-prop="columnField" component-prop="columnField"
/> />

View File

@ -44,15 +44,18 @@ const formattedDate = computed({
let newDate; let newDate;
if (value) { if (value) {
// parse input // parse input
if (value.includes('/') && value.length >= 10) { if (value.includes('/')) {
if (value.length == 6) value = value + new Date().getFullYear();
if (value.length >= 10) {
if (value.at(2) == '/') value = value.split('/').reverse().join('/'); if (value.at(2) == '/') value = value.split('/').reverse().join('/');
value = date.formatDate( value = date.formatDate(
new Date(value).toISOString(), new Date(value).toISOString(),
'YYYY-MM-DDTHH:mm:ss.SSSZ' 'YYYY-MM-DDTHH:mm:ss.SSSZ'
); );
} }
let ymd = value.split('-').map((e) => parseInt(e)); }
newDate = new Date(ymd[0], ymd[1] - 1, ymd[2]); const [year, month, day] = value.split('-').map((e) => parseInt(e));
newDate = new Date(year, month - 1, day);
if (model.value) { if (model.value) {
const orgDate = const orgDate =
model.value instanceof Date ? model.value : new Date(model.value); model.value instanceof Date ? model.value : new Date(model.value);
@ -107,7 +110,12 @@ watch(
isPopupOpen = false; isPopupOpen = false;
" "
/> />
<QIcon name="event" class="cursor-pointer" /> <QIcon
name="event"
class="cursor-pointer"
@click="isPopupOpen = !isPopupOpen"
:title="t('Open date')"
/>
</template> </template>
<QMenu <QMenu
transition-show="scale" transition-show="scale"
@ -116,6 +124,7 @@ watch(
anchor="bottom left" anchor="bottom left"
self="top start" self="top start"
:no-focus="true" :no-focus="true"
:no-parent-event="true"
> >
<QDate <QDate
v-model="popupDate" v-model="popupDate"
@ -132,7 +141,6 @@ watch(
</QInput> </QInput>
</div> </div>
</template> </template>
<style lang="scss"> <style lang="scss">
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before { .vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
border-bottom-style: solid; border-bottom-style: solid;
@ -142,3 +150,7 @@ watch(
border-style: solid; border-style: solid;
} }
</style> </style>
<i18n>
es:
Open date: Abrir fecha
</i18n>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { watch, computed, ref } from 'vue'; import { watch, computed, ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { date } from 'quasar'; import { date } from 'quasar';
@ -20,6 +20,7 @@ const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const dateFormat = 'HH:mm'; const dateFormat = 'HH:mm';
const isPopupOpen = ref(); const isPopupOpen = ref();
const hover = ref(); const hover = ref();
const inputRef = ref();
const styleAttrs = computed(() => { const styleAttrs = computed(() => {
return props.isOutlined return props.isOutlined
@ -41,11 +42,17 @@ const formattedTime = computed({
let time = value; let time = value;
if (time) { if (time) {
if (time?.length > 5) time = dateToTime(time); if (time?.length > 5) time = dateToTime(time);
else {
if (time.length == 1 && parseInt(time) > 2) time = time.padStart(2, '0');
time = time.padEnd(5, '0');
if (!time.includes(':'))
time = time.substring(0, 2) + ':' + time.substring(3, 5);
}
if (!props.timeOnly) { if (!props.timeOnly) {
const hours = time.split(':'); const [hh, mm] = time.split(':');
const date = new Date(model.value); const date = new Date(model.value ? model.value : null);
date.setHours(hours[0], hours[1], 0); date.setHours(hh, mm, 0);
time = date.toISOString(); time = date?.toISOString();
} }
} }
model.value = time; model.value = time;
@ -61,11 +68,31 @@ watch(
(val) => (formattedTime.value = val), (val) => (formattedTime.value = val),
{ immediate: true } { immediate: true }
); );
watch(
() => formattedTime.value,
async (val) => {
let position = 3;
const input = inputRef.value?.getNativeElement();
if (!val || !input) return;
let [hh, mm] = val.split(':');
hh = parseInt(hh);
if (hh >= 10 || mm != '00') return;
await nextTick();
await nextTick();
if (!hh) position = 0;
input.setSelectionRange(position, position);
},
{ immediate: true }
);
</script> </script>
<template> <template>
<div @mouseover="hover = true" @mouseleave="hover = false"> <div @mouseover="hover = true" @mouseleave="hover = false">
<QInput <QInput
ref="inputRef"
class="vn-input-time" class="vn-input-time"
mask="##:##" mask="##:##"
placeholder="--:--" placeholder="--:--"
@ -74,6 +101,8 @@ watch(
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
style="min-width: 100px" style="min-width: 100px"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="$attrs.required ? [requiredFieldRule] : null"
@click="isPopupOpen = false"
@focus="inputRef.getNativeElement().setSelectionRange(0, 0)"
> >
<template #append> <template #append>
<QIcon <QIcon
@ -90,7 +119,12 @@ watch(
isPopupOpen = false; isPopupOpen = false;
" "
/> />
<QIcon name="Schedule" class="cursor-pointer" /> <QIcon
name="Schedule"
class="cursor-pointer"
@click="isPopupOpen = !isPopupOpen"
:title="t('Open time')"
/>
</template> </template>
<QMenu <QMenu
transition-show="scale" transition-show="scale"
@ -99,6 +133,7 @@ watch(
anchor="bottom left" anchor="bottom left"
self="top start" self="top start"
:no-focus="true" :no-focus="true"
:no-parent-event="true"
> >
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn /> <QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
</QMenu> </QMenu>
@ -114,3 +149,8 @@ watch(
border-style: solid; border-style: solid;
} }
</style> </style>
<i18n>
es:
Open time: Abrir tiempo
</i18n>
, nextTick

View File

@ -18,7 +18,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
onMounted(() => { onMounted(() => {
setOptions(); setOptions();
arrayDataStore.reset(['skip']); reset(['skip']);
const query = route.query; const query = route.query;
const searchUrl = store.searchUrl; const searchUrl = store.searchUrl;
@ -74,9 +74,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
}; };
let exprFilter; let exprFilter;
let userParams = { ...store.userParams }; let userParams = { ...store.userParams };
if (store?.exprBuilder) { if (store?.exprBuilder) {
const where = buildFilter(userParams, (param, value) => { const where = buildFilter(userParams, (param, value) => {
const res = store.exprBuilder(param, value); const res = store.exprBuilder(param, value);
@ -159,11 +157,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
if (filter) store.filter = filter; if (filter) store.filter = filter;
let userParams = { ...store.userParams, ...params }; let userParams = { ...store.userParams, ...params };
userParams = sanitizerParams(userParams, store?.exprBuilder); userParams = sanitizerParams(userParams, store?.exprBuilder);
store.userParams = userParams; store.userParams = userParams;
arrayDataStore.reset(['skip', 'filter.skip', 'page']); reset(['skip', 'filter.skip', 'page']);
await fetch({}); await fetch({});
return { filter, params }; return { filter, params };
@ -190,6 +187,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
} }
store.order = order; store.order = order;
reset(['skip', 'filter.skip', 'page']);
fetch({}); fetch({});
index++; index++;

View File

@ -183,15 +183,10 @@ const fetchEntryBuys = async () => {
{{ t('globals.summary.basicData') }} {{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" /> <QIcon name="open_in_new" />
</router-link> </router-link>
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" /> <VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
<VnLv :label="t('entry.summary.currency')" :value="entry.currency.name" /> <VnLv :label="t('entry.summary.currency')" :value="entry.currency.name" />
<VnLv :label="t('entry.summary.company')" :value="entry.company.code" /> <VnLv :label="t('entry.summary.company')" :value="entry.company.code" />
<VnLv :label="t('entry.summary.reference')" :value="entry.reference" /> <VnLv :label="t('entry.summary.reference')" :value="entry.reference" />
<VnLv <VnLv
:label="t('entry.summary.invoiceNumber')" :label="t('entry.summary.invoiceNumber')"
:value="entry.invoiceNumber" :value="entry.invoiceNumber"
@ -205,7 +200,6 @@ const fetchEntryBuys = async () => {
{{ t('globals.summary.basicData') }} {{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" /> <QIcon name="open_in_new" />
</router-link> </router-link>
<VnLv :label="t('entry.summary.travelReference')"> <VnLv :label="t('entry.summary.travelReference')">
<template #value> <template #value>
<span class="link"> <span class="link">
@ -214,31 +208,25 @@ const fetchEntryBuys = async () => {
</span> </span>
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv
:label="t('entry.summary.travelAgency')" :label="t('entry.summary.travelAgency')"
:value="entry.travel.agency.name" :value="entry.travel.agency.name"
/> />
<VnLv :label="t('shipped')" :value="toDate(entry.travel.shipped)" /> <VnLv :label="t('shipped')" :value="toDate(entry.travel.shipped)" />
<VnLv <VnLv
:label="t('entry.summary.travelWarehouseOut')" :label="t('entry.summary.travelWarehouseOut')"
:value="entry.travel.warehouseOut.name" :value="entry.travel.warehouseOut.name"
/> />
<QCheckbox <QCheckbox
:label="t('entry.summary.travelDelivered')" :label="t('entry.summary.travelDelivered')"
v-model="entry.travel.isDelivered" v-model="entry.travel.isDelivered"
:disable="true" :disable="true"
/> />
<VnLv :label="t('landed')" :value="toDate(entry.travel.landed)" /> <VnLv :label="t('landed')" :value="toDate(entry.travel.landed)" />
<VnLv <VnLv
:label="t('entry.summary.travelWarehouseIn')" :label="t('entry.summary.travelWarehouseIn')"
:value="entry.travel.warehouseIn.name" :value="entry.travel.warehouseIn.name"
/> />
<QCheckbox <QCheckbox
:label="t('entry.summary.travelReceived')" :label="t('entry.summary.travelReceived')"
v-model="entry.travel.isReceived" v-model="entry.travel.isReceived"

View File

@ -63,7 +63,7 @@ const redirectToEntryBasicData = (_, { id }) => {
<VnSearchbar <VnSearchbar
url="Entries/filter" url="Entries/filter"
custom-route-redirect-name="EntrySummary" custom-route-redirect-name="EntrySummary"
data-key="EntrySummary" data-key="Entry"
:label="t('Search entries')" :label="t('Search entries')"
:info="t('You can search by entry reference')" :info="t('You can search by entry reference')"
/> />

View File

@ -14,10 +14,10 @@ const stateStore = useStateStore();
const expanded = ref(true); const expanded = ref(true);
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.leftDrawer = false;
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.leftDrawer = true));
</script> </script>
<template> <template>
@ -63,13 +63,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</template> </template>
</QExpansionItem> </QExpansionItem>
</QCard> </QCard>
<QCard class="full-width q-mb-lg"> <QCard class="full-width">
<QItem class="justify-between"> <QItem class="justify-between">
<QItemLabel class="slider-container"> <QItemLabel class="col slider-container">
<span class="text-body1" <span class="text-body1"
>{{ t('salesMonitor.ticketsMonitor') }} >{{ t('salesMonitor.ticketsMonitor') }}
</span> </span>
<QCardSection class="col"><SalesTicketsTable /> </QCardSection> <QCardSection class="col" style="padding-inline: 0"
><SalesTicketsTable />
</QCardSection>
</QItemLabel> </QItemLabel>
</QItem> </QItem>
</QCard> </QCard>

View File

@ -3,14 +3,11 @@ import { ref, computed, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import { toDateFormat } from 'src/filters/date.js'; import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters'; import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -37,9 +34,11 @@ const filter = reactive({
}, },
}); });
const refetch = async () => await paginateRef.value.fetch();
watch(dateRange, (val) => { watch(dateRange, (val) => {
filter.where['v.stamp'].between = val; filter.where['v.stamp'].between = val;
paginateRef.value.fetch(); refetch();
}); });
function exprBuilder(param, value) { function exprBuilder(param, value) {
@ -53,25 +52,15 @@ function exprBuilder(param, value) {
const params = reactive({}); const params = reactive({});
const applyColumnFilter = async (col) => {
try {
const paramKey = col.columnFilter?.filterParamKey || col.field;
params[paramKey] = col.columnFilter.filterValue;
await paginateRef.value.addFilter(null, params);
} catch (err) {
console.error('Error applying column filter', err);
}
};
const columns = computed(() => [ const columns = computed(() => [
{ {
label: t('salesClientsTable.date'), label: t('salesClientsTable.date'),
name: 'date', name: 'dated',
field: 'dated', field: 'dated',
align: 'left', align: 'left',
columnFilter: null, columnFilter: null,
sortable: true, sortable: true,
format: (val) => toDateFormat(val), format: (row) => toDateFormat(row.dated),
}, },
{ {
label: t('salesClientsTable.hour'), label: t('salesClientsTable.hour'),
@ -86,40 +75,20 @@ const columns = computed(() => [
field: 'salesPerson', field: 'salesPerson',
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnField: {
component: VnSelect, component: null,
filterParamKey: 'salesPersonFk',
type: 'select',
filterValue: null,
attrs: {
options: workersActiveOptions.value,
'option-value': 'id',
'option-label': 'name',
dense: true,
}, },
}, },
format: (val) => dashIfEmpty(val),
},
{ {
label: t('salesClientsTable.client'), label: t('salesClientsTable.client'),
field: 'clientName', field: 'clientName',
name: 'client', name: 'client',
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnField: {
component: VnSelect, component: null,
filterParamKey: 'clientFk',
type: 'select',
filterValue: null,
attrs: {
options: clientsOptions.value,
'option-value': 'id',
'option-label': 'name',
dense: true,
}, },
}, },
format: (val) => dashIfEmpty(val),
},
]); ]);
</script> </script>
@ -144,7 +113,7 @@ const columns = computed(() => [
@on-fetch="(data) => (clientsOptions = data)" @on-fetch="(data) => (clientsOptions = data)"
/> />
<QCard style="max-height: 380px; overflow-y: scroll"> <QCard style="max-height: 380px; overflow-y: scroll">
<VnPaginate <VnTable
ref="paginateRef" ref="paginateRef"
data-key="SalesMonitorClients" data-key="SalesMonitorClients"
url="SalesMonitors/clientsFilter" url="SalesMonitors/clientsFilter"
@ -155,63 +124,24 @@ const columns = computed(() => [
:filter="filter" :filter="filter"
:offset="50" :offset="50"
auto-load auto-load
>
<template #body="{ rows }">
<QTable
:rows="rows"
:columns="columns" :columns="columns"
row-key="id" :right-search="false"
:pagination="{ rowsPerPage: 0 }" default-mode="table"
class="full-width" dense
:no-data-label="t('globals.noResults')" :without-header="true"
> >
<template #top> <template #column-salesPerson="{ row }">
<VnInputDate
:label="t('salesClientsTable.from')"
dense
v-model="from"
class="q-mr-lg"
style="width: 150px"
/>
<VnInputDate
:label="t('salesClientsTable.to')"
dense
v-model="to"
style="width: 150px"
/>
</template>
<template #top-row="{ cols }">
<QTr>
<QTd
v-for="(col, index) in cols"
:key="index"
style="max-width: 100px"
>
<VnSelect
:is="col.columnFilter.component"
v-if="col.columnFilter"
v-model="col.columnFilter.filterValue"
v-bind="col.columnFilter.attrs"
@update:model-value="applyColumnFilter(col)"
dense
/>
</QTd>
</QTr>
</template>
<template #body-cell-salesPerson="{ row }">
<QTd> <QTd>
<span class="link">{{ row.salesPerson }}</span> <span class="link">{{ row.salesPerson }}</span>
<WorkerDescriptorProxy :id="row.salesPersonFk" dense /> <WorkerDescriptorProxy :id="row.salesPersonFk" dense />
</QTd> </QTd>
</template> </template>
<template #body-cell-client="{ row }"> <template #column-client="{ row }">
<QTd> <QTd>
<span class="link">{{ row.clientName }}</span> <span class="link">{{ row.clientName }}</span>
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />
</QTd> </QTd>
</template> </template>
</QTable> </VnTable>
</template>
</VnPaginate>
</QCard> </QCard>
</template> </template>

View File

@ -5,7 +5,8 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js'; import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
@ -50,19 +51,22 @@ const columns = computed(() => [
name: 'date', name: 'date',
field: 'dated', field: 'dated',
align: 'left', align: 'left',
columnFilter: null, sortable: true,
cardVisible: true,
}, },
{ {
label: t('salesOrdersTable.client'), label: t('salesOrdersTable.client'),
name: 'client', name: 'client',
align: 'left', align: 'left',
sortable: true, sortable: true,
cardVisible: true,
}, },
{ {
label: t('salesOrdersTable.salesPerson'), label: t('salesOrdersTable.salesPerson'),
name: 'salesPerson', name: 'salesPerson',
align: 'left', align: 'left',
sortable: true, sortable: true,
cardVisible: true,
}, },
]); ]);
@ -119,28 +123,29 @@ const redirectToOrderSummary = (orderId) => {
@on-fetch="(data) => (clientsOptions = data)" @on-fetch="(data) => (clientsOptions = data)"
/> />
<VnSubToolbar />
<QCard style="max-height: 380px; overflow-y: scroll"> <QCard style="max-height: 380px; overflow-y: scroll">
<VnPaginate <VnTable
ref="paginateRef" ref="paginateRef"
data-key="SalesMonitorOrders" data-key="SalesMonitorOrders"
url="SalesMonitors/ordersFilter" url="SalesMonitors/ordersFilter"
order="date_make DESC" order="date_make DESC"
:limit="6" :limit="6"
:right-search="false"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
auto-load auto-load
>
<template #body="{ rows }">
<QTable
:rows="rows"
:columns="columns" :columns="columns"
row-key="id" :table="{
selection="multiple" 'row-key': 'id',
v-model:selected="selectedRows" selection: 'multiple',
:pagination="{ rowsPerPage: 0 }" 'hide-bottom': true,
:no-data-label="t('globals.noResults')" }"
default-mode="table"
:without-header="false"
@row-click="(_, row) => redirectToOrderSummary(row.id)" @row-click="(_, row) => redirectToOrderSummary(row.id)"
v-model:selected="selectedRows"
> >
<template #top> <template #top-left>
<QBtn <QBtn
v-if="selectedRows.length > 0" v-if="selectedRows.length > 0"
icon="delete" icon="delete"
@ -157,13 +162,12 @@ const redirectToOrderSummary = (orderId) => {
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip> <QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
<template #body-cell-date="{ row }"> <template #column-date="{ row }">
<QTd> <QTd>
<QBadge <QBadge
:color="getBadgeColor(row.date_send)" :color="getBadgeColor(row.date_send)"
text-color="black" text-color="black"
class="q-ma-none q-mb-md" class="q-pa-sm q-mb-md"
dense
style="font-size: 14px" style="font-size: 14px"
> >
{{ toDateFormat(row.date_send) }} {{ toDateFormat(row.date_send) }}
@ -171,7 +175,7 @@ const redirectToOrderSummary = (orderId) => {
<div>{{ toDateTimeFormat(row.date_make) }}</div> <div>{{ toDateTimeFormat(row.date_make) }}</div>
</QTd> </QTd>
</template> </template>
<template #body-cell-client="{ row }"> <template #column-client="{ row }">
<QTd> <QTd>
<div class="q-mb-md"> <div class="q-mb-md">
<span class="link">{{ row.clientName }}</span> <span class="link">{{ row.clientName }}</span>
@ -180,7 +184,8 @@ const redirectToOrderSummary = (orderId) => {
<span> {{ row.agencyName }}</span> <span> {{ row.agencyName }}</span>
</QTd> </QTd>
</template> </template>
<template #body-cell-salesPerson="{ row }">
<template #column-salesPerson="{ row }">
<QTd> <QTd>
<div class="q-mb-md"> <div class="q-mb-md">
<span class="link">{{ row.salesPerson }}</span> <span class="link">{{ row.salesPerson }}</span>
@ -189,9 +194,7 @@ const redirectToOrderSummary = (orderId) => {
<span>{{ toCurrency(row.import) }}</span> <span>{{ toCurrency(row.import) }}</span>
</QTd> </QTd>
</template> </template>
</QTable> </VnTable>
</template>
</VnPaginate>
</QCard> </QCard>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -6,7 +6,6 @@ import { useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue'; import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
@ -15,6 +14,7 @@ import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toDateFormat, toTimeFormat } from 'src/filters/date.js'; import { toDateFormat, toTimeFormat } from 'src/filters/date.js';
@ -103,7 +103,10 @@ const columns = computed(() => [
name: 'problems', name: 'problems',
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: null, columnFilter: false,
attrs: {
dense: true,
},
}, },
{ {
label: t('salesTicketsTable.identifier'), label: t('salesTicketsTable.identifier'),
@ -111,11 +114,10 @@ const columns = computed(() => [
field: 'id', field: 'id',
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnInput, component: 'input',
type: 'text', name: 'id',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
dense: true, dense: true,
}, },
@ -128,10 +130,8 @@ const columns = computed(() => [
field: 'nickname', field: 'nickname',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnInput, component: 'input',
type: 'text', name: 'nickname',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
dense: true, dense: true,
}, },
@ -144,11 +144,8 @@ const columns = computed(() => [
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnSelect, component: 'select',
filterParamKey: 'salesPersonFk', name: 'salesPersonFk',
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
options: workersActiveOptions.value, options: workersActiveOptions.value,
'option-value': 'id', 'option-value': 'id',
@ -160,14 +157,12 @@ const columns = computed(() => [
{ {
label: t('salesTicketsTable.date'), label: t('salesTicketsTable.date'),
name: 'date', name: 'date',
style: { 'max-width': '100px' },
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnInputDate, component: 'date',
filterParamKey: 'shippedDate', name: 'shippedDate',
type: 'date',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
dense: true, dense: true,
}, },
@ -180,6 +175,13 @@ const columns = computed(() => [
align: 'left', align: 'left',
sortable: true, sortable: true,
format: (val) => toTimeFormat(val), format: (val) => toTimeFormat(val),
columnFilter: {
component: 'input',
name: 'theoreticalHour',
attrs: {
dense: true,
},
},
}, },
{ {
label: t('salesTicketsTable.practical'), label: t('salesTicketsTable.practical'),
@ -188,10 +190,8 @@ const columns = computed(() => [
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnInput, component: 'input',
type: 'text', name: 'practicalHour',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
dense: true, dense: true,
}, },
@ -204,6 +204,13 @@ const columns = computed(() => [
align: 'left', align: 'left',
sortable: true, sortable: true,
format: (val) => toTimeFormat(val), format: (val) => toTimeFormat(val),
columnFilter: {
component: 'input',
name: 'shippedDate',
attrs: {
dense: true,
},
},
}, },
{ {
@ -211,13 +218,11 @@ const columns = computed(() => [
name: 'province', name: 'province',
field: 'province', field: 'province',
align: 'left', align: 'left',
style: { 'max-width': '100px' },
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnSelect, component: 'select',
filterParamKey: 'provinceFk', name: 'provinceFk',
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
options: provincesOptions.value, options: provincesOptions.value,
'option-value': 'id', 'option-value': 'id',
@ -230,13 +235,11 @@ const columns = computed(() => [
label: t('salesTicketsTable.state'), label: t('salesTicketsTable.state'),
name: 'state', name: 'state',
align: 'left', align: 'left',
style: { 'max-width': '100px' },
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnSelect, component: 'select',
filterParamKey: 'stateFk', name: 'stateFk',
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
options: statesOptions.value, options: statesOptions.value,
'option-value': 'id', 'option-value': 'id',
@ -252,13 +255,13 @@ const columns = computed(() => [
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnInput, inWhere: true,
type: 'text',
filterValue: null,
event: getInputEvents,
attrs: {
dense: true,
}, },
attrs: {
'checked-icon': 'local_bar',
'unchecked-icon': 'local_bar',
'false-value': 0,
'true-value': 1,
}, },
}, },
{ {
@ -267,11 +270,8 @@ const columns = computed(() => [
align: 'left', align: 'left',
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnSelect, component: 'select',
filterParamKey: 'zoneFk', name: 'zoneFk',
type: 'select',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
options: zonesOptions.value, options: zonesOptions.value,
'option-value': 'id', 'option-value': 'id',
@ -285,21 +285,44 @@ const columns = computed(() => [
name: 'total', name: 'total',
field: 'totalWithVat', field: 'totalWithVat',
align: 'left', align: 'left',
style: { 'max-width': '75px' },
sortable: true, sortable: true,
columnFilter: { columnFilter: {
component: VnInput, component: 'input',
type: 'text', name: 'totalWithVat',
filterValue: null,
event: getInputEvents,
attrs: { attrs: {
dense: true, dense: true,
}, },
}, },
}, },
{ {
name: 'rowActions', align: 'right',
align: 'left', name: 'tableActions',
sortable: true, label: '',
actions: [
{
title: t('salesTicketsTable.goToLines'),
icon: 'vn:lines',
color: 'priamry',
action: (row) => redirectToSales(row.id),
isPrimary: true,
attrs: {
flat: true,
dense: true,
},
},
{
title: t('salesTicketsTable.preview'),
icon: 'preview',
color: 'priamry',
action: (row) => viewSummary(row.id, TicketSummary),
isPrimary: true,
attrs: {
flat: true,
dense: true,
},
},
],
}, },
]); ]);
@ -315,7 +338,9 @@ const getBadgeAttrs = (date) => {
if (comparation < 0) return { color: 'success', 'text-color': 'black' }; if (comparation < 0) return { color: 'success', 'text-color': 'black' };
return { color: 'transparent', 'text-color': 'white' }; return { color: 'transparent', 'text-color': 'white' };
}; };
let refreshTimer = null; let refreshTimer = null;
const autoRefreshHandler = (value) => { const autoRefreshHandler = (value) => {
if (value) if (value)
refreshTimer = setInterval(() => paginateRef.value.fetch(), DEFAULT_AUTO_REFRESH); refreshTimer = setInterval(() => paginateRef.value.fetch(), DEFAULT_AUTO_REFRESH);
@ -324,8 +349,10 @@ const autoRefreshHandler = (value) => {
refreshTimer = null; refreshTimer = null;
} }
}; };
const redirectToTicketSummary = (id) => { const redirectToTicketSummary = (id) => {
router.push({ name: 'TicketSummary', params: { id } }); const url = `#/ticket/${id}/summary`;
window.open(url, '_blank');
}; };
const stateColors = { const stateColors = {
@ -348,12 +375,17 @@ const formatShippedDate = (date) => {
return toDateFormat(_date); return toDateFormat(_date);
}; };
onMounted(async () => { const redirectToSales = (id) => {
const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions'); const url = `#/ticket/${id}/sale`;
allColumnNames.value = filteredColumns.map((col) => col.name); window.open(url, '_blank');
params = fetchParams(); };
await paginateRef.value.addFilter(null, params);
}); // onMounted(async () => {
// const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions');
// allColumnNames.value = filteredColumns.map((col) => col.name);
// params = fetchParams();
// await paginateRef.value.addFilter(null, params);
// });
</script> </script>
<template> <template>
@ -394,7 +426,7 @@ onMounted(async () => {
auto-load auto-load
@on-fetch="(data) => (zonesOptions = data)" @on-fetch="(data) => (zonesOptions = data)"
/> />
<VnPaginate <VnTable
ref="paginateRef" ref="paginateRef"
data-key="SalesMonitorTickets" data-key="SalesMonitorTickets"
url="SalesMonitors/salesFilter" url="SalesMonitors/salesFilter"
@ -403,18 +435,14 @@ onMounted(async () => {
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:user-params="params" :user-params="params"
:offset="50" :offset="50"
>
<template #body="{ rows }">
<QTable
:rows="rows"
:columns="columns" :columns="columns"
row-key="id"
:pagination="{ rowsPerPage: 0 }"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:no-data-label="t('globals.noResults')" :right-search="false"
default-mode="table"
auto-load
@row-click="(_, row) => redirectToTicketSummary(row.id)" @row-click="(_, row) => redirectToTicketSummary(row.id)"
> >
<template #top> <template #top-left>
<TableVisibleColumns <TableVisibleColumns
:all-columns="allColumnNames" :all-columns="allColumnNames"
table-code="ticketsMonitor" table-code="ticketsMonitor"
@ -427,36 +455,15 @@ onMounted(async () => {
@update:model-value="autoRefreshHandler" @update:model-value="autoRefreshHandler"
/> />
</template> </template>
<template #top-row="{ cols }"> <template #column-problems="{ row }">
<QTr> <QTd class="no-padding" style="max-width: 50px">
<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
style="padding-bottom: 0"
/>
</QTd>
</QTr>
</template>
<template #body-cell-problems="{ row }">
<QTd class="q-gutter-x-sm">
<QIcon <QIcon
v-if="row.isTaxDataChecked === 0" v-if="row.isTaxDataChecked === 0"
name="vn:no036" name="vn:no036"
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ <QTooltip>{{ t('salesTicketsTable.noVerifiedData') }}</QTooltip>
t('salesTicketsTable.noVerifiedData')
}}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.hasTicketRequest" v-if="row.hasTicketRequest"
@ -464,9 +471,7 @@ onMounted(async () => {
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ <QTooltip>{{ t('salesTicketsTable.purchaseRequest') }}</QTooltip>
t('salesTicketsTable.purchaseRequest')
}}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.itemShortage" v-if="row.itemShortage"
@ -476,12 +481,7 @@ onMounted(async () => {
> >
<QTooltip>{{ t('salesTicketsTable.notVisible') }}</QTooltip> <QTooltip>{{ t('salesTicketsTable.notVisible') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
v-if="row.isFreezed"
name="vn:frozen"
color="primary"
size="xs"
>
<QTooltip>{{ t('salesTicketsTable.clientFrozen') }}</QTooltip> <QTooltip>{{ t('salesTicketsTable.clientFrozen') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
@ -490,10 +490,7 @@ onMounted(async () => {
:color="row.hasHighRisk ? 'negative' : 'primary'" :color="row.hasHighRisk ? 'negative' : 'primary'"
size="xs" size="xs"
> >
<QTooltip <QTooltip>{{ t('salesTicketsTable.risk') }}: {{ row.risk }}</QTooltip>
>{{ t('salesTicketsTable.risk') }}:
{{ row.risk }}</QTooltip
>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.hasComponentLack" v-if="row.hasComponentLack"
@ -501,9 +498,7 @@ onMounted(async () => {
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ <QTooltip>{{ t('salesTicketsTable.componentLack') }}</QTooltip>
t('salesTicketsTable.componentLack')
}}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.isTooLittle" v-if="row.isTooLittle"
@ -515,38 +510,39 @@ onMounted(async () => {
</QIcon> </QIcon>
</QTd> </QTd>
</template> </template>
<template #body-cell-identifier="{ row }"> <template #column-identifier="{ row }">
<QTd> <QTd class="no-padding">
<span class="link" @click.stop.prevent>{{ row.id }}</span> <span class="link" @click.stop.prevent>
{{ row.id }}
<TicketDescriptorProxy :id="row.id" /> <TicketDescriptorProxy :id="row.id" />
</span>
</QTd> </QTd>
</template> </template>
<template #body-cell-client="{ row }"> <template #column-client="{ row }">
<QTd @click.stop.prevent> <QTd class="no-padding" @click.stop.prevent>
<span class="link">{{ row.nickname }}</span> <span class="link">{{ row.nickname }}</span>
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />
</QTd> </QTd>
</template> </template>
<template #body-cell-salesPerson="{ row }"> <template #column-salesPerson="{ row }">
<QTd @click.stop.prevent> <QTd class="no-padding" @click.stop.prevent>
<span class="link">{{ row.userName }}</span> <span class="link">{{ row.userName }}</span>
<WorkerDescriptorProxy :id="row.salesPersonFk" /> <WorkerDescriptorProxy :id="row.salesPersonFk" />
</QTd> </QTd>
</template> </template>
<template #body-cell-date="{ row }"> <template #column-date="{ row }">
<QTd> <QTd class="no-padding">
<QBadge <QBadge
v-bind="getBadgeAttrs(row.shippedDate)" v-bind="getBadgeAttrs(row.shippedDate)"
class="q-ma-none" class="q-pa-sm"
dense
style="font-size: 14px" style="font-size: 14px"
> >
{{ formatShippedDate(row.shippedDate) }} {{ formatShippedDate(row.shippedDate) }}
</QBadge> </QBadge>
</QTd> </QTd>
</template> </template>
<template #body-cell-state="{ row }"> <template #column-state="{ row }">
<QTd @click.stop.prevent> <QTd class="no-padding" @click.stop.prevent>
<div v-if="row.refFk"> <div v-if="row.refFk">
<span class="link">{{ row.refFk }}</span> <span class="link">{{ row.refFk }}</span>
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" /> <InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
@ -555,69 +551,37 @@ onMounted(async () => {
v-else v-else
:color="stateColors[row.classColor] || 'transparent'" :color="stateColors[row.classColor] || 'transparent'"
:text-color="stateColors[row.classColor] ? 'black' : 'white'" :text-color="stateColors[row.classColor] ? 'black' : 'white'"
dense class="q-pa-sm"
style="font-size: 14px" style="font-size: 14px"
> >
{{ row.state }} {{ row.state }}
</QBadge> </QBadge>
</QTd> </QTd>
</template> </template>
<template #body-cell-isFragile="{ row }"> <template #column-isFragile="{ row }">
<QTd> <QTd class="no-padding">
<QIcon <QIcon v-if="row.isFragile" name="local_bar" color="primary" size="sm">
v-if="row.isFragile"
name="local_bar"
color="primary"
size="sm"
>
<QTooltip>{{ t('salesTicketsTable.isFragile') }}</QTooltip> <QTooltip>{{ t('salesTicketsTable.isFragile') }}</QTooltip>
</QIcon> </QIcon>
</QTd> </QTd>
</template> </template>
<template #body-cell-zone="{ row }"> <template #column-zone="{ row }">
<QTd @click.stop.prevent> <QTd class="no-padding" @click.stop.prevent>
<span class="link">{{ row.zoneName }}</span> <span class="link">{{ row.zoneName }}</span>
<ZoneDescriptorProxy :id="row.zoneFk" /> <ZoneDescriptorProxy :id="row.zoneFk" />
</QTd> </QTd>
</template> </template>
<template #body-cell-total="{ row }"> <template #column-total="{ row }">
<QTd> <QTd class="no-padding">
<QBadge <QBadge
:color="totalPriceColor(row) || 'transparent'" :color="totalPriceColor(row) || 'transparent'"
:text-color="totalPriceColor(row) ? 'black' : 'white'" :text-color="totalPriceColor(row) ? 'black' : 'white'"
dense class="q-pa-sm"
style="font-size: 14px" style="font-size: 14px"
> >
{{ toCurrency(row.totalWithVat) }} {{ toCurrency(row.totalWithVat) }}
</QBadge> </QBadge>
</QTd> </QTd>
</template> </template>
<template #body-cell-rowActions="{ row }"> </VnTable>
<QTd @click.stop.prevent>
<QBtn
icon="vn:lines"
color="primary"
size="md"
class="q-mr-sm"
flat
dense
:to="{ name: 'TicketSale', params: { id: row.id } }"
>
<QTooltip>{{ t('salesTicketsTable.goToLines') }}</QTooltip>
</QBtn>
<QBtn
icon="preview"
color="primary"
size="md"
dense
flat
@click="viewSummary(row.id, TicketSummary)"
>
<QTooltip>{{ t('salesTicketsTable.preview') }}</QTooltip>
</QBtn>
</QTd>
</template>
</QTable>
</template>
</VnPaginate>
</template> </template>

View File

@ -176,8 +176,6 @@ function confirmRemove(item) {
} }
async function remove(item) { async function remove(item) {
console.log('item: ', item);
console.log('id: ', route.params.id);
await axios.post('OrderRows/removes', { await axios.post('OrderRows/removes', {
actualOrderId: route.params.id, actualOrderId: route.params.id,
rows: [item.id], rows: [item.id],

View File

@ -126,7 +126,6 @@ const columns = computed(() => [
]); ]);
async function fetchClientAddress(id, data) { async function fetchClientAddress(id, data) {
console.log('data: ', data);
const clientData = await axios.get(`Clients/${id}`); const clientData = await axios.get(`Clients/${id}`);
selectedAddress.value = clientData.data.defaultAddressFk; selectedAddress.value = clientData.data.defaultAddressFk;
data.addressId = selectedAddress.value; data.addressId = selectedAddress.value;

View File

@ -372,15 +372,15 @@ const showReasonForm = () => {
const updateWorkerTimeControlMail = async (state, reason) => { const updateWorkerTimeControlMail = async (state, reason) => {
try { try {
const params = { const params = {
workerId: Number(route.params.id),
year: selectedDate.value.getFullYear(), year: selectedDate.value.getFullYear(),
week: selectedWeekNumber.value, week: selectedWeekNumber.value,
state, state,
}; };
const workerId = Number(route.params.id);
if (reason) params.reason = reason; if (reason) params.reason = reason;
await axios.post('WorkerTimeControls/updateWorkerTimeControlMail', params); await axios.post(`WorkerTimeControls/${workerId}/updateMailState`, params);
await getMailStates(selectedDate.value); await getMailStates(selectedDate.value);
await fetchWeekData(); await fetchWeekData();
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');

View File

@ -14,7 +14,7 @@ describe('WorkerCreate', () => {
Phone: { val: '123456789' }, Phone: { val: '123456789' },
'Worker code': { val: 'DWW' }, 'Worker code': { val: 'DWW' },
Boss: { val: developerBossId, type: 'select' }, Boss: { val: developerBossId, type: 'select' },
Birth: { val: '2022-12-11T23:00:00.000Z', type: 'date', day: 11 }, Birth: { val: '11-12-2022', type: 'date' },
}; };
const external = { const external = {
Fi: { val: 'Z4531219V' }, Fi: { val: 'Z4531219V' },

View File

@ -87,7 +87,6 @@ Cypress.Commands.add('selectOption', (selector, option) => {
}); });
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
const days = '.q-date__calendar-days .q-date__calendar-item--in';
cy.waitForElement('.q-form > .q-card'); cy.waitForElement('.q-form > .q-card');
cy.get(`${form} input`).each(([el]) => { cy.get(`${form} input`).each(([el]) => {
cy.wrap(el) cy.wrap(el)
@ -96,17 +95,14 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
const field = obj[ariaLabel]; const field = obj[ariaLabel];
if (!field) return; if (!field) return;
const { type, val, day } = field; const { type, val } = field;
switch (type) { switch (type) {
case 'select': case 'select':
cy.wrap(el).type(val); cy.wrap(el).type(val);
cy.get('.q-menu .q-item').contains(val).click(); cy.get('.q-menu .q-item').contains(val).click();
break; break;
case 'date': case 'date':
cy.wrap(el).click(); cy.wrap(el).type(val.split('-').join(''));
cy.get(days)
.eq(day ? day - 1 : 0)
.click();
break; break;
default: default:
cy.wrap(el).type(val); cy.wrap(el).type(val);