<?php
    $record = $record ?? null;
    $selectedCategory = old('category', collect($record->categories ?? [])->filter()->first());
    $selectedPartner = old('authorised_partner_id', $record?->authorised_partner_id);
?>
<?php echo $__env->make('iqec.partials.partner-personal-fields', ['record' => $record], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<h4 class="mb-3">Official Information</h4>
<div class="row">
    <div class="col-md-6 mb-3">
        <label class="form-label">Name of Institute / Organization</label>
        <input type="text" name="institute_name" class="form-control" value="<?php echo e(old('institute_name', $record->institute_name ?? '')); ?>">
    </div>
    <?php if(auth()->user()->isSuperAdmin()): ?>
        <div class="col-md-6 mb-3">
            <label class="form-label">Authorised Partner</label>
            <select name="authorised_partner_id" class="form-control js-select2 <?php $__errorArgs = ['authorised_partner_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" data-placeholder="Search and select authorised partner">
                <option value="">Select authorised partner</option>
                <?php $__currentLoopData = $authorisedPartners; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $partner): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($partner->id); ?>" <?php if((string) $selectedPartner === (string) $partner->id): echo 'selected'; endif; ?>>
                        <?php echo e($partner->applicant_name); ?><?php if($partner->email): ?> (<?php echo e($partner->email); ?>)<?php endif; ?>
                    </option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <?php $__errorArgs = ['authorised_partner_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                <div class="invalid-feedback d-block"><?php echo e($message); ?></div>
            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
    <?php endif; ?>
    <div class="col-md-6 mb-3">
        <label class="form-label">Building No/Name</label>
        <input type="text" name="official_building" class="form-control" value="<?php echo e(old('official_building', $record->official_building ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Street</label>
        <input type="text" name="official_street" class="form-control" value="<?php echo e(old('official_street', $record->official_street ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">City</label>
        <input type="text" name="official_city" class="form-control" value="<?php echo e(old('official_city', $record->official_city ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">State</label>
        <input type="text" name="official_state" class="form-control" value="<?php echo e(old('official_state', $record->official_state ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Postal code</label>
        <input type="text" name="official_postal_code" class="form-control" value="<?php echo e(old('official_postal_code', $record->official_postal_code ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Country</label>
        <input type="text" name="official_country" class="form-control" value="<?php echo e(old('official_country', $record->official_country ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Email</label>
        <input type="email" name="official_email" class="form-control" value="<?php echo e(old('official_email', $record->official_email ?? '')); ?>" autocomplete="email" autocapitalize="none" spellcheck="false">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Phone Number with Country Code</label>
        <input type="text" name="official_phone" class="form-control" value="<?php echo e(old('official_phone', $record->official_phone ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Website</label>
        <input type="text" name="website" class="form-control" value="<?php echo e(old('website', $record->website ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Second Contact Person Name</label>
        <input type="text" name="second_contact_name" class="form-control" value="<?php echo e(old('second_contact_name', $record->second_contact_name ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Email Address</label>
        <input type="email" name="second_contact_email" class="form-control" value="<?php echo e(old('second_contact_email', $record->second_contact_email ?? '')); ?>" autocomplete="email" autocapitalize="none" spellcheck="false">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Phone Number with Country Code</label>
        <input type="text" name="second_contact_phone" class="form-control" value="<?php echo e(old('second_contact_phone', $record->second_contact_phone ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Mobile Number with Country Code</label>
        <input type="text" name="mobile" class="form-control" value="<?php echo e(old('mobile', $record->mobile ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Practical Lab (Area in sq feet)</label>
        <input type="text" name="practical_lab_area" class="form-control" value="<?php echo e(old('practical_lab_area', $record->practical_lab_area ?? '')); ?>">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Theory Class Room (Area in sq feet)</label>
        <input type="text" name="theory_classroom_area" class="form-control" value="<?php echo e(old('theory_classroom_area', $record->theory_classroom_area ?? '')); ?>">
    </div>
</div>
<h4 class="mb-3">Category</h4>
<div class="mb-3">
    <label class="form-label">Select category</label>
    <select name="category" class="form-control js-select2 <?php $__errorArgs = ['category'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" data-placeholder="Search and select category" data-tags="true">
        <option value="">Select category</option>
        <?php
            $categoryOptions = \App\Models\CoursewarePartner::CATEGORIES;
            if ($selectedCategory && ! array_key_exists($selectedCategory, $categoryOptions) && ! in_array($selectedCategory, $categoryOptions, true)) {
                $categoryOptions[$selectedCategory] = $selectedCategory;
            }
        ?>
        <?php $__currentLoopData = $categoryOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <option value="<?php echo e($key); ?>" <?php if((string) $selectedCategory === (string) $key || (string) $selectedCategory === (string) $label): echo 'selected'; endif; ?>><?php echo e($label); ?></option>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </select>
    <small class="text-muted">Search to select, or type a new category and press enter.</small>
    <?php $__errorArgs = ['category'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
        <div class="invalid-feedback d-block"><?php echo e($message); ?></div>
    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</div>
<div class="mb-3">
    <label class="form-label">Your Requirements</label>
    <textarea name="requirements" class="form-control" rows="4"><?php echo e(old('requirements', $record->requirements ?? '')); ?></textarea>
</div>
<?php /**PATH /Users/fasil/Sites/iqec/admin/resources/views/iqec/courseware-partners/_form.blade.php ENDPATH**/ ?>