add prettier code formater
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export type ContractCreate = {
|
||||
form_id: number;
|
||||
contract: Record<string, string | number | null>;
|
||||
}
|
||||
export type ContractCreate = {
|
||||
form_id: number;
|
||||
contract: Record<string, string | number | null>;
|
||||
};
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
import type { Productor } from "@/services/resources/productors";
|
||||
import type { Shipment } from "@/services/resources/shipments";
|
||||
import type { User } from "@/services/resources/users";
|
||||
|
||||
export type Form = {
|
||||
id: number;
|
||||
name: string;
|
||||
season: string;
|
||||
start: string;
|
||||
end: string;
|
||||
productor: Productor;
|
||||
referer: User;
|
||||
shipments: Shipment[];
|
||||
minimum_shipment_value: number | null;
|
||||
}
|
||||
|
||||
export type FormCreate = {
|
||||
name: string;
|
||||
season: string;
|
||||
start: string;
|
||||
end: string;
|
||||
productor_id: number;
|
||||
referer_id: number;
|
||||
minimum_shipment_value: number | null;
|
||||
}
|
||||
|
||||
export type FormEdit = {
|
||||
name?: string | null;
|
||||
season?: string | null;
|
||||
start?: string | null;
|
||||
end?: string | null;
|
||||
productor_id?: number | null;
|
||||
referer_id?: number | null;
|
||||
minimum_shipment_value: number | null;
|
||||
}
|
||||
|
||||
export type FormEditPayload = {
|
||||
id: number;
|
||||
form: FormEdit;
|
||||
}
|
||||
|
||||
export type FormInputs = {
|
||||
name: string;
|
||||
season: string;
|
||||
start: string | null;
|
||||
end: string | null;
|
||||
productor_id: string;
|
||||
referer_id: string;
|
||||
minimum_shipment_value: number | string | null;
|
||||
}
|
||||
import type { Productor } from "@/services/resources/productors";
|
||||
import type { Shipment } from "@/services/resources/shipments";
|
||||
import type { User } from "@/services/resources/users";
|
||||
|
||||
export type Form = {
|
||||
id: number;
|
||||
name: string;
|
||||
season: string;
|
||||
start: string;
|
||||
end: string;
|
||||
productor: Productor;
|
||||
referer: User;
|
||||
shipments: Shipment[];
|
||||
minimum_shipment_value: number | null;
|
||||
};
|
||||
|
||||
export type FormCreate = {
|
||||
name: string;
|
||||
season: string;
|
||||
start: string;
|
||||
end: string;
|
||||
productor_id: number;
|
||||
referer_id: number;
|
||||
minimum_shipment_value: number | null;
|
||||
};
|
||||
|
||||
export type FormEdit = {
|
||||
name?: string | null;
|
||||
season?: string | null;
|
||||
start?: string | null;
|
||||
end?: string | null;
|
||||
productor_id?: number | null;
|
||||
referer_id?: number | null;
|
||||
minimum_shipment_value: number | null;
|
||||
};
|
||||
|
||||
export type FormEditPayload = {
|
||||
id: number;
|
||||
form: FormEdit;
|
||||
};
|
||||
|
||||
export type FormInputs = {
|
||||
name: string;
|
||||
season: string;
|
||||
start: string | null;
|
||||
end: string | null;
|
||||
productor_id: string;
|
||||
referer_id: string;
|
||||
minimum_shipment_value: number | string | null;
|
||||
};
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
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_methods: PaymentMethod[];
|
||||
type: string;
|
||||
products: Product[]
|
||||
}
|
||||
|
||||
export type ProductorCreate = {
|
||||
name: string;
|
||||
address: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string;
|
||||
}
|
||||
|
||||
export type ProductorEdit = {
|
||||
name: string | null;
|
||||
address: string | null;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
export type ProductorInputs = {
|
||||
name: string;
|
||||
address: string;
|
||||
type: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
}
|
||||
|
||||
export type ProductorEditPayload = {
|
||||
productor: ProductorEdit;
|
||||
id: number;
|
||||
}
|
||||
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_methods: PaymentMethod[];
|
||||
type: string;
|
||||
products: Product[];
|
||||
};
|
||||
|
||||
export type ProductorCreate = {
|
||||
name: string;
|
||||
address: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string;
|
||||
};
|
||||
|
||||
export type ProductorEdit = {
|
||||
name: string | null;
|
||||
address: string | null;
|
||||
payment_methods: PaymentMethod[];
|
||||
type: string | null;
|
||||
};
|
||||
|
||||
export type ProductorInputs = {
|
||||
name: string;
|
||||
address: string;
|
||||
type: string;
|
||||
payment_methods: PaymentMethod[];
|
||||
};
|
||||
|
||||
export type ProductorEditPayload = {
|
||||
productor: ProductorEdit;
|
||||
id: number;
|
||||
};
|
||||
|
||||
@@ -1,100 +1,106 @@
|
||||
import type { Productor } from "@/services/resources/productors";
|
||||
import type { Shipment } from "@/services/resources/shipments";
|
||||
|
||||
type ProductTypeKey = "1" | "2";
|
||||
type ProductUnitKey = "1" | "2" | "3";
|
||||
|
||||
export const ProductType = {
|
||||
"1": "planned",
|
||||
"2": "recurrent",
|
||||
};
|
||||
|
||||
export const ProductUnit = {
|
||||
"1": "grams",
|
||||
"2": "kilo",
|
||||
"3": "piece",
|
||||
};
|
||||
|
||||
export const ProductQuantityUnit = {
|
||||
"ml": "mililiter",
|
||||
"L": "liter",
|
||||
"g": "grams",
|
||||
"kg": "kilo"
|
||||
}
|
||||
|
||||
export type Product = {
|
||||
id: number;
|
||||
productor: Productor;
|
||||
name: string;
|
||||
unit: ProductUnitKey;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
quantity_unit: string | null;
|
||||
type: ProductTypeKey;
|
||||
shipments: Shipment[];
|
||||
}
|
||||
|
||||
export type ProductCreate = {
|
||||
productor_id: number;
|
||||
name: string;
|
||||
unit: string;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
quantity_unit: string | null;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export type ProductEdit = {
|
||||
productor_id: number | null;
|
||||
name: string | null;
|
||||
unit: string | null;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
quantity_unit: string | null;
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
export type ProductInputs = {
|
||||
productor_id: string | null;
|
||||
name: string;
|
||||
unit: string | null;
|
||||
price: number | string | null;
|
||||
price_kg: number | string | null;
|
||||
quantity: number | string | null;
|
||||
quantity_unit: string | null;
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
export type ProductEditPayload = {
|
||||
product: ProductEdit;
|
||||
id: number;
|
||||
}
|
||||
|
||||
export function productToProductInputs(product: Product): ProductInputs {
|
||||
return {
|
||||
productor_id: String(product.productor.id),
|
||||
name: product.name,
|
||||
unit: product.unit,
|
||||
price: product.price,
|
||||
price_kg: product.price_kg,
|
||||
quantity: product.quantity,
|
||||
quantity_unit: product.quantity_unit,
|
||||
type: product.type,
|
||||
};
|
||||
}
|
||||
|
||||
export function productCreateFromProductInputs(productInput: ProductInputs): ProductCreate {
|
||||
return {
|
||||
productor_id: Number(productInput.productor_id)!,
|
||||
name: productInput.name,
|
||||
unit: productInput.unit!,
|
||||
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!,
|
||||
}
|
||||
}
|
||||
import type { Productor } from "@/services/resources/productors";
|
||||
import type { Shipment } from "@/services/resources/shipments";
|
||||
|
||||
type ProductTypeKey = "1" | "2";
|
||||
type ProductUnitKey = "1" | "2" | "3";
|
||||
|
||||
export const ProductType = {
|
||||
"1": "planned",
|
||||
"2": "recurrent",
|
||||
};
|
||||
|
||||
export const ProductUnit = {
|
||||
"1": "grams",
|
||||
"2": "kilo",
|
||||
"3": "piece",
|
||||
};
|
||||
|
||||
export const ProductQuantityUnit = {
|
||||
ml: "mililiter",
|
||||
L: "liter",
|
||||
g: "grams",
|
||||
kg: "kilo",
|
||||
};
|
||||
|
||||
export type Product = {
|
||||
id: number;
|
||||
productor: Productor;
|
||||
name: string;
|
||||
unit: ProductUnitKey;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
quantity_unit: string | null;
|
||||
type: ProductTypeKey;
|
||||
shipments: Shipment[];
|
||||
};
|
||||
|
||||
export type ProductCreate = {
|
||||
productor_id: number;
|
||||
name: string;
|
||||
unit: string;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
quantity_unit: string | null;
|
||||
type: string;
|
||||
};
|
||||
|
||||
export type ProductEdit = {
|
||||
productor_id: number | null;
|
||||
name: string | null;
|
||||
unit: string | null;
|
||||
price: number | null;
|
||||
price_kg: number | null;
|
||||
quantity: number | null;
|
||||
quantity_unit: string | null;
|
||||
type: string | null;
|
||||
};
|
||||
|
||||
export type ProductInputs = {
|
||||
productor_id: string | null;
|
||||
name: string;
|
||||
unit: string | null;
|
||||
price: number | string | null;
|
||||
price_kg: number | string | null;
|
||||
quantity: number | string | null;
|
||||
quantity_unit: string | null;
|
||||
type: string | null;
|
||||
};
|
||||
|
||||
export type ProductEditPayload = {
|
||||
product: ProductEdit;
|
||||
id: number;
|
||||
};
|
||||
|
||||
export function productToProductInputs(product: Product): ProductInputs {
|
||||
return {
|
||||
productor_id: String(product.productor.id),
|
||||
name: product.name,
|
||||
unit: product.unit,
|
||||
price: product.price,
|
||||
price_kg: product.price_kg,
|
||||
quantity: product.quantity,
|
||||
quantity_unit: product.quantity_unit,
|
||||
type: product.type,
|
||||
};
|
||||
}
|
||||
|
||||
export function productCreateFromProductInputs(productInput: ProductInputs): ProductCreate {
|
||||
return {
|
||||
productor_id: Number(productInput.productor_id)!,
|
||||
name: productInput.name,
|
||||
unit: productInput.unit!,
|
||||
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!,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
import type { Form } from "./forms";
|
||||
import type { Product } from "./products";
|
||||
|
||||
export type Shipment = {
|
||||
name: string;
|
||||
date: string;
|
||||
id: number;
|
||||
form: Form;
|
||||
form_id: number;
|
||||
products: Product[];
|
||||
}
|
||||
|
||||
export type ShipmentCreate = {
|
||||
name: string;
|
||||
date: string;
|
||||
form_id: number;
|
||||
product_ids: number[];
|
||||
}
|
||||
|
||||
export type ShipmentEdit = {
|
||||
name: string | null;
|
||||
date: string | null;
|
||||
form_id: number | null;
|
||||
product_ids: number[];
|
||||
}
|
||||
|
||||
export type ShipmentEditPayload = {
|
||||
id: number;
|
||||
shipment: ShipmentEdit;
|
||||
}
|
||||
|
||||
export type ShipmentInputs = {
|
||||
name: string | null;
|
||||
date: string | null;
|
||||
form_id: string | null;
|
||||
product_ids: string[];
|
||||
}
|
||||
|
||||
export function shipmentToShipmentInputs(shipment: Shipment): ShipmentInputs {
|
||||
return {
|
||||
...shipment,
|
||||
form_id: String(shipment.form_id),
|
||||
product_ids: shipment.products.map((el) => (String(el.id)))
|
||||
};
|
||||
}
|
||||
|
||||
export function shipmentCreateFromShipmentInputs(shipmentInput: ShipmentInputs): ShipmentCreate {
|
||||
return {
|
||||
name: shipmentInput.name!,
|
||||
date: shipmentInput.date!,
|
||||
form_id: Number(shipmentInput.form_id),
|
||||
product_ids: shipmentInput.product_ids.map(el => (Number(el))),
|
||||
}
|
||||
}
|
||||
import type { Form } from "./forms";
|
||||
import type { Product } from "./products";
|
||||
|
||||
export type Shipment = {
|
||||
name: string;
|
||||
date: string;
|
||||
id: number;
|
||||
form: Form;
|
||||
form_id: number;
|
||||
products: Product[];
|
||||
};
|
||||
|
||||
export type ShipmentCreate = {
|
||||
name: string;
|
||||
date: string;
|
||||
form_id: number;
|
||||
product_ids: number[];
|
||||
};
|
||||
|
||||
export type ShipmentEdit = {
|
||||
name: string | null;
|
||||
date: string | null;
|
||||
form_id: number | null;
|
||||
product_ids: number[];
|
||||
};
|
||||
|
||||
export type ShipmentEditPayload = {
|
||||
id: number;
|
||||
shipment: ShipmentEdit;
|
||||
};
|
||||
|
||||
export type ShipmentInputs = {
|
||||
name: string | null;
|
||||
date: string | null;
|
||||
form_id: string | null;
|
||||
product_ids: string[];
|
||||
};
|
||||
|
||||
export function shipmentToShipmentInputs(shipment: Shipment): ShipmentInputs {
|
||||
return {
|
||||
...shipment,
|
||||
form_id: String(shipment.form_id),
|
||||
product_ids: shipment.products.map((el) => String(el.id)),
|
||||
};
|
||||
}
|
||||
|
||||
export function shipmentCreateFromShipmentInputs(shipmentInput: ShipmentInputs): ShipmentCreate {
|
||||
return {
|
||||
name: shipmentInput.name!,
|
||||
date: shipmentInput.date!,
|
||||
form_id: Number(shipmentInput.form_id),
|
||||
product_ids: shipmentInput.product_ids.map((el) => Number(el)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import type { Product } from "@/services/resources/products";
|
||||
|
||||
export type User = {
|
||||
id: number;
|
||||
name: string;
|
||||
email: string;
|
||||
products: Product[];
|
||||
}
|
||||
|
||||
export type UserInputs = {
|
||||
email: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type UserCreate ={
|
||||
email: string | null;
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export type UserEdit ={
|
||||
email: string | null;
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export type UserEditPayload = {
|
||||
user: UserEdit;
|
||||
id: number;
|
||||
}
|
||||
import type { Product } from "@/services/resources/products";
|
||||
|
||||
export type User = {
|
||||
id: number;
|
||||
name: string;
|
||||
email: string;
|
||||
products: Product[];
|
||||
};
|
||||
|
||||
export type UserInputs = {
|
||||
email: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type UserCreate = {
|
||||
email: string | null;
|
||||
name: string | null;
|
||||
};
|
||||
|
||||
export type UserEdit = {
|
||||
email: string | null;
|
||||
name: string | null;
|
||||
};
|
||||
|
||||
export type UserEditPayload = {
|
||||
user: UserEdit;
|
||||
id: number;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user