@extends('layouts.app') @section('title', 'Kasir') @section('content') @php $productPayload=$products->map(fn($p)=>[ 'id'=>$p->id,'name'=>$p->name,'code'=>$p->code,'barcode'=>$p->barcode,'category_id'=>$p->category_id, 'image'=>$p->image_path?asset('media/'.$p->image_path):null,'type'=>$p->type,'price'=>$p->final_price, 'bom_ready'=>$p->type!=='bom'||($p->activeRecipe&&$p->activeRecipe->items->isNotEmpty()&&$p->activeRecipe->items->every(fn($item)=>(float)$item->unit_cost>0)), 'missing_materials'=>$p->type==='bom'?$p->activeRecipe?->items->filter(fn($item)=>(float)$item->unit_cost<=0)->pluck('material.name')->values()??[]:[], 'prices'=>$p->prices->pluck('final_price','branch_id'), 'hpp'=>$p->prices->pluck('hpp_snapshot','branch_id'), ]); $discountPayload=$branches->mapWithKeys(fn($branch)=>[$branch->id=>(($discountSettings[$branch->id]??'1')==='1')]); $defaultBranchId=auth()->user()->branch_id??$branches->first()?->id; $discountDisabled=($discountSettings[$defaultBranchId]??'1')!=='1'; @endphp
Klik produk untuk menambahkan ke keranjang.