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

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

    <div class="card-body">
        <form action="{{ route("admin.referensipkapks.update", [$referensipkapk->id]) }}" method="POST" enctype="multipart/form-data">
            @csrf
            @method('PUT')
            <div class="form-group {{ $errors->has('nama') ? 'has-error' : '' }}">
                <label for="nama">{{ trans('cruds.referensipkapk.fields.nama') }}</label>
                <input type="text" id="nama" name="nama" class="form-control" value="{{ old('nama', isset($referensipkapk) ? $referensipkapk->nama : '') }}">
                @if($errors->has('nama'))
                    <em class="invalid-feedback">
                        {{ $errors->first('nama') }}
                    </em>
                @endif
                <p class="helper-block">
                    {{ trans('cruds.referensipkapk.fields.nama_helper') }}
                </p>
            </div>
            <div class="form-group {{ $errors->has('nip') ? 'has-error' : '' }}">
                <label for="nip">{{ trans('cruds.referensipkapk.fields.nip') }}</label>
                <input type="text" id="nip" name="nip" class="form-control" value="{{ old('nip', isset($referensipkapk) ? $referensipkapk->nip : '') }}">
                @if($errors->has('nip'))
                    <em class="invalid-feedback">
                        {{ $errors->first('nip') }}
                    </em>
                @endif
                <p class="helper-block">
                    {{ trans('cruds.referensipkapk.fields.nip_helper') }}
                </p>
            </div>
            <div class="form-group {{ $errors->has('jabatan') ? 'has-error' : '' }}">
                <label for="jabatan">{{ trans('cruds.referensipkapk.fields.jabatan') }}</label>
                <input type="text" id="jabatan" name="jabatan" class="form-control" value="{{ old('jabatan', isset($referensipkapk) ? $referensipkapk->jabatan : '') }}">
                @if($errors->has('jabatan'))
                    <em class="invalid-feedback">
                        {{ $errors->first('jabatan') }}
                    </em>
                @endif
                <p class="helper-block">
                    {{ trans('cruds.referensipkapk.fields.jabatan_helper') }}
                </p>
            </div>
            <div class="form-group {{ $errors->has('pangkat_gol_id') ? 'has-error' : '' }}">
                <label for="pangkat_gol">{{ trans('cruds.referensipkapk.fields.pangkat_gol') }}</label>
                <select name="pangkat_gol_id" id="pangkat_gol" class="form-control select2">
                    @foreach($pangkat_gols as $id => $pangkat_gol)
                        <option value="{{ $id }}" {{ (isset($referensipkapk) && $referensipkapk->pangkat_gol ? $referensipkapk->pangkat_gol->id : old('pangkat_gol_id')) == $id ? 'selected' : '' }}>{{ $pangkat_gol }}</option>
                    @endforeach
                </select>
                @if($errors->has('pangkat_gol_id'))
                    <em class="invalid-feedback">
                        {{ $errors->first('pangkat_gol_id') }}
                    </em>
                @endif
            </div>
            <div>
                <input class="btn btn-danger" type="submit" value="{{ trans('global.save') }}">
            </div>
        </form>
    </div>
</div>
@endsection