nyavokevin 9cbc1bcbdb feat(ui): add price lists and group-based quote flows
Add price list management across the API, store, services, routes,
navigation, and sales views.

Support quotes for either a client or a client group, including PDF
download and nullable client validation for group-based recipients.

Extend client groups to manage assigned clients directly from the form
and detail views, and refresh supplier, intervention, stock, and order
screens with updated interactions and layouts.
2026-04-02 12:07:11 +03:00

79 lines
1.7 KiB
TypeScript

import { request } from "./http";
export interface PriceList {
id: number;
name: string;
valid_from: string | null;
valid_to: string | null;
is_default: boolean;
}
export interface PriceListListResponse {
data: PriceList[];
}
export interface PriceListResponse {
data: PriceList;
}
export interface CreatePriceListPayload {
name: string;
valid_from?: string | null;
valid_to?: string | null;
is_default?: boolean;
}
export interface UpdatePriceListPayload
extends Partial<CreatePriceListPayload> {
id: number;
}
export const PriceListService = {
async getAllPriceLists(): Promise<PriceListListResponse> {
return await request<PriceListListResponse>({
url: "/api/price-lists",
method: "get",
});
},
async getPriceList(id: number): Promise<PriceListResponse> {
return await request<PriceListResponse>({
url: `/api/price-lists/${id}`,
method: "get",
});
},
async createPriceList(
payload: CreatePriceListPayload
): Promise<PriceListResponse> {
return await request<PriceListResponse>({
url: "/api/price-lists",
method: "post",
data: payload,
});
},
async updatePriceList(
payload: UpdatePriceListPayload
): Promise<PriceListResponse> {
const { id, ...updateData } = payload;
return await request<PriceListResponse>({
url: `/api/price-lists/${id}`,
method: "put",
data: updateData,
});
},
async deletePriceList(
id: number
): Promise<{ success?: boolean; message: string }> {
return await request<{ success?: boolean; message: string }>({
url: `/api/price-lists/${id}`,
method: "delete",
});
},
};
export default PriceListService;