
@include('dashboard.include.header')
@if(Auth::user()->type == "User")
<script>
    document.location.href = '/resellerdash'
</script>
@endif
  
<div class="content-wrapper">
  <div class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <!-- <h1 class="m-0">User Register</h1> -->
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="#">Home</a></li>
            <li class="breadcrumb-item active">User Register</li>
          </ol>
        </div>
      </div>
    </div>
  </div>
 
  <section class="content">
    <div class="container-fluid">
    <div class="row">
          <div class="col-md-2"></div>
          <div class="col-md-8">
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">User Register</small></h3>
              </div>
              <form class="form-horizontal" method="POST" action="/registerreseller">
                {{ csrf_field() }}
                <div class="card-body">
                <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                <label for="name" class="control-label">Name</label>
                    <input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>
                    @if ($errors->has('name'))
                        <span class="help-block">
                            <strong>{{ $errors->first('name') }}</strong>
                        </span>
                    @endif         
            </div>

            <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                <label class="control-label" for="email">E-Mail Address</label>
                    <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>

                    @if ($errors->has('email'))
                        <span class="help-block">
                            <strong>{{ $errors->first('email') }}</strong>
                        </span>
                    @endif
            </div>

            <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                <label class="control-label" for="password">Password</label>
                    <input id="password" type="password" class="form-control" name="password" required>
                    @if ($errors->has('password'))
                        <span class="help-block">
                            <strong>{{ $errors->first('password') }}</strong>
                        </span>
                    @endif
            </div>

            <div class="form-group">
                <label  class="control-label" for="password-confirm">Confirm Password</label>
                    <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
            </div>

            <div class="form-group">
            <label class="control-label" for="type">User Type:</label>
                    <select class="form-control" name="type" id="type">
                        <option value="Reseller">Reseller Admin</option>  
                        <option value="User">Reseller User</option>                          
                    </select>
            </div>

                </div>
                    <div class="row">
                    <div class="col-md-4"></div>
                    <div class="col-md-4"><button type="submit" class="btn btn-block btn-primary">Register</button></div>
                    <div class="col-md-4"></div>
                    </div><br>
              </form>
            </div>
            </div>
          <div class="col-md-2"></div>
        </div>
    </div>
  </section>
</div>

@include('dashboard.include.footer');

<script>
@if (session('reg_success'))
        swal("Success!","{{session('success')}}","success");
        swal({
            title: "Registration Success!",
            text: "{{session('reg_success')}}",
            icon: "success",
            button: "OK",
        });
    @endif

</script>

<script>
  $.widget.bridge('uibutton', $.ui.button)
</script>



