feat: spots

This commit is contained in:
Michael 2025-07-11 15:03:59 +02:00
parent 08010fbb61
commit a4e1a3328f
20 changed files with 172 additions and 97 deletions

View file

@ -6,7 +6,11 @@ import {smartblock_page} from "@/composables/content/smartblock_page.ts";
import SmartBlockEditor from "@partials/SmartBlockEditor.vue";
import {useSmartBlockStore} from "@/stores/smartblock.store.ts";
import {baseSmartBlock} from "@models/smartblock/smartblock.ts";
import {useShowTypeStore} from "@stores/showType.store.ts";
const { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = smartblock_page()
// Props, data and stores
const props = defineProps({
hideColumns: {
type: Array,
@ -16,18 +20,8 @@ const props = defineProps({
type: Boolean,
required: false
},
showType: {
type: String as PropType<'spot' | null>,
required: false,
validator: (value: string) => ['spot'].includes(value),
},
});
const smartBlockStore = useSmartBlockStore()
const { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = smartblock_page()
const itemEdited = ref({
id: null
})
@ -42,6 +36,11 @@ const dialog = reactive({
const visibleHeaders = ref(headers)
const showTypeStore = useShowTypeStore();
const smartBlockStore = useSmartBlockStore()
// Funcs
const openDialog = (type, title = '', text = '') => {
dialog.open = true
dialog.type = type
@ -54,7 +53,7 @@ const edit = (item) => {
item = baseSmartBlock();
}
smartBlockStore.loadSmartBlock(item);
smartBlockStore.currentSmartBlock.smart_block_type = props.showType;
smartBlockStore.currentSmartBlock.smart_block_type = showTypeStore.currentType;
itemEdited.value = item;
console.log(smartBlockStore)
}
@ -78,7 +77,7 @@ const cancel = (item) => {
const confirmDelete = (confirm) => {
if (confirm) {
if (!bulk) {
if (!bulk.value) {
deleteItem(itemEdited.value.id)
} else {
itemEdited.value.forEach(el => {