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
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (8.3) (push) Waiting to run
tests / ci (8.4) (push) Waiting to run
tests / ci (8.5) (push) Waiting to run

This commit is contained in:
Yoga Pangestu 2026-07-05 17:17:09 +07:00
parent 39fa697df8
commit 0078c16e17
3 changed files with 11 additions and 3 deletions

View File

@ -108,6 +108,12 @@ private function pendingCuttings(Request $request): int
return 0;
}
if ($user->can('owner_verifications.verify')) {
return Cutting::query()
->pendingVerification()
->count();
}
return Cutting::query()
->completed()
->count();

View File

@ -56,7 +56,9 @@ const getProductPriceRange = (product: Product) => {
);
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) {
return 'Rp 0';

View File

@ -166,11 +166,11 @@ const handleAddToCart = () => {
</div>
<!-- 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
(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">
<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="[
'px-3 py-2 text-left rounded-xl border transition-all cursor-pointer',
activePriceType === price.type