refactor: enhance product pricing logic in ProductCard and ProductModal components to exclude specific price types, and add pending verification count for user permissions in HandleInertiaRequests middleware
This commit is contained in:
parent
39fa697df8
commit
0078c16e17
@ -108,6 +108,12 @@ private function pendingCuttings(Request $request): int
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($user->can('owner_verifications.verify')) {
|
||||||
|
return Cutting::query()
|
||||||
|
->pendingVerification()
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
return Cutting::query()
|
return Cutting::query()
|
||||||
->completed()
|
->completed()
|
||||||
->count();
|
->count();
|
||||||
|
|||||||
@ -56,7 +56,9 @@ const getProductPriceRange = (product: Product) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (prices.length === 0) {
|
if (prices.length === 0) {
|
||||||
const fallbackPrices = product.variants.flatMap(v => v.prices.map(p => p.price));
|
const fallbackPrices = product.variants.flatMap(v =>
|
||||||
|
v.prices.filter(p => !['harga_modal', 'tiktok', 'shopee'].includes(p.type)).map(p => p.price)
|
||||||
|
);
|
||||||
|
|
||||||
if (fallbackPrices.length === 0) {
|
if (fallbackPrices.length === 0) {
|
||||||
return 'Rp 0';
|
return 'Rp 0';
|
||||||
|
|||||||
@ -166,11 +166,11 @@ const handleAddToCart = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Price Tiers -->
|
<!-- Price Tiers -->
|
||||||
<div v-if="activeVariant && activeVariant.prices.length > 0" class="space-y-2">
|
<div v-if="activeVariant && activeVariant.prices.filter(p => !['harga_modal', 'tiktok', 'shopee'].includes(p.type)).length > 0" class="space-y-2">
|
||||||
<h4 class="text-[10px] uppercase font-bold tracking-widest text-slate-400">Saluran Harga
|
<h4 class="text-[10px] uppercase font-bold tracking-widest text-slate-400">Saluran Harga
|
||||||
(Grosir/Eceran)</h4>
|
(Grosir/Eceran)</h4>
|
||||||
<div class="grid grid-cols-2 gap-1.5 max-h-28 md:max-h-36 overflow-y-auto scrollbar-thin pr-1">
|
<div class="grid grid-cols-2 gap-1.5 max-h-28 md:max-h-36 overflow-y-auto scrollbar-thin pr-1">
|
||||||
<button v-for="price in activeVariant.prices" :key="price.id"
|
<button v-for="price in activeVariant.prices.filter(p => !['harga_modal', 'tiktok', 'shopee'].includes(p.type))" :key="price.id"
|
||||||
@click="activePriceType = price.type" :class="[
|
@click="activePriceType = price.type" :class="[
|
||||||
'px-3 py-2 text-left rounded-xl border transition-all cursor-pointer',
|
'px-3 py-2 text-left rounded-xl border transition-all cursor-pointer',
|
||||||
activePriceType === price.type
|
activePriceType === price.type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user