@extends('layouts.admin')
@section('styles')
    <link rel="stylesheet" href="{{ asset('assets/admin/css/vendors/select2.css') }}">
@endsection
@section('app')
    <div class="container-fluid">
        <div class="list-product-header">
            <div>
                <a class="btn btn-dark" href="{{ route('finance.payrolls') }}">Kembali</a>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <form class="row g-3 custom-input" action="{{ route('finance.payroll.update', encryptId($payroll->id)) }}"
                    method="post">
                    @csrf
                    @method('put')
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="employee">Pegawai
                        </label>
                        <input name="employee" class="form-control @error('employee') is-invalid @enderror" id="employee"
                            type="text" placeholder="Masukan Keterangan"
                            value="{{ old('employee', $payroll->employee->biography->full_name) }}" readonly>
                        @error('employee')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="amount">Jumlah</label>
                        <input name="amount" class="form-control rupiah-format @error('amount') is-invalid @enderror"
                            id="amount" type="text" placeholder="Masukan Jumlah"
                            value="{{ old('amount', formatToRupiah($payroll->amount)) }}" inputmode="numeric" readonly>
                        @error('amount')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="incentive">Insentif / Bonus</label>
                        <input name="incentive" class="form-control rupiah-format @error('incentive') is-invalid @enderror"
                            id="incentive" type="text" placeholder="Masukan Insentif"
                            value="{{ old('incentive', formatToRupiah($payroll->incentive)) }}" inputmode="numeric">
                        @error('incentive')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="cut">Potongan</label>
                        <input name="cut" class="form-control rupiah-format @error('cut') is-invalid @enderror"
                            id="cut" type="text" placeholder="Masukan Potongan"
                            value="{{ old('cut', formatToRupiah($payroll->cut)) }}" inputmode="numeric">
                        @error('cut')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="shaving_result">Hasil Mencukur</label>
                        <input name="shaving_result" class="form-control @error('shabing_result') is-invalid @enderror"
                            id="shaving_result" type="text" placeholder="Silakan Pilih Pegawai"
                            value="{{ old('shaving_result', formatToRupiah($payroll->shaving_result)) }}" readonly>
                        @error('shaving_result')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="percentage_shaving">Persentase Mencukur</label>
                        <div class="input-group">
                            <button class="btn btn-outline-dark" id="button-addon1" type="button">%</button>
                            <input name="percentage_shaving"
                                class="form-control @error('percentage_shaving') is-invalid @enderror" type="number"
                                placeholder="Masukan Persentase Mencukur" id="percentage_shaving"
                                value="{{ old('percentage_shaving', $payroll->percentage_shaving) }}" readonly>
                        </div>
                        @error('percentage_shaving')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="total">Total</label>
                        <input name="total" class="form-control rupiah-format @error('total') is-invalid @enderror"
                            id="total" type="text" placeholder="Masukan Total"
                            value="{{ old('total', formatToRupiah($payroll->total)) }}" inputmode="numeric">
                        @error('total')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-lg-6 position-relative">
                        <label class="form-label" for="description">Keterangan</label>
                        <input name="description" class="form-control @error('description') is-invalid @enderror"
                            id="description" type="text" placeholder="Masukan Keterangan"
                            value="{{ old('description', $payroll->description) }}">
                        @error('description')
                            <div class="invalid-feedback">
                                {{ $message }}
                            </div>
                        @enderror
                    </div>
                    <div class="col-12">
                        <button class="btn btn-primary button-disable" type="submit">Simpan</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
@section('afterScripts')
    <script src="{{ asset('assets/js/forms/button-disable.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/js/forms/rupiah-format.js?ver=1.0.0') }}"></script>
    <script src="{{ asset('assets/admin/js/select2/select2.js') }}"></script>
    <script src="{{ asset('assets/admin/js/select2/select2-config.js?ver=1.0.0') }}"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="{{ asset('assets/admin/js/custom/payroll.js?ver=1.0.0') }}"></script>
@endsection
