#6896 end orders migration #400
|
@ -1,18 +1,20 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
|
||||
jon marked this conversation as resolved
|
||||
const $props = defineProps({
|
||||
jon marked this conversation as resolved
jsegarra
commented
Esta prop no se usa para nada, no? Esta prop no se usa para nada, no?
|
||||
collection: {
|
||||
type: [String, Number],
|
||||
default: null,
|
||||
default: 'Images',
|
||||
},
|
||||
size: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
type: String,
|
||||
default: '200x200',
|
||||
},
|
||||
jsegarra marked this conversation as resolved
jsegarra
commented
La defines como String pero el valor no lo usas en ningún lado. La defines como String pero el valor no lo usas en ningún lado.
En la 32, compruebas si está o no
|
||||
zoomSize: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'lg',
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
Esta tampoco Esta tampoco
|
||||
},
|
||||
id: {
|
||||
type: Boolean,
|
||||
|
@ -20,9 +22,16 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
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>
|
||||
<template>
|
||||
<QImg
|
||||
:src="url"
|
||||
class="img"
|
||||
v-bind="$attrs"
|
||||
@click="show = !show"
|
||||
|
@ -31,6 +40,7 @@ const show = ref(false);
|
|||
/>
|
||||
<QDialog v-model="show" v-if="$props.zoomSize">
|
||||
<QImg
|
||||
:src="url"
|
||||
class="img_zoom"
|
||||
v-bind="$attrs"
|
||||
jsegarra marked this conversation as resolved
jsegarra
commented
La acción es de zoom, así que pondría zoom-in La acción es de zoom, así que pondría zoom-in
|
||||
spinner-color="primary"
|
||||
|
@ -42,11 +52,13 @@ const show = ref(false);
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.img {
|
||||
cursor: pointer;
|
||||
border-radius: 0%;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.img_zoom {
|
||||
width: 12%;
|
||||
width: 72%;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -69,12 +69,7 @@ onMounted(async () => {
|
|||
|
||||
<template>
|
||||
<div class="relative-position">
|
||||
<VnImg
|
||||
:src="image"
|
||||
spinner-color="primary"
|
||||
style="min-height: 256px"
|
||||
zoom-size="lg"
|
||||
>
|
||||
<VnImg :id="$props.entityId">
|
||||
<template #error>
|
||||
<div class="absolute-full picture text-center q-pa-md flex flex-center">
|
||||
jon marked this conversation as resolved
Outdated
jgallego
commented
estos no pueden ir en el mismo componente? estos no pueden ir en el mismo componente?
|
||||
<div>
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
De echo, si pones esta prop modificas la imagen y no se ve entera.
De echo, si pones esta prop modificas la imagen y no se ve entera.
Por ejemplo, http://localhost:9000/#/item/6/summary?limit=10
1. Con el style, la imagen se corta en las letras, cuando realmente no es así
2. Spinner-color no es una prop del component VnImg, asi que no haria falta definirla
3. Te propondria definir un valor por defecto a la prop de zoomSize,por ejemplo "lg"
jsegarra
commented
Veo que has puesto v-bind="$attrs, guay. Veo que has puesto v-bind="$attrs, guay.
Sin embargo, con respecto a spinner-color, si lo pones en este component, todas las instancias usaran este color y no el que hayas puesto en las instancias
|
||||
|
|
|
@ -139,9 +139,19 @@ const onOrderChange = (value, params) => {
|
|||
};
|
||||
|
||||
const onOrderFieldChange = (value, params) => {
|
||||
console.log('value: ', value);
|
||||
console.log('params: ', params);
|
||||
const tagObj = JSON.parse(params.orderBy);
|
||||
const tagObj = JSON.parse(params.orderBy); // esto donde va
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
💣👀 💣👀
|
||||
const fields = {
|
||||
Relevancy: (value) => value + ' DESC, name',
|
||||
ColorAndPrice: 'showOrder, price',
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
En este switch se repite la la asignación de params.orderBy y los console.logs Se puede reducir definiendo un objeto en el que el "case" sea la clave y la asignación de tagObj.field el valor En este switch se repite la la asignación de params.orderBy y los console.logs
Se puede reducir definiendo un objeto en el que el "case" sea la clave y la asignación de tagObj.field el valor
|
||||
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) {
|
||||
case 'Relevancy':
|
||||
tagObj.field = value + ' DESC, name';
|
||||
|
@ -211,7 +221,6 @@ const useLang = (values) => {
|
|||
@remove="clearFilter"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
{{ console.log('tag: ', tag) }}
|
||||
<strong v-if="tag.label === 'categoryFk'">
|
||||
{{ t(selectedCategory?.name || '') }}
|
||||
</strong>
|
||||
|
|
|
@ -7,13 +7,10 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
|||
import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
import { useSession } from 'composables/useSession';
|
||||
import toCurrency from '../../../filters/toCurrency';
|
||||
|
||||
const DEFAULT_PRICE_KG = 0;
|
||||
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
const { t } = useI18n();
|
||||
|
||||
defineProps({
|
||||
|
@ -30,15 +27,7 @@ const dialog = ref(null);
|
|||
<div class="container order-catalog-item overflow-hidden">
|
||||
<QCard class="card shadow-6">
|
||||
<div class="img-wrapper">
|
||||
<VnImg
|
||||
: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"
|
||||
/>
|
||||
<VnImg :id="item.id" class="image" />
|
||||
<div v-if="item.hex" class="item-color-container">
|
||||
<div
|
||||
class="item-color"
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
Propuesta: dejar src y class. Si quieres darle otro estilo, lo comentamos Propuesta: dejar src y class. Si quieres darle otro estilo, lo comentamos
|
||||
|
|
|
@ -37,11 +37,9 @@ const onClientsFetched = (data) => {
|
|||
const client = clientList.value.find(
|
||||
(client) => client.id === initialFormState.clientFk
|
||||
);
|
||||
if (client && client.defaultAddressFk) {
|
||||
fetchAddressList(client.defaultAddressFk);
|
||||
} else {
|
||||
if (!client?.defaultAddressFk)
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
podemos simplificarlo
podemos simplificarlo
```
if (!client?.defaultAddressFk)
throw new Error(t(`No default address found for the client`));
fetchAddressList(client.defaultAddressFk);
```
|
||||
throw new Error(t(`No default address found for the client`));
|
||||
}
|
||||
fetchAddressList(client.defaultAddressFk);
|
||||
};
|
||||
|
||||
const fetchAddressList = async (addressId) => {
|
||||
|
@ -148,7 +146,7 @@ async function onDataSaved(data) {
|
|||
<div class="q-pa-md">
|
||||
<FormModel
|
||||
:url="!isNew ? `Orders/${route.params.id}` : null"
|
||||
:url-create="'Orders/new'"
|
||||
url-create="Orders/new"
|
||||
@on-data-saved="onDataSaved"
|
||||
:model="ORDER_MODEL"
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
url-create="Orders/new" url-create="Orders/new"
|
||||
:form-initial-data="isNew ? initialFormState : null"
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
|
|||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import OrderCatalogItem from 'pages/Order/Card/OrderCatalogItem.vue';
|
||||
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
|
||||
|
||||
|
@ -53,31 +52,6 @@ function extractValueTags(items) {
|
|||
</script>
|
||||
|
||||
<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>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<OrderCatalogFilter
|
||||
|
|
|
@ -12,15 +12,12 @@ import VnConfirm from 'components/ui/VnConfirm.vue';
|
|||
import VnImg from 'components/ui/VnImg.vue';
|
||||
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
import { useSession } from 'composables/useSession';
|
||||
import axios from 'axios';
|
||||
import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const quasar = useQuasar();
|
||||
const token = getTokenMultimedia();
|
||||
const orderSummary = ref({
|
||||
total: null,
|
||||
vat: null,
|
||||
|
@ -44,7 +41,6 @@ function confirmRemove(item) {
|
|||
}
|
||||
|
||||
async function remove(item) {
|
||||
console.log('item: ', item);
|
||||
await axios.post('OrderRows/removes', {
|
||||
actualOrderId: route.params.id,
|
||||
rows: [item.id],
|
||||
|
@ -65,6 +61,11 @@ async function confirmOrder() {
|
|||
}
|
||||
|
||||
const detailsColumns = ref([
|
||||
{
|
||||
name: 'img',
|
||||
label: '',
|
||||
field: (row) => row?.item?.id,
|
||||
},
|
||||
{
|
||||
name: 'item',
|
||||
label: t('order.summary.item'),
|
||||
|
@ -76,6 +77,17 @@ const detailsColumns = ref([
|
|||
label: t('globals.description'),
|
||||
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',
|
||||
label: t('order.summary.quantity'),
|
||||
|
@ -91,6 +103,11 @@ const detailsColumns = ref([
|
|||
label: t('order.summary.amount'),
|
||||
field: (row) => toCurrency(row?.quantity * row?.price),
|
||||
},
|
||||
{
|
||||
name: 'actions',
|
||||
label: '',
|
||||
field: (row) => row?.id,
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
|
@ -164,104 +181,91 @@ const detailsColumns = ref([
|
|||
:columns="detailsColumns"
|
||||
:rows="rows"
|
||||
flat
|
||||
class="full-width"
|
||||
style="text-align: center"
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props" class="tr-header">
|
||||
<QTh></QTh>
|
||||
<QTh auto-width>{{ t('item') }}</QTh>
|
||||
<QTh>{{ t('globals.description') }}</QTh>
|
||||
<QTh>{{ t('warehouse') }}</QTh>
|
||||
<QTh>{{ t('shipped') }}</QTh>
|
||||
<QTh auto-width>
|
||||
{{ t('order.summary.quantity') }}
|
||||
<QTr class="tr-header" :props="props">
|
||||
<QTh
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
style="text-align: center"
|
||||
>
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
<QTh auto-width>{{ t('order.summary.price') }}</QTh>
|
||||
<QTh auto-width>{{ t('amount') }}</QTh>
|
||||
<QTh></QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
<QTr :props="props">
|
||||
<QTd>
|
||||
<div class="image-wrapper">
|
||||
<VnImg
|
||||
: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"
|
||||
/>
|
||||
<template #body-cell-img="{ value }">
|
||||
<QTd>
|
||||
<div class="image-wrapper">
|
||||
<VnImg :id="value" class="rounded" />
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-item="{ value }">
|
||||
<QTd class="item">
|
||||
<span class="link">
|
||||
<QBtn flat>
|
||||
{{ value }}
|
||||
</QBtn>
|
||||
<ItemDescriptorProxy :id="value" />
|
||||
</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ value }">
|
||||
<QTd class="description-cell">
|
||||
<FetchedTags
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
Nos e muestran porque te falta pasarle row.item Nos e muestran porque te falta pasarle row.item
|
||||
:item="value"
|
||||
:max-length="6"
|
||||
class="fetched-tags"
|
||||
/>
|
||||
<div class="row full-width justify-between">
|
||||
{{ value }}
|
||||
<div v-if="value" class="subName">
|
||||
{{ value.toUpperCase() }}
|
||||
</div>
|
||||
</QTd>
|
||||
<QTd key="item" :props="props" class="item">
|
||||
<span class="link">
|
||||
<QBtn flat>
|
||||
{{ props.row.item?.id }}
|
||||
</QBtn>
|
||||
<ItemDescriptorProxy
|
||||
:id="props.row.item?.id"
|
||||
/>
|
||||
</span>
|
||||
</QTd>
|
||||
<QTd
|
||||
key="description"
|
||||
:props="props"
|
||||
class="description-cell"
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-warehouse="{ value }">
|
||||
jon marked this conversation as resolved
jsegarra
commented
Eliminar body-cell-XXX cuando sólo se muestra valor Eliminar body-cell-XXX cuando sólo se muestra valor
|
||||
<QTd>
|
||||
{{ value }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-shipped="{ value }">
|
||||
<QTd>
|
||||
{{ value }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-quantity="{ value }">
|
||||
<QTd>
|
||||
{{ value }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-price="{ value }">
|
||||
<QTd>
|
||||
{{ value }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-amount="{ value }">
|
||||
<QTd>
|
||||
{{ value }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ value }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
name="delete"
|
||||
color="primary"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
@click.stop="confirmRemove(value)"
|
||||
style="margin-left: 40%"
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
es necesario? es necesario?
|
||||
>
|
||||
<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
|
||||
:item="props.row.item"
|
||||
:max-length="6"
|
||||
class="fetched-tags"
|
||||
/>
|
||||
</QTd>
|
||||
<QTd>
|
||||
{{ props.row.warehouse.name }}
|
||||
</QTd>
|
||||
<QTd>
|
||||
{{ toDate(props.row.shipped) }}
|
||||
</QTd>
|
||||
<QTd key="quantity" :props="props">
|
||||
{{ props.row.quantity }}
|
||||
</QTd>
|
||||
<QTd key="price" :props="props">
|
||||
{{ toCurrency(props.row.price) }}
|
||||
</QTd>
|
||||
<QTd key="amount" :props="props">
|
||||
{{
|
||||
toCurrency(
|
||||
props.row?.quantity * props.row?.price
|
||||
)
|
||||
}}
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QIcon
|
||||
name="delete"
|
||||
color="primary"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
@click.stop="confirmRemove(props.row)"
|
||||
style="margin-left: 40%"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('Remove thermograph')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</QTr>
|
||||
<QTooltip>{{ t('Remove thermograph') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</div>
|
||||
|
@ -320,32 +324,9 @@ const detailsColumns = ref([
|
|||
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 {
|
||||
width: 25%;
|
||||
jon marked this conversation as resolved
Outdated
jsegarra
commented
poniendo 5, 10, 15, 20 o 25 tenemos el mismo resultado poniendo 5, 10, 15, 20 o 25 tenemos el mismo resultado
|
||||
}
|
||||
jon marked this conversation as resolved
Outdated
jgallego
commented
hay mucho estilo, en general no hay que usar estilo, sino que se use lo nativo, pongo a @jsegarra para que lo valide y/o te explique como implementarlo. hay mucho estilo, en general no hay que usar estilo, sino que se use lo nativo, pongo a @jsegarra para que lo valide y/o te explique como implementarlo.
|
||||
.fetched-tags {
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.subName {
|
||||
text-transform: uppercase;
|
||||
|
|
Lo ideal de este componente seria montar la url en este componente pasandole la coleccion(user/Images, etc), el tamaño(200x200, 50x50, etc), el id.
Así podemos reemplazar QImg y la propiedad src por VnImg y las props de antes