166
CHANGELOG.md
166
CHANGELOG.md
|
@ -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
|
||||
|
||||
### Added 🆕
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "24.30.1",
|
||||
"version": "24.32.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
|
|
@ -78,7 +78,7 @@ const defaultComponents = {
|
|||
date: {
|
||||
component: markRaw(VnInputDate),
|
||||
attrs: {
|
||||
readonly: true,
|
||||
readonly: !$props.isEditable,
|
||||
disable: !$props.isEditable,
|
||||
style: 'min-width: 125px',
|
||||
class: 'fit',
|
||||
|
|
|
@ -48,6 +48,17 @@ const forceAttrs = {
|
|||
label: $props.showTitle ? '' : $props.column.label,
|
||||
};
|
||||
|
||||
const selectComponent = {
|
||||
component: markRaw(VnSelect),
|
||||
event: updateEvent,
|
||||
attrs: {
|
||||
class: 'q-px-sm q-pb-xs q-pt-none fit',
|
||||
dense: true,
|
||||
filled: !$props.showTitle,
|
||||
},
|
||||
forceAttrs,
|
||||
};
|
||||
|
||||
const components = {
|
||||
input: {
|
||||
component: markRaw(VnInput),
|
||||
|
@ -97,16 +108,8 @@ const components = {
|
|||
},
|
||||
forceAttrs,
|
||||
},
|
||||
select: {
|
||||
component: markRaw(VnSelect),
|
||||
event: updateEvent,
|
||||
attrs: {
|
||||
class: 'q-px-sm q-pb-xs q-pt-none fit',
|
||||
dense: true,
|
||||
filled: !$props.showTitle,
|
||||
},
|
||||
forceAttrs,
|
||||
},
|
||||
select: selectComponent,
|
||||
rawSelect: selectComponent,
|
||||
};
|
||||
|
||||
async function addFilter(value) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, computed, watch } from 'vue';
|
||||
import { ref, onBeforeMount, onMounted, computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -96,6 +96,7 @@ const DEFAULT_MODE = 'card';
|
|||
const TABLE_MODE = 'table';
|
||||
const mode = ref(DEFAULT_MODE);
|
||||
const selected = ref([]);
|
||||
const hasParams = ref(false);
|
||||
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
|
||||
const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
|
||||
const orders = ref(parseOrder(routeQuery.filter?.order));
|
||||
|
@ -117,11 +118,14 @@ const tableModes = [
|
|||
disable: $props.disableOption?.card,
|
||||
},
|
||||
];
|
||||
onBeforeMount(() => {
|
||||
setUserParams(route.query[$props.searchUrl]);
|
||||
hasParams.value = Object.keys(params.value).length !== 0;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode;
|
||||
stateStore.rightDrawer = true;
|
||||
setUserParams(route.query[$props.searchUrl]);
|
||||
columnsVisibilitySkiped.value = [
|
||||
...splittedColumns.value.columns
|
||||
.filter((c) => c.visible == false)
|
||||
|
@ -281,6 +285,11 @@ defineExpose({
|
|||
:params="params"
|
||||
:columns="splittedColumns.columns"
|
||||
/>
|
||||
<slot
|
||||
name="moreFilterPanel"
|
||||
:params="params"
|
||||
:columns="splittedColumns.columns"
|
||||
/>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</QScrollArea>
|
||||
|
@ -295,6 +304,7 @@ defineExpose({
|
|||
:disable-infinite-scroll="isTableMode"
|
||||
@save-changes="reload"
|
||||
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
|
||||
:auto-load="hasParams || $attrs['auto-load']"
|
||||
>
|
||||
<template
|
||||
v-for="(_, slotName) in $slots"
|
||||
|
@ -407,7 +417,7 @@ defineExpose({
|
|||
<VnTableColumn
|
||||
:column="col"
|
||||
:row="row"
|
||||
:is-editable="false"
|
||||
:is-editable="col.isEditable ?? isEditable"
|
||||
v-model="row[col.name]"
|
||||
component-prop="columnField"
|
||||
/>
|
||||
|
|
|
@ -44,15 +44,18 @@ const formattedDate = computed({
|
|||
let newDate;
|
||||
if (value) {
|
||||
// parse input
|
||||
if (value.includes('/') && value.length >= 10) {
|
||||
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
||||
value = date.formatDate(
|
||||
new Date(value).toISOString(),
|
||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||
);
|
||||
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('/');
|
||||
value = date.formatDate(
|
||||
new Date(value).toISOString(),
|
||||
'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) {
|
||||
const orgDate =
|
||||
model.value instanceof Date ? model.value : new Date(model.value);
|
||||
|
@ -107,7 +110,12 @@ watch(
|
|||
isPopupOpen = false;
|
||||
"
|
||||
/>
|
||||
<QIcon name="event" class="cursor-pointer" />
|
||||
<QIcon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
@click="isPopupOpen = !isPopupOpen"
|
||||
:title="t('Open date')"
|
||||
/>
|
||||
</template>
|
||||
<QMenu
|
||||
transition-show="scale"
|
||||
|
@ -116,6 +124,7 @@ watch(
|
|||
anchor="bottom left"
|
||||
self="top start"
|
||||
:no-focus="true"
|
||||
:no-parent-event="true"
|
||||
>
|
||||
<QDate
|
||||
v-model="popupDate"
|
||||
|
@ -132,7 +141,6 @@ watch(
|
|||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
|
||||
border-bottom-style: solid;
|
||||
|
@ -142,3 +150,7 @@ watch(
|
|||
border-style: solid;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Open date: Abrir fecha
|
||||
</i18n>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { watch, computed, ref } from 'vue';
|
||||
import { watch, computed, ref, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { date } from 'quasar';
|
||||
|
||||
|
@ -20,6 +20,7 @@ const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
|||
const dateFormat = 'HH:mm';
|
||||
const isPopupOpen = ref();
|
||||
const hover = ref();
|
||||
const inputRef = ref();
|
||||
|
||||
const styleAttrs = computed(() => {
|
||||
return props.isOutlined
|
||||
|
@ -41,11 +42,17 @@ const formattedTime = computed({
|
|||
let time = value;
|
||||
if (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) {
|
||||
const hours = time.split(':');
|
||||
const date = new Date(model.value);
|
||||
date.setHours(hours[0], hours[1], 0);
|
||||
time = date.toISOString();
|
||||
const [hh, mm] = time.split(':');
|
||||
const date = model.value ?? Date.vnNew();
|
||||
date.setHours(hh, mm, 0);
|
||||
time = date?.toISOString();
|
||||
}
|
||||
}
|
||||
model.value = time;
|
||||
|
@ -55,17 +62,37 @@ const formattedTime = computed({
|
|||
function dateToTime(newDate) {
|
||||
return date.formatDate(new Date(newDate), dateFormat);
|
||||
}
|
||||
|
||||
const timeField = ref();
|
||||
watch(
|
||||
() => model.value,
|
||||
(val) => (formattedTime.value = val),
|
||||
{ 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>
|
||||
|
||||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="inputRef"
|
||||
class="vn-input-time"
|
||||
mask="##:##"
|
||||
placeholder="--:--"
|
||||
|
@ -74,6 +101,8 @@ watch(
|
|||
:class="{ required: $attrs.required }"
|
||||
style="min-width: 100px"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
@click="isPopupOpen = false"
|
||||
@focus="inputRef.getNativeElement().setSelectionRange(0, 0)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
@ -90,7 +119,12 @@ watch(
|
|||
isPopupOpen = false;
|
||||
"
|
||||
/>
|
||||
<QIcon name="Schedule" class="cursor-pointer" />
|
||||
<QIcon
|
||||
name="Schedule"
|
||||
class="cursor-pointer"
|
||||
@click="isPopupOpen = !isPopupOpen"
|
||||
:title="t('Open time')"
|
||||
/>
|
||||
</template>
|
||||
<QMenu
|
||||
transition-show="scale"
|
||||
|
@ -99,6 +133,7 @@ watch(
|
|||
anchor="bottom left"
|
||||
self="top start"
|
||||
:no-focus="true"
|
||||
:no-parent-event="true"
|
||||
>
|
||||
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
|
||||
</QMenu>
|
||||
|
@ -114,3 +149,8 @@ watch(
|
|||
border-style: solid;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Open time: Abrir tiempo
|
||||
</i18n>
|
||||
, nextTick
|
||||
|
|
|
@ -125,7 +125,8 @@ function filter(val, options) {
|
|||
});
|
||||
}
|
||||
|
||||
const id = row.id;
|
||||
if (!row) return;
|
||||
const id = row[$props.optionValue];
|
||||
const optionLabel = String(row[$props.optionLabel]).toLowerCase();
|
||||
|
||||
return id == search || optionLabel.includes(search);
|
||||
|
|
|
@ -8,18 +8,32 @@ const $props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
find: {
|
||||
type: String,
|
||||
type: [String, Object],
|
||||
default: null,
|
||||
description: 'search in row to add default options',
|
||||
},
|
||||
});
|
||||
const options = ref([]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const { url } = useAttrs();
|
||||
const { url, optionValue, optionLabel } = useAttrs();
|
||||
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||
if (findBy) options.value = [$props.row[findBy]];
|
||||
if (!findBy || !$props.row) return;
|
||||
// is object
|
||||
if (typeof findBy == 'object') {
|
||||
const { value, label } = findBy;
|
||||
if (!$props.row[value] || !$props.row[label]) return;
|
||||
return (options.value = [
|
||||
{
|
||||
[optionValue ?? 'id']: $props.row[value],
|
||||
[optionLabel ?? 'name']: $props.row[label],
|
||||
},
|
||||
]);
|
||||
}
|
||||
// is string
|
||||
if ($props.row[findBy]) options.value = [$props.row[findBy]];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
|
||||
</template>
|
||||
|
|
|
@ -120,7 +120,7 @@ const toModule = computed(() =>
|
|||
:icon="iconModule"
|
||||
color="white"
|
||||
class="link"
|
||||
:to="toModule"
|
||||
:to="$attrs['to-module'] ?? toModule"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.goToModuleIndex') }}
|
||||
|
|
|
@ -52,8 +52,8 @@ const containerClasses = computed(() => {
|
|||
--calendar-border-current: #84d0e2 2px solid;
|
||||
--calendar-current-color-dark: #84d0e2;
|
||||
// Colores de fondo del calendario en dark mode
|
||||
--calendar-outside-background-dark: #222;
|
||||
--calendar-background-dark: #222;
|
||||
--calendar-outside-background-dark: var(--vn-section-color);
|
||||
--calendar-background-dark: var(--vn-section-color);
|
||||
}
|
||||
|
||||
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
|
||||
|
@ -70,8 +70,27 @@ const containerClasses = computed(() => {
|
|||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.q-calendar-month__head--workweek,
|
||||
.q-calendar-month__head--weekday,
|
||||
// .q-calendar-month__workweek.q-past-day,
|
||||
.q-calendar-month__week :nth-child(6),
|
||||
:nth-child(7) {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
|
||||
.q-calendar-month__head--weekdays > div[aria-label='miércoles'] > span {
|
||||
/* color: transparent; */
|
||||
visibility: hidden;
|
||||
// position: absolute;
|
||||
}
|
||||
.q-calendar-month__head--weekdays > div[aria-label='miércoles'] > span:after {
|
||||
content: 'X';
|
||||
visibility: visible;
|
||||
left: 33%;
|
||||
position: absolute;
|
||||
}
|
||||
.transparent-background {
|
||||
--calendar-background-dark: transparent;
|
||||
// --calendar-background-dark: transparent;
|
||||
--calendar-background: transparent;
|
||||
--calendar-outside-background-dark: transparent;
|
||||
}
|
||||
|
@ -110,11 +129,6 @@ const containerClasses = computed(() => {
|
|||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.q-calendar-month__week--days > div:nth-child(6),
|
||||
.q-calendar-month__week--days > div:nth-child(7) {
|
||||
// Cambia el color de los días sábado y domingo
|
||||
color: #777777;
|
||||
}
|
||||
|
||||
.q-calendar-month__week--wrapper {
|
||||
margin-bottom: 4px;
|
||||
|
@ -124,6 +138,7 @@ const containerClasses = computed(() => {
|
|||
height: 32px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
|
||||
.q-calendar__button--bordered {
|
||||
|
@ -147,7 +162,7 @@ const containerClasses = computed(() => {
|
|||
.q-calendar-month__head--workweek,
|
||||
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
|
||||
text-transform: capitalize;
|
||||
color: $color-font-secondary;
|
||||
color: var(--vn-label-color);
|
||||
font-weight: bold;
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
|
|
|
@ -110,9 +110,11 @@ async function search(evt) {
|
|||
|
||||
store.filter.where = {};
|
||||
isLoading.value = true;
|
||||
const filter = { ...userParams.value };
|
||||
const filter = { ...userParams.value, ...$props.modelValue };
|
||||
store.userParamsChanged = true;
|
||||
const { params: newParams } = await arrayData.addFilter({ params: userParams.value });
|
||||
const { params: newParams } = await arrayData.addFilter({
|
||||
params: filter,
|
||||
});
|
||||
userParams.value = newParams;
|
||||
|
||||
if (!$props.showAll && !Object.values(filter).length) store.data = [];
|
||||
|
|
|
@ -18,7 +18,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
|
||||
onMounted(() => {
|
||||
setOptions();
|
||||
arrayDataStore.reset(['skip']);
|
||||
reset(['skip']);
|
||||
|
||||
const query = route.query;
|
||||
const searchUrl = store.searchUrl;
|
||||
|
@ -74,9 +74,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
};
|
||||
|
||||
let exprFilter;
|
||||
|
||||
let userParams = { ...store.userParams };
|
||||
|
||||
if (store?.exprBuilder) {
|
||||
const where = buildFilter(userParams, (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;
|
||||
|
||||
let userParams = { ...store.userParams, ...params };
|
||||
|
||||
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
||||
|
||||
store.userParams = userParams;
|
||||
arrayDataStore.reset(['skip', 'filter.skip', 'page']);
|
||||
reset(['skip', 'filter.skip', 'page']);
|
||||
|
||||
await fetch({});
|
||||
return { filter, params };
|
||||
|
@ -190,6 +187,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
}
|
||||
|
||||
store.order = order;
|
||||
reset(['skip', 'filter.skip', 'page']);
|
||||
fetch({});
|
||||
index++;
|
||||
|
||||
|
|
|
@ -246,6 +246,7 @@ globals:
|
|||
mailForwarding: Mail forwarding
|
||||
mailAlias: Mail alias
|
||||
privileges: Privileges
|
||||
labeler: Labeler
|
||||
created: Created
|
||||
worker: Worker
|
||||
now: Now
|
||||
|
|
|
@ -248,6 +248,7 @@ globals:
|
|||
components: Componentes
|
||||
pictures: Fotos
|
||||
packages: Bultos
|
||||
labeler: Etiquetas
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
now: Ahora
|
||||
|
|
|
@ -24,7 +24,7 @@ const $props = defineProps({
|
|||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const DepartmentDescriptorRef = ref();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
|
@ -55,18 +55,20 @@ const { openConfirmationModal } = useVnConfirm();
|
|||
</script>
|
||||
<template>
|
||||
<CardDescriptor
|
||||
ref="DepartmentDescriptorRef"
|
||||
module="Department"
|
||||
data-key="departmentData"
|
||||
:url="`Departments/${entityId}`"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
:summary="$props.summary"
|
||||
:to-module="{ name: 'WorkerDepartment' }"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
department = data;
|
||||
setData(data);
|
||||
}
|
||||
"
|
||||
data-key="department"
|
||||
>
|
||||
<template #menu="{}">
|
||||
<QItem
|
||||
|
|
|
@ -115,7 +115,6 @@ watch;
|
|||
:subtitle="data.subtitle"
|
||||
@on-fetch="setData"
|
||||
data-key="entry"
|
||||
:summary="$attrs"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<QItem v-ripple clickable @click="showEntryReport(entity)">
|
||||
|
|
|
@ -183,15 +183,10 @@ const fetchEntryBuys = async () => {
|
|||
{{ t('globals.summary.basicData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
|
||||
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
|
||||
|
||||
<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.reference')" :value="entry.reference" />
|
||||
|
||||
<VnLv
|
||||
:label="t('entry.summary.invoiceNumber')"
|
||||
:value="entry.invoiceNumber"
|
||||
|
@ -205,7 +200,6 @@ const fetchEntryBuys = async () => {
|
|||
{{ t('globals.summary.basicData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
|
||||
<VnLv :label="t('entry.summary.travelReference')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
|
@ -214,31 +208,25 @@ const fetchEntryBuys = async () => {
|
|||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelAgency')"
|
||||
:value="entry.travel.agency.name"
|
||||
/>
|
||||
|
||||
<VnLv :label="t('shipped')" :value="toDate(entry.travel.shipped)" />
|
||||
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelWarehouseOut')"
|
||||
:value="entry.travel.warehouseOut.name"
|
||||
/>
|
||||
|
||||
<QCheckbox
|
||||
:label="t('entry.summary.travelDelivered')"
|
||||
v-model="entry.travel.isDelivered"
|
||||
:disable="true"
|
||||
/>
|
||||
<VnLv :label="t('landed')" :value="toDate(entry.travel.landed)" />
|
||||
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelWarehouseIn')"
|
||||
:value="entry.travel.warehouseIn.name"
|
||||
/>
|
||||
|
||||
<QCheckbox
|
||||
:label="t('entry.summary.travelReceived')"
|
||||
v-model="entry.travel.isReceived"
|
||||
|
|
|
@ -63,7 +63,7 @@ const redirectToEntryBasicData = (_, { id }) => {
|
|||
<VnSearchbar
|
||||
url="Entries/filter"
|
||||
custom-route-redirect-name="EntrySummary"
|
||||
data-key="EntrySummary"
|
||||
data-key="Entry"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
|
|
|
@ -98,7 +98,6 @@ const printBuys = (rowId) => {
|
|||
ref="myEntriesRef"
|
||||
data-key="myEntriesList"
|
||||
url="Entries/filter"
|
||||
:order="['landed DESC', 'id DESC']"
|
||||
:columns="columns"
|
||||
default-mode="card"
|
||||
auto-load
|
||||
|
|
|
@ -84,7 +84,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
|
|||
/>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions>
|
||||
<QCardActions class="flex justify-center">
|
||||
<QBtn
|
||||
v-if="entity.client"
|
||||
size="md"
|
||||
|
|
|
@ -14,10 +14,10 @@ const stateStore = useStateStore();
|
|||
const expanded = ref(true);
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
stateStore.leftDrawer = false;
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
onUnmounted(() => (stateStore.leftDrawer = true));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -63,13 +63,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</template>
|
||||
</QExpansionItem>
|
||||
</QCard>
|
||||
<QCard class="full-width q-mb-lg">
|
||||
<QCard class="full-width">
|
||||
<QItem class="justify-between">
|
||||
<QItemLabel class="slider-container">
|
||||
<QItemLabel class="col slider-container">
|
||||
<span class="text-body1"
|
||||
>{{ t('salesMonitor.ticketsMonitor') }}
|
||||
</span>
|
||||
<QCardSection class="col"><SalesTicketsTable /> </QCardSection>
|
||||
<QCardSection class="col" style="padding-inline: 0"
|
||||
><SalesTicketsTable />
|
||||
</QCardSection>
|
||||
</QItemLabel>
|
||||
</QItem>
|
||||
</QCard>
|
||||
|
|
|
@ -3,14 +3,11 @@ import { ref, computed, reactive, watch } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
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 CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -37,9 +34,11 @@ const filter = reactive({
|
|||
},
|
||||
});
|
||||
|
||||
const refetch = async () => await paginateRef.value.fetch();
|
||||
|
||||
watch(dateRange, (val) => {
|
||||
filter.where['v.stamp'].between = val;
|
||||
paginateRef.value.fetch();
|
||||
refetch();
|
||||
});
|
||||
|
||||
function exprBuilder(param, value) {
|
||||
|
@ -53,25 +52,15 @@ function exprBuilder(param, value) {
|
|||
|
||||
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(() => [
|
||||
{
|
||||
label: t('salesClientsTable.date'),
|
||||
name: 'date',
|
||||
name: 'dated',
|
||||
field: 'dated',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
sortable: true,
|
||||
format: (val) => toDateFormat(val),
|
||||
format: (row) => toDateFormat(row.dated),
|
||||
},
|
||||
{
|
||||
label: t('salesClientsTable.hour'),
|
||||
|
@ -86,19 +75,9 @@ const columns = computed(() => [
|
|||
field: 'salesPerson',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'salesPersonFk',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
attrs: {
|
||||
options: workersActiveOptions.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('salesClientsTable.client'),
|
||||
|
@ -106,19 +85,9 @@ const columns = computed(() => [
|
|||
name: 'client',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'clientFk',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
attrs: {
|
||||
options: clientsOptions.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
@ -144,7 +113,7 @@ const columns = computed(() => [
|
|||
@on-fetch="(data) => (clientsOptions = data)"
|
||||
/>
|
||||
<QCard style="max-height: 380px; overflow-y: scroll">
|
||||
<VnPaginate
|
||||
<VnTable
|
||||
ref="paginateRef"
|
||||
data-key="SalesMonitorClients"
|
||||
url="SalesMonitors/clientsFilter"
|
||||
|
@ -155,63 +124,24 @@ const columns = computed(() => [
|
|||
:filter="filter"
|
||||
:offset="50"
|
||||
auto-load
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
default-mode="table"
|
||||
dense
|
||||
:without-header="true"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #top>
|
||||
<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>
|
||||
<span class="link">{{ row.salesPerson }}</span>
|
||||
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="{ row }">
|
||||
<QTd>
|
||||
<span class="link">{{ row.clientName }}</span>
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<template #column-salesPerson="{ row }">
|
||||
<QTd>
|
||||
<span class="link">{{ row.salesPerson }}</span>
|
||||
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
|
||||
</QTd>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
<template #column-client="{ row }">
|
||||
<QTd>
|
||||
<span class="link">{{ row.clientName }}</span>
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
</VnTable>
|
||||
</QCard>
|
||||
</template>
|
||||
|
|
|
@ -5,7 +5,8 @@ import { useI18n } from 'vue-i18n';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.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 { toCurrency } from 'src/filters';
|
||||
|
@ -50,19 +51,22 @@ const columns = computed(() => [
|
|||
name: 'date',
|
||||
field: 'dated',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: t('salesOrdersTable.client'),
|
||||
name: 'client',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: t('salesOrdersTable.salesPerson'),
|
||||
name: 'salesPerson',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -119,79 +123,78 @@ const redirectToOrderSummary = (orderId) => {
|
|||
@on-fetch="(data) => (clientsOptions = data)"
|
||||
/>
|
||||
|
||||
<VnSubToolbar />
|
||||
<QCard style="max-height: 380px; overflow-y: scroll">
|
||||
<VnPaginate
|
||||
<VnTable
|
||||
ref="paginateRef"
|
||||
data-key="SalesMonitorOrders"
|
||||
url="SalesMonitors/ordersFilter"
|
||||
order="date_make DESC"
|
||||
:limit="6"
|
||||
:right-search="false"
|
||||
:expr-builder="exprBuilder"
|
||||
auto-load
|
||||
:columns="columns"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
'hide-bottom': true,
|
||||
}"
|
||||
default-mode="table"
|
||||
:without-header="false"
|
||||
@row-click="(_, row) => redirectToOrderSummary(row.id)"
|
||||
v-model:selected="selectedRows"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedRows"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
@row-click="(_, row) => redirectToOrderSummary(row.id)"
|
||||
<template #top-left>
|
||||
<QBtn
|
||||
v-if="selectedRows.length > 0"
|
||||
icon="delete"
|
||||
size="md"
|
||||
color="primary"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('salesOrdersTable.deleteConfirmTitle'),
|
||||
t('salesOrdersTable.deleteConfirmMessage'),
|
||||
removeOrders
|
||||
)
|
||||
"
|
||||
>
|
||||
<template #top>
|
||||
<QBtn
|
||||
v-if="selectedRows.length > 0"
|
||||
icon="delete"
|
||||
size="md"
|
||||
color="primary"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('salesOrdersTable.deleteConfirmTitle'),
|
||||
t('salesOrdersTable.deleteConfirmMessage'),
|
||||
removeOrders
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
<template #body-cell-date="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:color="getBadgeColor(row.date_send)"
|
||||
text-color="black"
|
||||
class="q-ma-none q-mb-md"
|
||||
dense
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toDateFormat(row.date_send) }}
|
||||
</QBadge>
|
||||
<div>{{ toDateTimeFormat(row.date_make) }}</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="{ row }">
|
||||
<QTd>
|
||||
<div class="q-mb-md">
|
||||
<span class="link">{{ row.clientName }}</span>
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</div>
|
||||
<span> {{ row.agencyName }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-salesPerson="{ row }">
|
||||
<QTd>
|
||||
<div class="q-mb-md">
|
||||
<span class="link">{{ row.salesPerson }}</span>
|
||||
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
|
||||
</div>
|
||||
<span>{{ toCurrency(row.import) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
<template #column-date="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:color="getBadgeColor(row.date_send)"
|
||||
text-color="black"
|
||||
class="q-pa-sm q-mb-md"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toDateFormat(row.date_send) }}
|
||||
</QBadge>
|
||||
<div>{{ toDateTimeFormat(row.date_make) }}</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-client="{ row }">
|
||||
<QTd>
|
||||
<div class="q-mb-md">
|
||||
<span class="link">{{ row.clientName }}</span>
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</div>
|
||||
<span> {{ row.agencyName }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #column-salesPerson="{ row }">
|
||||
<QTd>
|
||||
<div class="q-mb-md">
|
||||
<span class="link">{{ row.salesPerson }}</span>
|
||||
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
|
||||
</div>
|
||||
<span>{{ toCurrency(row.import) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
</VnTable>
|
||||
</QCard>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -6,7 +6,6 @@ import { useRouter } from 'vue-router';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.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 TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.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 VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { toDateFormat, toTimeFormat } from 'src/filters/date.js';
|
||||
|
@ -103,7 +103,10 @@ const columns = computed(() => [
|
|||
name: 'problems',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
columnFilter: false,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.identifier'),
|
||||
|
@ -111,11 +114,10 @@ const columns = computed(() => [
|
|||
field: 'id',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'input',
|
||||
name: 'id',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
|
@ -128,10 +130,8 @@ const columns = computed(() => [
|
|||
field: 'nickname',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'input',
|
||||
name: 'nickname',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
|
@ -144,11 +144,8 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'salesPersonFk',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'select',
|
||||
name: 'salesPersonFk',
|
||||
attrs: {
|
||||
options: workersActiveOptions.value,
|
||||
'option-value': 'id',
|
||||
|
@ -160,14 +157,12 @@ const columns = computed(() => [
|
|||
{
|
||||
label: t('salesTicketsTable.date'),
|
||||
name: 'date',
|
||||
style: { 'max-width': '100px' },
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInputDate,
|
||||
filterParamKey: 'shippedDate',
|
||||
type: 'date',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'date',
|
||||
name: 'shippedDate',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
|
@ -180,6 +175,13 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => toTimeFormat(val),
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
name: 'theoreticalHour',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('salesTicketsTable.practical'),
|
||||
|
@ -188,10 +190,8 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'input',
|
||||
name: 'practicalHour',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
|
@ -204,6 +204,13 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => toTimeFormat(val),
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
name: 'shippedDate',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -211,13 +218,11 @@ const columns = computed(() => [
|
|||
name: 'province',
|
||||
field: 'province',
|
||||
align: 'left',
|
||||
style: { 'max-width': '100px' },
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'provinceFk',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'select',
|
||||
name: 'provinceFk',
|
||||
attrs: {
|
||||
options: provincesOptions.value,
|
||||
'option-value': 'id',
|
||||
|
@ -230,13 +235,11 @@ const columns = computed(() => [
|
|||
label: t('salesTicketsTable.state'),
|
||||
name: 'state',
|
||||
align: 'left',
|
||||
style: { 'max-width': '100px' },
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'stateFk',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'select',
|
||||
name: 'stateFk',
|
||||
attrs: {
|
||||
options: statesOptions.value,
|
||||
'option-value': 'id',
|
||||
|
@ -252,13 +255,13 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
inWhere: 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',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'zoneFk',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'select',
|
||||
name: 'zoneFk',
|
||||
attrs: {
|
||||
options: zonesOptions.value,
|
||||
'option-value': 'id',
|
||||
|
@ -285,21 +285,44 @@ const columns = computed(() => [
|
|||
name: 'total',
|
||||
field: 'totalWithVat',
|
||||
align: 'left',
|
||||
style: { 'max-width': '75px' },
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
component: 'input',
|
||||
name: 'totalWithVat',
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'rowActions',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
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' };
|
||||
return { color: 'transparent', 'text-color': 'white' };
|
||||
};
|
||||
|
||||
let refreshTimer = null;
|
||||
|
||||
const autoRefreshHandler = (value) => {
|
||||
if (value)
|
||||
refreshTimer = setInterval(() => paginateRef.value.fetch(), DEFAULT_AUTO_REFRESH);
|
||||
|
@ -324,8 +349,10 @@ const autoRefreshHandler = (value) => {
|
|||
refreshTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const redirectToTicketSummary = (id) => {
|
||||
router.push({ name: 'TicketSummary', params: { id } });
|
||||
const url = `#/ticket/${id}/summary`;
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
|
||||
const stateColors = {
|
||||
|
@ -348,12 +375,17 @@ const formatShippedDate = (date) => {
|
|||
return toDateFormat(_date);
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
const redirectToSales = (id) => {
|
||||
const url = `#/ticket/${id}/sale`;
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
|
||||
// onMounted(async () => {
|
||||
// const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions');
|
||||
// allColumnNames.value = filteredColumns.map((col) => col.name);
|
||||
// params = fetchParams();
|
||||
// await paginateRef.value.addFilter(null, params);
|
||||
// });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -394,7 +426,7 @@ onMounted(async () => {
|
|||
auto-load
|
||||
@on-fetch="(data) => (zonesOptions = data)"
|
||||
/>
|
||||
<VnPaginate
|
||||
<VnTable
|
||||
ref="paginateRef"
|
||||
data-key="SalesMonitorTickets"
|
||||
url="SalesMonitors/salesFilter"
|
||||
|
@ -403,221 +435,153 @@ onMounted(async () => {
|
|||
:expr-builder="exprBuilder"
|
||||
:user-params="params"
|
||||
:offset="50"
|
||||
:columns="columns"
|
||||
:visible-columns="visibleColumns"
|
||||
:right-search="false"
|
||||
default-mode="table"
|
||||
auto-load
|
||||
@row-click="(_, row) => redirectToTicketSummary(row.id)"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:visible-columns="visibleColumns"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
@row-click="(_, row) => redirectToTicketSummary(row.id)"
|
||||
>
|
||||
<template #top>
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="ticketsMonitor"
|
||||
labels-traductions-path="salesTicketsTable"
|
||||
@on-config-saved="visibleColumns = [...$event, 'rowActions']"
|
||||
/>
|
||||
<QCheckbox
|
||||
v-model="autoRefresh"
|
||||
:label="t('salesTicketsTable.autoRefresh')"
|
||||
@update:model-value="autoRefreshHandler"
|
||||
/>
|
||||
</template>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<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
|
||||
v-if="row.isTaxDataChecked === 0"
|
||||
name="vn:no036"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('salesTicketsTable.noVerifiedData')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasTicketRequest"
|
||||
name="vn:buyrequest"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('salesTicketsTable.purchaseRequest')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.itemShortage"
|
||||
name="vn:unavailable"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.isFreezed"
|
||||
name="vn:frozen"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.risk"
|
||||
name="vn:risk"
|
||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip
|
||||
>{{ t('salesTicketsTable.risk') }}:
|
||||
{{ row.risk }}</QTooltip
|
||||
>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasComponentLack"
|
||||
name="vn:components"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('salesTicketsTable.componentLack')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.isTooLittle"
|
||||
name="vn:isTooLittle"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.tooLittle') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-identifier="{ row }">
|
||||
<QTd>
|
||||
<span class="link" @click.stop.prevent>{{ row.id }}</span>
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="{ row }">
|
||||
<QTd @click.stop.prevent>
|
||||
<span class="link">{{ row.nickname }}</span>
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-salesPerson="{ row }">
|
||||
<QTd @click.stop.prevent>
|
||||
<span class="link">{{ row.userName }}</span>
|
||||
<WorkerDescriptorProxy :id="row.salesPersonFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-date="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
v-bind="getBadgeAttrs(row.shippedDate)"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ formatShippedDate(row.shippedDate) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-state="{ row }">
|
||||
<QTd @click.stop.prevent>
|
||||
<div v-if="row.refFk">
|
||||
<span class="link">{{ row.refFk }}</span>
|
||||
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
||||
</div>
|
||||
<QBadge
|
||||
v-else
|
||||
:color="stateColors[row.classColor] || 'transparent'"
|
||||
:text-color="stateColors[row.classColor] ? 'black' : 'white'"
|
||||
dense
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ row.state }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-isFragile="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
v-if="row.isFragile"
|
||||
name="local_bar"
|
||||
color="primary"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.isFragile') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-zone="{ row }">
|
||||
<QTd @click.stop.prevent>
|
||||
<span class="link">{{ row.zoneName }}</span>
|
||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-total="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:color="totalPriceColor(row) || 'transparent'"
|
||||
:text-color="totalPriceColor(row) ? 'black' : 'white'"
|
||||
dense
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toCurrency(row.totalWithVat) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-rowActions="{ row }">
|
||||
<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 #top-left>
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="ticketsMonitor"
|
||||
labels-traductions-path="salesTicketsTable"
|
||||
@on-config-saved="visibleColumns = [...$event, 'rowActions']"
|
||||
/>
|
||||
<QCheckbox
|
||||
v-model="autoRefresh"
|
||||
:label="t('salesTicketsTable.autoRefresh')"
|
||||
@update:model-value="autoRefreshHandler"
|
||||
/>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
<template #column-problems="{ row }">
|
||||
<QTd class="no-padding" style="max-width: 50px">
|
||||
<QIcon
|
||||
v-if="row.isTaxDataChecked === 0"
|
||||
name="vn:no036"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasTicketRequest"
|
||||
name="vn:buyrequest"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.itemShortage"
|
||||
name="vn:unavailable"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||
<QTooltip>{{ t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.risk"
|
||||
name="vn:risk"
|
||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.risk') }}: {{ row.risk }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasComponentLack"
|
||||
name="vn:components"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.componentLack') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.isTooLittle"
|
||||
name="vn:isTooLittle"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('salesTicketsTable.tooLittle') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-identifier="{ row }">
|
||||
<QTd class="no-padding">
|
||||
<span class="link" @click.stop.prevent>
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-client="{ row }">
|
||||
<QTd class="no-padding" @click.stop.prevent>
|
||||
<span class="link">{{ row.nickname }}</span>
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-salesPerson="{ row }">
|
||||
<QTd class="no-padding" @click.stop.prevent>
|
||||
<span class="link">{{ row.userName }}</span>
|
||||
<WorkerDescriptorProxy :id="row.salesPersonFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-date="{ row }">
|
||||
<QTd class="no-padding">
|
||||
<QBadge
|
||||
v-bind="getBadgeAttrs(row.shippedDate)"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ formatShippedDate(row.shippedDate) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-state="{ row }">
|
||||
<QTd class="no-padding" @click.stop.prevent>
|
||||
<div v-if="row.refFk">
|
||||
<span class="link">{{ row.refFk }}</span>
|
||||
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
||||
</div>
|
||||
<QBadge
|
||||
v-else
|
||||
:color="stateColors[row.classColor] || 'transparent'"
|
||||
:text-color="stateColors[row.classColor] ? 'black' : 'white'"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ row.state }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-isFragile="{ row }">
|
||||
<QTd class="no-padding">
|
||||
<QIcon v-if="row.isFragile" name="local_bar" color="primary" size="sm">
|
||||
<QTooltip>{{ t('salesTicketsTable.isFragile') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-zone="{ row }">
|
||||
<QTd class="no-padding" @click.stop.prevent>
|
||||
<span class="link">{{ row.zoneName }}</span>
|
||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-total="{ row }">
|
||||
<QTd class="no-padding">
|
||||
<QBadge
|
||||
:color="totalPriceColor(row) || 'transparent'"
|
||||
:text-color="totalPriceColor(row) ? 'black' : 'white'"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toCurrency(row.totalWithVat) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
|
|
@ -176,8 +176,6 @@ function confirmRemove(item) {
|
|||
}
|
||||
|
||||
async function remove(item) {
|
||||
console.log('item: ', item);
|
||||
console.log('id: ', route.params.id);
|
||||
await axios.post('OrderRows/removes', {
|
||||
actualOrderId: route.params.id,
|
||||
rows: [item.id],
|
||||
|
|
|
@ -126,7 +126,6 @@ const columns = computed(() => [
|
|||
]);
|
||||
|
||||
async function fetchClientAddress(id, data) {
|
||||
console.log('data: ', data);
|
||||
const clientData = await axios.get(`Clients/${id}`);
|
||||
selectedAddress.value = clientData.data.defaultAddressFk;
|
||||
data.addressId = selectedAddress.value;
|
||||
|
|
|
@ -76,7 +76,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
|
|||
:subtitle="data.subtitle"
|
||||
data-key="routeData"
|
||||
@on-fetch="setData"
|
||||
:summary="$attrs"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('Date')" :value="toDate(entity?.created)" />
|
||||
|
|
|
@ -72,10 +72,7 @@ const columns = computed(() => [
|
|||
label: t('globals.warehouse'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
options: warehouses.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -57,9 +57,13 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
useLike: false,
|
||||
cardVisible: true,
|
||||
|
@ -76,8 +80,10 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
find: {
|
||||
value: 'agencyModeFk',
|
||||
label: 'agencyName',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -91,7 +97,10 @@ const columns = computed(() => [
|
|||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
optionLabel: 'numberPlate',
|
||||
optionValue: 'id',
|
||||
find: {
|
||||
value: 'vehicleFk',
|
||||
label: 'vehiclePlateNumber',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -248,6 +257,7 @@ const openTicketsDialog = (id) => {
|
|||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('Create route'),
|
||||
|
|
|
@ -51,7 +51,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
|
|||
:subtitle="data.subtitle"
|
||||
data-key="Shelvings"
|
||||
@on-fetch="setData"
|
||||
:summary="$attrs"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('shelving.summary.code')" :value="entity.code" />
|
||||
|
|
|
@ -11,18 +11,14 @@ const { t } = useI18n();
|
|||
const route = useRoute();
|
||||
|
||||
const routeName = computed(() => route.name);
|
||||
const searchBarDataKeys = {
|
||||
TicketSummary: 'TicketSummary',
|
||||
TicketSale: 'TicketSale',
|
||||
TicketPurchaseRequest: 'TicketPurchaseRequest',
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Ticket"
|
||||
base-url="Tickets"
|
||||
:filter-panel="TicketFilter"
|
||||
:descriptor="TicketDescriptor"
|
||||
:search-data-key="searchBarDataKeys[routeName]"
|
||||
search-data-key="TicketList"
|
||||
:search-custom-route-redirect="routeName"
|
||||
:searchbar-label="t('card.search')"
|
||||
:searchbar-info="t('card.searchInfo')"
|
||||
|
|
|
@ -626,7 +626,7 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #body-cell-ticketId="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<QBtn flat class="link">
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</QBtn>
|
||||
|
@ -658,7 +658,7 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #body-cell-futureId="{ row }">
|
||||
<QTd class="vertical-separator">
|
||||
<QBtn flat color="primary" dense>
|
||||
<QBtn flat class="link" dense>
|
||||
{{ row.futureId }}
|
||||
<TicketDescriptorProxy :id="row.futureId" />
|
||||
</QBtn>
|
||||
|
|
|
@ -15,11 +15,11 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const workers = ref();
|
||||
const provinces = ref();
|
||||
const states = ref();
|
||||
const agencies = ref();
|
||||
const warehouses = ref();
|
||||
const workers = ref([]);
|
||||
const provinces = ref([]);
|
||||
const states = ref([]);
|
||||
const agencies = ref([]);
|
||||
const warehouses = ref([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -33,7 +33,7 @@ const warehouses = ref();
|
|||
@on-fetch="(data) => (workers = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -442,7 +442,7 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #body-cell-ticketId="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<QBtn flat class="link">
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</QBtn>
|
||||
|
@ -489,7 +489,7 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template #body-cell-futureId="{ row }">
|
||||
<QTd class="vertical-separator">
|
||||
<QBtn flat color="primary" dense>
|
||||
<QBtn flat class="link" dense>
|
||||
{{ row.futureId }}
|
||||
<TicketDescriptorProxy :id="row.futureId" />
|
||||
</QBtn>
|
||||
|
|
|
@ -1,118 +1,311 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate, toCurrency } from 'src/filters/index';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import TicketSummary from './Card/TicketSummary.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import TicketFilter from './TicketFilter.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
const clientsOptions = ref([]);
|
||||
const addressesOptions = ref([]);
|
||||
const agenciesOptions = ref([]);
|
||||
const selectedClient = ref();
|
||||
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'stateFk',
|
||||
label: t('ticketList.state'),
|
||||
columnFilter: {
|
||||
name: 'stateFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'States',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: t('ticketList.id'),
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'nickname',
|
||||
label: t('ticketList.nickname'),
|
||||
isTitle: true,
|
||||
},
|
||||
|
||||
const from = Date.vnNew();
|
||||
const to = Date.vnNew();
|
||||
to.setDate(to.getDate() + 1);
|
||||
{
|
||||
align: 'left',
|
||||
name: 'shipped',
|
||||
cardVisible: true,
|
||||
label: t('ticketList.shipped'),
|
||||
columnFilter: {
|
||||
component: 'date',
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'zoneFk',
|
||||
label: t('ticketList.zone'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Zones',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.zoneName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketList.salesPerson'),
|
||||
name: 'salesPersonFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'salesPerson' },
|
||||
optionFilter: 'firstName',
|
||||
useLike: false,
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'totalWithVat',
|
||||
label: t('ticketList.totalWithVat'),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'number',
|
||||
inWhere: true,
|
||||
},
|
||||
format: (row) => toCurrency(row.totalWithVat),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('ticketList.summary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row.id, TicketSummary),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const userParams = {
|
||||
from: from.toISOString(),
|
||||
to: to.toISOString(),
|
||||
const onClientSelected = async (formData) => {
|
||||
await fetchClient(formData);
|
||||
await fetchAddresses(formData);
|
||||
};
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/ticket/${id}` });
|
||||
}
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
||||
let params = {
|
||||
warehouseFk: formData.warehouseId,
|
||||
addressFk: formData.addressId,
|
||||
landed: formData.landed,
|
||||
};
|
||||
|
||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
||||
|
||||
agenciesOptions.value = data;
|
||||
|
||||
const defaultAgency = agenciesOptions.value.find(
|
||||
(agency) =>
|
||||
agency.agencyModeFk === selectedClient.value.defaultAddress.agencyModeFk
|
||||
);
|
||||
|
||||
if (defaultAgency) formData.agencyModeId = defaultAgency.agencyModeFk;
|
||||
};
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
try {
|
||||
const filter = {
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
fields: ['id', 'agencyModeFk'],
|
||||
},
|
||||
},
|
||||
where: { id: formData.clientId },
|
||||
};
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
const { data } = await axios.get('Clients', { params });
|
||||
const [client] = data;
|
||||
selectedClient.value = client;
|
||||
} catch (err) {
|
||||
console.error('Error fetching client');
|
||||
}
|
||||
};
|
||||
|
||||
const fetchAddresses = async (formData) => {
|
||||
try {
|
||||
if (!formData.clientId) return;
|
||||
|
||||
const filter = {
|
||||
fields: ['nickname', 'street', 'city', 'id'],
|
||||
where: { isActive: true },
|
||||
order: 'nickname ASC',
|
||||
};
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, {
|
||||
params,
|
||||
});
|
||||
addressesOptions.value = data;
|
||||
|
||||
const { defaultAddress } = selectedClient.value;
|
||||
formData.addressId = defaultAddress.id;
|
||||
} catch (err) {
|
||||
console.error(`Error fetching addresses`, err);
|
||||
return err.response;
|
||||
}
|
||||
};
|
||||
const getColor = (row) => {
|
||||
return row?.classColor ? `bg-${row.classColor}` : 'bg-orange';
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="TicketList"
|
||||
data-key="Tickets"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('You can search by ticket id or alias')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TicketFilter data-key="TicketList" />
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Tickets"
|
||||
url="Tickets/filter"
|
||||
:create="{
|
||||
urlCreate: 'Tickets/new',
|
||||
title: t('ticketList.createTicket'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
default-mode="table"
|
||||
:columns="columns"
|
||||
redirect="ticket"
|
||||
auto-load
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Clients"
|
||||
:label="t('ticketList.client')"
|
||||
v-model="data.clientId"
|
||||
:options="clientsOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
@update:model-value="(client) => onClientSelected(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Addresses"
|
||||
:label="t('ticket.create.address')"
|
||||
v-model="data.addressId"
|
||||
:options="addressesOptions"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
hide-selected
|
||||
:disable="!data.clientId"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt.nickname }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `${scope.opt.street}, ${scope.opt.city}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInputDate
|
||||
placeholder="dd-mm-aaa"
|
||||
:label="t('ticket.create.landed')"
|
||||
v-model="data.landed"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
url="Warehouses"
|
||||
:label="t('ticket.create.warehouse')"
|
||||
v-model="data.warehouseId"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('ticket.create.agency')"
|
||||
v-model="data.agencyModeId"
|
||||
:options="agenciesOptions"
|
||||
option-value="agencyModeFk"
|
||||
option-label="agencyMode"
|
||||
hide-selected
|
||||
:disable="!data.clientId || !data.landed || !data.warehouseId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="TicketList"
|
||||
url="Tickets/filter"
|
||||
:user-params="userParams"
|
||||
order="id DESC"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:id="row.id"
|
||||
:title="`${row.nickname}`"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
:label="t('ticket.list.nickname')"
|
||||
:value="row.nickname"
|
||||
/>
|
||||
<VnLv :label="t('ticket.list.state')">
|
||||
<template #value>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="row.classColor ?? 'orange'"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
{{ row.state }}
|
||||
</QBadge>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('ticket.list.shipped')"
|
||||
:value="toDate(row.shipped)"
|
||||
/>
|
||||
<VnLv :label="t('Zone')" :value="row.zoneName" />
|
||||
<VnLv
|
||||
:label="t('ticket.list.salesPerson')"
|
||||
:value="row.salesPerson"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('ticket.list.total')"
|
||||
:value="toCurrency(row.totalWithVat)"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id, TicketSummary)"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn :to="{ name: 'TicketCreate' }" fab icon="add" color="primary">
|
||||
<QTooltip>
|
||||
{{ t('New ticket') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
<template #column-stateFk="{ row }">
|
||||
<QChip :class="getColor(row)" dense square>
|
||||
{{ row.state }}
|
||||
</QChip>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -1,40 +1,28 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, reactive, onUnmounted } from 'vue';
|
||||
import { onMounted, ref, computed, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSelectCache from 'src/components/common/VnSelectCache.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const paginateRef = ref(null);
|
||||
const agencyModesOptions = ref([]);
|
||||
const visibleColumns = ref([]);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const allColumnNames = ref([]);
|
||||
|
||||
const arrayData = useArrayData('WeeklyTickets');
|
||||
const { store } = arrayData;
|
||||
|
||||
const tableRef = ref();
|
||||
const weekdays = [
|
||||
{ id: 0, name: t('weekdays.mon') },
|
||||
{ id: 1, name: t('weekdays.tue') },
|
||||
|
@ -45,113 +33,132 @@ const weekdays = [
|
|||
{ id: 6, name: t('weekdays.sun') },
|
||||
];
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'clientName':
|
||||
return { 'c.name': value };
|
||||
case 'nickName':
|
||||
return { 'u.name': value };
|
||||
}
|
||||
};
|
||||
|
||||
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 getInputEvents = (col) => ({ 'keyup.enter': () => applyColumnFilter(col) });
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'ticketFk',
|
||||
label: t('weeklyTickets.id'),
|
||||
name: 'id',
|
||||
field: 'ticketFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'clientFk',
|
||||
label: t('weeklyTickets.client'),
|
||||
name: 'client',
|
||||
field: 'clientName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
isTitle: true,
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
isWhere: true,
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row) => row.clientName,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'weekDay',
|
||||
label: t('weeklyTickets.shipment'),
|
||||
name: 'shipment',
|
||||
field: 'weekDay',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.agency'),
|
||||
name: 'agency',
|
||||
field: 'agencyModeFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.warehouse'),
|
||||
name: 'warehouse',
|
||||
field: 'warehouseName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('weeklyTickets.salesperson'),
|
||||
field: 'salesperson',
|
||||
name: 'salesperson',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
filterParamKey: 'nickName',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
dense: true,
|
||||
options: weekdays,
|
||||
optionLabel: weekdays.name,
|
||||
optionValue: weekdays.id,
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'actions',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
label: t('weeklyTickets.agency'),
|
||||
name: 'agencyModeFk',
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
alias: 'tw',
|
||||
attrs: {
|
||||
url: 'AgencyModes',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'warehouseFk',
|
||||
label: t('weeklyTickets.warehouse'),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Warehouses',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: t('weeklyTickets.salesperson'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
alias: 'u',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'salesperson' },
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
cardVisible: true,
|
||||
format: (row) => row.userName,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('ticketWeekly.delete'),
|
||||
icon: 'delete',
|
||||
action: (row) =>
|
||||
openConfirmationModal(
|
||||
t('You are going to delete this weekly ticket'),
|
||||
t(
|
||||
'This ticket will be removed from weekly tickets! Continue anyway?'
|
||||
),
|
||||
() => deleteWeekly(row.ticketFk)
|
||||
),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const redirectToTicketSummary = (ticketFk) =>
|
||||
router.push({ name: 'TicketSummary', params: { id: ticketFk } });
|
||||
|
||||
const deleteWeekly = async (ticketFk) => {
|
||||
try {
|
||||
await axios.delete(`TicketWeeklies/${ticketFk}`);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
const ticketIndex = store.data.findIndex((e) => e.ticketFk == ticketFk);
|
||||
store.data.splice(ticketIndex, 1);
|
||||
location.reload();
|
||||
} catch (err) {
|
||||
console.error('Error deleting weekly', err);
|
||||
}
|
||||
|
@ -176,147 +183,61 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes/isActive"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (agencyModesOptions = data)"
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="WeeklyTickets"
|
||||
:label="t('weeklyTickets.search')"
|
||||
:info="t('weeklyTickets.searchInfo')"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="itemsIndex"
|
||||
labels-traductions-path="weeklyTickets"
|
||||
@on-config-saved="visibleColumns = [...$event, 'actions']"
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="WeeklyTickets"
|
||||
url="TicketWeeklies/filter"
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
:use-model="true"
|
||||
:disable-option="{ card: true }"
|
||||
auto-load
|
||||
>
|
||||
<template #column-ticketFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.ticketFk }}
|
||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-weekDay="{ row }">
|
||||
<VnSelect
|
||||
:options="weekdays"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.weekDay"
|
||||
@update:model-value="onUpdate(row.ticketFk, 'weekDay', $event)"
|
||||
/>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<VnPaginate
|
||||
ref="paginateRef"
|
||||
data-key="WeeklyTickets"
|
||||
url="TicketWeeklies/filter"
|
||||
:order="['weekDay', 'ticketFk']"
|
||||
:limit="20"
|
||||
:expr-builder="exprBuilder"
|
||||
:user-params="params"
|
||||
:offset="50"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:visible-columns="visibleColumns"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
@row-click="(_, row) => redirectToTicketSummary(row.ticketFk)"
|
||||
>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<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-id="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.ticketFk }}
|
||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-salesperson="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
{{ row.userName }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary" dense>
|
||||
{{ row.clientName }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-shipment="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnSelect
|
||||
:options="weekdays"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.weekDay"
|
||||
@update:model-value="
|
||||
onUpdate(row.ticketFk, 'weekDay', $event)
|
||||
"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-agency="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnSelect
|
||||
:options="agencyModesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="row.agencyModeFk"
|
||||
@update:model-value="
|
||||
onUpdate(row.ticketFk, 'agencyModeFk', $event)
|
||||
"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('You are going to delete this weekly ticket'),
|
||||
t(
|
||||
'This ticket will be removed from weekly tickets! Continue anyway?'
|
||||
),
|
||||
() => deleteWeekly(row.ticketFk)
|
||||
)
|
||||
"
|
||||
class="q-ml-sm cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.delete') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</QPage>
|
||||
<template #column-agencyModeFk="{ row }">
|
||||
<VnSelectCache
|
||||
url="AgencyModes/isActive"
|
||||
:row="row"
|
||||
:find="['agencyModeFk', 'agencyModeName']"
|
||||
v-model="row.agencyModeFk"
|
||||
@update:model-value="onUpdate(row.ticketFk, 'agencyModeFk', $event)"
|
||||
>
|
||||
{{ console.log('row: ', row) }}
|
||||
</VnSelectCache>
|
||||
</template>
|
||||
<template #column-clientFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.clientName }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-id="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.userName }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -225,3 +225,14 @@ package:
|
|||
added: Added
|
||||
addPackage: Add package
|
||||
removePackage: Remove package
|
||||
ticketList:
|
||||
id: Id
|
||||
nickname: Nickname
|
||||
state: State
|
||||
shipped: Shipped
|
||||
zone: Zone
|
||||
salesPerson: Sales person
|
||||
totalWithVat: Total with VAT
|
||||
summary: Summary
|
||||
client: Customer
|
||||
createTicket: Create ticket
|
||||
|
|
|
@ -228,3 +228,14 @@ ticketSaleTracking:
|
|||
Search ticket: Buscar tickets
|
||||
You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
||||
Select lines to see the options: Selecciona líneas para ver las opciones
|
||||
ticketList:
|
||||
id: Id
|
||||
nickname: Alias
|
||||
state: Estado
|
||||
shipped: F. Envío
|
||||
zone: Zona
|
||||
salesPerson: Comercial
|
||||
totalWithVat: Total con IVA
|
||||
summary: Resumen
|
||||
client: Cliente
|
||||
createTicket: Crear ticket
|
||||
|
|
|
@ -5,7 +5,7 @@ import WorkerFilter from '../WorkerFilter.vue';
|
|||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Worker"
|
||||
data-key="Workers"
|
||||
base-url="Workers"
|
||||
:descriptor="WorkerDescriptor"
|
||||
:filter-panel="WorkerFilter"
|
||||
|
|
|
@ -111,7 +111,6 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
:filter="filter"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
:summary="$attrs"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
worker = data;
|
||||
|
@ -145,7 +144,12 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
</QItem>
|
||||
</template>
|
||||
<template #before>
|
||||
<VnImg :id="entityId" collection="user" size="160x160" class="photo">
|
||||
<VnImg
|
||||
:id="parseInt(entityId)"
|
||||
collection="user"
|
||||
size="160x160"
|
||||
class="photo"
|
||||
>
|
||||
<template #error>
|
||||
<div
|
||||
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||
|
@ -182,6 +186,32 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
</template>
|
||||
</VnLv>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions class="flex justify-center">
|
||||
<QBtn
|
||||
:to="{
|
||||
name: 'CustomerCard',
|
||||
params: { id: entity.id },
|
||||
}"
|
||||
size="md"
|
||||
icon="vn:Person"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Go to client') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:to="{
|
||||
name: 'AccountCard',
|
||||
params: { id: entity.user.id },
|
||||
}"
|
||||
size="md"
|
||||
icon="face"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Go to user') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -372,15 +372,15 @@ const showReasonForm = () => {
|
|||
const updateWorkerTimeControlMail = async (state, reason) => {
|
||||
try {
|
||||
const params = {
|
||||
workerId: Number(route.params.id),
|
||||
year: selectedDate.value.getFullYear(),
|
||||
week: selectedWeekNumber.value,
|
||||
state,
|
||||
};
|
||||
const workerId = Number(route.params.id);
|
||||
|
||||
if (reason) params.reason = reason;
|
||||
|
||||
await axios.post('WorkerTimeControls/updateWorkerTimeControlMail', params);
|
||||
await axios.post(`WorkerTimeControls/${workerId}/updateMailState`, params);
|
||||
await getMailStates(selectedDate.value);
|
||||
await fetchWeekData();
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
|
@ -410,7 +410,7 @@ const resendEmail = async () => {
|
|||
workerId: Number(route.params.id),
|
||||
state: 'SENDED',
|
||||
};
|
||||
await axios.post('WorkerTimeControls/weekly-hour-hecord-email', params);
|
||||
await axios.post('WorkerTimeControls/weekly-hour-record-email', params);
|
||||
await getMailStates(selectedDate.value);
|
||||
notify(t('Email sended'), 'positive');
|
||||
} catch (err) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
|
||||
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
|
@ -139,7 +138,9 @@ const paintWorkWeeks = async () => {
|
|||
show-work-weeks
|
||||
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
|
||||
:selected-dates="selectedDates"
|
||||
:min-weekday-label="1"
|
||||
:locale="locale"
|
||||
animated
|
||||
mini-mode
|
||||
enable-outside-days
|
||||
class="q-py-sm"
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useRoute } from 'vue-router';
|
|||
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
entryId: {
|
||||
|
@ -37,8 +37,8 @@ const entryDirections = [
|
|||
|
||||
const closeButton = ref(null);
|
||||
|
||||
const onDataSaved = () => {
|
||||
emit('onDataSaved');
|
||||
const onDataSaved = (dataSaved) => {
|
||||
emit('onDataSaved', dataSaved);
|
||||
closeForm();
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ onBeforeMount(() => {
|
|||
:default-actions="false"
|
||||
:title="title"
|
||||
:url-create="urlCreate"
|
||||
@on-data-saved="onDataSaved()"
|
||||
@on-data-saved="onDataSaved"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnInputTime
|
||||
|
@ -91,7 +91,6 @@ onBeforeMount(() => {
|
|||
option-value="code"
|
||||
option-label="description"
|
||||
hide-selected
|
||||
:required="true"
|
||||
/>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
|
|
|
@ -1,86 +1,297 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import WorkerSummary from './Card/WorkerSummary.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import WorkerFilter from './WorkerFilter.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import WorkerSummary from './Card/WorkerSummary.vue';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnRadio from 'src/components/common/VnRadio.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const companiesOptions = ref([]);
|
||||
const workersOptions = ref([]);
|
||||
const payMethodsOptions = ref([]);
|
||||
const bankEntitiesOptions = ref([]);
|
||||
const postcodesOptions = ref([]);
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/worker/${id}` });
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: t('tableColumns.id'),
|
||||
columnFilter: {
|
||||
alias: 'w',
|
||||
inWhere: true,
|
||||
},
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'nickname',
|
||||
label: t('tableColumns.name'),
|
||||
isTitle: true,
|
||||
columnFilter: {
|
||||
name: 'search',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'departmentFk',
|
||||
label: t('tableColumns.department'),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
inWhere: true,
|
||||
alias: 'wd',
|
||||
attrs: {
|
||||
url: 'Departments',
|
||||
},
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.department),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'email',
|
||||
label: t('tableColumns.email'),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
alias: 'mu',
|
||||
inWhere: true,
|
||||
},
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('InvoiceOutSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row.id, WorkerSummary),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postcode = code;
|
||||
data.city = town;
|
||||
data.provinceFk = provinceFk;
|
||||
data.countryFk = countryFk;
|
||||
}
|
||||
|
||||
const redirectToCreateView = () => {
|
||||
router.push({ name: 'WorkerCreate' });
|
||||
};
|
||||
function uppercaseStreetModel(data) {
|
||||
return {
|
||||
get: () => (data.street ? data.street.toUpperCase() : ''),
|
||||
set: (value) => {
|
||||
data.street = value.toUpperCase();
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="WorkerList"
|
||||
data-key="Worker"
|
||||
:label="t('Search worker')"
|
||||
:info="t('You can search by worker id or name')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<WorkerFilter data-key="WorkerList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="WorkerList"
|
||||
url="Workers/filter"
|
||||
order="id DESC"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:id="row.id"
|
||||
:title="row.nickname"
|
||||
@click="navigate(row.id)"
|
||||
<FetchData
|
||||
url="Companies"
|
||||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Workers/search"
|
||||
@on-fetch="(data) => (workersOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Paymethods"
|
||||
@on-fetch="(data) => (payMethodsOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="BankEntities"
|
||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Worker"
|
||||
url="Workers/filter"
|
||||
:create="{
|
||||
urlCreate: 'Workers/new',
|
||||
title: t('Create worker'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {
|
||||
isFreelance: false,
|
||||
},
|
||||
}"
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
redirect="worker"
|
||||
auto-load
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<div class="q-pa-lg full-width" style="max-width: 1200px">
|
||||
<VnRadio
|
||||
v-model="data.isFreelance"
|
||||
:val="false"
|
||||
:label="`${t('Internal')}`"
|
||||
@update:model-value="data.payMethodFk = defaultPayMethod"
|
||||
/>
|
||||
<VnRadio
|
||||
v-model="data.isFreelance"
|
||||
:val="true"
|
||||
:label="`${t('External')}`"
|
||||
@update:model-value="delete data.payMethodFk"
|
||||
/>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.firstName" :label="t('worker.create.name')" />
|
||||
<VnInput
|
||||
v-model="data.lastNames"
|
||||
:label="t('worker.create.lastName')"
|
||||
/>
|
||||
<VnInput v-model="data.code" :label="t('worker.create.code')" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.name" :label="t('worker.create.webUser')" />
|
||||
<VnInput
|
||||
v-model="data.email"
|
||||
:label="t('worker.create.personalEmail')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('worker.create.company')"
|
||||
v-model="data.companyFk"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
hide-selected
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('worker.create.boss')"
|
||||
v-model="data.bossFk"
|
||||
:options="workersOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv :label="t('worker.list.name')" :value="row.userName" />
|
||||
<VnLv :label="t('worker.list.email')" :value="row.email" />
|
||||
<VnLv
|
||||
:label="t('worker.list.department')"
|
||||
:value="row.department"
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt.nickname }},
|
||||
{{ scope.opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.fi" :label="t('worker.create.fi')" />
|
||||
<VnInputDate
|
||||
v-model="data.birth"
|
||||
:label="t('worker.create.birth')"
|
||||
:disable="data.isFreelance"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.phone"
|
||||
:label="t('worker.create.phone')"
|
||||
:disable="data.isFreelance"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnLocation
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
:options="postcodesOptions"
|
||||
v-model="data.location"
|
||||
@update:model-value="(location) => handleLocation(data, location)"
|
||||
:disable="data.isFreelance"
|
||||
>
|
||||
</VnLocation>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('worker.create.street')"
|
||||
:model-value="uppercaseStreetModel(data).get()"
|
||||
@update:model-value="uppercaseStreetModel(data).set"
|
||||
:disable="data.isFreelance"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('worker.create.payMethods')"
|
||||
v-model="data.payMethodFk"
|
||||
:options="payMethodsOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
map-options
|
||||
hide-selected
|
||||
:disable="data.isFreelance"
|
||||
@update:model-value="(val) => !val && delete data.payMethodFk"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.iban"
|
||||
:label="t('worker.create.iban')"
|
||||
:disable="data.isFreelance"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelectDialog
|
||||
:label="t('worker.create.bankEntity')"
|
||||
v-model="data.bankEntityFk"
|
||||
:options="bankEntitiesOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
hide-selected
|
||||
:roles-allowed-to-create="['salesAssistant', 'hr']"
|
||||
:disable="data.isFreelance"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
@on-data-saved="(data) => bankEntitiesOptions.push(data)"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
outline
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id, WorkerSummary)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection v-if="scope.opt">
|
||||
<QItemLabel
|
||||
>{{ scope.opt.bic }}
|
||||
{{ scope.opt.name }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
||||
<QTooltip>
|
||||
{{ t('worker.list.newWorker') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
</div>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
|
||||
tableColumns:
|
||||
id: ID
|
||||
name: Name
|
||||
department: Department
|
||||
email: Email
|
||||
|
|
|
@ -4,3 +4,8 @@ Locker: Taquilla
|
|||
Internal: Interno
|
||||
External: Externo
|
||||
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
|
||||
tableColumns:
|
||||
id: ID
|
||||
name: Nombre
|
||||
department: Departamento
|
||||
email: Email
|
||||
|
|
|
@ -52,7 +52,6 @@ const setData = (entity) => {
|
|||
:filter="filter"
|
||||
@on-fetch="setData"
|
||||
data-key="zoneData"
|
||||
:summary="$attrs"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<ZoneDescriptorMenuItems :zone="entity" />
|
||||
|
|
|
@ -104,6 +104,25 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'WorkerTimeControl',
|
||||
path: 'time-control',
|
||||
meta: {
|
||||
title: 'timeControl',
|
||||
icon: 'access_time',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerCalendar',
|
||||
path: 'calendar',
|
||||
meta: {
|
||||
title: 'calendar',
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerCalendar.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerPda',
|
||||
path: 'pda',
|
||||
|
@ -150,25 +169,6 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerLog.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerCalendar',
|
||||
path: 'calendar',
|
||||
meta: {
|
||||
title: 'calendar',
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerCalendar.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerTimeControl',
|
||||
path: 'time-control',
|
||||
meta: {
|
||||
title: 'timeControl',
|
||||
icon: 'access_time',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerLocker',
|
||||
path: 'locker',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
describe('WorkerCreate', () => {
|
||||
const externalRadio = '.q-toolbar .q-radio:nth-child(2)';
|
||||
const externalRadio = '.q-radio:nth-child(2)';
|
||||
const notification = '.q-notification__message';
|
||||
const developerBossId = 120;
|
||||
|
||||
|
@ -9,12 +9,13 @@ describe('WorkerCreate', () => {
|
|||
Name: { val: 'Manolo' },
|
||||
'Last name': { val: 'Hurtado' },
|
||||
'Personal email': { val: 'manolo@mydomain.com' },
|
||||
Company: { val: 'VNL', type: 'select' },
|
||||
Street: { val: 'S/ DEFAULTWORKERSTREET' },
|
||||
Location: { val: 1, type: 'select' },
|
||||
Phone: { val: '123456789' },
|
||||
'Worker code': { val: 'DWW' },
|
||||
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 = {
|
||||
Fi: { val: 'Z4531219V' },
|
||||
|
@ -29,16 +30,14 @@ describe('WorkerCreate', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('hr');
|
||||
cy.visit('/#/worker/create');
|
||||
cy.visit('/#/worker/list');
|
||||
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||
});
|
||||
|
||||
it('should throw an error if a pay method has not been selected', () => {
|
||||
cy.fillInForm(internal);
|
||||
cy.saveCard();
|
||||
cy.get(notification).should(
|
||||
'contains.text',
|
||||
'That payment method requires an IBAN'
|
||||
);
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
cy.get(notification).should('contains.text', 'Payment method is required');
|
||||
});
|
||||
|
||||
it('should create an internal', () => {
|
||||
|
@ -46,14 +45,14 @@ describe('WorkerCreate', () => {
|
|||
...internal,
|
||||
'Pay method': { val: 'PayMethod one', type: 'select' },
|
||||
});
|
||||
cy.saveCard();
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
cy.get(notification).should('contains.text', 'Data created');
|
||||
});
|
||||
|
||||
it('should create an external', () => {
|
||||
cy.get(externalRadio).click();
|
||||
cy.fillInForm(external);
|
||||
cy.saveCard();
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
cy.get(notification).should('contains.text', 'Data created');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
describe('WorkerList', () => {
|
||||
const workerFieldNames =
|
||||
'.card-list-body > .list-items > :nth-child(1) > .value > span';
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit('/#/worker/list');
|
||||
});
|
||||
|
||||
it('should load workers', () => {
|
||||
cy.get(workerFieldNames).eq(2).should('have.text', 'jessicajones');
|
||||
cy.get(workerFieldNames).eq(3).should('have.text', 'brucebanner');
|
||||
cy.get(workerFieldNames).eq(4).should('have.text', 'charlesxavier');
|
||||
});
|
||||
|
||||
it('should open the worker summary', () => {
|
||||
cy.openListSummary(2);
|
||||
cy.get('.summaryHeader div').should('have.text', '1110 - Jessica Jones');
|
||||
cy.get('.summary .header-link')
|
||||
.eq(0)
|
||||
.invoke('text')
|
||||
.should('include', 'Basic data');
|
||||
cy.get('.summary .header-link').eq(2).should('have.text', 'User data ');
|
||||
cy.get('.bg-header > :nth-child(2) > .full-width > :nth-child(1) >').type(
|
||||
'jessica jones{enter}'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -87,7 +87,6 @@ Cypress.Commands.add('selectOption', (selector, option) => {
|
|||
});
|
||||
|
||||
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.get(`${form} input`).each(([el]) => {
|
||||
cy.wrap(el)
|
||||
|
@ -96,17 +95,14 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
|||
const field = obj[ariaLabel];
|
||||
if (!field) return;
|
||||
|
||||
const { type, val, day } = field;
|
||||
const { type, val } = field;
|
||||
switch (type) {
|
||||
case 'select':
|
||||
cy.wrap(el).type(val);
|
||||
cy.get('.q-menu .q-item').contains(val).click();
|
||||
break;
|
||||
case 'date':
|
||||
cy.wrap(el).click();
|
||||
cy.get(days)
|
||||
.eq(day ? day - 1 : 0)
|
||||
.click();
|
||||
cy.wrap(el).type(val.split('-').join(''));
|
||||
break;
|
||||
default:
|
||||
cy.wrap(el).type(val);
|
||||
|
|
Loading…
Reference in New Issue