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($designation)): ?>Edit <?php else: ?> Add <?php endif; ?></strong>Designation</h2>
</div>
<div class="body">
<?php if(isset($designation)): ?>
<?php echo Form::model( $designation, ['route' => ['designations.update', $designation->idDesignation], 'method' => 'put','class'=>'form-horizontal'] ); ?>
<?php else: ?>
<?php echo Form::open(['url' => 'school/designations','class'=>'form-horizontal','files'=>true]); ?>
<?php endif; ?>
<div class="row clearfix">
<div class="col-sm-4 form-control-label required">
<label for="classname">Department</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<?php echo Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms','required'=>'required']); ?>
<?php if($errors->has('idDepartment')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idDepartment')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<?php if(isset($designation)): ?>
<div class="row clearfix">
<div class="col-sm-4 form-control-label required">
<label for="classname">Designation</label>
</div>
<div class="col-sm-6">
<div class="form-group">
<?php echo Form::text('designationName',null,['class' => 'form-control','required'=>'required']); ?>
<?php if($errors->has('designationName')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('designationName')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<?php else: ?>
<div class="row clearfix">
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>Note: To Assign Class you have to keep your teacher's designations as "Teacher"</strong>
</label>
<table class="table">
<thead>
<tr>
<th></th>
<th>Designation Name</th>
<th></th>
</tr>
</thead>
<tbody id="optional_list">
<?php $i = 1; ?>
<tr>
<td class="sno"><?php echo e($i); ?></td>
<td>
<?php echo Form::text('designations[1][designationName]',null,['class' => 'form-control','required'=>'required','placeholder'=>'eg:Teacher,Staff,Driver']); ?>
</td>
</tr>
<?php $i++; ?>
</tbody>
<tr>
<td colspan="4" style="text-align: right"><input type="button" class="add-row btn btn-sm btn-success" value="Add Row"></td>
</tr>
</table>
</div>
<?php endif; ?>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
<?php if(isset($designation)): ?>
<?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 class="col-lg-6 col-md-6 col-sm-6">
<div class="card">
<div class="header">
<h2><strong>List Of Designations</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<thead>
<tr>
<th>S.NO.</th>
<th>Department</th>
<th>Designation</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $designations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($i); ?></td>
<td><?php if(isset($var->department)): ?><?php echo e($var->department->departmentName); ?><?php endif; ?></td>
<td><?php echo e($var->designationName); ?></td>
<td>
<a href='<?php echo e(url('/school/designations/'.$var->idDesignation.'/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->idDesignation); ?>" 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>
$(document).ready(function() {
var i = $('.sno:last').text();
$(".add-row").click(function(){
i++;
var markup = '<tr><td class="sno">'+i+'</td>\
<td><input class="form-control" type="text" name="designations['+i+'][designationName]" required="required" placeholder = "eg:Teacher,Staff,Driver"></td>\n\
<td style="text-align:right;vertical-align: middle;"><input type="button" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td></tr>';
$("#optional_list").append(markup);
});
$('#optional_list').on('click', 'input[type="button"]', function () {
$(this).closest('tr').remove();
i = $('.sno:last').text();
});
//Add Input field if others is selecyted
});
$(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 Designation !",
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/designations/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Designation 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 -