@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 Waste  </h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form   role="form" method="POST" action="{{ url('/waste/edit') }}">
                        {{ csrf_field() }}
              <div class="box-body">
                
                
                <div class="form-group">
                  <label for="exampleInputPassword1">Waste Name - اسم المخلف</label>
                  <input type="text" name="name" value="{{$waste->name}}" class="form-control"  placeholder="Waste Name - اسم المخلف" required>
                </div>
                
                <div class="form-group">
                  <label for="exampleInputPassword1">Waste Unit - وحدة المخلف</label>
                  <input type="text" name="unit"  value="{{$waste->unit}}"  class="form-control"  placeholder="Waste  - وحدة المخلف " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Waste Price  كجم/عدد </label>
                  <input type="number" step="0.01" name="price" value="{{$waste->price}}" class="form-control"  placeholder="Waste Price - سعر المخلف " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Waste tax</label>
                  <input type="number" name="tax" class="form-control"  value="{{$waste->tax}}" placeholder="Waste Tax -  الضريبة " required>
                </div>
                
                <div class="form-group">
                <label>Class - الفـئـة</label>
                <select class="form-control select2" style="width: 100%;" name="class_id" id="class_id" required>
                  @foreach( $classes as $class ) 
                  <option value="{{ $class->id }}" {{ $waste->class_id == $class->id ? 'selected' : '' }} > {{$class->name}}</option>
                  @endforeach
                </select>
                </div>

                <div class="form-group">
                <label>Classification - التصنيف</label>
                <select class="form-control select2" style="width: 100%;" name="classifications_id" id="classifications_id" required>
                  @foreach( $classifications as $classification ) 
                  <option value="{{ $classification->id }}" {{ $waste->classifications_id == $classification->id ? 'selected' : '' }}>{{$classification->name}}</option>
                  @endforeach
                </select>
                </div>

                <div class="form-group">
                <label>Group - المجموعة</label>
                <select class="form-control select2" style="width: 100%;" name="groups_id" id="groups_id" required>
                  @foreach( $groups as $group ) 
                  <option value="{{ $group->id }}"  {{ $waste->groups_id == $group->id ? 'selected' : '' }}>{{$group->name}}</option>
                  @endforeach
                </select>
                </div>

                <div class="form-group">
                <label>Recycler Methods- طرق اعادة الاستخدام</label>
                <select class="form-control select2" style="width: 100%;" name="reuse_methods_id" id="reuse_methods_id" required>
                  @foreach( $recycle_methods as $recycle_method ) 
                  <option value="{{ $recycle_method->id }}" {{ $waste->reuse_methods_id == $recycle_method->id ? 'selected' : '' }}>{{$recycle_method->name}}</option>
                  @endforeach
                </select>
                </div>
                
                 <div class="form-group">
                <label>store- المخزن</label>
                <select class="form-control select2" style="width: 100%;" name="store_id" id="store_id" required>
                  @foreach( $stores as $store ) 
                  <option value="{{ $store->id }}" {{ $waste->store_id == $store->id ? 'selected' : '' }}>{{$store->store_name}} </option>
                  @endforeach
                </select>
                </div>
                
                
               <input type="hidden" name="waste_id" value="{{$waste->id}}" class="form-control"  placeholder="Waste Name - اسم المخلف" required>
              </div>
              <!-- /.box-body -->

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

@endsection