WIP: Added searchbar in Wagon module #835

Draft
jon wants to merge 16 commits from Fix-AddSearchbarToWagonModule into dev
4 changed files with 10 additions and 1 deletions
Showing only changes of commit 38c3697bef - Show all commits

View File

@ -67,6 +67,10 @@ const props = defineProps({
type: Function, type: Function,
default: undefined, default: undefined,
}, },
moduleName: {
type: Boolean,
default: false,
},
}); });
const searchText = ref(); const searchText = ref();

View File

@ -247,6 +247,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
} }
function updateStateParams() { function updateStateParams() {
const usesModuleName = userOptions.moduleName;
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } }; const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter); newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter);
@ -261,7 +262,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const { matched: matches } = router.currentRoute.value; const { matched: matches } = router.currentRoute.value;
const { path } = matches.at(-1); const { path } = matches.at(-1);
Outdated
Review

No hay que poner rutas concretas en un composable global.
Mañana lo miramos

No hay que poner rutas concretas en un composable global. Mañana lo miramos
path === '/wagon/list' || path === '/wagon/type/list' usesModuleName
? (to = ? (to =
store?.data?.length === 1 store?.data?.length === 1
? path.replace( ? path.replace(

View File

@ -18,6 +18,7 @@ const dialog = ref();
const { push } = useRouter(); const { push } = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const useModuleName = ref(true);
const initialData = computed(() => { const initialData = computed(() => {
return { return {
@ -93,6 +94,7 @@ const exprBuilder = (param, value) => {
data-key="WagonTypeList" data-key="WagonTypeList"
:label="t('searchWagonType')" :label="t('searchWagonType')"
:info="t('searchInfo')" :info="t('searchInfo')"
:module-name="useModuleName"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
/> />
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">

View File

@ -14,6 +14,7 @@ const quasar = useQuasar();
const arrayData = useArrayData('WagonList'); const arrayData = useArrayData('WagonList');
const store = arrayData.store; const store = arrayData.store;
const router = useRouter(); const router = useRouter();
const useModuleName = ref(true);
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const filter = { const filter = {
@ -105,6 +106,7 @@ const exprBuilder = (param, value) => {
data-key="WagonList" data-key="WagonList"
:label="t('searchWagon')" :label="t('searchWagon')"
:info="t('searchInfo')" :info="t('searchInfo')"
:module-name="useModuleName"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
/> />
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">