458 lines
34 KiB
PHP
458 lines
34 KiB
PHP
@extends("frontend.main")
|
|
@section("content")
|
|
@php $total = 0 @endphp
|
|
<div class="row mt-2">
|
|
@if(! empty( $cart) )
|
|
<div class="col-md-8">
|
|
<form action="{{ route('cart.store') }}" class="form-submit__oder" method="post">
|
|
@csrf
|
|
@if(count($cart))
|
|
<div class="list_cart_choosen_product">
|
|
@foreach($cart as $key => $item)
|
|
@if($item['product_type'] == 4)
|
|
|
|
<div data-product="{{ $key }}"
|
|
data-target="vps"
|
|
class="row row-product__item shadow mb-3 rounded p-3">
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
<div class="col-md-10">
|
|
<h4>{{ $item['product']->name }}</h4>
|
|
</div>
|
|
<div class="col-md-2 text-end">
|
|
<a href="{{ route('cart.remove',['cart_id' => $key]) }}">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<!--Time buy-->
|
|
<div class="row form-group mt-3 align-items-center">
|
|
<label class="col-md-4" for="time_buy">Chọn khoảng thời gian:</label>
|
|
<div class="col-md-8">
|
|
<select class="form-control time-buy__change"
|
|
data-price="{{ $item['price'] }}"
|
|
id="time_buy" name="vps[{{ $key }}][time_buy]">
|
|
<option
|
|
value="1"
|
|
@selected(
|
|
(isset(session('vps')[$key]['time_buy']) && (int) session('vps')[$key]['time_buy'] === 1) ||
|
|
(isset(old('vps')[$key]['time_buy']) && (int) old('vps')[$key]['time_buy'] === 1)
|
|
)>
|
|
|
|
1 Tháng
|
|
</option>
|
|
<option
|
|
value="3"
|
|
@selected(
|
|
(isset(session('vps')[$key]['time_buy']) && (int) session('vps')[$key]['time_buy'] === 3) ||
|
|
(isset(old('vps')[$key]['time_buy']) && (int) old('vps')[$key]['time_buy'] === 3)
|
|
)>
|
|
3 Tháng
|
|
</option>
|
|
<option
|
|
value="6"
|
|
@selected(
|
|
(isset(session('vps')[$key]['time_buy']) && (int) session('vps')[$key]['time_buy'] === 6) ||
|
|
(isset(old('vps')[$key]['time_buy']) && (int) old('vps')[$key]['time_buy'] === 6)
|
|
)>
|
|
6 Tháng
|
|
</option>
|
|
<option
|
|
value="12" @selected(
|
|
(isset(session('vps')[$key]['time_buy']) && (int) session('vps')[$key]['time_buy'] === 12) ||
|
|
(isset(old('vps')[$key]['time_buy']) && (int) old('vps')[$key]['time_buy'] === 12)
|
|
)>
|
|
12 Tháng
|
|
</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="row form-group mt-3 align-items-center">
|
|
<label class="col-md-4" for="hostname_{{$key}}">Nhập Hostname:</label>
|
|
<div class="col-md-8"><input type="text" class="form-control"
|
|
value="{{ (! is_null(session('vps')) ? session('vps')[$key]['hostname'] : null) ?? ( ! is_null(old('vps')) ? old('vps')[$key]['hostname'] : null) }}"
|
|
name="vps[{{$key}}][hostname]"
|
|
placeholder="Hostname"
|
|
id="hostname_{{$key}}"></div>
|
|
</div>
|
|
<hr>
|
|
<div class="mb-2">Chọn hệ điều hành</div>
|
|
|
|
<div class="row box-os__selector">
|
|
<input type="hidden" class="os_select_hidden"
|
|
name="vps[{{ $key }}][os_id]"
|
|
value="{{ (! is_null(session('vps')) ? session('vps')[$key]['os_id'] : null) ?? ( ! is_null(old('vps')) ? old('vps')[$key]['os_id'] : null) }}">
|
|
<input type="hidden" class="os_select_hidden"
|
|
name="vps[{{ $key }}][os_version_id]"
|
|
value="{{ (! is_null(session('vps')) ? session('vps')[$key]['os_version_id'] : null) ?? ( ! is_null(old('vps')) ? old('vps')[$key]['os_version_id'] : null) }}">
|
|
@if($item['os_group']->count())
|
|
@foreach($item['os_group']->all() as $_item)
|
|
<div
|
|
data-os="{{ $_item->id }}"
|
|
class="col-md-3 box-os_center {{ ( isset(session('vps')[$key]['os_id']) && (int) session('vps')[$key]['os_id'] === $_item->id) || (isset(old('vps')[$key]['os_id']) && (int) old('vps')[$key]['os_id'] === $_item->id) ? "active" : "" }} text-center shadow position-relative border rounded p-3">
|
|
<span class="deploy_checkbox_checkmark"
|
|
style="top:20px; margin-top:0;">
|
|
</span>
|
|
<div class="box-image__check">
|
|
<img
|
|
src="{{ $_item->thumbnail }}"
|
|
alt="{{ $_item->name }}">
|
|
<span>
|
|
<strong>{{ $_item->name }}</strong>
|
|
</span>
|
|
<hr style="height: 0.25px">
|
|
</div>
|
|
|
|
<div class="mt-2 d-block btn-check__os">
|
|
<label>
|
|
<select name="version"
|
|
class="select-version__os form-control">
|
|
<option value="0">Chọn Version</option>
|
|
@if($_item->Os->count())
|
|
@foreach($_item->Os->all() as $_sub)
|
|
<option
|
|
@selected(
|
|
(( isset(session('vps')[$key]['os_id']) && (int) session('vps')[$key]['os_id'] === $_item->id) || (isset(old('vps')[$key]['os_id']) && (int) old('vps')[$key]['os_id'] === $_item->id)) &&
|
|
(( isset(old('vps')[$key]['os_version_id']) && old('vps')[$key]['os_version_id'] === $_sub->id ) || (isset(session('vps')[$key]['os_version_id']) && (int) session('vps')[$key]['os_version_id'] === $_sub->id ))
|
|
)
|
|
value="{{ $_sub->id }}">{{ $_sub->version }}
|
|
</option>
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
<hr>
|
|
<div>Dịch vụ bổ sung</div>
|
|
<div class="row mt-3">
|
|
@if($item['addon']->count())
|
|
@foreach($item['addon']->all() as $_item)
|
|
<div class="col-md-4">
|
|
<div class="box-add__on">
|
|
<div class="box-title_name mb-2">
|
|
<label for="input-qty"><strong>{{ $_item->name }}
|
|
({{number_format($_item->price,0,'.',',') }}
|
|
đ/
|
|
1 Tháng)</strong> </label>
|
|
</div>
|
|
<div class="buttons_added">
|
|
<input class="minus is-form" type="button"
|
|
value="-">
|
|
<input class="input-qty" max="{{ $_item->max }}"
|
|
min="{{ $_item->min }}"
|
|
step="{{ $_item->step }}"
|
|
name="vps[{{$key}}][addon][{{ strtolower($_item->name) }}][value]"
|
|
data-name="{{ strtolower($_item->name) }}"
|
|
data-price="{{ $_item->price }}"
|
|
data-prefix="{{ $_item->prefix }}"
|
|
type="text"
|
|
value="{{ (! is_null(session('vps')) ? session('vps')[$key]['addon'][strtolower($_item->name)]['value'] : 0) ?? ( ! is_null(old('vps')) ? old('vps')[$key]['addon'][strtolower($_item->name)]['value'] : 0) }}">
|
|
<input class="plus is-form" type="button" value="+">
|
|
<input type="hidden"
|
|
name="vps[{{$key}}][addon][{{ strtolower($_item->name) }}][price]"
|
|
value="{{ $_item->price }}" class="item">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
@else
|
|
<!--Hosting Service-->
|
|
<div data-product="{{ $key }}"
|
|
data-target="hosting"
|
|
class="row row-product__item shadow mb-3 rounded p-3">
|
|
<div class="col-md-12">
|
|
<div class="row align-items-center">
|
|
<!--Name-->
|
|
<div class="col-md-10">
|
|
<h4>{{ $item['product']->name }}</h4>
|
|
</div>
|
|
<!--Delete-->
|
|
<div class="col-md-2 text-end">
|
|
<a href="{{ route('cart.remove',['cart_id' => $key]) }}">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<!--Domain-->
|
|
<div class="row form-group align-items-center">
|
|
<label class="col-md-4" for="domain">Nhập tên miền để kích hoạt:</label>
|
|
<div class="col-md-8">
|
|
<input type="text" class="form-control"
|
|
value="{{ ( ! is_null(session('hosting')) ? session('hosting')[$key]['domain'] : null) ??
|
|
( ! is_null(old('hosting')) ? old('hosting')[$key]['domain'] : null) }}"
|
|
name="hosting[{{$key}}][domain]"
|
|
placeholder="abc.com"
|
|
id="domain">
|
|
</div>
|
|
</div>
|
|
<!--Time Buy-->
|
|
<div class="row form-group mt-3 align-items-center">
|
|
<label class="col-md-4" for="time_buy_{{$key}}">Chọn khoảng thời
|
|
gian:</label>
|
|
<div class="col-md-8">
|
|
<select class="form-control time-buy__change"
|
|
data-price="{{ $item['price'] }}"
|
|
id="time_buy_{{$key}}" name="hosting[{{$key}}][time_buy]">
|
|
<option
|
|
value="12"
|
|
@selected(
|
|
(isset(session('hosting')[$key]['time_buy']) && (int) session('hosting')[$key]['time_buy'] === 12) ||
|
|
(isset(old('hosting')[$key]['time_buy']) && (int) old('hosting')[$key]['time_buy'] === 12)
|
|
)>
|
|
12 Tháng
|
|
</option>
|
|
{{-- <option--}}
|
|
{{-- value="24"--}}
|
|
{{-- @selected(--}}
|
|
{{-- (isset(session('hosting')[$key]['time_buy']) && (int) session('hosting')[$key]['time_buy'] === 24) ||--}}
|
|
{{-- (isset(old('hosting')[$key]['time_buy']) && (int) old('hosting')[$key]['time_buy'] === 24)--}}
|
|
{{-- )>--}}
|
|
{{-- 24 Tháng--}}
|
|
{{-- </option>--}}
|
|
{{-- <option--}}
|
|
{{-- value="36"--}}
|
|
{{-- @selected(--}}
|
|
{{-- (isset(session('hosting')[$key]['time_buy']) && (int) session('hosting')[$key]['time_buy'] === 36) ||--}}
|
|
{{-- (isset(old('hosting')[$key]['time_buy']) && (int) old('hosting')[$key]['time_buy'] === 36)--}}
|
|
{{-- )>--}}
|
|
{{-- 36 Tháng--}}
|
|
{{-- </option>--}}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</form>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="shadow rounded cart_widget p-3">
|
|
<div class="title">
|
|
Thông tin đơn hàng
|
|
</div>
|
|
@foreach($cart as $key => $item)
|
|
@if(! is_null(session('vps')) && $item['product_type'] === 4 )
|
|
@foreach(session('vps')[$key]['addon'] as $_key => $_add)
|
|
@if($_add['value'])
|
|
@php($total += $_add['value'] * $_add['price'] * session('vps')[$key]['time_buy'])
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
<div class="name-price"
|
|
data-price__addon="{{$total}}"
|
|
data-focus="{{ $item['product_type'] === 3 ? "hosting_$key" : "vps_$key" }}"
|
|
data-price__product="{{ $key }}">
|
|
<div class="name">
|
|
<span class="name-price-left">{{ $item['product']->name }}</span>
|
|
<span class="text-highlight text-cycle name-price-right">
|
|
@switch($item['product_type'])
|
|
@case(3)
|
|
x <span
|
|
data-month="{{ (! is_null(session('hosting')) ? session('hosting')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('hosting')) ? old('hosting')[$key]['time_buy'] : null ) ?? 12)}}"
|
|
class="hosting_{{$key}}_month">{{ (! is_null(session('hosting')) ? session('hosting')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('hosting')) ? old('hosting')[$key]['time_buy'] : null ) ?? 12)
|
|
}}</span> Tháng
|
|
@break
|
|
@case(4)
|
|
x <span
|
|
data-month="{{ (! is_null(session('vps')) ? session('vps')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('vps')) ? old('vps')[$key]['time_buy'] : null ) ?? 1)
|
|
}}"
|
|
class="vps_{{$key}}_month">{{ (! is_null(session('vps')) ? session('vps')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('vps')) ? old('vps')[$key]['time_buy'] : null ) ?? 1)
|
|
}}</span> Tháng
|
|
@break
|
|
@endswitch
|
|
</span>
|
|
</div>
|
|
<div class="price">
|
|
<span class="price-amount">
|
|
@switch($item['product_type'])
|
|
@case(3)
|
|
<span
|
|
data-price="{{ ($item['price'] * ((! is_null(session('hosting')) ? session('hosting')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('hosting')) ? old('hosting')[$key]['time_buy'] : null ) ?? 12))) }}"
|
|
class="hosting_{{$key}}_price-amount">
|
|
{{ number_format(($item['price'] * ((! is_null(session('hosting')) ? session('hosting')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('hosting')) ? old('hosting')[$key]['time_buy'] : null ) ?? 12))),0,'.',',') }}
|
|
</span>đ
|
|
@php($total += $item['price']* ((! is_null(session('hosting')) ? session('hosting')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('hosting')) ? old('hosting')[$key]['time_buy'] : null ) ?? 12)))
|
|
@break
|
|
@case(4)
|
|
<span
|
|
data-price=" {{ $item['price'] * ((! is_null(session('vps')) ? session('vps')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('vps')) ? old('vps')[$key]['time_buy'] : null ) ?? 1)) }}"
|
|
class="vps_{{$key}}_price-amount">
|
|
{{ number_format($item['price'] * ((! is_null(session('vps')) ? session('vps')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('vps')) ? old('vps')[$key]['time_buy'] : null ) ?? 1)),0,'.',',') }}
|
|
</span>đ
|
|
@php($total += $item['price']* ((! is_null(session('vps')) ? session('vps')[$key]['time_buy'] : null) ??
|
|
((! is_null(old('vps')) ? old('vps')[$key]['time_buy'] : null ) ?? 1)))
|
|
@break
|
|
@endswitch
|
|
</span>
|
|
</div>
|
|
<div
|
|
class="box-add__on {{ ! (isset(session('vps')[$key]['addon']['cpu']) && session('vps')[$key]['addon']['cpu']['value']) ? "d-none" : "" }} text-start">
|
|
<div>Dịch vụ bổ sung</div>
|
|
<input type="hidden" name="sum_total_addOn" value="0">
|
|
@if($item['product_type'] === 4)
|
|
@if(! is_null(session('vps')))
|
|
@foreach(session('vps')[$key]['addon'] as $_key => $_add)
|
|
@if($_add['value'])
|
|
<div class="price addon-price vps_{{$key}}_add_{{$_key}}">
|
|
<div class="addon-price__name">{{ strtoupper($_key) }}</div>
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<span class="price-amount">
|
|
<span
|
|
data-price="{{$_add['value'] * $_add['price']}}"
|
|
class="vps_0_add_cpu_price-amount">
|
|
{{ number_format($_add['value'] * $_add['price'],0,'.','.') }}</span> đ
|
|
</span>
|
|
</div>
|
|
<div> X {{$_add['value']}}</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@if(session('coupon'))
|
|
<div class="item-bottom item-price-discount pt-2" style="border-top: 1px dashed;">
|
|
<span class="font-weight-bold cart_widget_subtitle">
|
|
Giảm giá
|
|
</span>
|
|
<span class="price">
|
|
@switch(session('coupon')['coupon_type'])
|
|
@case(1)
|
|
<span
|
|
data-price="{{(session('coupon')['coupon_value'] / 100 ) * $total }}"
|
|
class="price-amount price-one font-weight-bold color-main cart_coupon">
|
|
{{ number_format((session('coupon')['coupon_value'] / 100 ) * $total,0,'.',',') }}
|
|
</span>
|
|
đ
|
|
@php($total -= (session('coupon')['coupon_value'] / 100 ) * $total)
|
|
@break
|
|
@case(2)
|
|
<span
|
|
data-price="{{session('coupon')['coupon_value']}}"
|
|
class="price-amount price-one font-weight-bold color-main cart_coupon">
|
|
{{ number_format(session('coupon')['coupon_value'],0,'.',',') }}
|
|
</span>
|
|
đ
|
|
@php($total -= session('coupon')['coupon_value'])
|
|
@break
|
|
@endswitch
|
|
</span>
|
|
</div>
|
|
@endif
|
|
@if($total < 0)
|
|
@php($total = 0)
|
|
@endif
|
|
<div class="item-bottom item-price-all">
|
|
<span class="font-weight-bold cart_widget_subtitle">
|
|
Tổng tiền (chưa VAT)
|
|
</span>
|
|
<span class="price">
|
|
<span
|
|
data-price="{{$total}}"
|
|
class="price-amount price-one font-weight-bold color-main cart_total_novat">
|
|
{{ number_format($total,0,'.',',') }}
|
|
</span>
|
|
đ
|
|
</span>
|
|
</div>
|
|
<div class="item-bottom item-price-all">
|
|
<span class="font-weight-bold cart_widget_subtitle">
|
|
VAT <i class="fa-regular fa-circle-exclamation color-main"></i>
|
|
</span>
|
|
<span class="price">
|
|
<span
|
|
data-price="{{$total * (10/100)}}"
|
|
class="price-amount price-one font-weight-bold color-main cart_vat">
|
|
{{ number_format($total * (10/100),0,'.',',') }}
|
|
@php($total += $total * (10/100) )
|
|
</span>
|
|
đ
|
|
</span>
|
|
</div>
|
|
<div class="item-bottom item-price-all">
|
|
<span class="font-weight-bold cart_widget_subtitle">
|
|
Thành tiền
|
|
</span>
|
|
<span class="price">
|
|
<span
|
|
data-price="{{$total}}"
|
|
class="price-amount price-one font-weight-bold color-main cart_total_amount">
|
|
{{ number_format($total,0,'.',',') }}
|
|
</span>
|
|
đ
|
|
</span>
|
|
</div>
|
|
</div>
|
|
@if(! session('coupon'))
|
|
<div class="shadow rounded cart_widget p-3 mt-3">
|
|
<div class="title">
|
|
Bạn có mã giảm giá?
|
|
</div>
|
|
<div class="form-apply">
|
|
<form action="{{ route('cart.applyCoupon') }}" class="form-coupon__checker" method="post">
|
|
@csrf
|
|
<div class="input-group">
|
|
<input type="text" class="form-control promotion_code"
|
|
placeholder="Nhập mã ưu đãi của bạn tại đây" name="promotion_code">
|
|
|
|
<div class="input-group-append">
|
|
<button class="btn btn-outline-secondary apply_coupon" type="button"
|
|
onclick="loadForm(this)">
|
|
<i class="fas fa-check"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
<div class="pt-3">
|
|
<a href="javascript:void(0)" class="btn w-100 bg-color__brand btn-order text-white bg-gradient">
|
|
<i class="fas fa-cart-plus"></i>
|
|
Đặt hàng
|
|
</a>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<div class="col-md-12">
|
|
<div class="alert alert-warning" role="alert">
|
|
Chưa có đơn hàng
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endsection
|
|
@if(! empty($cart))
|
|
@push('viewScripts')
|
|
<script src="{{ asset('lib/validate/validate.min.js') }}"></script>
|
|
@endpush
|
|
@endif
|