0
0
Fork 0

Merge branch 'dev' into feature/SaleTracking

This commit is contained in:
Alex Moreno 2024-07-15 08:17:01 +00:00
commit cc8062785a
56 changed files with 1057 additions and 686 deletions

View File

@ -5,6 +5,7 @@ import { dashIfEmpty } from 'src/filters';
/* basic input */ /* basic input */
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnSelectCache from 'components/common/VnSelectCache.vue';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnComponent from 'components/common/VnComponent.vue'; import VnComponent from 'components/common/VnComponent.vue';
@ -41,6 +42,17 @@ const $props = defineProps({
}, },
}); });
const defaultSelect = {
attrs: {
row: $props.row,
disable: !$props.isEditable,
class: 'fit',
},
forceAttrs: {
label: $props.showLabel && $props.column.label,
},
};
const defaultComponents = { const defaultComponents = {
input: { input: {
component: markRaw(VnInput), component: markRaw(VnInput),
@ -94,14 +106,12 @@ const defaultComponents = {
}, },
}, },
select: { select: {
component: markRaw(VnSelectCache),
...defaultSelect,
},
rawSelect: {
component: markRaw(VnSelect), component: markRaw(VnSelect),
attrs: { ...defaultSelect,
disable: !$props.isEditable,
class: 'fit',
},
forceAttrs: {
label: $props.showLabel && $props.column.label,
},
}, },
icon: { icon: {
component: markRaw(QIcon), component: markRaw(QIcon),

View File

@ -139,14 +139,11 @@ const showFilter = computed(
</script> </script>
<template> <template>
<div <div
v-if="showTitle" v-if="showFilter"
class="q-pt-sm q-px-sm ellipsis" class="full-width"
:class="`text-${column?.align ?? 'left'}`" :class="alignRow()"
:style="!showFilter ? { 'min-height': 72 + 'px' } : ''" style="max-height: 45px; overflow: hidden"
> >
{{ column?.label }}
</div>
<div v-if="showFilter" class="full-width" :class="alignRow()">
<VnTableColumn <VnTableColumn
:column="$props.column" :column="$props.column"
default="input" default="input"

View File

@ -0,0 +1,95 @@
<script setup>
import { ref } from 'vue';
import { useArrayData } from 'composables/useArrayData';
const model = defineModel({ type: Object, required: true });
const $props = defineProps({
name: {
type: String,
default: '',
},
label: {
type: String,
default: undefined,
},
dataKey: {
type: String,
required: true,
},
searchUrl: {
type: String,
default: 'params',
},
vertical: {
type: Boolean,
default: false,
},
});
const hover = ref();
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
async function orderBy(name, direction) {
if (!name) return;
switch (direction) {
case 'DESC':
direction = undefined;
break;
case undefined:
direction = 'ASC';
break;
case 'ASC':
direction = 'DESC';
break;
}
if (!direction) return await arrayData.deleteOrder(name);
await arrayData.addOrder(name, direction);
}
defineExpose({ orderBy });
</script>
<template>
<div
@mouseenter="hover = true"
@mouseleave="hover = false"
@click="orderBy(name, model?.direction)"
class="row items-center no-wrap cursor-pointer"
>
<span :title="label">{{ label }}</span>
<QChip
v-if="name"
:label="!vertical && model?.index"
:icon="
(model?.index || hover) && !vertical
? model?.direction == 'DESC'
? 'arrow_downward'
: 'arrow_upward'
: undefined
"
:size="vertical ? '' : 'sm'"
:class="[
model?.index ? 'color-vn-text' : 'bg-transparent',
vertical ? 'q-px-none' : '',
]"
class="no-box-shadow"
:clickable="true"
style="min-width: 40px"
>
<div
class="column flex-center"
v-if="vertical"
:style="!model?.index && 'color: #5d5d5d'"
>
{{ model?.index }}
<QIcon
:name="
model?.index
? model?.direction == 'DESC'
? 'arrow_downward'
: 'arrow_upward'
: 'swap_vert'
"
size="xs"
/>
</div>
</QChip>
</div>
</template>

View File

@ -13,7 +13,8 @@ import VnLv from 'components/ui/VnLv.vue';
import VnTableColumn from 'components/VnTable/VnColumn.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue';
import VnTableFilter from 'components/VnTable/VnFilter.vue'; import VnTableFilter from 'components/VnTable/VnFilter.vue';
import VnTableChip from 'components/VnTable/VnChip.vue'; import VnTableChip from 'components/VnTable/VnChip.vue';
import TableVisibleColumns from 'src/components/VnTable/VnVisibleColumn.vue'; import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
const $props = defineProps({ const $props = defineProps({
columns: { columns: {
@ -22,7 +23,7 @@ const $props = defineProps({
}, },
defaultMode: { defaultMode: {
type: String, type: String,
default: 'card', // 'table', 'card' default: 'table', // 'table', 'card'
}, },
columnSearch: { columnSearch: {
type: Boolean, type: Boolean,
@ -68,6 +69,10 @@ const $props = defineProps({
type: Object, type: Object,
default: () => ({ card: false, table: false }), default: () => ({ card: false, table: false }),
}, },
withoutHeader: {
type: Boolean,
default: false,
},
tableCode: { tableCode: {
type: String, type: String,
default: null, default: null,
@ -89,9 +94,11 @@ const mode = ref(DEFAULT_MODE);
const selected = ref([]); const selected = ref([]);
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}'); const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
const params = ref({ ...routeQuery, ...routeQuery.filter?.where }); const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
const orders = ref(parseOrder(routeQuery.filter?.order));
const CrudModelRef = ref({}); const CrudModelRef = ref({});
const showForm = ref(false); const showForm = ref(false);
const splittedColumns = ref({ columns: [] }); const splittedColumns = ref({ columns: [] });
const columnsVisibilitySkiped = ref();
const tableModes = [ const tableModes = [
{ {
icon: 'view_column', icon: 'view_column',
@ -111,6 +118,12 @@ onMounted(() => {
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode; mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode;
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
setUserParams(route.query[$props.searchUrl]); setUserParams(route.query[$props.searchUrl]);
columnsVisibilitySkiped.value = [
...splittedColumns.value.columns
.filter((c) => c.visible == false)
.map((c) => c.name),
...['tableActions'],
];
}); });
watch( watch(
@ -136,10 +149,15 @@ function setUserParams(watchedParams) {
if (!watchedParams) return; if (!watchedParams) return;
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
const where = JSON.parse(watchedParams?.filter)?.where; const filter = JSON.parse(watchedParams?.filter);
const where = filter?.where;
const order = filter?.order;
watchedParams = { ...watchedParams, ...where }; watchedParams = { ...watchedParams, ...where };
delete watchedParams.filter; delete watchedParams.filter;
delete params.value?.filter;
params.value = { ...params.value, ...watchedParams }; params.value = { ...params.value, ...watchedParams };
orders.value = parseOrder(order);
} }
function splitColumns(columns) { function splitColumns(columns) {
@ -147,7 +165,7 @@ function splitColumns(columns) {
columns: [], columns: [],
chips: [], chips: [],
create: [], create: [],
visible: [], cardVisible: [],
}; };
for (const col of columns) { for (const col of columns) {
@ -155,7 +173,7 @@ function splitColumns(columns) {
if (col.chip) splittedColumns.value.chips.push(col); if (col.chip) splittedColumns.value.chips.push(col);
if (col.isTitle) splittedColumns.value.title = col; if (col.isTitle) splittedColumns.value.title = col;
if (col.create) splittedColumns.value.create.push(col); if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.visible.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false; if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true }; if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true };
splittedColumns.value.columns.push(col); splittedColumns.value.columns.push(col);
@ -171,6 +189,7 @@ function splitColumns(columns) {
label: t('status'), label: t('status'),
name: 'tableStatus', name: 'tableStatus',
columnFilter: false, columnFilter: false,
orderBy: false,
}); });
} }
} }
@ -199,6 +218,17 @@ function getColAlign(col) {
return 'text-' + (col.align ?? 'left'); return 'text-' + (col.align ?? 'left');
} }
function parseOrder(urlOrders) {
const orderObject = {};
if (!urlOrders) return orderObject;
if (typeof urlOrders == 'string') urlOrders = [urlOrders];
for (const [index, orders] of urlOrders.entries()) {
const [name, direction] = orders.split(' ');
orderObject[name] = { direction, index: index + 1 };
}
return orderObject;
}
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
defineExpose({ defineExpose({
reload, reload,
@ -224,20 +254,31 @@ defineExpose({
:redirect="!!redirect" :redirect="!!redirect"
> >
<template #body> <template #body>
<VnTableFilter <div
:column="col" class="row no-wrap flex-center"
:data-key="$attrs['data-key']"
v-for="col of splittedColumns.columns" v-for="col of splittedColumns.columns"
:key="col.id" :key="col.id"
v-model="params[columnName(col)]" >
:search-url="searchUrl" <VnTableFilter
:column="col"
:data-key="$attrs['data-key']"
v-model="params[columnName(col)]"
:search-url="searchUrl"
/>
<VnTableOrder
v-model="orders[col.name]"
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
:vertical="true"
/>
</div>
<slot
name="moreFilterPanel"
:params="params"
:columns="splittedColumns.columns"
/> />
</template> </template>
<slot
name="moreFilterPanel"
:params="params"
:columns="splittedColumns.columns"
/>
</VnFilterPanel> </VnFilterPanel>
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
@ -280,14 +321,15 @@ defineExpose({
@row-click="(_, row) => rowClickFunction(row)" @row-click="(_, row) => rowClickFunction(row)"
@update:selected="emit('update:selected', $event)" @update:selected="emit('update:selected', $event)"
> >
<template #top-left> <template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"></slot> <slot name="top-left"></slot>
</template> </template>
<template #top-right> <template #top-right>
<TableVisibleColumns <VnVisibleColumn
v-if="isTableMode" v-if="isTableMode"
v-model="splittedColumns.columns" v-model="splittedColumns.columns"
:table-code="tableCode ?? route.name" :table-code="tableCode ?? route.name"
:skip="columnsVisibilitySkiped"
/> />
<QBtnToggle <QBtnToggle
v-model="mode" v-model="mode"
@ -306,18 +348,33 @@ defineExpose({
/> />
</template> </template>
<template #header-cell="{ col }"> <template #header-cell="{ col }">
<QTh <QTh v-if="col.visible ?? true" auto-width>
auto-width <div
style="min-width: 100px" class="column self-start q-ml-xs ellipsis"
v-if="$props.columnSearch && col.visible" :class="`text-${col?.align ?? 'left'}`"
> style="height: 75px"
<VnTableFilter >
:column="col" <div
:show-title="true" class="row items-center no-wrap"
:data-key="$attrs['data-key']" style="height: 30px"
v-model="params[columnName(col)]" >
:search-url="searchUrl" <VnTableOrder
/> v-model="orders[col.name]"
:name="col.orderBy ?? col.name"
:label="col?.label"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
/>
</div>
<VnTableFilter
v-if="$props.columnSearch"
:column="col"
:show-title="true"
:data-key="$attrs['data-key']"
v-model="params[columnName(col)]"
:search-url="searchUrl"
/>
</div>
</QTh> </QTh>
</template> </template>
<template #header-cell-tableActions> <template #header-cell-tableActions>
@ -340,8 +397,8 @@ defineExpose({
<QTd <QTd
auto-width auto-width
class="no-margin q-px-xs" class="no-margin q-px-xs"
:class="getColAlign(col)" :class="[getColAlign(col), col.class, col.columnField?.class]"
v-if="col.visible" v-if="col.visible ?? true"
> >
<slot :name="`column-${col.name}`" :col="col" :row="row"> <slot :name="`column-${col.name}`" :col="col" :row="row">
<VnTableColumn <VnTableColumn
@ -430,7 +487,7 @@ defineExpose({
:class="$props.cardClass" :class="$props.cardClass"
> >
<div <div
v-for="col of splittedColumns.visible" v-for="col of splittedColumns.cardVisible"
:key="col.name" :key="col.name"
class="fields" class="fields"
> >
@ -544,6 +601,10 @@ es:
color: var(--vn-text-color); color: var(--vn-text-color);
} }
.color-vn-text {
color: var(--vn-text-color);
}
.q-table--dark .q-table__bottom, .q-table--dark .q-table__bottom,
.q-table--dark thead, .q-table--dark thead,
.q-table--dark tr, .q-table--dark tr,

View File

@ -12,6 +12,10 @@ const $props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
skip: {
type: Array,
default: () => [],
},
}); });
const { notify } = useNotify(); const { notify } = useNotify();
@ -30,8 +34,12 @@ function setUserConfigViewData(data, isLocal) {
if (!data) return; if (!data) return;
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config // Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
if (!isLocal) localColumns.value = []; if (!isLocal) localColumns.value = [];
// Array to Object
const skippeds = $props.skip.reduce((a, v) => ({ ...a, [v]: v }), {});
for (let column of columns.value) { for (let column of columns.value) {
const { label, name } = column; const { label, name } = column;
if (skippeds[name]) continue;
column.visible = data[name] ?? true; column.visible = data[name] ?? true;
if (!isLocal) localColumns.value.push({ name, label, visible: column.visible }); if (!isLocal) localColumns.value.push({ name, label, visible: column.visible });
} }
@ -127,7 +135,7 @@ onMounted(async () => {
}); });
</script> </script>
<template> <template>
<QBtn icon="vn:visible_columns" class="bg-vn-section-color q-mr-md" dense> <QBtn icon="vn:visible_columns" class="bg-vn-section-color q-mr-md q-px-sm" dense>
<QPopupProxy ref="popupProxyRef"> <QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md"> <QCard class="column q-pa-md">
<QIcon name="info" size="sm" class="info-icon"> <QIcon name="info" size="sm" class="info-icon">

View File

@ -18,7 +18,7 @@ watchEffect(() => {
(matched) => Object.keys(matched.meta).length (matched) => Object.keys(matched.meta).length
); );
breadcrumbs.value.length = 0; breadcrumbs.value.length = 0;
if (!matched.value[0]) return;
if (matched.value[0].name != 'Dashboard') { if (matched.value[0].name != 'Dashboard') {
root.value = useCamelCase(matched.value[0].path.substring(1).toLowerCase()); root.value = useCamelCase(matched.value[0].path.substring(1).toLowerCase());

View File

@ -75,6 +75,7 @@ const myOptions = ref([]);
const myOptionsOriginal = ref([]); const myOptionsOriginal = ref([]);
const vnSelectRef = ref(); const vnSelectRef = ref();
const dataRef = ref(); const dataRef = ref();
const lastVal = ref();
const value = computed({ const value = computed({
get() { get() {
@ -85,14 +86,31 @@ const value = computed({
}, },
}); });
watch(options, (newValue) => {
setOptions(newValue);
});
watch(modelValue, (newValue) => {
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
fetchFilter(newValue);
});
onMounted(() => {
setOptions(options.value);
if ($props.url && $props.modelValue && !findKeyInOptions())
fetchFilter($props.modelValue);
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
function findKeyInOptions() {
if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length;
}
function setOptions(data) { function setOptions(data) {
myOptions.value = JSON.parse(JSON.stringify(data)); myOptions.value = JSON.parse(JSON.stringify(data));
myOptionsOriginal.value = JSON.parse(JSON.stringify(data)); myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
} }
onMounted(() => {
setOptions(options.value);
if ($props.url && $props.modelValue) fetchFilter($props.modelValue);
});
function filter(val, options) { function filter(val, options) {
const search = val.toString().toLowerCase(); const search = val.toString().toLowerCase();
@ -125,15 +143,21 @@ async function fetchFilter(val) {
const defaultWhere = $props.useLike const defaultWhere = $props.useLike
? { [key]: { like: `%${val}%` } } ? { [key]: { like: `%${val}%` } }
: { [key]: val }; : { [key]: val };
const where = { ...defaultWhere, ...$props.where }; const where = { ...(val ? defaultWhere : {}), ...$props.where };
const fetchOptions = { where, order: sortBy, limit }; const fetchOptions = { where, order: sortBy, limit };
if (fields) fetchOptions.fields = fields; if (fields) fetchOptions.fields = fields;
return dataRef.value.fetch(fetchOptions); return dataRef.value.fetch(fetchOptions);
} }
async function filterHandler(val, update) { async function filterHandler(val, update) {
if (!$props.defaultFilter) return update(); if (!val && lastVal.value === val) {
lastVal.value = val;
return update();
}
lastVal.value = val;
let newOptions; let newOptions;
if (!$props.defaultFilter) return update();
if ($props.url) { if ($props.url) {
newOptions = await fetchFilter(val); newOptions = await fetchFilter(val);
} else newOptions = filter(val, myOptionsOriginal.value); } else newOptions = filter(val, myOptionsOriginal.value);
@ -149,19 +173,6 @@ async function filterHandler(val, update) {
} }
); );
} }
watch(options, (newValue) => {
setOptions(newValue);
});
watch(modelValue, (newValue) => {
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
fetchFilter(newValue);
});
onMounted(async () => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
</script> </script>
<template> <template>

View File

@ -0,0 +1,25 @@
<script setup>
import { ref, onBeforeMount, useAttrs } from 'vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const $props = defineProps({
row: {
type: [Object],
default: null,
},
find: {
type: String,
default: null,
},
});
const options = ref([]);
onBeforeMount(async () => {
const { url } = useAttrs();
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
if (findBy) options.value = [$props.row[findBy]];
});
</script>
<template>
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
</template>

View File

@ -56,7 +56,12 @@ onBeforeMount(async () => {
skip: 0, skip: 0,
}); });
store = arrayData.store; store = arrayData.store;
entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data)); entity = computed(() => {
const data = (Array.isArray(store.data) ? store.data[0] : store.data) ?? {};
if (data) emit('onFetch', data);
return data;
});
// It enables to load data only once if the module is the same as the dataKey // It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id) await getData(); if (!isSameDataKey.value || !route.params.id) await getData();
watch( watch(
@ -85,9 +90,9 @@ function getValueFromPath(path) {
const keys = path.toString().split('.'); const keys = path.toString().split('.');
let current = entity.value; let current = entity.value;
for (let i = 0; i < keys.length; i++) { for (const key of keys) {
if (current[keys[i]] === undefined) return undefined; if (current[key] === undefined) return undefined;
else current = current[keys[i]]; else current = current[key];
} }
return current; return current;
} }

View File

@ -52,6 +52,10 @@ const dialog = ref(null);
:value="item?.[`value${index + 4}`]" :value="item?.[`value${index + 4}`]"
/> />
</template> </template>
<div v-if="item.minQuantity" class="min-quantity">
<QIcon name="production_quantity_limits" size="xs" />
{{ item.minQuantity }}
</div>
<div class="footer"> <div class="footer">
<div class="price"> <div class="price">
<p v-if="isCatalog"> <p v-if="isCatalog">
@ -133,6 +137,11 @@ const dialog = ref(null);
} }
} }
.min-quantity {
text-align: right;
color: $negative !important;
}
.footer { .footer {
.price { .price {
overflow: hidden; overflow: hidden;

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, onBeforeUnmount, ref, nextTick } from 'vue'; import { onMounted, onBeforeUnmount, ref } from 'vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore(); const stateStore = useStateStore();

View File

@ -24,10 +24,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const searchUrl = store.searchUrl; const searchUrl = store.searchUrl;
if (query[searchUrl]) { if (query[searchUrl]) {
const params = JSON.parse(query[searchUrl]); const params = JSON.parse(query[searchUrl]);
const filter = params?.filter; const filter = params?.filter && JSON.parse(params?.filter ?? '{}');
delete params.filter; delete params.filter;
store.userParams = { ...params, ...store.userParams }; store.userParams = { ...params, ...store.userParams };
store.userFilter = { ...JSON.parse(filter ?? '{}'), ...store.userFilter }; store.userFilter = { ...filter, ...store.userFilter };
if (filter.order) store.order = filter.order;
} }
}); });
@ -69,7 +70,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
canceller = new AbortController(); canceller = new AbortController();
const filter = { const filter = {
order: store.order,
limit: store.limit, limit: store.limit,
}; };
@ -94,6 +94,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
Object.assign(params, userParams); Object.assign(params, userParams);
params.filter.skip = store.skip; params.filter.skip = store.skip;
if (store.order && store.order.length) params.filter.order = store.order;
else delete params.filter.order;
params.filter = JSON.stringify(params.filter); params.filter = JSON.stringify(params.filter);
store.currentFilter = params; store.currentFilter = params;
@ -147,7 +149,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
store.filter = {}; store.filter = {};
if (params) store.userParams = { ...params }; if (params) store.userParams = { ...params };
const response = await fetch({ append: false }); const response = await fetch({});
return response; return response;
} }
@ -160,7 +162,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
store.userParams = userParams; store.userParams = userParams;
arrayDataStore.reset(['skip', 'filter.skip', 'page']); arrayDataStore.reset(['skip', 'filter.skip', 'page']);
await fetch({ append: false }); await fetch({});
return { filter, params }; return { filter, params };
} }
@ -171,6 +173,37 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
await addFilter({ filter: { where } }); await addFilter({ filter: { where } });
} }
async function addOrder(field, direction = 'ASC') {
const newOrder = field + ' ' + direction;
let order = store.order || [];
if (typeof order == 'string') order = [order];
let index = order.findIndex((o) => o.split(' ')[0] === field);
if (index > -1) {
order[index] = newOrder;
} else {
index = order.length;
order.push(newOrder);
}
store.order = order;
fetch({});
index++;
return { index, order };
}
async function deleteOrder(field) {
let order = store.order ?? [];
if (typeof order == 'string') order = [order];
const index = order.findIndex((o) => o.split(' ')[0] === field);
if (index > -1) order.splice(index, 1);
store.order = order;
fetch({});
}
function sanitizerParams(params, exprBuilder) { function sanitizerParams(params, exprBuilder) {
for (const param in params) { for (const param in params) {
if (params[param] === '' || params[param] === null) { if (params[param] === '' || params[param] === null) {
@ -198,7 +231,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
} }
async function refresh() { async function refresh() {
if (Object.values(store.userParams).length) await fetch({ append: false }); if (Object.values(store.userParams).length) await fetch({});
} }
function updateStateParams() { function updateStateParams() {
@ -240,6 +273,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
applyFilter, applyFilter,
addFilter, addFilter,
addFilterWhere, addFilterWhere,
addOrder,
deleteOrder,
refresh, refresh,
destroy, destroy,
loadMore, loadMore,

View File

@ -229,3 +229,29 @@ input::-webkit-inner-spin-button {
*::-webkit-scrollbar-track { *::-webkit-scrollbar-track {
background: transparent; background: transparent;
} }
.q-table {
thead,
tbody {
th {
.q-select {
max-width: 120px;
}
}
td {
padding: 1px 10px 1px 10px;
max-width: 100px;
div span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.expand {
max-width: 400px;
}
}
}

View File

@ -633,69 +633,6 @@ ticket:
landed: Landed landed: Landed
warehouse: Warehouse warehouse: Warehouse
agency: Agency agency: Agency
claim:
list:
customer: Customer
assignedTo: Assigned
created: Created
state: State
rmaList:
code: Code
records: records
card:
claimId: Claim ID
attendedBy: Attended by
created: Created
state: State
ticketId: Ticket ID
customerSummary: Customer summary
claimedTicket: Claimed ticket
saleTracking: Sale tracking
ticketTracking: Ticket tracking
commercial: Commercial
province: Province
zone: Zone
customerId: client ID
summary:
customer: Customer
assignedTo: Assigned
attendedBy: Attended by
created: Created
state: State
details: Details
item: Item
landed: Landed
quantity: Quantity
claimed: Claimed
price: Price
discount: Discount
total: Total
actions: Actions
responsibility: Responsibility
company: Company
person: Employee/Customer
notes: Notes
photos: Photos
development: Development
reason: Reason
result: Result
responsible: Responsible
worker: Worker
redelivery: Redelivery
changeState: Change state
basicData:
customer: Customer
assignedTo: Assigned
created: Created
state: State
pickup: Pick up
null: No
agency: Agency
delivery: Delivery
photo:
fileDescription: 'Claim id {claimId} from client {clientName} id {clientId}'
noData: 'There are no images/videos, click here or drag and drop the file'
dragDrop: Drag and drop it here
invoiceOut: invoiceOut:
list: list:
ref: Reference ref: Reference

View File

@ -638,69 +638,6 @@ ticket:
landed: F. entrega landed: F. entrega
warehouse: Almacén warehouse: Almacén
agency: Agencia agency: Agencia
claim:
list:
customer: Cliente
assignedTo: Asignada a
created: Creada
state: Estado
rmaList:
code: Código
records: registros
card:
claimId: ID reclamación
attendedBy: Atendida por
created: Creada
state: Estado
ticketId: ID ticket
customerSummary: Resumen del cliente
claimedTicket: Ticket reclamado
saleTracking: Líneas preparadas
ticketTracking: Estados del ticket
commercial: Comercial
province: Provincia
zone: Zona
customerId: ID del cliente
summary:
customer: Cliente
assignedTo: Asignada a
attendedBy: Atendida por
created: Creada
state: Estado
details: Detalles
item: Artículo
landed: Entregado
quantity: Cantidad
claimed: Reclamado
price: Precio
discount: Descuento
total: Total
actions: Acciones
responsibility: Responsabilidad
company: Empresa
person: Comercial/Cliente
notes: Observaciones
photos: Fotos
development: Trazabilidad
reason: Motivo
result: Consecuencias
responsible: Responsable
worker: Trabajador
redelivery: Devolución
changeState: Cambiar estado
basicData:
customer: Cliente
assignedTo: Asignada a
created: Creada
state: Estado
pickup: Recogida
null: No
agency: Agencia
delivery: Reparto
photo:
fileDescription: 'Reclamacion ID {claimId} del cliente {clientName} id {clientId}'
noData: No hay imágenes/videos haz click aquí o arrastra y suelta el archivo
dragDrop: Arrástralo y sueltalo aquí
invoiceOut: invoiceOut:
list: list:
ref: Referencia ref: Referencia

View File

@ -33,8 +33,8 @@ const DEFAULT_MAX_RESPONSABILITY = 5;
const DEFAULT_MIN_RESPONSABILITY = 1; const DEFAULT_MIN_RESPONSABILITY = 1;
const arrayData = useArrayData('claimData'); const arrayData = useArrayData('claimData');
const marker_labels = [ const marker_labels = [
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.summary.company') }, { value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.company') },
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') }, { value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.person') },
]; ];
const multiplicatorValue = ref(); const multiplicatorValue = ref();
const loading = ref(false); const loading = ref(false);
@ -209,12 +209,12 @@ async function post(query, params) {
<QItem class="justify-between"> <QItem class="justify-between">
<QItemLabel class="slider-container"> <QItemLabel class="slider-container">
<p class="text-primary"> <p class="text-primary">
{{ t('claim.summary.actions') }} {{ t('claim.actions') }}
</p> </p>
<QSlider <QSlider
class="responsibility { 'background-color:primary': quasar.platform.is.mobile }" class="responsibility { 'background-color:primary': quasar.platform.is.mobile }"
v-model="claim.responsibility" v-model="claim.responsibility"
:label-value="t('claim.summary.responsibility')" :label-value="t('claim.responsibility')"
@change="(value) => save({ responsibility: value })" @change="(value) => save({ responsibility: value })"
label-always label-always
color="primary" color="primary"

View File

@ -30,7 +30,7 @@ function setClaimStates(data) {
} }
async function getEnumValues() { async function getEnumValues() {
optionsList.value = [{ id: null, description: t('claim.basicData.null') }]; optionsList.value = [{ id: null, description: t('claim.null') }];
const { data } = await axios.get(`Applications/get-enum-values`, { const { data } = await axios.get(`Applications/get-enum-values`, {
params: { params: {
schema: 'vn', schema: 'vn',
@ -39,7 +39,7 @@ async function getEnumValues() {
}, },
}); });
for (let value of data) for (let value of data)
optionsList.value.push({ id: value, description: t(`claim.basicData.${value}`) }); optionsList.value.push({ id: value, description: t(`claim.${value}`) });
} }
getEnumValues(); getEnumValues();
@ -77,17 +77,14 @@ const statesFilter = {
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnInput <VnInput
v-model="data.client.name" v-model="data.client.name"
:label="t('claim.basicData.customer')" :label="t('claim.customer')"
disable disable
/> />
<VnInputDate <VnInputDate v-model="data.created" :label="t('claim.created')" />
v-model="data.created"
:label="t('claim.basicData.created')"
/>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnSelect <VnSelect
:label="t('claim.basicData.assignedTo')" :label="t('claim.assignedTo')"
v-model="data.workerFk" v-model="data.workerFk"
:options="workersOptions" :options="workersOptions"
option-value="id" option-value="id"
@ -114,7 +111,7 @@ const statesFilter = {
option-value="id" option-value="id"
option-label="description" option-label="description"
emit-value emit-value
:label="t('claim.basicData.state')" :label="t('claim.state')"
map-options map-options
use-input use-input
@filter="(value, update) => filter(value, update, statesFilter)" @filter="(value, update) => filter(value, update, statesFilter)"
@ -136,7 +133,7 @@ const statesFilter = {
option-value="id" option-value="id"
option-label="description" option-label="description"
emit-value emit-value
:label="t('claim.basicData.pickup')" :label="t('claim.pickup')"
map-options map-options
use-input use-input
:input-debounce="0" :input-debounce="0"

View File

@ -2,7 +2,7 @@
import { ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toPercentage } from 'src/filters'; import { toDateHourMinSec, toPercentage } from 'src/filters';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue'; import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
@ -42,7 +42,7 @@ function stateColor(code) {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
data.value = useCardDescription(entity.client.name, entity.id); data.value = useCardDescription(entity?.client?.name, entity.id);
state.set('ClaimDescriptor', entity); state.set('ClaimDescriptor', entity);
}; };
onMounted(async () => { onMounted(async () => {
@ -52,7 +52,6 @@ onMounted(async () => {
<template> <template>
<CardDescriptor <CardDescriptor
ref="descriptor"
:url="`Claims/${entityId}`" :url="`Claims/${entityId}`"
:filter="filter" :filter="filter"
module="Claim" module="Claim"
@ -64,7 +63,7 @@ onMounted(async () => {
<ClaimDescriptorMenu :claim="entity" /> <ClaimDescriptorMenu :claim="entity" />
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv v-if="entity.claimState" :label="t('claim.card.state')"> <VnLv v-if="entity.claimState" :label="t('claim.state')">
<template #value> <template #value>
<QBadge <QBadge
:color="stateColor(entity.claimState.code)" :color="stateColor(entity.claimState.code)"
@ -75,8 +74,8 @@ onMounted(async () => {
</QBadge> </QBadge>
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.card.created')" :value="toDate(entity.created)" /> <VnLv :label="t('claim.created')" :value="toDateHourMinSec(entity.created)" />
<VnLv :label="t('claim.card.commercial')"> <VnLv :label="t('claim.commercial')">
<template #value> <template #value>
<VnUserLink <VnUserLink
:name="entity.client?.salesPersonUser?.name" :name="entity.client?.salesPersonUser?.name"
@ -86,17 +85,17 @@ onMounted(async () => {
</VnLv> </VnLv>
<VnLv <VnLv
v-if="entity.worker" v-if="entity.worker"
:label="t('claim.card.attendedBy')" :label="t('claim.attendedBy')"
:value="entity.worker.user.name" :value="entity.worker.user.name"
> >
<template #value> <template #value>
<VnUserLink <VnUserLink
:name="entity.worker.user.nickname" :name="entity.worker.user.name"
:worker-id="entity.worker.id" :worker-id="entity.worker.id"
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.card.zone')"> <VnLv :label="t('claim.zone')">
<template #value> <template #value>
<span class="link"> <span class="link">
{{ entity.ticket?.zone?.name }} {{ entity.ticket?.zone?.name }}
@ -105,10 +104,10 @@ onMounted(async () => {
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv
:label="t('claim.card.province')" :label="t('claim.province')"
:value="entity.ticket?.address?.province?.name" :value="entity.ticket?.address?.province?.name"
/> />
<VnLv :label="t('claim.card.ticketId')"> <VnLv :label="t('claim.ticketId')">
<template #value> <template #value>
<span class="link"> <span class="link">
{{ entity.ticketFk }} {{ entity.ticketFk }}
@ -130,7 +129,7 @@ onMounted(async () => {
color="primary" color="primary"
:to="{ name: 'CustomerCard', params: { id: entity.clientFk } }" :to="{ name: 'CustomerCard', params: { id: entity.clientFk } }"
> >
<QTooltip>{{ t('claim.card.customerSummary') }}</QTooltip> <QTooltip>{{ t('claim.customerSummary') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
size="md" size="md"
@ -138,7 +137,7 @@ onMounted(async () => {
color="primary" color="primary"
:to="{ name: 'TicketCard', params: { id: entity.ticketFk } }" :to="{ name: 'TicketCard', params: { id: entity.ticketFk } }"
> >
<QTooltip>{{ t('claim.card.claimedTicket') }}</QTooltip> <QTooltip>{{ t('claim.claimedTicket') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
size="md" size="md"
@ -146,7 +145,7 @@ onMounted(async () => {
color="primary" color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'" :href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'"
> >
<QTooltip>{{ t('claim.card.saleTracking') }}</QTooltip> <QTooltip>{{ t('claim.saleTracking') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
size="md" size="md"
@ -154,7 +153,7 @@ onMounted(async () => {
color="primary" color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'" :href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
> >
<QTooltip>{{ t('claim.card.ticketTracking') }}</QTooltip> <QTooltip>{{ t('claim.ticketTracking') }}</QTooltip>
</QBtn> </QBtn>
</QCardActions> </QCardActions>
</template> </template>

View File

@ -9,7 +9,7 @@ const state = useState();
const user = state.getUser(); const user = state.getUser();
const $props = defineProps({ const $props = defineProps({
id: { type: Number, default: null }, id: { type: [Number, String], default: null },
addNote: { type: Boolean, default: true }, addNote: { type: Boolean, default: true },
}); });
const claimId = computed(() => $props.id || route.params.id); const claimId = computed(() => $props.id || route.params.id);

View File

@ -18,7 +18,7 @@ const claimId = computed(() => router.currentRoute.value.params.id);
const claimDms = ref([ const claimDms = ref([
{ {
dmsFk: 1, dmsFk: claimId,
}, },
]); ]);
const client = ref({}); const client = ref({});
@ -113,7 +113,7 @@ async function create() {
warehouseId: config.value.warehouseFk, warehouseId: config.value.warehouseFk,
companyId: config.value.companyFk, companyId: config.value.companyFk,
dmsTypeId: dmsType.value.id, dmsTypeId: dmsType.value.id,
description: t('claim.photo.fileDescription', { description: t('claim.fileDescription', {
claimId: claimId.value, claimId: claimId.value,
clientName: client.value.name, clientName: client.value.name,
clientId: client.value.id, clientId: client.value.id,
@ -177,7 +177,7 @@ function onDrag() {
> >
<QIcon size="xl" name="file_download" /> <QIcon size="xl" name="file_download" />
<h5> <h5>
{{ t('claim.photo.dragDrop') }} {{ t('claim.dragDrop') }}
</h5> </h5>
</div> </div>
<div <div
@ -188,7 +188,7 @@ function onDrag() {
<QIcon size="xl" name="image"></QIcon> <QIcon size="xl" name="image"></QIcon>
<QIcon size="xl" name="movie"></QIcon> <QIcon size="xl" name="movie"></QIcon>
<h5> <h5>
{{ t('claim.photo.noData') }} {{ t('claim.noData') }}
</h5> </h5>
</div> </div>
<div class="multimediaParent bg-transparent" v-if="claimDms?.length && !dragFile"> <div class="multimediaParent bg-transparent" v-if="claimDms?.length && !dragFile">

View File

@ -1,20 +1,25 @@
<script setup> <script setup>
import axios from 'axios';
import { onMounted, ref, computed } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue'; import dashIfEmpty from 'src/filters/dashIfEmpty';
import FetchData from 'components/FetchData.vue';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
import FetchData from 'components/FetchData.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import ClaimSummaryAction from 'src/pages/Claim/Card/ClaimSummaryAction.vue';
import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import axios from 'axios'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import dashIfEmpty from 'src/filters/dashIfEmpty';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -34,6 +39,9 @@ const ClaimStates = ref([]);
const claimUrl = ref(); const claimUrl = ref();
const salixUrl = ref(); const salixUrl = ref();
const claimDmsRef = ref(); const claimDmsRef = ref();
const claimDms = ref([]);
const multimediaDialog = ref();
const multimediaSlide = ref();
const claimDmsFilter = ref({ const claimDmsFilter = ref({
include: [ include: [
{ {
@ -42,34 +50,29 @@ const claimDmsFilter = ref({
], ],
}); });
onMounted(async () => {
salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
label: 'claim.summary.item', label: 'claim.item',
field: (row) => row.sale.itemFk, field: (row) => row.sale.itemFk,
sortable: true, sortable: true,
}, },
{ {
name: 'landed', name: 'landed',
label: 'claim.summary.landed', label: 'claim.landed',
field: (row) => row.sale.ticket.landed, field: (row) => row.sale.ticket.landed,
format: (value) => toDate(value), format: (value) => toDate(value),
sortable: true, sortable: true,
}, },
{ {
name: 'quantity', name: 'quantity',
label: 'claim.summary.quantity', label: 'claim.quantity',
field: (row) => row.sale.quantity, field: (row) => row.sale.quantity,
sortable: true, sortable: true,
}, },
{ {
name: 'claimed', name: 'claimed',
label: 'claim.summary.claimed', label: 'claim.claimed',
field: (row) => row.quantity, field: (row) => row.quantity,
sortable: true, sortable: true,
}, },
@ -80,32 +83,38 @@ const detailsColumns = ref([
}, },
{ {
name: 'price', name: 'price',
label: 'claim.summary.price', label: 'claim.price',
field: (row) => row.sale.price, field: (row) => row.sale.price,
sortable: true, sortable: true,
}, },
{ {
name: 'discount', name: 'discount',
label: 'claim.summary.discount', label: 'claim.discount',
field: (row) => row.sale.discount, field: (row) => row.sale.discount,
format: (value) => `${value} %`, format: (value) => `${value} %`,
sortable: true, sortable: true,
}, },
{ {
name: 'total', name: 'total',
label: 'claim.summary.total', label: 'claim.total',
field: ({ sale }) => field: ({ sale }) =>
toCurrency(sale.quantity * sale.price * ((100 - sale.discount) / 100)), toCurrency(sale.quantity * sale.price * ((100 - sale.discount) / 100)),
sortable: true, sortable: true,
}, },
]); ]);
const markerLabels = [
{ value: 1, label: t('claim.company') },
{ value: 5, label: t('claim.person') },
];
const STATE_COLOR = { const STATE_COLOR = {
pending: 'warning', pending: 'warning',
incomplete: 'info', incomplete: 'info',
resolved: 'positive', resolved: 'positive',
canceled: 'negative', canceled: 'negative',
}; };
function stateColor(code) { function stateColor(code) {
return STATE_COLOR[code]; return STATE_COLOR[code];
} }
@ -113,38 +122,40 @@ function stateColor(code) {
const developmentColumns = ref([ const developmentColumns = ref([
{ {
name: 'claimReason', name: 'claimReason',
label: 'claim.summary.reason', label: 'claim.reason',
field: (row) => row.claimReason.description, field: (row) => row.claimReason.description,
sortable: true, sortable: true,
}, },
{ {
name: 'claimResult', name: 'claimResult',
label: 'claim.summary.result', label: 'claim.result',
field: (row) => row.claimResult.description, field: (row) => row.claimResult.description,
sortable: true, sortable: true,
}, },
{ {
name: 'claimResponsible', name: 'claimResponsible',
label: 'claim.summary.responsible', label: 'claim.responsible',
field: (row) => row.claimResponsible.description, field: (row) => row.claimResponsible.description,
sortable: true, sortable: true,
}, },
{ {
name: 'worker', name: 'worker',
label: 'claim.summary.worker', label: 'claim.worker',
field: (row) => row.worker?.user.nickname, field: (row) => row.worker?.user.nickname,
sortable: true, sortable: true,
}, },
{ {
name: 'claimRedelivery', name: 'claimRedelivery',
label: 'claim.summary.redelivery', label: 'claim.redelivery',
field: (row) => row.claimRedelivery.description, field: (row) => row.claimRedelivery.description,
sortable: true, sortable: true,
}, },
]); ]);
const claimDms = ref([]);
const multimediaDialog = ref(); onMounted(async () => {
const multimediaSlide = ref(); salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
async function getClaimDms() { async function getClaimDms() {
claimDmsFilter.value.where = { claimFk: entityId.value }; claimDmsFilter.value.where = { claimFk: entityId.value };
@ -200,7 +211,7 @@ async function changeState(value) {
> >
<QList> <QList>
<QVirtualScroll <QVirtualScroll
style="max-height: 300px" class="max-container-height"
:items="ClaimStates" :items="ClaimStates"
separator separator
v-slot="{ item, index }" v-slot="{ item, index }"
@ -221,16 +232,13 @@ async function changeState(value) {
</QBtnDropdown> </QBtnDropdown>
</template> </template>
<template #body="{ entity: { claim, salesClaimed, developments } }"> <template #body="{ entity: { claim, salesClaimed, developments } }">
<QCard class="vn-one"> <QCard class="vn-one" v-if="$route.name != 'ClaimSummary'">
<VnTitle <VnTitle
:url="`#/claim/${entityId}/basic-data`" :url="`#/claim/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')" :text="t('globals.pageTitles.basicData')"
/> />
<VnLv <VnLv :label="t('claim.created')" :value="toDate(claim.created)" />
:label="t('claim.summary.created')" <VnLv :label="t('claim.state')">
:value="toDate(claim.created)"
/>
<VnLv :label="t('claim.summary.state')">
<template #value> <template #value>
<QChip :color="stateColor(claim.claimState.code)" dense> <QChip :color="stateColor(claim.claimState.code)" dense>
{{ claim.claimState.description }} {{ claim.claimState.description }}
@ -245,7 +253,7 @@ async function changeState(value) {
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.attendedBy')"> <VnLv :label="t('claim.attendedBy')">
<template #value> <template #value>
<VnUserLink <VnUserLink
:name="claim.worker?.user?.nickname" :name="claim.worker?.user?.nickname"
@ -253,7 +261,7 @@ async function changeState(value) {
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.customer')"> <VnLv :label="t('claim.customer')">
<template #value> <template #value>
<span class="link cursor-pointer"> <span class="link cursor-pointer">
{{ claim.client?.name }} {{ claim.client?.name }}
@ -262,27 +270,63 @@ async function changeState(value) {
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv
:label="t('claim.basicData.pickup')" :label="t('claim.pickup')"
:value="`${dashIfEmpty(claim.pickup)}`" :value="`${dashIfEmpty(claim.pickup)}`"
/> />
</QCard> </QCard>
<QCard class="vn-three"> <QCard class="vn-two">
<VnTitle <VnTitle :url="`#/claim/${entityId}/notes`" :text="t('claim.notes')" />
:url="`#/claim/${entityId}/notes`"
:text="t('claim.summary.notes')"
/>
<ClaimNotes <ClaimNotes
:id="entityId" :id="entityId"
:add-note="false" :add-note="false"
style="max-height: 300px" class="max-container-height"
order="created ASC" order="created ASC"
/> />
</QCard> </QCard>
<QCard class="vn-two" v-if="salesClaimed.length > 0"> <QCard class="vn-two" v-if="claimDms?.length">
<VnTitle <VnTitle :url="`#/claim/${entityId}/photos`" :text="t('claim.photos')" />
:url="`#/claim/${entityId}/lines`" <div class="container max-container-height" style="overflow: auto">
:text="t('claim.summary.details')" <div
/> class="multimedia-container"
v-for="(media, index) of claimDms"
:key="index"
>
<div class="relative-position">
<QIcon
name="play_circle"
color="primary"
size="xl"
class="absolute-center zindex"
v-if="media.isVideo"
@click.stop="openDialog(media.dmsFk)"
>
<QTooltip>Video</QTooltip>
</QIcon>
<QCard
class="multimedia relative-position"
style="max-height: 128px"
>
<QImg
:src="media.url"
class="rounded-borders cursor-pointer fit"
@click="openDialog(media.dmsFk)"
v-if="!media.isVideo"
>
</QImg>
<video
:src="media.url"
class="rounded-borders cursor-pointer fit"
muted="muted"
v-if="media.isVideo"
@click="openDialog(media.dmsFk)"
/>
</QCard>
</div>
</div>
</div>
</QCard>
<QCard class="vn-max" v-if="salesClaimed.length > 0">
<VnTitle :url="`#/claim/${entityId}/lines`" :text="t('claim.details')" />
<QTable <QTable
:columns="detailsColumns" :columns="detailsColumns"
:rows="salesClaimed" :rows="salesClaimed"
@ -320,53 +364,8 @@ async function changeState(value) {
</template> </template>
</QTable> </QTable>
</QCard> </QCard>
<QCard class="vn-two" v-if="claimDms.length > 0"> <QCard class="vn-max" v-if="developments.length > 0">
<VnTitle <VnTitle :url="claimUrl + 'development'" :text="t('claim.development')" />
:url="`#/claim/${entityId}/photos`"
:text="t('claim.summary.photos')"
/>
<div class="container">
<div
class="multimedia-container"
v-for="(media, index) of claimDms"
:key="index"
>
<div class="relative-position">
<QIcon
name="play_circle"
color="primary"
size="xl"
class="absolute-center zindex"
v-if="media.isVideo"
@click.stop="openDialog(media.dmsFk)"
>
<QTooltip>Video</QTooltip>
</QIcon>
<QCard class="multimedia relative-position">
<QImg
:src="media.url"
class="rounded-borders cursor-pointer fit"
@click="openDialog(media.dmsFk)"
v-if="!media.isVideo"
>
</QImg>
<video
:src="media.url"
class="rounded-borders cursor-pointer fit"
muted="muted"
v-if="media.isVideo"
@click="openDialog(media.dmsFk)"
/>
</QCard>
</div>
</div>
</div>
</QCard>
<QCard class="vn-two" v-if="developments.length > 0">
<VnTitle
:url="claimUrl + 'development'"
:text="t('claim.summary.development')"
/>
<QTable <QTable
:columns="developmentColumns" :columns="developmentColumns"
:rows="developments" :rows="developments"
@ -382,27 +381,31 @@ async function changeState(value) {
</QTh> </QTh>
</QTr> </QTr>
</template> </template>
<template #body-cell-worker="props">
<QTd :props="props" class="link">
{{ props.value }}
<WorkerDescriptorProxy :id="props.row.worker.id" />
</QTd>
</template>
</QTable> </QTable>
</QCard> </QCard>
<QCard class="vn-max"> <QCard class="vn-max">
<VnTitle :url="claimUrl + 'action'" :text="t('claim.summary.actions')" /> <VnTitle :url="claimUrl + 'action'" :text="t('claim.actions')" />
<div id="slider-container" class="q-px-xl q-py-md"> <div id="slider-container" class="q-px-xl q-py-md">
<QSlider <QSlider
v-model="claim.responsibility" v-model="claim.responsibility"
label label
:label-value="t('claim.summary.responsibility')" :label-value="t('claim.responsibility')"
label-always label-always
color="var()" color="var()"
markers markers
:marker-labels="[ :marker-labels="markerLabels"
{ value: 1, label: t('claim.summary.company') },
{ value: 5, label: t('claim.summary.person') },
]"
:min="1" :min="1"
:max="5" :max="5"
readonly readonly
/> />
</div> </div>
<ClaimSummaryAction :id="entityId" />
</QCard> </QCard>
<QDialog <QDialog
v-model="multimediaDialog" v-model="multimediaDialog"
@ -458,7 +461,7 @@ async function changeState(value) {
gap: 15px; gap: 15px;
} }
.multimedia-container { .multimedia-container {
flex: 1 0 21%; flex: 0 0 128px;
} }
.multimedia { .multimedia {
transition: all 0.5s; transition: all 0.5s;
@ -491,4 +494,8 @@ async function changeState(value) {
.change-state { .change-state {
width: 10%; width: 10%;
} }
.max-container-height {
max-height: 300px;
}
</style> </style>

View File

@ -0,0 +1,97 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { toDate, toPercentage } from 'filters/index';
import VnTable from 'src/components/VnTable/VnTable.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
const { t } = useI18n();
const $props = defineProps({
id: {
type: [Number, String],
required: true,
},
});
const columns = [
{
name: 'itemFk',
label: t('Id item'),
columnFilter: false,
align: 'left',
},
{
name: 'ticketFk',
label: t('Ticket'),
columnFilter: false,
align: 'left',
},
{
name: 'claimDestinationFk',
label: t('Destination'),
columnFilter: false,
align: 'left',
},
{
name: 'landed',
label: t('Landed'),
format: (row) => toDate(row.landed),
align: 'left',
},
{
name: 'quantity',
label: t('Quantity'),
align: 'left',
},
{
name: 'concept',
label: t('Description'),
align: 'left',
},
{
name: 'price',
label: t('Price'),
align: 'left',
},
{
name: 'discount',
label: t('Discount'),
format: ({ discount }) => toPercentage(discount / 100),
align: 'left',
},
{
name: 'total',
label: t('Total'),
align: 'left',
},
];
</script>
<template>
<VnTable
data-key="ClaimEndsTable"
url="ClaimEnds/filter"
:right-search="false"
:column-search="false"
:disable-option="{ card: true, table: true }"
search-url="actions"
:filter="{ where: { claimFk: $props.id } }"
:columns="columns"
:limit="0"
:without-header="true"
auto-load
>
<template #column-itemFk="{ row }">
<span class="link">
{{ row.itemFk }}
<ItemDescriptorProxy :id="row.itemFk" />
</span>
</template>
<template #column-ticketFk="{ row }">
<span class="link">
{{ row.ticketFk }}
<TicketDescriptorProxy :id="row.ticketFk" />
</span>
</template>
</VnTable>
</template>

View File

@ -16,19 +16,14 @@ const props = defineProps({
}, },
}); });
const workers = ref(); const states = ref([]);
const states = ref();
defineExpose({ states });
</script> </script>
<template> <template>
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
<FetchData <VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="(data) => (workers = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>
@ -36,156 +31,110 @@ const states = ref();
</div> </div>
</template> </template>
<template #body="{ params, searchFn }"> <template #body="{ params, searchFn }">
<QItem class="q-my-sm"> <div class="q-pa-sm q-gutter-y-sm">
<QItemSection> <VnInput
<VnInput :label="t('claim.customerId')"
:label="t('Customer ID')" v-model="params.clientFk"
v-model="params.clientFk" lazy-rules
lazy-rules is-outlined
is-outlined >
> <template #prepend> <QIcon name="badge" size="xs" /></template>
<template #prepend> </VnInput>
<QIcon name="badge" size="xs"></QIcon> </template <VnInput
></VnInput> :label="t('Client Name')"
</QItemSection> v-model="params.clientName"
</QItem> lazy-rules
<QItem class="q-mb-sm"> is-outlined
<QItemSection> />
<VnInput <VnSelect
:label="t('Client Name')" :label="t('Salesperson')"
v-model="params.clientName" v-model="params.salesPersonFk"
lazy-rules @update:model-value="searchFn()"
is-outlined url="Workers/activeWithInheritedRole"
/> :filter="{ where: { role: 'salesPerson' } }"
</QItemSection> :use-like="false"
</QItem> option-value="id"
<QItem class="q-mb-sm"> option-label="name"
<QItemSection v-if="!workers"> option-filter="firstName"
<QSkeleton type="QInput" class="full-width" /> dense
</QItemSection> outlined
<QItemSection v-if="workers"> rounded
<VnSelect />
:label="t('Salesperson')" <VnSelect
v-model="params.salesPersonFk" :label="t('claim.attendedBy')"
@update:model-value="searchFn()" v-model="params.attenderFk"
:options="workers" @update:model-value="searchFn()"
option-value="id" url="Workers/activeWithInheritedRole"
option-label="name" :filter="{ where: { role: 'salesPerson' } }"
emit-value :use-like="false"
map-options option-value="id"
use-input option-label="name"
hide-selected option-filter="firstName"
dense dense
outlined outlined
rounded rounded
:input-debounce="0" />
/> <VnSelect
</QItemSection> :label="t('claim.state')"
</QItem> v-model="params.claimStateFk"
<QItem class="q-mb-sm"> @update:model-value="searchFn()"
<QItemSection v-if="!workers"> :options="states"
<QSkeleton type="QInput" class="full-width" /> option-value="id"
</QItemSection> option-label="description"
<QItemSection v-if="workers"> dense
<VnSelect outlined
:label="t('Attender')" rounded
v-model="params.attenderFk" />
@update:model-value="searchFn()" <VnInputDate
:options="workers" v-model="params.created"
option-value="id" @update:model-value="searchFn()"
option-label="name" :label="t('claim.created')"
emit-value outlined
map-options rounded
use-input dense
hide-selected />
dense <VnSelect
outlined :label="t('Item')"
rounded v-model="params.itemFk"
:input-debounce="0" @update:model-value="searchFn()"
/> url="Items/withName"
</QItemSection> option-value="id"
</QItem> option-label="name"
<QItem class="q-mb-sm"> sort-by="id DESC"
<QItemSection v-if="!workers"> outlined
<QSkeleton type="QInput" class="full-width" /> rounded
</QItemSection> dense
<QItemSection v-if="workers"> >
<VnSelect <template #option="scope">
:label="t('Responsible')" <QItem v-bind="scope.itemProps">
v-model="params.claimResponsibleFk" <QItemSection>
@update:model-value="searchFn()" <QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
:options="workers" <QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
option-value="id" </QItemSection>
option-label="name" </QItem>
emit-value </template>
map-options </VnSelect>
use-input <VnSelect
hide-selected :label="t('claim.responsible')"
dense v-model="params.claimResponsibleFk"
outlined @update:model-value="searchFn()"
rounded url="Workers/activeWithInheritedRole"
:input-debounce="0" :filter="{ where: { role: 'salesPerson' } }"
/> :use-like="false"
</QItemSection> option-value="id"
</QItem> option-label="name"
<QItem class="q-mb-sm"> option-filter="firstName"
<QItemSection v-if="!states"> dense
<QSkeleton type="QInput" class="full-width" /> outlined
</QItemSection> rounded
<QItemSection v-if="states"> />
<VnSelect <QCheckbox
:label="t('State')" v-model="params.myTeam"
v-model="params.claimStateFk" :label="t('params.myTeam')"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="states" toggle-indeterminate
option-value="id" />
option-label="description" </div>
emit-value
map-options
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('myTeam')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QSeparator />
<QExpansionItem :label="t('More options')" expand-separator>
<!-- <QItem>
<QItemSection>
<qSelect
:label="t('Item')"
v-model="params.itemFk"
:options="items"
:loading="loading"
@filter="filterFn"
@virtual-scroll="onScroll"
option-value="id"
option-label="name"
emit-value
map-options
/>
</QItemSection>
</QItem> -->
<QItem>
<QItemSection>
<VnInputDate
v-model="params.created"
:label="t('Created')"
is-outlined
/>
</QItemSection>
</QItem>
</QExpansionItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
@ -201,7 +150,8 @@ en:
claimResponsibleFk: Responsible claimResponsibleFk: Responsible
claimStateFk: State claimStateFk: State
created: Created created: Created
myTeam: My team myTeam: My team
itemFk: Item
es: es:
params: params:
search: Contiene search: Contiene
@ -212,14 +162,9 @@ es:
claimResponsibleFk: Responsable claimResponsibleFk: Responsable
claimStateFk: Estado claimStateFk: Estado
created: Creada created: Creada
Customer ID: ID cliente myTeam: Mi equipo
itemFk: Artículo
Client Name: Nombre del cliente Client Name: Nombre del cliente
Salesperson: Comercial Salesperson: Comercial
Attender: Asistente
Responsible: Responsable
State: Estado
Item: Artículo Item: Artículo
Created: Creada
More options: Más opciones
myTeam: Mi equipo
</i18n> </i18n>

View File

@ -1,38 +1,114 @@
<script setup> <script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { toDate } from 'filters/index'; import { toDate } from 'filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import ClaimFilter from './ClaimFilter.vue'; import ClaimFilter from './ClaimFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import ClaimSummary from './Card/ClaimSummary.vue'; import ClaimSummary from './Card/ClaimSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const claimFilterRef = ref();
const columns = computed(() => [
{
align: 'left',
name: 'id',
label: t('customer.extendedList.tableVisibleColumns.id'),
chip: {
condition: () => true,
},
isId: true,
},
{
align: 'left',
label: t('customer.extendedList.tableVisibleColumns.name'),
name: 'clientName',
isTitle: true,
visible: false,
},
{
align: 'left',
label: t('claim.customer'),
name: 'clientFk',
cardVisible: true,
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
},
class: 'expand',
},
{
align: 'left',
label: t('claim.attendedBy'),
name: 'attendedBy',
cardVisible: true,
columnFilter: {
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
where: { role: 'salesPerson' },
useLike: false,
optionValue: 'id',
optionLabel: 'name',
optionFilter: 'firstName',
},
},
},
{
align: 'left',
label: t('claim.created'),
name: 'created',
format: ({ created }) => toDate(created),
cardVisible: true,
columnFilter: {
component: 'date',
},
},
{
align: 'left',
label: t('claim.state'),
name: 'stateCode',
chip: {
condition: () => true,
color: ({ stateCode }) => STATE_COLOR[stateCode] ?? 'bg-grey',
},
columnFilter: {
name: 'claimStateFk',
component: 'select',
attrs: {
options: claimFilterRef.value?.states,
optionLabel: 'description',
},
},
},
{
align: 'right',
name: 'tableActions',
actions: [
{
title: t('Client ticket list'),
icon: 'preview',
action: (row) => viewSummary(row.id, ClaimSummary),
},
],
},
]);
const STATE_COLOR = { const STATE_COLOR = {
pending: 'warning', pending: 'bg-warning',
managed: 'info', managed: 'bg-info',
resolved: 'positive', resolved: 'bg-positive',
}; };
function getApiUrl() {
return new URL(window.location).origin;
}
function stateColor(code) {
return STATE_COLOR[code];
}
function navigate(event, id) {
if (event.ctrlKey || event.metaKey)
return window.open(`${getApiUrl()}/#/claim/${id}/summary`);
router.push({ path: `/claim/${id}` });
}
</script> </script>
<template> <template>
@ -43,85 +119,39 @@ function navigate(event, id) {
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ClaimFilter data-key="ClaimList" /> <ClaimFilter data-key="ClaimList" ref="claimFilterRef" />
</template> </template>
</RightMenu> </RightMenu>
<QPage class="column items-center q-pa-md"> <VnTable
<div class="vn-card-list"> data-key="ClaimList"
<VnPaginate url="Claims/filter"
data-key="ClaimList" :order="['priority ASC', 'created DESC']"
url="Claims/filter" :columns="columns"
:order="['priority ASC', 'created DESC']" redirect="claim"
auto-load :right-search="false"
> auto-load
<template #body="{ rows }"> >
<CardList <template #column-clientFk="{ row }">
:id="row.id" <span class="link" @click.stop>
:key="row.id" {{ row.clientName }}
:title="row.clientName" <CustomerDescriptorProxy :id="row.clientFk" />
@click="navigate($event, row.id)" </span>
v-for="row of rows" </template>
> <template #column-attendedBy="{ row }">
<template #list-items> <span @click.stop>
<VnLv :label="t('claim.list.customer')"> <VnUserLink :name="row.workerName" :worker-id="row.workerFk" />
<template #value> </span>
<span class="link" @click.stop> </template>
{{ row.clientName }} </VnTable>
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
</VnLv>
<VnLv :label="t('claim.list.assignedTo')">
<template #value>
<span @click.stop>
<VnUserLink
:name="row.workerName"
:worker-id="row.workerFk"
/>
</span>
</template>
</VnLv>
<VnLv
:label="t('claim.list.created')"
:value="toDate(row.created)"
/>
<VnLv :label="t('claim.list.state')">
<template #value>
<QBadge
text-color="black"
:color="stateColor(row.stateCode)"
dense
>
{{ row.stateDescription }}
</QBadge>
</template>
</VnLv>
</template>
<template #actions>
<QBtn
:label="t('globals.description')"
@click.stop
outline
style="margin-top: 15px"
>
<CustomerDescriptorProxy :id="row.clientFk" />
</QBtn>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ClaimSummary)"
color="primary"
style="margin-top: 15px"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template> </template>
<i18n> <i18n>
es: es:
Search claim: Buscar reclamación Search claim: Buscar reclamación
You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente
params:
stateCode: Estado
en:
params:
stateCode: State
</i18n> </i18n>

View File

@ -0,0 +1,46 @@
claim:
customer: Customer
code: Code
records: records
claimId: Claim ID
attendedBy: Attended by
ticketId: Ticket ID
customerSummary: Customer summary
claimedTicket: Claimed ticket
saleTracking: Sale tracking
ticketTracking: Ticket tracking
commercial: Commercial
province: Province
zone: Zone
customerId: client ID
assignedTo: Assigned
created: Created
details: Details
item: Item
landed: Landed
quantity: Quantity
claimed: Claimed
price: Price
discount: Discount
total: Total
actions: Actions
responsibility: Responsibility
company: Company
person: Employee/Customer
notes: Notes
photos: Photos
development: Development
reason: Reason
result: Result
responsible: Responsible
worker: Worker
redelivery: Redelivery
changeState: Change state
state: State
pickup: Pick up
null: No
agency: Agency
delivery: Delivery
fileDescription: 'Claim id {claimId} from client {clientName} id {clientId}'
noData: 'There are no images/videos, click here or drag and drop the file'
dragDrop: Drag and drop it here

View File

@ -1,2 +1,48 @@
Search claim: Buscar reclamación Search claim: Buscar reclamación
You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente
claim:
customer: Cliente
code: Código
records: Registros
claimId: ID de reclamación
attendedBy: Atendido por
ticketId: ID de ticket
customerSummary: Resumen del cliente
claimedTicket: Ticket reclamado
saleTracking: Seguimiento de ventas
ticketTracking: Seguimiento de tickets
commercial: Comercial
province: Provincia
zone: Zona
customerId: ID de cliente
assignedTo: Asignado a
created: Creado
details: Detalles
item: Artículo
landed: Llegado
quantity: Cantidad
claimed: Reclamado
price: Precio
discount: Descuento
total: Total
actions: Acciones
responsibility: Responsabilidad
company: Empresa
person: Empleado/Cliente
notes: Notas
photos: Fotos
development: Trazabilidad
reason: Razón
result: Resultado
responsible: Responsable
worker: Trabajador
redelivery: Reentrega
changeState: Cambiar estado
state: Estado
pickup: Recoger
null: No
agency: Agencia
delivery: Entrega
fileDescription: 'ID de reclamación {claimId} del cliente {clientName} con ID {clientId}'
noData: 'No hay imágenes/videos, haz clic aquí o arrastra y suelta el archivo'
dragDrop: Arrastra y suelta aquí

View File

@ -32,7 +32,7 @@ const entityId = computed(() => {
}); });
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.name, entity.id)); const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
</script> </script>
<template> <template>

View File

@ -42,6 +42,9 @@ const columns = computed(() => [
name: 'name', name: 'name',
isTitle: true, isTitle: true,
create: true, create: true,
columnField: {
class: 'expand',
},
}, },
{ {
align: 'left', align: 'left',
@ -49,6 +52,9 @@ const columns = computed(() => [
label: t('customer.extendedList.tableVisibleColumns.socialName'), label: t('customer.extendedList.tableVisibleColumns.socialName'),
isTitle: true, isTitle: true,
create: true, create: true,
columnField: {
class: 'expand',
},
}, },
{ {
align: 'left', align: 'left',
@ -78,8 +84,8 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('customer.extendedList.tableVisibleColumns.credit'), label: t('customer.extendedList.tableVisibleColumns.credit'),
name: 'credit', name: 'credit',
component: 'number',
columnFilter: { columnFilter: {
component: 'number',
inWhere: true, inWhere: true,
}, },
}, },
@ -87,8 +93,8 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('customer.extendedList.tableVisibleColumns.creditInsurance'), label: t('customer.extendedList.tableVisibleColumns.creditInsurance'),
name: 'creditInsurance', name: 'creditInsurance',
component: 'number',
columnFilter: { columnFilter: {
component: 'number',
inWhere: true, inWhere: true,
}, },
}, },
@ -130,6 +136,9 @@ const columns = computed(() => [
columnFilter: { columnFilter: {
inWhere: true, inWhere: true,
}, },
columnField: {
class: 'expand',
},
}, },
{ {
align: 'left', align: 'left',
@ -179,8 +188,8 @@ const columns = computed(() => [
label: t('customer.extendedList.tableVisibleColumns.created'), label: t('customer.extendedList.tableVisibleColumns.created'),
name: 'created', name: 'created',
format: ({ created }) => toDate(created), format: ({ created }) => toDate(created),
component: 'date',
columnFilter: { columnFilter: {
component: 'date',
alias: 'c', alias: 'c',
inWhere: true, inWhere: true,
}, },
@ -405,7 +414,6 @@ function handleLocation(data, location) {
}" }"
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table"
redirect="customer" redirect="customer"
auto-load auto-load
> >

View File

@ -73,7 +73,7 @@ onMounted(async () => {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => const setData = (entity) =>
(data.value = useCardDescription(entity.supplier.nickname, entity.id)); (data.value = useCardDescription(entity.supplier?.nickname, entity.id));
const currentEntry = computed(() => state.get('entry')); const currentEntry = computed(() => state.get('entry'));

View File

@ -191,7 +191,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
redirect="entry" redirect="entry"
default-mode="table"
auto-load auto-load
:right-search="false" :right-search="false"
/> />

View File

@ -199,7 +199,6 @@ onMounted(async () => {
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
redirect="entry" redirect="entry"
default-mode="table"
auto-load auto-load
:right-search="false" :right-search="false"
/> />

View File

@ -207,7 +207,6 @@ watchEffect(selectedRows);
v-model:selected="selectedRows" v-model:selected="selectedRows"
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table"
redirect="invoice-out" redirect="invoice-out"
auto-load auto-load
:table="{ :table="{

View File

@ -164,7 +164,6 @@ const downloadCSV = async () => {
" "
:limit="0" :limit="0"
:columns="columns" :columns="columns"
default-mode="table"
auto-load auto-load
:is-editable="false" :is-editable="false"
:use-model="true" :use-model="true"

View File

@ -5,7 +5,9 @@ import { useRoute } from 'vue-router';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue'; import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
import OrderDescriptorProxy from 'src/pages/Order/Card/OrderDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
@ -45,8 +47,8 @@ const columns = computed(() => [
align: 'left', align: 'left',
}, },
{ {
label: t('itemDiary.id'), label: t('itemDiary.origin'),
name: 'id', name: 'originId',
align: 'left', align: 'left',
}, },
{ {
@ -65,8 +67,8 @@ const columns = computed(() => [
}, },
{ {
label: t('itemDiary.client'), label: t('itemDiary.entity'),
name: 'client', name: 'entityId',
align: 'left', align: 'left',
format: (val) => dashIfEmpty(val), format: (val) => dashIfEmpty(val),
}, },
@ -111,10 +113,28 @@ const getBadgeAttrs = (_date) => {
return attrs; return attrs;
}; };
const getIdDescriptor = (row) => { const originTypeMap = {
let descriptor = EntryDescriptorProxy; entry: {
if (row.isTicket) descriptor = TicketDescriptorProxy; descriptor: EntryDescriptorProxy,
return descriptor; icon: 'vn:entry',
},
ticket: {
descriptor: TicketDescriptorProxy,
icon: 'vn:ticket',
},
order: {
descriptor: OrderDescriptorProxy,
icon: 'vn:basket',
},
};
const entityTypeMap = {
client: {
descriptor: CustomerDescriptorProxy,
},
supplier: {
descriptor: SupplierDescriptorProxy,
},
}; };
onMounted(async () => { onMounted(async () => {
@ -206,21 +226,28 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QBadge> </QBadge>
</QTd> </QTd>
</template> </template>
<template #body-cell-id="{ row }"> <template #body-cell-originId="{ row }">
<QTd @click.stop> <QTd @click.stop>
<component <component
:is="getIdDescriptor(row)" :is="originTypeMap[row.originType]?.descriptor"
:id="row.origin" :id="row.originId"
class="q-ma-none" class="q-ma-none"
dense dense
style="font-size: 14px" style="font-size: 14px"
> >
{{ row.origin }} {{ row.originId }}
</component> </component>
<span class="link">{{ row.origin }}</span> <span class="link">
<QIcon
:name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm"
size="xs"
/>
{{ row.originId }}
</span>
</QTd> </QTd>
</template> </template>
<template #body-cell-client="{ row }"> <template #body-cell-entityId="{ row }">
<QTd @click.stop> <QTd @click.stop>
<QBadge <QBadge
:color="row.highlighted ? 'warning' : 'transparent'" :color="row.highlighted ? 'warning' : 'transparent'"
@ -228,11 +255,18 @@ onUnmounted(() => (stateStore.rightDrawer = false));
dense dense
style="font-size: 14px" style="font-size: 14px"
> >
<span v-if="row.isTicket" class="link"> <component
{{ dashIfEmpty(row.name) }} :is="entityTypeMap[row.entityType]?.descriptor"
<CustomerDescriptorProxy :id="row.clientFk" /> :id="row.entityId"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ row.entityId }}
</component>
<span class="link">
{{ dashIfEmpty(row.entityName) }}
</span> </span>
<span v-else>{{ dashIfEmpty(row.name) }}</span>
</QBadge> </QBadge>
</QTd> </QTd>
</template> </template>

View File

@ -135,10 +135,6 @@ const isAdministrative = computed(() => {
:label="t('item.summary.nonRecycledPlastic')" :label="t('item.summary.nonRecycledPlastic')"
:value="item.nonRecycledPlastic" :value="item.nonRecycledPlastic"
/> />
<VnLv
:label="t('item.summary.minSalesQuantity')"
:value="item.minQuantity"
/>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<component <component

View File

@ -14,10 +14,10 @@ shelvings:
removeConfirmSubtitle: Are you sure you want to continue? removeConfirmSubtitle: Are you sure you want to continue?
itemDiary: itemDiary:
date: Date date: Date
id: Id origin: Origin
state: State state: State
reference: Reference reference: Reference
client: Client entity: Entity
in: In in: In
out: Out out: Out
balance: Balance balance: Balance

View File

@ -14,10 +14,10 @@ shelvings:
removeConfirmSubtitle: ¿Seguro que quieres continuar? removeConfirmSubtitle: ¿Seguro que quieres continuar?
itemDiary: itemDiary:
date: Fecha date: Fecha
id: Id origin: Origen
state: Estado state: Estado
reference: Referencia reference: Referencia
client: Cliente entity: Entidad
in: Entrada in: Entrada
out: Salida out: Salida
balance: Balance balance: Balance

View File

@ -60,7 +60,7 @@ const filter = {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
data.value = useCardDescription(entity.client.name, entity.id); data.value = useCardDescription(entity?.client?.name, entity?.id);
state.set('OrderDescriptor', entity); state.set('OrderDescriptor', entity);
}; };
@ -131,7 +131,7 @@ const total = ref(null);
color="primary" color="primary"
:to="{ name: 'CustomerCard', params: { id: entity.clientFk } }" :to="{ name: 'CustomerCard', params: { id: entity.clientFk } }"
> >
<QTooltip>{{ t('claim.card.customerSummary') }}</QTooltip> <QTooltip>{{ t('claim.customerSummary') }}</QTooltip>
</QBtn> </QBtn>
</QCardActions> </QCardActions>
</template> </template>

View File

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

View File

@ -21,9 +21,6 @@ const quasar = useQuasar();
const componentKey = ref(0); const componentKey = ref(0);
const tableLinesRef = ref(); const tableLinesRef = ref();
const order = ref(); const order = ref();
const refresh = () => {
componentKey.value += 1;
};
const orderSummary = ref({ const orderSummary = ref({
total: null, total: null,
vat: null, vat: null,
@ -66,37 +63,6 @@ const lineFilter = ref({
where: { orderFk: route.params.id }, where: { orderFk: route.params.id },
}); });
function confirmRemove(item) {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('confirmDeletion'),
message: t('confirmDeletionMessage'),
promise: async () => remove(item),
},
});
}
async function remove(item) {
await axios.post('OrderRows/removes', {
actualOrderId: route.params.id,
rows: [item.id],
});
quasar.notify({
message: t('globals.dataDeleted'),
type: 'positive',
});
refresh();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
}
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'center', align: 'center',
@ -121,6 +87,7 @@ const columns = computed(() => [
condition: () => true, condition: () => true,
}, },
isId: true, isId: true,
format: (row) => row?.item?.id,
}, },
{ {
align: 'left', align: 'left',
@ -190,12 +157,45 @@ const columns = computed(() => [
{ {
title: t('delete'), title: t('delete'),
icon: 'delete', icon: 'delete',
click: (row) => confirmRemove(row.item), action: (row) => confirmRemove(row),
isPrimary: true, isPrimary: true,
}, },
], ],
}, },
]); ]);
function confirmRemove(item) {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('confirmDeletion'),
message: t('confirmDeletionMessage'),
promise: async () => remove(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],
});
quasar.notify({
message: t('globals.dataDeleted'),
type: 'positive',
});
tableLinesRef.value.reload();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
}
</script> </script>
<template> <template>
@ -249,7 +249,6 @@ const columns = computed(() => [
data-key="OrderLines" data-key="OrderLines"
url="OrderRows" url="OrderRows"
:columns="columns" :columns="columns"
default-mode="table"
:right-search="false" :right-search="false"
:use-model="true" :use-model="true"
auto-load auto-load
@ -272,7 +271,7 @@ const columns = computed(() => [
</template> </template>
</VnTable> </VnTable>
</div> </div>
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed"> <QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" /> <QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QTooltip> <QTooltip>
{{ t('confirm') }} {{ t('confirm') }}

View File

@ -154,7 +154,6 @@ async function fetchClientAddress(id, data) {
}, },
}" }"
:columns="columns" :columns="columns"
default-mode="table"
redirect="order" redirect="order"
auto-load auto-load
> >

View File

@ -78,10 +78,11 @@ const columns = computed(() => [
:columns="columns" :columns="columns"
:right-search="false" :right-search="false"
:use-model="true" :use-model="true"
default-mode="card"
/> />
</template> </template>
<i18n> <i18n>
es: es:
isOwn: Tiene propietario isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia Search agency: Buscar agencia

View File

@ -117,6 +117,7 @@ function downloadPdfs() {
:columns="columns" :columns="columns"
:right-search="true" :right-search="true"
:use-model="true" :use-model="true"
default-mode="card"
/> />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -237,7 +237,6 @@ const openTicketsDialog = (id) => {
url="Routes/filter" url="Routes/filter"
:columns="columns" :columns="columns"
:right-search="true" :right-search="true"
default-mode="table"
:is-editable="true" :is-editable="true"
:create="{ :create="{
urlCreate: 'Routes', urlCreate: 'Routes',

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onUpdated } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';

View File

@ -99,7 +99,6 @@ const columns = computed(() => [
}" }"
order="id ASC" order="id ASC"
:columns="columns" :columns="columns"
default-mode="table"
auto-load auto-load
:right-search="false" :right-search="false"
:use-model="true" :use-model="true"

View File

@ -5,7 +5,6 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
const { t } = useI18n(); const { t } = useI18n();

View File

@ -3,6 +3,7 @@ import { onMounted, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDate, toCurrency } from 'src/filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import TicketSummary from './Card/TicketSummary.vue'; import TicketSummary from './Card/TicketSummary.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';

View File

@ -198,7 +198,6 @@ const columns = computed(() => [
}" }"
order="landed DESC" order="landed DESC"
:columns="columns" :columns="columns"
default-mode="table"
auto-load auto-load
redirect="travel" redirect="travel"
:is-editable="false" :is-editable="false"

View File

@ -77,7 +77,6 @@ const columns = computed(() => [
}" }"
order="paymentDate DESC" order="paymentDate DESC"
:columns="columns" :columns="columns"
default-mode="table"
auto-load auto-load
:right-search="false" :right-search="false"
:is-editable="true" :is-editable="true"

View File

@ -71,7 +71,7 @@ watch(
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
data.value = useCardDescription(entity.user.nickname, entity.id); data.value = useCardDescription(entity.user?.nickname, entity.id);
}; };
const openChangePasswordForm = () => changePasswordFormDialog.value.show(); const openChangePasswordForm = () => changePasswordFormDialog.value.show();

View File

@ -116,7 +116,6 @@ const columns = computed(() => [
}" }"
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table"
auto-load auto-load
:right-search="false" :right-search="false"
:is-editable="true" :is-editable="true"

View File

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

View File

@ -8,7 +8,8 @@ describe('InvoiceInCorrective', () => {
it('should create a correcting invoice', () => { it('should create a correcting invoice', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/1/summary?limit=10`); cy.visit(`/#/invoice-in/1/summary`);
cy.waitForElement('.q-page');
cy.openActionsDescriptor(); cy.openActionsDescriptor();

View File

@ -7,6 +7,7 @@ describe('InvoiceInDescriptor', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/invoice-in/1/summary'); cy.visit('/#/invoice-in/1/summary');
cy.waitForElement('.q-page');
cy.openActionsDescriptor(); cy.openActionsDescriptor();
cy.get(firstDescritorOpt).click(); cy.get(firstDescritorOpt).click();

View File

@ -5,7 +5,7 @@ import { useRouter } from 'vue-router';
import * as vueRouter from 'vue-router'; import * as vueRouter from 'vue-router';
describe('useArrayData', () => { describe('useArrayData', () => {
const filter = '{"order":"","limit":10,"skip":0}'; const filter = '{"limit":10,"skip":0}';
const params = { supplierFk: 2 }; const params = { supplierFk: 2 };
beforeEach(() => { beforeEach(() => {
vi.spyOn(useRouter(), 'replace'); vi.spyOn(useRouter(), 'replace');