"Enhance user redirection logic: add new_tab parameter to SessionUser.vue and update ActionSettingsWheelButton.vue to support opening links in a new tab for improved user navigation."
This commit is contained in:
@@ -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"
|
||||
/>
|
||||
<!-- Go to the user/order/:order_id page, in a new tab -->
|
||||
|
||||
@@ -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 : '');
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user