forked from verdnatura/salix-front
Merge branch 'dev' into 7671_dense_itemFixedPrices
This commit is contained in:
commit
d347a81d74
|
@ -9,16 +9,16 @@ export default {
|
||||||
const keyBindingMap = routes
|
const keyBindingMap = routes
|
||||||
.filter((route) => route.meta.keyBinding)
|
.filter((route) => route.meta.keyBinding)
|
||||||
.reduce((map, route) => {
|
.reduce((map, route) => {
|
||||||
map[route.meta.keyBinding.toLowerCase()] = route.path;
|
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||||
return map;
|
return map;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
const { ctrlKey, altKey, key } = event;
|
const { ctrlKey, altKey, code } = event;
|
||||||
|
|
||||||
if (ctrlKey && altKey && keyBindingMap[key] && !isNotified) {
|
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
router.push(keyBindingMap[key]);
|
router.push(keyBindingMap[code]);
|
||||||
isNotified = true;
|
isNotified = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,12 @@ const itemComputed = computed(() => {
|
||||||
<QItemSection avatar v-if="!itemComputed.icon">
|
<QItemSection avatar v-if="!itemComputed.icon">
|
||||||
<QIcon name="disabled_by_default" />
|
<QIcon name="disabled_by_default" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
|
<QItemSection>
|
||||||
|
{{ t(itemComputed.title) }}
|
||||||
|
<QTooltip>
|
||||||
|
{{ 'Ctrl + Alt + ' + item.keyBinding.toUpperCase() }}
|
||||||
|
</QTooltip>
|
||||||
|
</QItemSection>
|
||||||
<QItemSection side>
|
<QItemSection side>
|
||||||
<slot name="side" :item="itemComputed" />
|
<slot name="side" :item="itemComputed" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -55,6 +55,15 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
|
||||||
>
|
>
|
||||||
<div class="text-center text-primary button-text">
|
<div class="text-center text-primary button-text">
|
||||||
{{ t(item.title) }}
|
{{ t(item.title) }}
|
||||||
|
<div v-if="item.keyBinding">
|
||||||
|
{{ '(' + item.keyBinding + ')' }}
|
||||||
|
<QTooltip>
|
||||||
|
{{
|
||||||
|
'Ctrl + Alt + ' +
|
||||||
|
item.keyBinding.toUpperCase()
|
||||||
|
}}
|
||||||
|
</QTooltip>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'suppliers',
|
title: 'suppliers',
|
||||||
icon: 'vn:supplier',
|
icon: 'vn:supplier',
|
||||||
moduleName: 'Supplier',
|
moduleName: 'Supplier',
|
||||||
|
keyBinding: 'p',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'SupplierMain' },
|
redirect: { name: 'SupplierMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'users',
|
title: 'users',
|
||||||
icon: 'face',
|
icon: 'face',
|
||||||
moduleName: 'Account',
|
moduleName: 'Account',
|
||||||
|
keyBinding: 'u',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'AccountMain' },
|
redirect: { name: 'AccountMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'claims',
|
title: 'claims',
|
||||||
icon: 'vn:claims',
|
icon: 'vn:claims',
|
||||||
moduleName: 'Claim',
|
moduleName: 'Claim',
|
||||||
|
keyBinding: 'r',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'ClaimMain' },
|
redirect: { name: 'ClaimMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'customers',
|
title: 'customers',
|
||||||
icon: 'vn:client',
|
icon: 'vn:client',
|
||||||
moduleName: 'Customer',
|
moduleName: 'Customer',
|
||||||
|
keyBinding: 'c',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'CustomerMain' },
|
redirect: { name: 'CustomerMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'entries',
|
title: 'entries',
|
||||||
icon: 'vn:entry',
|
icon: 'vn:entry',
|
||||||
moduleName: 'Entry',
|
moduleName: 'Entry',
|
||||||
|
keyBinding: 'e',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'EntryMain' },
|
redirect: { name: 'EntryMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'items',
|
title: 'items',
|
||||||
icon: 'vn:item',
|
icon: 'vn:item',
|
||||||
moduleName: 'Item',
|
moduleName: 'Item',
|
||||||
|
keyBinding: 'a',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'ItemMain' },
|
redirect: { name: 'ItemMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'monitors',
|
title: 'monitors',
|
||||||
icon: 'grid_view',
|
icon: 'grid_view',
|
||||||
moduleName: 'Monitor',
|
moduleName: 'Monitor',
|
||||||
|
keyBinding: 'm',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'MonitorMain' },
|
redirect: { name: 'MonitorMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'order',
|
title: 'order',
|
||||||
icon: 'vn:basket',
|
icon: 'vn:basket',
|
||||||
moduleName: 'Order',
|
moduleName: 'Order',
|
||||||
|
keyBinding: 'o',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'OrderMain' },
|
redirect: { name: 'OrderMain' },
|
||||||
|
|
|
@ -7,7 +7,6 @@ export default {
|
||||||
title: 'routes',
|
title: 'routes',
|
||||||
icon: 'vn:delivery',
|
icon: 'vn:delivery',
|
||||||
moduleName: 'Route',
|
moduleName: 'Route',
|
||||||
keyBinding: 'r',
|
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'RouteMain' },
|
redirect: { name: 'RouteMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'tickets',
|
title: 'tickets',
|
||||||
icon: 'vn:ticket',
|
icon: 'vn:ticket',
|
||||||
moduleName: 'Ticket',
|
moduleName: 'Ticket',
|
||||||
|
keyBinding: 't',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'TicketMain' },
|
redirect: { name: 'TicketMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'workers',
|
title: 'workers',
|
||||||
icon: 'vn:worker',
|
icon: 'vn:worker',
|
||||||
moduleName: 'Worker',
|
moduleName: 'Worker',
|
||||||
|
keyBinding: 'w',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'WorkerMain' },
|
redirect: { name: 'WorkerMain' },
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'zones',
|
title: 'zones',
|
||||||
icon: 'vn:zone',
|
icon: 'vn:zone',
|
||||||
moduleName: 'Zone',
|
moduleName: 'Zone',
|
||||||
|
keyBinding: 'z',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'ZoneMain' },
|
redirect: { name: 'ZoneMain' },
|
||||||
|
|
|
@ -72,6 +72,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
|
||||||
if (meta) {
|
if (meta) {
|
||||||
item.title = `globals.pageTitles.${meta.title}`;
|
item.title = `globals.pageTitles.${meta.title}`;
|
||||||
item.icon = meta.icon;
|
item.icon = meta.icon;
|
||||||
|
item.keyBinding = meta.keyBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.push(item);
|
parent.push(item);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
describe('VnShortcuts', () => {
|
||||||
|
const modules = {
|
||||||
|
item: 'a',
|
||||||
|
customer: 'c',
|
||||||
|
ticket: 't',
|
||||||
|
claim: 'r',
|
||||||
|
worker: 'w',
|
||||||
|
monitor: 'm',
|
||||||
|
order: 'o',
|
||||||
|
supplier: 'p',
|
||||||
|
entry: 'e',
|
||||||
|
zone: 'z',
|
||||||
|
account: 'u',
|
||||||
|
};
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/');
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const [module, shortcut] of Object.entries(modules)) {
|
||||||
|
it(`should visit ${module} module`, () => {
|
||||||
|
cy.get('body').trigger('keydown', {
|
||||||
|
ctrlKey: true,
|
||||||
|
altKey: true,
|
||||||
|
code: `Key${shortcut.toUpperCase()}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.url().should('include', module);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue