feat(settings): add admin toggle for prescription upload button and bind to header
E2E Playwright Tests / Run Full E2E & Security Suites (push) Waiting to run
Deploy Canina / deploy (push) Has been cancelled

This commit is contained in:
parsa aghaei committed 2026-08-26 14:32:30 +03:30
1 parent 3109e30fd7
commit 0132cce0cb
13 files changed
+5099 -4983

No files matched your search

+32 -27
View File
@@ -46,6 +46,7 @@ export default function Header({
const [searchQuery, setSearchQuery] = useState("");
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const isB2BEnabled = useSettingsStore((s) => s.getBoolean('b2bRegistrationOpen', true) && s.getBoolean('b2b_enabled', true));
const isPrescriptionEnabled = useSettingsStore((s) => s.getText('PRESCRIPTION_UPLOAD_ENABLED', 'true') !== 'false');
const [menuItems, setMenuItems] = useState<{
id: string;
@@ -239,15 +240,17 @@ export default function Header({
{/* Left Action Buttons */}
<div className="flex items-center gap-1.5 sm:gap-3 shrink-0">
{/* Prescription Upload Button (Desktop & Mobile) */}
<button
onClick={() => setIsPrescriptionModalOpen(true)}
className="flex items-center gap-1.5 px-2.5 sm:px-3 py-2 bg-emerald-50 text-emerald-700 border border-emerald-200 hover:bg-emerald-100 rounded-xl text-[11px] sm:text-xs font-black transition-all shadow-xs cursor-pointer"
title="ثبت نسخه دامپزشک"
>
<FileHeart className="w-3.5 h-3.5 sm:w-4 sm:h-4 text-emerald-600 shrink-0" />
<span className="hidden xs:inline sm:inline">ثبت نسخه دامپزشک</span>
<span className="inline xs:hidden sm:hidden">ثبت نسخه</span>
</button>
{isPrescriptionEnabled && (
<button
onClick={() => setIsPrescriptionModalOpen(true)}
className="flex items-center gap-1.5 px-2.5 sm:px-3 py-2 bg-emerald-50 text-emerald-700 border border-emerald-200 hover:bg-emerald-100 rounded-xl text-[11px] sm:text-xs font-black transition-all shadow-xs cursor-pointer"
title="ثبت نسخه دامپزشک"
>
<FileHeart className="w-3.5 h-3.5 sm:w-4 sm:h-4 text-emerald-600 shrink-0" />
<span className="hidden xs:inline sm:inline">ثبت نسخه دامپزشک</span>
<span className="inline xs:hidden sm:hidden">ثبت نسخه</span>
</button>
)}
{/* User Account Button with Dropdown & Pets List */}
{isLoggedIn ? (
@@ -528,25 +531,27 @@ export default function Header({
</form>
{/* Direct Prescription CTA in Mobile Drawer */}
<button
type="button"
onClick={() => {
setIsMobileMenuOpen(false);
setIsPrescriptionModalOpen(true);
}}
className="w-full flex items-center justify-between p-3.5 bg-gradient-to-r from-emerald-500 to-teal-600 text-white rounded-2xl font-black text-xs shadow-md shadow-emerald-500/20 hover:brightness-105 transition-all cursor-pointer font-vazir"
>
<div className="flex items-center gap-2.5">
<div className="p-1.5 bg-white/20 rounded-xl">
<FileHeart className="w-4 h-4 text-white" />
{isPrescriptionEnabled && (
<button
type="button"
onClick={() => {
setIsMobileMenuOpen(false);
setIsPrescriptionModalOpen(true);
}}
className="w-full flex items-center justify-between p-3.5 bg-gradient-to-r from-emerald-500 to-teal-600 text-white rounded-2xl font-black text-xs shadow-md shadow-emerald-500/20 hover:brightness-105 transition-all cursor-pointer font-vazir"
>
<div className="flex items-center gap-2.5">
<div className="p-1.5 bg-white/20 rounded-xl">
<FileHeart className="w-4 h-4 text-white" />
</div>
<div className="text-right">
<div className="text-xs font-black">ثبت و استعلام نسخه دامپزشک</div>
<div className="text-[10px] text-emerald-100 font-medium">تامین فوری دارو و مکمل‌های اورجینال</div>
</div>
</div>
<div className="text-right">
<div className="text-xs font-black">ثبت و استعلام نسخه دامپزشک</div>
<div className="text-[10px] text-emerald-100 font-medium">تامین فوری دارو و مکمل‌های اورجینال</div>
</div>
</div>
<span className="text-lg">←</span>
</button>
<span className="text-lg">←</span>
</button>
)}
{/* Dynamic Menu Groups in Mobile Drawer */}
{headerNavItems.map((navGroup) => {