Add pay button
This commit is contained in:
parent
8e538fb463
commit
a57df459a6
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
|
@ -8,17 +8,22 @@ import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import TicketCreateServiceType from './TicketCreateServiceType.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const ticketServiceTypeFetchRef = ref(null);
|
||||
const ticketServiceCrudRef = ref(null);
|
||||
const ticketServiceOptions = ref([]);
|
||||
const arrayData = useArrayData('TicketNotes');
|
||||
const { store } = arrayData;
|
||||
const { notify } = useNotify();
|
||||
|
||||
const selectedServices = ref(new Set());
|
||||
|
||||
|
@ -40,6 +45,29 @@ watch(
|
|||
await ticketServiceCrudRef.value.reload();
|
||||
}
|
||||
);
|
||||
|
||||
const createRefund = async () => {
|
||||
try {
|
||||
if (!selectedServices.value.size) return;
|
||||
|
||||
const params = {
|
||||
servicesIds: Array.from(selectedServices.value),
|
||||
withWarehouse: false,
|
||||
negative: true,
|
||||
};
|
||||
const { data } = await axios.post('Sales/clone', params);
|
||||
const [refundTicket] = data;
|
||||
notify(
|
||||
t('service.createRefundSuccess', {
|
||||
ticketId: refundTicket.id,
|
||||
}),
|
||||
'positive'
|
||||
);
|
||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -49,14 +77,14 @@ watch(
|
|||
auto-load
|
||||
url="TicketServiceTypes"
|
||||
/>
|
||||
<!-- <Teleport v-if="" to="#st-actions">
|
||||
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
|
||||
<QBtn
|
||||
color="primary"
|
||||
:label="t('service.pay')"
|
||||
:disabled="!selectedServices.size"
|
||||
@click.stop="viewAddObservation(selected)"
|
||||
@click.stop="createRefund()"
|
||||
/>
|
||||
</Teleport> -->
|
||||
</Teleport>
|
||||
<CrudModel
|
||||
ref="ticketServiceCrudRef"
|
||||
data-key="TicketService"
|
||||
|
@ -133,5 +161,4 @@ watch(
|
|||
</QCard>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<pre>checkeds: {{ selectedServices }}</pre>
|
||||
</template>
|
||||
|
|
|
@ -7,3 +7,4 @@ service:
|
|||
newService: New service type
|
||||
addService: Add service
|
||||
quantityInfo: To create services with negative amounts mark the service on the source ticket and press the pay button.
|
||||
createRefundSuccess: 'The following refund ticket have been created: { ticketId }'
|
||||
|
|
|
@ -7,5 +7,6 @@ service:
|
|||
newService: Nuevo tipo de servicio
|
||||
addService: Añadir servicio
|
||||
quantityInfo: Para crear sevicios con cantidades negativas marcar servicio en el ticket origen y apretar el boton abonar.
|
||||
createRefundSuccess: 'Se ha creado siguiente ticket de abono: { ticketId }'
|
||||
Search ticket: Buscar ticket
|
||||
You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
||||
|
|
Loading…
Reference in New Issue