Formatted some client files

This commit is contained in:
Donkie
2023-12-17 20:36:13 +01:00
parent 83081c3ade
commit b0fbe7dea7
6 changed files with 58 additions and 47 deletions

View File

@@ -7,7 +7,6 @@ import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import { IFilament } from "./model";
import { enrichText } from "../../utils/parsing";
import { IVendor } from "../vendors/model";
import { useNavigate } from "react-router-dom";
dayjs.extend(utc);
@@ -34,19 +33,22 @@ export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
const gotoVendor = (): undefined => {
const URL = `/vendor/show/${record?.vendor?.id}`;
navigate(URL);
}
};
const gotoSpools = (): undefined => {
const URL = `/spool#filters=[{"field":"filament.id","operator":"in","value":[${record?.id}]}]`
const URL = `/spool#filters=[{"field":"filament.id","operator":"in","value":[${record?.id}]}]`;
navigate(URL);
}
};
return (
<Show isLoading={isLoading} title={record ? formatTitle(record) : ""}>
<Title level={5}>{t("filament.fields.id")}</Title>
<NumberField value={record?.id ?? ""} />
<Title level={5}>{t("filament.fields.vendor")}</Title>
<button onClick={gotoVendor} style={{ background: 'none', border: 'none', color: 'blue', cursor: 'pointer', paddingLeft: 0 }}>
<button
onClick={gotoVendor}
style={{ background: "none", border: "none", color: "blue", cursor: "pointer", paddingLeft: 0 }}
>
{record ? record.vendor?.name : ""}
</button>
<Title level={5}>{t("filament.fields.registered")}</Title>
@@ -118,10 +120,13 @@ export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
<Title level={5}>{t("filament.fields.comment")}</Title>
<TextField value={enrichText(record?.comment)} />
<Title level={5}>{t("filament.fields.spools")}</Title>
<button onClick={gotoSpools} style={{ background: 'none', border: 'none', color: 'blue', cursor: 'pointer', paddingLeft: 0 }}>
<button
onClick={gotoSpools}
style={{ background: "none", border: "none", color: "blue", cursor: "pointer", paddingLeft: 0 }}
>
{record ? formatTitle(record) : ""}
</button>
</Show >
</Show>
);
};