Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c2afb3d3b5 | |||
| 48fc033ffa |
@@ -16,10 +16,10 @@ export default function FeedPage() {
|
|||||||
{/* Page title */}
|
{/* Page title */}
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h1 className="text-foreground text-2xl font-bold md:text-3xl">
|
<h1 className="text-foreground text-2xl font-bold md:text-3xl">
|
||||||
Khám phá quán nước
|
Explore Shops
|
||||||
</h1>
|
</h1>
|
||||||
<p className="mt-1 text-sm text-(--color-text-muted)">
|
<p className="mt-1 text-sm text-(--color-text-muted)">
|
||||||
Tìm và chọn quán yêu thích của bạn
|
Find and choose your favorite shop
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ export default function FeedPage() {
|
|||||||
}}
|
}}
|
||||||
className="cursor-pointer border-none bg-transparent text-sm text-(--color-primary) hover:underline"
|
className="cursor-pointer border-none bg-transparent text-sm text-(--color-primary) hover:underline"
|
||||||
>
|
>
|
||||||
Xóa bộ lọc
|
Clear filters
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -46,7 +46,7 @@ export default function FeedPage() {
|
|||||||
<div className="flex flex-col items-stretch gap-3 sm:flex-row sm:items-center">
|
<div className="flex flex-col items-stretch gap-3 sm:flex-row sm:items-center">
|
||||||
<div className="flex shrink-0 items-center gap-2 text-sm font-semibold text-(--color-text-secondary)">
|
<div className="flex shrink-0 items-center gap-2 text-sm font-semibold text-(--color-text-secondary)">
|
||||||
<i className="fa-solid fa-filter text-(--color-primary)"></i>
|
<i className="fa-solid fa-filter text-(--color-primary)"></i>
|
||||||
<span>Lọc quán</span>
|
<span>Filter shops</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Name search */}
|
{/* Name search */}
|
||||||
@@ -54,7 +54,7 @@ export default function FeedPage() {
|
|||||||
value={searchName}
|
value={searchName}
|
||||||
onChange={setSearchName}
|
onChange={setSearchName}
|
||||||
onClear={() => setSearchName("")}
|
onClear={() => setSearchName("")}
|
||||||
placeholder="Tìm theo tên quán..."
|
placeholder="Search by shop name..."
|
||||||
className="min-w-0 flex-1"
|
className="min-w-0 flex-1"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -65,13 +65,13 @@ export default function FeedPage() {
|
|||||||
type="text"
|
type="text"
|
||||||
value={searchAddress}
|
value={searchAddress}
|
||||||
onChange={(e) => setSearchAddress(e.target.value)}
|
onChange={(e) => setSearchAddress(e.target.value)}
|
||||||
placeholder="Tìm theo địa chỉ..."
|
placeholder="Search by address..."
|
||||||
className="bg-background text-foreground focus:ring-opacity-20 w-full rounded-xl border border-(--color-border) py-2.5 pr-9 pl-9 text-sm transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)"
|
className="bg-background text-foreground focus:ring-opacity-20 w-full rounded-xl border border-(--color-border) py-2.5 pr-9 pl-9 text-sm transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)"
|
||||||
/>
|
/>
|
||||||
{searchAddress && (
|
{searchAddress && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setSearchAddress("")}
|
onClick={() => setSearchAddress("")}
|
||||||
aria-label="Xóa tìm kiếm địa chỉ"
|
aria-label="Clear address search"
|
||||||
className="absolute top-1/2 right-3 -translate-y-1/2 cursor-pointer border-none bg-transparent p-0 text-(--color-text-muted) transition-colors duration-150 hover:text-(--color-primary)"
|
className="absolute top-1/2 right-3 -translate-y-1/2 cursor-pointer border-none bg-transparent p-0 text-(--color-text-muted) transition-colors duration-150 hover:text-(--color-primary)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-xmark text-sm"></i>
|
<i className="fa-solid fa-xmark text-sm"></i>
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Button from "@/components/atoms/buttons/Button";
|
||||||
|
import ErrorMessageLogin from "@/components/atoms/errors/ErrorMessageLogin";
|
||||||
|
import { useAuth } from "@/lib/auth-context";
|
||||||
|
import { SHOP_INFO } from "@/lib/constants";
|
||||||
|
import Image from "next/image";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { FormEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
export default function LoginOtpPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
const { setUser } = useAuth();
|
||||||
|
|
||||||
|
const [phone, setPhone] = useState("");
|
||||||
|
const [role, setRole] = useState("");
|
||||||
|
const [otp, setOtp] = useState("");
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [errors, setErrors] = useState({ otp: "", general: "" });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const storedPhone = sessionStorage.getItem("login_phone");
|
||||||
|
const storedRole = sessionStorage.getItem("login_role");
|
||||||
|
if (!storedPhone || !storedRole) {
|
||||||
|
router.replace("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setPhone(storedPhone);
|
||||||
|
setRole(storedRole);
|
||||||
|
}, [router]);
|
||||||
|
|
||||||
|
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (!otp.trim()) {
|
||||||
|
setErrors({ otp: "Please enter your OTP code", general: "" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
setErrors({ otp: "", general: "" });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const endpoint =
|
||||||
|
role === "manager"
|
||||||
|
? "/api/manager/quick_login"
|
||||||
|
: "/api/customer/quick_login";
|
||||||
|
|
||||||
|
const res = await fetch(endpoint, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ phone, otp }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
const userData = await res.json();
|
||||||
|
setUser(userData);
|
||||||
|
localStorage.setItem("coffee-shop-user", JSON.stringify(userData));
|
||||||
|
sessionStorage.removeItem("login_phone");
|
||||||
|
sessionStorage.removeItem("login_role");
|
||||||
|
router.push(role === "manager" ? "/manager" : "/");
|
||||||
|
} else {
|
||||||
|
const errorCode = (await res.text().catch(() => "")).trim();
|
||||||
|
const msg =
|
||||||
|
errorCode === "InvalidOTP"
|
||||||
|
? "Incorrect or expired OTP code"
|
||||||
|
: "An error occurred, please try again";
|
||||||
|
setErrors({ otp: msg, general: "" });
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setErrors({ otp: "", general: "Unable to connect, please try again" });
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!phone) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-background flex min-h-screen items-center justify-center px-4 py-8">
|
||||||
|
<div className="w-full max-w-md rounded-2xl bg-white p-8 shadow-lg">
|
||||||
|
{/* Logo & Shop Name */}
|
||||||
|
<div className="mb-8 flex flex-col items-center">
|
||||||
|
<div className="relative mb-4 h-20 w-20">
|
||||||
|
<Image
|
||||||
|
src={SHOP_INFO.logo}
|
||||||
|
alt={SHOP_INFO.name}
|
||||||
|
fill
|
||||||
|
className="object-contain"
|
||||||
|
sizes="80px"
|
||||||
|
priority
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<h1 className="mb-1 text-2xl font-bold text-(--color-primary-dark)">
|
||||||
|
{SHOP_INFO.name}
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm text-(--color-text-muted)">
|
||||||
|
Verify your phone number
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{errors.general && <ErrorMessageLogin message={errors.general} />}
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-5">
|
||||||
|
{/* Info */}
|
||||||
|
<div className="rounded-lg border border-blue-200 bg-blue-50 p-4">
|
||||||
|
<p className="text-sm text-blue-800">
|
||||||
|
<i className="fa-solid fa-circle-info mr-2"></i>
|
||||||
|
OTP code sent to <strong>{phone}</strong>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* OTP Input */}
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
htmlFor="otp"
|
||||||
|
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
||||||
|
>
|
||||||
|
OTP code
|
||||||
|
</label>
|
||||||
|
<div className="relative">
|
||||||
|
<i className="fa-solid fa-key absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
||||||
|
<input
|
||||||
|
id="otp"
|
||||||
|
type="text"
|
||||||
|
value={otp}
|
||||||
|
onChange={(e) => {
|
||||||
|
setOtp(e.target.value);
|
||||||
|
setErrors({ otp: "", general: "" });
|
||||||
|
}}
|
||||||
|
placeholder="Enter OTP code"
|
||||||
|
maxLength={6}
|
||||||
|
disabled={isLoading}
|
||||||
|
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-4 py-3 text-center text-lg tracking-widest transition-all duration-150 outline-none placeholder:text-sm placeholder:tracking-normal placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) disabled:opacity-60 lg:pl-11 ${errors.otp ? "border-red-400" : "border-(--color-border)"}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{errors.otp && (
|
||||||
|
<ErrorMessageLogin message={errors.otp} type="secondary" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Buttons */}
|
||||||
|
<div className="space-y-3 pt-2">
|
||||||
|
<Button
|
||||||
|
variant="primaryNoBorder"
|
||||||
|
type="submit"
|
||||||
|
style="login"
|
||||||
|
size="lg"
|
||||||
|
disabled={isLoading}
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-2"></i>
|
||||||
|
Processing...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Sign in"
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => router.push("/login")}
|
||||||
|
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) transition-all duration-150 hover:bg-(--color-primary) hover:text-white active:scale-98"
|
||||||
|
>
|
||||||
|
Change phone number
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -25,39 +25,12 @@ export default function LoginPage() {
|
|||||||
{SHOP_INFO.name}
|
{SHOP_INFO.name}
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm text-(--color-text-muted)">
|
<p className="text-sm text-(--color-text-muted)">
|
||||||
Đăng nhập vào hệ thống
|
Enter your phone number to sign in
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Login Form */}
|
{/* Login Form */}
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
|
|
||||||
{/* Demo Credentials Info */}
|
|
||||||
<div className="bg-background mt-6 rounded-lg p-4">
|
|
||||||
<p className="mb-2 text-xs font-semibold text-(--color-text-muted)">
|
|
||||||
Tài khoản demo:
|
|
||||||
</p>
|
|
||||||
<ul className="space-y-1 text-xs text-(--color-text-muted)">
|
|
||||||
<li>
|
|
||||||
• Quản lý:{" "}
|
|
||||||
<code className="rounded bg-white px-1.5 py-0.5">
|
|
||||||
admin / admin
|
|
||||||
</code>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
• Nhân viên:{" "}
|
|
||||||
<code className="rounded bg-white px-1.5 py-0.5">
|
|
||||||
Nguyễn Văn An / Nguyễn Văn An
|
|
||||||
</code>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
• Khách hàng:{" "}
|
|
||||||
<code className="rounded bg-white px-1.5 py-0.5">
|
|
||||||
0987654321 / user1
|
|
||||||
</code>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Button from "@/components/atoms/buttons/Button";
|
||||||
|
import ErrorMessageLogin from "@/components/atoms/errors/ErrorMessageLogin";
|
||||||
|
import { useAuth } from "@/lib/auth-context";
|
||||||
|
import { SHOP_INFO } from "@/lib/constants";
|
||||||
|
import Image from "next/image";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { FormEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
export default function LoginPasswordPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
const { setUser } = useAuth();
|
||||||
|
|
||||||
|
const [phone, setPhone] = useState("");
|
||||||
|
const [password, setPassword] = useState("");
|
||||||
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [errors, setErrors] = useState({ password: "", general: "" });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const storedPhone = sessionStorage.getItem("login_phone");
|
||||||
|
const storedRole = sessionStorage.getItem("login_role");
|
||||||
|
if (!storedPhone || storedRole !== "manager") {
|
||||||
|
router.replace("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setPhone(storedPhone);
|
||||||
|
}, [router]);
|
||||||
|
|
||||||
|
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (!password.trim()) {
|
||||||
|
setErrors({ password: "Please enter your password", general: "" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
setErrors({ password: "", general: "" });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/login", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ phone, password, role: "manager" }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
const userData = await res.json();
|
||||||
|
setUser(userData);
|
||||||
|
localStorage.setItem("coffee-shop-user", JSON.stringify(userData));
|
||||||
|
sessionStorage.removeItem("login_phone");
|
||||||
|
sessionStorage.removeItem("login_role");
|
||||||
|
router.push("/manager");
|
||||||
|
} else {
|
||||||
|
const STATUS_ERROR_MAP: Record<number, string> = {
|
||||||
|
400: "Incorrect login details, please try again",
|
||||||
|
401: "Incorrect password",
|
||||||
|
403: "Account is locked",
|
||||||
|
404: "Account does not exist",
|
||||||
|
};
|
||||||
|
const msg =
|
||||||
|
STATUS_ERROR_MAP[res.status] ??
|
||||||
|
(res.status >= 500
|
||||||
|
? "Server error, please try again later"
|
||||||
|
: "An error occurred, please try again");
|
||||||
|
setErrors({ password: "", general: msg });
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setErrors({ password: "", general: "Unable to connect, please try again" });
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!phone) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-background flex min-h-screen items-center justify-center px-4 py-8">
|
||||||
|
<div className="w-full max-w-md rounded-2xl bg-white p-8 shadow-lg">
|
||||||
|
{/* Logo & Shop Name */}
|
||||||
|
<div className="mb-8 flex flex-col items-center">
|
||||||
|
<div className="relative mb-4 h-20 w-20">
|
||||||
|
<Image
|
||||||
|
src={SHOP_INFO.logo}
|
||||||
|
alt={SHOP_INFO.name}
|
||||||
|
fill
|
||||||
|
className="object-contain"
|
||||||
|
sizes="80px"
|
||||||
|
priority
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<h1 className="mb-1 text-2xl font-bold text-(--color-primary-dark)">
|
||||||
|
{SHOP_INFO.name}
|
||||||
|
</h1>
|
||||||
|
<p className="text-sm text-(--color-text-muted)">Manager sign in</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{errors.general && <ErrorMessageLogin message={errors.general} />}
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-5">
|
||||||
|
{/* Phone display */}
|
||||||
|
<div className="rounded-lg border border-(--color-border) bg-(--color-background) px-4 py-3 text-sm text-(--color-text-secondary)">
|
||||||
|
<i className="fa-solid fa-phone mr-2 text-(--color-text-muted)"></i>
|
||||||
|
{phone}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Password Input */}
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
htmlFor="password"
|
||||||
|
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
||||||
|
>
|
||||||
|
Password
|
||||||
|
</label>
|
||||||
|
<div className="relative">
|
||||||
|
<i className="fa-solid fa-lock absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
||||||
|
<input
|
||||||
|
id="password"
|
||||||
|
type={showPassword ? "text" : "password"}
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPassword(e.target.value);
|
||||||
|
setErrors({ password: "", general: "" });
|
||||||
|
}}
|
||||||
|
placeholder="Enter password"
|
||||||
|
disabled={isLoading}
|
||||||
|
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-10 py-3 transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) disabled:opacity-60 lg:pl-11 ${errors.password ? "border-red-400" : "border-(--color-border)"}`}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
|
className="absolute top-1/2 right-4 -translate-y-1/2 text-(--color-text-muted) transition-colors hover:text-(--color-primary)"
|
||||||
|
aria-label={showPassword ? "Hide password" : "Show password"}
|
||||||
|
>
|
||||||
|
<i className={`fa-solid ${showPassword ? "fa-eye-slash" : "fa-eye"}`}></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{errors.password && (
|
||||||
|
<ErrorMessageLogin message={errors.password} type="secondary" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Buttons */}
|
||||||
|
<div className="space-y-3 pt-2">
|
||||||
|
<Button
|
||||||
|
variant="primaryNoBorder"
|
||||||
|
type="submit"
|
||||||
|
style="login"
|
||||||
|
size="lg"
|
||||||
|
disabled={isLoading}
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-2"></i>
|
||||||
|
Processing...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Sign in"
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => router.push("/login")}
|
||||||
|
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) transition-all duration-150 hover:bg-(--color-primary) hover:text-white active:scale-98"
|
||||||
|
>
|
||||||
|
Change phone number
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import Button from "@/components/atoms/buttons/Button";
|
||||||
|
import { SHOP_INFO } from "@/lib/constants";
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { FormEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
type PageState = "checking" | "available" | "closed" | "error";
|
||||||
|
|
||||||
|
export default function ManagerSignupPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const [pageState, setPageState] = useState<PageState>("checking");
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [form, setForm] = useState({ name: "", phone: "", password: "", eateryName: "" });
|
||||||
|
const [errors, setErrors] = useState({ name: "", phone: "", password: "", eateryName: "", submit: "" });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch("/api/manager/signup")
|
||||||
|
.then((res) => {
|
||||||
|
setPageState("available")
|
||||||
|
// if (res.ok) ;
|
||||||
|
// else if (res.status === 403) setPageState("closed");
|
||||||
|
// else setPageState("error");
|
||||||
|
})
|
||||||
|
.catch(() => setPageState("error"));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const validatePhone = (phone: string) => /^(0[3|5|7|8|9])[0-9]{8}$/.test(phone);
|
||||||
|
|
||||||
|
const handleChange = (field: keyof typeof form) => (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
setForm({ ...form, [field]: e.target.value });
|
||||||
|
setErrors({ ...errors, [field]: "", submit: "" });
|
||||||
|
};
|
||||||
|
|
||||||
|
const validate = () => {
|
||||||
|
const next = { name: "", phone: "", password: "", eateryName: "", submit: "" };
|
||||||
|
if (!form.name.trim()) next.name = "Please enter your full name";
|
||||||
|
if (!form.phone.trim()) next.phone = "Please enter your phone number";
|
||||||
|
else if (!validatePhone(form.phone)) next.phone = "Invalid phone number (e.g. 0987654321)";
|
||||||
|
if (!form.password.trim()) next.password = "Please enter your password";
|
||||||
|
else if (form.password.length < 6) next.password = "Password must be at least 6 characters";
|
||||||
|
if (!form.eateryName.trim()) next.eateryName = "Please enter the restaurant name";
|
||||||
|
setErrors(next);
|
||||||
|
return !next.name && !next.phone && !next.password && !next.eateryName;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (!validate()) return;
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/manager/signup", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify(form),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok || res.status === 201) {
|
||||||
|
router.push("/login");
|
||||||
|
} else {
|
||||||
|
const errorCode = (await res.text().catch(() => "")).trim();
|
||||||
|
const errorMap: Record<string, string> = {
|
||||||
|
ExistedUser: "Phone number already registered",
|
||||||
|
InvalidPhoneNumber: "Invalid phone number",
|
||||||
|
};
|
||||||
|
setErrors({ ...errors, submit: errorMap[errorCode] ?? "An error occurred, please try again" });
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setErrors({ ...errors, submit: "Unable to connect, please try again" });
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-background flex min-h-screen items-center justify-center px-4 py-8">
|
||||||
|
<div className="w-full max-w-md rounded-2xl bg-white p-8 shadow-lg">
|
||||||
|
{/* Logo */}
|
||||||
|
<div className="mb-8 flex flex-col items-center">
|
||||||
|
<div className="relative mb-4 h-20 w-20">
|
||||||
|
<Image src={SHOP_INFO.logo} alt={SHOP_INFO.name} fill className="object-contain" sizes="80px" priority />
|
||||||
|
</div>
|
||||||
|
<h1 className="mb-1 text-2xl font-bold text-(--color-primary-dark)">{SHOP_INFO.name}</h1>
|
||||||
|
<p className="text-sm text-(--color-text-muted)">Create a manager account</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Checking */}
|
||||||
|
{pageState === "checking" && (
|
||||||
|
<div className="flex flex-col items-center gap-3 py-8 text-(--color-text-muted)">
|
||||||
|
<i className="fa-solid fa-spinner fa-spin text-2xl text-(--color-primary)"></i>
|
||||||
|
<p className="text-sm">Checking...</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Closed */}
|
||||||
|
{pageState === "closed" && (
|
||||||
|
<div className="flex flex-col items-center gap-4 py-6">
|
||||||
|
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-red-100">
|
||||||
|
<i className="fa-solid fa-lock text-2xl text-red-500"></i>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<h2 className="mb-2 text-lg font-semibold text-(--color-text-primary)">Registration closed</h2>
|
||||||
|
<p className="text-sm text-(--color-text-muted)">The system already has a restaurant. Registration is no longer available.</p>
|
||||||
|
</div>
|
||||||
|
<Link
|
||||||
|
href="/login"
|
||||||
|
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) no-underline transition-all duration-150 hover:bg-(--color-primary) hover:text-white"
|
||||||
|
>
|
||||||
|
Quay lại đăng nhập
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Error */}
|
||||||
|
{pageState === "error" && (
|
||||||
|
<div className="flex flex-col items-center gap-4 py-6">
|
||||||
|
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-yellow-100">
|
||||||
|
<i className="fa-solid fa-triangle-exclamation text-2xl text-yellow-500"></i>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<h2 className="mb-2 text-lg font-semibold text-(--color-text-primary)">Không thể kết nối</h2>
|
||||||
|
<p className="text-sm text-(--color-text-muted)">Không thể kiểm tra trạng thái đăng ký. Vui lòng thử lại.</p>
|
||||||
|
</div>
|
||||||
|
<Button variant="primaryNoBorder" style="login" size="lg" onClick={() => { setPageState("checking"); fetch("/api/manager/signup").then((r) => { if (r.ok) setPageState("available"); else if (r.status === 403) setPageState("closed"); else setPageState("error"); }).catch(() => setPageState("error")); }}>
|
||||||
|
Thử lại
|
||||||
|
</Button>
|
||||||
|
<Link href="/login" className="text-sm text-(--color-primary) underline">Quay lại đăng nhập</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Signup Form */}
|
||||||
|
{pageState === "available" && (
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-4">
|
||||||
|
{[
|
||||||
|
{ id: "name", label: "Họ tên", icon: "fa-user", placeholder: "Nguyễn Văn A", field: "name" as const, type: "text" },
|
||||||
|
{ id: "phone", label: "Số điện thoại", icon: "fa-phone", placeholder: "0987654321", field: "phone" as const, type: "tel" },
|
||||||
|
{ id: "password", label: "Mật khẩu", icon: "fa-lock", placeholder: "Ít nhất 6 ký tự", field: "password" as const, type: "password" },
|
||||||
|
{ id: "eateryName", label: "Tên nhà hàng", icon: "fa-store", placeholder: "Coffee & More", field: "eateryName" as const, type: "text" },
|
||||||
|
].map(({ id, label, icon, placeholder, field, type }) => (
|
||||||
|
<div key={id}>
|
||||||
|
<label htmlFor={id} className="mb-2 block text-sm font-medium text-(--color-text-secondary)">
|
||||||
|
{label}
|
||||||
|
</label>
|
||||||
|
<div className="relative">
|
||||||
|
<i className={`fa-solid ${icon} absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block`}></i>
|
||||||
|
<input
|
||||||
|
id={id}
|
||||||
|
type={type}
|
||||||
|
value={form[field]}
|
||||||
|
onChange={handleChange(field)}
|
||||||
|
placeholder={placeholder}
|
||||||
|
disabled={isLoading}
|
||||||
|
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-4 py-3 transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) disabled:opacity-60 lg:pl-11 ${errors[field] ? "border-red-400" : "border-(--color-border)"}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{errors[field] && (
|
||||||
|
<p className="mt-1.5 flex items-center gap-1 text-xs text-red-500">
|
||||||
|
<i className="fa-solid fa-circle-exclamation"></i>
|
||||||
|
{errors[field]}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{errors.submit && (
|
||||||
|
<div className="rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
|
||||||
|
<i className="fa-solid fa-circle-exclamation mr-2"></i>
|
||||||
|
{errors.submit}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="space-y-3 pt-2">
|
||||||
|
<Button variant="primaryNoBorder" type="submit" style="login" size="lg" disabled={isLoading}>
|
||||||
|
{isLoading ? (
|
||||||
|
<><i className="fa-solid fa-spinner fa-spin mr-2"></i>Đang xử lý...</>
|
||||||
|
) : (
|
||||||
|
"Đăng ký"
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
<Link
|
||||||
|
href="/login"
|
||||||
|
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) no-underline transition-all duration-150 hover:bg-(--color-primary) hover:text-white"
|
||||||
|
>
|
||||||
|
Đã có tài khoản? Đăng nhập
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
+2
-2
@@ -38,7 +38,7 @@ export default function Home() {
|
|||||||
}, [activeCategory]);
|
}, [activeCategory]);
|
||||||
|
|
||||||
const activeCategoryLabel =
|
const activeCategoryLabel =
|
||||||
MENU_CATEGORIES.find((c) => c.id === activeCategory)?.name ?? "Tất cả";
|
MENU_CATEGORIES.find((c) => c.id === activeCategory)?.name ?? "All";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-background flex min-h-[calc(100vh-var(--spacing-header-height))] items-start">
|
<div className="bg-background flex min-h-[calc(100vh-var(--spacing-header-height))] items-start">
|
||||||
@@ -69,7 +69,7 @@ export default function Home() {
|
|||||||
setSearchQuery(q);
|
setSearchQuery(q);
|
||||||
}}
|
}}
|
||||||
onClear={() => setSearchQuery("")}
|
onClear={() => setSearchQuery("")}
|
||||||
placeholder="Tìm kiếm món..."
|
placeholder="Search items..."
|
||||||
className="sm:max-w-xs"
|
className="sm:max-w-xs"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -46,22 +46,22 @@ export default function PaymentPage() {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr className="bg-(--color-border-light)/40 text-left">
|
<tr className="bg-(--color-border-light)/40 text-left">
|
||||||
<th scope="col" className="px-4 py-3 font-semibold">
|
<th scope="col" className="px-4 py-3 font-semibold">
|
||||||
Tên sản phẩm
|
Product name
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" className="px-4 py-3 font-semibold">
|
<th scope="col" className="px-4 py-3 font-semibold">
|
||||||
Giá tiền
|
Price
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" className="px-4 py-3 font-semibold">
|
<th scope="col" className="px-4 py-3 font-semibold">
|
||||||
Mô tả
|
Description
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" className="px-4 py-3 font-semibold">
|
<th scope="col" className="px-4 py-3 font-semibold">
|
||||||
Số lượng
|
Quantity
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
scope="col"
|
scope="col"
|
||||||
className="px-4 py-3 text-right font-semibold"
|
className="px-4 py-3 text-right font-semibold"
|
||||||
>
|
>
|
||||||
Xóa
|
Delete
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -116,7 +116,7 @@ export default function PaymentPage() {
|
|||||||
style="payment"
|
style="payment"
|
||||||
aria-label={`Xóa ${item.name} khỏi giỏ hàng`}
|
aria-label={`Xóa ${item.name} khỏi giỏ hàng`}
|
||||||
>
|
>
|
||||||
Xóa sản phẩm
|
Delete product
|
||||||
</Button>
|
</Button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+147
-35
@@ -6,19 +6,48 @@ import { SHOP_INFO } from "@/lib/constants";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { SubmitEvent, useState } from "react";
|
import { FormEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
// Static OTP for demo (in production, this would be sent via SMS)
|
// Static OTP for demo (in production, this would be sent via SMS)
|
||||||
const DEMO_OTP = "123456";
|
const DEMO_OTP = "123456";
|
||||||
|
|
||||||
export default function RegisterPage() {
|
export default function RegisterPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { completeRegistration } = useAuth();
|
const { setUser } = useAuth();
|
||||||
|
|
||||||
const [step, setStep] = useState<"phone" | "otp">("phone");
|
const [step, setStep] = useState<"phone" | "otp">("phone");
|
||||||
const [phone, setPhone] = useState("");
|
const [phone, setPhone] = useState("");
|
||||||
const [otp, setOtp] = useState("");
|
const [otp, setOtp] = useState("");
|
||||||
const [errors, setErrors] = useState({ phone: "", otp: "" });
|
const [errors, setErrors] = useState({ phone: "", otp: "" });
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [otpSending, setOtpSending] = useState(false);
|
||||||
|
const [otpSendError, setOtpSendError] = useState("");
|
||||||
|
|
||||||
|
const sendOtp = async () => {
|
||||||
|
setOtpSending(true);
|
||||||
|
setOtpSendError("");
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/sms_otp", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ phone }),
|
||||||
|
});
|
||||||
|
if (!res.ok) {
|
||||||
|
setOtpSendError("Unable to send OTP, please try again");
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setOtpSendError("Unable to connect, please try again");
|
||||||
|
} finally {
|
||||||
|
setOtpSending(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (step === "otp") {
|
||||||
|
sendOtp();
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [step]);
|
||||||
|
|
||||||
// Validate Vietnamese phone number
|
// Validate Vietnamese phone number
|
||||||
const validatePhone = (phoneNumber: string): boolean => {
|
const validatePhone = (phoneNumber: string): boolean => {
|
||||||
@@ -28,45 +57,86 @@ export default function RegisterPage() {
|
|||||||
return phoneRegex.test(phoneNumber);
|
return phoneRegex.test(phoneNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePhoneSubmit = (e: SubmitEvent<HTMLFormElement>) => {
|
const handlePhoneSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!phone.trim()) {
|
if (!phone.trim()) {
|
||||||
setErrors({ ...errors, phone: "Vui lòng nhập số điện thoại" });
|
setErrors({ ...errors, phone: "Please enter your phone number" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validatePhone(phone)) {
|
if (!validatePhone(phone)) {
|
||||||
setErrors({
|
setErrors({
|
||||||
...errors,
|
...errors,
|
||||||
phone: "Số điện thoại không hợp lệ (VD: 0987654321)",
|
phone: "Invalid phone number (e.g. 0987654321)",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
// Move to OTP step
|
|
||||||
setStep("otp");
|
|
||||||
setErrors({ phone: "", otp: "" });
|
setErrors({ phone: "", otp: "" });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/customer/quick_signup", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ phone }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
setStep("otp");
|
||||||
|
} else {
|
||||||
|
const errorCode = (await res.text().catch(() => "")).trim();
|
||||||
|
const phoneErrorMap: Record<string, string> = {
|
||||||
|
ExistedUser: "Phone number already registered",
|
||||||
|
InvalidPhoneNumber: "Invalid phone number",
|
||||||
|
};
|
||||||
|
const msg = phoneErrorMap[errorCode] ?? "An error occurred, please try again";
|
||||||
|
setErrors({ phone: msg, otp: "" });
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setErrors({ phone: "Unable to connect, please try again", otp: "" });
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOtpSubmit = (e: SubmitEvent<HTMLFormElement>) => {
|
const handleOtpSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!otp.trim()) {
|
if (!otp.trim()) {
|
||||||
setErrors({ ...errors, otp: "Vui lòng nhập mã OTP" });
|
setErrors({ ...errors, otp: "Please enter your OTP code" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otp !== DEMO_OTP) {
|
setIsLoading(true);
|
||||||
setErrors({ ...errors, otp: "Mã OTP không đúng" });
|
setErrors({ phone: "", otp: "" });
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Complete registration
|
try {
|
||||||
completeRegistration(phone);
|
const res = await fetch("/api/customer/quick_login", {
|
||||||
router.push("/");
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({ phone, otp }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
const userData = await res.json();
|
||||||
|
setUser(userData);
|
||||||
|
localStorage.setItem("coffee-shop-user", JSON.stringify(userData));
|
||||||
|
router.push("/");
|
||||||
|
} else {
|
||||||
|
const errorCode = (await res.text().catch(() => "")).trim();
|
||||||
|
const msg =
|
||||||
|
errorCode === "InvalidOTP"
|
||||||
|
? "Incorrect or expired OTP code"
|
||||||
|
: "An error occurred, please try again";
|
||||||
|
setErrors({ phone: "", otp: msg });
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setErrors({ phone: "", otp: "Unable to connect, please try again" });
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBackToPhone = () => {
|
const handleBackToPhone = () => {
|
||||||
@@ -96,8 +166,8 @@ export default function RegisterPage() {
|
|||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm text-(--color-text-muted)">
|
<p className="text-sm text-(--color-text-muted)">
|
||||||
{step === "phone"
|
{step === "phone"
|
||||||
? "Đăng ký tài khoản khách hàng"
|
? "Create a customer account"
|
||||||
: "Xác thực số điện thoại"}
|
: "Verify your phone number"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -133,7 +203,7 @@ export default function RegisterPage() {
|
|||||||
htmlFor="phone"
|
htmlFor="phone"
|
||||||
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
||||||
>
|
>
|
||||||
Số điện thoại
|
Phone number
|
||||||
</label>
|
</label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<i className="fa-solid fa-phone absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
<i className="fa-solid fa-phone absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
||||||
@@ -146,7 +216,8 @@ export default function RegisterPage() {
|
|||||||
setErrors({ ...errors, phone: "" });
|
setErrors({ ...errors, phone: "" });
|
||||||
}}
|
}}
|
||||||
placeholder="0987654321"
|
placeholder="0987654321"
|
||||||
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-10 py-3 transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) lg:pl-11 ${errors.phone ? "border-red-400" : "border-(--color-border)"} `}
|
disabled={isLoading}
|
||||||
|
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-10 py-3 transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) disabled:opacity-60 lg:pl-11 ${errors.phone ? "border-red-400" : "border-(--color-border)"} `}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{errors.phone && (
|
{errors.phone && (
|
||||||
@@ -156,7 +227,7 @@ export default function RegisterPage() {
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<p className="mt-2 text-xs text-(--color-text-muted)">
|
<p className="mt-2 text-xs text-(--color-text-muted)">
|
||||||
Nhập số điện thoại Việt Nam (10 số, bắt đầu bằng 0)
|
Enter a Vietnamese phone number (10 digits, starting with 0)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -168,8 +239,16 @@ export default function RegisterPage() {
|
|||||||
type="submit"
|
type="submit"
|
||||||
style="login"
|
style="login"
|
||||||
size="lg"
|
size="lg"
|
||||||
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
Tiếp tục
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-2"></i>
|
||||||
|
Processing...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Continue"
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Back to Login */}
|
{/* Back to Login */}
|
||||||
@@ -177,7 +256,7 @@ export default function RegisterPage() {
|
|||||||
href="/login"
|
href="/login"
|
||||||
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) no-underline transition-all duration-150 hover:bg-(--color-primary) hover:text-white active:scale-98"
|
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) no-underline transition-all duration-150 hover:bg-(--color-primary) hover:text-white active:scale-98"
|
||||||
>
|
>
|
||||||
Quay lại đăng nhập
|
Back to sign in
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -190,7 +269,16 @@ export default function RegisterPage() {
|
|||||||
<div className="rounded-lg border border-blue-200 bg-blue-50 p-4">
|
<div className="rounded-lg border border-blue-200 bg-blue-50 p-4">
|
||||||
<p className="mb-2 text-sm text-blue-800">
|
<p className="mb-2 text-sm text-blue-800">
|
||||||
<i className="fa-solid fa-circle-info mr-2"></i>
|
<i className="fa-solid fa-circle-info mr-2"></i>
|
||||||
Mã OTP đã được gửi đến số <strong>{phone}</strong>
|
{otpSending ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-1"></i>
|
||||||
|
Sending OTP to <strong>{phone}</strong>...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
OTP code sent to <strong>{phone}</strong>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-blue-600">
|
<p className="text-xs text-blue-600">
|
||||||
Demo OTP:{" "}
|
Demo OTP:{" "}
|
||||||
@@ -199,6 +287,12 @@ export default function RegisterPage() {
|
|||||||
</code>
|
</code>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{otpSendError && (
|
||||||
|
<p className="flex items-center gap-1 text-xs text-red-500">
|
||||||
|
<i className="fa-solid fa-circle-exclamation"></i>
|
||||||
|
{otpSendError}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* OTP Input */}
|
{/* OTP Input */}
|
||||||
<div>
|
<div>
|
||||||
@@ -206,7 +300,7 @@ export default function RegisterPage() {
|
|||||||
htmlFor="otp"
|
htmlFor="otp"
|
||||||
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
||||||
>
|
>
|
||||||
Mã OTP
|
OTP code
|
||||||
</label>
|
</label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<i className="fa-solid fa-key absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
<i className="fa-solid fa-key absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
||||||
@@ -218,9 +312,10 @@ export default function RegisterPage() {
|
|||||||
setOtp(e.target.value);
|
setOtp(e.target.value);
|
||||||
setErrors({ ...errors, otp: "" });
|
setErrors({ ...errors, otp: "" });
|
||||||
}}
|
}}
|
||||||
placeholder="Nhập mã OTP"
|
placeholder="Enter OTP code"
|
||||||
maxLength={6}
|
maxLength={6}
|
||||||
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-4 py-3 text-center text-lg tracking-widest transition-all duration-150 outline-none placeholder:text-sm placeholder:tracking-normal placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) lg:pl-11 ${errors.otp ? "border-red-400" : "border-(--color-border)"} `}
|
disabled={isLoading}
|
||||||
|
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-4 py-3 text-center text-lg tracking-widest transition-all duration-150 outline-none placeholder:text-sm placeholder:tracking-normal placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) disabled:opacity-60 lg:pl-11 ${errors.otp ? "border-red-400" : "border-(--color-border)"} `}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{errors.otp && (
|
{errors.otp && (
|
||||||
@@ -239,8 +334,16 @@ export default function RegisterPage() {
|
|||||||
type="submit"
|
type="submit"
|
||||||
style="login"
|
style="login"
|
||||||
size="lg"
|
size="lg"
|
||||||
|
disabled={isLoading || otpSending}
|
||||||
>
|
>
|
||||||
Hoàn tất đăng ký
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-2"></i>
|
||||||
|
Processing...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Complete registration"
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Back Button */}
|
{/* Back Button */}
|
||||||
@@ -249,19 +352,28 @@ export default function RegisterPage() {
|
|||||||
onClick={handleBackToPhone}
|
onClick={handleBackToPhone}
|
||||||
size="lg"
|
size="lg"
|
||||||
style="login"
|
style="login"
|
||||||
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
Thay đổi số điện thoại
|
Change phone number
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Resend OTP (disabled in demo) */}
|
{/* Resend OTP */}
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled
|
onClick={sendOtp}
|
||||||
className="cursor-not-allowed text-sm text-(--color-text-muted)"
|
disabled={otpSending || isLoading}
|
||||||
|
className="text-sm text-(--color-primary) underline disabled:cursor-not-allowed disabled:opacity-50 disabled:no-underline"
|
||||||
>
|
>
|
||||||
Gửi lại mã OTP (60s)
|
{otpSending ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-1"></i>
|
||||||
|
Resending...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Resend OTP code"
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import { useMemo, useState } from "react";
|
|||||||
// ─── Constants ────────────────────────────────────────────────────────────────
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const PERIOD_LABELS: Record<AnalyticsPeriod, string> = {
|
const PERIOD_LABELS: Record<AnalyticsPeriod, string> = {
|
||||||
day: "Theo ngày",
|
day: "By day",
|
||||||
week: "Theo tuần",
|
week: "By week",
|
||||||
month: "Theo tháng",
|
month: "By month",
|
||||||
year: "Theo năm",
|
year: "By year",
|
||||||
};
|
};
|
||||||
|
|
||||||
const CATEGORY_COLORS = [
|
const CATEGORY_COLORS = [
|
||||||
@@ -67,7 +67,7 @@ const CHART_META: Record<ChartType, { icon: string; label: string }> = {
|
|||||||
function CategorySelect({
|
function CategorySelect({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
label = "Danh mục:",
|
label = "Category:",
|
||||||
}: {
|
}: {
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (v: string) => void;
|
onChange: (v: string) => void;
|
||||||
@@ -78,12 +78,12 @@ function CategorySelect({
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<label className="text-xs text-(--color-text-muted)">{label}</label>
|
<label className="text-xs text-(--color-text-muted)">{label}</label>
|
||||||
<select
|
<select
|
||||||
title="Danh mục"
|
title="Category"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
className="bg-background text-foreground rounded-lg border border-(--color-border) px-2 py-1.5 text-xs"
|
className="bg-background text-foreground rounded-lg border border-(--color-border) px-2 py-1.5 text-xs"
|
||||||
>
|
>
|
||||||
<option value="all">Tất cả</option>
|
<option value="all">All</option>
|
||||||
{categories.map((c) => (
|
{categories.map((c) => (
|
||||||
<option key={c.id} value={c.id}>
|
<option key={c.id} value={c.id}>
|
||||||
{c.name}
|
{c.name}
|
||||||
@@ -181,7 +181,7 @@ export default function AnalyticsPage() {
|
|||||||
</span>
|
</span>
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-foreground text-lg leading-tight font-bold">
|
<h1 className="text-foreground text-lg leading-tight font-bold">
|
||||||
Thống kê & Phân tích tài chính
|
Financial Statistics & Analytics
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-xs text-(--color-text-muted)">
|
<p className="text-xs text-(--color-text-muted)">
|
||||||
Financial Analytics Dashboard
|
Financial Analytics Dashboard
|
||||||
@@ -205,7 +205,7 @@ export default function AnalyticsPage() {
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
<select
|
<select
|
||||||
title="Chọn kỳ"
|
title="Select period"
|
||||||
value={period}
|
value={period}
|
||||||
onChange={(e) => setPeriod(e.target.value as AnalyticsPeriod)}
|
onChange={(e) => setPeriod(e.target.value as AnalyticsPeriod)}
|
||||||
className="text-foreground block rounded-lg border border-(--color-border) bg-(--color-bg-card) px-2 py-1.5 text-xs sm:hidden"
|
className="text-foreground block rounded-lg border border-(--color-border) bg-(--color-bg-card) px-2 py-1.5 text-xs sm:hidden"
|
||||||
@@ -226,12 +226,12 @@ export default function AnalyticsPage() {
|
|||||||
{/* ── Summary Cards ── */}
|
{/* ── Summary Cards ── */}
|
||||||
<section>
|
<section>
|
||||||
<h2 className="mb-3 text-sm font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
<h2 className="mb-3 text-sm font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
||||||
Tổng quan
|
Overview
|
||||||
</h2>
|
</h2>
|
||||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||||
<SummaryCard
|
<SummaryCard
|
||||||
icon="fa-solid fa-sack-dollar"
|
icon="fa-solid fa-sack-dollar"
|
||||||
title="Tổng doanh thu"
|
title="Total Revenue"
|
||||||
value={formatCurrency(totalRevenue)}
|
value={formatCurrency(totalRevenue)}
|
||||||
subtitle={PERIOD_LABELS[period]}
|
subtitle={PERIOD_LABELS[period]}
|
||||||
change={revComp.change}
|
change={revComp.change}
|
||||||
@@ -240,27 +240,27 @@ export default function AnalyticsPage() {
|
|||||||
/>
|
/>
|
||||||
<SummaryCard
|
<SummaryCard
|
||||||
icon="fa-solid fa-receipt"
|
icon="fa-solid fa-receipt"
|
||||||
title="Số đơn hàng"
|
title="Total Orders"
|
||||||
value={totalOrders.toLocaleString()}
|
value={totalOrders.toLocaleString()}
|
||||||
subtitle="Tổng đơn trong kỳ"
|
subtitle="Total orders in period"
|
||||||
change={ordComp.change}
|
change={ordComp.change}
|
||||||
changePercent={ordComp.changePercent}
|
changePercent={ordComp.changePercent}
|
||||||
isPositive={ordComp.isPositive}
|
isPositive={ordComp.isPositive}
|
||||||
/>
|
/>
|
||||||
<SummaryCard
|
<SummaryCard
|
||||||
icon="fa-solid fa-circle-dollar-to-slot"
|
icon="fa-solid fa-circle-dollar-to-slot"
|
||||||
title="Tổng lợi nhuận"
|
title="Total Profit"
|
||||||
value={formatCurrency(totalProfit)}
|
value={formatCurrency(totalProfit)}
|
||||||
subtitle="Ước tính từ dữ liệu bán hàng"
|
subtitle="Estimated from sales data"
|
||||||
change={proComp.change}
|
change={proComp.change}
|
||||||
changePercent={proComp.changePercent}
|
changePercent={proComp.changePercent}
|
||||||
isPositive={proComp.isPositive}
|
isPositive={proComp.isPositive}
|
||||||
/>
|
/>
|
||||||
<SummaryCard
|
<SummaryCard
|
||||||
icon="fa-solid fa-basket-shopping"
|
icon="fa-solid fa-basket-shopping"
|
||||||
title="Giá trị đơn TB"
|
title="Avg. Order Value"
|
||||||
value={formatCurrency(avgOrderValue)}
|
value={formatCurrency(avgOrderValue)}
|
||||||
subtitle="Doanh thu / số đơn hàng"
|
subtitle="Revenue / number of orders"
|
||||||
change={0}
|
change={0}
|
||||||
changePercent={0}
|
changePercent={0}
|
||||||
isPositive={true}
|
isPositive={true}
|
||||||
@@ -273,7 +273,7 @@ export default function AnalyticsPage() {
|
|||||||
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||||
<h2 className="text-foreground text-base font-semibold">
|
<h2 className="text-foreground text-base font-semibold">
|
||||||
<i className="fa-solid fa-chart-area mr-2 text-(--color-primary)"></i>
|
<i className="fa-solid fa-chart-area mr-2 text-(--color-primary)"></i>
|
||||||
Biểu đồ doanh thu
|
Revenue Chart
|
||||||
</h2>
|
</h2>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
{CHART_TYPES.map((t) => (
|
{CHART_TYPES.map((t) => (
|
||||||
@@ -298,7 +298,7 @@ export default function AnalyticsPage() {
|
|||||||
{activeChart === "line" && (
|
{activeChart === "line" && (
|
||||||
<>
|
<>
|
||||||
<p className="mb-3 text-xs text-(--color-text-muted)">
|
<p className="mb-3 text-xs text-(--color-text-muted)">
|
||||||
Doanh thu theo thời gian — {PERIOD_LABELS[period]}
|
Revenue over time — {PERIOD_LABELS[period]}
|
||||||
</p>
|
</p>
|
||||||
<LineChart data={revenueData} height={220} />
|
<LineChart data={revenueData} height={220} />
|
||||||
</>
|
</>
|
||||||
@@ -306,7 +306,7 @@ export default function AnalyticsPage() {
|
|||||||
{activeChart === "bar" && (
|
{activeChart === "bar" && (
|
||||||
<>
|
<>
|
||||||
<p className="mb-3 text-xs text-(--color-text-muted)">
|
<p className="mb-3 text-xs text-(--color-text-muted)">
|
||||||
So sánh doanh thu nửa đầu và nửa sau kỳ hiện tại
|
Comparing revenue of the first and second half of the current period
|
||||||
</p>
|
</p>
|
||||||
<BarChart
|
<BarChart
|
||||||
current={barCurrent}
|
current={barCurrent}
|
||||||
@@ -318,7 +318,7 @@ export default function AnalyticsPage() {
|
|||||||
{activeChart === "pie" && (
|
{activeChart === "pie" && (
|
||||||
<>
|
<>
|
||||||
<p className="mb-3 text-xs text-(--color-text-muted)">
|
<p className="mb-3 text-xs text-(--color-text-muted)">
|
||||||
Tỷ trọng doanh thu theo danh mục sản phẩm
|
Revenue share by product category
|
||||||
</p>
|
</p>
|
||||||
<PieChart data={pieData} />
|
<PieChart data={pieData} />
|
||||||
</>
|
</>
|
||||||
@@ -330,7 +330,7 @@ export default function AnalyticsPage() {
|
|||||||
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||||
<h2 className="text-foreground text-base font-semibold">
|
<h2 className="text-foreground text-base font-semibold">
|
||||||
<i className="fa-solid fa-fire mr-2 text-orange-500"></i>
|
<i className="fa-solid fa-fire mr-2 text-orange-500"></i>
|
||||||
Top sản phẩm bán chạy
|
Top best-selling products
|
||||||
</h2>
|
</h2>
|
||||||
<CategorySelect
|
<CategorySelect
|
||||||
value={categoryFilter}
|
value={categoryFilter}
|
||||||
@@ -353,7 +353,7 @@ export default function AnalyticsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex shrink-0 items-center gap-3 text-xs">
|
<div className="flex shrink-0 items-center gap-3 text-xs">
|
||||||
<span className="text-(--color-text-muted) tabular-nums">
|
<span className="text-(--color-text-muted) tabular-nums">
|
||||||
{p.unitsSold} ly
|
{p.unitsSold} cups
|
||||||
</span>
|
</span>
|
||||||
<span className="font-semibold text-(--color-primary) tabular-nums">
|
<span className="font-semibold text-(--color-primary) tabular-nums">
|
||||||
{formatCurrency(p.revenue)}
|
{formatCurrency(p.revenue)}
|
||||||
@@ -377,17 +377,17 @@ export default function AnalyticsPage() {
|
|||||||
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||||
<h2 className="text-foreground text-base font-semibold">
|
<h2 className="text-foreground text-base font-semibold">
|
||||||
<i className="fa-solid fa-table text-foreground mr-2"></i>
|
<i className="fa-solid fa-table text-foreground mr-2"></i>
|
||||||
Phân tích chi tiết sản phẩm
|
Detailed product analytics
|
||||||
</h2>
|
</h2>
|
||||||
<CategorySelect
|
<CategorySelect
|
||||||
value={categoryFilter}
|
value={categoryFilter}
|
||||||
onChange={setCategoryFilter}
|
onChange={setCategoryFilter}
|
||||||
label="Lọc danh mục:"
|
label="Filter category:"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p className="mb-3 text-xs text-(--color-text-muted)">
|
<p className="mb-3 text-xs text-(--color-text-muted)">
|
||||||
Click vào tiêu đề cột để sắp xếp. Hiển thị {filteredSales.length}{" "}
|
Click column headers to sort. Showing {filteredSales.length}{" "}
|
||||||
sản phẩm.
|
products.
|
||||||
</p>
|
</p>
|
||||||
<ProductTable data={filteredSales} />
|
<ProductTable data={filteredSales} />
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ export default function AnalyticsPage() {
|
|||||||
<div className="bg-background mt-4 flex flex-wrap gap-4 rounded-xl p-4 text-sm">
|
<div className="bg-background mt-4 flex flex-wrap gap-4 rounded-xl p-4 text-sm">
|
||||||
<div>
|
<div>
|
||||||
<span className="text-(--color-text-muted)">
|
<span className="text-(--color-text-muted)">
|
||||||
Tổng doanh thu:{" "}
|
Total revenue:{" "}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-semibold text-(--color-primary)">
|
<span className="font-semibold text-(--color-primary)">
|
||||||
{formatCurrencyFull(filteredRevenue)}
|
{formatCurrencyFull(filteredRevenue)}
|
||||||
@@ -403,7 +403,7 @@ export default function AnalyticsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-(--color-text-muted)">
|
<span className="text-(--color-text-muted)">
|
||||||
Tổng lợi nhuận:{" "}
|
Total profit:{" "}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-semibold text-green-600">
|
<span className="font-semibold text-green-600">
|
||||||
{formatCurrencyFull(filteredProfit)}
|
{formatCurrencyFull(filteredProfit)}
|
||||||
@@ -411,15 +411,15 @@ export default function AnalyticsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-(--color-text-muted)">
|
<span className="text-(--color-text-muted)">
|
||||||
Tổng sản lượng:{" "}
|
Total units:{" "}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-foreground font-semibold">
|
<span className="text-foreground font-semibold">
|
||||||
{filteredUnits.toLocaleString()} ly
|
{filteredUnits.toLocaleString()} cups
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-(--color-text-muted)">
|
<span className="text-(--color-text-muted)">
|
||||||
Biên LN trung bình:{" "}
|
Avg. profit margin:{" "}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-semibold text-yellow-700">
|
<span className="font-semibold text-yellow-700">
|
||||||
{avgMargin.toFixed(1)}%
|
{avgMargin.toFixed(1)}%
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import {
|
import {
|
||||||
CategoriesTab,
|
CategoriesTab,
|
||||||
CombosTab,
|
CombosTab,
|
||||||
|
MenuItemsTab,
|
||||||
ProductsTab,
|
ProductsTab,
|
||||||
} from "@/components/organisms/manager";
|
} from "@/components/organisms/manager";
|
||||||
import { useAuth } from "@/lib/auth-context";
|
import { useAuth } from "@/lib/auth-context";
|
||||||
@@ -17,7 +18,7 @@ export default function ManagerPage() {
|
|||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
id: "products" as const,
|
id: "products" as const,
|
||||||
label: "Thực đơn",
|
label: "Menu",
|
||||||
icon: "fa-solid fa-utensils",
|
icon: "fa-solid fa-utensils",
|
||||||
count: products.length,
|
count: products.length,
|
||||||
},
|
},
|
||||||
@@ -29,10 +30,16 @@ export default function ManagerPage() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "categories" as const,
|
id: "categories" as const,
|
||||||
label: "Danh mục",
|
label: "Categories",
|
||||||
icon: "fa-solid fa-tags",
|
icon: "fa-solid fa-tags",
|
||||||
count: categories.length,
|
count: categories.length,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "menu-items" as const,
|
||||||
|
label: "Menu",
|
||||||
|
icon: "fa-solid fa-bowl-food",
|
||||||
|
count: null,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -51,7 +58,7 @@ export default function ManagerPage() {
|
|||||||
|
|
||||||
<nav className="flex-1 space-y-1 p-3">
|
<nav className="flex-1 space-y-1 p-3">
|
||||||
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
||||||
Quản lý thực đơn
|
Menu Management
|
||||||
</p>
|
</p>
|
||||||
{tabs.map((tab) => (
|
{tabs.map((tab) => (
|
||||||
<button
|
<button
|
||||||
@@ -65,29 +72,31 @@ export default function ManagerPage() {
|
|||||||
>
|
>
|
||||||
<i className={`${tab.icon} w-4 text-center`}></i>
|
<i className={`${tab.icon} w-4 text-center`}></i>
|
||||||
<span className="flex-1 text-left">{tab.label}</span>
|
<span className="flex-1 text-left">{tab.label}</span>
|
||||||
<span
|
{tab.count !== null && (
|
||||||
className={`rounded-full px-2 py-0.5 text-xs font-semibold ${
|
<span
|
||||||
activeTab === tab.id
|
className={`rounded-full px-2 py-0.5 text-xs font-semibold ${
|
||||||
? "bg-white/20 text-white"
|
activeTab === tab.id
|
||||||
: "bg-(--color-border-light) text-(--color-text-muted)"
|
? "bg-white/20 text-white"
|
||||||
}`}
|
: "bg-(--color-border-light) text-(--color-text-muted)"
|
||||||
>
|
}`}
|
||||||
{tab.count}
|
>
|
||||||
</span>
|
{tab.count}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
||||||
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
||||||
Phân tích
|
Analytics
|
||||||
</p>
|
</p>
|
||||||
<Link
|
<Link
|
||||||
href="/manager/analytics"
|
href="/manager/analytics"
|
||||||
className="hover:bg-background flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition-all hover:text-(--color-primary-dark)"
|
className="hover:bg-background flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition-all hover:text-(--color-primary-dark)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-chart-line w-4 text-center"></i>
|
<i className="fa-solid fa-chart-line w-4 text-center"></i>
|
||||||
<span className="flex-1 text-left">Tài chính</span>
|
<span className="flex-1 text-left">Finance</span>
|
||||||
<span className="rounded-full bg-(--color-accent-light) px-2 py-0.5 text-xs font-semibold text-(--color-primary)">
|
<span className="rounded-full bg-(--color-accent-light) px-2 py-0.5 text-xs font-semibold text-(--color-primary)">
|
||||||
Mới
|
New
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
@@ -95,9 +104,9 @@ export default function ManagerPage() {
|
|||||||
className="hover:bg-background flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition-all hover:text-(--color-primary-dark)"
|
className="hover:bg-background flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) no-underline transition-all hover:text-(--color-primary-dark)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-calendar-days w-4 text-center"></i>
|
<i className="fa-solid fa-calendar-days w-4 text-center"></i>
|
||||||
<span className="flex-1 text-left">Ca làm</span>
|
<span className="flex-1 text-left">Shifts</span>
|
||||||
<span className="rounded-full bg-(--color-accent-light) px-2 py-0.5 text-xs font-semibold text-(--color-primary)">
|
<span className="rounded-full bg-(--color-accent-light) px-2 py-0.5 text-xs font-semibold text-(--color-primary)">
|
||||||
Mới
|
New
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
@@ -110,9 +119,9 @@ export default function ManagerPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="text-foreground truncate text-sm font-semibold">
|
<p className="text-foreground truncate text-sm font-semibold">
|
||||||
{user?.name ?? "Quản lý"}
|
{user?.name ?? "Manager"}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-(--color-text-muted)">Quản lý quán</p>
|
<p className="text-xs text-(--color-text-muted)">Store Manager</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-1 flex gap-2 px-1">
|
<div className="mt-1 flex gap-2 px-1">
|
||||||
@@ -121,14 +130,14 @@ export default function ManagerPage() {
|
|||||||
className="hover:bg-background flex flex-1 items-center justify-center gap-1.5 rounded-xl border border-(--color-border-light) bg-transparent py-2 text-xs font-medium text-(--color-text-secondary) no-underline transition"
|
className="hover:bg-background flex flex-1 items-center justify-center gap-1.5 rounded-xl border border-(--color-border-light) bg-transparent py-2 text-xs font-medium text-(--color-text-secondary) no-underline transition"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-house"></i>
|
<i className="fa-solid fa-house"></i>
|
||||||
Trang chủ
|
Home
|
||||||
</Link>
|
</Link>
|
||||||
<button
|
<button
|
||||||
onClick={logout}
|
onClick={logout}
|
||||||
className="flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-xl border-none bg-transparent py-2 text-xs font-medium text-red-500 transition hover:bg-red-50"
|
className="flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-xl border-none bg-transparent py-2 text-xs font-medium text-red-500 transition hover:bg-red-50"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-right-from-bracket"></i>
|
<i className="fa-solid fa-right-from-bracket"></i>
|
||||||
Đăng xuất
|
Logout
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -139,16 +148,18 @@ export default function ManagerPage() {
|
|||||||
<header className="sticky top-0 z-40 flex items-center justify-between border-b border-(--color-border-light) bg-white px-5 py-4 shadow-sm">
|
<header className="sticky top-0 z-40 flex items-center justify-between border-b border-(--color-border-light) bg-white px-5 py-4 shadow-sm">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-foreground text-lg font-bold">
|
<h1 className="text-foreground text-lg font-bold">
|
||||||
{tabs.find((t) => t.id === activeTab)?.label ?? "Quản lý"}
|
{tabs.find((t) => t.id === activeTab)?.label ?? "Manager"}
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-xs text-(--color-text-muted)">
|
<p className="text-xs text-(--color-text-muted)">
|
||||||
Quản lý{" "}
|
Manage{" "}
|
||||||
{activeTab === "products"
|
{activeTab === "products"
|
||||||
? "thực đơn"
|
? "menu items"
|
||||||
: activeTab === "combos"
|
: activeTab === "combos"
|
||||||
? "combo"
|
? "combos"
|
||||||
: "danh mục"}{" "}
|
: activeTab === "categories"
|
||||||
của quán
|
? "categories"
|
||||||
|
: "menu"}{" "}
|
||||||
|
for your store
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -173,7 +184,7 @@ export default function ManagerPage() {
|
|||||||
className="flex items-center gap-1.5 rounded-xl border-none bg-(--color-accent-light) px-3 py-2 text-xs font-medium text-(--color-primary) no-underline transition hover:bg-(--color-accent-light)/70"
|
className="flex items-center gap-1.5 rounded-xl border-none bg-(--color-accent-light) px-3 py-2 text-xs font-medium text-(--color-primary) no-underline transition hover:bg-(--color-accent-light)/70"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-chart-line"></i>
|
<i className="fa-solid fa-chart-line"></i>
|
||||||
<span className="hidden sm:inline">Tài chính</span>
|
<span className="hidden sm:inline">Finance</span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -184,14 +195,14 @@ export default function ManagerPage() {
|
|||||||
className="flex items-center gap-1.5 rounded-xl bg-(--color-accent-light) px-3 py-2 text-xs font-medium text-(--color-primary) no-underline transition hover:opacity-80"
|
className="flex items-center gap-1.5 rounded-xl bg-(--color-accent-light) px-3 py-2 text-xs font-medium text-(--color-primary) no-underline transition hover:opacity-80"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-chart-line"></i>
|
<i className="fa-solid fa-chart-line"></i>
|
||||||
Thống kê tài chính
|
Financial Analytics
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
href="/"
|
href="/"
|
||||||
className="hover:bg-background flex items-center gap-1.5 rounded-xl border border-(--color-border-light) bg-transparent px-3 py-2 text-xs font-medium text-(--color-text-secondary) no-underline transition"
|
className="hover:bg-background flex items-center gap-1.5 rounded-xl border border-(--color-border-light) bg-transparent px-3 py-2 text-xs font-medium text-(--color-text-secondary) no-underline transition"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-house"></i>
|
<i className="fa-solid fa-house"></i>
|
||||||
Trang chủ
|
Home
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -200,6 +211,7 @@ export default function ManagerPage() {
|
|||||||
{activeTab === "products" && <ProductsTab />}
|
{activeTab === "products" && <ProductsTab />}
|
||||||
{activeTab === "combos" && <CombosTab />}
|
{activeTab === "combos" && <CombosTab />}
|
||||||
{activeTab === "categories" && <CategoriesTab />}
|
{activeTab === "categories" && <CategoriesTab />}
|
||||||
|
{activeTab === "menu-items" && <MenuItemsTab />}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,18 +12,18 @@ import Link from "next/link";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
const MONTH_NAMES = [
|
const MONTH_NAMES = [
|
||||||
"Tháng 1",
|
"January",
|
||||||
"Tháng 2",
|
"February",
|
||||||
"Tháng 3",
|
"March",
|
||||||
"Tháng 4",
|
"April",
|
||||||
"Tháng 5",
|
"May",
|
||||||
"Tháng 6",
|
"June",
|
||||||
"Tháng 7",
|
"July",
|
||||||
"Tháng 8",
|
"August",
|
||||||
"Tháng 9",
|
"September",
|
||||||
"Tháng 10",
|
"October",
|
||||||
"Tháng 11",
|
"November",
|
||||||
"Tháng 12",
|
"December",
|
||||||
];
|
];
|
||||||
|
|
||||||
function getMonday(d: Date): Date {
|
function getMonday(d: Date): Date {
|
||||||
@@ -95,7 +95,7 @@ export default function StaffSchedulePage() {
|
|||||||
<i className="fa-solid fa-calendar-days text-sm text-white"></i>
|
<i className="fa-solid fa-calendar-days text-sm text-white"></i>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-foreground text-sm font-bold">Lịch làm việc</p>
|
<p className="text-foreground text-sm font-bold">Work Schedule</p>
|
||||||
<p className="text-xs text-(--color-text-muted)">
|
<p className="text-xs text-(--color-text-muted)">
|
||||||
{isManager ? "Manager" : "Staff"}
|
{isManager ? "Manager" : "Staff"}
|
||||||
</p>
|
</p>
|
||||||
@@ -105,7 +105,7 @@ export default function StaffSchedulePage() {
|
|||||||
{/* View toggle */}
|
{/* View toggle */}
|
||||||
<nav className="flex-1 space-y-1 p-3">
|
<nav className="flex-1 space-y-1 p-3">
|
||||||
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
||||||
Chế độ xem
|
View
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -117,7 +117,7 @@ export default function StaffSchedulePage() {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-table-columns w-4 text-center"></i>
|
<i className="fa-solid fa-table-columns w-4 text-center"></i>
|
||||||
<span className="flex-1 text-left">Theo tuần</span>
|
<span className="flex-1 text-left">Weekly</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -129,13 +129,13 @@ export default function StaffSchedulePage() {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-calendar w-4 text-center"></i>
|
<i className="fa-solid fa-calendar w-4 text-center"></i>
|
||||||
<span className="flex-1 text-left">Theo tháng</span>
|
<span className="flex-1 text-left">Monthly</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* Quick nav */}
|
{/* Quick nav */}
|
||||||
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
||||||
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
||||||
Điều hướng
|
Navigation
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -143,7 +143,7 @@ export default function StaffSchedulePage() {
|
|||||||
className="hover:bg-background flex w-full cursor-pointer items-center gap-3 rounded-xl border-none bg-transparent px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) transition-all hover:text-(--color-primary-dark)"
|
className="hover:bg-background flex w-full cursor-pointer items-center gap-3 rounded-xl border-none bg-transparent px-3 py-2.5 text-sm font-medium text-(--color-text-secondary) transition-all hover:text-(--color-primary-dark)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-crosshairs w-4 text-center"></i>
|
<i className="fa-solid fa-crosshairs w-4 text-center"></i>
|
||||||
<span className="flex-1 text-left">Hôm nay</span>
|
<span className="flex-1 text-left">Today</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ export default function StaffSchedulePage() {
|
|||||||
{isManager && (
|
{isManager && (
|
||||||
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
||||||
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
<p className="mb-2 px-3 text-[11px] font-semibold tracking-wider text-(--color-text-muted) uppercase">
|
||||||
Quản lý
|
Management
|
||||||
</p>
|
</p>
|
||||||
<Link
|
<Link
|
||||||
href="/manager"
|
href="/manager"
|
||||||
@@ -167,7 +167,7 @@ export default function StaffSchedulePage() {
|
|||||||
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
<div className="mt-3 border-t border-(--color-border-light) pt-3">
|
||||||
<div className="rounded-xl bg-(--color-primary)/5 p-3">
|
<div className="rounded-xl bg-(--color-primary)/5 p-3">
|
||||||
<p className="text-[10px] font-semibold text-(--color-text-muted) uppercase">
|
<p className="text-[10px] font-semibold text-(--color-text-muted) uppercase">
|
||||||
Ngân sách tuần
|
Weekly Budget
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-1 text-lg font-bold text-(--color-primary)">
|
<p className="mt-1 text-lg font-bold text-(--color-primary)">
|
||||||
{weeklyBudget.toLocaleString("vi-VN")}
|
{weeklyBudget.toLocaleString("vi-VN")}
|
||||||
@@ -187,10 +187,10 @@ export default function StaffSchedulePage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="text-foreground truncate text-sm font-semibold">
|
<p className="text-foreground truncate text-sm font-semibold">
|
||||||
{user?.name ?? "Nhân viên"}
|
{user?.name ?? "Staff"}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-(--color-text-muted)">
|
<p className="text-xs text-(--color-text-muted)">
|
||||||
{isManager ? "Quản lý" : "Nhân viên"}
|
{isManager ? "Manager" : "Staff"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -200,7 +200,7 @@ export default function StaffSchedulePage() {
|
|||||||
className="hover:bg-background flex flex-1 items-center justify-center gap-1.5 rounded-xl border border-(--color-border-light) bg-transparent py-2 text-xs font-medium text-(--color-text-secondary) no-underline transition"
|
className="hover:bg-background flex flex-1 items-center justify-center gap-1.5 rounded-xl border border-(--color-border-light) bg-transparent py-2 text-xs font-medium text-(--color-text-secondary) no-underline transition"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-house"></i>
|
<i className="fa-solid fa-house"></i>
|
||||||
Trang chủ
|
Home
|
||||||
</Link>
|
</Link>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -208,7 +208,7 @@ export default function StaffSchedulePage() {
|
|||||||
className="flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-xl border-none bg-transparent py-2 text-xs font-medium text-red-500 transition hover:bg-red-50"
|
className="flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-xl border-none bg-transparent py-2 text-xs font-medium text-red-500 transition hover:bg-red-50"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-right-from-bracket"></i>
|
<i className="fa-solid fa-right-from-bracket"></i>
|
||||||
Đăng xuất
|
Logout
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -220,7 +220,7 @@ export default function StaffSchedulePage() {
|
|||||||
<header className="sticky top-0 z-40 flex items-center justify-between border-b border-(--color-border-light) bg-white px-4 py-3 shadow-sm md:px-5 md:py-4">
|
<header className="sticky top-0 z-40 flex items-center justify-between border-b border-(--color-border-light) bg-white px-4 py-3 shadow-sm md:px-5 md:py-4">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-foreground text-base font-bold md:text-lg">
|
<h1 className="text-foreground text-base font-bold md:text-lg">
|
||||||
Đăng ký ca làm
|
Register Shift
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-xs text-(--color-text-muted)">
|
<p className="text-xs text-(--color-text-muted)">
|
||||||
{view === "week"
|
{view === "week"
|
||||||
@@ -241,7 +241,7 @@ export default function StaffSchedulePage() {
|
|||||||
: "bg-transparent text-(--color-text-secondary)"
|
: "bg-transparent text-(--color-text-secondary)"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Tuần
|
Week
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -252,14 +252,14 @@ export default function StaffSchedulePage() {
|
|||||||
: "bg-transparent text-(--color-text-secondary)"
|
: "bg-transparent text-(--color-text-secondary)"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Tháng
|
Month
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Navigation arrows */}
|
{/* Navigation arrows */}
|
||||||
<div className="hidden items-center gap-1 md:flex">
|
<div className="hidden items-center gap-1 md:flex">
|
||||||
<button
|
<button
|
||||||
title="Về trước"
|
title="Previous"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={view === "week" ? goToPrevWeek : goToPrevMonth}
|
onClick={view === "week" ? goToPrevWeek : goToPrevMonth}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border border-(--color-border-light) bg-transparent text-(--color-text-muted) transition hover:bg-gray-50"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border border-(--color-border-light) bg-transparent text-(--color-text-muted) transition hover:bg-gray-50"
|
||||||
@@ -271,10 +271,10 @@ export default function StaffSchedulePage() {
|
|||||||
onClick={goToToday}
|
onClick={goToToday}
|
||||||
className="cursor-pointer rounded-lg border border-(--color-border-light) bg-transparent px-3 py-1.5 text-xs font-medium text-(--color-text-secondary) transition hover:bg-gray-50"
|
className="cursor-pointer rounded-lg border border-(--color-border-light) bg-transparent px-3 py-1.5 text-xs font-medium text-(--color-text-secondary) transition hover:bg-gray-50"
|
||||||
>
|
>
|
||||||
Hôm nay
|
Today
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
title="Tiếp theo"
|
title="Next"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={view === "week" ? goToNextWeek : goToNextMonth}
|
onClick={view === "week" ? goToNextWeek : goToNextMonth}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border border-(--color-border-light) bg-transparent text-(--color-text-muted) transition hover:bg-gray-50"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border border-(--color-border-light) bg-transparent text-(--color-text-muted) transition hover:bg-gray-50"
|
||||||
@@ -294,14 +294,14 @@ export default function StaffSchedulePage() {
|
|||||||
className="hidden cursor-pointer items-center gap-1.5 rounded-xl border-none bg-(--color-primary) px-3 py-2 text-xs font-semibold text-white transition hover:opacity-90 md:flex"
|
className="hidden cursor-pointer items-center gap-1.5 rounded-xl border-none bg-(--color-primary) px-3 py-2 text-xs font-semibold text-white transition hover:opacity-90 md:flex"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-plus"></i>
|
<i className="fa-solid fa-plus"></i>
|
||||||
Tạo ca
|
Create Shift
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Mobile nav */}
|
{/* Mobile nav */}
|
||||||
<div className="flex items-center gap-1 md:hidden">
|
<div className="flex items-center gap-1 md:hidden">
|
||||||
<button
|
<button
|
||||||
title="Về trước"
|
title="Previous"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={view === "week" ? goToPrevWeek : goToPrevMonth}
|
onClick={view === "week" ? goToPrevWeek : goToPrevMonth}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-none bg-transparent text-(--color-text-muted)"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-none bg-transparent text-(--color-text-muted)"
|
||||||
@@ -309,7 +309,7 @@ export default function StaffSchedulePage() {
|
|||||||
<i className="fa-solid fa-chevron-left text-xs"></i>
|
<i className="fa-solid fa-chevron-left text-xs"></i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
title="Tiếp theo"
|
title="Next"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={view === "week" ? goToNextWeek : goToNextMonth}
|
onClick={view === "week" ? goToNextWeek : goToNextMonth}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-none bg-transparent text-(--color-text-muted)"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-none bg-transparent text-(--color-text-muted)"
|
||||||
@@ -353,7 +353,7 @@ export default function StaffSchedulePage() {
|
|||||||
{/* Mobile FAB for manager */}
|
{/* Mobile FAB for manager */}
|
||||||
{isManager && (
|
{isManager && (
|
||||||
<button
|
<button
|
||||||
title="Tạo ca"
|
title="Create Shift"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCreateDate(undefined);
|
setCreateDate(undefined);
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import type { BadgeProps } from "./Badge.types";
|
|
||||||
|
|
||||||
export default function Badge({
|
|
||||||
variant = "primary",
|
|
||||||
size = "md",
|
|
||||||
children,
|
|
||||||
className = "",
|
|
||||||
...props
|
|
||||||
}: BadgeProps) {
|
|
||||||
const variants = {
|
|
||||||
primary: "bg-(--color-primary) text-white",
|
|
||||||
secondary: "bg-(--color-border-light) text-(--color-text-secondary)",
|
|
||||||
success: "bg-green-100 text-green-700",
|
|
||||||
danger: "bg-red-100 text-red-700",
|
|
||||||
warning: "bg-yellow-100 text-yellow-700",
|
|
||||||
};
|
|
||||||
|
|
||||||
const sizes = {
|
|
||||||
sm: "px-2 py-1 text-xs",
|
|
||||||
md: "px-3 py-1.5 text-sm",
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
className={`inline-flex items-center justify-center rounded-full font-semibold ${variants[variant]} ${sizes[size]} ${className}`}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { HTMLAttributes } from "react";
|
|
||||||
|
|
||||||
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
||||||
variant?: "primary" | "secondary" | "success" | "danger" | "warning";
|
|
||||||
size?: "sm" | "md";
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import { HTMLAttributes } from "react";
|
|
||||||
|
|
||||||
export interface PriceBadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
||||||
price: number;
|
|
||||||
currency?: string;
|
|
||||||
className?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function PriceBadge({
|
|
||||||
price,
|
|
||||||
currency = "VND",
|
|
||||||
className = "",
|
|
||||||
...props
|
|
||||||
}: PriceBadgeProps) {
|
|
||||||
const formattedPrice =
|
|
||||||
currency === "VND"
|
|
||||||
? price.toLocaleString("vi-VN", {
|
|
||||||
style: "currency",
|
|
||||||
currency: "VND",
|
|
||||||
})
|
|
||||||
: `${price.toFixed(2)} ${currency}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
className={`text-sm font-bold text-(--color-primary) ${className}`}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{formattedPrice}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export { default as Badge } from "./Badge";
|
|
||||||
export { default as PriceBadge } from "./PriceBadge";
|
|
||||||
export type { BadgeProps } from "./Badge.types";
|
|
||||||
export type { PriceBadgeProps } from "./PriceBadge";
|
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import type { ButtonProps } from "./Button.types";
|
|
||||||
|
|
||||||
export default function IconButton({
|
|
||||||
variant = "primary",
|
|
||||||
size = "md",
|
|
||||||
icon,
|
|
||||||
disabled = false,
|
|
||||||
className = "",
|
|
||||||
children,
|
|
||||||
style: _style,
|
|
||||||
...props
|
|
||||||
}: ButtonProps) {
|
|
||||||
const baseStyles =
|
|
||||||
"font-semibold rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center";
|
|
||||||
|
|
||||||
const variants: Record<NonNullable<ButtonProps["variant"]>, string> = {
|
|
||||||
primary:
|
|
||||||
"bg-(--color-primary) text-white hover:bg-(--color-primary-dark) active:scale-95",
|
|
||||||
secondary:
|
|
||||||
"border border-(--color-border) hover:bg-(--color-border-light) active:scale-95",
|
|
||||||
danger: "bg-red-500 text-white hover:bg-red-600 active:scale-95",
|
|
||||||
ghost: "bg-transparent hover:bg-(--color-border-light) active:scale-95",
|
|
||||||
primaryNoBorder:
|
|
||||||
"bg-(--color-primary) text-white hover:bg-(--color-primary-dark) active:scale-95",
|
|
||||||
bgWhite:
|
|
||||||
"bg-white text-(--color-text-primary) hover:bg-gray-100 active:scale-95",
|
|
||||||
};
|
|
||||||
|
|
||||||
const sizes = {
|
|
||||||
sm: "h-8 w-8 text-sm",
|
|
||||||
md: "h-10 w-10 text-base",
|
|
||||||
lg: "h-12 w-12 text-lg",
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${className}`}
|
|
||||||
disabled={disabled}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{icon ? <i className={`fa-solid ${icon}`}></i> : children}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -3,17 +3,13 @@ export { Button } from "./buttons";
|
|||||||
export type { ButtonProps } from "./buttons";
|
export type { ButtonProps } from "./buttons";
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
export { TextInput, SearchInput, Textarea } from "./inputs";
|
export { TextInput, Textarea } from "./inputs";
|
||||||
export type { TextInputProps, SearchInputProps, TextareaProps } from "./inputs";
|
export type { TextInputProps, TextareaProps } from "./inputs";
|
||||||
|
|
||||||
// Typography
|
// Typography
|
||||||
export { Heading, Text, Caption } from "./typography";
|
export { Heading, Text, Caption } from "./typography";
|
||||||
export type { HeadingProps, TextProps, CaptionProps } from "./typography";
|
export type { HeadingProps, TextProps, CaptionProps } from "./typography";
|
||||||
|
|
||||||
// Badges
|
|
||||||
export { Badge, PriceBadge } from "./badges";
|
|
||||||
export type { BadgeProps } from "./badges";
|
|
||||||
|
|
||||||
// Dividers
|
// Dividers
|
||||||
export { Divider } from "./dividers";
|
export { Divider } from "./dividers";
|
||||||
export type { DividerProps } from "./dividers";
|
export type { DividerProps } from "./dividers";
|
||||||
|
|||||||
@@ -13,17 +13,3 @@ export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
|
|||||||
error?: string;
|
error?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
||||||
onClear?: () => void;
|
|
||||||
className?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoginInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
||||||
label: string;
|
|
||||||
type: string;
|
|
||||||
name: string;
|
|
||||||
value: string;
|
|
||||||
errors?: string;
|
|
||||||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
import { useState } from "react";
|
|
||||||
|
|
||||||
import { LoginInputProps } from "./Input.types";
|
|
||||||
|
|
||||||
export default function LoginInput({
|
|
||||||
label,
|
|
||||||
type,
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
errors,
|
|
||||||
onChange,
|
|
||||||
...restProps
|
|
||||||
}: LoginInputProps) {
|
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
|
||||||
|
|
||||||
function isPassword() {
|
|
||||||
if (type === "password") {
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setShowPassword(!showPassword)}
|
|
||||||
className="absolute top-1/2 right-4 -translate-y-1/2 text-(--color-text-muted) transition-colors hover:text-(--color-primary)"
|
|
||||||
aria-label={showPassword ? "Ẩn mật khẩu" : "Hiện mật khẩu"}
|
|
||||||
>
|
|
||||||
<i
|
|
||||||
className={`fa-solid ${showPassword ? "fa-eye-slash" : "fa-eye"}`}
|
|
||||||
></i>
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<label
|
|
||||||
htmlFor={name}
|
|
||||||
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</label>
|
|
||||||
<div className="relative">
|
|
||||||
<i className="fa-solid fa-user absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
|
||||||
<input
|
|
||||||
id={name}
|
|
||||||
type={showPassword ? "text" : type}
|
|
||||||
value={value}
|
|
||||||
onChange={onChange}
|
|
||||||
placeholder={
|
|
||||||
type === "password"
|
|
||||||
? "Mật khẩu"
|
|
||||||
: "admin / số điện thoại / tên nhân viên"
|
|
||||||
}
|
|
||||||
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-10 py-3 transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) lg:pl-11 ${errors ? "border-red-400" : "border-(--color-border)"} `}
|
|
||||||
/>
|
|
||||||
{isPassword()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import type { SearchInputProps } from "./Input.types";
|
|
||||||
|
|
||||||
export default function SearchInput({
|
|
||||||
value,
|
|
||||||
onChange,
|
|
||||||
onClear,
|
|
||||||
className = "",
|
|
||||||
...props
|
|
||||||
}: SearchInputProps) {
|
|
||||||
return (
|
|
||||||
<div className="relative w-full">
|
|
||||||
<i className="fa-solid fa-magnifying-glass pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-sm text-(--color-text-muted)"></i>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={value}
|
|
||||||
onChange={onChange}
|
|
||||||
className={`w-full rounded-lg border border-(--color-border) bg-transparent py-2 pr-9 pl-9 text-sm transition-all duration-150 placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)/20 focus:outline-none ${className}`}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
{value && onClear && (
|
|
||||||
<button
|
|
||||||
title="Xóa"
|
|
||||||
type="button"
|
|
||||||
onClick={onClear}
|
|
||||||
className="absolute top-1/2 right-3 -translate-y-1/2 text-(--color-text-muted) transition-colors hover:text-(--color-primary)"
|
|
||||||
aria-label="Xóa"
|
|
||||||
>
|
|
||||||
<i className="fa-solid fa-xmark text-sm"></i>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,3 @@
|
|||||||
export { default as TextInput } from "./TextInput";
|
export { default as TextInput } from "./TextInput";
|
||||||
export { default as SearchInput } from "./SearchInput";
|
|
||||||
export { default as Textarea } from "./Textarea";
|
export { default as Textarea } from "./Textarea";
|
||||||
export type {
|
export type { TextInputProps, TextareaProps } from "./Input.types";
|
||||||
TextInputProps,
|
|
||||||
SearchInputProps,
|
|
||||||
TextareaProps,
|
|
||||||
LoginInputProps,
|
|
||||||
} from "./Input.types";
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ export default function PaymentSummaryCard({
|
|||||||
return (
|
return (
|
||||||
<aside className="shrink-0 xl:w-85">
|
<aside className="shrink-0 xl:w-85">
|
||||||
<div className="bg-card sticky top-[calc(var(--spacing-header-height)+1rem)] rounded-2xl border border-(--color-border-light) p-4 md:p-5">
|
<div className="bg-card sticky top-[calc(var(--spacing-header-height)+1rem)] rounded-2xl border border-(--color-border-light) p-4 md:p-5">
|
||||||
<h2 className="mb-4 text-lg font-bold">Hóa đơn</h2>
|
<h2 className="mb-4 text-lg font-bold">Bill</h2>
|
||||||
|
|
||||||
<div className="flex items-center justify-between border-b border-(--color-border-light) pb-4">
|
<div className="flex items-center justify-between border-b border-(--color-border-light) pb-4">
|
||||||
<span className="text-(--color-text-muted)">Tổng cộng</span>
|
<span className="text-(--color-text-muted)">Total</span>
|
||||||
<span className="text-xl font-bold text-(--color-primary)">
|
<span className="text-xl font-bold text-(--color-primary)">
|
||||||
{formatPrice(totalPrice)}
|
{formatPrice(totalPrice)}
|
||||||
</span>
|
</span>
|
||||||
@@ -40,7 +40,7 @@ export default function PaymentSummaryCard({
|
|||||||
size="md"
|
size="md"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
>
|
>
|
||||||
Tiền mặt
|
Cash
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -61,7 +61,7 @@ export default function PaymentSummaryCard({
|
|||||||
size="md"
|
size="md"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
>
|
>
|
||||||
Đánh giá
|
Review
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ export default function PaymentSummaryCard({
|
|||||||
variant="secondary"
|
variant="secondary"
|
||||||
className="w-full"
|
className="w-full"
|
||||||
>
|
>
|
||||||
Quay về
|
Return
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default function ProductCard({
|
|||||||
icon="fa-cart-plus"
|
icon="fa-cart-plus"
|
||||||
aria-label={`Mua ${productName}`}
|
aria-label={`Mua ${productName}`}
|
||||||
>
|
>
|
||||||
Mua
|
Buy
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function ShopCard({ name, address, image }: ShopCardProps) {
|
|||||||
className="inline-flex shrink-0 items-center gap-1.5 rounded-xl bg-(--color-primary) px-3.5 py-2 text-xs font-semibold text-white no-underline transition-all duration-150 hover:bg-(--color-primary-dark) active:scale-95"
|
className="inline-flex shrink-0 items-center gap-1.5 rounded-xl bg-(--color-primary) px-3.5 py-2 text-xs font-semibold text-white no-underline transition-all duration-150 hover:bg-(--color-primary-dark) active:scale-95"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-book-open text-[10px]"></i>
|
<i className="fa-solid fa-book-open text-[10px]"></i>
|
||||||
Xem menu
|
View menu
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,122 +1,122 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
import Button from "@/components/atoms/buttons/Button";
|
import Button from "@/components/atoms/buttons/Button";
|
||||||
import ErrorMessageLogin from "@/components/atoms/errors/ErrorMessageLogin";
|
import ErrorMessageLogin from "@/components/atoms/errors/ErrorMessageLogin";
|
||||||
import LoginInput from "@/components/atoms/inputs/LoginInput";
|
|
||||||
import { useAuth } from "@/lib/auth-context";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { SubmitEvent, useState } from "react";
|
import { FormEvent, useState } from "react";
|
||||||
|
|
||||||
|
const PHONE_REGEX = /^(0[35789])[0-9]{8}$/;
|
||||||
|
|
||||||
export default function LoginForm() {
|
export default function LoginForm() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { login } = useAuth();
|
|
||||||
|
|
||||||
const [username, setUsername] = useState("");
|
const [phone, setPhone] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [errors, setErrors] = useState({
|
const [errors, setErrors] = useState({ phone: "", general: "" });
|
||||||
username: "",
|
|
||||||
password: "",
|
|
||||||
general: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const validate = (): boolean => {
|
const validate = (): boolean => {
|
||||||
const newErrors = { username: "", password: "", general: "" };
|
if (!phone.trim()) {
|
||||||
let isValid = true;
|
setErrors({ phone: "Please enter your phone number", general: "" });
|
||||||
|
return false;
|
||||||
if (!username.trim()) {
|
|
||||||
newErrors.username = "Vui lòng nhập tên đăng nhập";
|
|
||||||
isValid = false;
|
|
||||||
}
|
}
|
||||||
|
if (!PHONE_REGEX.test(phone)) {
|
||||||
if (!password.trim()) {
|
setErrors({ phone: "Invalid phone number (e.g. 0987654321)", general: "" });
|
||||||
newErrors.password = "Vui lòng nhập mật khẩu";
|
return false;
|
||||||
isValid = false;
|
|
||||||
} else if (password.length < 4) {
|
|
||||||
newErrors.password = "Mật khẩu phải có ít nhất 4 ký tự";
|
|
||||||
isValid = false;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
setErrors(newErrors);
|
|
||||||
return isValid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async (e: SubmitEvent<HTMLFormElement>) => {
|
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!validate()) return;
|
if (!validate()) return;
|
||||||
|
|
||||||
const success = await login(username, password);
|
setIsLoading(true);
|
||||||
|
setErrors({ phone: "", general: "" });
|
||||||
|
|
||||||
if (success) {
|
try {
|
||||||
router.push("/");
|
const res = await fetch("/api/sms_otp", {
|
||||||
} else {
|
method: "POST",
|
||||||
setErrors({
|
headers: { "Content-Type": "application/json" },
|
||||||
username: "",
|
body: JSON.stringify({ phone }),
|
||||||
password: "",
|
|
||||||
general: "Tên đăng nhập hoặc mật khẩu không đúng",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const role = (await res.text().catch(() => "")).trim();
|
||||||
|
|
||||||
|
if (res.ok && (role === "customer" || role === "manager")) {
|
||||||
|
sessionStorage.setItem("login_phone", phone);
|
||||||
|
sessionStorage.setItem("login_role", role);
|
||||||
|
router.push(role === "manager" ? "/login/password" : "/login/otp");
|
||||||
|
} else if (res.status === 404) {
|
||||||
|
setErrors({ phone: "", general: "Phone number not registered" });
|
||||||
|
} else {
|
||||||
|
setErrors({ phone: "", general: "An error occurred, please try again" });
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
setErrors({ phone: "", general: "Unable to connect, please try again" });
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* Error Message */}
|
|
||||||
{errors.general && <ErrorMessageLogin message={errors.general} />}
|
{errors.general && <ErrorMessageLogin message={errors.general} />}
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-5">
|
<form onSubmit={handleSubmit} className="space-y-5">
|
||||||
<div>
|
<div>
|
||||||
{/* Username Input */}
|
<label
|
||||||
<LoginInput
|
htmlFor="phone"
|
||||||
label="Tên đăng nhập"
|
className="mb-2 block text-sm font-medium text-(--color-text-secondary)"
|
||||||
type="text"
|
>
|
||||||
name="username"
|
Phone number
|
||||||
value={username}
|
</label>
|
||||||
onChange={(e) => {
|
<div className="relative">
|
||||||
setUsername(e.target.value);
|
<i className="fa-solid fa-phone absolute top-1/2 left-4 hidden -translate-y-1/2 text-(--color-text-muted) lg:block"></i>
|
||||||
setErrors({ ...errors, username: "", general: "" });
|
<input
|
||||||
}}
|
id="phone"
|
||||||
errors={errors.username}
|
type="tel"
|
||||||
/>
|
value={phone}
|
||||||
{errors.username && (
|
onChange={(e) => {
|
||||||
<ErrorMessageLogin message={errors.username} type="secondary" />
|
setPhone(e.target.value);
|
||||||
|
setErrors({ phone: "", general: "" });
|
||||||
|
}}
|
||||||
|
placeholder="0987654321"
|
||||||
|
disabled={isLoading}
|
||||||
|
className={`text-foreground focus:ring-opacity-20 w-full rounded-xl border bg-white px-10 py-3 transition-all duration-150 outline-none placeholder:text-(--color-text-muted) focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary) disabled:opacity-60 lg:pl-11 ${errors.phone ? "border-red-400" : "border-(--color-border)"}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{errors.phone && (
|
||||||
|
<ErrorMessageLogin message={errors.phone} type="secondary" />
|
||||||
)}
|
)}
|
||||||
|
<p className="mt-2 text-xs text-(--color-text-muted)">
|
||||||
|
Enter a Vietnamese phone number (10 digits, starting with 0)
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Password Input */}
|
|
||||||
<div>
|
|
||||||
<LoginInput
|
|
||||||
label="Mật khẩu"
|
|
||||||
type="password"
|
|
||||||
name="password"
|
|
||||||
value={password}
|
|
||||||
onChange={(e) => {
|
|
||||||
setPassword(e.target.value);
|
|
||||||
setErrors({ ...errors, password: "", general: "" });
|
|
||||||
}}
|
|
||||||
errors={errors.password}
|
|
||||||
/>
|
|
||||||
{errors.password && (
|
|
||||||
<ErrorMessageLogin message={errors.password} type="secondary" />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Buttons */}
|
|
||||||
<div className="space-y-3 pt-2">
|
<div className="space-y-3 pt-2">
|
||||||
{/* Login Button */}
|
|
||||||
<Button
|
<Button
|
||||||
variant="primaryNoBorder"
|
variant="primaryNoBorder"
|
||||||
type="submit"
|
type="submit"
|
||||||
style="login"
|
style="login"
|
||||||
size="lg"
|
size="lg"
|
||||||
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
Đăng nhập
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner fa-spin mr-2"></i>
|
||||||
|
Processing...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Continue"
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Register Button */}
|
|
||||||
<Link
|
<Link
|
||||||
href="/register"
|
href="/register"
|
||||||
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) no-underline transition-all duration-150 hover:bg-(--color-primary) hover:text-white active:scale-98"
|
className="flex w-full items-center justify-center rounded-xl border-2 border-(--color-primary) bg-white py-3 font-semibold text-(--color-primary) no-underline transition-all duration-150 hover:bg-(--color-primary) hover:text-white active:scale-98"
|
||||||
>
|
>
|
||||||
Đăng ký tài khoản
|
Create account
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ export default function CategoriesTab() {
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<p className="text-sm text-(--color-text-muted)">
|
<p className="text-sm text-(--color-text-muted)">
|
||||||
<strong className="text-foreground">{categories.length}</strong> danh
|
<strong className="text-foreground">{categories.length}</strong>{" "}
|
||||||
mục
|
categories
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
onClick={() => setModalCategory("new")}
|
onClick={() => setModalCategory("new")}
|
||||||
className="flex cursor-pointer items-center gap-2 rounded-xl border-none bg-(--color-primary) px-4 py-2 text-sm font-semibold text-white transition hover:bg-(--color-primary-dark) active:scale-95"
|
className="flex cursor-pointer items-center gap-2 rounded-xl border-none bg-(--color-primary) px-4 py-2 text-sm font-semibold text-white transition hover:bg-(--color-primary-dark) active:scale-95"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-plus"></i>
|
<i className="fa-solid fa-plus"></i>
|
||||||
<span className="hidden sm:inline">Thêm danh mục</span>
|
<span className="hidden sm:inline">Add category</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -50,19 +50,19 @@ export default function CategoriesTab() {
|
|||||||
<p className="text-foreground truncate font-semibold">
|
<p className="text-foreground truncate font-semibold">
|
||||||
{cat.name}
|
{cat.name}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-(--color-text-muted)">{count} món</p>
|
<p className="text-xs text-(--color-text-muted)">{count} items</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-1 opacity-0 transition-opacity group-hover:opacity-100">
|
<div className="flex flex-col gap-1 opacity-0 transition-opacity group-hover:opacity-100">
|
||||||
<button
|
<button
|
||||||
onClick={() => setModalCategory(cat)}
|
onClick={() => setModalCategory(cat)}
|
||||||
title="Chỉnh sửa"
|
title="Edit"
|
||||||
className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-lg border border-(--color-border-light) bg-transparent text-(--color-text-muted) transition hover:border-(--color-primary-light) hover:text-(--color-primary)"
|
className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-lg border border-(--color-border-light) bg-transparent text-(--color-text-muted) transition hover:border-(--color-primary-light) hover:text-(--color-primary)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-pen text-[11px]"></i>
|
<i className="fa-solid fa-pen text-[11px]"></i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setDeleteTarget(cat)}
|
onClick={() => setDeleteTarget(cat)}
|
||||||
title="Xóa"
|
title="Delete"
|
||||||
className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-lg border border-transparent bg-transparent text-(--color-text-muted) transition hover:border-red-200 hover:bg-red-50 hover:text-red-500"
|
className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-lg border border-transparent bg-transparent text-(--color-text-muted) transition hover:border-red-200 hover:bg-red-50 hover:text-red-500"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-trash text-[11px]"></i>
|
<i className="fa-solid fa-trash text-[11px]"></i>
|
||||||
@@ -75,7 +75,7 @@ export default function CategoriesTab() {
|
|||||||
{categories.length === 0 && (
|
{categories.length === 0 && (
|
||||||
<div className="col-span-full flex flex-col items-center gap-3 py-16 text-(--color-text-muted)">
|
<div className="col-span-full flex flex-col items-center gap-3 py-16 text-(--color-text-muted)">
|
||||||
<i className="fa-solid fa-tag text-4xl opacity-30"></i>
|
<i className="fa-solid fa-tag text-4xl opacity-30"></i>
|
||||||
<p className="text-sm">Chưa có danh mục nào</p>
|
<p className="text-sm">No categories yet</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function CategoryModal({
|
|||||||
<div className="w-full max-w-md rounded-2xl bg-white shadow-2xl">
|
<div className="w-full max-w-md rounded-2xl bg-white shadow-2xl">
|
||||||
<div className="flex items-center justify-between border-b border-(--color-border-light) px-6 py-4">
|
<div className="flex items-center justify-between border-b border-(--color-border-light) px-6 py-4">
|
||||||
<h2 className="text-foreground text-lg font-bold">
|
<h2 className="text-foreground text-lg font-bold">
|
||||||
{isEdit ? "Chỉnh sửa danh mục" : "Thêm danh mục mới"}
|
{isEdit ? "Edit category" : "Add new category"}
|
||||||
</h2>
|
</h2>
|
||||||
<button
|
<button
|
||||||
title="Close"
|
title="Close"
|
||||||
@@ -66,7 +66,7 @@ export default function CategoryModal({
|
|||||||
<form onSubmit={handleSubmit} className="space-y-4 px-6 py-5">
|
<form onSubmit={handleSubmit} className="space-y-4 px-6 py-5">
|
||||||
<div>
|
<div>
|
||||||
<label className="mb-1 block text-sm font-medium text-(--color-text-secondary)">
|
<label className="mb-1 block text-sm font-medium text-(--color-text-secondary)">
|
||||||
Tên danh mục <span className="text-red-500">*</span>
|
Category name <span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
required
|
required
|
||||||
@@ -74,7 +74,7 @@ export default function CategoryModal({
|
|||||||
value={form.name}
|
value={form.name}
|
||||||
onChange={(e) => setForm({ ...form, name: e.target.value })}
|
onChange={(e) => setForm({ ...form, name: e.target.value })}
|
||||||
className="text-foreground w-full rounded-xl border border-(--color-border) bg-white px-3 py-2 text-sm transition outline-none focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)/20"
|
className="text-foreground w-full rounded-xl border border-(--color-border) bg-white px-3 py-2 text-sm transition outline-none focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)/20"
|
||||||
placeholder="Ví dụ: Cà Phê"
|
placeholder="e.g. Coffee"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,265 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useAuth } from "@/lib/auth-context";
|
||||||
|
import { addManagerMenuItem, gqlFetch } from "@/lib/graphql";
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
interface MenuItem {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Eatery {
|
||||||
|
id: string;
|
||||||
|
ownerId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatPrice(price: number) {
|
||||||
|
return price.toLocaleString("vi-VN") + "đ";
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function MenuItemsTab() {
|
||||||
|
const { user } = useAuth();
|
||||||
|
const [eateryId, setEateryId] = useState<string | null>(null);
|
||||||
|
const [menuItems, setMenuItems] = useState<MenuItem[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const [showForm, setShowForm] = useState(false);
|
||||||
|
const [newName, setNewName] = useState("");
|
||||||
|
const [newPrice, setNewPrice] = useState("");
|
||||||
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
const [submitError, setSubmitError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const loadEateryId = useCallback(async (): Promise<string | null> => {
|
||||||
|
if (!user) return null;
|
||||||
|
const data = await gqlFetch<{ allEateries: Eatery[] }>(
|
||||||
|
"{ allEateries { id ownerId } }",
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
data.allEateries.find((e) => e.ownerId === String(user.id))?.id ?? null
|
||||||
|
);
|
||||||
|
}, [user]);
|
||||||
|
|
||||||
|
const loadMenuItems = useCallback(async (id: string): Promise<MenuItem[]> => {
|
||||||
|
const data = await gqlFetch<{ menuItemsByEatery: MenuItem[] }>(
|
||||||
|
`query($eateryId: String!) {
|
||||||
|
menuItemsByEatery(eateryId: $eateryId) { id name price }
|
||||||
|
}`,
|
||||||
|
{ eateryId: id },
|
||||||
|
);
|
||||||
|
return data.menuItemsByEatery ?? [];
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function init() {
|
||||||
|
setLoading(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const id = await loadEateryId();
|
||||||
|
setEateryId(id);
|
||||||
|
if (id) setMenuItems(await loadMenuItems(id));
|
||||||
|
else setMenuItems([]);
|
||||||
|
} catch {
|
||||||
|
setError("Không thể tải dữ liệu menu. Kiểm tra kết nối backend.");
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
}, [loadEateryId, loadMenuItems]);
|
||||||
|
|
||||||
|
const handleAdd = async (e: React.FormEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (!newName.trim() || !newPrice) return;
|
||||||
|
setSubmitting(true);
|
||||||
|
setSubmitError(null);
|
||||||
|
try {
|
||||||
|
const added = await addManagerMenuItem(newName.trim(), parseFloat(newPrice));
|
||||||
|
if (added) setMenuItems((prev) => [...prev, added]);
|
||||||
|
setNewName("");
|
||||||
|
setNewPrice("");
|
||||||
|
setShowForm(false);
|
||||||
|
} catch {
|
||||||
|
setSubmitError("Không thể thêm món. Vui lòng thử lại.");
|
||||||
|
} finally {
|
||||||
|
setSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeForm = () => {
|
||||||
|
setShowForm(false);
|
||||||
|
setSubmitError(null);
|
||||||
|
setNewName("");
|
||||||
|
setNewPrice("");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-center py-16 text-(--color-text-muted)">
|
||||||
|
<i className="fa-solid fa-spinner mr-2 animate-spin"></i>
|
||||||
|
Đang tải menu...
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center justify-center py-16 text-red-500">
|
||||||
|
<i className="fa-solid fa-circle-exclamation mb-2 text-2xl"></i>
|
||||||
|
<p className="text-sm">{error}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eateryId) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center justify-center py-16 text-(--color-text-muted)">
|
||||||
|
<i className="fa-solid fa-store mb-2 block text-3xl opacity-30"></i>
|
||||||
|
<p className="text-sm">Quán của bạn chưa được khởi tạo trong hệ thống.</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
{/* Toolbar */}
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<p className="text-sm text-(--color-text-muted)">
|
||||||
|
<strong className="text-foreground">{menuItems.length}</strong> món trong menu
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
onClick={() => setShowForm(true)}
|
||||||
|
className="flex cursor-pointer items-center gap-2 rounded-xl border-none bg-(--color-primary) px-4 py-2 text-sm font-semibold text-white transition hover:bg-(--color-primary-dark) active:scale-95"
|
||||||
|
>
|
||||||
|
<i className="fa-solid fa-plus"></i>
|
||||||
|
<span className="hidden sm:inline">Thêm món</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Table */}
|
||||||
|
<div className="overflow-x-auto rounded-2xl border border-(--color-border-light) bg-white shadow-sm">
|
||||||
|
<table className="min-w-full divide-y divide-(--color-border-light) text-sm">
|
||||||
|
<thead className="bg-background">
|
||||||
|
<tr>
|
||||||
|
<th className="px-4 py-3 text-left font-semibold text-(--color-text-secondary)">
|
||||||
|
Tên món
|
||||||
|
</th>
|
||||||
|
<th className="px-4 py-3 text-right font-semibold text-(--color-text-secondary)">
|
||||||
|
Giá
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-(--color-border-light)">
|
||||||
|
{menuItems.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
colSpan={2}
|
||||||
|
className="py-12 text-center text-(--color-text-muted)"
|
||||||
|
>
|
||||||
|
<i className="fa-solid fa-bowl-food mb-2 block text-3xl opacity-30"></i>
|
||||||
|
Chưa có món nào trong menu
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
menuItems.map((item) => (
|
||||||
|
<tr
|
||||||
|
key={item.id}
|
||||||
|
className="hover:bg-background transition-colors"
|
||||||
|
>
|
||||||
|
<td className="px-4 py-3">
|
||||||
|
<p className="text-foreground font-medium">{item.name}</p>
|
||||||
|
</td>
|
||||||
|
<td className="px-4 py-3 text-right font-semibold text-(--color-primary)">
|
||||||
|
{formatPrice(item.price)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Add Item Modal */}
|
||||||
|
{showForm && (
|
||||||
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm">
|
||||||
|
<div className="w-full max-w-sm rounded-2xl bg-white p-6 shadow-lg">
|
||||||
|
<div className="mb-4 flex items-center justify-between">
|
||||||
|
<h2 className="text-foreground font-bold">Thêm món mới</h2>
|
||||||
|
<button
|
||||||
|
onClick={closeForm}
|
||||||
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-none bg-transparent text-(--color-text-muted) hover:text-(--color-primary)"
|
||||||
|
>
|
||||||
|
<i className="fa-solid fa-xmark"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form onSubmit={handleAdd} className="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label className="mb-1.5 block text-sm font-medium text-(--color-text-secondary)">
|
||||||
|
Tên món <span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={newName}
|
||||||
|
onChange={(e) => setNewName(e.target.value)}
|
||||||
|
placeholder="Nhập tên món..."
|
||||||
|
required
|
||||||
|
className="text-foreground w-full rounded-xl border border-(--color-border) bg-white px-3 py-2 text-sm outline-none transition focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)/20"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="mb-1.5 block text-sm font-medium text-(--color-text-secondary)">
|
||||||
|
Giá (VNĐ) <span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
value={newPrice}
|
||||||
|
onChange={(e) => setNewPrice(e.target.value)}
|
||||||
|
placeholder="Nhập giá..."
|
||||||
|
required
|
||||||
|
min={0}
|
||||||
|
step={500}
|
||||||
|
className="text-foreground w-full rounded-xl border border-(--color-border) bg-white px-3 py-2 text-sm outline-none transition focus:border-(--color-primary) focus:ring-2 focus:ring-(--color-primary)/20"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{submitError && (
|
||||||
|
<p className="text-sm text-red-500">
|
||||||
|
<i className="fa-solid fa-circle-exclamation mr-1"></i>
|
||||||
|
{submitError}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex gap-2 pt-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={closeForm}
|
||||||
|
className="flex-1 cursor-pointer rounded-xl border border-(--color-border-light) bg-transparent py-2 text-sm font-medium text-(--color-text-secondary) transition hover:bg-background"
|
||||||
|
>
|
||||||
|
Hủy
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={submitting}
|
||||||
|
className="flex-1 cursor-pointer rounded-xl border-none bg-(--color-primary) py-2 text-sm font-semibold text-white transition hover:bg-(--color-primary-dark) disabled:opacity-60"
|
||||||
|
>
|
||||||
|
{submitting ? (
|
||||||
|
<>
|
||||||
|
<i className="fa-solid fa-spinner mr-1 animate-spin"></i>
|
||||||
|
Đang lưu...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Thêm món"
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ export default function StatusBadge({ available }: StatusBadgeProps) {
|
|||||||
available ? "bg-emerald-500" : "bg-amber-500"
|
available ? "bg-emerald-500" : "bg-amber-500"
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
{available ? "Còn hàng" : "Tạm hết"}
|
{available ? "In stock" : "Out of stock"}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export { default as ComboModal } from "./ComboModal";
|
|||||||
export { default as ProductsTab } from "./ProductsTab";
|
export { default as ProductsTab } from "./ProductsTab";
|
||||||
export { default as CategoriesTab } from "./CategoriesTab";
|
export { default as CategoriesTab } from "./CategoriesTab";
|
||||||
export { default as CombosTab } from "./CombosTab";
|
export { default as CombosTab } from "./CombosTab";
|
||||||
|
export { default as MenuItemsTab } from "./MenuItemsTab";
|
||||||
export type {
|
export type {
|
||||||
ProductModalProps,
|
ProductModalProps,
|
||||||
CategoryModalProps,
|
CategoryModalProps,
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
<i className="fa-solid fa-heart text-(--color-accent)"></i>
|
<i className="fa-solid fa-heart text-(--color-accent)"></i>
|
||||||
</div>
|
</div>
|
||||||
<Heading level={2} id="review-modal-title">
|
<Heading level={2} id="review-modal-title">
|
||||||
Cảm ơn quý khách
|
Thank you
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text variant="body2" className="mt-2">
|
<Text variant="body2" className="mt-2">
|
||||||
Chúng tôi trân trọng đánh giá của bạn!
|
We appreciate your feedback!
|
||||||
</Text>
|
</Text>
|
||||||
<Button onClick={handleClose} variant="primary" className="mt-4">
|
<Button onClick={handleClose} variant="primary" className="mt-4">
|
||||||
Đóng
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -65,21 +65,21 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
id="review-modal-title"
|
id="review-modal-title"
|
||||||
className="text-foreground mb-1 text-xl font-bold"
|
className="text-foreground mb-1 text-xl font-bold"
|
||||||
>
|
>
|
||||||
Đánh giá của bạn
|
Your Review
|
||||||
</h2>
|
</h2>
|
||||||
<p className="mb-5 text-sm text-(--color-text-muted)">
|
<p className="mb-5 text-sm text-(--color-text-muted)">
|
||||||
Hãy cho chúng tôi biết trải nghiệm của bạn hôm nay
|
Tell us about your experience today
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Star rating */}
|
{/* Star rating */}
|
||||||
<div className="mb-5">
|
<div className="mb-5">
|
||||||
<p className="mb-2 text-sm font-medium text-(--color-text-secondary)">
|
<p className="mb-2 text-sm font-medium text-(--color-text-secondary)">
|
||||||
Mức độ hài lòng
|
Satisfaction level
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
className="flex gap-2"
|
className="flex gap-2"
|
||||||
role="radiogroup"
|
role="radiogroup"
|
||||||
aria-label="Xếp hạng sao"
|
aria-label="Star rating"
|
||||||
>
|
>
|
||||||
{[1, 2, 3, 4, 5].map((star) => {
|
{[1, 2, 3, 4, 5].map((star) => {
|
||||||
const isActive = star <= (hovered || rating);
|
const isActive = star <= (hovered || rating);
|
||||||
@@ -90,7 +90,7 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
onClick={() => setRating(star)}
|
onClick={() => setRating(star)}
|
||||||
onMouseEnter={() => setHovered(star)}
|
onMouseEnter={() => setHovered(star)}
|
||||||
onMouseLeave={() => setHovered(0)}
|
onMouseLeave={() => setHovered(0)}
|
||||||
aria-label={`${star} sao`}
|
aria-label={`${star} star`}
|
||||||
aria-pressed={rating === star}
|
aria-pressed={rating === star}
|
||||||
className="text-3xl transition-transform hover:scale-110 active:scale-95 sm:text-4xl"
|
className="text-3xl transition-transform hover:scale-110 active:scale-95 sm:text-4xl"
|
||||||
>
|
>
|
||||||
@@ -108,7 +108,7 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
{rating > 0 && (
|
{rating > 0 && (
|
||||||
<p className="mt-1.5 text-xs text-(--color-text-muted)">
|
<p className="mt-1.5 text-xs text-(--color-text-muted)">
|
||||||
{
|
{
|
||||||
["", "Rất tệ", "Tệ", "Bình thường", "Tốt", "Xuất sắc"][
|
["", "Very poor", "Poor", "Average", "Good", "Excellent"][
|
||||||
rating
|
rating
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -120,10 +120,10 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
<Textarea
|
<Textarea
|
||||||
id="review-text"
|
id="review-text"
|
||||||
label="Nhận xét (tùy chọn)"
|
label="Comment (optional)"
|
||||||
value={review}
|
value={review}
|
||||||
onChange={(e) => setReview(e.target.value)}
|
onChange={(e) => setReview(e.target.value)}
|
||||||
placeholder="Chia sẻ cảm nhận của bạn về đồ uống, dịch vụ..."
|
placeholder="Share your thoughts on the drinks, service..."
|
||||||
rows={4}
|
rows={4}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -137,7 +137,7 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
className="flex-1"
|
className="flex-1"
|
||||||
icon="fa-arrow-left"
|
icon="fa-arrow-left"
|
||||||
>
|
>
|
||||||
Quay lại
|
Go back
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -146,7 +146,7 @@ export default function ReviewModal({ isOpen, onClose }: ReviewModalProps) {
|
|||||||
className="flex-1"
|
className="flex-1"
|
||||||
icon="fa-check"
|
icon="fa-check"
|
||||||
>
|
>
|
||||||
Xác nhận
|
Confirm
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { useMemo, useState } from "react";
|
|||||||
|
|
||||||
import type { MobileShiftViewProps } from "./ShiftSchedule.types";
|
import type { MobileShiftViewProps } from "./ShiftSchedule.types";
|
||||||
|
|
||||||
const DAY_HEADERS = ["T2", "T3", "T4", "T5", "T6", "T7", "CN"];
|
const DAY_HEADERS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
||||||
|
|
||||||
function formatDateISO(d: Date): string {
|
function formatDateISO(d: Date): string {
|
||||||
const y = d.getFullYear();
|
const y = d.getFullYear();
|
||||||
@@ -26,18 +26,18 @@ function isToday(d: Date): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MONTH_NAMES = [
|
const MONTH_NAMES = [
|
||||||
"Tháng 1",
|
"January",
|
||||||
"Tháng 2",
|
"February",
|
||||||
"Tháng 3",
|
"March",
|
||||||
"Tháng 4",
|
"April",
|
||||||
"Tháng 5",
|
"May",
|
||||||
"Tháng 6",
|
"June",
|
||||||
"Tháng 7",
|
"July",
|
||||||
"Tháng 8",
|
"August",
|
||||||
"Tháng 9",
|
"September",
|
||||||
"Tháng 10",
|
"October",
|
||||||
"Tháng 11",
|
"November",
|
||||||
"Tháng 12",
|
"December",
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function MobileShiftView({
|
export default function MobileShiftView({
|
||||||
@@ -94,7 +94,7 @@ export default function MobileShiftView({
|
|||||||
{/* Month navigation */}
|
{/* Month navigation */}
|
||||||
<div className="mb-3 flex items-center justify-between">
|
<div className="mb-3 flex items-center justify-between">
|
||||||
<button
|
<button
|
||||||
title="Trở lại tháng trước"
|
title="Previous month"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={goToPrevMonth}
|
onClick={goToPrevMonth}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
||||||
@@ -105,7 +105,7 @@ export default function MobileShiftView({
|
|||||||
{MONTH_NAMES[currentDate.getMonth()]} {currentDate.getFullYear()}
|
{MONTH_NAMES[currentDate.getMonth()]} {currentDate.getFullYear()}
|
||||||
</h3>
|
</h3>
|
||||||
<button
|
<button
|
||||||
title="Trở lại tháng sau"
|
title="Next month"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={goToNextMonth}
|
onClick={goToNextMonth}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
||||||
@@ -173,22 +173,22 @@ export default function MobileShiftView({
|
|||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="h-2 w-2 rounded-full bg-amber-400"></span>
|
<span className="h-2 w-2 rounded-full bg-amber-400"></span>
|
||||||
<span className="text-[10px] text-(--color-text-muted)">
|
<span className="text-[10px] text-(--color-text-muted)">
|
||||||
Còn trống
|
Available
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="h-2 w-2 rounded-full bg-green-500"></span>
|
<span className="h-2 w-2 rounded-full bg-green-500"></span>
|
||||||
<span className="text-[10px] text-(--color-text-muted)">Đã ĐK</span>
|
<span className="text-[10px] text-(--color-text-muted)">Registered</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="h-2 w-2 rounded-full bg-purple-400"></span>
|
<span className="h-2 w-2 rounded-full bg-purple-400"></span>
|
||||||
<span className="text-[10px] text-(--color-text-muted)">
|
<span className="text-[10px] text-(--color-text-muted)">
|
||||||
Nghỉ phép
|
On leave
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="h-2 w-2 rounded-full bg-red-400"></span>
|
<span className="h-2 w-2 rounded-full bg-red-400"></span>
|
||||||
<span className="text-[10px] text-(--color-text-muted)">Vắng</span>
|
<span className="text-[10px] text-(--color-text-muted)">Absent</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -199,7 +199,7 @@ export default function MobileShiftView({
|
|||||||
{dayOfWeek}, {selectedDateObj.getDate()}/
|
{dayOfWeek}, {selectedDateObj.getDate()}/
|
||||||
{selectedDateObj.getMonth() + 1}/{selectedDateObj.getFullYear()}
|
{selectedDateObj.getMonth() + 1}/{selectedDateObj.getFullYear()}
|
||||||
<span className="ml-2 text-xs font-normal text-(--color-text-muted)">
|
<span className="ml-2 text-xs font-normal text-(--color-text-muted)">
|
||||||
({selectedShifts.length} ca)
|
({selectedShifts.length} shift{selectedShifts.length !== 1 ? "s" : ""})
|
||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ export default function MobileShiftView({
|
|||||||
<div className="rounded-xl border border-dashed border-(--color-border-light) py-8 text-center">
|
<div className="rounded-xl border border-dashed border-(--color-border-light) py-8 text-center">
|
||||||
<i className="fa-regular fa-calendar-xmark mb-2 text-2xl text-gray-300"></i>
|
<i className="fa-regular fa-calendar-xmark mb-2 text-2xl text-gray-300"></i>
|
||||||
<p className="text-sm text-(--color-text-muted)">
|
<p className="text-sm text-(--color-text-muted)">
|
||||||
Không có ca làm trong ngày này
|
No shifts for this day
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useMemo } from "react";
|
|||||||
|
|
||||||
import type { MonthlyCalendarProps } from "./ShiftSchedule.types";
|
import type { MonthlyCalendarProps } from "./ShiftSchedule.types";
|
||||||
|
|
||||||
const DAY_HEADERS = ["T2", "T3", "T4", "T5", "T6", "T7", "CN"];
|
const DAY_HEADERS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
||||||
|
|
||||||
function formatDateISO(d: Date): string {
|
function formatDateISO(d: Date): string {
|
||||||
const y = d.getFullYear();
|
const y = d.getFullYear();
|
||||||
@@ -125,7 +125,7 @@ export default function MonthlyCalendar({
|
|||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<span className="h-2 w-2 rounded-full bg-blue-400"></span>
|
<span className="h-2 w-2 rounded-full bg-blue-400"></span>
|
||||||
<span className="text-[10px] text-blue-600">
|
<span className="text-[10px] text-blue-600">
|
||||||
{summary.available} trống
|
{summary.available} available
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -133,7 +133,7 @@ export default function MonthlyCalendar({
|
|||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<span className="h-2 w-2 rounded-full bg-blue-700"></span>
|
<span className="h-2 w-2 rounded-full bg-blue-700"></span>
|
||||||
<span className="text-[10px] text-blue-800">
|
<span className="text-[10px] text-blue-800">
|
||||||
{summary.registered} đã ĐK
|
{summary.registered} registered
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -141,7 +141,7 @@ export default function MonthlyCalendar({
|
|||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<span className="h-2 w-2 rounded-full bg-purple-400"></span>
|
<span className="h-2 w-2 rounded-full bg-purple-400"></span>
|
||||||
<span className="text-[10px] text-purple-600">
|
<span className="text-[10px] text-purple-600">
|
||||||
{summary.leave} nghỉ
|
{summary.leave} on leave
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -149,7 +149,7 @@ export default function MonthlyCalendar({
|
|||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<span className="h-2 w-2 rounded-full bg-red-400"></span>
|
<span className="h-2 w-2 rounded-full bg-red-400"></span>
|
||||||
<span className="text-[10px] text-red-600">
|
<span className="text-[10px] text-red-600">
|
||||||
{summary.absent} vắng
|
{summary.absent} absent
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function ShiftCreateModal({
|
|||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if (!date || !startTime || !endTime) {
|
if (!date || !startTime || !endTime) {
|
||||||
setError("Vui lòng điền đầy đủ thông tin.");
|
setError("Please fill in all required fields.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ export default function ShiftCreateModal({
|
|||||||
const endMinutes = eh * 60 + em;
|
const endMinutes = eh * 60 + em;
|
||||||
|
|
||||||
if (endMinutes <= startMinutes) {
|
if (endMinutes <= startMinutes) {
|
||||||
setError("Giờ kết thúc phải sau giờ bắt đầu.");
|
setError("End time must be after start time.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +77,10 @@ export default function ShiftCreateModal({
|
|||||||
<div className="flex items-center justify-between border-b border-(--color-border-light) px-5 py-4">
|
<div className="flex items-center justify-between border-b border-(--color-border-light) px-5 py-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-foreground text-base font-bold">
|
<h2 className="text-foreground text-base font-bold">
|
||||||
Tạo ca làm mới
|
Create New Shift
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-xs text-(--color-text-muted)">
|
<p className="text-xs text-(--color-text-muted)">
|
||||||
Thêm khung giờ ca làm cho nhân viên
|
Add a shift time slot for staff
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@@ -98,7 +98,7 @@ export default function ShiftCreateModal({
|
|||||||
{/* Date */}
|
{/* Date */}
|
||||||
<div>
|
<div>
|
||||||
<label className="mb-1 block text-xs font-semibold text-(--color-text-secondary)">
|
<label className="mb-1 block text-xs font-semibold text-(--color-text-secondary)">
|
||||||
Ngày
|
Date
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
title="Date"
|
title="Date"
|
||||||
@@ -113,7 +113,7 @@ export default function ShiftCreateModal({
|
|||||||
<div className="grid grid-cols-2 gap-3">
|
<div className="grid grid-cols-2 gap-3">
|
||||||
<div>
|
<div>
|
||||||
<label className="mb-1 block text-xs font-semibold text-(--color-text-secondary)">
|
<label className="mb-1 block text-xs font-semibold text-(--color-text-secondary)">
|
||||||
Giờ bắt đầu
|
Start Time
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
title="Start Time"
|
title="Start Time"
|
||||||
@@ -125,7 +125,7 @@ export default function ShiftCreateModal({
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="mb-1 block text-xs font-semibold text-(--color-text-secondary)">
|
<label className="mb-1 block text-xs font-semibold text-(--color-text-secondary)">
|
||||||
Giờ kết thúc
|
End Time
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
title="End Time"
|
title="End Time"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const MONTH_NAMES_EN = [
|
|||||||
"December",
|
"December",
|
||||||
];
|
];
|
||||||
|
|
||||||
const DAY_LABELS = ["T2", "T3", "T4", "T5", "T6", "T7", "CN"];
|
const DAY_LABELS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
||||||
const DAY_LABELS_EN = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
const DAY_LABELS_EN = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
||||||
|
|
||||||
function formatDateShort(d: Date): string {
|
function formatDateShort(d: Date): string {
|
||||||
@@ -94,7 +94,7 @@ export default function WeeklySchedule({
|
|||||||
<div className="rounded-xl border border-(--color-border-light) bg-white p-3">
|
<div className="rounded-xl border border-(--color-border-light) bg-white p-3">
|
||||||
<div className="mb-3 flex items-center justify-between">
|
<div className="mb-3 flex items-center justify-between">
|
||||||
<button
|
<button
|
||||||
title="Tuần trước"
|
title="Previous week"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={goToPrevWeek}
|
onClick={goToPrevWeek}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
||||||
@@ -105,7 +105,7 @@ export default function WeeklySchedule({
|
|||||||
{MONTH_NAMES_EN[currentDate.getMonth()]} {currentDate.getFullYear()}
|
{MONTH_NAMES_EN[currentDate.getMonth()]} {currentDate.getFullYear()}
|
||||||
</h3>
|
</h3>
|
||||||
<button
|
<button
|
||||||
title="Tuần sau"
|
title="Next week"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={goToNextWeek}
|
onClick={goToNextWeek}
|
||||||
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
className="flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none bg-transparent text-(--color-text-muted) transition hover:bg-gray-100"
|
||||||
@@ -192,7 +192,7 @@ export default function WeeklySchedule({
|
|||||||
className="flex w-full cursor-pointer items-center justify-center rounded-lg border border-dashed border-gray-300 bg-transparent py-2 text-xs text-gray-400 transition hover:border-(--color-primary) hover:text-(--color-primary)"
|
className="flex w-full cursor-pointer items-center justify-center rounded-lg border border-dashed border-gray-300 bg-transparent py-2 text-xs text-gray-400 transition hover:border-(--color-primary) hover:text-(--color-primary)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-plus mr-1"></i>
|
<i className="fa-solid fa-plus mr-1"></i>
|
||||||
Thêm ca
|
Add shift
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -213,7 +213,7 @@ export default function WeeklySchedule({
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th className="w-28 border-r border-b border-(--color-border-light) bg-gray-50 px-3 py-3 text-left text-xs font-semibold text-(--color-text-muted) uppercase">
|
<th className="w-28 border-r border-b border-(--color-border-light) bg-gray-50 px-3 py-3 text-left text-xs font-semibold text-(--color-text-muted) uppercase">
|
||||||
Bộ phận
|
Department
|
||||||
</th>
|
</th>
|
||||||
{weekDates.map((date, i) => (
|
{weekDates.map((date, i) => (
|
||||||
<th
|
<th
|
||||||
@@ -273,7 +273,7 @@ export default function WeeklySchedule({
|
|||||||
className="mt-auto flex cursor-pointer items-center justify-center rounded-lg border border-dashed border-gray-300 bg-transparent py-1 text-[10px] text-gray-400 transition hover:border-(--color-primary) hover:text-(--color-primary)"
|
className="mt-auto flex cursor-pointer items-center justify-center rounded-lg border border-dashed border-gray-300 bg-transparent py-1 text-[10px] text-gray-400 transition hover:border-(--color-primary) hover:text-(--color-primary)"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-plus mr-1"></i>
|
<i className="fa-solid fa-plus mr-1"></i>
|
||||||
Thêm ca
|
Add shift
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function ShopGrid({
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-center justify-center gap-4 py-24 text-(--color-text-muted)">
|
<div className="flex flex-col items-center justify-center gap-4 py-24 text-(--color-text-muted)">
|
||||||
<i className="fa-solid fa-store text-5xl opacity-30"></i>
|
<i className="fa-solid fa-store text-5xl opacity-30"></i>
|
||||||
<p className="text-base font-medium">Không tìm thấy quán nào phù hợp</p>
|
<p className="text-base font-medium">No shops found matching your search</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import type { AuthLayoutProps } from "./AuthLayout.types";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth layout template — centers content in the screen.
|
|
||||||
* Used by login and register pages.
|
|
||||||
*/
|
|
||||||
export default function AuthLayout({ children }: AuthLayoutProps) {
|
|
||||||
return (
|
|
||||||
<div className="bg-background flex min-h-screen items-center justify-center px-4 py-8">
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export interface AuthLayoutProps {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export { default as AuthLayout } from "./AuthLayout";
|
|
||||||
export type { AuthLayoutProps } from "./AuthLayout.types";
|
|
||||||
@@ -2,10 +2,6 @@
|
|||||||
export { MainLayout } from "./main-layout";
|
export { MainLayout } from "./main-layout";
|
||||||
export type { MainLayoutProps } from "./main-layout";
|
export type { MainLayoutProps } from "./main-layout";
|
||||||
|
|
||||||
// Auth Layout
|
|
||||||
export { AuthLayout } from "./auth-layout";
|
|
||||||
export type { AuthLayoutProps } from "./auth-layout";
|
|
||||||
|
|
||||||
// Feed Layout
|
// Feed Layout
|
||||||
export { FeedLayout } from "./feed-layout";
|
export { FeedLayout } from "./feed-layout";
|
||||||
export type { FeedLayoutProps } from "./feed-layout";
|
export type { FeedLayoutProps } from "./feed-layout";
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ import type { ManagerLayoutProps } from "./ManagerLayout.types";
|
|||||||
* Redirects non-managers away; shows loading state while auth resolves.
|
* Redirects non-managers away; shows loading state while auth resolves.
|
||||||
*/
|
*/
|
||||||
export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
export default function ManagerLayout({ children }: ManagerLayoutProps) {
|
||||||
const { user } = useAuth();
|
const { user, isInitialized } = useAuth();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (user !== null && user.role !== "manager") {
|
if (isInitialized && user !== null && user.role !== "manager") {
|
||||||
router.replace("/");
|
router.replace("/");
|
||||||
}
|
}
|
||||||
}, [user, router]);
|
}, [user, isInitialized, router]);
|
||||||
|
|
||||||
if (user === null) {
|
if (!isInitialized || user === null) {
|
||||||
return (
|
return (
|
||||||
<div className="bg-background flex min-h-screen items-center justify-center">
|
<div className="bg-background flex min-h-screen items-center justify-center">
|
||||||
<div className="flex flex-col items-center gap-4 text-(--color-text-muted)">
|
<div className="flex flex-col items-center gap-4 text-(--color-text-muted)">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: frontend-container
|
- name: frontend-container
|
||||||
image: git.demonkernel.io.vn/foodsurf/frontend:1.2.0
|
image: git.demonkernel.io.vn/foodsurf/frontend:1.2.3
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
+9
-9
@@ -48,7 +48,7 @@ export default function Footer() {
|
|||||||
<ul className="flex flex-col gap-2 text-sm opacity-80">
|
<ul className="flex flex-col gap-2 text-sm opacity-80">
|
||||||
<li className="flex items-start gap-2">
|
<li className="flex items-start gap-2">
|
||||||
<i className="fa-solid fa-location-dot mt-0.5 w-4 shrink-0 text-center text-(--color-accent)"></i>
|
<i className="fa-solid fa-location-dot mt-0.5 w-4 shrink-0 text-center text-(--color-accent)"></i>
|
||||||
<span>Địa chỉ: {SHOP_INFO.address}</span>
|
<span>Address: {SHOP_INFO.address}</span>
|
||||||
</li>
|
</li>
|
||||||
<li className="flex items-center gap-2">
|
<li className="flex items-center gap-2">
|
||||||
<i className="fa-solid fa-phone w-4 shrink-0 text-center text-(--color-accent)"></i>
|
<i className="fa-solid fa-phone w-4 shrink-0 text-center text-(--color-accent)"></i>
|
||||||
@@ -56,7 +56,7 @@ export default function Footer() {
|
|||||||
href={`tel:${SHOP_INFO.phone}`}
|
href={`tel:${SHOP_INFO.phone}`}
|
||||||
className="transition-colors duration-150 hover:text-(--color-accent)"
|
className="transition-colors duration-150 hover:text-(--color-accent)"
|
||||||
>
|
>
|
||||||
Số điện thoại: {SHOP_INFO.phone}
|
Phone: {SHOP_INFO.phone}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="flex items-center gap-2">
|
<li className="flex items-center gap-2">
|
||||||
@@ -83,7 +83,7 @@ export default function Footer() {
|
|||||||
{/* ── 2. Social links ── */}
|
{/* ── 2. Social links ── */}
|
||||||
<div className="col-span-1">
|
<div className="col-span-1">
|
||||||
<h3 className="mb-4 text-sm font-bold tracking-wider text-(--color-accent) uppercase">
|
<h3 className="mb-4 text-sm font-bold tracking-wider text-(--color-accent) uppercase">
|
||||||
Kết nối
|
Follow Us
|
||||||
</h3>
|
</h3>
|
||||||
<ul className="flex flex-col gap-3">
|
<ul className="flex flex-col gap-3">
|
||||||
<li>
|
<li>
|
||||||
@@ -129,20 +129,20 @@ export default function Footer() {
|
|||||||
{/* ── 3. WiFi card ── */}
|
{/* ── 3. WiFi card ── */}
|
||||||
<div className="col-span-1">
|
<div className="col-span-1">
|
||||||
<h3 className="mb-4 text-sm font-bold tracking-wider text-(--color-accent) uppercase">
|
<h3 className="mb-4 text-sm font-bold tracking-wider text-(--color-accent) uppercase">
|
||||||
WiFi Miễn Phí
|
Free WiFi
|
||||||
</h3>
|
</h3>
|
||||||
<div className="border-opacity-50 bg-opacity-30 rounded-xl border border-(--color-primary-light) bg-(--color-primary-dark) p-4">
|
<div className="border-opacity-50 bg-opacity-30 rounded-xl border border-(--color-primary-light) bg-(--color-primary-dark) p-4">
|
||||||
<div className="mb-3 flex items-center gap-2">
|
<div className="mb-3 flex items-center gap-2">
|
||||||
<i className="fa-solid fa-wifi shrink-0 text-lg text-(--color-accent)"></i>
|
<i className="fa-solid fa-wifi shrink-0 text-lg text-(--color-accent)"></i>
|
||||||
<span className="text-sm font-semibold">
|
<span className="text-sm font-semibold">
|
||||||
Kết nối miễn phí
|
Connect for free
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{/* Stacked label + value rows — no overflow risk */}
|
{/* Stacked label + value rows — no overflow risk */}
|
||||||
<div className="flex flex-col gap-3 text-sm">
|
<div className="flex flex-col gap-3 text-sm">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<span className="text-xs tracking-wide uppercase opacity-60">
|
<span className="text-xs tracking-wide uppercase opacity-60">
|
||||||
Tên mạng
|
Network name
|
||||||
</span>
|
</span>
|
||||||
<span className="border-opacity-30 rounded border border-(--color-accent) px-2 py-1 font-mono font-bold break-all text-(--color-accent)">
|
<span className="border-opacity-30 rounded border border-(--color-accent) px-2 py-1 font-mono font-bold break-all text-(--color-accent)">
|
||||||
{SHOP_INFO.wifi.name}
|
{SHOP_INFO.wifi.name}
|
||||||
@@ -150,7 +150,7 @@ export default function Footer() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<span className="text-xs tracking-wide uppercase opacity-60">
|
<span className="text-xs tracking-wide uppercase opacity-60">
|
||||||
Mật khẩu
|
Password
|
||||||
</span>
|
</span>
|
||||||
<span className="border-opacity-30 rounded border border-(--color-accent) px-2 py-1 font-mono font-bold tracking-wider break-all text-(--color-accent)">
|
<span className="border-opacity-30 rounded border border-(--color-accent) px-2 py-1 font-mono font-bold tracking-wider break-all text-(--color-accent)">
|
||||||
{SHOP_INFO.wifi.password}
|
{SHOP_INFO.wifi.password}
|
||||||
@@ -170,9 +170,9 @@ export default function Footer() {
|
|||||||
© {new Date().getFullYear()} {SHOP_INFO.name}. All rights reserved.
|
© {new Date().getFullYear()} {SHOP_INFO.name}. All rights reserved.
|
||||||
</span>
|
</span>
|
||||||
<span className="flex items-center gap-1">
|
<span className="flex items-center gap-1">
|
||||||
Được vận hành{" "}
|
Powered by{" "}
|
||||||
<i className="fa-solid fa-heart mx-1 text-(--color-accent)"></i>{" "}
|
<i className="fa-solid fa-heart mx-1 text-(--color-accent)"></i>{" "}
|
||||||
bằng Drinkool
|
Drinkool
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+9
-9
@@ -72,11 +72,11 @@ export default function Header() {
|
|||||||
/* Guest: sign-in button */
|
/* Guest: sign-in button */
|
||||||
<button
|
<button
|
||||||
onClick={handleAuthClick}
|
onClick={handleAuthClick}
|
||||||
title="Đăng nhập"
|
title="Sign in"
|
||||||
className="flex cursor-pointer items-center gap-2.5 rounded-xl border-none bg-(--color-primary) px-5 py-2.5 text-sm font-semibold text-white transition-all duration-150 hover:bg-(--color-primary-dark) active:scale-95"
|
className="flex cursor-pointer items-center gap-2.5 rounded-xl border-none bg-(--color-primary) px-5 py-2.5 text-sm font-semibold text-white transition-all duration-150 hover:bg-(--color-primary-dark) active:scale-95"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-right-to-bracket"></i>
|
<i className="fa-solid fa-right-to-bracket"></i>
|
||||||
<span className="hidden sm:inline">Đăng nhập</span>
|
<span className="hidden sm:inline">Sign in</span>
|
||||||
</button>
|
</button>
|
||||||
) : user.role === "manager" ? (
|
) : user.role === "manager" ? (
|
||||||
/* Manager: dashboard link + logout */
|
/* Manager: dashboard link + logout */
|
||||||
@@ -90,8 +90,8 @@ export default function Header() {
|
|||||||
</Link>
|
</Link>
|
||||||
<button
|
<button
|
||||||
onClick={handleAuthClick}
|
onClick={handleAuthClick}
|
||||||
title="Đăng xuất"
|
title="Sign out"
|
||||||
aria-label="Đăng xuất"
|
aria-label="Sign out"
|
||||||
className="flex cursor-pointer items-center gap-2 rounded-xl border border-(--color-border) bg-transparent px-3 py-2.5 text-sm font-medium text-(--color-text-muted) transition-all duration-150 hover:border-red-300 hover:bg-red-50 hover:text-red-500 active:scale-95"
|
className="flex cursor-pointer items-center gap-2 rounded-xl border border-(--color-border) bg-transparent px-3 py-2.5 text-sm font-medium text-(--color-text-muted) transition-all duration-150 hover:border-red-300 hover:bg-red-50 hover:text-red-500 active:scale-95"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-right-from-bracket text-base"></i>
|
<i className="fa-solid fa-right-from-bracket text-base"></i>
|
||||||
@@ -105,12 +105,12 @@ export default function Header() {
|
|||||||
className="flex items-center gap-2 rounded-xl border border-(--color-accent) bg-(--color-accent-light) px-4 py-2.5 text-sm font-semibold text-(--color-primary-dark) no-underline transition-all duration-150 hover:bg-(--color-accent) hover:text-white"
|
className="flex items-center gap-2 rounded-xl border border-(--color-accent) bg-(--color-accent-light) px-4 py-2.5 text-sm font-semibold text-(--color-primary-dark) no-underline transition-all duration-150 hover:bg-(--color-accent) hover:text-white"
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-calendar-check text-base"></i>
|
<i className="fa-solid fa-calendar-check text-base"></i>
|
||||||
<span className="hidden sm:inline">Ca làm</span>
|
<span className="hidden sm:inline">My Shifts</span>
|
||||||
</Link>
|
</Link>
|
||||||
<button
|
<button
|
||||||
onClick={handleAuthClick}
|
onClick={handleAuthClick}
|
||||||
title="Nhấn để đăng xuất"
|
title="Click to sign out"
|
||||||
aria-label="Đăng xuất"
|
aria-label="Sign out"
|
||||||
className="bg-background flex cursor-pointer items-center gap-2.5 rounded-xl border border-(--color-border) px-4 py-2 text-sm font-semibold text-(--color-text-secondary) transition-all duration-150 hover:border-(--color-primary-light) hover:bg-(--color-border-light) active:scale-95"
|
className="bg-background flex cursor-pointer items-center gap-2.5 rounded-xl border border-(--color-border) px-4 py-2 text-sm font-semibold text-(--color-text-secondary) transition-all duration-150 hover:border-(--color-primary-light) hover:bg-(--color-border-light) active:scale-95"
|
||||||
>
|
>
|
||||||
{/* Avatar circle */}
|
{/* Avatar circle */}
|
||||||
@@ -124,14 +124,14 @@ export default function Header() {
|
|||||||
/* Customer: phone icon + label */
|
/* Customer: phone icon + label */
|
||||||
<button
|
<button
|
||||||
onClick={handleAuthClick}
|
onClick={handleAuthClick}
|
||||||
title={`Khách hàng - ${user.phone || ""} - Nhấn để đăng xuất`}
|
title={`Customer - ${user.phone || ""} - Click to sign out`}
|
||||||
className="flex cursor-pointer items-center gap-2.5 rounded-xl border-none bg-(--color-primary-light) px-4 py-2 text-sm font-semibold text-white transition-all duration-150 hover:bg-(--color-primary) active:scale-95"
|
className="flex cursor-pointer items-center gap-2.5 rounded-xl border-none bg-(--color-primary-light) px-4 py-2 text-sm font-semibold text-white transition-all duration-150 hover:bg-(--color-primary) active:scale-95"
|
||||||
>
|
>
|
||||||
{/* Customer icon */}
|
{/* Customer icon */}
|
||||||
<div className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-white text-xs text-(--color-primary-light)">
|
<div className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-white text-xs text-(--color-primary-light)">
|
||||||
<i className="fa-solid fa-user"></i>
|
<i className="fa-solid fa-user"></i>
|
||||||
</div>
|
</div>
|
||||||
<span className="hidden sm:inline">Khách hàng</span>
|
<span className="hidden sm:inline">Customer</span>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+18
-118
@@ -12,95 +12,18 @@ import type { User } from "./types";
|
|||||||
|
|
||||||
interface AuthContextType {
|
interface AuthContextType {
|
||||||
user: User | null;
|
user: User | null;
|
||||||
login: (username: string, password: string) => Promise<boolean>;
|
setUser: (user: User | null) => void;
|
||||||
|
isInitialized: boolean;
|
||||||
|
login: (username: string, password: string) => Promise<{ ok: boolean; status?: number }>;
|
||||||
logout: () => void;
|
logout: () => void;
|
||||||
registerPhone: string | null;
|
|
||||||
setRegisterPhone: (phone: string | null) => void;
|
|
||||||
completeRegistration: (phone: string) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const AuthContext = createContext<AuthContextType | undefined>(undefined);
|
const AuthContext = createContext<AuthContextType | undefined>(undefined);
|
||||||
|
|
||||||
// Mock user database
|
|
||||||
const MOCK_AUTH_DB = {
|
|
||||||
// Admin
|
|
||||||
admin: {
|
|
||||||
username: "admin",
|
|
||||||
password: "admin",
|
|
||||||
user: {
|
|
||||||
id: 1,
|
|
||||||
name: "Quản lý",
|
|
||||||
role: "manager" as const,
|
|
||||||
avatar: null,
|
|
||||||
phone: "0912345678",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// Staff (username and password are their names)
|
|
||||||
"Nguyễn Văn An": {
|
|
||||||
username: "Nguyễn Văn An",
|
|
||||||
password: "Nguyễn Văn An",
|
|
||||||
user: {
|
|
||||||
id: 2,
|
|
||||||
name: "Nguyễn Văn An",
|
|
||||||
role: "staff" as const,
|
|
||||||
avatar: null,
|
|
||||||
phone: "0901234567",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"Trần Thị Bình": {
|
|
||||||
username: "Trần Thị Bình",
|
|
||||||
password: "Trần Thị Bình",
|
|
||||||
user: {
|
|
||||||
id: 3,
|
|
||||||
name: "Trần Thị Bình",
|
|
||||||
role: "staff" as const,
|
|
||||||
avatar: null,
|
|
||||||
phone: "0902345678",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"Lê Văn Cường": {
|
|
||||||
username: "Lê Văn Cường",
|
|
||||||
password: "Lê Văn Cường",
|
|
||||||
user: {
|
|
||||||
id: 4,
|
|
||||||
name: "Lê Văn Cường",
|
|
||||||
role: "staff" as const,
|
|
||||||
avatar: null,
|
|
||||||
phone: "0903456789",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// Customers (username is phone number, password is custom)
|
|
||||||
"0987654321": {
|
|
||||||
username: "0987654321",
|
|
||||||
password: "user1",
|
|
||||||
user: {
|
|
||||||
id: 5,
|
|
||||||
name: "Khách hàng",
|
|
||||||
role: "customer" as const,
|
|
||||||
avatar: null,
|
|
||||||
phone: "0987654321",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"0976543210": {
|
|
||||||
username: "0976543210",
|
|
||||||
password: "user1",
|
|
||||||
user: {
|
|
||||||
id: 6,
|
|
||||||
name: "Khách hàng",
|
|
||||||
role: "customer" as const,
|
|
||||||
avatar: null,
|
|
||||||
phone: "0976543210",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export function AuthProvider({ children }: { children: ReactNode }) {
|
export function AuthProvider({ children }: { children: ReactNode }) {
|
||||||
const [user, setUser] = useState<User | null>(null);
|
const [user, setUser] = useState<User | null>(null);
|
||||||
const [registerPhone, setRegisterPhone] = useState<string | null>(null);
|
const [isInitialized, setIsInitialized] = useState(false);
|
||||||
|
|
||||||
// Load user from localStorage on mount
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedUser = localStorage.getItem("coffee-shop-user");
|
const savedUser = localStorage.getItem("coffee-shop-user");
|
||||||
if (savedUser) {
|
if (savedUser) {
|
||||||
@@ -110,32 +33,32 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|||||||
console.error("Failed to parse saved user", e);
|
console.error("Failed to parse saved user", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setIsInitialized(true);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const login = async (phone: string, password: string): Promise<boolean> => {
|
const login = async (username: string, password: string): Promise<{ ok: boolean; status?: number }> => {
|
||||||
|
const isPhone = /^0\d{9}$/.test(username.trim());
|
||||||
|
const role = isPhone ? "customer" : "manager";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/customer/login", {
|
const response = await fetch("/api/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: { "Content-Type": "application/json" },
|
||||||
"Content-Type": "application/json",
|
body: JSON.stringify({ phone: username, password, role }),
|
||||||
},
|
|
||||||
body: JSON.stringify({ phone, password }),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const userData = await response.json();
|
const userData = await response.json();
|
||||||
|
|
||||||
setUser(userData);
|
setUser(userData);
|
||||||
localStorage.setItem("coffee-shop-user", JSON.stringify(userData));
|
localStorage.setItem("coffee-shop-user", JSON.stringify(userData));
|
||||||
|
return { ok: true };
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
console.error("Đăng nhập thất bại:", response.statusText);
|
console.error("Đăng nhập thất bại:", response.status);
|
||||||
return false;
|
return { ok: false, status: response.status };
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Lỗi kết nối API:", error);
|
console.error("Lỗi kết nối API:", error);
|
||||||
return false;
|
return { ok: false };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -144,37 +67,14 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|||||||
localStorage.removeItem("coffee-shop-user");
|
localStorage.removeItem("coffee-shop-user");
|
||||||
};
|
};
|
||||||
|
|
||||||
const completeRegistration = (phone: string) => {
|
|
||||||
// Create new customer account
|
|
||||||
const newUser: User = {
|
|
||||||
id: Date.now(),
|
|
||||||
name: "Khách hàng",
|
|
||||||
role: "customer",
|
|
||||||
avatar: null,
|
|
||||||
phone,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Add to mock database (in real app, this would be API call)
|
|
||||||
(MOCK_AUTH_DB as any)[phone] = {
|
|
||||||
username: phone,
|
|
||||||
password: "user1", // Default password for new customers
|
|
||||||
user: newUser,
|
|
||||||
};
|
|
||||||
|
|
||||||
setUser(newUser);
|
|
||||||
localStorage.setItem("coffee-shop-user", JSON.stringify(newUser));
|
|
||||||
setRegisterPhone(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthContext.Provider
|
<AuthContext.Provider
|
||||||
value={{
|
value={{
|
||||||
user,
|
user,
|
||||||
|
setUser,
|
||||||
|
isInitialized,
|
||||||
login,
|
login,
|
||||||
logout,
|
logout,
|
||||||
registerPhone,
|
|
||||||
setRegisterPhone,
|
|
||||||
completeRegistration,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
+96
-112
@@ -15,9 +15,9 @@ import type {
|
|||||||
// ===== SHOP INFORMATION =====
|
// ===== SHOP INFORMATION =====
|
||||||
export const SHOP_INFO: ShopInfo = {
|
export const SHOP_INFO: ShopInfo = {
|
||||||
name: "Coffee Shop",
|
name: "Coffee Shop",
|
||||||
tagline: "Hương vị đậm đà – Khoảnh khắc thư giãn",
|
tagline: "Rich Flavors – Moments of Relaxation",
|
||||||
logo: "/imgs/logo.png",
|
logo: "/imgs/logo.png",
|
||||||
address: "123 Đường Nguyễn Huệ, Quận 1, TP. Hồ Chí Minh",
|
address: "123 Nguyen Hue Street, District 1, Ho Chi Minh City",
|
||||||
phone: "0901 234 567",
|
phone: "0901 234 567",
|
||||||
managerPhone: "0912 345 678",
|
managerPhone: "0912 345 678",
|
||||||
email: "contact@coffeeshop.vn",
|
email: "contact@coffeeshop.vn",
|
||||||
@@ -25,7 +25,7 @@ export const SHOP_INFO: ShopInfo = {
|
|||||||
name: "CoffeeShop_Free",
|
name: "CoffeeShop_Free",
|
||||||
password: "coffee2024",
|
password: "coffee2024",
|
||||||
},
|
},
|
||||||
openHours: "07:00 – 22:00 (Thứ 2 – Chủ nhật)",
|
openHours: "07:00 – 22:00 (Monday – Sunday)",
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===== SOCIAL LINKS =====
|
// ===== SOCIAL LINKS =====
|
||||||
@@ -38,15 +38,15 @@ export const SOCIAL_LINKS: SocialLinks = {
|
|||||||
// ===== MENU CATEGORIES =====
|
// ===== MENU CATEGORIES =====
|
||||||
// Each category has a unique FontAwesome icon representing the item type
|
// Each category has a unique FontAwesome icon representing the item type
|
||||||
export const MENU_CATEGORIES: MenuCategory[] = [
|
export const MENU_CATEGORIES: MenuCategory[] = [
|
||||||
{ id: "all", name: "Tất cả", icon: "fa-solid fa-border-all" },
|
{ id: "all", name: "All", icon: "fa-solid fa-border-all" },
|
||||||
{ id: "cafe", name: "Cà Phê", icon: "fa-solid fa-mug-hot" },
|
{ id: "cafe", name: "Coffee", icon: "fa-solid fa-mug-hot" },
|
||||||
{ id: "tra", name: "Trà", icon: "fa-solid fa-leaf" },
|
{ id: "tra", name: "Tea", icon: "fa-solid fa-leaf" },
|
||||||
{ id: "sua-chua", name: "Sữa Chua", icon: "fa-solid fa-jar" },
|
{ id: "sua-chua", name: "Yogurt", icon: "fa-solid fa-jar" },
|
||||||
{ id: "nuoc-ep", name: "Nước Ép", icon: "fa-solid fa-blender" },
|
{ id: "nuoc-ep", name: "Juice", icon: "fa-solid fa-blender" },
|
||||||
{ id: "latte", name: "Latte", icon: "fa-solid fa-mug-saucer" },
|
{ id: "latte", name: "Latte", icon: "fa-solid fa-mug-saucer" },
|
||||||
{
|
{
|
||||||
id: "giai-khat",
|
id: "giai-khat",
|
||||||
name: "Giải Khát / Ăn Vặt",
|
name: "Refreshments / Snacks",
|
||||||
icon: "fa-solid fa-ice-cream",
|
icon: "fa-solid fa-ice-cream",
|
||||||
},
|
},
|
||||||
{ id: "topping", name: "Topping", icon: "fa-solid fa-layer-group" },
|
{ id: "topping", name: "Topping", icon: "fa-solid fa-layer-group" },
|
||||||
@@ -57,182 +57,182 @@ export const MENU_CATEGORIES: MenuCategory[] = [
|
|||||||
export const MOCK_PRODUCTS: Product[] = [
|
export const MOCK_PRODUCTS: Product[] = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Cà Phê Đen",
|
name: "Black Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
price: 25000,
|
price: 25000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Cà phê đen truyền thống, đậm đà hương vị Việt Nam, pha phin thủ công.",
|
"Traditional Vietnamese black coffee, rich and bold, brewed by hand with a phin filter.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Cà Phê Sữa",
|
name: "Milk Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
price: 30000,
|
price: 30000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Cà phê sữa đặc thơm ngon, béo ngậy, kết hợp hoàn hảo giữa cà phê và sữa đặc.",
|
"Aromatic condensed milk coffee, rich and creamy — a perfect blend of strong coffee and sweet condensed milk.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "Bạc Xỉu",
|
name: "White Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
price: 32000,
|
price: 32000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Bạc xỉu nhẹ nhàng, ít cà phê nhiều sữa, thích hợp cho người mới uống cà phê.",
|
"Light and mild, with less coffee and more milk — perfect for those just starting to enjoy coffee.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
name: "Cà Phê Trứng",
|
name: "Egg Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
price: 45000,
|
price: 45000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Cà phê trứng đặc sản Hà Nội, lớp kem trứng mịn màng phủ trên nền cà phê đậm đà.",
|
"A Hanoi specialty — smooth, velvety egg cream layered over a bold coffee base.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
name: "Trà Đào Cam Sả",
|
name: "Peach Orange Lemongrass Tea",
|
||||||
category: "tra",
|
category: "tra",
|
||||||
price: 35000,
|
price: 35000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Trà đào thơm mát kết hợp cam tươi và sả, thanh mát và giải nhiệt tuyệt vời.",
|
"Fragrant peach tea with fresh orange and lemongrass — refreshing and wonderfully cooling.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 6,
|
id: 6,
|
||||||
name: "Trà Xanh Matcha",
|
name: "Matcha Green Tea",
|
||||||
category: "tra",
|
category: "tra",
|
||||||
price: 40000,
|
price: 40000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Matcha Nhật Bản nguyên chất, vị đắng nhẹ đặc trưng, thơm mát và bổ dưỡng.",
|
"Pure Japanese matcha with a signature light bitterness — aromatic, refreshing, and nutritious.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 7,
|
id: 7,
|
||||||
name: "Trà Vải Hoa Nhài",
|
name: "Lychee Jasmine Tea",
|
||||||
category: "tra",
|
category: "tra",
|
||||||
price: 38000,
|
price: 38000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Trà vải thanh ngọt kết hợp hương hoa nhài dịu dàng, thư giãn tâm hồn.",
|
"Sweet lychee tea delicately infused with jasmine blossom — a calming and soulful sip.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 8,
|
id: 8,
|
||||||
name: "Sữa Chua Trân Châu",
|
name: "Yogurt with Tapioca Pearls",
|
||||||
category: "sua-chua",
|
category: "sua-chua",
|
||||||
price: 38000,
|
price: 38000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Sữa chua mịn màng kết hợp trân châu đen dẻo dai, chua ngọt hài hòa.",
|
"Smooth, creamy yogurt paired with chewy black tapioca pearls — a perfectly balanced sweet and tangy treat.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 9,
|
id: 9,
|
||||||
name: "Sữa Chua Dâu",
|
name: "Strawberry Yogurt",
|
||||||
category: "sua-chua",
|
category: "sua-chua",
|
||||||
price: 40000,
|
price: 40000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Sữa chua mát lạnh với dâu tươi ngọt chua, giàu vitamin và khoáng chất.",
|
"Chilled yogurt with fresh sweet-tart strawberries, packed with vitamins and minerals.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 10,
|
id: 10,
|
||||||
name: "Nước Ép Cam",
|
name: "Fresh Orange Juice",
|
||||||
category: "nuoc-ep",
|
category: "nuoc-ep",
|
||||||
price: 35000,
|
price: 35000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Nước ép cam tươi nguyên chất, giàu vitamin C, tốt cho sức khỏe.",
|
"100% freshly squeezed orange juice, rich in vitamin C and great for your health.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 11,
|
id: 11,
|
||||||
name: "Nước Ép Dưa Hấu",
|
name: "Watermelon Juice",
|
||||||
category: "nuoc-ep",
|
category: "nuoc-ep",
|
||||||
price: 30000,
|
price: 30000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Nước ép dưa hấu mát lạnh, giải nhiệt tức thì trong những ngày hè oi bức.",
|
"Ice-cold watermelon juice — instantly refreshing on hot summer days.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 12,
|
id: 12,
|
||||||
name: "Latte Caramel",
|
name: "Caramel Latte",
|
||||||
category: "latte",
|
category: "latte",
|
||||||
price: 45000,
|
price: 45000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Latte caramel ngọt ngào, thơm béo với lớp foam sữa mịn và sốt caramel.",
|
"Sweet and indulgent caramel latte with a velvety milk foam topping and a drizzle of caramel sauce.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 13,
|
id: 13,
|
||||||
name: "Latte Vanilla",
|
name: "Vanilla Latte",
|
||||||
category: "latte",
|
category: "latte",
|
||||||
price: 45000,
|
price: 45000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Latte vanilla nhẹ nhàng, hương thơm dịu dàng từ vanilla tự nhiên.",
|
"Smooth and gentle vanilla latte with a delicate natural vanilla fragrance.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 14,
|
id: 14,
|
||||||
name: "Bánh Mì Nướng Bơ",
|
name: "Toasted Butter Bread",
|
||||||
category: "giai-khat",
|
category: "giai-khat",
|
||||||
price: 20000,
|
price: 20000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Bánh mì nướng giòn rụm, phết bơ thơm và mứt dâu, ăn kèm cà phê tuyệt vời.",
|
"Crispy toasted bread spread with fragrant butter and strawberry jam — the perfect coffee companion.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 15,
|
id: 15,
|
||||||
name: "Bánh Flan",
|
name: "Caramel Flan",
|
||||||
category: "giai-khat",
|
category: "giai-khat",
|
||||||
price: 25000,
|
price: 25000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Bánh flan mềm mịn, ngọt ngào với lớp caramel vàng óng, tan chảy trong miệng.",
|
"Silky smooth flan with a golden caramel topping that melts in your mouth.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 16,
|
id: 16,
|
||||||
name: "Trân Châu Đen",
|
name: "Black Tapioca Pearls",
|
||||||
category: "topping",
|
category: "topping",
|
||||||
price: 10000,
|
price: 10000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Trân châu đen dẻo dai, thêm vào bất kỳ đồ uống nào để tăng thêm hương vị.",
|
"Chewy black tapioca pearls — add them to any drink for extra flavor and texture.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 17,
|
id: 17,
|
||||||
name: "Thạch Cà Phê",
|
name: "Coffee Jelly",
|
||||||
category: "topping",
|
category: "topping",
|
||||||
price: 10000,
|
price: 10000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Thạch cà phê mát lạnh, thêm hương vị đặc biệt cho đồ uống của bạn.",
|
"Cool coffee jelly that adds a distinctive flavor boost to your drink.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 18,
|
id: 18,
|
||||||
name: "Trân Châu Trắng",
|
name: "White Tapioca Pearls",
|
||||||
category: "topping",
|
category: "topping",
|
||||||
price: 10000,
|
price: 10000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
description:
|
description:
|
||||||
"Trân châu trắng dẻo dai, thêm vào bất kỳ đồ uống nào để tăng thêm hương vị.",
|
"Chewy white tapioca pearls — add them to any drink for extra flavor and texture.",
|
||||||
available: true,
|
available: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -241,8 +241,8 @@ export const MOCK_PRODUCTS: Product[] = [
|
|||||||
export const MOCK_COMBOS: Combo[] = [
|
export const MOCK_COMBOS: Combo[] = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Combo Cà Phê Đôi",
|
name: "Double Coffee Combo",
|
||||||
description: "2 ly cà phê đen + 2 bánh mì nướng bơ, tiết kiệm 15%.",
|
description: "2 black coffees + 2 toasted butter breads, save 15%.",
|
||||||
price: 75000,
|
price: 75000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
items: [
|
items: [
|
||||||
@@ -253,8 +253,8 @@ export const MOCK_COMBOS: Combo[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Combo Trà Sữa Nhóm",
|
name: "Group Tea Combo",
|
||||||
description: "2 trà đào cam sả + 2 trà xanh matcha, dành cho nhóm bạn.",
|
description: "2 peach orange lemongrass teas + 2 matcha green teas, perfect for a group.",
|
||||||
price: 130000,
|
price: 130000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
items: [
|
items: [
|
||||||
@@ -265,8 +265,8 @@ export const MOCK_COMBOS: Combo[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "Combo Buổi Sáng",
|
name: "Morning Combo",
|
||||||
description: "1 cà phê sữa + 1 bánh flan, khởi đầu ngày mới ngọt ngào.",
|
description: "1 milk coffee + 1 caramel flan — start your day on a sweet note.",
|
||||||
price: 48000,
|
price: 48000,
|
||||||
image: "/imgs/products/placeholder.jpg",
|
image: "/imgs/products/placeholder.jpg",
|
||||||
items: [
|
items: [
|
||||||
@@ -354,34 +354,34 @@ export const MOCK_REVENUE_DAILY: RevenueDataPoint[] = [
|
|||||||
|
|
||||||
// Weekly revenue (last 12 weeks)
|
// Weekly revenue (last 12 weeks)
|
||||||
export const MOCK_REVENUE_WEEKLY: RevenueDataPoint[] = [
|
export const MOCK_REVENUE_WEEKLY: RevenueDataPoint[] = [
|
||||||
{ label: "T1/W1", revenue: 8200000, orders: 295 },
|
{ label: "Jan/W1", revenue: 8200000, orders: 295 },
|
||||||
{ label: "T1/W2", revenue: 9450000, orders: 340 },
|
{ label: "Jan/W2", revenue: 9450000, orders: 340 },
|
||||||
{ label: "T1/W3", revenue: 10100000, orders: 362 },
|
{ label: "Jan/W3", revenue: 10100000, orders: 362 },
|
||||||
{ label: "T1/W4", revenue: 8750000, orders: 315 },
|
{ label: "Jan/W4", revenue: 8750000, orders: 315 },
|
||||||
{ label: "T2/W1", revenue: 9200000, orders: 330 },
|
{ label: "Feb/W1", revenue: 9200000, orders: 330 },
|
||||||
{ label: "T2/W2", revenue: 10500000, orders: 378 },
|
{ label: "Feb/W2", revenue: 10500000, orders: 378 },
|
||||||
{ label: "T2/W3", revenue: 11200000, orders: 400 },
|
{ label: "Feb/W3", revenue: 11200000, orders: 400 },
|
||||||
{ label: "T2/W4", revenue: 9800000, orders: 352 },
|
{ label: "Feb/W4", revenue: 9800000, orders: 352 },
|
||||||
{ label: "T3/W1", revenue: 10400000, orders: 374 },
|
{ label: "Mar/W1", revenue: 10400000, orders: 374 },
|
||||||
{ label: "T3/W2", revenue: 11800000, orders: 424 },
|
{ label: "Mar/W2", revenue: 11800000, orders: 424 },
|
||||||
{ label: "T3/W3", revenue: 12500000, orders: 448 },
|
{ label: "Mar/W3", revenue: 12500000, orders: 448 },
|
||||||
{ label: "T3/W4", revenue: 10900000, orders: 392 },
|
{ label: "Mar/W4", revenue: 10900000, orders: 392 },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Monthly revenue (last 12 months)
|
// Monthly revenue (last 12 months)
|
||||||
export const MOCK_REVENUE_MONTHLY: RevenueDataPoint[] = [
|
export const MOCK_REVENUE_MONTHLY: RevenueDataPoint[] = [
|
||||||
{ label: "T4/2025", revenue: 42000000, orders: 1512 },
|
{ label: "Apr/2025", revenue: 42000000, orders: 1512 },
|
||||||
{ label: "T5/2025", revenue: 45500000, orders: 1638 },
|
{ label: "May/2025", revenue: 45500000, orders: 1638 },
|
||||||
{ label: "T6/2025", revenue: 48000000, orders: 1728 },
|
{ label: "Jun/2025", revenue: 48000000, orders: 1728 },
|
||||||
{ label: "T7/2025", revenue: 52000000, orders: 1872 },
|
{ label: "Jul/2025", revenue: 52000000, orders: 1872 },
|
||||||
{ label: "T8/2025", revenue: 49500000, orders: 1782 },
|
{ label: "Aug/2025", revenue: 49500000, orders: 1782 },
|
||||||
{ label: "T9/2025", revenue: 46800000, orders: 1685 },
|
{ label: "Sep/2025", revenue: 46800000, orders: 1685 },
|
||||||
{ label: "T10/2025", revenue: 51200000, orders: 1843 },
|
{ label: "Oct/2025", revenue: 51200000, orders: 1843 },
|
||||||
{ label: "T11/2025", revenue: 55000000, orders: 1980 },
|
{ label: "Nov/2025", revenue: 55000000, orders: 1980 },
|
||||||
{ label: "T12/2025", revenue: 62000000, orders: 2232 },
|
{ label: "Dec/2025", revenue: 62000000, orders: 2232 },
|
||||||
{ label: "T1/2026", revenue: 44000000, orders: 1584 },
|
{ label: "Jan/2026", revenue: 44000000, orders: 1584 },
|
||||||
{ label: "T2/2026", revenue: 47500000, orders: 1710 },
|
{ label: "Feb/2026", revenue: 47500000, orders: 1710 },
|
||||||
{ label: "T3/2026", revenue: 53500000, orders: 1926 },
|
{ label: "Mar/2026", revenue: 53500000, orders: 1926 },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Yearly revenue (last 5 years)
|
// Yearly revenue (last 5 years)
|
||||||
@@ -397,7 +397,7 @@ export const MOCK_REVENUE_YEARLY: RevenueDataPoint[] = [
|
|||||||
export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
||||||
{
|
{
|
||||||
productId: 12,
|
productId: 12,
|
||||||
name: "Latte Caramel",
|
name: "Caramel Latte",
|
||||||
category: "latte",
|
category: "latte",
|
||||||
unitsSold: 487,
|
unitsSold: 487,
|
||||||
revenue: 21915000,
|
revenue: 21915000,
|
||||||
@@ -408,7 +408,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 6,
|
productId: 6,
|
||||||
name: "Trà Xanh Matcha",
|
name: "Matcha Green Tea",
|
||||||
category: "tra",
|
category: "tra",
|
||||||
unitsSold: 412,
|
unitsSold: 412,
|
||||||
revenue: 16480000,
|
revenue: 16480000,
|
||||||
@@ -419,7 +419,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 5,
|
productId: 5,
|
||||||
name: "Trà Đào Cam Sả",
|
name: "Peach Orange Lemongrass Tea",
|
||||||
category: "tra",
|
category: "tra",
|
||||||
unitsSold: 398,
|
unitsSold: 398,
|
||||||
revenue: 13930000,
|
revenue: 13930000,
|
||||||
@@ -430,7 +430,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 13,
|
productId: 13,
|
||||||
name: "Latte Vanilla",
|
name: "Vanilla Latte",
|
||||||
category: "latte",
|
category: "latte",
|
||||||
unitsSold: 356,
|
unitsSold: 356,
|
||||||
revenue: 16020000,
|
revenue: 16020000,
|
||||||
@@ -441,7 +441,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 4,
|
productId: 4,
|
||||||
name: "Cà Phê Trứng",
|
name: "Egg Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
unitsSold: 340,
|
unitsSold: 340,
|
||||||
revenue: 15300000,
|
revenue: 15300000,
|
||||||
@@ -452,7 +452,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 2,
|
productId: 2,
|
||||||
name: "Cà Phê Sữa",
|
name: "Milk Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
unitsSold: 325,
|
unitsSold: 325,
|
||||||
revenue: 9750000,
|
revenue: 9750000,
|
||||||
@@ -463,7 +463,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 3,
|
productId: 3,
|
||||||
name: "Bạc Xỉu",
|
name: "White Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
unitsSold: 298,
|
unitsSold: 298,
|
||||||
revenue: 9536000,
|
revenue: 9536000,
|
||||||
@@ -474,7 +474,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 1,
|
productId: 1,
|
||||||
name: "Cà Phê Đen",
|
name: "Black Coffee",
|
||||||
category: "cafe",
|
category: "cafe",
|
||||||
unitsSold: 285,
|
unitsSold: 285,
|
||||||
revenue: 7125000,
|
revenue: 7125000,
|
||||||
@@ -485,7 +485,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 9,
|
productId: 9,
|
||||||
name: "Sữa Chua Dâu",
|
name: "Strawberry Yogurt",
|
||||||
category: "sua-chua",
|
category: "sua-chua",
|
||||||
unitsSold: 267,
|
unitsSold: 267,
|
||||||
revenue: 10680000,
|
revenue: 10680000,
|
||||||
@@ -496,7 +496,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 10,
|
productId: 10,
|
||||||
name: "Nước Ép Cam",
|
name: "Fresh Orange Juice",
|
||||||
category: "nuoc-ep",
|
category: "nuoc-ep",
|
||||||
unitsSold: 241,
|
unitsSold: 241,
|
||||||
revenue: 8435000,
|
revenue: 8435000,
|
||||||
@@ -507,7 +507,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 8,
|
productId: 8,
|
||||||
name: "Sữa Chua Trân Châu",
|
name: "Yogurt with Tapioca Pearls",
|
||||||
category: "sua-chua",
|
category: "sua-chua",
|
||||||
unitsSold: 228,
|
unitsSold: 228,
|
||||||
revenue: 8664000,
|
revenue: 8664000,
|
||||||
@@ -518,7 +518,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 7,
|
productId: 7,
|
||||||
name: "Trà Vải Hoa Nhài",
|
name: "Lychee Jasmine Tea",
|
||||||
category: "tra",
|
category: "tra",
|
||||||
unitsSold: 215,
|
unitsSold: 215,
|
||||||
revenue: 8170000,
|
revenue: 8170000,
|
||||||
@@ -529,7 +529,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 15,
|
productId: 15,
|
||||||
name: "Bánh Flan",
|
name: "Caramel Flan",
|
||||||
category: "giai-khat",
|
category: "giai-khat",
|
||||||
unitsSold: 198,
|
unitsSold: 198,
|
||||||
revenue: 4950000,
|
revenue: 4950000,
|
||||||
@@ -540,7 +540,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 11,
|
productId: 11,
|
||||||
name: "Nước Ép Dưa Hấu",
|
name: "Watermelon Juice",
|
||||||
category: "nuoc-ep",
|
category: "nuoc-ep",
|
||||||
unitsSold: 182,
|
unitsSold: 182,
|
||||||
revenue: 5460000,
|
revenue: 5460000,
|
||||||
@@ -551,7 +551,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 14,
|
productId: 14,
|
||||||
name: "Bánh Mì Nướng Bơ",
|
name: "Toasted Butter Bread",
|
||||||
category: "giai-khat",
|
category: "giai-khat",
|
||||||
unitsSold: 175,
|
unitsSold: 175,
|
||||||
revenue: 3500000,
|
revenue: 3500000,
|
||||||
@@ -562,7 +562,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 16,
|
productId: 16,
|
||||||
name: "Trân Châu Đen",
|
name: "Black Tapioca Pearls",
|
||||||
category: "topping",
|
category: "topping",
|
||||||
unitsSold: 456,
|
unitsSold: 456,
|
||||||
revenue: 4560000,
|
revenue: 4560000,
|
||||||
@@ -573,7 +573,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 17,
|
productId: 17,
|
||||||
name: "Thạch Cà Phê",
|
name: "Coffee Jelly",
|
||||||
category: "topping",
|
category: "topping",
|
||||||
unitsSold: 389,
|
unitsSold: 389,
|
||||||
revenue: 3890000,
|
revenue: 3890000,
|
||||||
@@ -584,7 +584,7 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
productId: 18,
|
productId: 18,
|
||||||
name: "Trân Châu Trắng",
|
name: "White Tapioca Pearls",
|
||||||
category: "topping",
|
category: "topping",
|
||||||
unitsSold: 342,
|
unitsSold: 342,
|
||||||
revenue: 3420000,
|
revenue: 3420000,
|
||||||
@@ -595,22 +595,6 @@ export const MOCK_PRODUCT_SALES: ProductSalesStats[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// ===== MOCK USERS (for UI demo – replace with real auth) =====
|
|
||||||
export const MOCK_USERS: Record<string, User> = {
|
|
||||||
manager: {
|
|
||||||
id: 1,
|
|
||||||
name: "Nguyễn Văn An",
|
|
||||||
role: "manager",
|
|
||||||
avatar: null,
|
|
||||||
},
|
|
||||||
staff: {
|
|
||||||
id: 2,
|
|
||||||
name: "Trần Thị Bình",
|
|
||||||
role: "staff",
|
|
||||||
avatar: null,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// ===== SHIFT / SCHEDULE DATA =====
|
// ===== SHIFT / SCHEDULE DATA =====
|
||||||
|
|
||||||
export const DEPARTMENTS: Department[] = [
|
export const DEPARTMENTS: Department[] = [
|
||||||
@@ -635,9 +619,9 @@ function generateMockShifts(): ShiftSlot[] {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const staffPool = [
|
const staffPool = [
|
||||||
{ id: 2, name: "Nguyễn Văn An" },
|
{ id: 2, name: "Alex Nguyen" },
|
||||||
{ id: 3, name: "Trần Thị Bình" },
|
{ id: 3, name: "Binh Tran" },
|
||||||
{ id: 4, name: "Lê Văn Cường" },
|
{ id: 4, name: "Cuong Le" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Generate shifts from April 6 to April 26, 2026
|
// Generate shifts from April 6 to April 26, 2026
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import type { Eatery } from "./types";
|
||||||
|
|
||||||
|
export async function gqlFetch<T = Record<string, unknown>>(
|
||||||
|
query: string,
|
||||||
|
variables?: Record<string, unknown>,
|
||||||
|
): Promise<T> {
|
||||||
|
const res = await fetch("/api/eatery/graphql", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
credentials: "include",
|
||||||
|
body: JSON.stringify({ query, variables }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) throw new Error(`GraphQL request failed: ${res.status}`);
|
||||||
|
return res.json() as Promise<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addManagerMenuItem(
|
||||||
|
name: string,
|
||||||
|
price: number,
|
||||||
|
): Promise<{ id: string; name: string; price: number } | null> {
|
||||||
|
const data = await gqlFetch<{
|
||||||
|
addMenuItem: { id: string; name: string; price: number } | null;
|
||||||
|
}>(
|
||||||
|
`mutation($name: String!, $price: Float!) {
|
||||||
|
addMenuItem(name: $name, price: $price) { id name price }
|
||||||
|
}`,
|
||||||
|
{ name, price },
|
||||||
|
);
|
||||||
|
return data.addMenuItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchManagerEatery(): Promise<Eatery | null> {
|
||||||
|
const data = await gqlFetch<{ eateriesByOwner: Eatery | null }>(`
|
||||||
|
query {
|
||||||
|
eateriesByOwner {
|
||||||
|
id
|
||||||
|
ownerId
|
||||||
|
name
|
||||||
|
isVerified
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
return data.eateriesByOwner;
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import type { Combo, ComboItem, MenuCategory, Product } from "./types";
|
|||||||
|
|
||||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export type ManagerTab = "products" | "combos" | "categories";
|
export type ManagerTab = "products" | "combos" | "categories" | "menu-items";
|
||||||
|
|
||||||
interface ManagerContextType {
|
interface ManagerContextType {
|
||||||
// Data
|
// Data
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ export interface SocialLinks {
|
|||||||
website: string;
|
website: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===== EATERY (GRAPHQL) TYPES =====
|
||||||
|
export interface Eatery {
|
||||||
|
id: string;
|
||||||
|
ownerId: string;
|
||||||
|
name: string;
|
||||||
|
isVerified: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
// ===== SHOP (QUÁN NƯỚC) TYPES =====
|
// ===== SHOP (QUÁN NƯỚC) TYPES =====
|
||||||
export interface Shop {
|
export interface Shop {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
+6
-9
@@ -20,16 +20,13 @@ const nextConfig: NextConfig = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
const rewrites = [];
|
const gatewayUrl = "http://localhost:32080";
|
||||||
|
return [
|
||||||
if (process.env.NODE_ENV !== "production") {
|
{
|
||||||
rewrites.push({
|
|
||||||
source: "/api/:path*",
|
source: "/api/:path*",
|
||||||
destination: "http://host.docker.internal:32080/api/:path*",
|
destination: `${gatewayUrl}/api/:path*`,
|
||||||
});
|
},
|
||||||
}
|
];
|
||||||
|
|
||||||
return rewrites;
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "temp",
|
"name": "temp",
|
||||||
"version": "1.2.0",
|
"version": "1.2.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "temp",
|
"name": "temp",
|
||||||
"version": "1.2.0",
|
"version": "1.2.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/postcss": "^4.2.2",
|
"@tailwindcss/postcss": "^4.2.2",
|
||||||
"@types/node": "^20.19.37",
|
"@types/node": "^20.19.37",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "temp",
|
"name": "temp",
|
||||||
"version": "1.2.0",
|
"version": "1.2.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
Generated
+84
-48
@@ -20,9 +20,6 @@ importers:
|
|||||||
next:
|
next:
|
||||||
specifier: 16.1.7
|
specifier: 16.1.7
|
||||||
version: 16.1.7(@babel/core@7.29.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
version: 16.1.7(@babel/core@7.29.0)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
||||||
nextjs:
|
|
||||||
specifier: ^0.0.3
|
|
||||||
version: 0.0.3
|
|
||||||
react:
|
react:
|
||||||
specifier: 19.2.3
|
specifier: 19.2.3
|
||||||
version: 19.2.3
|
version: 19.2.3
|
||||||
@@ -221,12 +218,16 @@ packages:
|
|||||||
resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==}
|
resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@humanfs/core@0.19.1':
|
'@humanfs/core@0.19.2':
|
||||||
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
|
resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==}
|
||||||
engines: {node: '>=18.18.0'}
|
engines: {node: '>=18.18.0'}
|
||||||
|
|
||||||
'@humanfs/node@0.16.7':
|
'@humanfs/node@0.16.8':
|
||||||
resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==}
|
resolution: {integrity: sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==}
|
||||||
|
engines: {node: '>=18.18.0'}
|
||||||
|
|
||||||
|
'@humanfs/types@0.15.0':
|
||||||
|
resolution: {integrity: sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==}
|
||||||
engines: {node: '>=18.18.0'}
|
engines: {node: '>=18.18.0'}
|
||||||
|
|
||||||
'@humanwhocodes/module-importer@1.0.1':
|
'@humanwhocodes/module-importer@1.0.1':
|
||||||
@@ -267,89 +268,105 @@ packages:
|
|||||||
resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}
|
resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-libvips-linux-arm@1.2.4':
|
'@img/sharp-libvips-linux-arm@1.2.4':
|
||||||
resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}
|
resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-libvips-linux-ppc64@1.2.4':
|
'@img/sharp-libvips-linux-ppc64@1.2.4':
|
||||||
resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==}
|
resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-libvips-linux-riscv64@1.2.4':
|
'@img/sharp-libvips-linux-riscv64@1.2.4':
|
||||||
resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==}
|
resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-libvips-linux-s390x@1.2.4':
|
'@img/sharp-libvips-linux-s390x@1.2.4':
|
||||||
resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}
|
resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-libvips-linux-x64@1.2.4':
|
'@img/sharp-libvips-linux-x64@1.2.4':
|
||||||
resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}
|
resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-libvips-linuxmusl-arm64@1.2.4':
|
'@img/sharp-libvips-linuxmusl-arm64@1.2.4':
|
||||||
resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}
|
resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@img/sharp-libvips-linuxmusl-x64@1.2.4':
|
'@img/sharp-libvips-linuxmusl-x64@1.2.4':
|
||||||
resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}
|
resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@img/sharp-linux-arm64@0.34.5':
|
'@img/sharp-linux-arm64@0.34.5':
|
||||||
resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}
|
resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-linux-arm@0.34.5':
|
'@img/sharp-linux-arm@0.34.5':
|
||||||
resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}
|
resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-linux-ppc64@0.34.5':
|
'@img/sharp-linux-ppc64@0.34.5':
|
||||||
resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==}
|
resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-linux-riscv64@0.34.5':
|
'@img/sharp-linux-riscv64@0.34.5':
|
||||||
resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==}
|
resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-linux-s390x@0.34.5':
|
'@img/sharp-linux-s390x@0.34.5':
|
||||||
resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}
|
resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-linux-x64@0.34.5':
|
'@img/sharp-linux-x64@0.34.5':
|
||||||
resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}
|
resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@img/sharp-linuxmusl-arm64@0.34.5':
|
'@img/sharp-linuxmusl-arm64@0.34.5':
|
||||||
resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}
|
resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@img/sharp-linuxmusl-x64@0.34.5':
|
'@img/sharp-linuxmusl-x64@0.34.5':
|
||||||
resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}
|
resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}
|
||||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@img/sharp-wasm32@0.34.5':
|
'@img/sharp-wasm32@0.34.5':
|
||||||
resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}
|
resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}
|
||||||
@@ -416,24 +433,28 @@ packages:
|
|||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@next/swc-linux-arm64-musl@16.1.7':
|
'@next/swc-linux-arm64-musl@16.1.7':
|
||||||
resolution: {integrity: sha512-uufcze7LYv0FQg9GnNeZ3/whYfo+1Q3HnQpm16o6Uyi0OVzLlk2ZWoY7j07KADZFY8qwDbsmFnMQP3p3+Ftprw==}
|
resolution: {integrity: sha512-uufcze7LYv0FQg9GnNeZ3/whYfo+1Q3HnQpm16o6Uyi0OVzLlk2ZWoY7j07KADZFY8qwDbsmFnMQP3p3+Ftprw==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@next/swc-linux-x64-gnu@16.1.7':
|
'@next/swc-linux-x64-gnu@16.1.7':
|
||||||
resolution: {integrity: sha512-KWVf2gxYvHtvuT+c4MBOGxuse5TD7DsMFYSxVxRBnOzok/xryNeQSjXgxSv9QpIVlaGzEn/pIuI6Koosx8CGWA==}
|
resolution: {integrity: sha512-KWVf2gxYvHtvuT+c4MBOGxuse5TD7DsMFYSxVxRBnOzok/xryNeQSjXgxSv9QpIVlaGzEn/pIuI6Koosx8CGWA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@next/swc-linux-x64-musl@16.1.7':
|
'@next/swc-linux-x64-musl@16.1.7':
|
||||||
resolution: {integrity: sha512-HguhaGwsGr1YAGs68uRKc4aGWxLET+NevJskOcCAwXbwj0fYX0RgZW2gsOCzr9S11CSQPIkxmoSbuVaBp4Z3dA==}
|
resolution: {integrity: sha512-HguhaGwsGr1YAGs68uRKc4aGWxLET+NevJskOcCAwXbwj0fYX0RgZW2gsOCzr9S11CSQPIkxmoSbuVaBp4Z3dA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@next/swc-win32-arm64-msvc@16.1.7':
|
'@next/swc-win32-arm64-msvc@16.1.7':
|
||||||
resolution: {integrity: sha512-S0n3KrDJokKTeFyM/vGGGR8+pCmXYrjNTk2ZozOL1C/JFdfUIL9O1ATaJOl5r2POe56iRChbsszrjMAdWSv7kQ==}
|
resolution: {integrity: sha512-S0n3KrDJokKTeFyM/vGGGR8+pCmXYrjNTk2ZozOL1C/JFdfUIL9O1ATaJOl5r2POe56iRChbsszrjMAdWSv7kQ==}
|
||||||
@@ -631,24 +652,28 @@ packages:
|
|||||||
engines: {node: '>= 20'}
|
engines: {node: '>= 20'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@tailwindcss/oxide-linux-arm64-musl@4.2.2':
|
'@tailwindcss/oxide-linux-arm64-musl@4.2.2':
|
||||||
resolution: {integrity: sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag==}
|
resolution: {integrity: sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag==}
|
||||||
engines: {node: '>= 20'}
|
engines: {node: '>= 20'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@tailwindcss/oxide-linux-x64-gnu@4.2.2':
|
'@tailwindcss/oxide-linux-x64-gnu@4.2.2':
|
||||||
resolution: {integrity: sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg==}
|
resolution: {integrity: sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg==}
|
||||||
engines: {node: '>= 20'}
|
engines: {node: '>= 20'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@tailwindcss/oxide-linux-x64-musl@4.2.2':
|
'@tailwindcss/oxide-linux-x64-musl@4.2.2':
|
||||||
resolution: {integrity: sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ==}
|
resolution: {integrity: sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ==}
|
||||||
engines: {node: '>= 20'}
|
engines: {node: '>= 20'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@tailwindcss/oxide-wasm32-wasi@4.2.2':
|
'@tailwindcss/oxide-wasm32-wasi@4.2.2':
|
||||||
resolution: {integrity: sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q==}
|
resolution: {integrity: sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q==}
|
||||||
@@ -843,41 +868,49 @@ packages:
|
|||||||
resolution: {integrity: sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ==}
|
resolution: {integrity: sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-arm64-musl@1.11.1':
|
'@unrs/resolver-binding-linux-arm64-musl@1.11.1':
|
||||||
resolution: {integrity: sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w==}
|
resolution: {integrity: sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-ppc64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-ppc64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA==}
|
resolution: {integrity: sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA==}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-riscv64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-riscv64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ==}
|
resolution: {integrity: sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ==}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-riscv64-musl@1.11.1':
|
'@unrs/resolver-binding-linux-riscv64-musl@1.11.1':
|
||||||
resolution: {integrity: sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew==}
|
resolution: {integrity: sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew==}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-s390x-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-s390x-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg==}
|
resolution: {integrity: sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg==}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-x64-gnu@1.11.1':
|
'@unrs/resolver-binding-linux-x64-gnu@1.11.1':
|
||||||
resolution: {integrity: sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w==}
|
resolution: {integrity: sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@unrs/resolver-binding-linux-x64-musl@1.11.1':
|
'@unrs/resolver-binding-linux-x64-musl@1.11.1':
|
||||||
resolution: {integrity: sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA==}
|
resolution: {integrity: sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@unrs/resolver-binding-wasm32-wasi@1.11.1':
|
'@unrs/resolver-binding-wasm32-wasi@1.11.1':
|
||||||
resolution: {integrity: sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ==}
|
resolution: {integrity: sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ==}
|
||||||
@@ -1063,8 +1096,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
|
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
|
||||||
engines: {node: 18 || 20 || >=22}
|
engines: {node: 18 || 20 || >=22}
|
||||||
|
|
||||||
baseline-browser-mapping@2.10.19:
|
baseline-browser-mapping@2.10.20:
|
||||||
resolution: {integrity: sha512-qCkNLi2sfBOn8XhZQ0FXsT1Ki/Yo5P90hrkRamVFRS7/KV9hpfA4HkoWNU152+8w0zPjnxo5psx5NL3PSGgv5g==}
|
resolution: {integrity: sha512-1AaXxEPfXT+GvTBJFuy4yXVHWJBXa4OdbIebGN/wX5DlsIkU0+wzGnd2lOzokSk51d5LUmqjgBLRLlypLUqInQ==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -1591,8 +1624,8 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9
|
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9
|
||||||
|
|
||||||
eslint-plugin-react-hooks@7.1.0:
|
eslint-plugin-react-hooks@7.1.1:
|
||||||
resolution: {integrity: sha512-LDicyhrRFrIaheDYryeM2W8gWyZXnAs4zIr2WVPiOSeTmIu2RjR4x/9N0xLaRWZ+9hssBDGo3AadcohuzAvSvg==}
|
resolution: {integrity: sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0
|
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0
|
||||||
@@ -1944,8 +1977,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-L83pBR/oZvQQNjv4kw9aUpTqBxERPiY7B42jsmkt1VDeUaRVhYkEIKzkCqrppjtxHe2EZqzZJzuhMXsWsxYIsw==}
|
resolution: {integrity: sha512-L83pBR/oZvQQNjv4kw9aUpTqBxERPiY7B42jsmkt1VDeUaRVhYkEIKzkCqrppjtxHe2EZqzZJzuhMXsWsxYIsw==}
|
||||||
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
|
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
|
||||||
|
|
||||||
hasown@2.0.2:
|
hasown@2.0.3:
|
||||||
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
resolution: {integrity: sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
hermes-estree@0.25.1:
|
hermes-estree@0.25.1:
|
||||||
@@ -2337,24 +2370,28 @@ packages:
|
|||||||
engines: {node: '>= 12.0.0'}
|
engines: {node: '>= 12.0.0'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
lightningcss-linux-arm64-musl@1.32.0:
|
lightningcss-linux-arm64-musl@1.32.0:
|
||||||
resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==}
|
resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==}
|
||||||
engines: {node: '>= 12.0.0'}
|
engines: {node: '>= 12.0.0'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
lightningcss-linux-x64-gnu@1.32.0:
|
lightningcss-linux-x64-gnu@1.32.0:
|
||||||
resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==}
|
resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==}
|
||||||
engines: {node: '>= 12.0.0'}
|
engines: {node: '>= 12.0.0'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
lightningcss-linux-x64-musl@1.32.0:
|
lightningcss-linux-x64-musl@1.32.0:
|
||||||
resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==}
|
resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==}
|
||||||
engines: {node: '>= 12.0.0'}
|
engines: {node: '>= 12.0.0'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
lightningcss-win32-arm64-msvc@1.32.0:
|
lightningcss-win32-arm64-msvc@1.32.0:
|
||||||
resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==}
|
resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==}
|
||||||
@@ -2616,10 +2653,6 @@ packages:
|
|||||||
sass:
|
sass:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
nextjs@0.0.3:
|
|
||||||
resolution: {integrity: sha512-mYbDUo4/sRAZ8TqK63PCpYnFiLg7BICG/ot9+guOrUKd4/Fo71ZmEQ41IZbH6nqbQvG7SXTBuofJXAIWfNho0w==}
|
|
||||||
engines: {node: '>=0.8.21'}
|
|
||||||
|
|
||||||
nocache@2.0.0:
|
nocache@2.0.0:
|
||||||
resolution: {integrity: sha512-YdKcy2x0dDwOh+8BEuHvA+mnOKAhmMQDgKBOCUGaLpewdmsRYguYZSom3yA+/OrE61O/q+NMQANnun65xpI1Hw==}
|
resolution: {integrity: sha512-YdKcy2x0dDwOh+8BEuHvA+mnOKAhmMQDgKBOCUGaLpewdmsRYguYZSom3yA+/OrE61O/q+NMQANnun65xpI1Hw==}
|
||||||
|
|
||||||
@@ -3557,8 +3590,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==}
|
resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
|
|
||||||
type-fest@5.5.0:
|
type-fest@5.6.0:
|
||||||
resolution: {integrity: sha512-PlBfpQwiUvGViBNX84Yxwjsdhd1TUlXr6zjX7eoirtCPIr08NAmxwa+fcYBTeRQxHo9YC9wwF3m9i700sHma8g==}
|
resolution: {integrity: sha512-8ZiHFm91orbSAe2PSAiSVBVko18pbhbiB3U9GglSzF/zCGkR+rxpHx6sEMCUm4kxY4LjDIUGgCfUMtwfZfjfUA==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
|
|
||||||
type-is@1.6.18:
|
type-is@1.6.18:
|
||||||
@@ -3999,13 +4032,18 @@ snapshots:
|
|||||||
'@eslint/core': 0.17.0
|
'@eslint/core': 0.17.0
|
||||||
levn: 0.4.1
|
levn: 0.4.1
|
||||||
|
|
||||||
'@humanfs/core@0.19.1': {}
|
'@humanfs/core@0.19.2':
|
||||||
|
|
||||||
'@humanfs/node@0.16.7':
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@humanfs/core': 0.19.1
|
'@humanfs/types': 0.15.0
|
||||||
|
|
||||||
|
'@humanfs/node@0.16.8':
|
||||||
|
dependencies:
|
||||||
|
'@humanfs/core': 0.19.2
|
||||||
|
'@humanfs/types': 0.15.0
|
||||||
'@humanwhocodes/retry': 0.4.3
|
'@humanwhocodes/retry': 0.4.3
|
||||||
|
|
||||||
|
'@humanfs/types@0.15.0': {}
|
||||||
|
|
||||||
'@humanwhocodes/module-importer@1.0.1': {}
|
'@humanwhocodes/module-importer@1.0.1': {}
|
||||||
|
|
||||||
'@humanwhocodes/retry@0.4.3': {}
|
'@humanwhocodes/retry@0.4.3': {}
|
||||||
@@ -4845,7 +4883,7 @@ snapshots:
|
|||||||
|
|
||||||
balanced-match@4.0.4: {}
|
balanced-match@4.0.4: {}
|
||||||
|
|
||||||
baseline-browser-mapping@2.10.19: {}
|
baseline-browser-mapping@2.10.20: {}
|
||||||
|
|
||||||
basic-auth@2.0.1:
|
basic-auth@2.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -4895,7 +4933,7 @@ snapshots:
|
|||||||
|
|
||||||
browserslist@4.28.2:
|
browserslist@4.28.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
baseline-browser-mapping: 2.10.19
|
baseline-browser-mapping: 2.10.20
|
||||||
caniuse-lite: 1.0.30001788
|
caniuse-lite: 1.0.30001788
|
||||||
electron-to-chromium: 1.5.340
|
electron-to-chromium: 1.5.340
|
||||||
node-releases: 2.0.37
|
node-releases: 2.0.37
|
||||||
@@ -5284,7 +5322,7 @@ snapshots:
|
|||||||
has-property-descriptors: 1.0.2
|
has-property-descriptors: 1.0.2
|
||||||
has-proto: 1.2.0
|
has-proto: 1.2.0
|
||||||
has-symbols: 1.1.0
|
has-symbols: 1.1.0
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
internal-slot: 1.1.0
|
internal-slot: 1.1.0
|
||||||
is-array-buffer: 3.0.5
|
is-array-buffer: 3.0.5
|
||||||
is-callable: 1.2.7
|
is-callable: 1.2.7
|
||||||
@@ -5351,11 +5389,11 @@ snapshots:
|
|||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
get-intrinsic: 1.3.0
|
get-intrinsic: 1.3.0
|
||||||
has-tostringtag: 1.0.2
|
has-tostringtag: 1.0.2
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
|
|
||||||
es-shim-unscopables@1.1.0:
|
es-shim-unscopables@1.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
|
|
||||||
es-to-primitive@1.3.0:
|
es-to-primitive@1.3.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -5382,7 +5420,7 @@ snapshots:
|
|||||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1))
|
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1))
|
||||||
eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.4(jiti@2.6.1))
|
eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.4(jiti@2.6.1))
|
||||||
eslint-plugin-react: 7.37.5(eslint@9.39.4(jiti@2.6.1))
|
eslint-plugin-react: 7.37.5(eslint@9.39.4(jiti@2.6.1))
|
||||||
eslint-plugin-react-hooks: 7.1.0(eslint@9.39.4(jiti@2.6.1))
|
eslint-plugin-react-hooks: 7.1.1(eslint@9.39.4(jiti@2.6.1))
|
||||||
globals: 16.4.0
|
globals: 16.4.0
|
||||||
typescript-eslint: 8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3)
|
typescript-eslint: 8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3)
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
@@ -5439,7 +5477,7 @@ snapshots:
|
|||||||
eslint: 9.39.4(jiti@2.6.1)
|
eslint: 9.39.4(jiti@2.6.1)
|
||||||
eslint-import-resolver-node: 0.3.10
|
eslint-import-resolver-node: 0.3.10
|
||||||
eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1))
|
eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1))
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
is-core-module: 2.16.1
|
is-core-module: 2.16.1
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
minimatch: 3.1.5
|
minimatch: 3.1.5
|
||||||
@@ -5467,7 +5505,7 @@ snapshots:
|
|||||||
damerau-levenshtein: 1.0.8
|
damerau-levenshtein: 1.0.8
|
||||||
emoji-regex: 9.2.2
|
emoji-regex: 9.2.2
|
||||||
eslint: 9.39.4(jiti@2.6.1)
|
eslint: 9.39.4(jiti@2.6.1)
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
jsx-ast-utils: 3.3.5
|
jsx-ast-utils: 3.3.5
|
||||||
language-tags: 1.0.9
|
language-tags: 1.0.9
|
||||||
minimatch: 3.1.5
|
minimatch: 3.1.5
|
||||||
@@ -5475,7 +5513,7 @@ snapshots:
|
|||||||
safe-regex-test: 1.1.0
|
safe-regex-test: 1.1.0
|
||||||
string.prototype.includes: 2.0.1
|
string.prototype.includes: 2.0.1
|
||||||
|
|
||||||
eslint-plugin-react-hooks@7.1.0(eslint@9.39.4(jiti@2.6.1)):
|
eslint-plugin-react-hooks@7.1.1(eslint@9.39.4(jiti@2.6.1)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/core': 7.29.0
|
'@babel/core': 7.29.0
|
||||||
'@babel/parser': 7.29.2
|
'@babel/parser': 7.29.2
|
||||||
@@ -5496,7 +5534,7 @@ snapshots:
|
|||||||
es-iterator-helpers: 1.3.2
|
es-iterator-helpers: 1.3.2
|
||||||
eslint: 9.39.4(jiti@2.6.1)
|
eslint: 9.39.4(jiti@2.6.1)
|
||||||
estraverse: 5.3.0
|
estraverse: 5.3.0
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
jsx-ast-utils: 3.3.5
|
jsx-ast-utils: 3.3.5
|
||||||
minimatch: 3.1.5
|
minimatch: 3.1.5
|
||||||
object.entries: 1.1.9
|
object.entries: 1.1.9
|
||||||
@@ -5529,7 +5567,7 @@ snapshots:
|
|||||||
'@eslint/eslintrc': 3.3.5
|
'@eslint/eslintrc': 3.3.5
|
||||||
'@eslint/js': 9.39.4
|
'@eslint/js': 9.39.4
|
||||||
'@eslint/plugin-kit': 0.4.1
|
'@eslint/plugin-kit': 0.4.1
|
||||||
'@humanfs/node': 0.16.7
|
'@humanfs/node': 0.16.8
|
||||||
'@humanwhocodes/module-importer': 1.0.1
|
'@humanwhocodes/module-importer': 1.0.1
|
||||||
'@humanwhocodes/retry': 0.4.3
|
'@humanwhocodes/retry': 0.4.3
|
||||||
'@types/estree': 1.0.8
|
'@types/estree': 1.0.8
|
||||||
@@ -5761,7 +5799,7 @@ snapshots:
|
|||||||
asynckit: 0.4.0
|
asynckit: 0.4.0
|
||||||
combined-stream: 1.0.8
|
combined-stream: 1.0.8
|
||||||
es-set-tostringtag: 2.1.0
|
es-set-tostringtag: 2.1.0
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
mime-types: 2.1.35
|
mime-types: 2.1.35
|
||||||
|
|
||||||
formats@1.0.0: {}
|
formats@1.0.0: {}
|
||||||
@@ -5799,7 +5837,7 @@ snapshots:
|
|||||||
call-bound: 1.0.4
|
call-bound: 1.0.4
|
||||||
define-properties: 1.2.1
|
define-properties: 1.2.1
|
||||||
functions-have-names: 1.2.3
|
functions-have-names: 1.2.3
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
is-callable: 1.2.7
|
is-callable: 1.2.7
|
||||||
|
|
||||||
functions-have-names@1.2.3: {}
|
functions-have-names@1.2.3: {}
|
||||||
@@ -5822,7 +5860,7 @@ snapshots:
|
|||||||
get-proto: 1.0.1
|
get-proto: 1.0.1
|
||||||
gopd: 1.2.0
|
gopd: 1.2.0
|
||||||
has-symbols: 1.1.0
|
has-symbols: 1.1.0
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
math-intrinsics: 1.1.0
|
math-intrinsics: 1.1.0
|
||||||
|
|
||||||
get-own-enumerable-property-symbols@3.0.2: {}
|
get-own-enumerable-property-symbols@3.0.2: {}
|
||||||
@@ -5963,7 +6001,7 @@ snapshots:
|
|||||||
'@babel/runtime': 7.1.2
|
'@babel/runtime': 7.1.2
|
||||||
amqplib: 0.5.2
|
amqplib: 0.5.2
|
||||||
|
|
||||||
hasown@2.0.2:
|
hasown@2.0.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
function-bind: 1.1.2
|
function-bind: 1.1.2
|
||||||
|
|
||||||
@@ -6056,7 +6094,7 @@ snapshots:
|
|||||||
internal-slot@1.1.0:
|
internal-slot@1.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
side-channel: 1.1.0
|
side-channel: 1.1.0
|
||||||
|
|
||||||
into-stream@7.0.0:
|
into-stream@7.0.0:
|
||||||
@@ -6099,7 +6137,7 @@ snapshots:
|
|||||||
|
|
||||||
is-core-module@2.16.1:
|
is-core-module@2.16.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
|
|
||||||
is-data-view@1.0.2:
|
is-data-view@1.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -6154,7 +6192,7 @@ snapshots:
|
|||||||
call-bound: 1.0.4
|
call-bound: 1.0.4
|
||||||
gopd: 1.2.0
|
gopd: 1.2.0
|
||||||
has-tostringtag: 1.0.2
|
has-tostringtag: 1.0.2
|
||||||
hasown: 2.0.2
|
hasown: 2.0.3
|
||||||
|
|
||||||
is-regexp@1.0.0: {}
|
is-regexp@1.0.0: {}
|
||||||
|
|
||||||
@@ -6550,7 +6588,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@next/env': 16.1.7
|
'@next/env': 16.1.7
|
||||||
'@swc/helpers': 0.5.15
|
'@swc/helpers': 0.5.15
|
||||||
baseline-browser-mapping: 2.10.19
|
baseline-browser-mapping: 2.10.20
|
||||||
caniuse-lite: 1.0.30001788
|
caniuse-lite: 1.0.30001788
|
||||||
postcss: 8.4.31
|
postcss: 8.4.31
|
||||||
react: 19.2.3
|
react: 19.2.3
|
||||||
@@ -6570,8 +6608,6 @@ snapshots:
|
|||||||
- '@babel/core'
|
- '@babel/core'
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
|
|
||||||
nextjs@0.0.3: {}
|
|
||||||
|
|
||||||
nocache@2.0.0: {}
|
nocache@2.0.0: {}
|
||||||
|
|
||||||
node-emoji@2.2.0:
|
node-emoji@2.2.0:
|
||||||
@@ -6850,7 +6886,7 @@ snapshots:
|
|||||||
micro-memoize: 5.1.1
|
micro-memoize: 5.1.1
|
||||||
package-up: 5.0.0
|
package-up: 5.0.0
|
||||||
tiny-jsonc: 1.0.2
|
tiny-jsonc: 1.0.2
|
||||||
type-fest: 5.5.0
|
type-fest: 5.6.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
|
|
||||||
@@ -6937,14 +6973,14 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
find-up-simple: 1.0.1
|
find-up-simple: 1.0.1
|
||||||
read-pkg: 10.1.0
|
read-pkg: 10.1.0
|
||||||
type-fest: 5.5.0
|
type-fest: 5.6.0
|
||||||
|
|
||||||
read-pkg@10.1.0:
|
read-pkg@10.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/normalize-package-data': 2.4.4
|
'@types/normalize-package-data': 2.4.4
|
||||||
normalize-package-data: 8.0.0
|
normalize-package-data: 8.0.0
|
||||||
parse-json: 8.3.0
|
parse-json: 8.3.0
|
||||||
type-fest: 5.5.0
|
type-fest: 5.6.0
|
||||||
unicorn-magic: 0.4.0
|
unicorn-magic: 0.4.0
|
||||||
|
|
||||||
read-pkg@9.0.1:
|
read-pkg@9.0.1:
|
||||||
@@ -7523,7 +7559,7 @@ snapshots:
|
|||||||
|
|
||||||
type-fest@4.41.0: {}
|
type-fest@4.41.0: {}
|
||||||
|
|
||||||
type-fest@5.5.0:
|
type-fest@5.6.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
tagged-tag: 1.0.0
|
tagged-tag: 1.0.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user