@php use Carbon\Carbon; use \Spatie\Permission\Models\Role; @endphp
<div>
<div class="container">
    <fieldset>
        <legend>Client</legend>
        <div class="row">
            <h5 class="col-12">Organization Details</h5>

            <div class="col-12">
                <dl class="row">
                    <dt class="col-3">Name (Short)</dt>
                    <dd class="col-9">{{ $client->name_sh ?? '-' }}</dd>

                    <dt class="col-3">Full Name</dt>
                    <dd class="col-9">{{ $client->name_fl ?? '-' }}</dd>

                    <dt class="col-3">Address</dt>
                    <dd class="col-9">{{ $client->address ?? '-' }}</dd>
                </dl>
            </div>
        </div>

        <div class="row">
            <h5 class="col-12">Company Representative</h5>

            <div class="col-12">
                <dl class="row">
                    <dt class="col-3">Surname</dt>
                    <dd class="col-9">{{ $client->boss_surn ?? '-' }}</dd>

                    <dt class="col-3">First Name</dt>
                    <dd class="col-9">{{ $client->boss_name ?? '-' }}</dd>

                    <dt class="col-3">Other Name</dt>
                    <dd class="col-9">{{ $client->boss_othname ?? '-' }}</dd>

                    <dt class="col-3">Post </dt>
                    <dd class="col-9">{{ $client->boss_post ?? '-' }}</dd>

                    <dt class="col-3">Phone</dt>
                    <dd class="col-9">{{ $client->boss_phone ?? '-' }}</dd>

                    <dt class="col-3">Cell</dt>
                    <dd class="col-9">{{ $client->boss_cell ?? '-' }}</dd>

                    <dt class="col-3">Email</dt>
                    <dd class="col-9">{{ $client->boss_email ?? '-' }}</dd>
                </dl>
            </div>
        </div>

        <div class="row">
            <h5 class="col-12">Accountant</h5>

            <div class="col-12">
                <dl class="row">
                    <dt class="col-3">Surname</dt>
                    <dd class="col-9">{{ $client->acc_surn ?? '-' }}</dd>

                    <dt class="col-3">First Name</dt>
                    <dd class="col-9">{{ $client->acc_name ?? '-' }}</dd>

                    <dt class="col-3">Other Name</dt>
                    <dd class="col-9">{{ $client->acc_othname ?? '-' }}</dd>

                    <dt class="col-3">Post </dt>
                    <dd class="col-9">{{ $client->acc_post ?? '-' }}</dd>

                    <dt class="col-3">Phone</dt>
                    <dd class="col-9">{{ $client->acc_phone ?? '-' }}</dd>

                    <dt class="col-3">Cell</dt>
                    <dd class="col-9">{{ $client->acc_cell ?? '-' }}</dd>

                    <dt class="col-3">Email</dt>
                    <dd class="col-9">{{ $client->acc_email ?? '-' }}</dd>
                </dl>
            </div>
        </div>
    </fieldset>

    <fieldset>
        <legend>Contract</legend>
        <div class="row">
            <h5 class="col-12">Contract Details</h5>

            <div class="col-12">
                <dl class="row">
                    <dt class="col-3">Client</dt>
                    <dd class="col-9">{{ $client->name_fl ?? '-' }}</dd>

                    <dt class="col-3">Issue Date</dt>
                    <dd class="col-9">{{ Carbon::parse($contract->d_doc ?? '')->toDateString() }}</dd>

                    <dt class="col-3">Start Date</dt>
                    <dd class="col-9">{{ Carbon::parse($contract->d_bgn ?? '')->toDateString() }}</dd>

                    <dt class="col-3">Expiry Date</dt>
                    <dd class="col-9">{{ Carbon::parse($contract->d_end ?? '')->toDateString() }}</dd>

                    <dt class="col-3">Contract Number</dt>
                    <dd class="col-9">{{ '-' }}</dd>
                </dl>
            </div>
        </div>

        <div class="row">
            <h5 class="col-12">Company Representative</h5>

            <div class="col-12">
                <dl class="row">
                    <dt class="col-3">Surname</dt>
                    <dd class="col-9">{{ $client->boss_surn ?? $contract->manager_surn ?? '-' }}</dd>

                    <dt class="col-3">First Name</dt>
                    <dd class="col-9">{{ $client->boss_name ?? $contract->manager_name ?? '-' }}</dd>

                    <dt class="col-3">Other Name</dt>
                    <dd class="col-9">{{ $client->boss_othname ?? $contract->manager_othnam ?? '-' }}</dd>

                    <dt class="col-3">Post </dt>
                    <dd class="col-9">{{ $client->boss_post ?? $contract->manager_post ?? '-' }}</dd>

                    <dt class="col-3">Phone</dt>
                    <dd class="col-9">{{ $client->boss_email ?? $contract->manager_phone ?? '-' }}</dd>

                    <dt class="col-3">Cell</dt>
                    <dd class="col-9">{{ $client->boss_phone ?? $contract->manager_cell ?? '-' }}</dd>

                    <dt class="col-3">Email</dt>
                    <dd class="col-9">{{ $client->boss_cell ?? $contract->manager_email ?? '-' }}</dd>
                </dl>
            </div>
        </div>

        <div class="row">
            <h5 class="col-12">Contract Access</h5>

            <div class="col-12">
                <h5 class="col-12">Access Type</h5>

                <div class="col-12">
                    <dl class="row">
                        <dt class="col-3">Internet</dt>
                        <dd class="col-9">{{ isset($contract) && $contract->posted_by_internet == 1 ? 'true' : 'false' }}</dd>

                        <dt class="col-3">Web-Service (API)</dt>
                        <dd class="col-9">{{ isset($contract) && $contract->posted_by_service == 1 ? 'true' : 'false' }}</dd>
                    </dl>
                </div>
            </div>

            <div class="col-12">
                <h5 class="col-12">Payment Type</h5>

                <div class="col-12">
                    <dl class="row">
                        <dt class="col-3">
                            {{--@if($contract->payment_type==1) Post-paid @endif
                            @if($contract->payment_type==2) Pre-paid @endif
                            @if($contract->payment_type==3) Free @endif--}}
                            @if(isset($contract->payment_type))
                                @switch($contract->payment_type)
                                    @case(1)
                                    Post-paid
                                    @break
                                    @case(2)
                                    Pre-paid
                                    @break
                                    @case(3)
                                    Free
                                    @break
                                    @default
                                    -
                                    @break
                                @endswitch
                            @endif
                        </dt>
                    </dl>
                </div>
            </div>
        </div>
    </fieldset>

    <fieldset>
        <legend>User</legend>
        <div class="row">
            <h5 class="col-12">User Details</h5>

            <div class="col-12">
                <dl class="row">
                    <dt class="col-3">Contract</dt>
                    <dd class="col-9">{{ $contract->client->name_fl ?? '-' }}</dd>

                    <dt class="col-3">Name</dt>
                    <dd class="col-9">{{ $user->name ?? '-' }}</dd>

                    <dt class="col-3">Email</dt>
                    <dd class="col-9">{{ $user->email ?? '-' }}</dd>

                    <dt class="col-3">Status</dt>
                    <dd class="col-9">
                        @if(isset($user))
                            @switch($user->status_l)
                                @case(1)
                                Active
                                @break
                                @case(2)
                                In-active
                                @break
                                @default
                                -
                                @break
                            @endswitch
                        @endif
                    </dd>

                    <dt class="col-3">Roles</dt>
                    <dd class="col-9">
                        @foreach($roles as $role)
                            <div class="icheck-primary" disabled="" title="{{ $role->name }}" @if($role->for_contract) style="display: none" @endif>
                                <input type="checkbox" @checked((isset($contract) && $role->name == 'CID-'.$contract->rid) || (isset($user) && $user->hasRole($role->name)))
                                name="role[]" value="{{ $role->name }}"
                                       id="role-{{ $loop->index }}">

                                <label for="role-{{ $loop->index }}" class="font-weight-normal">
                                    {{ $role->name }}
                                </label>
                            </div>
                        @endforeach
                    </dd>
                </dl>
            </div>
        </div>
    </fieldset>
</div>
