This commit is contained in:
rizky 2024-07-23 21:33:00 -07:00
parent 58bd986919
commit 3e09e4b0dd
7 changed files with 89 additions and 15 deletions

View File

@ -147,7 +147,10 @@ export const FieldInput: FC<{
className={cx(
"field-inner c-flex-1 c-flex c-items-center",
field.focused && "focused",
disabled && "c-pointer-events-none c-bg-gray-50"
disabled && "c-pointer-events-none",
disabled &&
!["checkbox"].includes(arg.sub_type) &&
" c-bg-gray-50"
)}
>
{not_ready ? (

View File

@ -12,6 +12,8 @@ export const FieldSingleCheckbox: FC<{
list: [] as any[],
change_timeout: null as any,
});
const disabled =
typeof field.disabled === "function" ? field.disabled() : field.disabled;
const renderOnChange = () => {
local.render();
if (field.on_change) {
@ -47,14 +49,16 @@ export const FieldSingleCheckbox: FC<{
<div className={cx(`c-flex c-flex-col c-space-y-1 c-p-0.5`)}>
<div
onClick={() => {
fm.data[field.name] = !value;
fm.render();
if (field.on_change) {
field.on_change({
value: !value,
name: field.name,
fm,
});
if(!disabled){
fm.data[field.name] = !value;
fm.render();
if (field.on_change) {
field.on_change({
value: !value,
name: field.name,
fm,
});
}
}
}}
className="c-flex c-flex-row c-space-x-1 cursor-pointer c-items-center rounded-full p-0.5"

View File

@ -4,7 +4,9 @@ import { FC } from "react";
import { FMLocal, FieldLocal } from "../../typings";
import { PropTypeInput } from "./TypeInput";
import * as XLSX from "xlsx";
const w = window as unknown as {
serverurl: string
}
export const FieldUpload: FC<{
field: FieldLocal;
@ -97,7 +99,7 @@ export const FieldUpload: FC<{
let url = siteurl("/_upload");
if (location.hostname === 'prasi.avolut.com' || location.host === 'localhost:4550') {
const newurl = new URL(location.href);
newurl.pathname = `/_proxy/https://julong-dev.avolut.com/_upload`;
newurl.pathname = `/_proxy/${w.serverurl}/_upload`;
url = newurl.toString();
}

61
comps/list/lib/export_excel.tsx Executable file
View File

@ -0,0 +1,61 @@
import * as XLSX from "xlsx";
import { TableListProp } from "../TableList";
import { filterWhere } from "lib/comps/filter/parser/filter-where";
import { call_prasi_events } from "lib/exports";
export const export_excel = async ({
list,
tbl,
on_load,
}: {
list: TableListProp;
tbl: {
columns: any[];
sort: {
columns: any;
orderBy: any;
};
render: () => void;
};
on_load: () => any;
}) => {
const where = filterWhere(list.filter_name, list.__props);
call_prasi_events("tablelist", "where", [list.__props?.gen__table, where]);
const orderBy = tbl.sort.orderBy || undefined;
const load_args: any = {
async reload() {},
orderBy,
where,
paging: {},
};
if (typeof list.on_load === "function") {
const result = await list.on_load({ ...load_args, mode: "query" });
const data = [] as any[];
const res = [
{
id: "ff4105af-aa81-4432-847b-1c97fc9eb505",
name_goal: "Top Down",
definition: null,
threshold: 1,
description: "Top Down",
goal_employee: [
{
id: "440dd52c-1a18-4b53-b0da-a45f47251f36",
},
],
},
];
const l = document.getElementsByClassName("rdg-row");
if (res.length) {
res.map((e, id) => {
if (tbl.columns.length) {
tbl.columns.map((ex, idx) => {
const r = null;
console.log({ r });
});
}
});
}
}
};

View File

@ -67,7 +67,7 @@ export const HeaderProfile = lazify(
/** charts */
export { PieChart } from "@/comps/charts/pie";
// export { BarChart } from "@/comps/charts/bar";
export { BarChart } from "@/comps/charts/bar";
// export { LineChart } from "@/comps/charts/line";
/** Generator */

View File

@ -21,6 +21,7 @@ type MLocal = typeof local_default & { render: () => void };
export const Menu: FC<MenuProp> = (props) => {
const imenu = props.menu;
console.log({imenu})
let role = props.role;
role = props.on_init();
let menu = get(imenu, role) || [];
@ -76,10 +77,12 @@ export const SideBar: FC<{
parent?: string;
}> = ({ data: _data, local, depth, pm, mode, expanded, parent }) => {
const PassProp = pm.PassProp;
w.prasi_menu.pm = pm;
w.prasi_menu = {
...w.prasi_menu,
pm
}
const data: IMenu[] = (typeof _data[0] === "string" ? [_data] : _data) as any;
console.log({data})
useEffect(() => {
data.map((item) => {
const menu = {

View File

@ -11,6 +11,7 @@ export type MenuProp = {
item: PrasiItem;
style: "navbar" | "sidebar";
on_load?: (on_done: (exec: () => void) => void) => void;
get_menu?: (mn: Array<Record<string, IMenu[]>>) => Array<Record<string, IMenu[]>>
};
export type MenuActive = {
data: any;