feat: a few tabs for module, deal services tab for mobiles

This commit is contained in:
2025-09-21 09:47:55 +04:00
parent 6e445d5ebf
commit 6d6c430e88
62 changed files with 521 additions and 128 deletions

View File

@ -0,0 +1,49 @@
import { useCrudOperations } from "@/hooks/cruds/baseCrud";
import {
CreateServiceSchema,
ServiceSchema,
UpdateServiceSchema,
} from "@/lib/client";
import {
createServiceMutation,
deleteServiceMutation,
updateServiceMutation,
} from "@/lib/client/@tanstack/react-query.gen";
type UseServicesProps = {
queryKey: any[];
};
export type ServicesCrud = {
onCreate: (service: CreateServiceSchema) => void;
onUpdate: (
serviceId: number,
service: UpdateServiceSchema,
onSuccess?: () => void
) => void;
onDelete: (service: ServiceSchema) => void;
};
export const useServicesCrud = ({
queryKey,
}: UseServicesProps): ServicesCrud => {
return useCrudOperations<
ServiceSchema,
UpdateServiceSchema,
CreateServiceSchema
>({
key: "getServices",
queryKey,
mutations: {
create: createServiceMutation(),
update: updateServiceMutation(),
delete: deleteServiceMutation(),
},
getUpdateEntity: (old, update) =>
({
...old,
...update,
}) as ServiceSchema,
getDeleteConfirmTitle: () => "Удаление услуги",
});
};