{{-- EXTENDS TEMPLATE --}}
@extends('layouts.app')

{{-- TITLE --}}
@section('title', __('lang.edit_data', ['data' => __('lang.application')]))

{{-- ADDITIONAL STYLE --}}
@push('addons-style')

@endpush

{{-- ADDITIONAL SCRIPT --}}
@push('addons-script')
<script src="{{ url('/') }}/assets/vendor/parsley/parsley.min.js"></script>
@endpush

{{-- CUSTOM STYLESHEET --}}
@push('custom-style')

@endpush

{{-- CUSTOM SCRIPT --}}
@push('custom-script')
<script>
    $(() => {
        $(".btn-save").on('click', function(e) {
            e.preventDefault();

            $("#formPengajuanPermohonan").parsley().validate();

            if ($("#formPengajuanPermohonan").parsley().isValid()) {
                $("#formPengajuanPermohonan").trigger('submit');
            }
        });
    });
</script>
@endpush

{{-- CONTENT --}}
@section('content')
<section role="main" class="content-body">
    <x-page-layout :breadcrumbs="$bc"></x-page-layout>
    <div class="row">
        <div class="col-md-12">
            <section class="card card-featured card-featured-primary mb-4">
                <div class="card-body">
                    <x-forms.form method="POST" action="{{ $method }}" id="formPengajuanPermohonan" onsubmit="btnLoading('{!! __('messages.saving_state') !!}')" autocomplete="off" enctype="multipart/form-data" data-parsley-validate="">
                    <h2 class="content-heading pt-0 mb-0 mt-0">@lang('lang.biodata_pemohon')</h2>
                    <div class="table-responsive">
                        @csrf
                        <table class="table table-hover mb-2" style="width:100%">
                            <colgroup>
                                <col width="20%">
                                <col width="2%">
                                <col width="78%">
                                <col width="100px">
                            </colgroup>
                            <tbody>
                                <tr>
                                    <td class="text-right">Nama</td>
                                    <td class="text-right">:</td>
                                    <td class="text-left">{{ $Anggota->name }}</td>
                                <tr>
                                    <td class="text-right">Alamat</td>
                                    <td class="text-right">:</td>
                                    <td class="text-left">{{ $Anggota->address }}</td>
                                </tr>
                                <tr>
                                    <td class="text-right">Handphone</td>
                                    <td class="text-right">:</td>
                                    <td class="text-left">{{ $Anggota->phone }}</td>
                                </tr>
                                <tr>
                                    <td class="text-right">Email</td>
                                    <td class="text-right">:</td>
                                    <td class="text-left">{{ $Anggota->email }}</td>
                                </tr>
                                <tr>
                                    <td class="text-right">Pekerjaan</td>
                                    <td class="text-right">:</td>
                                    <td class="text-left">{{ $Anggota->pekerjaan }}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <h2 class="content-heading pt-0 mb-0">@lang('lang.application')</h2>
                    <x-forms.form-help :mode="$updateMode" />
                    <div class="form-group">
                        <x-forms.label for="jenis_permohonan" :value="__('lang.jenis_permohonan')" /><span class="asterisk">*</span>
                        <x-forms.select name="jenis_permohonan" id="jenis_permohonan" required>
                            <option value="" selected>{{ __('messages.select_data', ['data' => __('lang.jenis_permohonan'),]) }}</option>
                            <option value="{{ encryptString('1') }}" {{ ($Permohonan->jenis_form_layanan_id == '1')?"selected":"" }}>@lang('lang.permohonan_info')</option>
                            <option value="{{ encryptString('2') }}" {{ ($Permohonan->jenis_form_layanan_id == '2')?"selected":"" }}>@lang('lang.keberatan_info')</option>
                        </x-forms.select>
                    </div>
                    <div class="form-group mt-0 mb-0">
                        <x-forms.label id="dokumen_permohonan" for="dokumen_permohonan" :value="__('lang.document_data', ['data' => __('lang.application')])" />
                        <x-forms.input-file name="dokumen_permohonan" id="dokumen_permohonan" accept=".pdf"/>
                        <small>@lang('messages.alert_file_pdf')</small>
                    </div>
                    <div class="form-group mt-0 mb-0">
                        <x-forms.label for="institusi" :value="__('lang.institusi')" />
                        <input id="institusi" type="text" class="form-control" name="institusi" placeholder="@lang('lang.place_data', ['data' => __('lang.institusi')])" value="{{ ($Permohonan->nama_institusi !== NULL)?$Permohonan->nama_institusi:"" }}"/>
                    </div>
                    <div class="form-group">
                        <x-forms.label for="ket_permohonan_info" :value="__('lang.ket_permohonan_info')" /><span class="asterisk">*</span>
                        <textarea class="form-control" id="ket_permohonan_info" name="ket_permohonan_info" rows="3" placeholder="{{__('lang.place_data', ['data' => __('lang.ket_permohonan_info')]) }}" required>{{ ($Permohonan->isi_permintaan_informasi !== NULL)?$Permohonan->isi_permintaan_informasi:"" }}</textarea>
                    </div>
                    <div class="form-group mt-2">
                        <a href="{{ URL::previous() }}" class="btn btn-hero btn-secondary">{{ __('lang.back') }}</a>
                        <button class="btn btn-hero btn-primary btn-loading btn-save">{{ __('lang.updated') }}</button>
                    </div>
                </x-forms.form>
                </div>
            </section>
        </div>
    </div>
</section>
@endsection
