fix(stock/editor/zibal): fix stock zero display in app, resolve admin rich text editor cursor jumping, optimize zibal queue parser
Deploy Canina / deploy (push) Successful in 1m38s

This commit is contained in:
parsa committed 2026-08-24 00:55:25 +03:30
1 parent d1e3daf992
commit 44e1f915f4
207 files changed
+254318 -117167

No files matched your search

@@ -170,7 +170,11 @@ const ArchiveProductCard: React.FC<{ product: Product }> = ({ product }) => {
) : (
<span className="text-xs font-bold text-amber-600 bg-amber-50 px-2 py-1 rounded-md">تماس جهت استعلام قیمت</span>
)}
{!useSettingsStore.getState().getText("catalog_disable_cart", "false").includes("true") && (() => {
{(product.packageSize !== undefined && product.packageSize !== null ? Number(product.packageSize) : 100) <= 0 ? (
<span className="px-2.5 py-1.5 rounded-xl bg-rose-50 text-rose-600 border border-rose-100 text-[11px] font-bold font-vazir">
ناموجود
</span>
) : !useSettingsStore.getState().getText("catalog_disable_cart", "false").includes("true") && (() => {
const cartItem = useCartStore.getState().items.find(i => i.product.id === product.id);
if (cartItem && cartItem.quantity > 0) {
return (
@@ -81,7 +81,7 @@ function ProductCard({ product }: { product: Product }) {
>
<Eye className="w-5 h-5" />
</div>
{allowCart && (
{allowCart && (product.packageSize !== undefined && product.packageSize !== null ? Number(product.packageSize) : 100) > 0 && (
<div
onClick={(e) => {
e.stopPropagation();
@@ -143,7 +143,7 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
return {
...apiProduct,
packageSize: apiProduct.packageSize || 100,
packageSize: apiProduct.packageSize !== undefined && apiProduct.packageSize !== null ? Number(apiProduct.packageSize) : 100,
};
}, [product, allProducts]);
@@ -185,8 +185,8 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
dailyDose = Math.max(1, Math.round(weight * factor));
}
const packageSize = fullProduct.packageSize || 100;
const duration = Math.max(1, Math.floor(packageSize / (dailyDose || 1)));
const packageSize = fullProduct.packageSize !== undefined && fullProduct.packageSize !== null ? Number(fullProduct.packageSize) : 100;
const duration = Math.max(1, Math.floor((packageSize || 100) / (dailyDose || 1)));
return {
dailyDose,
@@ -220,6 +220,8 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
);
if (!product || !fullProduct || !calculation) return <div className="min-h-screen flex items-center justify-center">محصول یافت نشد</div>;
const isOutOfStock = (product.packageSize !== undefined && product.packageSize !== null ? Number(product.packageSize) : 100) <= 0;
return (
<div className="min-h-screen bg-medical-gray-50 pt-2 pb-36 sm:pb-20 px-4 sm:px-6 lg:px-8 font-vazir" dir="rtl">
<div className="max-w-7xl mx-auto w-full">
@@ -274,10 +276,16 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
title="کلیک برای مشاهده تصویر بزرگتر"
>
<div className="absolute top-4 left-4 sm:top-6 sm:left-6 flex flex-col gap-1.5 sm:gap-2 z-10 items-start">
<div className="px-2.5 py-1 bg-green-500 text-white rounded-full text-[9px] sm:text-[10px] font-black uppercase tracking-widest flex items-center gap-1 font-vazir shadow-sm">
<CheckCircle2 className="w-3 h-3" />
موجود در انبار
</div>
{isOutOfStock ? (
<div className="px-2.5 py-1 bg-rose-500 text-white rounded-full text-[9px] sm:text-[10px] font-black uppercase tracking-widest flex items-center gap-1 font-vazir shadow-sm">
ناموجود در انبار
</div>
) : (
<div className="px-2.5 py-1 bg-green-500 text-white rounded-full text-[9px] sm:text-[10px] font-black uppercase tracking-widest flex items-center gap-1 font-vazir shadow-sm">
<CheckCircle2 className="w-3 h-3" />
موجود در انبار
</div>
)}
<div className="px-2.5 py-1 bg-canina-blue text-white rounded-full text-[9px] sm:text-[10px] font-black uppercase tracking-widest font-vazir whitespace-nowrap shadow-sm">
گرید دارویی اختصاصی
</div>
@@ -1061,6 +1069,14 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
<Phone className="w-4 h-4" />
استعلام و مشاوره
</a>
) : isOutOfStock ? (
<button
onClick={() => toast.info("درخواست اطلاع‌رسانی موجودی ثبت شد")}
className="flex-1 bg-amber-500 text-white py-2.5 px-3 rounded-xl font-black text-xs hover:bg-amber-600 transition-all flex items-center justify-center gap-1.5 shadow-md shadow-amber-500/20 whitespace-nowrap"
>
<Bell className="w-4 h-4" />
موجود شد خبر بده
</button>
) : (
<>
<div className="flex items-center gap-1 bg-medical-gray-50 border border-medical-gray-200 rounded-xl p-1 h-11">
@@ -124,7 +124,7 @@ export class ProductService {
category: categoryName || '',
categorySlug: data.categorySlug || '',
unit: data.unit || 'عدد',
packageSize: Number(data.packageSize || 100),
packageSize: data.packageSize !== undefined && data.packageSize !== null ? Number(data.packageSize) : 100,
dosage_logic: data.dosageLogic || '',
benefits: data.benefits || '',
suitableFor: (data.suitableFor as PetType) || 'سگ',