@extends('layouts.app_operasi')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            <div class="card">
                
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb pb-3">
                        <li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
                        @if($auth_user->roles == 'operasi')  
                        <li class="breadcrumb-item" aria-current="page"><a href="{{ route('daftar.kakitangan') }}">Kakitangan</a></li>
                        @elseif($auth_user->roles == 'admin')
                        <li class="breadcrumb-item" aria-current="page"><a href="{{ route('admin.daftar.kakitangan') }}">Kakitangan</a></li>
                        @endif
                      <li class="breadcrumb-item active" aria-current="page">Tukar Taraf</li>
                    </ol>
                </nav>

                <div class="card-body text-center">
                    @if($auth_user->roles == 'operasi')
                    <form action="{{ route('kakitangan.tukartaraf.update') }}" method="post">
                    @elseif($auth_user->roles == 'admin')
                    <form action="{{ route('admin.kakitangan.tukartaraf.update') }}" method="post">
                    @endif
                        @csrf
                        <input type="hidden" name='user_id' id='user_id' readonly value="{{ $user->id }}" class='form-control'>
                        <div class='row form-group'>
                            <div class='col-md-6'>
                                <div class='form-group row col-md-12'>
                                    <div class='col-md-5'>
                                        <b>Nama</b>
                                    </div>
                                    <div class='col-md-7'>
                                        <input type="text" name='nama' id='nama' readonly value="{{ $user->name }}" class='form-control'>
                                    </div>
                                </div>
                                <div class='form-group row col-md-12'>
                                    <div class='col-md-5'>
                                        <b>Email</b>
                                    </div>
                                    <div class='col-md-7'>
                                        <input type="text" name='email' id='email' readonly value="{{ $user->email }}" class='form-control'>
                                    </div>
                                </div>
                            </div>
                            <div class='col-md-6'>
                                <div class='form-group row col-md-12'>
                                    <div class='col-md-5'>
                                        <b>No KP</b>
                                    </div>
                                    <div class='col-md-7'>
                                        <input type="text" name='nokp' id='nokp' readonly value="{{ $user->no_kp }}" class='form-control'>
                                    </div>
                                </div>
                                <div class='form-group row col-md-12'>
                                    <div class='col-md-5'>
                                        <b>No Telefon</b>
                                    </div>
                                    <div class='col-md-7'>
                                        <input type="text" name='telefon' id='telefon' readonly value="{{ $user->no_telefon }}" class='form-control'>
                                    </div>
                                </div>
                                <div class='form-group row col-md-12'>
                                    <div class='col-md-5'>
                                        <b>Jawatan</b>
                                    </div>

                                    <div class='col-md-7'>
                                        <select class="form-control" name="role" data-placeholder="Pilih Jawatan" id="role">
                                            <option disabled selected> -- Pilih Jawatan -- </option>
                                            @foreach($role as $roles)    
                                                <option value="{{ $roles['role_code'] }}" {{ $user->roles == $roles['role_code'] ? 'selected' : '' }}>{{ $roles['keterangan'] }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class='row justify-content-end'>
                            <div class='col-md-12'>
                                <input type="submit" class='btn btn-info float-right mr-5' value='Tukar Taraf'>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
