IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="card">
<div class="header">
<h2><strong><?php if(isset($type)): ?>Update <?php else: ?> Create <?php endif; ?> Exam Types</strong></h2>
</div>
<div class="alert alert-danger" role="alert" id="msg" style="display: none;">
</div>
<div class="body">
<?php if(isset($type)): ?>
<?php echo Form::model( $type, ['url' => 'school/mark/exam/'.$type->idType, 'method' => 'POST','class'=>'form-horizontal'] ); ?>
<?php else: ?>
<?php echo Form::open(['url' => 'school/marks/exam','class'=>'form-horizontal','id'=>'form']); ?>
<?php endif; ?>
<div class="row clearfix">
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Name</strong></label>
<?php if(isset($type)): ?>
<?php echo Form::text('typeName',$type->name,['class' => 'form-control','required'=>'required','placeholder'=>'Name']); ?>
<?php else: ?>
<?php echo Form::text('typeName',null,['class' => 'form-control','required'=>'required','placeholder'=>'Name']); ?>
<?php endif; ?>
<?php if($errors->has('typeName')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('typeName')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>From Date</strong></label>
<?php if(isset($type)): ?>
<?php echo Form::text('fromDate',$type->from_date,['class' => 'form-control datepicker','required'=>'required','placeholder'=>'From Date' ,'style'=>'max-width: 100%;']); ?>
<?php else: ?>
<?php echo Form::text('fromDate',null,['class' => 'form-control datepicker','required'=>'required','placeholder'=>'From Date' ,'style'=>'max-width: 100%;']); ?>
<?php endif; ?>
<?php if($errors->has('fromDate')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('fromDate')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>To Date</strong></label>
<?php if(isset($type)): ?>
<?php echo Form::text('toDate',$type->to_date,['class' => 'form-control datepicker','required'=>'required','placeholder'=>'To Date','style'=>'max-width: 100%;']); ?>
<?php else: ?>
<?php echo Form::text('toDate',null,['class' => 'form-control datepicker','required'=>'required','placeholder'=>'To Date','style'=>'max-width: 100%;']); ?>
<?php endif; ?>
<?php if($errors->has('toDate')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('toDate')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="classname"><strong>Result Publication</strong></label>
<div class="input-group date" id="datetimepicker1" data-target-input="nearest">
<?php if(isset($type)): ?>
<?php echo Form::text('publish',$type->publish_date,['class' => 'form-control datetimepicker-input','required'=>'required','placeholder'=>'Select Date and Time','data-target'=> '#datetimepicker1']); ?>
<?php else: ?>
<?php echo Form::text('publish',null,['class' => 'form-control datetimepicker-input','required'=>'required','placeholder'=>'Select Date and Time','data-target'=> '#datetimepicker1']); ?>
<?php endif; ?>
<div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar-check-o"></i></div>
</div>
</div>
<?php if($errors->has('publish')): ?>
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong><?php echo e($errors->first('publish')); ?></strong>
</label>
<?php endif; ?>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-3 offset-sm-9">
<?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect' ,'style'=>'width: 150px; max-width: 254px;']); ?>
</div>
</div>
<?php echo Form::close(); ?>
</div>
</div>
<div class="card">
<div class="header">
<h2><strong>List of Exam Types</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable" id="marks_types">
<thead>
<tr>
<th>S.NO.</th>
<th>Name</th>
<th>From Date</th>
<th>To Date</th>
<th>Publish Time</th>
<th>Action</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
$('#datetimepicker1').datetimepicker();
if ( $.fn.dataTable.isDataTable( '#marks_types' ) ) {
table = $('#marks_types').DataTable();
table.destroy();
table = $('#marks_types').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "<?php echo e(url('school/marks/exam')); ?>"
});
}
});
$(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 Exam Type!",
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/marks/exam/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Exam Type 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
$('#form').on('submit',function(e){
$.ajaxSetup({
header:$('meta[name="_token"]').attr('content')
});
var formData = new FormData($('#form')[0]);
$("#submit-btn").prop('disabled', true);
$.ajax({
type:"POST",
url: "<?php echo e(url('school/marks/exam')); ?>",
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/marks/exam')); ?>";
}
else {
$("#submit-btn").prop('disabled', false);
$("#msg").empty(); //False Case: With error msg
$("#msg").append(data[Object.keys(data)[0]]);
$("#msg").css('display','block'); //$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);
$.each(errors, function (key, value) {
if (key.split(".")[1] + '.typeName' === key.split(".")[1] + '.' + key.split(".")[2])
{
errordept = '<span class="help-block">' + value + '</span>';
$('#depterror' + key.split(".")[1]).html(errordept);
}
});
}
}
});
return false;
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -