@extends('layouts.master')

@section('content')
@if (session()->has('message'))
<div class="row">
        <!-- left column -->
        <div class="col-md-2"></div>
<div class="col-md-4 alert alert-success alert-dismissible" style="font-size:18px;font-weight:bold;width:400px;margin-left:15px">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                {!! session('message') !!}
              </div>
              </div> 
@endif

<div class="row">
        <!-- left column -->
        <div class="col-md-2"></div>
        <div class="col-md-8">
          <!-- general form elements -->
          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">Edit Main Waste  </h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form   role="form" method="POST" action="{{ url('/main/edit') }}">
                        {{ csrf_field() }}
              <div class="box-body">
                
            
              <div class="form-group">
                <label>Choosw Supplier </label>
                <select class="form-control select2" onchange="showWasteOfSupplier(this.value)" style="width: 100%;" name="supplier_id" id="supplier_id" required>
                  @foreach( $suppliers as $supplier ) 
                  <option value="{{ $supplier->id }}" {{ $main->supplier->id == $supplier->id ? 'selected' : '' }} >{{$supplier->name}}</option>
                  @endforeach
                </select>
                </div>

                <div class="form-group">
                <label>Choosw Wastes </label>
                <select class="form-control select2"  style="width: 100%;" name="waste_id" id="waste_id" required>
                  @foreach( $wastes as $waste ) 
                  <option value="{{ $waste->id }}" {{ $main->waste->id == $waste->id ? 'selected' : '' }} >{{$waste->name}}</option>
                  @endforeach
                </select>
                </div>


                <div class="form-group">
                <label>Packing Methods  - طريقة التعبئة </label>
                <select class="form-control select2" style="width: 100%;" name="packingmethod_id" id="packingmethod_id" required>
                  @foreach( $packingmethods as $packingmethod ) 
                  <option value="{{ $packingmethod->id }}" {{ $main->packingmethod->id == $packingmethod->id ? 'selected' : '' }} >{{$packingmethod->name}}</option>
                  @endforeach
                </select>
                </div>

                <div class="form-group">
                <label>Physical Conditions  - الحالة الفيزيائية </label>
                <select class="form-control select2" style="width: 100%;" name="physicalcondition_id" id="physicalcondition_id" required>
                  @foreach( $physicalconditions as $physicalcondition ) 
                  <option value="{{ $physicalcondition->id }}" {{ $main->physicalcondition->id == $physicalcondition->id ? 'selected' : '' }} >{{$physicalcondition->name}}</option>
                  @endforeach
                </select>
                </div>

                <div class="form-group">
                <label>Driver Name- السائق</label>
                <select class="form-control select2" style="width: 100%;" name="driver_id" id="driver_id" required>
                  @foreach( $drivers as $driver ) 
                  <option value="{{ $driver->id }}" {{ $main->driver->id == $driver->id ? 'selected' : '' }}>{{$driver->name}}</option>
                  @endforeach
                </select>
                </div>
                
                <div class="form-group">
                <label>Vehicle number - رقم السيارة  </label>
                <select class="form-control select2" style="width: 100%;" name="vehicle_id" id="vehicle_id" required>
                  @foreach( $vehicles as $vehicle ) 
                  <option value="{{ $vehicle->id }}" {{ $main->vehicle->id == $vehicle->id ? 'selected' : '' }} >{{$vehicle->vehicle_num}}</option>
                  @endforeach
                </select>
                </div>


                <div class="form-group">
                <label> Suppervisor اسم المشرف   </label>
                <select class="form-control select2" style="width: 100%;" name="user_id" id="user_id" required>
                  @foreach( $users as $user ) 
                  <option value="{{ $user->id }}" {{ $main->user->id == $user->id ? 'selected' : '' }} >{{$user->name}}</option>
                  @endforeach
                </select>
                </div>


                <div class="form-group">
                  <label for="exampleInputPassword1">quantity</label>
                  <input type="text" name="quantity"  value="{{$main->quantity}}" class="form-control"  placeholder="quantity " required>
                </div>

                 
                
                
                
               <input type="hidden" name="main_id" value="{{$main->id}}" class="form-control"  placeholder="" required>
              </div>
              <!-- /.box-body -->

              <div class="box-footer">
                <button type="submit" class="btn btn-success">Save</button>
              </div>
            </form>

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



@endsection