IMMREX7
@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>@if(isset($product))Edit @else Add @endif Food Vendor</strong></h2>
</div>
<div class="body">
@if(isset($product))
{!! Form::model($product, ['method' => 'PATCH', 'action' => ['School\Canteen\FoodVendorController@update', $product->id], 'class' => 'form-horizontal','files'=>true]) !!}
@else
{!! Form::open(['url' => 'school/food-vendor', 'class' => 'form-horizontal','id'=>'form','files'=>true]) !!}
@endif
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Name</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('name',null,['class' => 'form-control','required'=>'required']) !!}
@if ($errors->has('name'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('name') }}</strong>
</label>
@endif
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="classname">Mobile</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::number('mobile',null,['class' => 'form-control','required'=>'required' ,'maxlength'=>'10' ,'oninput' => "javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"]) !!}
@if ($errors->has('mobile'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('mobile') }}</strong>
</label>
@endif
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Email</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::email('email',null,['class' => 'form-control','required'=>'required']) !!}
@if ($errors->has('email'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('email') }}</strong>
</label>
@endif
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="classname">Password</label>
</div>
<div class="col-sm-3">
<div class="form-group">
<input name="pwd" type="password" value="" class="form-control" required>
@if ($errors->has('pwd'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('pwd') }}</strong>
</label>
@endif
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-2 form-control-label required">
<label for="classname">Address</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::textarea('address',null,['class' => 'form-control','size'=>'30x2']) !!}
@if ($errors->has('address'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('address') }}</strong>
</label>
@endif
</div>
</div>
<div class="col-sm-2 form-control-label required">
<label for="classname">Order Time</label>
</div>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('order_time',null,['class' => 'form-control','required'=>'required','placeholder'=> '10:00-21:00 (24 hour format)']) !!}
@if ($errors->has('order_time'))
<label id="minmaxlength-error" class="error" for="minmaxlength">
<strong>{{ $errors->first('order_time') }}</strong>
</label>
@endif
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-8 offset-sm-2">
@if(isset($product))
{!! Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
@else
{!! Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'submit-btn']) !!}
@endif
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Food Vendor</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>Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Order Time</th>
<th>Address</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
@foreach($products as $value)
<tr>
<th scope="row">{{$i}}</th>
<td>{{$value->name}}</td>
<td>{{$value->mobile}}</td>
<td>{{$value->email}}</td>
<td>{{$value->order_time}}</td>
<td>{{$value->address}}</td>
<td>
<a href="{{ url('school/food-vendor/' . $value->id . '/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="{{$value->id}}" data-type="confirm">DELETE</button>
</td>
</tr>
<?php $i++; ?>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("image").files[0]);
oFReader.onload = function (oFREvent) {
document.getElementById("uploadPreview").src = oFREvent.target.result;
};
}
$(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: "{{url('/school/food-vendor/')}}" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Food Item 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>
@stop
Copyright © 2021 -