@extends('layouts.admin')
@section('content')

<div class="card">
    <div class="card-header">
        {{ trans('global.create') }} {{ trans('cruds.identitasKlien.title_singular') }}
    </div>

    <div class="card-body">
        <form action="{{ route("admin.identitas-kliens.store") }}" method="POST" enctype="multipart/form-data">
            @csrf
            <div class="form-group {{ $errors->has('nama') ? 'has-error' : '' }}">
                <label for="nama">{{ trans('cruds.identitasKlien.fields.nama') }}</label>
                <input type="text" id="nama" name="nama" class="form-control" value="{{ old('nama', isset($identitasKlien) ? $identitasKlien->nama : '') }}">
                @if($errors->has('nama'))
                    <em class="invalid-feedback">
                        {{ $errors->first('nama') }}
                    </em>
                @endif
                <p class="helper-block">
                    {{ trans('cruds.identitasKlien.fields.nama_helper') }}
                </p>
            </div>
            <div class="form-group {{ $errors->has('no_register') ? 'has-error' : '' }}">
                <label for="no_register">{{ trans('cruds.identitasKlien.fields.no_register') }}</label>
                <input type="text" id="no_register" name="no_register" class="form-control" value="{{ old('no_register', isset($identitasKlien) ? $identitasKlien->no_register : '') }}">
                @if($errors->has('no_register'))
                    <em class="invalid-feedback">
                        {{ $errors->first('no_register') }}
                    </em>
                @endif
                <p class="helper-block">
                    {{ trans('cruds.identitasKlien.fields.no_register_helper') }}
                </p>
            </div>
            <div class="form-group {{ $errors->has('agama_id') ? 'has-error' : '' }}">
                <label for="agama">{{ trans('cruds.identitasKlien.fields.agama') }}</label>
                <select name="agama_id" id="agama" class="form-control select2">
                    @foreach($agamas as $id => $agama)
                        <option value="{{ $id }}" {{ (isset($identitasKlien) && $identitasKlien->agama ? $identitasKlien->agama->id : old('agama_id')) == $id ? 'selected' : '' }}>{{ $agama }}</option>
                    @endforeach
                </select>
                @if($errors->has('agama_id'))
                    <em class="invalid-feedback">
                        {{ $errors->first('agama_id') }}
                    </em>
                @endif
            </div>
            <div>
                <input class="btn btn-danger" type="submit" value="{{ trans('global.save') }}">
            </div>
        </form>
    </div>
</div>
@endsection