Skip to content

Commit

Permalink
fix carcasse intermediaire maj
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudambro committed Oct 23, 2024
1 parent e4c8e34 commit 8b11c56
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/app/db/carcasse-intermediaire.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export function mergeCarcasseIntermediaireToJSON(
: oldItem.prise_en_charge || null,
);

console.log(
"manquante",
newItem?.get("manquante") === "true"
? true
: newItem?.get("manquante") === "false"
? false
: oldItem.manquante || null,
);
// Explicitly handle each field, including optional ones
const result: SerializeFrom<CarcasseIntermediaire> = {
fei_numero__bracelet__intermediaire_id: mergedItem.fei_numero__bracelet__intermediaire_id,
Expand Down
1 change: 0 additions & 1 deletion app/app/db/fei.client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// import * as zodSchemas from "prisma/generated/zod";
import dayjs from "dayjs";
import { SerializeFrom } from "@remix-run/node";
import { redirect } from "@remix-run/react";
import { type Fei, type Carcasse, type CarcasseIntermediaire } from "@prisma/client";
import { type FeiLoaderData } from "@api/routes/api.fei.$fei_numero";
import { type FeiUserLoaderData } from "@api/routes/api.fei-user.$fei_numero.$user_id";
Expand Down
1 change: 0 additions & 1 deletion app/app/main-sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ AND HANDLE POST REQUESTS TO QUEUE WHEN OFFLINE

self.addEventListener("fetch", (event: FetchEvent) => {
if (event.request.method === "POST") {
console.log("AIAIAIAIE POST REQUEST", event.request.url);
event.respondWith(handlePostRequest(event.request));
} else {
event.respondWith(handleFetchRequest(event.request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export default function CarcasseIntermediaire({ carcasse, canEdit, intermediaire
const submitCarcasseAccept = () => {
setCarcasseManquante(false);
setCarcasseRefusCheckbox(false);
setRefus("");
const form = new FormData(formRef.current!);
form.append(Prisma.CarcasseIntermediaireScalarFieldEnum.refus, "");
form.append(Prisma.CarcasseIntermediaireScalarFieldEnum.prise_en_charge, "true");
Expand Down Expand Up @@ -414,6 +415,7 @@ export default function CarcasseIntermediaire({ carcasse, canEdit, intermediaire
type: "submit",
nativeButtonProps: {
form: `intermediaire-carcasse-${carcasse.numero_bracelet}`,
disabled: carcasseRefusCheckbox && !refus,
onClick: (e) => {
console.log("submit refus");
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default function FEICurrentIntermediaire() {
if (intermediaireCheckById[checkId].prise_en_charge) {
carcassesApproved[checkId] = carcasse;
} else if (intermediaireCheckById[checkId].manquante) {
console.log("MANQUANTE ICI", intermediaireCheckById[checkId]);
carcassesManquantes[checkId] = carcasse;
} else {
carcassesRejetees[checkId] = carcasse;
Expand Down Expand Up @@ -119,6 +120,8 @@ export default function FEICurrentIntermediaire() {
intermediaire.check_finished_at,
]);

console.log({ carcassesSorted });

const needSelectNextUser = useMemo(() => {
if (fei.fei_current_owner_user_id !== user.id) {
return false;
Expand Down

0 comments on commit 8b11c56

Please sign in to comment.