IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-sm-5">
<div class="card">
<div class="header">
<h2><strong><?php if(isset($notice)): ?>Edit <?php else: ?> Add <?php endif; ?></strong>Circular</h2>
</div>
<div class="body">
<?php if(isset($notice)): ?>
<?php echo Form::model($notice, ['method' => 'PATCH', 'action' => ['School\EmployeeNoticeController@update', $notice->idEmployeeNoticeboard], 'class' => 'form-horizontal','files'=>true]); ?>
<?php else: ?>
<?php echo Form::open(['url' => 'school/employee-circular', 'class' => 'form-horizontal','id'=>'notice_form','files'=>true]); ?>
<?php endif; ?>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname" class="required">Department</label>
</div>
<div class="col-sm-8">
<div class="form-group">
<?php if(isset($notice) && $notice->idDepartment == null): ?>
<p class="form-control-static">ALL</p>
<?php else: ?>
<?php echo Form::select('idDepartment',$classes,null,['class' => 'form-control show-tick ms select2']); ?>
<?php endif; ?>
<?php if($errors->has('idDepartment')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idDepartment')); ?></strong>
</label>
<?php endif; ?>
<span id='classerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Select Designation</label>
</div>
<div class="col-sm-8">
<div class="form-group">
<?php if(isset($notice) && $notice->idDepartment == null): ?>
<p class="form-control-static">ALL</p>
<?php else: ?> <?php if(isset($notice)): ?>
<?php echo Form::select('idDesignation',$section,null,['class' => 'form-control show-tick ms select2']); ?>
<?php else: ?>
<div id="idDesignation" style="border:1px solid #ccc; width:200px; height: 110px; overflow-y: scroll;">
</div>
<?php endif; ?>
<?php endif; ?>
<?php if($errors->has('idDesignation')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('idDesignation')); ?></strong>
</label>
<?php endif; ?>
<span id='sectionerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">EC No.</label>
</div>
<div class="col-sm-8">
<div class="form-group">
<?php if(isset($notice)): ?>
<?php echo Form::select('idEmployee',$student,null,['class' => 'form-control show-tick ms']); ?>
<?php else: ?>
<div id="idEmployee" style="border:1px solid #ccc; width:250px; height: 110px; overflow-y: scroll;">
</div>
<?php if($errors->has('ecNO')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('ecNO')); ?></strong>
</label>
<?php endif; ?>
<?php endif; ?>
<span id="ecnoerror"></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname" class="required">Subject</label>
</div>
<div class="col-sm-8">
<div class="form-group">
<?php echo Form::text('subject',null,['class' => 'form-control','minlength'=>'2','maxlength'=>'120']); ?>
<?php if($errors->has('subject')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('subject')); ?></strong>
</label>
<?php endif; ?>
<span id='subjecterror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname" class="required">Notice</label>
</div>
<div class="col-sm-8">
<div class="form-group">
<?php echo Form::textarea('notice',null,['class' => 'form-control','size'=>'30x2','minlength'=>'2','maxlength'=>'500']); ?>
<?php if($errors->has('notice')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('notice')); ?></strong>
</label>
<?php endif; ?>
<span id='noticeerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Upload</label>
</div>
<div class="col-sm-8">
<div class="form-group">
<?php echo Form::file('noticeFile',null,['class' => 'form-control']); ?>
<?php if($errors->has('noticeFile')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('noticeFile')); ?></strong>
</label>
<?php endif; ?>
<span id='noticefileerror'></span>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-4 form-control-label">
<label for="classname">Select Publish Date</label>
</div>
<div class="col-sm-5">
<div class="form-group">
<?php echo Form::text('publishDate',null,['class' => 'form-control datepicker']); ?>
<?php if($errors->has('publishDate')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('publishDate')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<!-- <div class="col-sm-2">
<button class="btn btn-sm btn-success" style="font-size: 12px;" name='schedule'>Schedule</button>
</div>-->
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
<?php if(isset($notice)): ?>
<?php echo Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php else: ?>
<?php echo Form::submit('SAVE NOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'submit-btn']); ?>
<?php endif; ?>
<?php echo Form::close(); ?>
</div>
</div>
</div>
</div>
</div>
<!--</div>
<div class="row clearfix">-->
<div class="col-sm-7">
<div class="card">
<div class="header">
<h2><strong>List Of Circular</strong></h2>
</div>
<div class="body table-responsive">
<?php echo Form::open(['method' => 'GET', 'action' => ['School\NoticeboardController@index'], 'class' => 'form-horizontal']); ?>
<div class="row clearfix">
<div class="col-sm-3 form-control-label">
<label for="classname">From Date</label>
</div>
<div class="col-sm-5">
<div class="form-group">
<?php echo Form::text('fromDate',null,['class' => 'form-control datepicker']); ?>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-3 form-control-label">
<label for="classname">To Date</label>
</div>
<div class="col-sm-5">
<div class="form-group">
<?php echo Form::text('toDate',null,['class' => 'form-control datepicker']); ?>
</div>
</div>
<div class="col-sm-2">
<?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
<?php echo Form::close(); ?>
</div>
</div>
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<thead>
<tr>
<th>S. No.</th>
<th>Date</th>
<th>Department</th>
<th>Designation</th>
<th>Employee</th>
<th>Subject</th>
<th>Notice</th>
<th>Notice Doc</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $notices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<th scope="row"><?php echo e($i); ?></th>
<td><?php echo e($value->publishDate); ?></td>
<td><?php echo e(isset($value->department->departmentName) ? $value->department->departmentName : 'All'); ?></td>
<td><?php echo e(isset($value->designation->designationName) ? $value->designation->designationName : 'All'); ?></td>
<td><?php echo e(isset($value->enrollmentNo) ? $value->enrollmentNo : 'All'); ?></td>
<td><?php echo e($value->subject); ?></td>
<td style="word-wrap: break-word;"><?php echo e($value->notice); ?></td>
<td><a href="<?php echo e(url('/school/noticeboards/' . $value->idNoticeboard.'/viewdoc')); ?>" target="_blank">View</a></td>
<td>
<a href="<?php echo e(url('school/noticeboards/' . $value->idNoticeboard . '/edit')); ?>" class="btn btn-raised btn-info waves-effect btn-round">Edit </a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($value->idNoticeboard); ?>" 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() {
$('select[name="idDepartment"]').on('change', function() {
var departmentID = $(this).val();
if(departmentID) {
$.ajax({
url: "https://online-login.online/school/departments"+'/' +departmentID + "/designations",
type: "GET",
dataType: "json",
success:function(data) {
$('#idDesignation').empty();
$('#idDesignation').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-all" id="selectall"></div>');
$.each(data, function(key, value) {
$('#idDesignation').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:100px;">'+value+'</label><input type="checkbox" name="designations[]" value="'+key+'" class="designationclass"></div>');
});
}
});
}else{
$('select[name="idDesignation"]').empty();
}
});
});
$(document).on('click', '.select-all', function(){
var checkAll = this.checked;
if(checkAll === true){
$('input[type=checkbox]').each(function () {
this.checked = checkAll;
});
var designationIds = [];
$("input:checkbox[name='designations[]']:checked").each(function () {
designationIds.push($(this).val());
});
if (designationIds.length > 0) {
$.ajax({
url: "https://online-login.online/school/designations"+'/' +designationIds + "/employees",
type: "GET",
dataType: "json",
success:function(data) {
$('#idEmployee').empty();
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-allstd" id="selectallstd"></div>');
$.each(data, function(key, value) {
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">'+value+'</label><input type="checkbox" name="employees[]" value="'+key+'" class="empallselect"></div>');
});
}
});
}
}else{
$('#idEmployee').empty();
$('input[type=checkbox]').each(function () {
this.checked = checkAll;
});
}
});
$(document).on('click', '.designationclass', function(){
var designationIds = [];
$("input:checkbox[name='designations[]']:checked").each(function () {
designationIds.push($(this).val());
});
if (designationIds.length > 0) {
$.ajax({
url: "https://online-login.online/school/designations"+'/' +designationIds + "/employees",
type: "GET",
dataType: "json",
success:function(data) {
$('#idEmployee').empty();
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;padding-top:5px;"><label style="margin-right:42px;"><strong>Select All</label></strong><input type="checkbox" class="select-allstd" id="selectallstd"></div>');
$.each(data, function(key, value) {
$('#idEmployee').append('<div class="checkbox-inline" style="padding-left:10px;"><label style="margin-right:50px;">'+value+'</label><input type="checkbox" name="employees[]" value="'+key+'" class="empallselect"></div>');
});
}
});
}else{
$('#idEmployee').empty();
}
});
$(document).on('click', '.select-allstd', function(){
var checkAllstd = this.checked;
if(checkAllstd === true){
$("input:checkbox[name='employees[]']").each(function () {
this.checked = checkAllstd;
});
}else{
$('.empallselect').each(function () {
this.checked = checkAllstd;
});
}
});
// Delete Feehead
$(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 Notice!",
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/noticeboards/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Notice has been successfully deleted",
type: "success"
},function() {
location.reload();
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
// Saving form data
$('#notice_form').on('submit',function(e){
$.ajaxSetup({
header:$('meta[name="_token"]').attr('content')
});
var formData = new FormData($('#notice_form')[0]);
$("#submit-btn").prop('disabled', true);
$.ajax({
type:"POST",
url: "<?php echo e(url('school/employee-circular')); ?>",
processData: false,
contentType: false,
data:formData,
dataType: 'json',
success:function(data){
if( data[Object.keys(data)[0]] === 'SUCCESS' ){
$("#submit-btn").prop('disabled', true);
window.location = "<?php echo e(url('school/employee-circular')); ?>";
}
else { //False Case: With error msg
$("#msg").html(data); //$msg is the id of empty msg
}
},
error: function(data){
if( data.status === 422 ) {
$("#submit-btn").prop('disabled', false);
var errors = data.responseJSON.errors;
var errorHtml = '<div class="alert alert-danger"><ul>';
$('#formerrors').html(errorHtml);
if(errors['idDepartment']=== undefined){
$( '#classerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['idDepartment']+'</strong></span>';
$( '#classerror' ).html( errorname );
}
if(errors['subject']=== undefined){
$( '#subjecterror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['subject']+'</strong></span>';
$( '#subjecterror' ).html( errorname );
}
if(errors['notice']=== undefined){
$( '#noticeerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['notice']+'</strong></span>';
$( '#noticeerror' ).html( errorname );
}
if(errors['noticeFile']=== undefined){
$( '#noticefileerror' ).empty();
}else{
errorname = '<span class="help-block"><strong>'+errors['noticeFile']+'</strong></span>';
$( '#noticefileerror' ).html( errorname );
}
}
}
});
return false;
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -