<?php Fun::lang() ?>

@php
    $hr = '<span style="text-align:center">-----------------------------------------------------------------------<span>';
@endphp
<link rel="stylesheet" type="text/css" href="{{asset('assets/css/production.css')}}">
<div class="print_form" style="overflow-y: scroll">
    <div class=" col-sm-12 col-xs-12 form-group text-center">
        <h3>{{__('administrator.return_item')}}</h3>
    </div>
    <div class=" col-sm-12 col-xs-12 form-group">
        <table class="inv-header" >
            <tr>
                <td>{{__('administrator.start_date')}}</td>
                <td width="2%">:</td>
                <td>{{date('d-m-Y',strtotime($production->date))}}</td>
            </tr>
            <tr>
                <td>{{__('administrator.invoice_number')}}</td>
                <td>:</td>
                <td>{{$production->invoice_number}}</td>
            </tr>
            @if($production->tailor_id)
            <tr>
                <td>{{__('administrator.tailor')}}</td>
                <td>:</td>
                <td>{{findTailor($production->tailor_id)->name}}</td>
            </tr>
            @endif
            <tr>
                <td>{{__('administrator.status')}}</td>
                <td>:</td>
                <td>{!! $production->done===1?'<span class="label label-success label-xs">'.__('administrator.done').'</span>':'' !!}</td>
            </tr>
        </table>
    </div>
    <hr>
    @php $g_total = 0; @endphp
            <table class="table" >
                <thead>
                <tr>
                    <th>{{__('administrator.date')}}</th>
                    <th>{{__('administrator.invoice_number')}}</th>
                    <th>{{__('administrator.user')}}</th>
                    <th>{{__('administrator.total_return_item')}}</th>
                    <th>{{__('administrator.note')}}</th>
                    <th>{{__('administrator.view')}}</th>
                </tr>
                </thead>
                <tbody>
                @foreach($production_done as $rd)
                    @php
                        $user = findUser($rd->user_id);
                        $export_to = findWarehouse($rd->export_to);
                        $date = date('d-m-Y',strtotime($rd->date));
                        $qty = \App\Model\production\ProductionDoneDetailModel::where('production_done_id',$rd->id)->sum('qty');
                        $g_total+=$qty;
                    @endphp
                    <tr>
                        <td>{{$date}}</td>
                        <td>{{$rd->invoice_number}}</td>
                        <td>{{$user->name??''}}</td>
                        <td>{{$qty}}</td>
                        <td>{{$rd->note}}</td>
                        <td><button type="button" class="button_info" onclick="getHtmlFormShow('{{route('production-done-view',$rd->id)}}','800px')"><span class="fa fa-eye"></span></button></td>
                    </tr>
                @endforeach
                </tbody>
            </table>
    <table class="table">
        <tr>
            <td class="no-border text-right"> {{__('administrator.total_return_item')}}</td>
            <td>{{$g_total}} {{__('administrator.item')}}</td>
        </tr>
    </table>
</div>

