@php use App\Models\Contract; @endphp

<div>
    <fieldset>
        <legend>Fill the following fields to create a new User</legend>
        <div class="row">
            <x-adminlte-select name="contract_id" label="Select a Contract" placeholder="Select a contract"
                               fgroup-class="col-md-6" id="contract-select" readonly="true">
                <option value="">Select a Contract</option>
                <option selected value="{{ $contract->rid ?? '' }}">
                    {{ $contract->client->name_fl ?? '' }}
                </option>
            </x-adminlte-select>

            <x-adminlte-input name="name" label="Name" placeholder="Full Name"
                              value="{{ $user->name ?? old('name') }}"
                              fgroup-class="col-md-6"/>

            <x-adminlte-input name="email" label="Email" placeholder="E-mail Address"
                              value="{{ $user->email ?? old('email') }}"
                              fgroup-class="col-md-6"/>

            {{--<x-adminlte-input type="password" name="password" label="Password" placeholder="Password"
                              fgroup-class="col-md-6"/>--}}

            <x-adminlte-select id="status" name="status" label="Select a status"
                               placeholder="Select a status" fgroup-class="col-md-6">
                <option value="">Select a Status</option>
                <option @selected(isset($user) && $user->status_l == "1") value="1">Active (1)</option>
                <option @selected(isset($user) && $user->status_l == "0") value="0">Inactive (0)</option>
            </x-adminlte-select>

            <div class="form-check">
                <label>Role(s)</label>
                @foreach($roles as $role)
                    <div class="icheck-primary" 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
            </div>

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

<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;
    }

    .form-check{
        padding-left: 2.25rem;
    }

    .content-header .breadcrumb{
        padding-left: 10px;
    }

    .select2-container .select2-selection--single{
            height: unset;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow{
            height: 38px;
    }
</style>


