<div class="content-wrapper">
    <div class="container-xxl flex-grow-1 container-p-y">
        <div class="row">
            <input type="hidden" class="form-control" id="divisionId" value="<?php echo e($divisionId); ?>">
            <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="#divisionDetailsModal"><i class="ti ti-edit"></i> Update Division
                                    Details</button>
                            </div>
                            <div class="col-6">
                                <small class="card-text text-uppercase text-muted small">Division 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">
                                            Division Name:</span>
                                        <span>
                                            <?php echo e($getDeviData->divisionName); ?>

                                        </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">Division
                                            Head:</span>
                                        <span>
                                            <?php if($getDivisionFinalData != null): ?>
                                                <?php $__currentLoopData = $getUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($get->id == $getDivisionFinalData->divisionHead): ?>
                                                        <?php echo e($get->name); ?>

                                                    <?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">DM Name:</span>
                                        <span>
                                            <?php if($getDivisionFinalData != null): ?>
                                                <?php $__currentLoopData = $getUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($get->id == $getDivisionFinalData->dmName): ?>
                                                        <?php echo e($get->name); ?>

                                                    <?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">FO Name:</span>
                                        <span>
                                            <?php if($getDivisionFinalData != null): ?>
                                                <?php
                                                    $foNameArray = json_decode($getDivisionFinalData->foName, true);
                                                ?>
                                                <?php if(is_array($foNameArray) && count($foNameArray) > 0): ?>
                                                    <?php
                                                        $foNames = [];
                                                    ?>
                                                    <?php $__currentLoopData = $getUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php if(in_array($get->id, $foNameArray)): ?>
                                                            <?php
                                                                $foNames[] = $get->name;
                                                            ?>
                                                        <?php endif; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    <?php echo e(implode(', ', $foNames)); ?>

                                                <?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">RC Name:</span>
                                        <span>
                                            <?php if($getDivisionFinalData != null): ?>
                                                <?php $__currentLoopData = $getUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($get->id == $getDivisionFinalData->rcName): ?>
                                                        <?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-address-book ti-lg"></i><span
                                            class="fw-medium mx-2">Address:</span>
                                        <span>
                                            <?php if($getDivisionFinalData != null): ?>
                                                <?php echo e($getDivisionFinalData->address); ?>

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

                                            <?php endif; ?>
                                        </span>
                                    </li>
                                    <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($getDivisionFinalData != null): ?>
                                                <?php echo e($getDivisionFinalData->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>Old Account Number</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->oldAccountNumber); ?></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="divisionDetailsModal" 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 Division</h4>
                    <p>Update the division details</p>
                </div>
                <div class="row">
                    <div class="col-6 mb-4">
                        <label class="form-label" for="modalProfessionName">Division Head</label> <span
                            class=" text-danger">*</span>
                        <select class="selectize" id="txtDivisionHead">
                            <option value="">---Select---</option>
                            <?php $__currentLoopData = $userDetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($getDivisionFinalData != null): ?>
                                    <?php if($getDivisionFinalData->divisionHead == $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-6 mb-4">
                        <label class="form-label" for="modalProfessionName">DM Name</label> <span
                            class=" text-danger">*</span>
                        <select class="selectize" id="txtDMName">
                            <option value="">---Select---</option>
                            <?php $__currentLoopData = $userDetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($getDivisionFinalData != null): ?>
                                    <?php if($getDivisionFinalData->dmName == $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-6 mb-4">
                        <label class="form-label" for="modalProfessionName">FO Name</label>
                        <span class="text-danger">*</span>
                        <select class="selectize" id="txtFoName" multiple>
                            <option value="">---Select---</option>
                            <?php
                                $selectedFoNames = $getDivisionFinalData
                                    ? json_decode($getDivisionFinalData->foName, true)
                                    : [];
                            ?>
                            <?php $__currentLoopData = $userDetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($user->userType == 'Field Officer'): ?>
                                    <option value="<?php echo e($user->id); ?>"
                                        <?php if(is_array($selectedFoNames) && in_array($user->id, $selectedFoNames)): ?> selected <?php endif; ?>>
                                        <?php echo e($user->name); ?>

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

                    <div class="col-6 mb-4">
                        <label class="form-label" for="modalProfessionName">RC Name</label> <span
                            class=" text-danger">*</span>
                        <select class="selectize" id="txtRCName">
                            <option value="">---Select---</option>
                            <?php $__currentLoopData = $userDetails; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($getDivisionFinalData != null): ?>
                                    <?php if($getDivisionFinalData->rcName == $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($getDivisionFinalData != null): ?> <?php echo e($getDivisionFinalData->phone); ?><?php else: ?><?php echo e(''); ?> <?php endif; ?>">
                    </div>
                    <div class="col-12 mb-4">
                        <label class="form-label" for="modalProfessionName">Address</label> <span
                            class=" text-danger">*</span>
                        <textarea class="form-control" id="txtAddress">
<?php if($getDivisionFinalData != null): ?>
<?php echo e($getDivisionFinalData->address); ?><?php else: ?><?php echo e(''); ?>

<?php endif; ?>
</textarea>
                    </div>
                </div>


                <div class="col-12 text-center demo-vertical-spacing">
                    <button class="btn btn-primary me-4" id="btnUpdateDivisionDetails">Update Division
                        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/division_details.blade.php ENDPATH**/ ?>