2025-08-04 17:45:44 +02:00
|
|
|
import { clientsApi, companyId } from "~/server/FattureInCloud";
|
|
|
|
|
|
2026-03-05 12:32:03 +01:00
|
|
|
// export const getClientList = async () => {
|
|
|
|
|
// const clients = await clientsApi.listClients(
|
|
|
|
|
// companyId,
|
|
|
|
|
// undefined,
|
|
|
|
|
// "detailed",
|
|
|
|
|
// undefined,
|
|
|
|
|
// undefined,
|
|
|
|
|
// 100,
|
|
|
|
|
// );
|
|
|
|
|
// return clients.data;
|
|
|
|
|
// };
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2026-03-05 12:32:03 +01:00
|
|
|
// export const searchClient = async (cognome: string) => {
|
|
|
|
|
// const clients = await clientsApi.listClients(
|
|
|
|
|
// companyId,
|
|
|
|
|
// undefined,
|
|
|
|
|
// "detailed",
|
|
|
|
|
// undefined,
|
|
|
|
|
// undefined,
|
|
|
|
|
// 100,
|
|
|
|
|
// `name contains '${cognome}'`,
|
|
|
|
|
// );
|
|
|
|
|
// return clients.data;
|
|
|
|
|
// };
|
2025-08-04 17:45:44 +02:00
|
|
|
export const getClientFromCF = async (cf: string) => {
|
2025-08-28 18:27:07 +02:00
|
|
|
if (cf.length < 11) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
const clients = await clientsApi.listClients(
|
|
|
|
|
companyId,
|
|
|
|
|
undefined,
|
|
|
|
|
"detailed",
|
|
|
|
|
undefined,
|
|
|
|
|
undefined,
|
|
|
|
|
100,
|
|
|
|
|
`tax_code = '${cf}'`,
|
|
|
|
|
);
|
|
|
|
|
return clients.data;
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|
|
|
|
|
|
2026-03-05 12:32:03 +01:00
|
|
|
// export const addClient = async (client: Client) => {
|
|
|
|
|
// const newClient = await clientsApi.createClient(companyId, { data: client });
|
|
|
|
|
// return newClient.data;
|
|
|
|
|
// };
|