<div class="content-wrapper">
    <div class="container-xxl flex-grow-1 container-p-y">
        <div class="row">
            <input type="hidden" class="form-control" id="villageId" value="<?php echo e($villageId); ?>">
            <div class="col-xl-12 col-lg-12 col-md-12">
                <!-- About User -->
                <div class="card">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12 d-flex justify-content-end">
                                <button class="btn btn-primary btn-sm" data-bs-toggle="modal"
                                    data-bs-target="#villageDetailsModal"><i class="ti ti-edit"></i> Update Village
                                    Details</button>
                            </div>



                            <div class="col-6">
                                <small class="card-text text-uppercase text-muted small">Village Details</small>
                                <ul class="list-unstyled my-3 py-1">

                                    <li class="d-flex align-items-center mb-4">
                                        <i class="ti ti-user ti-lg"></i><span class="fw-medium mx-2">Village Name :</span>
                                        <span>
                                          <?php echo e($getVillageData->villageName); ?>

                                        </span>
                                    </li>


                                    <li class="d-flex align-items-center mb-4">
                                        <i class="ti ti-user ti-lg"></i><span class="fw-medium mx-2">Village Leader:</span>
                                        <span>
                                            <?php if($getVillageFinalData != null): ?>
                                                <?php $__currentLoopData = $getAllMemberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($get->id == $getVillageFinalData->villageLeader): ?>
                                                        <?php echo e($get->firstName); ?>  <?php echo e($get->lastName); ?>

                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                                <?php echo e('-'); ?>

                                            <?php endif; ?>
                                        </span>
                                    </li>
                                    <li class="d-flex align-items-center mb-4">
                                        <i class="ti ti-user ti-lg"></i><span class="fw-medium mx-2">Secretary :</span>
                                        <span>
                                            <?php if($getVillageFinalData != null): ?>
                                                <?php $__currentLoopData = $getAllMemberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($get->id == $getVillageFinalData->secretary): ?>
                                                    <?php echo e($get->firstName); ?>  <?php echo e($get->lastName); ?>

                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                                <?php echo e('-'); ?>

                                            <?php endif; ?>
                                        </span>
                                    </li>
                                    <li class="d-flex align-items-center mb-4">
                                        <i class="ti ti-user ti-lg"></i>
                                        <span class="fw-medium mx-2">Staff:</span>
                                        <span>
                                            <?php if($getVillageFinalData != null): ?>
                                                <?php
                                                    $staffArray = json_decode($getVillageFinalData->staff, true);
                                                ?>
                                                <?php if(is_array($staffArray) && count($staffArray) > 0): ?>
                                                    <?php
                                                        $staffNames = [];
                                                    ?>
                                                    <?php $__currentLoopData = $getAllMemberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php if(in_array($get->id, $staffArray)): ?>
                                                            <?php
                                                                $staffNames[] = $get->firstName;
                                                            ?>
                                                        <?php endif; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php echo e(implode(', ', $staffNames)); ?>

                                                <?php else: ?>
                                                    <?php echo e('-'); ?>

                                                <?php endif; ?>
                                            <?php else: ?>
                                                <?php echo e('-'); ?>

                                            <?php endif; ?>
                                        </span>
                                    </li>



                                    <li class="d-flex align-items-center mb-4">
                                        <i class="ti ti-user ti-lg"></i><span class="fw-medium mx-2">FO Name:</span>
                                        <span>
                                            <?php if($getVillageFinalData != null): ?>
                                                <?php $__currentLoopData = $getUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($get->id == $getVillageFinalData->foName): ?>
                                                        <?php echo e($get->name); ?>

                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                                <?php echo e('-'); ?>

                                            <?php endif; ?>
                                        </span>
                                    </li>

                                </ul>
                            </div>
                            <div class="col-6">
                                <small class="card-text text-uppercase text-muted small">Contacts</small>
                                <ul class="list-unstyled my-3 py-1">
                                    <li class="d-flex align-items-center mb-4">
                                        <i class="ti ti-phone-call ti-lg"></i><span class="fw-medium mx-2">Phone
                                            Number:</span>
                                        <span>
                                            <?php if($getVillageFinalData != null): ?>
                                                <?php echo e($getVillageFinalData->phone); ?>

                                            <?php else: ?>
                                                <?php echo e('-'); ?>

                                            <?php endif; ?>
                                        </span>
                                    </li>
                                </ul>
                            </div>
                        </div>

                    </div>
                </div>
                <!--/ About User -->
            </div>
            <div class="col-xl-12 mt-3 col-lg-12 col-md-12">
                <div class="card shadow">
                    <div class="card-body">
                        <table class="table table-sm datatableView">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Member Name</th>
                                    <th>Address</th>
                                    <th>NIC</th>
                                    <th>Phone Number</th>
                                    <th>New Account Number</th>
                                    <th>Old Account Number</th>
                                    <th>Profession</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                    $count = 1;
                                ?>
                                <?php $__currentLoopData = $memberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $member): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($count++); ?></td>
                                        <?php
                                            $encryptedId = encrypt($member->id);
                                        ?>
                                        <td><a href="<?php echo e(route('view_member', $encryptedId)); ?>"><?php echo e($member->firstName); ?> </a></td>
                                        <td><?php echo e($member->address); ?></td>
                                        <td><?php echo e($member->nicNumber); ?></td>
                                        <td><?php echo e($member->phoneNumber); ?></td>
                                        <td><?php echo e($member->newAccountNumber); ?></td>
                                        <td><?php echo e($member->oldAccountNumber); ?></td>
                                        <td><?php echo e($member->profession); ?></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<!--/ Division Details Modal -->
