This commit is contained in:
rizky 2024-08-07 07:24:29 -07:00
parent 2e6d2b5388
commit 15e1e983a5
3 changed files with 25 additions and 18 deletions

View File

@ -158,7 +158,6 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
if (!success) {
const errors = Object.keys(fm.error.list);
const count = errors.length;
console.log(fm.error.list);
toast.error(
<div className="c-flex c-text-red-600 c-items-center">
<AlertTriangle className="c-h-4 c-w-4 c-mr-1" />
@ -177,7 +176,6 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
}
);
} else {
if (!fm.is_newly_created) {
toast.success(
<div className="c-flex c-text-green-700 c-items-center">
<Check className="c-h-4 c-w-4 c-mr-1 " />
@ -192,7 +190,6 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
);
}
}
}
return success;
}
};

View File

@ -196,13 +196,22 @@ export const TableList: FC<TableListProp> = ({
},
};
} else {
const field = rel.checked.find((e) => !e.is_pk);
const field = rel.checked.find(
(e) => !e.is_pk && !e.relation
);
if (field) {
local.sort.orderBy = {
[columnKey]: {
[field.name]: direction === "ASC" ? "asc" : "desc",
},
};
} else if (rel.relation) {
local.sort.orderBy = {
[columnKey]: {
[rel.relation.to.fields[0]]:
direction === "ASC" ? "asc" : "desc",
},
};
}
}
}
@ -618,7 +627,8 @@ export const TableList: FC<TableListProp> = ({
}
}
let data = local.data || [];
let data = Array.isArray(local.data) ? local.data : [];
if (typeof local.data === "string") console.error(local.data);
if (isEditor) {
if (data.length > 0) {

View File

@ -3,7 +3,7 @@ import { toast as sonner } from "sonner";
const timer = {
timeout: null as any,
done: false,
limit: 400,
limit: 200,
};
export const toast = {