@extends('admin.head')
@section('middle')
<script src="https://cdn.ckeditor.com/4.12.1/standard/ckeditor.js"></script>
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Edit Product</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form role="form" action="{{ url('update_product') }}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<input type="hidden" name="product_id" value="{{ $products[0]->product_id }}">
<div class="box-body">
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
<input type="text" name="name" value="{{ $products[0]->name }}" class="form-control" placeholder="Enter Product Name Here" required="" >
</div>
<div class="form-group">
<label for="exampleInputEmail1">Category</label>
<select class="form-control" name="category_id" required="required">
<option value="">select Category</option>
@foreach($categories as $category)
@if($products[0]->category_id==$category->id)
<option value="{{ $category->id }}" selected>{{ $category->name }}</option>
@else
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endif
@endforeach
</select>
</div>
<div class="form-group">
<div>
<label for="exampleInputEmail1">Images</label>
</div>
@foreach($product_images as $image)
<div class="col-md-3 pic_div" style="border: 1px solid black">
<img style="height: 150px; width: 150px" src="{{ url('public/uploads/products') }}/{{ $image->image_name }}">
<div align="center" style="margin-top: 3px" > <button value="{{ $image->product_image_id }}" class="khan3 btn btn-danger "><i class="glyphicon glyphicon-trash"></i></button></div>
</div>
@endforeach
<input class="form-control" type="file" id="images" name="image[]" multiple />
</div>
<div class="form-group">
<label for="exampleInputPassword1" >Description</label>
<textarea style="height: 550px" class="form-control" name="editor1"><?php echo $products[0]->description;?></textarea>
</div>
<div style="margin-left: 50%;"><h3>Rates</h3></div>
<div class="sessions col-md-12" >
<table class="table table-bordered">
<thead style="background-color: #4ab752;">
<tr class="tr_clone">
<th style="width: 15%;">Quantity</th>
<th style="width: 13%;">Unit</th>
<th style="width: 13%;">(£)Amount</th>
<!-- <th style="width: 7%;">Add Participant</th>-->
<!-- <th style="width: 7%;">Participant Detail</th>-->
<th style="width: 7%;">Action</th>
</tr>
</thead>
<tbody id="session_body">
@foreach($product_rates as $rate)
<tr>
<td><input type="number" name="quantity[]" value="{{ $rate->quantity }}" placeholder="Enter Quantity Here" class="form-control" required="" step="any"></td>
<td><input type="text" name="unit[]" value="{{ $rate->unit }}" placeholder="Enter Unit Here" class="form-control" required=""></td>
<td><input type="text" name="amount[]" value="{{ $rate->amount }}" placeholder="Enter Amount Here" class="form-control" required=""></td>
<td><button class="btn btn-info btn-circle puradd1" type="button"><i class="fa fa-plus-square"></i></button>
<button class="btn btn-warning btn-circle removepur1" type="button"><i class="fa fa-times"></i></button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('body').on('click','.puradd1',function(){
var row = $(this).closest("tr");
var newRow = $('<tr>' +
'<td><input type="number" name="quantity[]" placeholder="Enter Quantity Here" class="form-control" required="" step="any"></td>'+
'<td><input type="text" name="unit[]" placeholder="Enter Unit Here" class="form-control" required=""></td>'+
'<td><input type="text" name="amount[]" placeholder="Enter Amount Here" class="form-control" required=""></td>'+
'<td> ' +
'<button class="btn btn-info btn-circle puradd1" type="button"><i class="fa fa-plus-square"></i></button>' +
' <button class="btn btn-warning btn-circle removepur1" type="button"><i class="fa fa-times"></i></button>' +
'</td>' +
'</tr>');
row.after(newRow);
});
$('body').on('click','.removepur1',function(){
$(this).closest('tr').remove();
$('.puradd1').show();
});
});
</script>
<script type="text/javascript">
CKEDITOR.replace('editor1', {
filebrowserUploadUrl: "{{route('ckeditor.upload', ['_token' => csrf_token() ])}}",
filebrowserUploadMethod: 'form'
});
</script>
<script>
$(document).ready(function(){
$('.khan3').on('click',function(e){
e.preventDefault();
if (confirm("Are you sure?"))
{
var fired_button = $(this).val();
$(this).closest("div.pic_div").hide();
$.get("{{ url('delete_product_image') }}"+'/'+fired_button,function(response){
});
}
})
});
</script>
@endsection
</body>
</html>
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]