add contract pdf generation
This commit is contained in:
4
frontend/src/services/resources/contracts.ts
Normal file
4
frontend/src/services/resources/contracts.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export type ContractCreate = {
|
||||
form_id: number;
|
||||
contract: Record<string, string | number | null>;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Productor } from "@/services/resources/productors";
|
||||
import type { Shipment, ShipmentInputs } from "@/services/resources/shipments";
|
||||
import type { Shipment } from "@/services/resources/shipments";
|
||||
import type { User } from "@/services/resources/users";
|
||||
|
||||
export type Form = {
|
||||
@@ -11,6 +11,7 @@ export type Form = {
|
||||
productor: Productor;
|
||||
referer: User;
|
||||
shipments: Shipment[];
|
||||
minimum_shipment_value: number | null;
|
||||
}
|
||||
|
||||
export type FormCreate = {
|
||||
@@ -20,6 +21,7 @@ export type FormCreate = {
|
||||
end: string;
|
||||
productor_id: number;
|
||||
referer_id: number;
|
||||
minimum_shipment_value: number | null;
|
||||
}
|
||||
|
||||
export type FormEdit = {
|
||||
@@ -29,6 +31,7 @@ export type FormEdit = {
|
||||
end?: string | null;
|
||||
productor_id?: number | null;
|
||||
referer_id?: number | null;
|
||||
minimum_shipment_value: number | null;
|
||||
}
|
||||
|
||||
export type FormEditPayload = {
|
||||
@@ -43,4 +46,5 @@ export type FormInputs = {
|
||||
end: string | null;
|
||||
productor_id: string;
|
||||
referer_id: string;
|
||||
minimum_shipment_value: number | string | null;
|
||||
}
|
||||
@@ -1,10 +1,21 @@
|
||||
import { t } from "@/config/i18n";
|
||||
import type { Product } from "./products";
|
||||
|
||||
export const PaymentMethods = [
|
||||
{value: "cheque", label: t("cheque", {capfirst: true})},
|
||||
{value: "transfer", label: t("transfer", {capfirst: true})},
|
||||
]
|
||||
|
||||
export type PaymentMethod = {
|
||||
name: string;
|
||||
details: string;
|
||||
}
|
||||
|
||||
export type Productor = {
|
||||
id: number;
|
||||
name: string;
|
||||
address: string;
|
||||
payment: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string;
|
||||
products: Product[]
|
||||
}
|
||||
@@ -12,22 +23,22 @@ export type Productor = {
|
||||
export type ProductorCreate = {
|
||||
name: string;
|
||||
address: string;
|
||||
payment: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string;
|
||||
}
|
||||
|
||||
export type ProductorEdit = {
|
||||
name: string | null;
|
||||
address: string | null;
|
||||
payment: string | null;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
export type ProductorInputs = {
|
||||
name: string;
|
||||
address: string;
|
||||
payment: string;
|
||||
type: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
}
|
||||
|
||||
export type ProductorEditPayload = {
|
||||
|
||||
@@ -61,9 +61,9 @@ export type ProductInputs = {
|
||||
productor_id: string | null;
|
||||
name: string;
|
||||
unit: string | null;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
price: number | string | null;
|
||||
price_kg: number | string | null;
|
||||
quantity: number | string | null;
|
||||
quantity_unit: string | null;
|
||||
type: string | null;
|
||||
}
|
||||
@@ -91,9 +91,9 @@ export function productCreateFromProductInputs(productInput: ProductInputs): Pro
|
||||
productor_id: Number(productInput.productor_id)!,
|
||||
name: productInput.name,
|
||||
unit: productInput.unit!,
|
||||
price: productInput.price!,
|
||||
price_kg: productInput.price_kg,
|
||||
quantity: productInput.quantity,
|
||||
price: productInput.price === "" || !productInput.price ? null : Number(productInput.price),
|
||||
price_kg: productInput.price_kg === "" || !productInput.price_kg ? null : Number(productInput.price_kg),
|
||||
quantity: productInput.quantity === "" || !productInput.quantity ? null : Number(productInput.quantity),
|
||||
quantity_unit: productInput.quantity_unit,
|
||||
type: productInput.type!,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user