IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="card">
<div class="header">
<h2><strong><?php if(isset($shift)): ?>Edit <?php else: ?> Add <?php endif; ?></strong>Shift</h2>
</div>
<div class="body">
<?php if(isset($shift)): ?>
<?php echo Form::model( $shift, ['route' => ['shifts.update', $shift->idShift], 'method' => 'put','class'=>'form-horizontal'] ); ?>
<?php else: ?>
<?php echo Form::open(['url' => 'school/shifts','class'=>'form-horizontal']); ?>
<?php endif; ?>
<div class="row clearfix">
<div class="col-sm-4 form-control-label required">
<label for="classname">Shift Name</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<?php echo Form::text('shiftName',null,['class' => 'form-control','required'=>'required']); ?>
<?php if($errors->has('shiftName')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('shiftName')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<div class="row clearfix demo-masked-input">
<table class="table">
<thead>
<tr>
<th>Weekdays</th>
<th>From</th>
<th></th>
<th>To</th>
<th></th>
<th>Weekly Off</th>
</tr>
</thead>
<tbody>
<?php if(isset($shift)): ?>
<?php $__currentLoopData = $shift->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $det): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($det->weekday->dayName); ?></td>
<td><?php echo Form::text('shifts['.$det->idWeekday.'][fromTime]',$det->fromTime,['class' => 'form-control time24']); ?></td>
<td>
<input type="radio" id="fam_<?php echo e($det->idWeekday); ?>" name="shifts[<?php echo e($det->idWeekday); ?>][shift_from]" value="am" <?php if($det->shift_from == 'am'): ?> checked <?php endif; ?> />
<label for="fam_<?php echo e($det->idWeekday); ?>">AM</label>
<input type="radio" id="fpm_<?php echo e($det->idWeekday); ?>" name="shifts[<?php echo e($det->idWeekday); ?>][shift_from]" value="pm" <?php if($det->shift_from == 'pm'): ?> checked <?php endif; ?> />
<label for="fpm_<?php echo e($det->idWeekday); ?>">PM</label>
</td>
<td>
<?php echo Form::text('shifts['.$det->idWeekday.'][toTime]',$det->toTime,['class' => 'form-control time24']); ?>
</td>
<td>
<input type="radio" id="tam_<?php echo e($det->idWeekday); ?>" name="shifts[<?php echo e($det->idWeekday); ?>][shift_to]" value="am" <?php if($det->shift_to == 'am'): ?> checked <?php endif; ?> />
<label for="tam_<?php echo e($det->idWeekday); ?>">AM</label>
<input type="radio" id="tpm_<?php echo e($det->idWeekday); ?>" name="shifts[<?php echo e($det->idWeekday); ?>][shift_to]" value="pm" <?php if($det->shift_to == 'pm'): ?> checked <?php endif; ?> />
<label for="tpm_<?php echo e($det->idWeekday); ?>">PM</label>
</td>
<td><input type="radio" name="shifts[<?php echo e($det->idWeekday); ?>][weekOff]" <?php if($det->weekOff == 'Y'): ?> checked <?php endif; ?>></td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
<?php $__currentLoopData = $weekdays; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($var); ?></td>
<td><?php echo Form::text('shifts['.$key.'][fromTime]',null,['class' => 'form-control time24']); ?></td>
<td><input type="radio" id="fam_<?php echo e($key); ?>" name="shifts[<?php echo e($key); ?>][shift_from]" value="am"/>
<label for="fam_<?php echo e($key); ?>">AM</label>
<input type="radio" id="fpm_<?php echo e($key); ?>" name="shifts[<?php echo e($key); ?>][shift_from]" value="pm"/>
<label for="fpm_<?php echo e($key); ?>">PM</label></td>
<td>
<?php echo Form::text('shifts['.$key.'][toTime]',null,['class' => 'form-control time24']); ?>
</td>
<td><input type="radio" id="tam_<?php echo e($key); ?>" name="shifts[<?php echo e($key); ?>][shift_to]" value="am"/>
<label for="tam_<?php echo e($key); ?>">AM</label>
<input type="radio" id="tpm_<?php echo e($key); ?>" name="shifts[<?php echo e($key); ?>][shift_to]" value="pm"/>
<label for="tpm_<?php echo e($key); ?>">PM</label></td>
<td><input type="radio" name="shifts[<?php echo e($key); ?>][weekOff]" id="weekday"></td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
<?php if(isset($shift)): ?>
<?php echo Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php else: ?>
<?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php endif; ?>
<?php echo Form::close(); ?>
</div>
</div>
</div>
</div>
</div
</div>
<div class="col-sm-6">
<div class="card">
<div class="header">
<h2><strong>List Of Shifts</strong></h2>
</div>
<div class="body table-responsive">
<?php echo Form::open(['method' => 'GET', 'action' => ['School\ShiftController@index'], 'class' => 'form-horizontal']); ?>
<div class="row clearfix">
<div class="col-sm-3 form-control-label">
<label for="classname">Financial Year</label>
</div>
<div class="col-sm-5">
<div class="form-group">
<?php echo Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']); ?>
</div>
</div>
<div class="col-sm-2">
<?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
</div>
</div>
<?php echo Form::close(); ?>
<br>
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<thead>
<tr>
<th>S.NO.</th>
<th>Shift</th>
<th>Details</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $shifts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($i); ?></td>
<td><?php echo e($var->shiftName); ?></td>
<td>
<?php if(count($var->details)>0): ?>
<table class="table table-bordered">
<thead>
<tr>
<th>Weekday</th>
<th>From Time</th>
<th>To Time</th>
<th>Week Off</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $var->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $det): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($det->weekday->dayName); ?></td>
<td><?php echo e($det->fromTime); ?> <?php if($det->weekOff != 'Y'): ?> <?php echo e($det->shift_from); ?> <?php endif; ?></td>
<td><?php echo e($det->toTime); ?> <?php if($det->weekOff != 'Y'): ?> <?php echo e($det->shift_to); ?> <?php endif; ?></td>
<td><?php if($det->weekOff == 'Y'): ?> Yes <?php else: ?> No <?php endif; ?></td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
<?php endif; ?>
</td>
<td>
<a href='<?php echo e(url('/school/shifts/'.$var->idShift.'/edit')); ?>' class="btn btn-raised btn-info waves-effect btn-round"><i class="fa fa-edit"></i>Edit</a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($var->idShift); ?>" data-type="confirm">DELETE</button>
</td>
</tr>
<?php $i++; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(function(){
$("[name='shifts[7][weekOff]']").on("change", function (e) {
if(this.value == "on"){
$('#fam_7').prop('checked', false);
$('#fpm_7').prop('checked', false);
$('#tam_7').prop('checked', false);
$('#tpm_7').prop('checked', false);
}
});
$('input[type=radio]').click(function(){
if (this.previous) {
this.checked = false;
}
this.previous = this.checked;
});
})
$(document).on('click', '.js-sweetalert', function (e) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
e.preventDefault();
var id = $(this).data('id');
swal({
title: "Are you sure?",
text: "Are You sure you want to delete this Shift !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "DELETE",
url: "<?php echo e(url('/school/shifts/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Shift has been successfully deleted",
type: "success"
},function() {
location.reload();
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -