useApplicationsStore.js 1.44 KB
import { defineStore } from 'pinia';
import { reactive, ref } from 'vue';

import ALIGNERICON from '@/views/assets/images/application-field/applications/aligner.png';
import TRAYICON from '@/views/assets/images/application-field/applications/tray.png';
import SPLINTICON from '@/views/assets/images/application-field/applications/splint.png';
import IMPLANTICON from '@/views/assets/images/application-field/applications/implant.png';
import BRIDGEICON from '@/views/assets/images/application-field/applications/bridge.png';

export const useApplicationsStore = defineStore('applications', () => {
    const items = reactive([
        {
            key: 'aligner',
            image: ALIGNERICON,
            enabled: true
        },
        {
            key: 'tray',
            image: TRAYICON,
            enabled: true
        },
        {
            key: 'splint',
            image: SPLINTICON,
            enabled: true
        },
        {
            key: 'implant',
            image: IMPLANTICON,
            enabled: false
        },
        {
            key: 'bridge',
            image: BRIDGEICON,
            enabled: false
        }
    ]);

    const selecteditem = ref('aligner');

    const handleSelect = (key) => {
        const item = items.find((el) => el.key === key);
        if (item && item.enabled) {
            selecteditem.value = key;
        }
    };

    return {
        items,
        selecteditem,
        handleSelect
    };
});