
<?php Fun::lang() ?>
<div class="page-purchases">
    <div class="container-fluid">
        <div class="top-content">
            <div class="row1">
                <div class="col-sm-12 col-xs-12">
                    <h2 class="show-product">{{__('administrator.info_detail')}} </h2>
                    <hr>
                </div>
            </div>
        </div>
        <hr>
        <hr>

        <div class="summary-header">
            <table>
                <tr>
                    <td>
                        <table class="text-left">
                            <tr>
                                <td>
                                    {{__('administrator.item_name')}}
                                </td>
                                <td>
                                    : {{$data['product_name']}}
                                </td>
                            </tr>
                            <tr>
                                <td>{{__('administrator.code')}}</td>
                                <td> : {{$data['barcode']}}</td>
                            </tr>
                            <tr>
                                <td>{{__('administrator.category')}}</td>
                                <td> : {{$data['category']}}</td>
                            </tr>
                            <tr>
                                <td>{{__('administrator.brands')}}</td>
                                <td> : {{$data['brand']}}</td>
                            </tr>
                            <tr>
                                <td>{{__('administrator.shelf')}}</td>
                                <td> : {{$data['shelf']}}</td>
                            </tr>
                            <tr>
                                <td>{{__('administrator.qty_alert')}}</td>
                                <td> : {{$data['qty_alert']}} {{$data['unit_alert']}}</td>
                            </tr>
                            <tr>
                                <td>{{__('administrator.created_at')}}</td>
                                <td> : {{date('d-m-Y',strtotime($data['created_at']))}} </td>
                            </tr>
                        </table>
                    </td>
                    <td width="30%">
                        <img src="{{findImg(\App\Model\ProductModel::find($data['product_id']))}}" width="70%">
                    </td>
                </tr>
            </table>
        </div>
        <div class="wrapper-table">
            <table class="table table-striped table-hover ">
                <thead>
                <tr>
                    <th>#</th>
                    <th>{{__('administrator.unit_name')}}</th>
                    <th>{{__('administrator.color')}}</th>
                    <th>{{__('administrator.size')}}</th>
                    <th>{{__('administrator.qty_per_unit')}}</th>
                    <th>{{__('administrator.cost')}}</th>
                    <th>{{__('administrator.wholesale_price')}}</th>
                    <th>{{__('administrator.retail_price')}}</th>
                </tr>
                </thead>
                <tbody>
                @foreach($product_unit as $key => $value)
                    @php
                    $unit = findUnit($value->unit_id);
                    $color = findColor($value->color_id);
                    $size = findSize($value->size_id);
                    @endphp
                    <tr>
                        <td>{{$key+1}}</td>
                        <td>{{$unit?$unit->unit:''}} </td>
                        <td>{{$color?$color->name:''}} <span class="btn" style="background: {{findColor($value->color_id)->color}};border: 1px solid black"></span></td>
                        <td>{{$size?$size->size:''}} </td>
                        <td>{{$value->qty_per_unit}} </td>
                        <td>{{$data['currency']}} {{  number_format($value->cost,2) }}</td>
                        <td>{{$data['currency']}} {{  number_format($value->wholesale_price,2) }}</td>
                        <td>{{$data['currency']}} {{  number_format($value->retail_price,2) }}</td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
</div>
