<div class="grid grid-cols-1 gap-4 sm:gap-5 lg:gap-6">
    <form wire:submit.prevent="submitEditForm">
        @csrf
        <input type="hidden" name="id" value="{{ $company->id }}">

        <div class="card pb-4">
            <div class="my-3 flex h-8 items-center justify-between px-4 sm:px-5">
                <h2 class="font-medium tracking-wide text-slate-700 line-clamp-1 dark:text-navy-100 lg:text-base">
                    <i aria-hidden="true" class="fa-solid fa-edit text-primary"></i> Edit
                </h2>

            </div>

            <div class="w-3/4 px-3 space-y-3 m-auto mb-4">
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Comapny Type</span>
                    </label>
                    <span class="relative flex w-full">
                        <select name="companyType" wire:model.defer="company.company_type_id"
                            class="form-select mt-1.5  w-2/4 rounded-lg border border-slate-300 bg-white px-3 py-2 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent">
                            @foreach ($companyTypes as $type)
                                <option value="{{ $type->id }}" {!! $type->id == $company->company_type_id ? 'selected' : '' !!}>{{ $type->name }}
                                </option>
                            @endforeach
                        </select>
                        @error('company.companyType')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>

                <div class="flex items-center">

                    <label class="w-2/12 mr-2">
                        <span>Tax No.:</span>
                    </label>
                    <span class="relative flex w-full">
                        <input wire:model.defer="company.tax"
                            class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs placeholder-text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" />
                        @error('company.tax')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>

                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Branch:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.branch"
                            class="form-input w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" name="branch" type="text" value="{{ $company->branch }}" />
                        @error('company.branch')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>

                </div>

                <div class="flex items-center">

                    <label class="w-2/12 mr-2">
                        <span>Thai name:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.name"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" name="name" type="text" value="{{ $company->name }}" />
                        @error('company.name')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>English name:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.name_en"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" name="name_en" type="text" value="{{ $company->name_en }}" />
                        @error('company.name_en')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Address:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <textarea wire:model.defer="company.address"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            cols="30" rows="5">
                        </textarea>
                        @error('company.address')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>District:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.district"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="district" value="{{ $company->district }}" />
                        @error('company.district')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Sub province:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.sub_province"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="sub_province" value="{{ $company->sub_province }}" />
                        @error('company.sub_province')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Province:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.province"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="province" value="{{ $company->province }}" />
                        @error('company.province')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Postcode:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.postcode"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="postcode" value="{{ $company->postcode }}" />
                        @error('company.postcode')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Phone:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.phone"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="phone" value="{{ $company->phone }}" />
                        @error('company.phone')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Fax:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.fax"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="fax" value="{{ $company->fax }}" />
                        @error('company.fax')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>
                <div class="flex items-center">
                    <label class="w-2/12 mr-2">
                        <span>Tax Incentive ID:</span>
                    </label>
                    <span class="relative flex  w-full">
                        <input wire:model.defer="company.tax_incentive"
                            class="form-input peer w-2/4 rounded-lg border border-slate-300 bg-transparent px-3 py-2 text-xs pl-4 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
                            placeholder="" type="text" name="tax_incentive"
                            value="{{ $company->tax_incentive }}" />
                        @error('company.tax_incentive')
                            <div class="ml-3 text-red-500 text-sm self-center">
                                {{ $message }}</div>
                        @enderror
                    </span>
                </div>

                <div class="grid grid-cols-8 justify-center space-x-2 pt-4">
                    <span wire:click="goBack"
                        class="col-start-3 btn  border border-slate-300 font-medium text-slate-800 hover:bg-slate-150 focus:bg-slate-150 active:bg-slate-150/80 dark:border-navy-450 dark:text-navy-50 dark:hover:bg-navy-500 dark:focus:bg-navy-500 dark:active:bg-navy-500/90">
                        Cancel
                    </span>
                    <button type="submit"
                        class="btn ml-3 bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
                        Save
                    </button>
                </div>
            </div>
        </div>
    </form>
</div>
