@extends('admin.layouts.app')
@section('title')
    {{ $order->name }} <small>{{ $title }}</small>
@endsection

@section('content')
   <div class="content">
       @include('adminlte-templates::common.errors')
       <div class="box box-primary">
           <div class="box-body">
               <div class="row">
                   {!! Form::model($order, ['route' => ['admin.orders.update', $order->id], 'method' => 'patch', 'files' => true]) !!}

                        @include('admin.orders.fields')

                   {!! Form::close() !!}
               </div>
           </div>
       </div>
   </div>

   <!-- edit attachment show -->
   <div class="content">
    <h3 class="box-title" style="margin-top: -10px;">Attachments</h3>
    <div class="box box-primary images">
        <div class="box-header">
        </div>
        <div class="box-body">
            <div class="col-md-6">
            @if($order['attach']->isNotEmpty())
            <h4>Sales</h4>     
                @foreach($order['attach'] as $attachment)
                @if($attachment->instance_type == \App\Models\Attachment::INSTANCE_TYPE_SALES)
                    <div class="image-box">
                    <i class="fa fa-file fa-lg" data-id="{{$attachment->id}}"></i>
                    <a href="{{url('storage/app/'.$attachment->path)}}">{{$attachment->name}}</a>
                    <br>                   
                    <br><br>
                </div>       
                   @endif                        
                @endforeach
            @else
                <h4>No Attachments available</h4>
            @endif
        </div>
        <div class="col-md-6">
            @if($order['attach']->isNotEmpty())

            <h4>Production</h4>     
                @foreach($order['attach'] as $attachment)
                @if($attachment->instance_type == \App\Models\Attachment::INSTANCE_TYPE_PRODUCTION)
                    <div class="image-box">
                    <i class="fa fa-file fa-lg" data-id="{{$attachment->id}}"></i>
                    <a href="{{url('storage/app/'.$attachment->path)}}">{{$attachment->name}}</a>
                    <br>                   
                    <br><br>
                </div>       
                   @endif                        
                @endforeach
            @else

            @endif
        </div>
        </div>
    </div>
</div>


@endsection