diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index c9f590565..e4924d3c1 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -329,6 +329,7 @@ globals:
email: Email
SSN: SSN
fi: FI
+ packing: ITP
myTeam: My team
departmentFk: Department
countryFk: Country
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 120f7742b..86c7e703b 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -335,6 +335,7 @@ globals:
SSN: NSS
fi: NIF
myTeam: Mi equipo
+ packing: ITP
countryFk: País
changePass: Cambiar contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados
diff --git a/src/pages/Monitor/Ticket/MonitorTicketFilter.vue b/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
index 8377d73ef..82578a61f 100644
--- a/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
+++ b/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
@@ -134,6 +134,7 @@ const getLocale = (label) => {
/>
+
{
/>
+
+
+
+
+
+
+
+
+
+
[
align: 'left',
format: (row) => row.practicalHour,
columnFilter: false,
+ dense: true,
},
{
label: t('salesTicketsTable.preparation'),
@@ -190,6 +196,7 @@ const columns = computed(() => [
'false-value': 0,
'true-value': 1,
},
+ component: false,
},
{
label: t('salesTicketsTable.zone'),
@@ -206,6 +213,12 @@ const columns = computed(() => [
},
},
},
+ {
+ label: t('salesTicketsTable.payMethod'),
+ name: 'payMethod',
+ align: 'left',
+ columnFilter: false,
+ },
{
label: t('salesTicketsTable.total'),
name: 'totalWithVat',
@@ -219,6 +232,36 @@ const columns = computed(() => [
},
},
},
+ {
+ label: t('salesTicketsTable.department'),
+ name: 'department',
+ align: 'left',
+ columnFilter: {
+ component: 'select',
+ url: 'Departments',
+ attrs: {
+ options: DepartmentOpts.value,
+ optionValue: 'name',
+ optionLabel: 'name',
+ dense: true,
+ },
+ },
+ },
+ {
+ label: t('salesTicketsTable.packing'),
+ name: 'packing',
+ align: 'left',
+ columnFilter: {
+ component: 'select',
+ url: 'ItemPackingTypes',
+ attrs: {
+ options: ItemPackingTypeOpts.value,
+ 'option-value': 'code',
+ 'option-label': 'code',
+ dense: true,
+ },
+ },
+ },
{
align: 'right',
name: 'tableActions',
@@ -318,6 +361,24 @@ const openTab = (id) =>
auto-load
@on-fetch="(data) => (zoneOpts = data)"
/>
+ (ItemPackingTypeOpts = data)"
+ />
+ (DepartmentOpts = data)"
+ />
@@ -337,7 +398,7 @@ const openTab = (id) =>
auto-load
:row-click="({ id }) => openTab(id)"
:disable-option="{ card: true }"
- :user-params="{ from, to, scopeDays: 0 }"
+ :user-params="{ from, to, scopeDays: 0, packing }"
>
import axios from 'axios';
-import { computed, ref, toRefs } from 'vue';
+import { computed, onMounted, ref, toRefs, watch } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
@@ -24,6 +24,15 @@ const props = defineProps({
},
});
+onMounted(() => {
+ restoreTicket();
+});
+
+watch(
+ () => props.ticket,
+ () => restoreTicket
+);
+
const { push, currentRoute } = useRouter();
const { dialog, notify } = useQuasar();
const { t } = useI18n();
@@ -42,6 +51,7 @@ const hasPdf = ref();
const weight = ref();
const hasDocuwareFile = ref();
const quasar = useQuasar();
+const canRestoreTicket = ref(false);
const actions = {
clone: async () => {
const opts = { message: t('Ticket cloned'), type: 'positive' };
@@ -373,6 +383,54 @@ async function uploadDocuware(force) {
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
}
+
+const restoreTicket = async () => {
+ const filter = {
+ fields: ['id', 'originFk', 'creationDate', 'newInstance'],
+ where: {
+ originFk: ticketId.value,
+ newInstance: { like: '%"isDeleted":true%' },
+ },
+ order: 'creationDate DESC',
+ limit: 1,
+ };
+ const params = { filter: JSON.stringify(filter) };
+
+ const { data } = await axios.get(`TicketLogs`, { params });
+
+ if (data && data.length) {
+ const now = Date.vnNew();
+ const maxDate = new Date(data[0].creationDate);
+ maxDate.setHours(maxDate.getHours() + 1);
+ if (now <= maxDate) {
+ return (canRestoreTicket.value = true);
+ }
+ return (canRestoreTicket.value = false);
+ }
+ return (canRestoreTicket.value = false);
+};
+
+async function openRestoreConfirmation(force) {
+ if (!force)
+ return quasar
+ .dialog({
+ component: VnConfirm,
+ componentProps: {
+ title: t('Are you sure you want to restore the ticket?'),
+ message: t('You are going to restore this ticket'),
+ },
+ })
+ .onOk(async () => {
+ ticketToRestore();
+ });
+}
+
+async function ticketToRestore() {
+ const { data } = await axios.post(`Tickets/${ticketId.value}/restore`);
+ if (data) {
+ notify({ message: t('Ticket restored'), type: 'positive' });
+ }
+}
{{ t('Show Proforma') }}
+
+
+
+
+ {{ t('Restore ticket') }}
+
diff --git a/test/cypress/integration/zone/zoneBasicData.spec.js b/test/cypress/integration/zone/zoneBasicData.spec.js
index de85dac94..6229039b7 100644
--- a/test/cypress/integration/zone/zoneBasicData.spec.js
+++ b/test/cypress/integration/zone/zoneBasicData.spec.js
@@ -1,5 +1,6 @@
describe('ZoneBasicData', () => {
const notification = '.q-notification__message';
+ const priceBasicData = '[data-cy="Price_input"]';
beforeEach(() => {
cy.viewport(1280, 720);
@@ -13,9 +14,15 @@ describe('ZoneBasicData', () => {
cy.get(notification).should('contains.text', "can't be blank");
});
+ it('should throw an error if the price is empty', () => {
+ cy.get(priceBasicData).clear();
+ cy.get('.q-btn-group > .q-btn--standard').click();
+ cy.get(notification).should('contains.text', 'cannot be blank');
+ });
+
it("should edit the basicData's zone", () => {
cy.get('.q-card > :nth-child(1)').type(' modified');
cy.get('.q-btn-group > .q-btn--standard').click();
- cy.get(notification).should('contains.text', 'Data saved');
+ cy.checkNotification('Data saved');
});
});