diff --git a/src/components/displays/buttons/ActionSettingsWheelButton.vue b/src/components/displays/buttons/ActionSettingsWheelButton.vue index 2497e275..79b4aa46 100644 --- a/src/components/displays/buttons/ActionSettingsWheelButton.vue +++ b/src/components/displays/buttons/ActionSettingsWheelButton.vue @@ -118,13 +118,12 @@ const redirectSuperUserInvoiceCollectionPage = (invoiceCollectionId) => { window.open(`/superuser/invoices/${invoiceCollectionId}`, '_blank'); }; -const redirectDepartmentOrderPage = async (orderId) => { +const redirectDepartmentOrderPage = async (orderId, newTab = false) => { // Send the user to the order page (In a new tab) // Get the department id from the order await SessionUser.objects.orders.functions.get_department_id(props.order_id).then((response) => { // Get the department id from the response - // Send the user to the order page (In a new tab) - window.open(`/admin/${response}/modules/pos/orders/${orderId}`, '_blank'); + SessionUser.functions.redirectTo.department(response.data.data.department_id, 'modules/pos/orders/' + orderId, newTab); }).catch((error) => { console.error(error); }); @@ -210,7 +209,7 @@ const hasUser = () => { v-if="SessionUser.canAccessAdmin() || SessionUser.canAccessSuperUser()" :label="`Se ${SessionUser.objects.orders.meta.labels.single.toLowerCase()} i ny fane`" icon="fas fa-external-link-alt" - :click-action="async () => redirectDepartmentOrderPage(props.order_id)" + :click-action="async () => redirectDepartmentOrderPage(props.order_id, true)" :disabled="false" /> diff --git a/src/components/session/token/SessionUser.vue b/src/components/session/token/SessionUser.vue index 79fd0204..40af1057 100644 --- a/src/components/session/token/SessionUser.vue +++ b/src/components/session/token/SessionUser.vue @@ -551,8 +551,13 @@ export const SessionUser = { * Redirect to a user page * @note This will redirect the user to '/user(/:path)' * @param path The path to redirect to (Optional) + * @param new_tab Open the url in a new tab */ - user: (path = null) => { + user: (path = null, new_tab = false) => { + if (new_tab) { + window.open('/user' + (path !== null ? path : ''), '_blank'); + return; + } window.location.href = '/user' + (path !== null ? path : ''); }, /**