@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 Supplier  </h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form   role="form" method="POST" action="{{ url('/supplier/edit') }}" enctype="multipart/form-data">
                        {{ csrf_field() }}
              <div class="box-body">
                
                
                 


                <div class="form-group">
                  <label for="exampleInputPassword1">Supplier Name - الاسم</label>
                  <input type="text" name="name" value="{{$supplier->name}}" class="form-control"  placeholder="Supplier Name - اسـم المورد " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Supplier Address - العنوان</label>
                  <input type="text" name="address" value="{{$supplier->address}}" class="form-control"  placeholder="Supplier Address - عنون المورد " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Supplier Phone - رقم الهاتف </label>
                  <input type="text" name="phone" value="{{$supplier->phone}}" class="form-control"  placeholder="Supplier Phone - رقم الهاتف " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Supplier Fax - الفاكس</label>
                  <input type="text" name="fax" value="{{$supplier->fax}}" class="form-control"  placeholder="Supplier Fax - الفاكس " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Supplier Email - الايميل</label>
                  <input type="text" name="email" value="{{$supplier->email}}" class="form-control"  placeholder="Supplier Email - الايميل " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Environmental Response - المسؤل البيئي</label>
                  <input type="text" name="environmental_response" value="{{$supplier->environmental_response}}" class="form-control"  placeholder="Environmental Response - المسؤل البيئي " required>
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Response Position - دور المسؤل</label>
                  <input type="text" name="resp_position"  value="{{$supplier->resp_position}}" class="form-control"  placeholder="Response Position - دور المسؤل " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Response Phone - رقم الهاتف المسؤل</label>
                  <input type="text" name="resp_phone"  value="{{$supplier->resp_phone}}" class="form-control"  placeholder="Response Phone - رقم الهاتف المسؤل " required>
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Response Email - ايميل المسؤل</label>
                  <input type="text" name="resp_email" value="{{$supplier->resp_email}}" class="form-control"  placeholder="Response Email - ايميل المسؤل " required>
                </div>


                <div class="form-group">
                  <label for="exampleInputPassword1">Commertial Registration No - رقم التسجيل التجاري</label>
                  <input type="text" name="commertial_registration_no" value="{{$supplier->commertial_registration_no}}" class="form-control"  placeholder="Commertial Registration No - رقم التسجيل التجاري " required>
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Tax Card No - رقم الضريبي</label>
                  <input type="text" name="tax_card_no" value="{{$supplier->tax_card_no}}" class="form-control"  placeholder="Tax Card No - رقم الضريبي " required>
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Operating Licence No - رخصة التشغيل</label>
                  <input type="text" name="operating_licence_no" value="{{$supplier->operating_licence_no}}" class="form-control"  placeholder="Operating Licence No - رخصة التشغيل " required>
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Industrial Registration No - رقم التسجيل الصناعي</label>
                  <input type="text" name="industrial_registration_no" value="{{$supplier->industrial_registration_no}}" class="form-control"  placeholder="Industrial Registration No - رقم التسجيل الصناعي " required>
                </div>

                

                <div class="form-group">
                <label>Industrial City - المدينة الصناعية</label>
                <select class="form-control select2" style="width: 100%;" name="industrial_city_id" id="industrial_city_id" required>
                  @foreach( $citys as $city ) 
                  <option value="{{ $city->id }}" {{ $supplier->industrial_city_id == $city->id ? 'selected' : '' }}>{{$city->name}}</option>
                  @endforeach
                </select>
                </div>

                <div   class="col-xs-6">
                <img   src='{{asset("$supplier->logo")}}'  alt="User Image" style="width:100px;height:100px;">
                </div>

                <div   class="col-xs-6">
                    <label for="exampleInputPassword1">لوجو المورد </label>
                    <input type="file" id="image" name="image" class="form-control"  accept="image/*"  >
                    
                </div>

               <input type="hidden" name="supplier_id" value="{{$supplier->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