diff --git a/src/components/common/VnSelectCache.vue b/src/components/common/VnSelectCache.vue
index 51873ef6e..b56f11220 100644
--- a/src/components/common/VnSelectCache.vue
+++ b/src/components/common/VnSelectCache.vue
@@ -8,15 +8,29 @@ const $props = defineProps({
default: null,
},
find: {
- type: String,
+ type: [String, Array],
default: null,
+ description: 'search in row to add default options',
},
});
const options = ref([]);
onBeforeMount(async () => {
- const { url } = useAttrs();
+ const { url, optionValue, optionLabel } = useAttrs();
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
- if (findBy) options.value = [$props.row[findBy]];
+ if (!findBy || !$props.row) return;
+ // is array
+ if (Array.isArray(findBy)) {
+ const [id, name] = findBy;
+ if (!$props.row[id] || !$props.row[name]) return;
+ return (options.value = [
+ {
+ [optionValue ?? 'id']: $props.row[id],
+ [optionLabel ?? 'name']: $props.row[name],
+ },
+ ]);
+ }
+ // is string
+ if ($props.row[findBy]) options.value = [$props.row[findBy]];
});
diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue
index 572fe3ec7..0c32c5b87 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -39,7 +39,6 @@ const columns = computed(() => [
align: 'left',
name: 'state',
label: t('ticketList.state'),
- cardVisible: true,
chip: {
condition: () => true,
color: (row) => {
@@ -54,9 +53,6 @@ const columns = computed(() => [
fields: ['id', 'name'],
},
},
- columnField: {
- component: null,
- },
},
{
align: 'left',
diff --git a/src/pages/Ticket/TicketWeekly.vue b/src/pages/Ticket/TicketWeekly.vue
index 65d79bc32..61532ee51 100644
--- a/src/pages/Ticket/TicketWeekly.vue
+++ b/src/pages/Ticket/TicketWeekly.vue
@@ -2,6 +2,7 @@
import { onMounted, ref, computed, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
+import VnSelectCache from 'src/components/common/VnSelectCache.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
@@ -17,7 +18,6 @@ const stateStore = useStateStore();
const { t } = useI18n();
const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm();
-const agencyModesOptions = ref([]);
const allColumnNames = ref([]);
const arrayData = useArrayData('WeeklyTickets');
@@ -91,10 +91,6 @@ const columns = computed(() => [
},
inWhere: true,
},
- columnField: {
- component: null,
- },
- format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
},
{
align: 'left',
@@ -219,15 +215,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
/>
-
+ >
+ {{ console.log('row: ', row) }}
+