Compare commits
12 Commits
dev
...
7449-claim
Author | SHA1 | Date |
---|---|---|
|
06f6095d75 | |
|
6b509ac669 | |
|
d510c49670 | |
|
90b534ccdc | |
|
29adddcedf | |
|
d4fe1e6a6d | |
|
40aaca9791 | |
|
ddd9d61214 | |
|
95fb833927 | |
|
ed01b774a3 | |
|
2ecfbbdd19 | |
|
d7ba8868a6 |
|
@ -1,6 +1,4 @@
|
|||
import { boot } from 'quasar/wrappers';
|
||||
import { date as quasarDate } from 'quasar';
|
||||
const { formatDate } = quasarDate;
|
||||
|
||||
export default boot(() => {
|
||||
Date.vnUTC = () => {
|
||||
|
@ -27,34 +25,4 @@ export default boot(() => {
|
|||
const date = new Date(Date.vnUTC());
|
||||
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
||||
};
|
||||
|
||||
Date.getCurrentDateTimeFormatted = (
|
||||
options = {
|
||||
startOfDay: false,
|
||||
endOfDay: true,
|
||||
iso: true,
|
||||
mask: 'DD-MM-YYYY HH:mm',
|
||||
},
|
||||
) => {
|
||||
const date = Date.vnUTC();
|
||||
if (options.startOfDay) {
|
||||
date.setHours(0, 0, 0);
|
||||
}
|
||||
if (options.endOfDay) {
|
||||
date.setHours(23, 59, 0);
|
||||
}
|
||||
if (options.iso) {
|
||||
return date.toISOString();
|
||||
}
|
||||
return formatDate(date, options.mask);
|
||||
};
|
||||
|
||||
Date.convertToISODateTime = (dateTimeStr) => {
|
||||
const [datePart, timePart] = dateTimeStr.split(' ');
|
||||
const [day, month, year] = datePart.split('-');
|
||||
const [hours, minutes] = timePart.split(':');
|
||||
|
||||
const isoDate = new Date(year, month - 1, day, hours, minutes);
|
||||
return isoDate.toISOString();
|
||||
};
|
||||
});
|
||||
|
|
|
@ -347,8 +347,8 @@ watch(formUrl, async () => {
|
|||
<QBtnDropdown
|
||||
v-if="$props.goTo && $props.defaultSave"
|
||||
@click="onSubmitAndGo"
|
||||
:label="tMobile('globals.saveAndContinue')"
|
||||
:title="t('globals.saveAndContinue')"
|
||||
:label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:disable="!hasChanges"
|
||||
color="primary"
|
||||
icon="save"
|
||||
|
@ -397,4 +397,4 @@ watch(formUrl, async () => {
|
|||
:label="t && t('globals.pleaseWait')"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
|
@ -140,7 +140,7 @@ const updatePhotoPreview = (value) => {
|
|||
img.onerror = () => {
|
||||
notify(
|
||||
t("This photo provider doesn't allow remote downloads"),
|
||||
'negative',
|
||||
'negative'
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -219,7 +219,11 @@ const makeRequest = async () => {
|
|||
color="primary"
|
||||
class="cursor-pointer"
|
||||
@click="rotateLeft()"
|
||||
/>
|
||||
>
|
||||
<!-- <QTooltip class="no-pointer-events">
|
||||
{{ t('Rotate left') }}
|
||||
</QTooltip> -->
|
||||
</QIcon>
|
||||
<div>
|
||||
<div ref="photoContainerRef" />
|
||||
</div>
|
||||
|
@ -229,7 +233,11 @@ const makeRequest = async () => {
|
|||
color="primary"
|
||||
class="cursor-pointer"
|
||||
@click="rotateRight()"
|
||||
/>
|
||||
>
|
||||
<!-- <QTooltip class="no-pointer-events">
|
||||
{{ t('Rotate right') }}
|
||||
</QTooltip> -->
|
||||
</QIcon>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
|
@ -257,6 +265,7 @@ const makeRequest = async () => {
|
|||
class="cursor-pointer q-mr-sm"
|
||||
@click="openInputFile()"
|
||||
>
|
||||
<!-- <QTooltip>{{ t('globals.selectFile') }}</QTooltip> -->
|
||||
</QIcon>
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{
|
||||
|
|
|
@ -376,8 +376,8 @@ defineExpose({
|
|||
data-cy="saveAndContinueDefaultBtn"
|
||||
v-if="$props.goTo"
|
||||
@click="saveAndGo"
|
||||
:label="tMobile('globals.saveAndContinue')"
|
||||
:title="t('globals.saveAndContinue')"
|
||||
:label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:disable="!hasChanges"
|
||||
color="primary"
|
||||
icon="save"
|
||||
|
|
|
@ -8,8 +8,7 @@ const model = defineModel({ prop: 'modelValue' });
|
|||
<VnInput
|
||||
v-model="model"
|
||||
ref="inputRef"
|
||||
@keydown.tab="$refs.inputRef.vnInputRef.blur()"
|
||||
@blur="model = useAccountShortToStandard(model) ?? model"
|
||||
@keydown.tab="model = useAccountShortToStandard($event.target.value) ?? model"
|
||||
@input="model = $event.target.value.replace(/[^\d.]/g, '')"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
<script setup>
|
||||
import { computed, useAttrs } from 'vue';
|
||||
import { date } from 'quasar';
|
||||
import VnDate from './VnDate.vue';
|
||||
import VnTime from './VnTime.vue';
|
||||
|
||||
const $attrs = useAttrs();
|
||||
const model = defineModel({ type: [Date] });
|
||||
|
||||
const $props = defineProps({
|
||||
isOutlined: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showEvent: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
const styleAttrs = computed(() => {
|
||||
return $props.isOutlined
|
||||
? {
|
||||
dense: true,
|
||||
outlined: true,
|
||||
rounded: true,
|
||||
}
|
||||
: {};
|
||||
});
|
||||
const mask = 'DD-MM-YYYY HH:mm';
|
||||
const selectedDate = computed({
|
||||
get() {
|
||||
if (!model.value) return new Date(model.value);
|
||||
return date.formatDate(new Date(model.value), mask);
|
||||
},
|
||||
set(value) {
|
||||
model.value = Date.convertToISODateTime(value);
|
||||
},
|
||||
});
|
||||
const manageDate = (date) => {
|
||||
selectedDate.value = date;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="vnInputDateRef"
|
||||
v-model="selectedDate"
|
||||
class="vn-input-date"
|
||||
placeholder="dd/mm/aaaa HH:mm"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
:clearable="false"
|
||||
@click="isPopupOpen = !isPopupOpen"
|
||||
@keydown="isPopupOpen = false"
|
||||
hide-bottom-space
|
||||
@update:model-value="manageDate"
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDateTime'"
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="today" size="xs">
|
||||
<QPopupProxy cover transition-show="scale" transition-hide="scale">
|
||||
<VnDate :mask="mask" v-model="selectedDate" />
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
<template #append>
|
||||
<QIcon name="access_time" size="xs">
|
||||
<QPopupProxy cover transition-show="scale" transition-hide="scale">
|
||||
<VnTime format24h :mask="mask" v-model="selectedDate" />
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Open date: Abrir fecha
|
||||
</i18n>
|
|
@ -1,81 +0,0 @@
|
|||
import { createWrapper } from 'app/test/vitest/helper.js';
|
||||
import { describe, it, expect, beforeAll } from 'vitest';
|
||||
import VnInputDateTime from 'components/common/VnInputDateTime.vue';
|
||||
import vnDateBoot from 'src/boot/vnDate';
|
||||
|
||||
let vm;
|
||||
let wrapper;
|
||||
|
||||
beforeAll(() => {
|
||||
// Initialize the vnDate boot
|
||||
vnDateBoot();
|
||||
});
|
||||
function generateWrapper(date, outlined, showEvent) {
|
||||
wrapper = createWrapper(VnInputDateTime, {
|
||||
props: {
|
||||
modelValue: date,
|
||||
isOutlined: outlined,
|
||||
showEvent: showEvent,
|
||||
},
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
}
|
||||
|
||||
describe('VnInputDateTime', () => {
|
||||
describe('selectedDate', () => {
|
||||
it('formats a valid datetime correctly', async () => {
|
||||
generateWrapper('2023-12-25T10:30:00', false, true);
|
||||
await vm.$nextTick();
|
||||
expect(vm.selectedDate).toBe('25-12-2023 10:30');
|
||||
});
|
||||
|
||||
it('handles null date value', async () => {
|
||||
generateWrapper(null, false, true);
|
||||
await vm.$nextTick();
|
||||
expect(vm.selectedDate).toBeInstanceOf(Date);
|
||||
});
|
||||
|
||||
it('updates the model value when a new datetime is set', async () => {
|
||||
vm.selectedDate = '31-12-2023 15:45';
|
||||
await vm.$nextTick();
|
||||
expect(wrapper.emitted()['update:modelValue']).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('styleAttrs', () => {
|
||||
it('should return empty styleAttrs when isOutlined is false', async () => {
|
||||
generateWrapper('2023-12-25T10:30:00', false, true);
|
||||
await vm.$nextTick();
|
||||
expect(vm.styleAttrs).toEqual({});
|
||||
});
|
||||
|
||||
it('should set styleAttrs when isOutlined is true', async () => {
|
||||
generateWrapper('2023-12-25T10:30:00', true, true);
|
||||
await vm.$nextTick();
|
||||
expect(vm.styleAttrs).toEqual({
|
||||
dense: true,
|
||||
outlined: true,
|
||||
rounded: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('component rendering', () => {
|
||||
it('should render date and time icons', async () => {
|
||||
generateWrapper('2023-12-25T10:30:00', false, true);
|
||||
await vm.$nextTick();
|
||||
const icons = wrapper.findAllComponents({ name: 'QIcon' });
|
||||
expect(icons.length).toBe(2);
|
||||
expect(icons[0].props('name')).toBe('today');
|
||||
expect(icons[1].props('name')).toBe('access_time');
|
||||
});
|
||||
|
||||
it('should render popup proxies for date and time', async () => {
|
||||
generateWrapper('2023-12-25T10:30:00', false, true);
|
||||
await vm.$nextTick();
|
||||
const popups = wrapper.findAllComponents({ name: 'QPopupProxy' });
|
||||
expect(popups.length).toBe(2);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -44,8 +44,7 @@ onBeforeMount(async () => {
|
|||
});
|
||||
|
||||
// It enables to load data only once if the module is the same as the dataKey
|
||||
if (!isSameDataKey.value || !route.params.id || $props.id !== route.params.id)
|
||||
await getData();
|
||||
if (!isSameDataKey.value || !route.params.id) await getData();
|
||||
watch(
|
||||
() => [$props.url, $props.filter],
|
||||
async () => {
|
||||
|
@ -59,8 +58,7 @@ async function getData() {
|
|||
store.filter = $props.filter ?? {};
|
||||
isLoading.value = true;
|
||||
try {
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
const { data } = store;
|
||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||
state.set($props.dataKey, data);
|
||||
emit('onFetch', data);
|
||||
} finally {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, reactive, useAttrs, computed } from 'vue';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { ref, reactive, useAttrs, computed, onMounted, nextTick, } from 'vue';
|
||||
import { onBeforeRouteLeave , useRouter, useRoute} from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { tMobile } from 'src/composables/tMobile';
|
||||
import { toDateHourMin } from 'src/filters';
|
||||
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
|
@ -33,10 +34,15 @@ const $props = defineProps({
|
|||
addNote: { type: Boolean, default: false },
|
||||
selectType: { type: Boolean, default: false },
|
||||
justInput: { type: Boolean, default: false },
|
||||
goTo: { type: String, default: '', },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const componentIsRendered = ref(false);
|
||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||
const observationTypes = ref([]);
|
||||
const vnPaginateRef = ref();
|
||||
|
@ -45,6 +51,7 @@ const defaultObservationType = computed(() =>
|
|||
observationTypes.value.find(ot => ot.code === 'salesPerson')?.id
|
||||
);
|
||||
|
||||
let savedNote = false;
|
||||
let originalText;
|
||||
|
||||
function handleClick(e) {
|
||||
|
@ -68,6 +75,7 @@ async function insert() {
|
|||
};
|
||||
await axios.post($props.url, newBody);
|
||||
await vnPaginateRef.value.fetch();
|
||||
savedNote = true;
|
||||
}
|
||||
|
||||
function confirmAndUpdate() {
|
||||
|
@ -129,8 +137,29 @@ const handleObservationTypes = (data) => {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => (componentIsRendered.value = true));
|
||||
});
|
||||
|
||||
async function saveAndGo() {
|
||||
savedNote = false;
|
||||
await insert();
|
||||
await savedNote;
|
||||
router.push({ path: $props.goTo });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && componentIsRendered && $props.goTo && !route.path.includes('summary')">
|
||||
<QBtn
|
||||
:label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
color="primary"
|
||||
icon="save"
|
||||
@click="saveAndGo"
|
||||
data-cy="save-continue-note-button"
|
||||
/>
|
||||
</Teleport>
|
||||
<FetchData
|
||||
v-if="selectType"
|
||||
url="ObservationTypes"
|
||||
|
@ -176,7 +205,7 @@ const handleObservationTypes = (data) => {
|
|||
:required="'required' in originalAttrs"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
<template #append v-if="!$props.goTo">
|
||||
<QBtn
|
||||
:title="t('Save (Enter)')"
|
||||
icon="save"
|
||||
|
|
|
@ -20,17 +20,17 @@ globals:
|
|||
logOut: Log out
|
||||
date: Date
|
||||
dataSaved: Data saved
|
||||
openDetail: Open detail
|
||||
dataDeleted: Data deleted
|
||||
delete: Delete
|
||||
search: Search
|
||||
lines: Lines
|
||||
changes: Changes
|
||||
dataCreated: Data created
|
||||
add: Add
|
||||
create: Create
|
||||
edit: Edit
|
||||
save: Save
|
||||
saveAndContinue: Save and continue
|
||||
saveAndContinue: Save and go to
|
||||
remove: Remove
|
||||
reset: Reset
|
||||
close: Close
|
||||
|
@ -107,6 +107,8 @@ globals:
|
|||
from: From
|
||||
to: To
|
||||
notes: Notes
|
||||
photos: Photos
|
||||
due-day: Due day
|
||||
refresh: Refresh
|
||||
item: Item
|
||||
ticket: Ticket
|
||||
|
@ -391,6 +393,7 @@ errors:
|
|||
updateUserConfig: Error updating user config
|
||||
tokenConfig: Error fetching token config
|
||||
writeRequest: The requested operation could not be completed
|
||||
claimBeginningQuantity: Cannot import a line with a claimed quantity of 0
|
||||
login:
|
||||
title: Login
|
||||
username: Username
|
||||
|
|
|
@ -21,16 +21,16 @@ globals:
|
|||
date: Fecha
|
||||
dataSaved: Datos guardados
|
||||
dataDeleted: Datos eliminados
|
||||
dataCreated: Datos creados
|
||||
openDetail: Ver detalle
|
||||
delete: Eliminar
|
||||
search: Buscar
|
||||
lines: Lineas
|
||||
changes: Cambios
|
||||
dataCreated: Datos creados
|
||||
add: Añadir
|
||||
create: Crear
|
||||
edit: Modificar
|
||||
save: Guardar
|
||||
saveAndContinue: Guardar y continuar
|
||||
saveAndContinue: Guardar e ir a
|
||||
remove: Eliminar
|
||||
reset: Restaurar
|
||||
close: Cerrar
|
||||
|
@ -111,6 +111,8 @@ globals:
|
|||
from: Desde
|
||||
to: Hasta
|
||||
notes: Notas
|
||||
photos: Fotos
|
||||
due-day: Vencimiento
|
||||
refresh: Actualizar
|
||||
item: Artículo
|
||||
ticket: Ticket
|
||||
|
@ -387,6 +389,7 @@ errors:
|
|||
updateUserConfig: Error al actualizar la configuración de usuario
|
||||
tokenConfig: Error al obtener configuración de token
|
||||
writeRequest: No se pudo completar la operación solicitada
|
||||
claimBeginningQuantity: No se puede importar una linea sin una cantidad reclamada
|
||||
login:
|
||||
title: Inicio de sesión
|
||||
username: Nombre de usuario
|
||||
|
|
|
@ -13,8 +13,10 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
|||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const claim = ref(null);
|
||||
|
@ -176,12 +178,17 @@ async function save(data) {
|
|||
}
|
||||
|
||||
async function importToNewRefundTicket() {
|
||||
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
|
||||
await claimActionsForm.value.reload();
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
try{
|
||||
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
|
||||
await claimActionsForm.value.reload();
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (error) {
|
||||
const errorMessage = error.response?.data?.error?.message;
|
||||
notify( t(errorMessage), 'negative' );
|
||||
}
|
||||
}
|
||||
|
||||
async function post(query, params) {
|
||||
|
|
|
@ -33,6 +33,7 @@ function onBeforeSave(formData, originalData) {
|
|||
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
|
||||
<FormModel
|
||||
model="Claim"
|
||||
:go-to="`/claim/${route.params.id}/notes`"
|
||||
:url-update="`Claims/updateClaim/${route.params.id}`"
|
||||
:mapper="onBeforeSave"
|
||||
auto-load
|
||||
|
|
|
@ -78,6 +78,8 @@ const columns = computed(() => [
|
|||
label: t('Quantity'),
|
||||
field: ({ sale }) => sale.quantity,
|
||||
sortable: true,
|
||||
style: 'padding-right: 20px;',
|
||||
headerStyle: 'padding-right: 20px;'
|
||||
},
|
||||
{
|
||||
name: 'claimed',
|
||||
|
@ -110,6 +112,8 @@ const columns = computed(() => [
|
|||
field: ({ sale }) => totalRow(sale),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
style: 'padding-right: 20px;',
|
||||
headerStyle: 'padding-right: 20px;'
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -152,12 +156,33 @@ function showImportDialog() {
|
|||
.onOk(() => claimLinesForm.value.reload());
|
||||
}
|
||||
|
||||
async function saveWhenHasChanges() {
|
||||
if (claimLinesForm.value.getChanges().updates) {
|
||||
await claimLinesForm.value.onSubmit();
|
||||
onFetch(claimLinesForm.value.formData);
|
||||
function fillClaimedQuantities() {
|
||||
const formData = claimLinesForm.value.formData;
|
||||
let hasChanges = false;
|
||||
|
||||
const selectedRows = formData.filter(row => selected.value.includes(row));
|
||||
|
||||
for (const row of selectedRows) {
|
||||
if (row.quantity === 0 || row.quantity === null) {
|
||||
row.quantity = row.sale.quantity;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasChanges) {
|
||||
quasar.notify({
|
||||
message: t('Cantidades rellenadas automáticamente'),
|
||||
type: 'positive',
|
||||
});
|
||||
} else {
|
||||
quasar.notify({
|
||||
message: t('No hay cantidades para rellenar'),
|
||||
type: 'info',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
|
||||
|
@ -185,15 +210,16 @@ async function saveWhenHasChanges() {
|
|||
auto-load
|
||||
/>
|
||||
<div class="q-pa-md">
|
||||
|
||||
<CrudModel
|
||||
data-key="ClaimLines"
|
||||
ref="claimLinesForm"
|
||||
:go-to="`photos`"
|
||||
:url="`Claims/${route.params.id}/lines`"
|
||||
save-url="ClaimBeginnings/crud"
|
||||
:user-filter="linesFilter"
|
||||
@on-fetch="onFetch"
|
||||
v-model:selected="selected"
|
||||
:default-save="false"
|
||||
:default-reset="false"
|
||||
auto-load
|
||||
:limit="0"
|
||||
|
@ -214,8 +240,7 @@ async function saveWhenHasChanges() {
|
|||
v-model.number="row.quantity"
|
||||
type="number"
|
||||
dense
|
||||
@keyup.enter="saveWhenHasChanges()"
|
||||
@blur="saveWhenHasChanges()"
|
||||
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -272,10 +297,7 @@ async function saveWhenHasChanges() {
|
|||
type="number"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="
|
||||
saveWhenHasChanges()
|
||||
"
|
||||
@blur="saveWhenHasChanges()"
|
||||
|
||||
/>
|
||||
</QItemLabel>
|
||||
</template>
|
||||
|
@ -313,6 +335,18 @@ async function saveWhenHasChanges() {
|
|||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
:unelevated="true"
|
||||
:label="t('Rellenar cantidades')"
|
||||
:title="t('Rellenar cantidades')"
|
||||
icon="auto_fix_high"
|
||||
:disabled="!selected.length"
|
||||
@click="fillClaimedQuantities"
|
||||
/>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -35,9 +35,11 @@ const body = {
|
|||
workerFk: user.value.id,
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnNotes
|
||||
url="claimObservations"
|
||||
:go-to="`/claim/${route.params.id}/lines`"
|
||||
:add-note="$props.addNote"
|
||||
:user-filter="claimFilter"
|
||||
:filter="{ where: { claimFk: claimId } }"
|
||||
|
|
|
@ -41,6 +41,7 @@ const sampleType = ref({ hasPreview: false });
|
|||
const initialData = reactive({});
|
||||
const entityId = computed(() => route.params.id);
|
||||
const customer = computed(() => useArrayData('Customer').store?.data);
|
||||
const filterEmailUsers = { where: { userFk: user.value.id } };
|
||||
const filterClientsAddresses = {
|
||||
include: [
|
||||
{ relation: 'province', scope: { fields: ['name'] } },
|
||||
|
@ -72,7 +73,7 @@ onBeforeMount(async () => {
|
|||
|
||||
const setEmailUser = (data) => {
|
||||
optionsEmailUsers.value = data;
|
||||
initialData.replyTo = data[0]?.notificationEmail;
|
||||
initialData.replyTo = data[0]?.email;
|
||||
};
|
||||
|
||||
const setClientsAddresses = (data) => {
|
||||
|
@ -181,12 +182,10 @@ const toCustomerSamples = () => {
|
|||
|
||||
<template>
|
||||
<FetchData
|
||||
:filter="{
|
||||
where: { id: customer.departmentFk },
|
||||
}"
|
||||
:filter="filterEmailUsers"
|
||||
@on-fetch="setEmailUser"
|
||||
auto-load
|
||||
url="Departments"
|
||||
url="EmailUsers"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterClientsAddresses"
|
||||
|
|
|
@ -6,12 +6,10 @@ import { toCurrency } from 'filters/index';
|
|||
import VnStockValueDisplay from 'src/components/ui/VnStockValueDisplay.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import axios from 'axios';
|
||||
import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
const MATCH = 'match';
|
||||
const { notifyResults } = displayResults();
|
||||
|
||||
const { t } = useI18n();
|
||||
const $props = defineProps({
|
||||
|
@ -20,20 +18,14 @@ const $props = defineProps({
|
|||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
replaceAction: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
|
||||
sales: {
|
||||
type: Array,
|
||||
required: true,
|
||||
required: false,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
@ -44,8 +36,6 @@ const proposalTableRef = ref(null);
|
|||
const sale = computed(() => $props.sales[0]);
|
||||
const saleFk = computed(() => sale.value.saleFk);
|
||||
const filter = computed(() => ({
|
||||
where: $props.filter,
|
||||
|
||||
itemFk: $props.itemLack.itemFk,
|
||||
sales: saleFk.value,
|
||||
}));
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
<script setup>
|
||||
import ItemProposal from './ItemProposal.vue';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
const $props = defineProps({
|
||||
itemLack: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
replaceAction: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
|
@ -35,7 +31,7 @@ defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.h
|
|||
<QDialog ref="dialogRef" transition-show="scale" transition-hide="scale">
|
||||
<QCard class="dialog-width">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<span class="text-h6 text-grey">{{ $t('itemProposal') }}</span>
|
||||
<span class="text-h6 text-grey">{{ $t('Item proposal') }}</span>
|
||||
<QSpace />
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
|
|
|
@ -233,10 +233,10 @@ const ticketColumns = ref([
|
|||
</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="{ row }">
|
||||
<QTd>
|
||||
<template #body-cell-client="{ value, row }">
|
||||
<QTd auto-width>
|
||||
<span class="link">
|
||||
{{ row.clientFk }}
|
||||
{{ value }}
|
||||
<CustomerDescriptorProxy :id="row?.clientFk" />
|
||||
</span>
|
||||
</QTd>
|
||||
|
|
|
@ -101,7 +101,7 @@ const onNextStep = async () => {
|
|||
t('basicData.negativesConfirmMessage'),
|
||||
submitWithNegatives,
|
||||
);
|
||||
else await submit();
|
||||
else submit();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -28,7 +28,6 @@ const props = defineProps({
|
|||
|
||||
onMounted(() => {
|
||||
restoreTicket();
|
||||
hasDocuware();
|
||||
});
|
||||
|
||||
watch(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import TicketDescriptor from './TicketDescriptor.vue';
|
||||
import TicketSummary from './TicketSummary.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -773,7 +773,6 @@ watch(
|
|||
v-model="row.itemFk"
|
||||
:use-like="false"
|
||||
@update:model-value="changeItem(row)"
|
||||
autofocus
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
|
@ -3,9 +3,7 @@ import { ref } from 'vue';
|
|||
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import split from './components/split';
|
||||
import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
|
||||
const { notifyResults } = displayResults();
|
||||
const emit = defineEmits(['ticketTransferred']);
|
||||
const emit = defineEmits(['ticketTransfered']);
|
||||
|
||||
const $props = defineProps({
|
||||
ticket: {
|
||||
|
@ -18,20 +16,13 @@ const splitDate = ref(Date.vnNew());
|
|||
|
||||
const splitSelectedRows = async () => {
|
||||
const tickets = Array.isArray($props.ticket) ? $props.ticket : [$props.ticket];
|
||||
const results = await split(tickets, splitDate.value);
|
||||
notifyResults(results, 'ticketFk');
|
||||
emit('ticketTransferred', tickets);
|
||||
await split(tickets, splitDate.value);
|
||||
emit('ticketTransfered', tickets);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnInputDate
|
||||
class="q-mr-sm"
|
||||
:label="$t('New date')"
|
||||
v-model="splitDate"
|
||||
clearable
|
||||
autofocus
|
||||
/>
|
||||
<VnInputDate class="q-mr-sm" :label="$t('New date')" v-model="splitDate" clearable />
|
||||
<QBtn class="q-mr-sm" color="primary" label="Split" @click="splitSelectedRows"></QBtn>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
|
|
|
@ -5,7 +5,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import TicketTransferForm from './TicketTransferForm.vue';
|
||||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
const emit = defineEmits(['ticketTransferred']);
|
||||
const emit = defineEmits(['ticketTransfered']);
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
import TicketSplit from './TicketSplit.vue';
|
||||
const emit = defineEmits(['ticketTransferred']);
|
||||
import Split from './TicketSplit.vue';
|
||||
const emit = defineEmits(['ticketTransfered']);
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
|
@ -35,7 +35,7 @@ const transferRef = ref(null);
|
|||
<template>
|
||||
<QPopupProxy ref="popupProxyRef" data-cy="ticketTransferPopup">
|
||||
<div class="flex row items-center q-ma-lg" v-if="$props.split">
|
||||
<TicketSplit
|
||||
<Split
|
||||
ref="splitRef"
|
||||
@splitSelectedRows="splitSelectedRows"
|
||||
:ticket="$props.ticket"
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import axios from 'axios';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
|
||||
export default async function (data, date) {
|
||||
const reducedData = data.reduce((acc, item) => {
|
||||
const existing = acc.find(({ ticketFk }) => ticketFk === item.id);
|
||||
if (existing) {
|
||||
existing.sales.push(item.saleFk);
|
||||
} else {
|
||||
acc.push({ ticketFk: item.ticketFk, sales: [item.saleFk], date });
|
||||
acc.push({ ticketFk: item.id, sales: [item.saleFk], date });
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
@ -14,5 +16,7 @@ export default async function (data, date) {
|
|||
|
||||
const results = await Promise.allSettled(promises);
|
||||
|
||||
notifyResults(results, 'ticketFk');
|
||||
|
||||
return results;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ const tableRef = ref();
|
|||
const changeItemDialogRef = ref(null);
|
||||
const changeStateDialogRef = ref(null);
|
||||
const changeQuantityDialogRef = ref(null);
|
||||
const showProposalDialog = ref(false);
|
||||
const showChangeQuantityDialog = ref(false);
|
||||
const selectedRows = ref([]);
|
||||
const route = useRoute();
|
||||
|
@ -62,7 +63,6 @@ const showItemProposal = () => {
|
|||
.dialog({
|
||||
component: ItemProposalProxy,
|
||||
componentProps: {
|
||||
filter: filter.value,
|
||||
itemLack: tableRef.value.itemLack,
|
||||
replaceAction: true,
|
||||
sales: selectedRows.value,
|
||||
|
@ -117,17 +117,21 @@ const showItemProposal = () => {
|
|||
sales: selectedRows,
|
||||
lastActiveTickets: selectedRows.map((row) => row.id),
|
||||
}"
|
||||
@ticket-transferred="reload"
|
||||
@ticket-transfered="reload"
|
||||
></TicketTransferProxy>
|
||||
</template>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
@click="showItemProposal"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
@click="showProposalDialog = true"
|
||||
:disable="selectedRows.length < 1"
|
||||
data-cy="itemProposal"
|
||||
>
|
||||
<QIcon name="import_export" class="rotate-90" />
|
||||
<QIcon
|
||||
name="import_export"
|
||||
class="rotate-90"
|
||||
@click="showItemProposal"
|
||||
></QIcon>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('itemProposal') }}
|
||||
</QTooltip>
|
||||
|
@ -135,7 +139,7 @@ const showItemProposal = () => {
|
|||
<VnPopupProxy
|
||||
data-cy="changeItem"
|
||||
icon="sync"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
:disable="selectedRows.length < 1"
|
||||
:tooltip="t('negative.detail.modal.changeItem.title')"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="vn:item" /> </template>
|
||||
|
@ -149,7 +153,7 @@ const showItemProposal = () => {
|
|||
<VnPopupProxy
|
||||
data-cy="changeState"
|
||||
icon="sync"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
:disable="selectedRows.length < 1"
|
||||
:tooltip="t('negative.detail.modal.changeState.title')"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="vn:eye" /> </template>
|
||||
|
@ -163,7 +167,7 @@ const showItemProposal = () => {
|
|||
<VnPopupProxy
|
||||
data-cy="changeQuantity"
|
||||
icon="sync"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
:disable="selectedRows.length < 1"
|
||||
:tooltip="t('negative.detail.modal.changeQuantity.title')"
|
||||
@click="showChangeQuantityDialog = true"
|
||||
>
|
||||
|
|
|
@ -6,7 +6,6 @@ import FetchData from 'components/FetchData.vue';
|
|||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDateTime from 'src/components/common/VnInputDateTime.vue';
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
|
@ -67,7 +66,6 @@ const setUserParams = (params) => {
|
|||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
@set-user-params="setUserParams"
|
||||
:unremovable-params="['warehouseFk']"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
@ -79,11 +77,12 @@ const setUserParams = (params) => {
|
|||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDateTime
|
||||
v-model="params.availabled"
|
||||
:label="t('negative.availabled')"
|
||||
<VnInput
|
||||
v-model="params.days"
|
||||
:label="t('negative.days')"
|
||||
dense
|
||||
filled
|
||||
type="number"
|
||||
@update:model-value="
|
||||
(value) => {
|
||||
setUserParams(params);
|
||||
|
|
|
@ -21,13 +21,14 @@ const selectedRows = ref([]);
|
|||
const tableRef = ref();
|
||||
const filterParams = ref({});
|
||||
const negativeParams = reactive({
|
||||
days: useRole().likeAny('buyer') ? 2 : 0,
|
||||
warehouseFk: useState().getUser().value.warehouseFk,
|
||||
availabled: Date.getCurrentDateTimeFormatted(),
|
||||
});
|
||||
const redirectToCreateView = ({ itemFk }) => {
|
||||
router.push({
|
||||
name: 'NegativeDetail',
|
||||
params: { id: itemFk },
|
||||
query: { days: filterParams.value.days ?? negativeParams.days },
|
||||
});
|
||||
};
|
||||
const columns = computed(() => [
|
||||
|
@ -64,19 +65,15 @@ const columns = computed(() => [
|
|||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
inWhere: false,
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'longName',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
label: t('negative.longName'),
|
||||
field: ({ longName }) => longName,
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
inWhere: false,
|
||||
useLike: true,
|
||||
},
|
||||
|
||||
sortable: true,
|
||||
headerStyle: 'width: 350px',
|
||||
cardVisible: true,
|
||||
|
@ -97,11 +94,6 @@ const columns = computed(() => [
|
|||
field: ({ inkFk }) => inkFk,
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
columnClass: 'shrink',
|
||||
inWhere: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'size',
|
||||
|
@ -163,6 +155,7 @@ const setUserParams = (params) => {
|
|||
<TicketLackFilter data-key="NegativeList" @set-user-params="setUserParams" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
{{ filterRef }}
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="NegativeList"
|
||||
|
|
|
@ -5,7 +5,7 @@ import { computed, ref, watch } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import { toDate, toHour } from 'src/filters';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
@ -22,6 +22,14 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => $props.filter,
|
||||
(v) => {
|
||||
filterLack.value.where = v;
|
||||
tableRef.value.reload(filterLack);
|
||||
},
|
||||
);
|
||||
|
||||
const filterLack = ref({
|
||||
include: [
|
||||
{
|
||||
|
@ -82,7 +90,6 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
name: 'alertLevelCode',
|
||||
field: 'alertLevelCode',
|
||||
label: t('negative.detail.state'),
|
||||
columnFilter: {
|
||||
name: 'alertLevelCode',
|
||||
|
@ -151,6 +158,7 @@ const saveChange = async (field, { row }) => {
|
|||
fetchItemLack.value.fetch();
|
||||
} catch (err) {
|
||||
console.error('Error saving changes', err);
|
||||
f;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -163,11 +171,7 @@ function onBuysFetched(data) {
|
|||
<FetchData
|
||||
ref="fetchItemLack"
|
||||
:url="`Tickets/itemLack`"
|
||||
:params="{
|
||||
itemFk: entityId,
|
||||
warehouseFk: $props.filter.warehouseFk,
|
||||
availabled: Date.getCurrentDateTimeFormatted(),
|
||||
}"
|
||||
:params="{ id: entityId }"
|
||||
@on-fetch="(data) => (itemLack = data[0])"
|
||||
auto-load
|
||||
/>
|
||||
|
@ -203,7 +207,6 @@ function onBuysFetched(data) {
|
|||
dense
|
||||
:is-editable="true"
|
||||
:row-click="false"
|
||||
:search-url="false"
|
||||
:right-search="false"
|
||||
:right-search-icon="false"
|
||||
v-model:selected="selectedRows"
|
||||
|
@ -211,6 +214,7 @@ function onBuysFetched(data) {
|
|||
>
|
||||
<template #top-left>
|
||||
<div style="display: flex; align-items: center" v-if="itemLack">
|
||||
<!-- <VnImg :id="itemLack.itemFk" class="rounded image-wrapper"></VnImg> -->
|
||||
<div class="flex column" style="align-items: center">
|
||||
<QBadge
|
||||
ref="badgeLackRef"
|
||||
|
@ -235,7 +239,7 @@ function onBuysFetched(data) {
|
|||
|
||||
<template #column-status="{ row }">
|
||||
<QTd style="min-width: 150px">
|
||||
<div class="flex items-start q-ma-sm">
|
||||
<div class="icon-container">
|
||||
<QIcon
|
||||
v-if="row.isBasket"
|
||||
name="vn:basket"
|
||||
|
@ -262,10 +266,9 @@ function onBuysFetched(data) {
|
|||
size="xs"
|
||||
>
|
||||
<QTooltip>{{
|
||||
row?.note || t('negative.detail.hasObservation')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
t('negative.detail.hasObservation')
|
||||
}}</QTooltip> </QIcon
|
||||
><QIcon
|
||||
v-if="row.isRookie"
|
||||
name="vn:Person"
|
||||
size="xs"
|
||||
|
@ -302,9 +305,9 @@ function onBuysFetched(data) {
|
|||
</span>
|
||||
</template>
|
||||
<template #column-ticketFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.ticketFk }}
|
||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
<span class="q-pa-sm link">
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-alertLevelCode="props">
|
||||
|
@ -332,6 +335,15 @@ function onBuysFetched(data) {
|
|||
</VnTable>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.icon-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 0.2fr);
|
||||
row-gap: 5px; /* Ajusta el espacio entre los iconos según sea necesario */
|
||||
}
|
||||
.icon-container > * {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
transition: all 1s ease;
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
|
||||
|
||||
const { notifyResults } = displayResults();
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
const emit = defineEmits(['update-item']);
|
||||
|
||||
const showChangeItemDialog = ref(false);
|
||||
|
@ -39,6 +37,7 @@ const updateItem = async () => {
|
|||
<template>
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center justify-center column items-stretch">
|
||||
{{ showChangeItemDialog }}
|
||||
<span>{{ $t('negative.detail.modal.changeItem.title') }}</span>
|
||||
<VnSelect
|
||||
url="Items/WithName"
|
||||
|
@ -48,7 +47,6 @@ const updateItem = async () => {
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="newItem"
|
||||
autofocus
|
||||
>
|
||||
</VnSelect>
|
||||
</QCardSection>
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
|
||||
const { notifyResults } = displayResults();
|
||||
const showChangeQuantityDialog = ref(false);
|
||||
const newQuantity = ref(null);
|
||||
const $props = defineProps({
|
||||
|
@ -17,16 +16,15 @@ const emit = defineEmits(['update-quantity']);
|
|||
const updateQuantity = async () => {
|
||||
try {
|
||||
showChangeQuantityDialog.value = true;
|
||||
const rowsToUpdate = $props.selectedRows.map(({ saleFk, ticketFk }) =>
|
||||
const rowsToUpdate = $props.selectedRows.map(({ saleFk }) =>
|
||||
axios.post(`Sales/${saleFk}/updateQuantity`, {
|
||||
saleFk,
|
||||
ticketFk,
|
||||
quantity: +newQuantity.value,
|
||||
}),
|
||||
);
|
||||
|
||||
const result = await Promise.allSettled(rowsToUpdate);
|
||||
notifyResults(result, 'ticketFk');
|
||||
notifyResults(result, 'saleFk');
|
||||
|
||||
emit('update-quantity', newQuantity.value);
|
||||
} catch (err) {
|
||||
|
@ -44,7 +42,6 @@ const updateQuantity = async () => {
|
|||
:min="0"
|
||||
:label="$t('negative.detail.modal.changeQuantity.placeholder')"
|
||||
v-model="newQuantity"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
|
|
|
@ -3,9 +3,8 @@ import { ref } from 'vue';
|
|||
import axios from 'axios';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
|
||||
const { notifyResults } = displayResults();
|
||||
const emit = defineEmits(['update-state']);
|
||||
const editableStates = ref([]);
|
||||
const showChangeStateDialog = ref(false);
|
||||
|
@ -50,7 +49,6 @@ const updateState = async () => {
|
|||
:options="editableStates"
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
import { Notify } from 'quasar';
|
||||
import useOpenURL from 'src/composables/useOpenURL';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export function displayResults() {
|
||||
const { t } = useI18n();
|
||||
|
||||
const createSuccessNotification = (id, path) => {
|
||||
Notify.create({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
actions: [
|
||||
{
|
||||
label: t('globals.openDetail'),
|
||||
color: 'white',
|
||||
handler: () => useOpenURL(`#/ticket/${id}/${path}`),
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
const handleResult = (result, key, path) => {
|
||||
if (result.status !== 'fulfilled') {
|
||||
const data = JSON.parse(result.reason.config.data);
|
||||
const error =
|
||||
result.reason.response?.data?.error?.message ?? result.reason.message;
|
||||
Notify.create({
|
||||
type: 'negative',
|
||||
message: `Ticket ${data[key]}: ${error}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const data = JSON.parse(result.value.config.data);
|
||||
let id = data[key];
|
||||
|
||||
if (result.value.data.status === 'noSplit') {
|
||||
Notify.create({
|
||||
type: 'warning',
|
||||
message: `Ticket ${id}: ${t('negative.split.noSplit')}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.value.data.status === 'split') {
|
||||
id = result.value.data.newTicket;
|
||||
}
|
||||
|
||||
createSuccessNotification(id, path);
|
||||
};
|
||||
|
||||
const notifyResults = (results, key, path = 'sale') =>
|
||||
results.forEach((result) => handleResult(result, key, path));
|
||||
|
||||
return { notifyResults };
|
||||
}
|
|
@ -236,7 +236,6 @@ negative:
|
|||
minTimed: minTimed
|
||||
negativeAction: Negative
|
||||
totalNegative: Total negatives
|
||||
availabled: Availabled
|
||||
days: Days
|
||||
buttonsUpdate:
|
||||
item: Item
|
||||
|
@ -266,7 +265,7 @@ negative:
|
|||
isRookie: Is rookie
|
||||
turno: Turn line
|
||||
isBasket: Basket
|
||||
hasObservation: Has substitution note
|
||||
hasObservation: Has substitution
|
||||
hasToIgnore: VIP
|
||||
modal:
|
||||
changeItem:
|
||||
|
@ -289,4 +288,3 @@ negative:
|
|||
newTicket: New ticket
|
||||
status: Result
|
||||
message: Message
|
||||
noSplit: No split
|
||||
|
|
|
@ -216,8 +216,7 @@ ticketList:
|
|||
negative:
|
||||
hour: Hora
|
||||
id: Id Articulo
|
||||
longName: Artículo
|
||||
itemFk: Artículo
|
||||
longName: Articulo
|
||||
supplier: Productor
|
||||
colour: Color
|
||||
size: Medida
|
||||
|
@ -233,7 +232,6 @@ negative:
|
|||
inkFk: Color
|
||||
timed: Hora
|
||||
date: Fecha
|
||||
availabled: Disponible
|
||||
minTimed: Hora
|
||||
type: Tipo
|
||||
negativeAction: Negativo
|
||||
|
@ -267,7 +265,7 @@ negative:
|
|||
isRookie: Cliente nuevo
|
||||
turno: Linea turno
|
||||
isBasket: Cesta
|
||||
hasObservation: Tiene nota de sustitución
|
||||
hasObservation: Tiene sustitución
|
||||
hasToIgnore: VIP
|
||||
modal:
|
||||
changeItem:
|
||||
|
@ -286,11 +284,10 @@ negative:
|
|||
title: Gestionar tickets spliteados
|
||||
subTitle: Confir fecha y agencia
|
||||
split:
|
||||
ticket: Ticket origen
|
||||
ticket: Ticket viejo
|
||||
newTicket: Ticket nuevo
|
||||
status: Estado
|
||||
message: Mensaje
|
||||
noSplit: No se puede splitar
|
||||
rounding: Redondeo
|
||||
noVerifiedData: Sin datos comprobados
|
||||
purchaseRequest: Petición de compra
|
||||
|
|
|
@ -8,9 +8,9 @@ const claimCard = {
|
|||
meta: {
|
||||
menu: [
|
||||
'ClaimBasicData',
|
||||
'ClaimNotes',
|
||||
'ClaimLines',
|
||||
'ClaimPhotos',
|
||||
'ClaimNotes',
|
||||
'ClaimDevelopment',
|
||||
'ClaimAction',
|
||||
'ClaimLog',
|
||||
|
@ -36,6 +36,15 @@ const claimCard = {
|
|||
},
|
||||
component: () => import('src/pages/Claim/Card/ClaimBasicData.vue'),
|
||||
},
|
||||
{
|
||||
path: 'notes',
|
||||
name: 'ClaimNotes',
|
||||
meta: {
|
||||
title: 'notes',
|
||||
icon: 'draft',
|
||||
},
|
||||
component: () => import('src/pages/Claim/Card/ClaimNotes.vue'),
|
||||
},
|
||||
{
|
||||
path: 'lines',
|
||||
name: 'ClaimLines',
|
||||
|
@ -54,15 +63,6 @@ const claimCard = {
|
|||
},
|
||||
component: () => import('src/pages/Claim/Card/ClaimPhoto.vue'),
|
||||
},
|
||||
{
|
||||
path: 'notes',
|
||||
name: 'ClaimNotes',
|
||||
meta: {
|
||||
title: 'notes',
|
||||
icon: 'draft',
|
||||
},
|
||||
component: () => import('src/pages/Claim/Card/ClaimNotes.vue'),
|
||||
},
|
||||
{
|
||||
path: 'development',
|
||||
name: 'ClaimDevelopment',
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import { Notify } from 'quasar';
|
||||
|
||||
export default function (results, key) {
|
||||
results.forEach((result, index) => {
|
||||
if (result.status === 'fulfilled') {
|
||||
const data = JSON.parse(result.value.config.data);
|
||||
Notify.create({
|
||||
type: 'positive',
|
||||
message: `Operación (${index + 1}) ${data[key]} completada con éxito.`,
|
||||
});
|
||||
} else {
|
||||
const data = JSON.parse(result.reason.config.data);
|
||||
Notify.create({
|
||||
type: 'negative',
|
||||
message: `Operación (${index + 1}) ${data[key]} fallida: ${result.reason.message}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('ClaimLines', () => {
|
||||
const claimId = 1;
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/claim/${claimId}/lines`);
|
||||
});
|
||||
|
||||
it('should add new line', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||
cy.get('.q-card > .q-table__container > .q-table__middle > .q-table > thead > tr > .q-table--col-auto-width > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg').click();
|
||||
cy.get('.q-card__actions > .q-btn--unelevated').click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Lines added to claim');
|
||||
})
|
||||
|
||||
it('should autofill claimed quantity if 0 or null', () => {
|
||||
cy.get('thead > tr > .q-table--col-auto-width > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg').click();
|
||||
cy.get('.q-btn--unelevated').click();
|
||||
cy.checkNotification('Cantidades rellenadas automáticamente');
|
||||
cy.get('.q-btn--unelevated').click();
|
||||
cy.checkNotification('No hay cantidades para rellenar');
|
||||
})
|
||||
});
|
|
@ -1,5 +1,4 @@
|
|||
describe('ClaimNotes', () => {
|
||||
const saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon';
|
||||
const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert';
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
|
@ -11,9 +10,9 @@ describe('ClaimNotes', () => {
|
|||
cy.get('.q-textarea')
|
||||
.should('be.visible')
|
||||
.should('not.be.disabled')
|
||||
.type(message);
|
||||
.type(message, "{{enter}}");
|
||||
|
||||
cy.get(saveBtn).click();
|
||||
cy.dataCy("save-continue-note-button").click();
|
||||
cy.get(firstNote).should('have.text', message);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue