@extends('layouts.admin')
@section('styles')
@endsection
@section('app')
    <div class="container-fluid">
        <div class="card">
            <div class="card-body">
                <form class="row g-3 custom-input"
                    action="{{ route('setting.application.update', encryptId($application->id)) }}" method="post"
                    enctype="multipart/form-data">
                    @csrf
                    @method('put')
                    <div class="col-lg-12 position-relative">
                        <label class="form-label" for="name">Nama</label>
                        <input name="name" class="form-control @error('name') is-invalid @enderror" id="name"
                            type="text" placeholder="Masukan Nama" value="{{ old('name', $application->name) }}">
                        @error('name')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="email">Email</label>
                        <input name="email" class="form-control @error('email') is-invalid @enderror" id="email"
                            type="text" placeholder="Masukan Email" value="{{ old('email', $application->email) }}">
                        @error('email')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="contact_number">Kontak
                            <span class="form-span"><i>(format : 08xxxxxxxx)</i></span>
                        </label>
                        <input name="contact_number" class="form-control @error('contact_number') is-invalid @enderror"
                            id="contact_number" type="number" placeholder="Masukan Kontak"
                            value="{{ old('contact_number', $application->contact_number) }}">
                        @error('contact_number')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-12 position-relative">
                        <label class="form-label" for="description">Deskripsi</label>
                        <textarea name="description" class="form-control @error('description') is-invalid @enderror" id="description"
                            rows="3" placeholder="Masukan Deskripsi">{{ old('description', $application->description) }}</textarea>
                        @error('description')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    @if (in_array(auth()->user()->role_id, [1, 3]))
                        <div class="col-12">
                            <button class="btn btn-primary button-disable" type="submit">Simpan</button>
                        </div>
                    @endif
                </form>
            </div>
        </div>
    </div>
@endsection
@section('afterScripts')
    <script src="{{ asset('assets/js/forms/button-disable.js?ver=1.0.0') }}"></script>
@endsection
