nhance/app/Views/hr_access_controll.php
2025-07-16 18:17:03 +05:30

180 lines
14 KiB
PHP

<div class="container-fluid">
<div class="row">
<div class="col-12">
<?php if(isset($hr_access_data) && !empty($hr_access_data)) { ?>
<form id="insuranceForm" onsubmit="submitForm(event)">
<?php foreach ($hr_access_data as $key => $value) {
$key = $key + 1 ?>
<!-- User 1 Card -->
<div class="user-card" data-user-id="<?= 'user' . $key ?>">
<!-- Hidden form elements for User 1 -->
<input type="hidden" name="<?= 'user' . $key ?>_pk" value="<?= $value['hr_access_table_pk'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_pre_hr_id" value="<?= $value['pre_hr_id'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_post_hr_id" value="<?= $value['post_hr_id'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_post_client_id" value="<?= $value['post_client_id'] ?>">
<div class="card-header" onclick="toggleAccordion(this)">
<div class="user-info">
<h5 class="mb-0"><?= $value['hr_name'] ?>
<!-- <i class="fa fa-info-circle" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> -->
</h5>
<p class="user-email"><?= $value['hr_mail'] ?></p>
</div>
<div class="accordion-icon">
<i class="fas fa-chevron-down"></i>
</div>
</div>
<div class="card-content">
<div class="content-inner">
<div class="row">
<div class="col-md-6 col-lg-3">
<div class="section">
<div class="section-title">
<input type="checkbox" class="main-checkbox"
onchange="toggleSection(this, '<?= 'user' . $key ?>-pre')" name="<?= 'user' . $key ?>_modules"
value="1" <?php if (in_array(1, $value['allowed_pre_modules'] ?? [])) {
echo 'checked';
} ?>>
<i class="fas fa-user-plus mr-2"></i>Pre enrollment
</div>
<div class="<?= in_array(1, $value['allowed_pre_modules']) ? 'checkbox-group' : 'checkbox-group hidden' ?>" id="<?= 'user' . $key ?>-pre">
<!-- Select All -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="all" data-user="<?= $key ?>" data-group="pre">
<label>Select all</label>
</div>
<!-- Select All Active -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="active" data-user="<?= $key ?>" data-group="pre">
<label>Select all Active policies</label>
</div>
<!-- Select All Inactive -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="inactive" data-user="<?= $key ?>" data-group="pre">
<label>Select all In-Active policies</label>
</div>
<?php foreach ($pre_policy_data as $key1 => $policies) {
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
?>
<div class="checkbox-item">
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>"
<?= in_array($policies['client_policy_id'], $value['allowed_pre_policies']) ? 'checked' : '' ?>>
<label style="<?php if($policies['policy_status'] == 0){echo 'color:#ff5757';} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="section">
<div class="section-title">
<input type="checkbox" class="main-checkbox"
onchange="toggleSection(this, '<?= 'user' . $key ?>-active')" name="<?= 'user' . $key ?>_modules"
value="2" <?php if (in_array(2, $value['allowed_post_modules'])) {
echo 'checked';
} ?>>
<i class="fas fa-check-circle mr-2"></i>Active policies
</div>
<div class="<?php if (in_array(2, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-active">
<!-- Select All -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="all" data-user="<?= $key ?>" data-group="post">
<label>Select all</label>
</div>
<!-- Select All Active -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="active" data-user="<?= $key ?>" data-group="post">
<label>Select all Active policies</label>
</div>
<!-- Select All Inactive -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="inactive" data-user="<?= $key ?>" data-group="post">
<label>Select all In-Active policies</label>
</div>
<?php foreach ($post_policy_data as $key2 => $policies) {
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
?>
<div class="checkbox-item">
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post"
value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {echo 'checked';} ?>>
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if($policies['policy_status'] == 0){echo 'color:#ff5757';} ?>"><?= $policies['policy_type'] . ' - ' . $policies['policy_no'] ?></label>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="section">
<div class="section-title">
<input type="checkbox" class="main-checkbox"
onchange="toggleSection(this, '<?= 'user' . $key ?>-cd')" name="<?= 'user' . $key ?>_modules" value="3" <?php if (in_array(3, $value['allowed_post_modules'])) { echo 'checked';} ?>>
<i class="fas fa-file-alt mr-2"></i>CD statement
</div>
<div class="<?php if (in_array(3, $value['allowed_post_modules'])) {echo 'checkbox-group';} else {echo 'checkbox-group hidden';} ?>" id="<?= 'user' . $key ?>-cd">
<!-- Select All -->
<div class="checkbox-item">
<input type="checkbox" class="select-all" data-type="all" data-user="<?= $key ?>" data-group="cd">
<label>Select all</label>
</div>
<?php foreach ($post_cd_data as $key3 => $cd) { ?>
<div class="checkbox-item">
<input type="checkbox" class="policy-checkbox" data-user="<?= $key ?>" data-group="cd" id="<?= 'user' . $key ?>-icici1" name="<?= 'user' . $key ?>_cd" value="<?= $cd['cd_master_pk'] ?>" <?php if (in_array($cd['cd_master_pk'], $value['allowed_cd'])) { echo 'checked';} ?>>
<label for="<?= 'user' . $key ?>-icici1"><?= $cd['insurer_short_name'] ?> - <span class="policy-number"><?= $cd['cd_account_no'] ?></span></label>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="section">
<div class="section-title">
<input type="checkbox" class="main-checkbox" name="<?= 'user' . $key ?>_modules" value="4" <?php if (in_array(4, $value['allowed_post_modules'])) {echo 'checked';} ?>>
<i class="fas fa-clipboard-list mr-2"></i>Claims
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<!-- Submit Section -->
<div class="submit-container">
<button type="submit" class="btn btn-primary btn-submit">
Submit Form
</button>
</div>
</form>
<?php } else { ?>
<div class="submit-container"><b>There is no HR data</b></div>
<?php } ?>
</div>
</div>
</div>