<div class="modal fade" id="villageDetailsModal" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg modal-simple">
        <div class="modal-content">
            <div class="modal-body">
                <button type="button" class="btn-close btn-pinned" data-bs-dismiss="modal" aria-label="Close"></button>
                <div class="text-center mb-6">
                    <h4 class="mb-2">Update Village</h4>
                    <p>Update the village details</p>
                </div>
                <div class="row">
                    <div class="col-6 mb-4">
                        <label class="form-label" for="modalProfessionName">Village Leader</label> <span
                            class=" text-danger">*</span>
                        <select class="selectize" id="txtVillageLeader">
                            <option value="">---Select---</option>
                            <?php $__currentLoopData = $memberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($getVillageFinalData != null): ?>
                                    <?php if($getVillageFinalData->villageLeader == $user->id): ?>
                                        <option value="<?php echo e($user->id); ?>" selected><?php echo e($user->firstName); ?></option>
                                    <?php else: ?>
                                        <option value="<?php echo e($user->id); ?>"><?php echo e($user->firstName); ?></option>
                                    <?php endif; ?>
                                <?php else: ?>
                                    <option value="<?php echo e($user->id); ?>"><?php echo e($user->firstName); ?></option>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <div class="col-6 mb-4">
                        <label class="form-label" for="modalProfessionName">Secretary</label> <span
                            class=" text-danger">*</span>
                        <select class="selectize" id="txtSecretary">
                            <option value="">---Select---</option>
                            <?php $__currentLoopData = $memberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($getVillageFinalData != null): ?>
                                    <?php if($getVillageFinalData->secretary == $user->id): ?>
                                        <option value="<?php echo e($user->id); ?>" selected><?php echo e($user->firstName); ?></option>
                                    <?php else: ?>
                                        <option value="<?php echo e($user->id); ?>"><?php echo e($user->firstName); ?></option>
                                    <?php endif; ?>
                                <?php else: ?>
                                    <option value="<?php echo e($user->id); ?>"><?php echo e($user->firstName); ?></option>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <div class="col-6 mb-4">
                        <label class="form-label" for="modalProfessionName">Staff</label>
                        <span class="text-danger">*</span>
                        <select class="selectize" id="txtStaff" multiple>
                            <option value="">---Select---</option>
                            <?php
                                $selectStaff = $getVillageFinalData
                                    ? json_decode($getVillageFinalData->staff, true)
                                    : [];
                            ?>
                            <?php $__currentLoopData = $memberData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($user->id); ?>"
                                        <?php if(is_array($selectStaff) && in_array($user->id, $selectStaff)): ?> selected <?php endif; ?>>
                                        <?php echo e($user->firstName); ?>

                                    </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>

                    <div class="col-6 mb-4">
                        <label class="form-label" for="modalProfessionName">FO Name</label> <span
                            class=" text-danger">*</span>
                        <select class="selectize" id="txtFoName">
                            <option value="">---Select---</option>
                            <?php $__currentLoopData = $userDetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($getVillageFinalData != null): ?>
                                    <?php if($getVillageFinalData->foName == $user->id): ?>
                                        <option value="<?php echo e($user->id); ?>" selected><?php echo e($user->name); ?></option>
                                    <?php else: ?>
                                        <option value="<?php echo e($user->id); ?>"><?php echo e($user->name); ?></option>
                                    <?php endif; ?>
                                <?php else: ?>
                                    <option value="<?php echo e($user->id); ?>"><?php echo e($user->name); ?></option>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <div class="col-12 mb-4">
                        <label class="form-label" for="modalProfessionName">Phone Number</label> <span
                            class=" text-danger">*</span>
                        <input type="text" class="form-control" id="txtPhoneNumber"
                            value="<?php if($getVillageFinalData != null): ?> <?php echo e($getVillageFinalData->phone); ?><?php else: ?><?php echo e(''); ?> <?php endif; ?>">
                    </div>
                </div>


                <div class="col-12 text-center demo-vertical-spacing">
                    <button class="btn btn-primary me-4" id="btnUpdateVillageDetails">Update Village
                        Details</button>
                    <button type="reset" class="btn btn-label-secondary" data-bs-dismiss="modal"
                        aria-label="Close">
                        Discard
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--/ Division Details Modal -->
<?php /**PATH /Users/anlex/Desktop/untitled folder/ngo/resources/views/pages/allpages/divisionbyvillage/village_details.blade.php ENDPATH**/ ?>