52 lines
1.3 KiB
Vue
52 lines
1.3 KiB
Vue
<script setup>
|
|
import { ref } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
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 { t } = useI18n();
|
|
|
|
const $props = defineProps({
|
|
ticket: {
|
|
type: [Array, Object],
|
|
default: () => {},
|
|
},
|
|
});
|
|
|
|
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);
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<VnInputDate
|
|
class="q-mr-sm"
|
|
:label="t('New date')"
|
|
v-model="splitDate"
|
|
clearable
|
|
autofocus
|
|
/>
|
|
<QBtn class="q-mr-sm" color="primary" label="Split" @click="splitSelectedRows"></QBtn>
|
|
</template>
|
|
<style lang="scss">
|
|
.q-table__bottom.row.items-center.q-table__bottom--nodata {
|
|
border-top: none;
|
|
}
|
|
</style>
|
|
<i18n>
|
|
es:
|
|
New date: Nueva fecha
|
|
Split: Separar
|
|
Transfer lines: Transferir líneas
|
|
Sales to transfer: Líneas a transferir
|
|
Destination ticket: Ticket destinatario
|
|
</i18n>
|