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
|
||||
@@ -0,0 +1,33 @@
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<select class="custom-select" name="change-product">
|
||||
@foreach($allService as $item)
|
||||
@php
|
||||
$productName = $item->description ?? 'Product #' . $item->product_id;
|
||||
@endphp
|
||||
<option value="{{ $item->product_id.'|'.$item->product_type }}"
|
||||
data-url="{{ route('customer.product',['userid' => $userid,'product' => $item->product_id,'type' => $item->product_type]) }}"
|
||||
@selected($product && "$product->id|$type" === "$item->product_id|$item->product_type")>
|
||||
{{ $productName }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@if($product)
|
||||
@switch($type)
|
||||
@case(3)
|
||||
<a href="{{ $product->Server ? "https://".$product->Server->name.":8880" : "" }}"
|
||||
target="_blank"
|
||||
class="btn bg-gradient-success">Login with Panel</a>
|
||||
@break
|
||||
@case(4)
|
||||
<button
|
||||
data-toggle="modal"
|
||||
data-target="#AddonModal"
|
||||
class="btn btn-trigger__addon bg-gradient-success">Add new addon
|
||||
</button>
|
||||
@break
|
||||
@endswitch
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user