@extends('admin-system.admin')

@section('content')
<div class="container-fluid px-0">
    <div class="row">
        <div class="col-sm-12">
            <div class="card border-0 bg-transparent">

                <div class="card-header border-0 bg-transparent px-0 py-0 mb_16">
                    <div class="d-flex justify-content-between align-items-center">
                        <h5 class="text-koulen text-secondary">Edit Branch</h5>
                        <a href="{{ url('adminbranch') }}" class="btn btn-secondary btn-sm">Back</a>
                    </div>
                </div>

                <div class="card-body p-3 border-0 bg-white rounded-lg">

                    <form action="{{ url('adminbranch/'.$branch->id) }}" method="POST">
                        @csrf
                        @method('PUT')

                        <div class="row">
                            <div class="col-sm-6 mb-3">
                                <label>Name EN</label>
                                <input type="text" name="name_en" class="form-control"
                                    value="{{ old('name_en', $branch->name_en) }}">
                                @error('name_en') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>

                            <div class="col-sm-6 mb-3">
                                <label>Name KM</label>
                                <input type="text" name="name_km" class="form-control"
                                    value="{{ old('name_km', $branch->name_km) }}">
                                @error('name_km') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 mb-3">
                                <label>Phone</label>
                                <input type="text" name="phone" class="form-control"
                                    value="{{ old('phone', $branch->phone) }}">
                                @error('phone') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>

                            <div class="col-sm-6 mb-3">
                                <label>Address</label>
                                <textarea name="address" class="form-control" rows="3">{{ old('address', $branch->address) }}</textarea>
                                @error('address') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 mb-3">
                                <label>Branch Prefix</label>
                                <input type="text" name="branch_prefix" class="form-control"
                                    value="{{ old('branch_prefix', $branch->branch_prefix) }}">
                                @error('branch_prefix') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>

                            <div class="col-sm-6 mb-3">
                                <label>Client Prefix</label>
                                <input type="text" name="client_prefix" class="form-control"
                                    value="{{ old('client_prefix', $branch->client_prefix) }}">
                                @error('client_prefix') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 mb-3">
                                <label>CO Prefix</label>
                                <input type="text" name="co_prefix" class="form-control"
                                    value="{{ old('co_prefix', $branch->co_prefix) }}">
                                @error('co_prefix') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>

                            <div class="col-sm-6 mb-3">
                                <label>User Prefix</label>
                                <input type="text" name="user_prefix" class="form-control"
                                    value="{{ old('user_prefix', $branch->user_prefix) }}">
                                @error('user_prefix') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 mb-3">
                                <label>Loan Prefix</label>
                                <input type="text" name="loan_prefix" class="form-control"
                                    value="{{ old('loan_prefix', $branch->loan_prefix) }}">
                                @error('loan_prefix') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>

                            <div class="col-sm-6 mb-3">
                                <label>Invoice Prefix</label>
                                <input type="text" name="invoice_prefix" class="form-control"
                                    value="{{ old('invoice_prefix', $branch->invoice_prefix) }}">
                                @error('invoice_prefix') <span class="text-danger">{{ $message }}</span> @enderror
                            </div>
                        </div>

                        <button class="btn btn-primary">Update</button>

                    </form>

                </div>

            </div>
        </div>
    </div>
</div>
@endsection
