fixing filter where by md name in link params

This commit is contained in:
rizky 2024-08-13 01:50:37 -07:00
parent 87414b839a
commit 8ec266d47c
5 changed files with 8 additions and 2 deletions

View File

@ -157,6 +157,7 @@ export const FieldLink: FC<{
export type LinkParam = { export type LinkParam = {
url: string; url: string;
name?: string;
where: any; where: any;
create: any; create: any;
update: any; update: any;

View File

@ -214,11 +214,13 @@ export const TableList: FC<TableListProp> = ({
const last = md.params.links[md.params.links.length - 1]; const last = md.params.links[md.params.links.length - 1];
if (last && last.where) { if (last && last.where) {
if ((last.name && last.name === md.name) || !last.name) {
for (const [k, v] of Object.entries(last.where)) { for (const [k, v] of Object.entries(last.where)) {
where[k] = v; where[k] = v;
} }
} }
} }
}
call_prasi_events("tablelist", "where", [__props?.gen__table, where]); call_prasi_events("tablelist", "where", [__props?.gen__table, where]);

View File

@ -90,6 +90,7 @@ export const breadcrumbPrefix = (md: MDLocal) => {
} }
} }
for (const link of md.params.links) { for (const link of md.params.links) {
if (link.name && link.name !== md.name) continue;
for (const p of link.prefix) { for (const p of link.prefix) {
prefix.push({ prefix.push({
label: p.label, label: p.label,

View File

@ -92,6 +92,7 @@ export const Layout: FC<LYTChild> = (props) => {
}) || []; }) || [];
const values: LinkParam = { const values: LinkParam = {
name: params.name,
url: getPathname({ hash: true }), url: getPathname({ hash: true }),
prefix, prefix,
hash: "", hash: "",

1
utils/globals.d.ts vendored
View File

@ -9,6 +9,7 @@ declare var preloaded: (url: string) => boolean;
declare var navigate: ( declare var navigate: (
url: string, url: string,
params?: { params?: {
name?: string;
where?: any; where?: any;
create?: any; create?: any;
update?: any; update?: any;