@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-{{session('type')}} 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('/credential/edit') }}">
                        {{ csrf_field() }}
              <div class="box-body">
                
              <div class="form-group">
                  <label for="exampleInputPassword1">Name - الاسم</label>
                  <input type="text" name="name" value="{{$user->name}}" class="form-control"  placeholder="username - login name " required>
                </div> 
                <div class="form-group">
                  <label for="exampleInputPassword1">Username - Login Email</label>
                  <input type="text" name="email" value="{{$user->email}}" class="form-control"  placeholder="username - login name " required>
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1"> Login Password</label>
                  <input type="password" name="password" class="form-control"  placeholder="Password - Login Password " >
                </div>

                <div class="form-group">
                  <label for="exampleInputPassword1">Confirm Login Password</label>
                  <input type="password" name="confirmpassword" class="form-control"  placeholder="Password - Login Password " >
                </div>


                <div class="form-group">
                <label>Supplier - المورد</label>
                <select class="form-control select2" style="width: 100%;" name="supplier_id" id="supplier_id" required>
                  @foreach( $suppliers as $supplier ) 
                  <option value="{{ $supplier->id }}" {{ $user->supplier->id == $supplier->id ? 'selected' : '' }}>{{$supplier->name}}</option>
                  @endforeach
                </select>
                </div>


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