Update source into github
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<div class="modal fade" id="AddonModal" tabindex="-1" role="dialog" aria-labelledby="AddonModal" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="AddonModal">Add new Addon to Product Service</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="box-append__element"></div>
|
||||
<div class="row row-order_id form-group">
|
||||
<label for="Order" class="col-md-4">Order ID:</label>
|
||||
<div class="col-md-8">
|
||||
<select name="order_id" class="form-control" id="Order">
|
||||
<option value="0">New Order</option>
|
||||
<option value="{{ $product->order_id }}">{{ $product->order_id }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-access__addon btn-primary">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@push('scripts')
|
||||
<script>
|
||||
$('.btn-trigger__addon').click(function (){
|
||||
$.get('{{route('api.GetAddonProduct')}}',{product: {{$product->id}}})
|
||||
.done(function (response){
|
||||
if (response.error === false)
|
||||
{
|
||||
$('.box-append__element').empty().append(response.data)
|
||||
} else {
|
||||
console.log(response)
|
||||
}
|
||||
})
|
||||
.catch(function (error){
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
})
|
||||
$('.btn-access__addon').click(function (){
|
||||
let body = $('body');
|
||||
let order = body.find('#AddonModal #Order option:selected').val()
|
||||
let addOnCPU = Number(body.find('#AddonModal #cpu').val())
|
||||
let addOnRAM = Number(body.find('#AddonModal #ram').val())
|
||||
let addOnSSD = Number(body.find('#AddonModal #ssd').val())
|
||||
|
||||
if(addOnCPU === 0 && addOnRAM === 0 && addOnSSD === 0)
|
||||
{
|
||||
Swal.fire({
|
||||
title: "Opp...",
|
||||
text: 'Invalid Request',
|
||||
icon: 'error',
|
||||
confirmButtonColor: "red",
|
||||
confirmButtonText: "Confirm"
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '{{route('api.AcceptAddon')}}',
|
||||
data: {
|
||||
order: order,
|
||||
cpu: addOnCPU,
|
||||
ram: addOnRAM,
|
||||
ssd: addOnSSD,
|
||||
product: {{$product->id}}
|
||||
},
|
||||
type: 'post',
|
||||
beforeSend: function (){
|
||||
swal.fire(
|
||||
{
|
||||
html: sweet_loader + "<h4>Please waiting ...</h4>",
|
||||
showConfirmButton: false
|
||||
}
|
||||
)
|
||||
},
|
||||
success: function (response)
|
||||
{
|
||||
if (response.error === false) {
|
||||
Swal.fire({
|
||||
title: "Thành công",
|
||||
text: response.message,
|
||||
icon: "success",
|
||||
confirmButtonColor: "#28a745",
|
||||
confirmButtonText: "Xác nhận"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
location.reload()
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Opp...",
|
||||
text: response.message,
|
||||
icon: 'error',
|
||||
confirmButtonColor: "#28a745",
|
||||
confirmButtonText: "Xác nhận"
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user