mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'fix/daily-checklist' into 'development'
[FIX/FE] Daily Checklist See merge request mbugroup/lti-web-client!459
This commit is contained in:
@@ -89,7 +89,10 @@ export function Dashboard() {
|
|||||||
options: kandangOptions,
|
options: kandangOptions,
|
||||||
loadMore: loadMoreKandang,
|
loadMore: loadMoreKandang,
|
||||||
isLoadingMore: isLoadingMoreKandang,
|
isLoadingMore: isLoadingMoreKandang,
|
||||||
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name');
|
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name', 'search', {
|
||||||
|
order_by: 'asc',
|
||||||
|
sort_by: 'name',
|
||||||
|
});
|
||||||
|
|
||||||
const handleKandangScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
const handleKandangScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
||||||
const target = e.target as HTMLDivElement;
|
const target = e.target as HTMLDivElement;
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ export function ListDailyChecklistContent() {
|
|||||||
options: kandangOptions,
|
options: kandangOptions,
|
||||||
isLoadingMore: isLoadingMoreKandang,
|
isLoadingMore: isLoadingMoreKandang,
|
||||||
loadMore: loadMoreKandang,
|
loadMore: loadMoreKandang,
|
||||||
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name');
|
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name', 'search', {
|
||||||
|
order_by: 'asc',
|
||||||
|
sort_by: 'name',
|
||||||
|
});
|
||||||
|
|
||||||
const checklistList = isResponseSuccess(checklistListRes)
|
const checklistList = isResponseSuccess(checklistListRes)
|
||||||
? checklistListRes.data || []
|
? checklistListRes.data || []
|
||||||
|
|||||||
@@ -96,7 +96,10 @@ export function MasterEmployeeContent() {
|
|||||||
options: kandangOptions,
|
options: kandangOptions,
|
||||||
loadMore: loadMoreKandang,
|
loadMore: loadMoreKandang,
|
||||||
isLoadingMore: isLoadingMoreKandang,
|
isLoadingMore: isLoadingMoreKandang,
|
||||||
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name');
|
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name', 'search', {
|
||||||
|
order_by: 'asc',
|
||||||
|
sort_by: 'name',
|
||||||
|
});
|
||||||
|
|
||||||
const handleKandangScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
const handleKandangScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
||||||
const target = e.target as HTMLDivElement;
|
const target = e.target as HTMLDivElement;
|
||||||
|
|||||||
@@ -368,7 +368,9 @@ export function MasterKandangContent() {
|
|||||||
name='search'
|
name='search'
|
||||||
placeholder='Cari kandang...'
|
placeholder='Cari kandang...'
|
||||||
value={tableFilterState.search}
|
value={tableFilterState.search}
|
||||||
onChange={(e) => updateFilter('search', e.target.value)}
|
onChange={(e) =>
|
||||||
|
updateFilter('search', e.target.value, true)
|
||||||
|
}
|
||||||
className={{
|
className={{
|
||||||
wrapper: 'w-full sm:w-[280px] border-gray-200',
|
wrapper: 'w-full sm:w-[280px] border-gray-200',
|
||||||
inputWrapper: 'px-3 py-2 h-fit rounded-md',
|
inputWrapper: 'px-3 py-2 h-fit rounded-md',
|
||||||
@@ -383,7 +385,11 @@ export function MasterKandangContent() {
|
|||||||
<Select
|
<Select
|
||||||
value={tableFilterState.location_id}
|
value={tableFilterState.location_id}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) =>
|
||||||
updateFilter('location_id', value === 'all' ? '' : value)
|
updateFilter(
|
||||||
|
'location_id',
|
||||||
|
value === 'all' ? '' : value,
|
||||||
|
true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<SelectTrigger className='w-[180px] border-gray-200'>
|
<SelectTrigger className='w-[180px] border-gray-200'>
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ export function DailyChecklistReportsContent() {
|
|||||||
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name', 'search', {
|
} = useSelect(DailyChecklistKandangApi.basePath, 'id', 'name', 'search', {
|
||||||
area_id: tableFilterState.area_id,
|
area_id: tableFilterState.area_id,
|
||||||
location_id: tableFilterState.location_id,
|
location_id: tableFilterState.location_id,
|
||||||
|
order_by: 'asc',
|
||||||
|
sort_by: 'name',
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleKandangScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
const handleKandangScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
||||||
@@ -159,17 +161,24 @@ export function DailyChecklistReportsContent() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const { options: employeeOptions } = useSelect(
|
const {
|
||||||
EmployeeApi.basePath,
|
options: employeeOptions,
|
||||||
'id',
|
loadMore: loadMoreEmployee,
|
||||||
'name',
|
isLoadingMore: isLoadingMoreEmployee,
|
||||||
'search',
|
} = useSelect(EmployeeApi.basePath, 'id', 'name', 'search', {
|
||||||
{
|
order_by: 'asc',
|
||||||
page: '1',
|
sort_by: 'name',
|
||||||
limit: '500',
|
kandang_id: tableFilterState.kandang_id,
|
||||||
kandang_id: tableFilterState.kandang_id,
|
});
|
||||||
|
|
||||||
|
const handleEmployeeScroll = (e: React.UIEvent<HTMLDivElement>) => {
|
||||||
|
const target = e.target as HTMLDivElement;
|
||||||
|
if (target.scrollHeight - target.scrollTop <= target.clientHeight + 10) {
|
||||||
|
if (!isLoadingMoreEmployee) {
|
||||||
|
loadMoreEmployee();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
};
|
||||||
|
|
||||||
const currentMonthMaxDay = new Date(
|
const currentMonthMaxDay = new Date(
|
||||||
Number(tableFilterState.tahun),
|
Number(tableFilterState.tahun),
|
||||||
@@ -493,7 +502,7 @@ export function DailyChecklistReportsContent() {
|
|||||||
>
|
>
|
||||||
<SelectValue placeholder='Semua ABK' />
|
<SelectValue placeholder='Semua ABK' />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent onScroll={handleEmployeeScroll}>
|
||||||
<SelectItem value='ALL'>Semua ABK</SelectItem>
|
<SelectItem value='ALL'>Semua ABK</SelectItem>
|
||||||
{employeeOptions.map((employee) => (
|
{employeeOptions.map((employee) => (
|
||||||
<SelectItem
|
<SelectItem
|
||||||
@@ -503,6 +512,11 @@ export function DailyChecklistReportsContent() {
|
|||||||
{employee.label}
|
{employee.label}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
{isLoadingMoreEmployee && (
|
||||||
|
<div className='flex justify-center p-2'>
|
||||||
|
<Loader2 className='h-4 w-4 animate-spin text-gray-500' />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { RequestOptions } from '@/services/http/base';
|
|||||||
import { redirectToSSO } from '@/lib/auth-helper';
|
import { redirectToSSO } from '@/lib/auth-helper';
|
||||||
|
|
||||||
const BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? '';
|
const BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ?? '';
|
||||||
const axiosClient = axios.create({ baseURL: BASE_URL, timeout: 30_000 });
|
const axiosClient = axios.create({ baseURL: BASE_URL, timeout: 60_000 });
|
||||||
|
|
||||||
axiosClient.interceptors.response.use(
|
axiosClient.interceptors.response.use(
|
||||||
(response) => response,
|
(response) => response,
|
||||||
@@ -38,7 +38,7 @@ export async function httpClient<T, B = unknown>(
|
|||||||
method: opts.method ?? 'GET',
|
method: opts.method ?? 'GET',
|
||||||
params: opts.query,
|
params: opts.query,
|
||||||
data: opts.body,
|
data: opts.body,
|
||||||
timeout: opts.timeoutMs ?? 30_000,
|
timeout: opts.timeoutMs ?? 60_000,
|
||||||
withCredentials: isCookieAuth && !isBearerAuth,
|
withCredentials: isCookieAuth && !isBearerAuth,
|
||||||
responseType: opts.responseType,
|
responseType: opts.responseType,
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user