mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Use accessorKey/styled headers and remove dead code
This commit is contained in:
@@ -112,11 +112,19 @@ const UniformityConfirmationPreview = ({
|
|||||||
|
|
||||||
const columns: ColumnDef<DetailOptionType>[] = [
|
const columns: ColumnDef<DetailOptionType>[] = [
|
||||||
{
|
{
|
||||||
header: 'Label',
|
accessorKey: 'label',
|
||||||
|
enableSorting: false,
|
||||||
|
header: () => (
|
||||||
|
<span className='font-medium text-sm leading-[150%]'>Label</span>
|
||||||
|
),
|
||||||
cell: (props) => props.row.original.label,
|
cell: (props) => props.row.original.label,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: 'Value',
|
accessorKey: 'value',
|
||||||
|
enableSorting: false,
|
||||||
|
header: () => (
|
||||||
|
<span className='font-medium text-sm leading-[150%]'>Value</span>
|
||||||
|
),
|
||||||
cell: (props) => {
|
cell: (props) => {
|
||||||
const id = props.row.original.id;
|
const id = props.row.original.id;
|
||||||
const value = props.row.original.value;
|
const value = props.row.original.value;
|
||||||
@@ -214,7 +222,6 @@ const UniformityTable = () => {
|
|||||||
const [isBulkActionLoading, setIsBulkActionLoading] = useState(false);
|
const [isBulkActionLoading, setIsBulkActionLoading] = useState(false);
|
||||||
const [isPdfExportLoading, setIsPdfExportLoading] = useState(false);
|
const [isPdfExportLoading, setIsPdfExportLoading] = useState(false);
|
||||||
const [isExcelExportLoading, setIsExcelExportLoading] = useState(false);
|
const [isExcelExportLoading, setIsExcelExportLoading] = useState(false);
|
||||||
const isAnyExportLoading = isPdfExportLoading || isExcelExportLoading;
|
|
||||||
|
|
||||||
const singleDeleteModal = useModal();
|
const singleDeleteModal = useModal();
|
||||||
const successModal = useModal();
|
const successModal = useModal();
|
||||||
@@ -238,7 +245,7 @@ const UniformityTable = () => {
|
|||||||
const [filterEndDate, setFilterEndDate] = useState('');
|
const [filterEndDate, setFilterEndDate] = useState('');
|
||||||
const [filterProjectFlockLocationId, setFilterProjectFlockLocationId] =
|
const [filterProjectFlockLocationId, setFilterProjectFlockLocationId] =
|
||||||
useState<string>('');
|
useState<string>('');
|
||||||
const [filterErrors, setFilterErrors] = useState<Record<string, string>>({});
|
const [, setFilterErrors] = useState<Record<string, string>>({});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
setInputValue: setFilterLocationInputValue,
|
setInputValue: setFilterLocationInputValue,
|
||||||
@@ -309,7 +316,6 @@ const UniformityTable = () => {
|
|||||||
? projectFlockKandangLookupData.data
|
? projectFlockKandangLookupData.data
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
// Update filterProjectFlockKandangId when lookup changes
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (projectFlockKandangLookup?.id) {
|
if (projectFlockKandangLookup?.id) {
|
||||||
setFilterProjectFlockKandangId(projectFlockKandangLookup.id);
|
setFilterProjectFlockKandangId(projectFlockKandangLookup.id);
|
||||||
@@ -483,12 +489,6 @@ const UniformityTable = () => {
|
|||||||
[filterFormik]
|
[filterFormik]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleApplyFilters = useCallback(() => {
|
|
||||||
handleFormSubmit(
|
|
||||||
new Event('submit') as unknown as React.FormEvent<HTMLFormElement>
|
|
||||||
);
|
|
||||||
}, [handleFormSubmit]);
|
|
||||||
|
|
||||||
const selectedRowIds = useMemo(() => {
|
const selectedRowIds = useMemo(() => {
|
||||||
return Object.keys(rowSelection)
|
return Object.keys(rowSelection)
|
||||||
.filter((key) => rowSelection[key])
|
.filter((key) => rowSelection[key])
|
||||||
@@ -1076,7 +1076,7 @@ const UniformityTable = () => {
|
|||||||
modalBox: 'rounded-2xl',
|
modalBox: 'rounded-2xl',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-4 mt-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
{createdUniformity ? (
|
{createdUniformity ? (
|
||||||
<UniformityConfirmationPreview
|
<UniformityConfirmationPreview
|
||||||
uniformityDetail={createdUniformity}
|
uniformityDetail={createdUniformity}
|
||||||
@@ -1112,7 +1112,7 @@ const UniformityTable = () => {
|
|||||||
modalBox: 'rounded-2xl',
|
modalBox: 'rounded-2xl',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-4 mt-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
<UniformityConfirmationPreview uniformity={selectedUniformity} />
|
<UniformityConfirmationPreview uniformity={selectedUniformity} />
|
||||||
</div>
|
</div>
|
||||||
</ConfirmationModal>
|
</ConfirmationModal>
|
||||||
@@ -1136,7 +1136,7 @@ const UniformityTable = () => {
|
|||||||
modalBox: 'rounded-2xl',
|
modalBox: 'rounded-2xl',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-4 mt-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
{selectedRowIds.length === 1 ? (
|
{selectedRowIds.length === 1 ? (
|
||||||
<UniformityConfirmationPreview
|
<UniformityConfirmationPreview
|
||||||
uniformity={selectedUniformities[0]}
|
uniformity={selectedUniformities[0]}
|
||||||
@@ -1168,7 +1168,7 @@ const UniformityTable = () => {
|
|||||||
modalBox: 'rounded-2xl',
|
modalBox: 'rounded-2xl',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-4 mt-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
<UniformityConfirmationPreview uniformity={selectedUniformity} />
|
<UniformityConfirmationPreview uniformity={selectedUniformity} />
|
||||||
</div>
|
</div>
|
||||||
</ConfirmationModal>
|
</ConfirmationModal>
|
||||||
@@ -1192,7 +1192,7 @@ const UniformityTable = () => {
|
|||||||
modalBox: 'rounded-2xl',
|
modalBox: 'rounded-2xl',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-4 mt-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
{selectedRowIds.length === 1 ? (
|
{selectedRowIds.length === 1 ? (
|
||||||
<UniformityConfirmationPreview
|
<UniformityConfirmationPreview
|
||||||
uniformity={selectedUniformities[0]}
|
uniformity={selectedUniformities[0]}
|
||||||
@@ -1224,7 +1224,7 @@ const UniformityTable = () => {
|
|||||||
modalBox: 'rounded-2xl',
|
modalBox: 'rounded-2xl',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-4 mt-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
{selectedRowIds.length === 1 ? (
|
{selectedRowIds.length === 1 ? (
|
||||||
<UniformityConfirmationPreview
|
<UniformityConfirmationPreview
|
||||||
uniformity={selectedUniformities[0]}
|
uniformity={selectedUniformities[0]}
|
||||||
|
|||||||
Reference in New Issue
Block a user