<?php if(isset($regUser)): ?>
    <?php echo Form::model($regUser, ['url' => "user-registration/$regUser->id", 'method' => 'put', 'class' => 'form-horizontal']); ?>

<?php else: ?>
    <?php echo Form::open(['url' => 'user-registration', 'method' => 'post', 'class' => 'form-horizontal']); ?>

<?php endif; ?>

<div class="form-group <?php echo e($errors->has('email') ? 'has-error' : ''); ?>">
    <?php echo Form::label('email', 'Username', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <?php echo Form::text('email', null, ['class' => 'form-control', 'placeholder' => 'Enter Username', 'autocomplete' => 'off']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('email')); ?>

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

<?php if(isset($regUser)): ?>
    <div class="form-group <?php echo e($errors->has('password') ? 'has-error' : ''); ?>">
	    <?php echo Form::label('password', 'Password', ['class' => 'required col-3 col-sm-3 control-label']); ?>

	    <div class="col-xs-9 col-sm-9">
	        <?php echo Form::text('password', base64_decode($regUser->secret), ['class' => 'form-control', 'placeholder' => 'Enter Password', 'autocomplete' => 'off']); ?>

	        <span class="text-danger">
			    <?php echo e($errors->first('password')); ?>

		    </span>
	    </div>
	</div>
<?php else: ?>
    <div class="form-group <?php echo e($errors->has('password') ? 'has-error' : ''); ?>">
	    <?php echo Form::label('password', 'Password', ['class' => 'required col-3 col-sm-3 control-label']); ?>

	    <div class="col-xs-9 col-sm-9">
	        <?php echo Form::text('password', null, ['class' => 'form-control', 'placeholder' => 'Enter Password', 'autocomplete' => 'off']); ?>

	        <span class="text-danger">
			    <?php echo e($errors->first('password')); ?>

		    </span>
	    </div>
	</div>
<?php endif; ?>

<!-- <div class="form-group <?php echo e($errors->has('password') ? 'has-error' : ''); ?>">
    <?php echo Form::label('password', 'Password', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <?php echo Form::text('password', null, ['class' => 'form-control', 'placeholder' => 'Enter Password', 'autocomplete' => 'off']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('password')); ?>

	    </span>
    </div>
</div> -->

<!-- <div class="form-group <?php echo e($errors->has('role') ? 'has-error' : ''); ?>">
    <?php echo Form::label('role', 'Role', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <?php echo Form::select('role', ['app_admin' => 'Order Manager', 'app_user' => 'Delivery Boy'], null, ['class' => 'form-control', 'placeholder' => 'Select Role']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('role')); ?>

	    </span>
    </div>
</div> -->

<div class="form-group <?php echo e($errors->has('name') ? 'has-error' : ''); ?>">
    <?php echo Form::label('name', 'Name', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <?php echo Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Enter Name', 'autocomplete' => 'off']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('name')); ?>

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

<div class="form-group <?php echo e($errors->has('phone_number') ? 'has-error' : ''); ?>">
    <?php echo Form::label('phone_number', 'Phone Number', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <?php echo Form::text('phone_number', null, ['class' => 'form-control', 'placeholder' => 'Enter Phone Number', 'autocomplete' => 'off']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('phone_number')); ?>

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

<div class="form-group <?php echo e($errors->has('depot_app_user') ? 'has-error' : ''); ?>">
    <?php echo Form::label('depot_app_user', 'Area/Depot/Mobile Detail', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <?php echo Form::text('depot_app_user', null, ['class' => 'form-control', 'placeholder' => 'Area - Mobile No.', 'autocomplete' => 'off']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('depot_app_user')); ?>

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

<div class="form-group <?php echo e($errors->has('zone') ? 'has-error' : ''); ?>">
    <?php echo Form::label('zone', 'Zone', ['class' => 'required col-3 col-sm-3 control-label']); ?>

    <div class="col-xs-9 col-sm-9">
        <!-- <?php echo Form::select('zone', ['All Zone' => 'All Zone', 'Dhaka North' => 'Dhaka North', 'Dhaka South' => 'Dhaka South'], null, ['class' => 'form-control', 'placeholder' => 'Select Zone']); ?> -->
        <?php echo Form::select('zone', ['Dhaka North' => 'Dhaka North', 'Dhaka South' => 'Dhaka South'], null, ['class' => 'form-control', 'placeholder' => 'Select Zone']); ?>

        <span class="text-danger">
		    <?php echo e($errors->first('zone')); ?>

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


<div class="box-footer">
	<a href="<?php echo e(url('/user-registration')); ?>" class="btn btn-default">Cancel</a>
	<?php if(isset($regUser)): ?>
	    <?php echo Form::button('Submit', ['class' => 'btn btn-success pull-right', 'data-toggle' => 'modal', 'data-target' => '#app_user_update']); ?>

	<?php else: ?>
	    <?php echo Form::button('Submit', ['class' => 'btn btn-primary pull-right', 'data-toggle' => 'modal', 'data-target' => '#app_user_create']); ?>

	<?php endif; ?>
	
</div>

<div class="modal modal-info fade" id="app_user_create">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title">Confirmation Message</h4>
			</div>
			<div class="modal-body">
				<h3>Want to Create App User?</h3>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>
				<button type="submit" class="btn btn-outline">Create App User</button>
			</div>
		</div>
	</div>
</div>


<div class="modal modal-warning fade" id="app_user_update">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title">Confirmation Message</h4>
			</div>
			<div class="modal-body">
				<h3>Want to Update App User?</h3>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>
				<button type="submit" class="btn btn-outline">Update App User</button>
			</div>
		</div>
	</div>
</div>

<?php echo Form::close(); ?>