@extends('layouts.admin')
@section('content')

<div class="card">
    <div class="card-header">
        {{ trans('global.edit') }} {{ trans('cruds.contactContact.title_singular') }}
    </div>

    <div class="card-body">
        <form method="POST" action="{{ route("admin.contact-contacts.update", [$contactContact->id]) }}" enctype="multipart/form-data">
            @method('PUT')
            @csrf
            <div class="form-group">
                <label class="required" for="company_id">{{ trans('cruds.contactContact.fields.company') }}</label>
                <select class="form-control select2 {{ $errors->has('company') ? 'is-invalid' : '' }}" name="company_id" id="company_id" required>
                    @foreach($companies as $id => $entry)
                        <option value="{{ $id }}" {{ (old('company_id') ? old('company_id') : $contactContact->company->id ?? '') == $id ? 'selected' : '' }}>{{ $entry }}</option>
                    @endforeach
                </select>
                @if($errors->has('company'))
                    <div class="invalid-feedback">
                        {{ $errors->first('company') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.company_helper') }}</span>
            </div>
            <div class="form-group">
                <label class="required" for="location">{{ trans('cruds.contactContact.fields.location') }}</label>
                <input class="form-control {{ $errors->has('location') ? 'is-invalid' : '' }}" type="text" name="location" id="location" value="{{ old('location', $contactContact->location) }}" required>
                @if($errors->has('location'))
                    <div class="invalid-feedback">
                        {{ $errors->first('location') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.location_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="unit_name">{{ trans('cruds.contactContact.fields.unit_name') }}</label>
                <input class="form-control {{ $errors->has('unit_name') ? 'is-invalid' : '' }}" type="text" name="unit_name" id="unit_name" value="{{ old('unit_name', $contactContact->unit_name) }}">
                @if($errors->has('unit_name'))
                    <div class="invalid-feedback">
                        {{ $errors->first('unit_name') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.unit_name_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="contact_first_name">{{ trans('cruds.contactContact.fields.contact_first_name') }}</label>
                <input class="form-control {{ $errors->has('contact_first_name') ? 'is-invalid' : '' }}" type="text" name="contact_first_name" id="contact_first_name" value="{{ old('contact_first_name', $contactContact->contact_first_name) }}">
                @if($errors->has('contact_first_name'))
                    <div class="invalid-feedback">
                        {{ $errors->first('contact_first_name') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.contact_first_name_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="contact_last_name">{{ trans('cruds.contactContact.fields.contact_last_name') }}</label>
                <input class="form-control {{ $errors->has('contact_last_name') ? 'is-invalid' : '' }}" type="text" name="contact_last_name" id="contact_last_name" value="{{ old('contact_last_name', $contactContact->contact_last_name) }}">
                @if($errors->has('contact_last_name'))
                    <div class="invalid-feedback">
                        {{ $errors->first('contact_last_name') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.contact_last_name_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="contact_phone_1">{{ trans('cruds.contactContact.fields.contact_phone_1') }}</label>
                <input class="form-control {{ $errors->has('contact_phone_1') ? 'is-invalid' : '' }}" type="text" name="contact_phone_1" id="contact_phone_1" value="{{ old('contact_phone_1', $contactContact->contact_phone_1) }}">
                @if($errors->has('contact_phone_1'))
                    <div class="invalid-feedback">
                        {{ $errors->first('contact_phone_1') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.contact_phone_1_helper') }}</span>
            </div>
            <div class="form-group">
                <label class="required" for="contact_phone_2">{{ trans('cruds.contactContact.fields.contact_phone_2') }}</label>
                <input class="form-control {{ $errors->has('contact_phone_2') ? 'is-invalid' : '' }}" type="text" name="contact_phone_2" id="contact_phone_2" value="{{ old('contact_phone_2', $contactContact->contact_phone_2) }}" required>
                @if($errors->has('contact_phone_2'))
                    <div class="invalid-feedback">
                        {{ $errors->first('contact_phone_2') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.contact_phone_2_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="contact_email">{{ trans('cruds.contactContact.fields.contact_email') }}</label>
                <input class="form-control {{ $errors->has('contact_email') ? 'is-invalid' : '' }}" type="text" name="contact_email" id="contact_email" value="{{ old('contact_email', $contactContact->contact_email) }}">
                @if($errors->has('contact_email'))
                    <div class="invalid-feedback">
                        {{ $errors->first('contact_email') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.contact_email_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="district">{{ trans('cruds.contactContact.fields.district') }}</label>
                <input class="form-control {{ $errors->has('district') ? 'is-invalid' : '' }}" type="text" name="district" id="district" value="{{ old('district', $contactContact->district) }}">
                @if($errors->has('district'))
                    <div class="invalid-feedback">
                        {{ $errors->first('district') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.district_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="pincode">{{ trans('cruds.contactContact.fields.pincode') }}</label>
                <input class="form-control {{ $errors->has('pincode') ? 'is-invalid' : '' }}" type="text" name="pincode" id="pincode" value="{{ old('pincode', $contactContact->pincode) }}">
                @if($errors->has('pincode'))
                    <div class="invalid-feedback">
                        {{ $errors->first('pincode') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.pincode_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="pan_number">{{ trans('cruds.contactContact.fields.pan_number') }}</label>
                <input class="form-control {{ $errors->has('pan_number') ? 'is-invalid' : '' }}" type="text" name="pan_number" id="pan_number" value="{{ old('pan_number', $contactContact->pan_number) }}">
                @if($errors->has('pan_number'))
                    <div class="invalid-feedback">
                        {{ $errors->first('pan_number') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.pan_number_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="gstn_number">{{ trans('cruds.contactContact.fields.gstn_number') }}</label>
                <input class="form-control {{ $errors->has('gstn_number') ? 'is-invalid' : '' }}" type="text" name="gstn_number" id="gstn_number" value="{{ old('gstn_number', $contactContact->gstn_number) }}">
                @if($errors->has('gstn_number'))
                    <div class="invalid-feedback">
                        {{ $errors->first('gstn_number') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.gstn_number_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="department">{{ trans('cruds.contactContact.fields.department') }}</label>
                <input class="form-control {{ $errors->has('department') ? 'is-invalid' : '' }}" type="text" name="department" id="department" value="{{ old('department', $contactContact->department) }}">
                @if($errors->has('department'))
                    <div class="invalid-feedback">
                        {{ $errors->first('department') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.department_helper') }}</span>
            </div>
            <div class="form-group">
                <label for="contact_address">{{ trans('cruds.contactContact.fields.contact_address') }}</label>
                <input class="form-control {{ $errors->has('contact_address') ? 'is-invalid' : '' }}" type="text" name="contact_address" id="contact_address" value="{{ old('contact_address', $contactContact->contact_address) }}">
                @if($errors->has('contact_address'))
                    <div class="invalid-feedback">
                        {{ $errors->first('contact_address') }}
                    </div>
                @endif
                <span class="help-block">{{ trans('cruds.contactContact.fields.contact_address_helper') }}</span>
            </div>
            <div class="row">
                <div class="col-md-6 form-group">
                    <label for="amc_engineer">{{ trans('cruds.contactContact.fields.amc_engineer') }}</label>
                    <select class="form-control select2 {{ $errors->has('amc_engineer') ? 'is-invalid' : '' }}" name="amc_engineer" id="amc_engineer">
                        @foreach($amc_engineer as $id => $entry)
                            <option value="{{ $id }}" {{ (old('day') ? old('day') : $id ?? '') == $contactContact->amc_engineer ? 'selected' : '' }}>{{ $entry }}</option>

                        @endforeach
                    </select>
                    @if($errors->has('amc_engineer'))
                        <div class="invalid-feedback">
                            {{ $errors->first('amc_engineer') }}
                        </div>
                    @endif
                    <span class="help-block">{{ trans('cruds.contactContact.fields.amc_engineer_helper') }}</span>
                </div>
                <div class="col-md-6 form-group">
                    <label for="day">{{ trans('cruds.contactContact.fields.day') }}</label>
                    <select class="form-control select2 {{ $errors->has('day') ? 'is-invalid' : '' }}" name="day" id="day">
                        @foreach($day as $id => $entry)

                            <option value="{{ $id }}" {{ (old('day') ? old('day') : $id ?? '') == ($contactContact->day - 1) ? 'selected' : '' }}>{{ $entry }}</option>

                        @endforeach
                    </select>
                    @if($errors->has('day'))
                        <div class="invalid-feedback">
                            {{ $errors->first('day') }}
                        </div>
                    @endif
                </div>
                </div>
            <div class="form-group">
                <button class="btn btn-danger" type="submit">
                    {{ trans('global.save') }}
                </button>
            </div>
        </form>
    </div>
</div>



@endsection
