Client: Reformatted all files with new line length
This commit is contained in:
10
client/src/pages/vendors/create.tsx
vendored
10
client/src/pages/vendors/create.tsx
vendored
@@ -9,20 +9,14 @@ interface CreateOrCloneProps {
|
||||
mode: "create" | "clone";
|
||||
}
|
||||
|
||||
export const VendorCreate: React.FC<
|
||||
IResourceComponentsProps & CreateOrCloneProps
|
||||
> = (props) => {
|
||||
export const VendorCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps> = (props) => {
|
||||
const t = useTranslate();
|
||||
|
||||
const { formProps, saveButtonProps, formLoading } = useForm<IVendor>();
|
||||
|
||||
return (
|
||||
<Create
|
||||
title={
|
||||
props.mode === "create"
|
||||
? t("vendor.titles.create")
|
||||
: t("vendor.titles.clone")
|
||||
}
|
||||
title={props.mode === "create" ? t("vendor.titles.create") : t("vendor.titles.clone")}
|
||||
isLoading={formLoading}
|
||||
saveButtonProps={saveButtonProps}
|
||||
>
|
||||
|
||||
95
client/src/pages/vendors/list.tsx
vendored
95
client/src/pages/vendors/list.tsx
vendored
@@ -1,27 +1,13 @@
|
||||
import React from "react";
|
||||
import {
|
||||
IResourceComponentsProps,
|
||||
BaseRecord,
|
||||
useTranslate,
|
||||
} from "@refinedev/core";
|
||||
import {
|
||||
useTable,
|
||||
List,
|
||||
EditButton,
|
||||
ShowButton,
|
||||
CloneButton,
|
||||
} from "@refinedev/antd";
|
||||
import { IResourceComponentsProps, BaseRecord, useTranslate } from "@refinedev/core";
|
||||
import { useTable, List, EditButton, ShowButton, CloneButton } from "@refinedev/antd";
|
||||
import { Table, Space, Button, Dropdown } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import { genericSorter, typeSorters } from "../../utils/sorting";
|
||||
import { genericFilterer, typeFilters } from "../../utils/filtering";
|
||||
import { IVendor } from "./model";
|
||||
import {
|
||||
TableState,
|
||||
useInitialTableState,
|
||||
useStoreInitialState,
|
||||
} from "../../utils/saveload";
|
||||
import { TableState, useInitialTableState, useStoreInitialState } from "../../utils/saveload";
|
||||
import { EditOutlined, FilterOutlined } from "@ant-design/icons";
|
||||
import { DateColumn, SortedColumn } from "../../components/column";
|
||||
|
||||
@@ -34,43 +20,27 @@ export const VendorList: React.FC<IResourceComponentsProps> = () => {
|
||||
const initialState = useInitialTableState("vendorList");
|
||||
|
||||
// Fetch data from the API
|
||||
const {
|
||||
tableProps,
|
||||
sorters,
|
||||
setSorters,
|
||||
filters,
|
||||
setFilters,
|
||||
current,
|
||||
pageSize,
|
||||
setCurrent,
|
||||
setPageSize,
|
||||
} = useTable<IVendor>({
|
||||
syncWithLocation: false,
|
||||
pagination: {
|
||||
mode: "off", // Perform pagination in antd's Table instead. Otherwise client-side sorting/filtering doesn't work.
|
||||
current: initialState.pagination.current,
|
||||
pageSize: initialState.pagination.pageSize,
|
||||
},
|
||||
sorters: {
|
||||
mode: "off", // Disable server-side sorting
|
||||
initial: initialState.sorters,
|
||||
},
|
||||
filters: {
|
||||
mode: "off", // Disable server-side filtering
|
||||
initial: initialState.filters,
|
||||
},
|
||||
});
|
||||
const { tableProps, sorters, setSorters, filters, setFilters, current, pageSize, setCurrent, setPageSize } =
|
||||
useTable<IVendor>({
|
||||
syncWithLocation: false,
|
||||
pagination: {
|
||||
mode: "off", // Perform pagination in antd's Table instead. Otherwise client-side sorting/filtering doesn't work.
|
||||
current: initialState.pagination.current,
|
||||
pageSize: initialState.pagination.pageSize,
|
||||
},
|
||||
sorters: {
|
||||
mode: "off", // Disable server-side sorting
|
||||
initial: initialState.sorters,
|
||||
},
|
||||
filters: {
|
||||
mode: "off", // Disable server-side filtering
|
||||
initial: initialState.filters,
|
||||
},
|
||||
});
|
||||
|
||||
// Create state for the columns to show
|
||||
const allColumns: (keyof IVendor & string)[] = [
|
||||
"id",
|
||||
"name",
|
||||
"registered",
|
||||
"comment",
|
||||
];
|
||||
const [showColumns, setShowColumns] = React.useState<string[]>(
|
||||
initialState.showColumns ?? allColumns
|
||||
);
|
||||
const allColumns: (keyof IVendor & string)[] = ["id", "name", "registered", "comment"];
|
||||
const [showColumns, setShowColumns] = React.useState<string[]>(initialState.showColumns ?? allColumns);
|
||||
|
||||
// Type the sorters and filters
|
||||
const typedSorters = typeSorters<IVendor>(sorters);
|
||||
@@ -181,24 +151,9 @@ export const VendorList: React.FC<IResourceComponentsProps> = () => {
|
||||
title={t("table.actions")}
|
||||
render={(_, record: BaseRecord) => (
|
||||
<Space>
|
||||
<EditButton
|
||||
hideText
|
||||
title={t("buttons.edit")}
|
||||
size="small"
|
||||
recordItemId={record.id}
|
||||
/>
|
||||
<ShowButton
|
||||
hideText
|
||||
title={t("buttons.show")}
|
||||
size="small"
|
||||
recordItemId={record.id}
|
||||
/>
|
||||
<CloneButton
|
||||
hideText
|
||||
title={t("buttons.clone")}
|
||||
size="small"
|
||||
recordItemId={record.id}
|
||||
/>
|
||||
<EditButton hideText title={t("buttons.edit")} size="small" recordItemId={record.id} />
|
||||
<ShowButton hideText title={t("buttons.show")} size="small" recordItemId={record.id} />
|
||||
<CloneButton hideText title={t("buttons.clone")} size="small" recordItemId={record.id} />
|
||||
</Space>
|
||||
)}
|
||||
/>
|
||||
|
||||
6
client/src/pages/vendors/show.tsx
vendored
6
client/src/pages/vendors/show.tsx
vendored
@@ -1,9 +1,5 @@
|
||||
import React from "react";
|
||||
import {
|
||||
IResourceComponentsProps,
|
||||
useShow,
|
||||
useTranslate,
|
||||
} from "@refinedev/core";
|
||||
import { IResourceComponentsProps, useShow, useTranslate } from "@refinedev/core";
|
||||
import { Show, NumberField, DateField, TextField } from "@refinedev/antd";
|
||||
import { Typography } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
Reference in New Issue
Block a user