<?php $__env->startSection('title', 'Payment'); ?>

<?php $__env->startPush('css'); ?>
	<link rel="stylesheet" href="<?php echo e(asset('backend/plugins/select2.min.css')); ?>">
	<!-- date Calender-->
	<link rel="stylesheet" href="<?php echo e(asset('myfile/backend/assets/datepicker/zebra_datepicker.min.css')); ?>" type="text/css">
	<link rel="stylesheet" href="<?php echo e(asset('myfile/backend/assets/datepicker/examples.css')); ?>" type="text/css">
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
	<div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            <?php if(Session::has('success')): ?>
                <div class="alert alert-success">
                    <?php echo e(Session::get('success')); ?>

                </div>
            <?php endif; ?>
            <?php if(Session::has('error')): ?>
                <div class="alert alert-danger">
                    <?php echo e(Session::get('error')); ?>

                </div>
            <?php endif; ?>
            <div class="row">
                <div class="col-md-7 col-sm-7 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>
								Employee Payment
								<a href="<?php echo e(route('employee.list')); ?>" class="btn btn-xs btn-primary">Employee List</a>
							</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                       aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a></li>
                                        <li><a href="#">Settings 2</a></li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
							<div class="row search-section ">
							    <div class="col-sm-2"></div>
							    <div class="col-sm-4">
							        <h3><?php echo e($employee->name); ?></h3> 
    								<p><?php echo e($employee->phone); ?></p>
    								<p><?php echo e($employee->email); ?></p>
    								<p><?php echo e($employee->address); ?></p>
							    </div>
							    <div class="col-sm-2">
							        <img src="<?php echo e(asset('storage/employee/'.$employee->image)); ?>" height="75" width="60" > 
							    </div>
							</div>
							<div class="table-content table-">
								<form action="<?php echo e(route('salary.store')); ?>"  class="form-horizontal" role="form" method="Post" autocomplete="off" >
									<?php echo e(csrf_field()); ?>

									<div class="text-center">
										<input type="hidden" name="employee_id" value="<?php echo e($employee->id); ?>">
										<div class="form-group">
											<label class="col-sm-4 control-label no-padding-right" for="form-field-1">Payment Date <span class='red'>*</span></label>
											<div class="col-sm-8">
												<input id="datepicker" type="text" name="pay_date"  class="form-control input-sm" data-zdp_readonly_element="true" value="<?php echo e(date('d-m-Y')); ?>" placeholder="dd-mm-yyyy" >
												<p class="error-sms"><?php echo e($errors->first('pay_date')); ?></p>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-4 control-label no-padding-right" for="form-field-1">Payment Amount <span class='red'>*</span></label>
											<div class="col-sm-4">
												<input id="payment" type="text" name="payment"  class="form-control input-sm"  value="<?php echo e(old('amount')); ?>" placeholder="xxxx">
												<p class="error-sms"><?php echo e($errors->first('payment')); ?></p>
											</div>
											<div class="col-sm-4">
												<input id="total_payment" type="text" name="total_payment" class="form-control input-sm" readonly="" value="<?php echo e(old('total_payment')); ?>" placeholder="xxxx">
												<p class="error-sms"><?php echo e($errors->first('total_payment')); ?></p>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-4 control-label no-padding-right" for="form-field-1">Note </label>
											<div class="col-sm-8">
												<input id="" type="text" name="note"  class="form-control"  value="<?php echo e(old('note')); ?>" placeholder="Say somothing about payment">
												<p class="error-sms"><?php echo e($errors->first('note')); ?></p>
											</div>
										</div>
										<!--<div class="form-group">
											<label class="control-label col-sm-4">SMS: </label>
											<div class="col-sm-2">
												<div class="checkbox">
													<label><input type="checkbox" class="ch" name="sms"> Send </label>
												</div>
											</div> 
										</div>-->
										<div class="form-group">
											<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-5">
											    <a href="<?php echo e(route('salary.list')); ?>" class="btn btn-danger">Cancel</a>
												<button class="btn btn-warning" type="reset">Reset</button>
												<button type="submit" class="btn btn-primary">Save</button>
											</div>
										</div>
									</div>
								</form>
							</div>	
						</div>
					</div>
				</div>
				<div class="col-md-5 col-sm-5 col-xs-12">
					<div class="x_panel">
                        <div class="x_title">
                            <h2>Employee Search </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                       aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a></li>
                                        <li><a href="#">Settings 2</a></li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
							<form action="<?php echo e(route('salary.create')); ?>" method="Get" class="form-horizontal" role="form" >
							<?php echo e(csrf_field()); ?>

								<div class="form-group">
									<label class="col-sm-4 control-label no-padding-right" for="form-field-1">Employee <span class='red'>*</span></label>
									<div class="col-sm-8">
										<select name="employee_name"  class="form-control select2">
											<option value="">- Select Employee -</option>
											<?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cus): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
												<option value="<?php echo e($cus->id); ?>" <?php echo e($cus->id == old('employee_name') ? 'selected' : ''); ?>><?php echo e($cus->name); ?> (<?php echo e($cus->phone); ?>)</option>
											<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
										</select>
										<p class="error-sms"><?php echo e($errors->first('employee_name')); ?></p>
									</div>
								</div>
								<div class="form-group">
									<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-5">
									  <button class="btn  btn-warning" type="reset">Reset</button>
									  <button type="submit" class="btn  btn-primary">Search</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
	<script src="<?php echo e(asset('backend/plugins/select2.min.js')); ?>"></script>
	<!-- Jquery Plugin For Date Calender-->
	<script type="text/javascript" src="<?php echo e(asset('myfile/backend/assets/datepicker/zebra_datepicker.src.js')); ?>"></script>
	<script>
		$(document).ready(function(){
			$('#datepicker').Zebra_DatePicker({
				format: 'd-m-Y',
				direction:<?php echo setting()->previous_date; ?>,
			});
			// select2 section
			$('.select2').select2();
		})
		
		$(document).on('keyup','#payment',function(){
			total_payment();
		})
		$(document).on('keyup','#discount_amount',function(){
			total_payment();
		})
		function total_payment(){
			var payment = $('#payment').val() || 0;
			var discount = $('#discount_amount').val() || 0;
			var total_pay = parseFloat(payment) + parseFloat(discount);
			$('#total_payment').val(total_pay.toFixed(2))
		}
	</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>