7691-testToMaster #537

Merged
alexm merged 395 commits from 7691-testToMaster into master 2024-07-09 05:39:56 +00:00
7 changed files with 135 additions and 177 deletions
Showing only changes of commit a5f4f85c80 - Show all commits

View File

@ -1,18 +1,20 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, computed } from 'vue';
import { useSession } from 'src/composables/useSession';
const $props = defineProps({ const $props = defineProps({
collection: { collection: {
type: [String, Number], type: [String, Number],
default: null, default: 'Images',
}, },
size: { size: {
type: Boolean, type: String,
default: false, default: '200x200',
}, },
zoomSize: { zoomSize: {
type: String, type: String,
required: true, required: true,
default: 'lg',
}, },
id: { id: {
type: Boolean, type: Boolean,
@ -20,9 +22,16 @@ const $props = defineProps({
}, },
}); });
const show = ref(false); const show = ref(false);
const token = useSession().getTokenMultimedia();
const timeStamp = `timestamp=${Date.now()}`;
const url = computed(
() =>
`/api/${$props.collection}/catalog/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp}`
);
</script> </script>
<template> <template>
<QImg <QImg
:src="url"
class="img" class="img"
v-bind="$attrs" v-bind="$attrs"
@click="show = !show" @click="show = !show"
@ -31,6 +40,7 @@ const show = ref(false);
/> />
<QDialog v-model="show" v-if="$props.zoomSize"> <QDialog v-model="show" v-if="$props.zoomSize">
<QImg <QImg
:src="url"
class="img_zoom" class="img_zoom"
v-bind="$attrs" v-bind="$attrs"
spinner-color="primary" spinner-color="primary"
@ -42,11 +52,13 @@ const show = ref(false);
<style lang="scss" scoped> <style lang="scss" scoped>
.img { .img {
cursor: pointer; cursor: zoom-in;
border-radius: 0%; }
.rounded {
border-radius: 50%;
} }
.img_zoom { .img_zoom {
width: 12%; width: 72%;
height: auto; height: auto;
} }
</style> </style>

View File

@ -69,12 +69,7 @@ onMounted(async () => {
<template> <template>
<div class="relative-position"> <div class="relative-position">
<VnImg <VnImg :id="$props.entityId">
:src="image"
spinner-color="primary"
style="min-height: 256px"
zoom-size="lg"
>
<template #error> <template #error>
<div class="absolute-full picture text-center q-pa-md flex flex-center"> <div class="absolute-full picture text-center q-pa-md flex flex-center">
<div> <div>

View File

@ -139,9 +139,19 @@ const onOrderChange = (value, params) => {
}; };
const onOrderFieldChange = (value, params) => { const onOrderFieldChange = (value, params) => {
console.log('value: ', value); const tagObj = JSON.parse(params.orderBy); // esto donde va
console.log('params: ', params); const fields = {
const tagObj = JSON.parse(params.orderBy); Relevancy: (value) => value + ' DESC, name',
ColorAndPrice: 'showOrder, price',
Name: 'name',
Price: 'price',
};
let tagField = fields[value];
if (!tagField) return;
if (typeof tagField === 'function') tagField = tagField(value);
tagObj.field = tagField;
params.orderBy = JSON.stringify(tagObj);
switch (value) { switch (value) {
case 'Relevancy': case 'Relevancy':
tagObj.field = value + ' DESC, name'; tagObj.field = value + ' DESC, name';
@ -211,7 +221,6 @@ const useLang = (values) => {
@remove="clearFilter" @remove="clearFilter"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
{{ console.log('tag: ', tag) }}
<strong v-if="tag.label === 'categoryFk'"> <strong v-if="tag.label === 'categoryFk'">
{{ t(selectedCategory?.name || '') }} {{ t(selectedCategory?.name || '') }}
</strong> </strong>

View File

@ -7,13 +7,10 @@ import VnImg from 'src/components/ui/VnImg.vue';
import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue'; import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import { useSession } from 'composables/useSession';
import toCurrency from '../../../filters/toCurrency'; import toCurrency from '../../../filters/toCurrency';
const DEFAULT_PRICE_KG = 0; const DEFAULT_PRICE_KG = 0;
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const { t } = useI18n(); const { t } = useI18n();
defineProps({ defineProps({
@ -30,15 +27,7 @@ const dialog = ref(null);
<div class="container order-catalog-item overflow-hidden"> <div class="container order-catalog-item overflow-hidden">
<QCard class="card shadow-6"> <QCard class="card shadow-6">
<div class="img-wrapper"> <div class="img-wrapper">
<VnImg <VnImg :id="item.id" class="image" />
:src="`/api/Images/catalog/200x200/${item.id}/download?access_token=${token}`"
spinner-color="primary"
:ratio="1"
zoom-size="lg"
height="192"
width="192"
class="image"
/>
<div v-if="item.hex" class="item-color-container"> <div v-if="item.hex" class="item-color-container">
<div <div
class="item-color" class="item-color"

View File

@ -37,11 +37,9 @@ const onClientsFetched = (data) => {
const client = clientList.value.find( const client = clientList.value.find(
(client) => client.id === initialFormState.clientFk (client) => client.id === initialFormState.clientFk
); );
if (client && client.defaultAddressFk) { if (!client?.defaultAddressFk)
fetchAddressList(client.defaultAddressFk);
} else {
throw new Error(t(`No default address found for the client`)); throw new Error(t(`No default address found for the client`));
} fetchAddressList(client.defaultAddressFk);
}; };
const fetchAddressList = async (addressId) => { const fetchAddressList = async (addressId) => {
@ -148,7 +146,7 @@ async function onDataSaved(data) {
<div class="q-pa-md"> <div class="q-pa-md">
<FormModel <FormModel
:url="!isNew ? `Orders/${route.params.id}` : null" :url="!isNew ? `Orders/${route.params.id}` : null"
:url-create="'Orders/new'" url-create="Orders/new"
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
:model="ORDER_MODEL" :model="ORDER_MODEL"
:form-initial-data="isNew ? initialFormState : null" :form-initial-data="isNew ? initialFormState : null"

View File

@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import OrderCatalogItem from 'pages/Order/Card/OrderCatalogItem.vue'; import OrderCatalogItem from 'pages/Order/Card/OrderCatalogItem.vue';
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue'; import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
@ -53,31 +52,6 @@ function extractValueTags(items) {
</script> </script>
<template> <template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
<VnSearchbar
data-key="OrderCatalogList"
url="Orders/CatalogFilter"
:limit="50"
:user-params="catalogParams"
:static-params="['orderFk', 'orderBy']"
:redirect="false"
/>
</Teleport>
<Teleport v-if="stateStore.isHeaderMounted()" to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click.stop="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<OrderCatalogFilter <OrderCatalogFilter

View File

@ -12,15 +12,12 @@ import VnConfirm from 'components/ui/VnConfirm.vue';
import VnImg from 'components/ui/VnImg.vue'; import VnImg from 'components/ui/VnImg.vue';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency, toDate } from 'src/filters';
import { useSession } from 'composables/useSession';
import axios from 'axios'; import axios from 'axios';
import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const quasar = useQuasar(); const quasar = useQuasar();
const token = getTokenMultimedia();
const orderSummary = ref({ const orderSummary = ref({
total: null, total: null,
vat: null, vat: null,
@ -44,7 +41,6 @@ function confirmRemove(item) {
} }
async function remove(item) { async function remove(item) {
console.log('item: ', item);
await axios.post('OrderRows/removes', { await axios.post('OrderRows/removes', {
actualOrderId: route.params.id, actualOrderId: route.params.id,
rows: [item.id], rows: [item.id],
@ -65,6 +61,11 @@ async function confirmOrder() {
} }
const detailsColumns = ref([ const detailsColumns = ref([
{
name: 'img',
label: '',
field: (row) => row?.item?.id,
},
{ {
name: 'item', name: 'item',
label: t('order.summary.item'), label: t('order.summary.item'),
@ -76,6 +77,17 @@ const detailsColumns = ref([
label: t('globals.description'), label: t('globals.description'),
field: (row) => row?.item?.name, field: (row) => row?.item?.name,
}, },
{
name: 'warehouse',
label: t('warehouse'),
field: (row) => row?.warehouse?.name,
sortable: true,
},
{
name: 'shipped',
label: t('shipped'),
field: (row) => toDate(row?.shipped),
},
{ {
name: 'quantity', name: 'quantity',
label: t('order.summary.quantity'), label: t('order.summary.quantity'),
@ -91,6 +103,11 @@ const detailsColumns = ref([
label: t('order.summary.amount'), label: t('order.summary.amount'),
field: (row) => toCurrency(row?.quantity * row?.price), field: (row) => toCurrency(row?.quantity * row?.price),
}, },
{
name: 'actions',
label: '',
field: (row) => row?.id,
},
]); ]);
</script> </script>
@ -164,104 +181,91 @@ const detailsColumns = ref([
:columns="detailsColumns" :columns="detailsColumns"
:rows="rows" :rows="rows"
flat flat
class="full-width"
style="text-align: center" style="text-align: center"
> >
<template #header="props"> <template #header="props">
<QTr :props="props" class="tr-header"> <QTr class="tr-header" :props="props">
<QTh></QTh> <QTh
<QTh auto-width>{{ t('item') }}</QTh> v-for="col in props.cols"
<QTh>{{ t('globals.description') }}</QTh> :key="col.name"
<QTh>{{ t('warehouse') }}</QTh> :props="props"
<QTh>{{ t('shipped') }}</QTh> style="text-align: center"
<QTh auto-width> >
{{ t('order.summary.quantity') }} {{ t(col.label) }}
</QTh> </QTh>
<QTh auto-width>{{ t('order.summary.price') }}</QTh>
<QTh auto-width>{{ t('amount') }}</QTh>
<QTh></QTh>
</QTr> </QTr>
</template> </template>
<template #body="props"> <template #body-cell-img="{ value }">
<QTr :props="props">
<QTd> <QTd>
<div class="image-wrapper"> <div class="image-wrapper">
<VnImg <VnImg :id="value" class="rounded" />
:src="`/api/Images/catalog/200x200/${props.row.item?.id}/download?access_token=${token}`"
class="image"
height="50"
width="50"
style="
cursor: pointer;
border-radius: 50%;
"
zoom-size="lg"
/>
</div> </div>
</QTd> </QTd>
<QTd key="item" :props="props" class="item"> </template>
<template #body-cell-item="{ value }">
<QTd class="item">
<span class="link"> <span class="link">
<QBtn flat> <QBtn flat>
{{ props.row.item?.id }} {{ value }}
</QBtn> </QBtn>
<ItemDescriptorProxy <ItemDescriptorProxy :id="value" />
:id="props.row.item?.id"
/>
</span> </span>
</QTd> </QTd>
<QTd </template>
key="description" <template #body-cell-description="{ value }">
:props="props" <QTd class="description-cell">
class="description-cell"
>
<div class="row full-width justify-between">
{{ props.row.item.name }}
<div
v-if="props.row.item.subName"
class="subName"
>
{{ props.row.item.subName.toUpperCase() }}
</div>
</div>
<FetchedTags <FetchedTags
:item="props.row.item" :item="value"
:max-length="6" :max-length="6"
class="fetched-tags" class="fetched-tags"
/> />
<div class="row full-width justify-between">
{{ value }}
<div v-if="value" class="subName">
{{ value.toUpperCase() }}
</div>
</div>
</QTd> </QTd>
</template>
<template #body-cell-warehouse="{ value }">
<QTd> <QTd>
{{ props.row.warehouse.name }} {{ value }}
</QTd> </QTd>
</template>
<template #body-cell-shipped="{ value }">
<QTd> <QTd>
{{ toDate(props.row.shipped) }} {{ value }}
</QTd> </QTd>
<QTd key="quantity" :props="props"> </template>
{{ props.row.quantity }} <template #body-cell-quantity="{ value }">
<QTd>
{{ value }}
</QTd> </QTd>
<QTd key="price" :props="props"> </template>
{{ toCurrency(props.row.price) }} <template #body-cell-price="{ value }">
<QTd>
{{ value }}
</QTd> </QTd>
<QTd key="amount" :props="props"> </template>
{{ <template #body-cell-amount="{ value }">
toCurrency( <QTd>
props.row?.quantity * props.row?.price {{ value }}
)
}}
</QTd> </QTd>
</template>
<template #body-cell-actions="{ value }">
<QTd> <QTd>
<QIcon <QIcon
name="delete" name="delete"
color="primary" color="primary"
size="sm" size="sm"
class="cursor-pointer" class="cursor-pointer"
@click.stop="confirmRemove(props.row)" @click.stop="confirmRemove(value)"
style="margin-left: 40%" style="margin-left: 40%"
> >
<QTooltip>{{ <QTooltip>{{ t('Remove thermograph') }}</QTooltip>
t('Remove thermograph')
}}</QTooltip>
</QIcon> </QIcon>
</QTd> </QTd>
</QTr>
</template> </template>
</QTable> </QTable>
</div> </div>
@ -320,32 +324,9 @@ const detailsColumns = ref([
text-align: center; text-align: center;
} }
.description {
display: flex;
flex-direction: column;
justify-content: center;
text-align: left;
height: auto;
padding-top: 12px;
padding-bottom: 12px;
.name {
display: flex;
align-items: center;
padding-bottom: 8px;
& > * {
flex: 1;
}
}
}
.description-cell { .description-cell {
width: 25%; width: 25%;
} }
.fetched-tags {
max-width: 90%;
}
.subName { .subName {
text-transform: uppercase; text-transform: uppercase;