mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'development' of https://gitlab.com/mbugroup/lti-web-client into feat/FE/US-34/stock-adjustment
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import CustomerForm from "@/components/pages/master-data/customer/form/CustomerForm";
|
||||
|
||||
const AddCustomer = () => {
|
||||
return (
|
||||
<section className="w-full p-4 flex flex-row justify-center">
|
||||
<CustomerForm/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddCustomer;
|
||||
@@ -0,0 +1,47 @@
|
||||
'use client';
|
||||
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import useSWR from 'swr';
|
||||
import { CustomerApi } from '@/services/api/master-data';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
import CustomerForm from '@/components/pages/master-data/customer/form/CustomerForm';
|
||||
|
||||
const CustomerEdit = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const costumerId = searchParams.get('customerId');
|
||||
|
||||
const { data: costumer, isLoading: isLoadingCostumer } = useSWR(
|
||||
costumerId,
|
||||
(id: number) => CustomerApi.getSingle(id)
|
||||
);
|
||||
|
||||
if (!costumerId) {
|
||||
router.back();
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLoadingCostumer && (!costumer || isResponseError(costumer))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingCostumer && (
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
)}
|
||||
{!isLoadingCostumer && isResponseSuccess(costumer) && (
|
||||
<CustomerForm formType='edit' initialValues={costumer.data} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomerEdit;
|
||||
@@ -0,0 +1,45 @@
|
||||
'use client'
|
||||
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import useSWR from "swr";
|
||||
import { CustomerApi } from '@/services/api/master-data';
|
||||
import { isResponseError, isResponseSuccess } from "@/lib/api-helper";
|
||||
import CustomerForm from "@/components/pages/master-data/customer/form/CustomerForm";
|
||||
|
||||
const CustomerDetail = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const costumerId = searchParams.get("customerId");
|
||||
|
||||
const { data: costumer, isLoading: isLoadingCostumer } = useSWR(
|
||||
costumerId,
|
||||
(id: number) => CustomerApi.getSingle(id)
|
||||
);
|
||||
|
||||
if(!costumerId){
|
||||
router.back();
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-row justify-center items-center p-4">
|
||||
<span className="loading loading-spinner loading-xl" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if(!isLoadingCostumer && (!costumer || isResponseError(costumer))){
|
||||
router.replace("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="w-full p-4 flex flex-row justify-center">
|
||||
{isLoadingCostumer && <span className="loading loading-spinner loading-xl" />}
|
||||
{!isLoadingCostumer && isResponseSuccess(costumer) && (
|
||||
<CustomerForm formType="detail" initialValues={costumer.data} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
export default CustomerDetail;
|
||||
@@ -0,0 +1,11 @@
|
||||
import CustomersTable from "@/components/pages/master-data/customer/CustomersTable";
|
||||
|
||||
const Customer = () => {
|
||||
return (
|
||||
<section className="w-full p-4">
|
||||
<CustomersTable />
|
||||
</section>
|
||||
)
|
||||
};
|
||||
|
||||
export default Customer;
|
||||
@@ -0,0 +1,11 @@
|
||||
import SupplierForm from '@/components/pages/master-data/supplier/form/SupplierForm';
|
||||
|
||||
const AddSupplier = () => {
|
||||
return (
|
||||
<section className='w-full p-4 flex flex-row justify-center'>
|
||||
<SupplierForm />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddSupplier;
|
||||
@@ -0,0 +1,49 @@
|
||||
'use client';
|
||||
|
||||
import SupplierForm from '@/components/pages/master-data/supplier/form/SupplierForm';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
import { SupplierApi } from '@/services/api/master-data';
|
||||
import { useSearchParams, useRouter } from 'next/navigation';
|
||||
import useSWR from 'swr';
|
||||
|
||||
const SupplierEdit = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
// Get Query Params
|
||||
const supplierId = searchParams.get('supplierId');
|
||||
|
||||
// Fetch Data
|
||||
const { data: supplier, isLoading: isLoadingSupplier } = useSWR(
|
||||
supplierId,
|
||||
(id: number) => SupplierApi.getSingle(id)
|
||||
);
|
||||
|
||||
if (!supplierId) {
|
||||
router.back();
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLoadingSupplier && (!supplier || isResponseError(supplier))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingSupplier && (
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
)}
|
||||
{!isLoadingSupplier && isResponseSuccess(supplier) && (
|
||||
<SupplierForm formType='edit' initialValues={supplier.data} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SupplierEdit;
|
||||
@@ -0,0 +1,49 @@
|
||||
'use client';
|
||||
|
||||
import SupplierForm from '@/components/pages/master-data/supplier/form/SupplierForm';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
import { SupplierApi } from '@/services/api/master-data';
|
||||
import { useSearchParams, useRouter } from 'next/navigation';
|
||||
import useSWR from 'swr';
|
||||
|
||||
const SupplierDetail = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
// Get Query Params
|
||||
const supplierId = searchParams.get('supplierId');
|
||||
|
||||
// Fetch Data
|
||||
const { data: supplier, isLoading: isLoadingSupplier } = useSWR(
|
||||
supplierId,
|
||||
(id: number) => SupplierApi.getSingle(id)
|
||||
);
|
||||
|
||||
if (!supplierId) {
|
||||
router.back();
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLoadingSupplier && (!supplier || isResponseError(supplier))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingSupplier && (
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
)}
|
||||
{!isLoadingSupplier && isResponseSuccess(supplier) && (
|
||||
<SupplierForm formType='detail' initialValues={supplier.data} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SupplierDetail;
|
||||
@@ -0,0 +1,11 @@
|
||||
import SuppliersTable from "@/components/pages/master-data/supplier/SupplierTable";
|
||||
|
||||
const Supplier = () => {
|
||||
return (
|
||||
<section className='w-full p-4'>
|
||||
<SuppliersTable />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default Supplier;
|
||||
Reference in New Issue
Block a user