bug fixed
This commit is contained in:
parent
52df438da4
commit
4db00f84fd
@ -1162,9 +1162,7 @@ const EditCompanyProfile = () => {
|
|||||||
if (productLimitMessage) return null;
|
if (productLimitMessage) return null;
|
||||||
|
|
||||||
if (checkedCountTotal >= MAX_TOTAL_SELECTED_PRODUCTS || allowedAddCount === 0) {
|
if (checkedCountTotal >= MAX_TOTAL_SELECTED_PRODUCTS || allowedAddCount === 0) {
|
||||||
return (
|
return null;
|
||||||
<p className="text-xs text-[#B91C1C] mt-1">Maximum of {MAX_TOTAL_SELECTED_PRODUCTS} products can be selected.</p>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newlyAddedCheckedCount >= allowedAddCount) {
|
if (newlyAddedCheckedCount >= allowedAddCount) {
|
||||||
@ -1293,12 +1291,33 @@ const EditCompanyProfile = () => {
|
|||||||
<h5 className="text-sm font-medium text-[#111827]">Selected Products</h5>
|
<h5 className="text-sm font-medium text-[#111827]">Selected Products</h5>
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="bg-[#FEF3C7] text-[#92400E] text-xs font-medium px-2 py-0.5 rounded-full">
|
{(() => {
|
||||||
{selectedProducts.filter(p => checkedProducts.has(p.value || p.id || p.product_id)).length}/15 selected
|
const checkedCount = selectedProducts.filter(p => checkedProducts.has(p.value || p.id || p.product_id)).length;
|
||||||
</span>
|
const isMaxReached = checkedCount >= 15;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={`text-xs font-medium px-2 py-0.5 rounded-full ${
|
||||||
|
isMaxReached
|
||||||
|
? 'bg-[#FEE2E2] text-[#B91C1C]'
|
||||||
|
: 'bg-[#FEF3C7] text-[#92400E]'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{checkedCount}/15 selected
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{selectedProducts.filter(p => checkedProducts.has(p.value || p.id || p.product_id)).length >= 15 && (
|
||||||
|
<div className="px-4 pt-3">
|
||||||
|
<div className="border border-[#FCA5A5] bg-[#FEF2F2] text-[#B91C1C] rounded-md px-3 py-2 text-xs">
|
||||||
|
Maximum limit of 15 products reached. Remove a product to add another.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
{selectedProducts.length > 0 ? (
|
{selectedProducts.length > 0 ? (
|
||||||
<ul className="divide-y divide-[#E5E7EB] max-h-96 overflow-y-auto">
|
<ul className="divide-y divide-[#E5E7EB] max-h-96 overflow-y-auto">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user