@extends('layouts.masterHome2')

@section('content')
<br> 


<div class="row" style="margin:20px">
          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
 
              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text  bg-info" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"> <b style="font-size:22px"> Waste</b> </span>
                <span class="info-box-number" style="text-align:center">{{$main->waste->name}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>

          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
              

              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-danger" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px"> Quantity {{$main->waste->unit}} </b></span>
                <span class="info-box-number" style="text-align:center">{{$main->quantity}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>

          <!-- /.col -->
          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
               

              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-success" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px">Store</b></span>
                <span class="info-box-number" style="text-align:center">{{$main->sell_store->store->store_name}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
          <div class="col-md-3 col-sm-6 col-12">
            <div class="info-box">
              

              <div class="info-box-content" style="height: 100px;">
                <span class="info-box-text bg-success" style="border-radius: 6px;height: 40px;display: flex;justify-content: center;align-items: center;"><b style="font-size:22px">Branch</b></span>
                <span class="info-box-number" style="text-align:center">{{$main->sell_store->branch->name}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
          
          <!-- /.col -->
        </div>

<div class="row">
<div class="col-md-6" style="margin-left:18px">
      <div class="card card-info">
          <div class="card-header">
            <h3 class="card-title">Add Sort From Carta #{{$main->id}} </h3>
          </div>
          <!-- /.card-header -->
          <!-- form start -->
          <form  role="form" method="POST" action="{{ url('/main/add_sort') }}">
                        {{ csrf_field() }}
          <div class="box-body">
                
            <div class="card-body">
                   
                <div class="form-group">
                  <label>Choose Sell Store</label>
                  <select class="form-control select2 select2-hidden-accessible"   style="width: 100%;" name="sell_store_id" id="sell_store_id" required>
                    @foreach( $sell_stores as $sell_store ) 
                    <option value="{{ $sell_store->id }}"  >{{$sell_store->store->store_name}} -- {{$sell_store->branch->name}}</option>
                    @endforeach
                  </select>
                </div>
  
  
 
                <div class="form-group">
                  <label for="exampleInputPassword1">Quantity  </label>
                  <input type="number" min="1" max="{{$main->quantity- $sorts_sum_quantity}}" id="quantity" name="quantity" class="form-control"  placeholder="Quantity " required>
                </div>
                     
                <input type="hidden" name="main_id" value="{{$main->id}}" class="form-control"  placeholder="" required>
                <input type="hidden" name="main_sell_store_id" value="{{$main->sell_store_id}}" class="form-control"  placeholder="" required>

                <div class="card-footer">
                  <button type="submit" class="btn btn-info">Sort</button>
                </div>  

                </div></div>
          </form>
      </div>


  </div>




<div class="col-md-5">
    <div class="card">
              <div class="card-header">
                <h3 class="card-title">Sorts Of carta #{{$main->id}}</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
                <table class="table table-sm">
                  <thead>
                    <tr>
                      <th style="text-align:center;vertical-align: middle; background-color:#2C4E71; color:#FFF;border-color:#0000003d;border-width: 2px;">المخزن </th>
                      <th style="text-align:center;vertical-align: middle; background-color:#2C4E71; color:#FFF;border-color:#0000003d;border-width: 2px;">الفرع</th>
                      <th style="text-align:center;vertical-align: middle; background-color:#2C4E71; color:#FFF;border-color:#0000003d;border-width: 2px;">الكمية</th>
                    </tr>
                  </thead>
                  <tbody>
                  @foreach( $sorts as $sort )
                   <tr>
                      
                   <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c" >{{$sort->sell_store->store->store_name}} </td>
                 
                 <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c" >{{$sort->sell_store->branch->name}} </td>
                 
                 <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c" >{{$sort->quantity}} </td>

                    </tr>
                    @endforeach
                  </tbody>
                </table>
              </div>
              <!-- /.card-body -->
    </div>
</div>
</div>
 

@endsection
