164 lines
7.3 KiB
PHP
164 lines
7.3 KiB
PHP
@php
|
|
use Carbon\Carbon;
|
|
use App\Http\Helpers\Helper;
|
|
@endphp
|
|
|
|
@extends("frontend.main")
|
|
@section("content")
|
|
<div class="row mt-2">
|
|
<div class="col-md-8 shadow rounded p-3">
|
|
<div class="row form-group">
|
|
<div class="col-md-6">
|
|
<div class="mb-3"><strong>Khách hàng</strong></div>
|
|
<div>{{ $invoice->Customer->firstname . " " . $invoice->Customer->lastname }}</div>
|
|
<div>Điện thoại: {{ $invoice->Customer->phone }}</div>
|
|
<div>Email: {{ $invoice->Customer->email }}</div>
|
|
<div>Địa chỉ: {{ $invoice->Customer->address }}</div>
|
|
</div>
|
|
<div class="col-md-6 border-0 border-start px-4">
|
|
<div class="mb-3"><strong>Thông tin hoá đơn</strong></div>
|
|
<div>Mã hoá đơn: #{{ $invoice->id }}</div>
|
|
<div>Ngày tạo: {{ Carbon::parse($invoice->date)->format("d/m/Y") }}</div>
|
|
<div>Hạn thanh toán: {{ Carbon::parse($invoice->due_date)->format("d/m/Y") }}</div>
|
|
<div>Tổng tiền: {{ number_format($invoice->total,0,',','.') }} đ</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="row form-group">
|
|
<div class="mb-3"><strong>Chi tiết hoá đơn</strong></div>
|
|
<table class="table table-invoice table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Dịch vụ</th>
|
|
<th>Thời hạn</th>
|
|
<th>Số tiền</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if($invoice->InvoiceItem->count())
|
|
@foreach($invoice->InvoiceItem->all() as $key => $item)
|
|
<tr>
|
|
<td class="text-center">{{ $key + 1 }}</td>
|
|
<td>
|
|
{{ $item->description }}
|
|
|
|
</td>
|
|
<td class="text-center">
|
|
{!! Helper::ViewBillingCycle($item->billing) !!}
|
|
</td>
|
|
<td class="text-center">
|
|
{{ number_format($item->amount * Helper::BillingFormat($item->billing),0,',','.') }}
|
|
đ
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@php($discount = 0)
|
|
@if($invoice->Order)
|
|
<tr>
|
|
<td colspan="3" class="text-end">
|
|
Giảm giá
|
|
</td>
|
|
<td class="text-center">
|
|
{{ number_format($invoice->Order->discount_value,0,',','.') }} đ
|
|
@php( $discount = $invoice->Order->discount_value)
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
<tr>
|
|
<td colspan="3" class="text-end">
|
|
Thành tiền (Chưa VAT)
|
|
</td>
|
|
<td class="text-center">
|
|
{{ number_format($invoice->InvoiceItem->sum('amount') * Helper::BillingFormat($item->billing) - $discount,0,',','.') }}
|
|
đ
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" class="text-end">
|
|
VAT (10%)
|
|
</td>
|
|
<td class="text-center">
|
|
{{ number_format(($invoice->InvoiceItem->sum('amount') * Helper::BillingFormat($item->billing) - $discount) * (10/100),0,',','.') }}
|
|
đ
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" class="text-end">
|
|
Tổng cộng
|
|
</td>
|
|
<td class="text-center">
|
|
{{ number_format($invoice->total,0,',','.') }} đ
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-md-4 shadow rounded p-3">
|
|
<div class="mb-3"><strong>Thông tin thanh toán</strong></div>
|
|
<div class="row form-group">
|
|
<div class="col-md-6">
|
|
<div>Trạng thái thanh toán:</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
{!! Helper::ViewInvoiceStatus($invoice->status) !!}
|
|
</div>
|
|
</div>
|
|
@if($invoice->status === 1)
|
|
<div class="row form-group mt-3">
|
|
<div class="col-md-6">
|
|
<div>Ngày thanh toán:</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
{{ Carbon::parse($invoice->date_paid)->format('d/m/Y') }}
|
|
</div>
|
|
</div>
|
|
{{-- <div class="row form-group mt-3">
|
|
<div class="col-md-6">
|
|
<div>Phương thức thanh toán:</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
{{ $invoice->Payment->name }}
|
|
</div>
|
|
</div> --}}
|
|
@endif
|
|
@if($invoice->status === 0)
|
|
<div class="row form-group mt-3">
|
|
<div class="col-md-12">
|
|
<label for="payment">Phương thức thanh toán:</label>
|
|
</div>
|
|
<input type="hidden" name="payment" value="1">
|
|
<div class="col-md-6 mt-3">
|
|
<div>Tổng thanh toán:</div>
|
|
</div>
|
|
<div class="col-md-6 mt-3">
|
|
<div><strong>{{ number_format($invoice->total,0,',','.') }} đ</strong></div>
|
|
</div>
|
|
<div class="p-3 col-md-12 text-center">
|
|
<button
|
|
onclick="PaymentInvoice({{$invoice->id}})"
|
|
class="btn bg-color__brand w-100 text-white btn-payment bg-gradient">
|
|
<i class="fas fa-cart-plus"></i>
|
|
Thanh toán ngay
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
</div>
|
|
</div>
|
|
|
|
@push('viewScripts')
|
|
<script src="{{ asset('js/sweetalert.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
const ApiUserPaymentInvoice = '{{ route('api.user.PaymentInvoice') }}';
|
|
</script>
|
|
@endpush
|
|
@push('viewStyles')
|
|
<link rel="stylesheet" href="{{ asset('css/sweetalert.css') }}">
|
|
@endpush
|
|
@endsection
|