@extends('adminlte::page')

@section('title', "IPRS | Edit a Client's Details")

@section('plugins.Select2', true)

@section('content_header')
    <div class="col-9 mx-auto">
        <div class="row mb-2">
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-left">
                    <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Dashboard</a></li>
                    <li class="breadcrumb-item"><a href="{{ route('client.index') }}">Clients</a></li>
                    <li class="breadcrumb-item active">{{ ucfirst($client->name_fl) }}</li>
                </ol>
            </div>
        </div>
        <div class="row mb-2">
            <div class="col-sm-12">
                <h1 class="m-0">{{ ucfirst($client->name_fl) }}</h1>
            </div>
        </div>
    </div>
@stop

@section('content')
    <div class="col-9 mx-auto">
        <form method="PATCH" action="{{ route('client.update', ['client'=>$client->rid]) }}" enctype="application/x-www-form-urlencoded">
            @csrf
            @method('PATCH')
            <fieldset>
                <legend>Organisation Details</legend>
                <div class="row">
                    <x-adminlte-input type="text" class="form-control" id="NAME_SH" name="NAME_SH"
                        label="Name (Short)"
                        value="{{ $client->name_sh ?? old('name_sh') }}"
                        placeholder="Organisation Name (Short)" fgroup-class="col-md-6"/>
                    <x-adminlte-input type="text" class="form-control" id="NAME_FL" name="NAME_FL"
                        value="{{ $client->name_fl ?? old('name_fl') }}"
                        label="Full Name" placeholder="Organisation Full Name" fgroup-class="col-md-6"/>
                    <x-adminlte-input type="text" class="form-control" id="ADDRESS" name="ADDRESS"
                        value="{{ $client->address ?? old('address') }}"
                        placeholder="Address" label="Organisation Address" fgroup-class="col-md-6"/>
                    <x-adminlte-input type="text" class="form-control" id="BANK_ACC" name="BANK_ACC"
                        placeholder="Organisation Bank Account"
                        value="{{ $client->bank_acc ?? old('bank_acc') }}"
                        label="Bank Account" fgroup-class="col-md-6"/>
                </div>
            </fieldset>
            <fieldset>
                <legend>Company Representative</legend>
                <div class="row">
                    <x-adminlte-input type="text" class="form-control" id="BOSS_SURN" name="BOSS_SURN"
                        label="Surname" placeholder="Surname" enable-old-support
                        value="{{ $client->boss_surn ?? old('boss_surn') }}" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="BOSS_NAME" name="BOSS_NAME"
                        value="{{ $client->boss_name ?? old('boss_name') }}"
                        label="First Name" placeholder="First Name" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="BOSS_OTHNAME" name="BOSS_OTHNAME"
                        value="{{ $client->boss_othname ?? old('boss_othname') }}"
                        label="Othername" placeholder="Othername" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="BOSS_POST" name="BOSS_POST"
                        value="{{ $client->boss_post ?? old('boss_post') }}"
                        label="Post in Organisation" placeholder="Post in Organisation" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="BOSS_PHONE" name="BOSS_PHONE"
                        value="{{ $client->boss_phone ?? old('boss_phone') }}"
                        label="Phone Number" placeholder="Phone Number" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="BOSS_CELL" name="BOSS_CELL"
                        value="{{ $client->boss_cell ?? old('boss_cell') }}"
                        label="Cell Number (Tel)" placeholder="Cell Number (Tel)" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="email" class="form-control" id="BOSS_EMAIL" name="BOSS_EMAIL"
                        value="{{ $client->boss_email ?? old('boss_email') }}"
                        label="E-mail Address" placeholder="E-mail Address" fgroup-class="col-md-4"/>
                </div>
            </fieldset>
            <fieldset>
                <legend>Accountant</legend>
                <div class="row">
                    <x-adminlte-input type="text" class="form-control" id="ACC_SURN" name="ACC_SURN"
                        value="{{ $client->acc_surn ?? old('acc_surn') }}"
                        label="Surname" placeholder="Surname" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="ACC_NAME" name="ACC_NAME"
                        value="{{ $client->acc_name ?? old('acc_name') }}"
                        label="First Name" placeholder="First Name" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="ACC_OTHNAME" name="ACC_OTHNAME"
                        value="{{ $client->acc_othname ?? old('acc_othname') }}"
                        label="Othername" placeholder="Othername" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="ACC_POST" name="ACC_POST"
                        value="{{ $client->acc_post ?? old('acc_post') }}"
                        label="Post in Organisation" placeholder="Post in Organization" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="ACC_PHONE" name="ACC_PHONE"
                        value="{{ $client->acc_phone ?? old('acc_phone') }}"
                        label="Phone Number" placeholder="Phone Number" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="text" class="form-control" id="ACC_CELL" name="ACC_CELL"
                        value="{{ $client->acc_cell ?? old('acc_cell') }}"
                        label="Cell Number (Tel)" placeholder="Cell Number (Tel)" fgroup-class="col-md-4"/>
                    <x-adminlte-input type="email" class="form-control" id="ACC_EMAIL" name="ACC_EMAIL"
                        value="{{ $client->acc_email ?? old('acc_email') }}"
                        label="E-mail Address" placeholder="E-mail Address" fgroup-class="col-md-4"/>
                </div>
            </fieldset>
            <fieldset>
                <legend>Select a Status</legend>
                <x-adminlte-select id="STATUS_CL" name="STATUS_CL" label="Select a status" placeholder="Select a status" fgroup-class="col-md-3">
                    <option value="" disabled>Select a Status</option>
                    <option {{ isset($client) && $client->status_cl == "0" ?? 'selected' }} value="0">Active (0)</option>
                    <option {{ isset($client) && $client->status_cl == "1" ?? 'selected' }} value="1">Inactive (1)</option>
                </x-adminlte-select>
            </fieldset>
            <button type="submit" class="btn btn-success">Submit</button>
        </form>
    </div>
@stop

@section('css')
    <!-- <link rel="stylesheet" href="{{ asset('vendor/adminlte/dist/css/styles.css') }}"> -->
    <style>
        fieldset {
            background-color: white;
            padding-block-start: 0.35em;
            padding-inline-start: 1.25em;
            padding-inline-end: 1.25em;
            padding-block-end: 0.625em;
            margin: 0 0 1em 0;
            border: 1px groove rgb(192, 192, 192);
            border-radius: 5px;
        }

        legend {
            background-color: #356eac;
            color: white;
            width: auto;
            font-size: medium;
            padding: 5px 10px;
            border-radius: 5px;
        }

        button{
            background-color: #14b04c;
        }

        .btn-primary{
            background-color: #356eac;
        }

        .btn-success{
            margin-bottom: 25px;
        }

        h3{
            margin-top: 1.5rem !important;
        }

    </style>

@stop

@section('js')

@stop
