@extends('admin/layouts/contentLayoutMaster')

@section('title', $title)

@section('vendor-style')
    <style>
        .table-bordered th,
        .table-bordered td {
            border: 1px solid #d7cece !important;
        }
    </style>
@endsection
@section('content')

    <?php
    $statuses = Config::get('params.statuses');
    $customer_types = Config::get('params.customer_types');
    $confrim = Config::get('params.confrim');
    // echo '<pre>';
    // print_r($model);
    // die();
    ?>
    <!-- Add rows table -->
    <div class="row card">
        <div class="card-header">
            <ul id="tabsJustified" class="nav nav-tabs">
                <li class="nav-item"><a href="#_" data-target="#information" data-toggle="tab"
                        class="nav-link small text-uppercase active">Customer Information</a></li>
                <li class="nav-item"><a href="#_" data-target="#transaction" data-toggle="tab"
                        class="nav-link small text-uppercase ">Transaction</a></li>

            </ul>
        </div>

        <div id="tabsJustifiedContent" class="tab-content">
            <div id="information" class="tab-pane fade active show">

                <div class="card-content">
                    <div class="card-body">

                        <div class="row">
                            <div class="col-sm-12">

                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td>First Name :</td>
                                            <td>{{ $model->firstName }}</td>
                                        </tr>
                                        <tr>
                                            <td>Last Name :</td>
                                            <td>{{ $model->lastName }}</td>
                                        </tr>
                                        <tr>
                                            <td>Email :</td>
                                            <td>{{ $model->email }}</td>
                                        </tr>
                                        <tr>
                                            <td>Phone :</td>
                                            <td>{{ $model->phone }}</td>
                                        </tr>
                                        <tr>
                                            <td>Status :</td>
                                            <td>{{ $model->status }}</td>
                                        </tr>

                                        <tr>
                                            <td>Type :</td>
                                            <td>{{ $customer_types[$model->type] }}</td>
                                        </tr>

                                        <tr>
                                            <td>Address Line :</td>
                                            <td>{{ $model->address->address1 }}</td>
                                        </tr>
                                        <tr>
                                            <td>Address Line 2 :</td>
                                            <td>{{ $model->address->address2 }}</td>
                                        </tr>
                                        <tr>
                                            <td>City :</td>
                                            <td>{{ $model->address->city }}</td>
                                        </tr>
                                        <tr>
                                            <td>Postcode :</td>
                                            <td>{{ $model->address->postcode }}</td>
                                        </tr>

                                        <tr>
                                            <td>Created:</td>
                                            <td>{{ $model->crated_at }}</td>
                                        </tr>
                                        <tr>
                                            <td>Last Updated:</td>
                                            <td>{{ $model->updated_at }}</td>
                                        </tr>

                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>

            </div>
            @if (count($transaction) > 0)
                <div id="transaction" class="tab-pane fade">
                    <div class="card-content">
                        <div class="card-body">
                            <div class="row">
                                <div class="col-sm-12">
                                    <table class="table table-bordered">
                                        <tbody>

                                            <tr>
                                                <th>Invoice Number</th>
                                                <th>Payment Method </td>
                                                <th>Boiler age </th>
                                                <th>Price </th>
                                                <th>Vat </th>
                                                <th>Total </th>
                                                <th>Start Date </th>
                                                <th>Confirmed </th>
                                                <th>Status </th>
                                                <th>Package Title </th>
                                                <th></th>
                                            </tr>
                                            @foreach ($transaction as $tran)
                                                <tr>
                                                    <td>{{ $tran->invoiceNumber }}</td>
                                                    <td>{{ $tran->paymentMethod }}</td>
                                                    <td>{{ $tran->boilerAge }}</td>
                                                    <td>{{ $tran->price }}</td>
                                                    <td>{{ $tran->vat }}</td>
                                                    <td>{{ $tran->total }}</td>
                                                    <td>{{ $tran->startDate }}</td>
                                                    <td>{{ isset($confrim[$tran->confirmed]) }}</td>
                                                    <td>{{ $tran->status ? 'Active' : 'Inactive' }}</td>
                                                    <td>{{ $tran->package->title }}</td>
                                                    <td><a href="{{ url('admin/transactions') }}/{{ $tran->id }}"
                                                            target="_blank"
                                                            class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light">View</a>
                                                            <a href="{{ url('admin/transactions/pdf') }}/{{ $tran->id }}"
                                                                class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light">Download</a>
                                                        </td>
                                                    </td>

                                                </tr>
                                            @endforeach



                                        </tbody>
                                    </table>


                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            @endif


        </div>

    </div>



    <!--/ Add rows table -->
    <!--/ Scroll - horizontal and vertical table -->
@endsection
@include('vendor_script')
@section('myscript')
    {{-- Page js files --}}
@endsection
