refactor(TicketDetails): actualizar deleteRow para usar nuevo endpoint e incluir ID de orden
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
This commit is contained in:
parent
aa66c086f2
commit
e84e31a7b4
|
@ -35,27 +35,22 @@ defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['onRowDeleted']);
|
const emit = defineEmits(['onRowDeleted']);
|
||||||
const jApi = inject('jApi');
|
const api = inject('api');
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
const lineDiscountSubtotal = line => {
|
const lineDiscountSubtotal = line => {
|
||||||
return line.quantity * line.price;
|
return line.quantity * line.price;
|
||||||
};
|
};
|
||||||
|
|
||||||
const lineSubtotal = line =>
|
const lineSubtotal = line =>
|
||||||
lineDiscountSubtotal(line) * ((100 - line.discount) / 100);
|
lineDiscountSubtotal(line) * ((100 - line.discount) / 100);
|
||||||
|
|
||||||
const deleteRow = id => {
|
const deleteRow = async (id, orderFk) => {
|
||||||
try {
|
try {
|
||||||
jApi.execQuery(
|
await api.post('/orderRows/removes', {
|
||||||
`START TRANSACTION;
|
rows: [id],
|
||||||
DELETE FROM hedera.myOrderRow WHERE ((id = #id));
|
actualOrderId: orderFk
|
||||||
COMMIT`,
|
});
|
||||||
{
|
|
||||||
id
|
|
||||||
}
|
|
||||||
);
|
|
||||||
emit('onRowDeleted');
|
emit('onRowDeleted');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting order item:', error);
|
console.error('Error deleting order item:', error);
|
||||||
|
@ -123,7 +118,7 @@ const deleteRow = id => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
null,
|
null,
|
||||||
t('confirmDelete'),
|
t('confirmDelete'),
|
||||||
() => deleteRow(row.id)
|
() => deleteRow(row.id, ticket.id)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue