IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-sm-6">
<div class="card">
<div class="header">
<h2><strong>Product Availability Page</strong></h2>
<h5><strong>Update Area</strong></h5>
<?php
if($vendor != null){
$vendorTime = explode("-",$vendor->order_time);
$now = \Carbon\Carbon::now();
$toTime = \Carbon\Carbon::parse($now->format('d-M-Y').' '.$vendorTime[0]);
$now->subDays(1);
$fromTime = \Carbon\Carbon::parse($now->format('d-M-Y').' '.$vendorTime[1]);
$nightNow = \Carbon\Carbon::now();
$nightFrom = \Carbon\Carbon::parse($nightNow->format('d-M-Y').' '.$vendorTime[1]);
$nightNow->addDays(1);
$nightTo = \Carbon\Carbon::parse($nightNow->format('d-M-Y').' '.$vendorTime[0]);
}
?>
<?php if($vendor != null): ?>
<p>You can update the menu from <?php echo e($vendorTime[1]); ?> today to <?php echo e($vendorTime[0]); ?> tomorrow</p>
<?php endif; ?>
</div>
<form action="/school/manage-food-stock" method="post">
<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover dataTable wrap" id="tableexp">
<thead>
<tr>
<th>Select</th>
<th>Photo</th>
<th>Name & Description</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $food; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td> <?php if(!in_array($value->id, $item)): ?><input type='checkbox' name='products[]' value='<?php echo e($value->id); ?>' /> <?php endif; ?></td>
<td><img src="<?php echo e(asset('storage/schools/'.$value->idSchool.'/foods/'.$value->pic)); ?>" height="60"></td>
<td><?php echo e($value->item_name); ?><br><?php echo e($value->short_description); ?></td>
<td><?php echo e($value->price); ?></td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<?php if($vendor != null): ?>
<?php if(str_contains($fromTime->diffForHumans(), 'ago') && str_contains($toTime->diffForHumans(), 'now')): ?>
<button class="btn btn-raised btn-warning btn-round waves-effect" type="submit">Update Data</button>
<?php endif; ?>
<?php if(str_contains($nightFrom->diffForHumans(), 'ago') && str_contains($nightTo->diffForHumans(), 'now')): ?>
<button class="btn btn-raised btn-warning btn-round waves-effect" type="submit">Update Data</button>
<?php endif; ?>
<?php endif; ?>
</div>
</form>
</div>
</div>
<div class="col-sm-6">
<div class="card">
<div class="header">
<h2><strong>Available Product</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover dataTable" id="tableData">
<thead>
<tr>
<th>Photo</th>
<th>Name & Description</th>
<th>Price</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $stock; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><img src="<?php echo e(asset('storage/schools/'.$value->idSchool.'/foods/'.$value->pic)); ?>" height="60"></td>
<td><?php echo e($value->item_name); ?><br><?php echo e($value->short_description); ?></td>
<td><?php echo e($value->price); ?></td>
<td> <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($value->idStock); ?>" data-type="confirm">DELETE</button> </td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(function () {
$('#tableexp').DataTable({
dom: 'Bfrtip',
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
fixedColumns: {
left: 1
},
buttons: [
{ extend: 'csv', footer: true, text: 'Excel',title:'Product List',
exportOptions: {
columns: [1,2,3,],
format: {
body: function (data, row, column, node ) {
if(column === 2 )
return "\0" + data ;
else if( column === 5 )
return data.replace( '<br>', '\r\n');
else return data;
}
}
}
}
]
});
$('#tableData').DataTable({
dom: 'Bfrtip',
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
fixedColumns: {
left: 1
},
buttons: [
{ extend: 'csv', footer: true, text: 'Excel',title:'Product List',
exportOptions: {
columns: [1,2,3,],
format: {
body: function (data, row, column, node ) {
if(column === 2 )
return "\0" + data ;
else if( column === 5 )
return data.replace( '<br>', '\r\n');
else return data;
}
}
}
}
]
});
});
$(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 item!",
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/remove-food-stock/')); ?>" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Stock 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 -