diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md
index f3a3d05a..fd5ad4b2 100644
--- a/webapp/CHANGELOG.md
+++ b/webapp/CHANGELOG.md
@@ -1,10 +1,9 @@
## [0.73.20](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.19...v0.73.20) (2024-12-05)
-
### Bug Fixes
-* desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer ([d52879d](https://github.com/SocialGouv/carte-jeune-engage/commit/d52879d1f07bcbbd4711457fac499ba02691e44e))
-* remove unused import ([fe1bb94](https://github.com/SocialGouv/carte-jeune-engage/commit/fe1bb94cc13ee929b93fd8270523e6cbd0403518))
+- desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer ([d52879d](https://github.com/SocialGouv/carte-jeune-engage/commit/d52879d1f07bcbbd4711457fac499ba02691e44e))
+- remove unused import ([fe1bb94](https://github.com/SocialGouv/carte-jeune-engage/commit/fe1bb94cc13ee929b93fd8270523e6cbd0403518))
## [0.73.19](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.18...v0.73.19) (2024-12-04)
diff --git a/webapp/src/components/modals/IssueModal.tsx b/webapp/src/components/modals/IssueModal.tsx
index f5c1db07..6f56b638 100644
--- a/webapp/src/components/modals/IssueModal.tsx
+++ b/webapp/src/components/modals/IssueModal.tsx
@@ -200,63 +200,59 @@ const IssueModal = (props: IssueModalProps) => {
];
return (
-
-
- {!showCrispModal && (
-
-
-
-
-
-
- setIsOpenCrisp(true)}
- icon={HiMiniChatBubbleOvalLeftEllipsis}
- text="Discutez avec nous en direct"
- />
- {kind === "order" && (
- <>
-
- ou
+
+
+ {!showCrispModal && (
+
+
+
+
+
+
+ setShowCrispModal(true)}
+ icon={HiMiniChatBubbleOvalLeftEllipsis}
+ text="Discutez avec nous en direct"
+ />
+ {kind === "order" && (
+ <>
+
+ ou
+
+
+
+
+
+ Disponible du lundi au vendredi de
+
+ 09h à 12h30 puis de 14h à 17h30
-
-
-
-
- Disponible du lundi au vendredi de
-
- 09h à 12h30 puis de 14h à 17h30
-
-
- >
- )}
-
-
-
- )}
-
+
+ >
+ )}
+
+
+
+ )}
+
);
};
diff --git a/webapp/src/components/ui/BackButton.tsx b/webapp/src/components/ui/BackButton.tsx
index 76038640..d96716dc 100644
--- a/webapp/src/components/ui/BackButton.tsx
+++ b/webapp/src/components/ui/BackButton.tsx
@@ -1,5 +1,6 @@
import { Icon, IconButton } from "@chakra-ui/react";
import { useRouter } from "next/router";
+import { useEffect, useState } from "react";
import { IconType } from "react-icons/lib";
import { TbChevronLeft } from "react-icons/tb";
@@ -13,6 +14,23 @@ const BackButton = (props: BackButtonProps) => {
const router = useRouter();
const { variant, onClick, icon } = props;
+ const [canGoBack, setCanGoBack] = useState(false);
+
+ useEffect(() => {
+ console.log("window.history.length", window.history);
+ setCanGoBack(window.history.length > 1);
+ }, []);
+
+ const handleBack = () => {
+ if (onClick) {
+ onClick();
+ } else if (canGoBack) {
+ router.back();
+ } else {
+ router.push("/dashboard");
+ }
+ };
+
return (
{
aria-label="Retour"
colorScheme="whiteBtn"
bgColor="white"
- onClick={onClick ? onClick : () => router.back()}
+ onClick={handleBack}
borderRadius="2.25xl"
size="md"
icon={}
diff --git a/webapp/src/pages/dashboard/account/history.tsx b/webapp/src/pages/dashboard/account/history.tsx
index 7290f8f5..a7bb3bee 100644
--- a/webapp/src/pages/dashboard/account/history.tsx
+++ b/webapp/src/pages/dashboard/account/history.tsx
@@ -7,6 +7,7 @@ import {
Heading,
Icon,
IconButton,
+ Link,
Text,
} from "@chakra-ui/react";
import { TinyColor } from "@ctrl/tinycolor";
@@ -19,6 +20,9 @@ import { OrderIncluded } from "~/server/api/routers/order";
import { CouponExtanded } from "~/server/api/routers/saving";
import { UserIncluded } from "~/server/api/routers/user";
import { api } from "~/utils/api";
+import NextLink from "next/link";
+import ConditionalLink from "~/components/ConditionalLink";
+import BackButton from "~/components/ui/BackButton";
const UserSavingsNoData = () => {
return (
@@ -70,19 +74,7 @@ export default function AccountHistory() {
return (
- {
- router.back();
- }}
- borderRadius="2.25xl"
- size="md"
- icon={}
- />
+
Historique de mes réductions
@@ -94,7 +86,9 @@ export default function AccountHistory() {
("usedAt" in userHistoryItem
? userHistoryItem.usedAt
? userHistoryItem.usedAt
- : userHistoryItem.assignUserAt
+ : "assignUserAt" in userHistoryItem
+ ? userHistoryItem.assignUserAt
+ : userHistoryItem.createdAt
: userHistoryItem.createdAt) as string
);
const previousCoupon = history[index - 1];
@@ -103,7 +97,9 @@ export default function AccountHistory() {
("usedAt" in previousCoupon
? previousCoupon.usedAt
? previousCoupon.usedAt
- : previousCoupon.assignUserAt
+ : "assignUserAt" in userHistoryItem
+ ? userHistoryItem.assignUserAt
+ : userHistoryItem.createdAt
: previousCoupon.createdAt) as string
)
: new Date();
@@ -151,64 +147,81 @@ export default function AccountHistory() {
justifyContent="space-between"
mt={4}
>
-
-
-
-
-
-
- {userHistoryItem.offer.partner.name}
-
-
- {userHistoryItem.offer.title}
-
-
- {"used" in userHistoryItem && !userHistoryItem.used ? (
-
-
-
- Fin{" "}
- {currentCouponUsedAt.toLocaleDateString("fr-FR", {
- day: "2-digit",
- month: "2-digit",
- })}
-
-
- ) : (
-
-
- Déjà utilisée
-
- )}
+
+
+
+
+
+
+ {userHistoryItem.offer.partner.name}
+
+
+ {userHistoryItem.offer.title}
+
+
+ {"used" in userHistoryItem &&
+ !userHistoryItem.used ? (
+
+
+
+ Fin{" "}
+ {currentCouponUsedAt.toLocaleDateString(
+ "fr-FR",
+ {
+ day: "2-digit",
+ month: "2-digit",
+ }
+ )}
+
+
+ ) : (
+
+
+ Déjà utilisée
+
+ )}
+
+
-
+
>
diff --git a/webapp/src/pages/dashboard/order/[id]/index.tsx b/webapp/src/pages/dashboard/order/[id]/index.tsx
index 9219820a..2074ac36 100644
--- a/webapp/src/pages/dashboard/order/[id]/index.tsx
+++ b/webapp/src/pages/dashboard/order/[id]/index.tsx
@@ -45,8 +45,9 @@ export default function OrderObizPage() {
const utils = api.useUtils();
const { user, setShowCrispModal } = useAuth();
- const { id } = router.query as {
+ const { id, from } = router.query as {
id: string;
+ from?: string;
};
const [showDetails, setShowDetails] = useState(false);
@@ -320,7 +321,15 @@ export default function OrderObizPage() {
>
- router.push("/dashboard/wallet")} />
+
+ router.push(
+ from === "history"
+ ? "/dashboard/account/history"
+ : "/dashboard/wallet"
+ )
+ }
+ />
{order.status === "delivered" && order.used && (
{
+await payload.db.drizzle.execute(sql`
+
+DO $$ BEGIN
+ CREATE TYPE "enum_forms_blocks_select_options_icon" AS ENUM('HiCursorArrowRays', 'HiBuildingStorefront');
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+
+CREATE TABLE IF NOT EXISTS "forms_blocks_select_options" (
+ "_order" integer NOT NULL,
+ "_parent_id" varchar NOT NULL,
+ "id" varchar PRIMARY KEY NOT NULL,
+ "label" varchar,
+ "value" varchar,
+ "icon" "enum_forms_blocks_select_options_icon"
+);
+
+CREATE TABLE IF NOT EXISTS "forms_blocks_select" (
+ "_order" integer NOT NULL,
+ "_parent_id" integer NOT NULL,
+ "_path" text NOT NULL,
+ "id" varchar PRIMARY KEY NOT NULL,
+ "name" varchar NOT NULL,
+ "label" varchar,
+ "required" boolean,
+ "block_name" varchar
+);
+
+CREATE INDEX IF NOT EXISTS "forms_blocks_select_options_order_idx" ON "forms_blocks_select_options" ("_order");
+CREATE INDEX IF NOT EXISTS "forms_blocks_select_options_parent_id_idx" ON "forms_blocks_select_options" ("_parent_id");
+CREATE INDEX IF NOT EXISTS "forms_blocks_select_order_idx" ON "forms_blocks_select" ("_order");
+CREATE INDEX IF NOT EXISTS "forms_blocks_select_parent_id_idx" ON "forms_blocks_select" ("_parent_id");
+CREATE INDEX IF NOT EXISTS "forms_blocks_select_path_idx" ON "forms_blocks_select" ("_path");
+DO $$ BEGIN
+ ALTER TABLE "forms_blocks_select_options" ADD CONSTRAINT "forms_blocks_select_options__parent_id_forms_blocks_select_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "forms_blocks_select"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+
+DO $$ BEGIN
+ ALTER TABLE "forms_blocks_select" ADD CONSTRAINT "forms_blocks_select__parent_id_forms_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "forms"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+`);
+
+};
+
+export async function down({ payload }: MigrateDownArgs): Promise {
+await payload.db.drizzle.execute(sql`
+
+DROP TABLE "forms_blocks_select_options";
+DROP TABLE "forms_blocks_select";`);
+
+};