mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore: format code using prettier
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import CustomerForm from "@/components/pages/master-data/customer/form/CustomerForm";
|
||||
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 className='w-full p-4 flex flex-row justify-center'>
|
||||
<CustomerForm />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default AddCustomer;
|
||||
export default AddCustomer;
|
||||
|
||||
@@ -1,45 +1,47 @@
|
||||
'use client'
|
||||
'use client';
|
||||
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import useSWR from "swr";
|
||||
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";
|
||||
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 costumerId = searchParams.get('customerId');
|
||||
|
||||
const { data: costumer, isLoading: isLoadingCostumer } = useSWR(
|
||||
costumerId,
|
||||
(id: number) => CustomerApi.getSingle(id)
|
||||
);
|
||||
|
||||
if(!costumerId){
|
||||
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 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");
|
||||
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" />}
|
||||
<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} />
|
||||
<CustomerForm formType='detail' initialValues={costumer.data} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomerDetail;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import CustomersTable from "@/components/pages/master-data/customer/CustomersTable";
|
||||
import CustomersTable from '@/components/pages/master-data/customer/CustomersTable';
|
||||
|
||||
const Customer = () => {
|
||||
return (
|
||||
<section className="w-full p-4">
|
||||
<section className='w-full p-4'>
|
||||
<CustomersTable />
|
||||
</section>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export default Customer;
|
||||
export default Customer;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import FlockForm from "@/components/pages/master-data/flock/form/FlockForm";
|
||||
import FlockForm from '@/components/pages/master-data/flock/form/FlockForm';
|
||||
|
||||
const AddFlock = () => {
|
||||
return (
|
||||
<section className="w-full p-4 flex flex-row justify-center">
|
||||
<section className='w-full p-4 flex flex-row justify-center'>
|
||||
<FlockForm />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default AddFlock;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
'use client';
|
||||
|
||||
import FlockForm from "@/components/pages/master-data/flock/form/FlockForm";
|
||||
import { isResponseError, isResponseSuccess } from "@/lib/api-helper";
|
||||
import { FlockApi } from "@/services/api/master-data";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import useSWR from "swr";
|
||||
import FlockForm from '@/components/pages/master-data/flock/form/FlockForm';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
import { FlockApi } from '@/services/api/master-data';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import useSWR from 'swr';
|
||||
|
||||
const FlockEdit = () => {
|
||||
const router = useRouter();
|
||||
@@ -44,6 +44,6 @@ const FlockEdit = () => {
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default FlockEdit;
|
||||
export default FlockEdit;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import SuspenseHelper from "@/components/helper/SuspenseHelper"
|
||||
import SuspenseHelper from '@/components/helper/SuspenseHelper';
|
||||
|
||||
const Layout = ({
|
||||
children
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
children: React.ReactNode;
|
||||
}>) => {
|
||||
return <SuspenseHelper>{children}</SuspenseHelper>
|
||||
}
|
||||
return <SuspenseHelper>{children}</SuspenseHelper>;
|
||||
};
|
||||
|
||||
export default Layout;
|
||||
export default Layout;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
'use client'
|
||||
'use client';
|
||||
|
||||
import FlockForm from "@/components/pages/master-data/flock/form/FlockForm";
|
||||
import { isResponseError, isResponseSuccess } from "@/lib/api-helper";
|
||||
import { FlockApi } from "@/services/api/master-data";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import useSWR from "swr";
|
||||
import FlockForm from '@/components/pages/master-data/flock/form/FlockForm';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
import { FlockApi } from '@/services/api/master-data';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import useSWR from 'swr';
|
||||
|
||||
const FlockDetail = () => {
|
||||
const router = useRouter();
|
||||
@@ -14,33 +14,36 @@ const FlockDetail = () => {
|
||||
const flockId = searchParams.get('flockId');
|
||||
|
||||
// Fetch Data
|
||||
const { data: flock, isLoading: isLoadingFlock } = useSWR(flockId, (id: number) => FlockApi.getSingle(id));
|
||||
const { data: flock, isLoading: isLoadingFlock } = useSWR(
|
||||
flockId,
|
||||
(id: number) => FlockApi.getSingle(id)
|
||||
);
|
||||
|
||||
if(!flockId){
|
||||
if (!flockId) {
|
||||
router.back();
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-row justify-center items-center p-4">
|
||||
<span className="loading loading-spinner loading-xl" />
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if(!isLoadingFlock && (!flock || isResponseError(flock))){
|
||||
if (!isLoadingFlock && (!flock || isResponseError(flock))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="w-full p-4 flex flex-row justify-center">
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingFlock && (
|
||||
<span className="loading loading-spinner loading-xl" />
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
)}
|
||||
{!isLoadingFlock && isResponseSuccess(flock) && (
|
||||
<FlockForm formType="detail" initialValues={flock.data} />
|
||||
<FlockForm formType='detail' initialValues={flock.data} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default FlockDetail;
|
||||
export default FlockDetail;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import FlockTable from "@/components/pages/master-data/flock/FlocksTable";
|
||||
import FlockTable from '@/components/pages/master-data/flock/FlocksTable';
|
||||
|
||||
const Flock = () => {
|
||||
return (
|
||||
<section className="w-full p-4">
|
||||
<FlockTable/>
|
||||
<section className='w-full p-4'>
|
||||
<FlockTable />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default Flock;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import ProductCategoryForm from "@/components/pages/master-data/product-category/form/ProductCategoryForm";
|
||||
import ProductCategoryForm from '@/components/pages/master-data/product-category/form/ProductCategoryForm';
|
||||
|
||||
const AddProductCategory = () => {
|
||||
return (
|
||||
<div className="w-full p-4 flex flex-row justify-center">
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
<ProductCategoryForm />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddProductCategory;
|
||||
export default AddProductCategory;
|
||||
|
||||
@@ -9,39 +9,44 @@ import { ProductCategoryApi } from '@/services/api/master-data';
|
||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||
|
||||
const ProductCategoryEdit = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const productCategoryId = searchParams.get('productCategoryId');
|
||||
const productCategoryId = searchParams.get('productCategoryId');
|
||||
|
||||
const { data: productCategory, isLoading: isLoadingProductCategory } = useSWR(
|
||||
productCategoryId,
|
||||
(id: number) => ProductCategoryApi.getSingle(id)
|
||||
);
|
||||
const { data: productCategory, isLoading: isLoadingProductCategory } = useSWR(
|
||||
productCategoryId,
|
||||
(id: number) => ProductCategoryApi.getSingle(id)
|
||||
);
|
||||
|
||||
if (!productCategoryId) {
|
||||
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 (!isLoadingProductCategory && (!productCategory || isResponseError(productCategory))) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
if (!productCategoryId) {
|
||||
router.back();
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingProductCategory && <span className='loading loading-spinner loading-xl' />}
|
||||
{!isLoadingProductCategory && isResponseSuccess(productCategory) && (
|
||||
<ProductCategoryForm type='edit' initialValues={productCategory.data} />
|
||||
)}
|
||||
</div>
|
||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ProductCategoryEdit;
|
||||
if (
|
||||
!isLoadingProductCategory &&
|
||||
(!productCategory || isResponseError(productCategory))
|
||||
) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingProductCategory && (
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
)}
|
||||
{!isLoadingProductCategory && isResponseSuccess(productCategory) && (
|
||||
<ProductCategoryForm type='edit' initialValues={productCategory.data} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProductCategoryEdit;
|
||||
|
||||
@@ -29,16 +29,24 @@ const ProductCategoryDetail = () => {
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLoadingProductCategory && (!productCategory || isResponseError(productCategory))) {
|
||||
if (
|
||||
!isLoadingProductCategory &&
|
||||
(!productCategory || isResponseError(productCategory))
|
||||
) {
|
||||
router.replace('/404');
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
{isLoadingProductCategory && <span className='loading loading-spinner loading-xl' />}
|
||||
{isLoadingProductCategory && (
|
||||
<span className='loading loading-spinner loading-xl' />
|
||||
)}
|
||||
{!isLoadingProductCategory && isResponseSuccess(productCategory) && (
|
||||
<ProductCategoryForm type='detail' initialValues={productCategory.data} />
|
||||
<ProductCategoryForm
|
||||
type='detail'
|
||||
initialValues={productCategory.data}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import ProductCategoryTable from "@/components/pages/master-data/product-category/ProductCategoryTable";
|
||||
import ProductCategoryTable from '@/components/pages/master-data/product-category/ProductCategoryTable';
|
||||
|
||||
const ProductCategory = () => {
|
||||
return (
|
||||
<section className="w-full p-4">
|
||||
<section className='w-full p-4'>
|
||||
<ProductCategoryTable />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProductCategory;
|
||||
export default ProductCategory;
|
||||
|
||||
@@ -2,10 +2,10 @@ import ProductForm from '@/components/pages/master-data/product/form/ProductForm
|
||||
|
||||
const AddProduct = () => {
|
||||
return (
|
||||
<div className="w-full p-4 flex flex-row justify-center">
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
<ProductForm />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddProduct;
|
||||
export default AddProduct;
|
||||
|
||||
@@ -13,9 +13,8 @@ const ProductEdit = () => {
|
||||
|
||||
const productId = searchParams.get('productId');
|
||||
|
||||
const { data: product, isLoading } = useSWR(
|
||||
productId,
|
||||
(id: number) => ProductApi.getSingle(id)
|
||||
const { data: product, isLoading } = useSWR(productId, (id: number) =>
|
||||
ProductApi.getSingle(id)
|
||||
);
|
||||
|
||||
if (!productId) {
|
||||
@@ -42,4 +41,4 @@ const ProductEdit = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ProductEdit;
|
||||
export default ProductEdit;
|
||||
|
||||
@@ -13,9 +13,8 @@ const ProductDetail = () => {
|
||||
|
||||
const productId = searchParams.get('productId');
|
||||
|
||||
const { data: product, isLoading } = useSWR(
|
||||
productId,
|
||||
(id: number) => ProductApi.getSingle(id)
|
||||
const { data: product, isLoading } = useSWR(productId, (id: number) =>
|
||||
ProductApi.getSingle(id)
|
||||
);
|
||||
|
||||
if (!productId) {
|
||||
@@ -42,4 +41,4 @@ const ProductDetail = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ProductDetail;
|
||||
export default ProductDetail;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import ProductsTable from "@/components/pages/master-data/product/ProductTable";
|
||||
import ProductsTable from '@/components/pages/master-data/product/ProductTable';
|
||||
|
||||
const Product = () => {
|
||||
return (
|
||||
<section className="w-full p-4">
|
||||
<ProductsTable />
|
||||
<section className='w-full p-4'>
|
||||
<ProductsTable />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default Product;
|
||||
export default Product;
|
||||
|
||||
@@ -8,4 +8,4 @@ const AddSupplier = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default AddSupplier;
|
||||
export default AddSupplier;
|
||||
|
||||
@@ -46,4 +46,4 @@ const SupplierDetail = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default SupplierDetail;
|
||||
export default SupplierDetail;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SuppliersTable from "@/components/pages/master-data/supplier/SupplierTable";
|
||||
import SuppliersTable from '@/components/pages/master-data/supplier/SupplierTable';
|
||||
|
||||
const Supplier = () => {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user