add contract page with dynamic form elements
This commit is contained in:
@@ -25,7 +25,7 @@ export default function Products() {
|
||||
}, [location, isEdit])
|
||||
|
||||
const closeModal = () => {
|
||||
navigate("/dashboard/products");
|
||||
navigate(`/dashboard/products${searchParams ? `?${searchParams.toString()}` : ""}`);
|
||||
};
|
||||
|
||||
const { data: products, isPending } = getProducts(searchParams);
|
||||
@@ -38,7 +38,7 @@ export default function Products() {
|
||||
}, [allProducts])
|
||||
|
||||
const productors = useMemo(() => {
|
||||
return allProducts?.map((form: Product) => (form.productor.name))
|
||||
return allProducts?.map((product: Product) => (product.productor.name))
|
||||
.filter((productor, index, array) => array.indexOf(productor) === index)
|
||||
}, [allProducts])
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function Products() {
|
||||
return;
|
||||
await editProductMutation.mutateAsync({
|
||||
id: id,
|
||||
product: product
|
||||
product: productCreateFromProductInputs(product)
|
||||
});
|
||||
closeModal();
|
||||
}, []);
|
||||
@@ -83,7 +83,7 @@ export default function Products() {
|
||||
<ActionIcon
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/dashboard/products/create`);
|
||||
navigate(`/dashboard/products/create${searchParams ? `?${searchParams.toString()}` : ""}`);
|
||||
}}
|
||||
>
|
||||
<IconPlus/>
|
||||
@@ -115,7 +115,8 @@ export default function Products() {
|
||||
<Table.Th>{t("type", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("price", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("priceKg", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("weight", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("quantity", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("quantity unit", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("unit", {capfirst: true})}</Table.Th>
|
||||
<Table.Th>{t("actions", {capfirst: true})}</Table.Th>
|
||||
</Table.Tr>
|
||||
|
||||
Reference in New Issue
Block a user