Files
thetool/public/mobile/components/MainMenu.js
2026-01-17 12:48:08 +00:00

86 lines
3.7 KiB
JavaScript

/**
* MainMenu Component
*
* Displays the main module menu for the MobileApp.
* Shows available modules like "Lager" that the user can access.
*/
export default {
name: 'MainMenu',
emits: ['navigate'],
props: {
user: Object
},
setup(props, { emit }) {
// Available modules
const modules = [
{
id: 'Workorder',
name: 'Aufträge',
icon: 'clipboard-check',
color: 'bg-sky-500',
iconColor: 'text-sky-500'
},
{
id: 'Lieferschein',
name: 'Lieferschein',
icon: 'document',
color: 'bg-purple-500',
iconColor: 'text-purple-500'
},
{
id: 'Lager',
name: 'Lager',
icon: 'warehouse',
color: 'bg-blue-500',
iconColor: 'text-blue-500'
}
];
const openModule = (moduleId) => {
emit('navigate', moduleId, null);
};
return {
modules,
openModule
};
},
template: `
<div class="p-3">
<!-- Module List -->
<div class="bg-white dark:bg-slate-800 rounded-xl overflow-hidden shadow-sm">
<button
v-for="(module, index) in modules"
:key="module.id"
@click="openModule(module.id)"
:class="[
'w-full flex items-center px-4 py-3.5 hover:bg-slate-50 dark:hover:bg-slate-700/50 active:bg-slate-100 dark:active:bg-slate-700 transition text-left',
index !== modules.length - 1 ? 'border-b border-slate-100 dark:border-slate-700' : ''
]"
>
<div :class="[module.color, 'w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0']">
<svg v-if="module.icon === 'clipboard-check'" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4" />
</svg>
<svg v-else-if="module.icon === 'document'" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
<svg v-else-if="module.icon === 'warehouse'" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 14v3m4-3v3m4-3v3M3 21h18M3 10h18M3 7l9-4 9 4M4 10h16v11H4V10z" />
</svg>
</div>
<span class="ml-3 font-medium text-slate-800 dark:text-white flex-1">
{{ module.name }}
</span>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</button>
</div>
</div>
`
};