nhance/app/Views/hr_access_controll.php

305 lines
20 KiB
PHP

<style>
<?php foreach ($hr_access_data as $key => $value) {
$key = $key + 1;
?>
#user<?php echo "$key"; ?>-active {
margin: 0;
}
#user<?= $key ?>-active .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-active label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-pre {
margin: 0;
}
#user<?= $key ?>-pre .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-pre label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-gmc2 {
margin: 0;
}
#user<?= $key ?>-gmc2 .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-gmc2 label {
font-size: 11px !important;
height: auto !important;
}
#user<?php echo "$key"; ?>-cd {
margin: 0;
}
#user<?= $key ?>-cd .checkbox-item {
padding-left: 0;
}
#user<?= $key ?>-cd label {
font-size: 11px !important;
height: auto !important;
}
<?php } ?>
</style>
<div class="container-fluid-min">
<div class="row">
<div class="col-12">
<?php if (isset($hr_access_data) && !empty($hr_access_data)) {
$listed_pre = [];
$listed_post = [];
?>
<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'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_pre_branch_id" value="<?= $value['pre_branch_id'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_post_branch_id" value="<?= $value['post_branch_id'] ?>">
<input type="hidden" name="<?= 'user' . $key ?>_pre_client_id" value="<?= $value['pre_client_id'] ?>">
<div class="card-header" onclick="toggleAccordion(this)" style="background-color: #F5FFFF;">
<div class="user-info">
<h5 class="mb-0"> Name -<?= $value['hr_name'] ?>
<!-- <i class="mdi mdi-information-outline" 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 style="color: black;"> <b>branch - <?= $value['post_branch_name']?></b></p>
<p class="user-email"> Mail - <?= $value['hr_mail'] ?></p>
</div>
<div class="accordion-icon">
<i class="mdi mdi-chevron-down"></i>
</div>
</div>
<div class="card-content">
<div class="content-inner" style="background-color: #F5FFFF;">
<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="mdi mdi-account-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';
// if (
// in_array($policies['branch_id'].'-'.$policies['policy_no'], $listed_pre)
// &&
// $value['pre_branch_id'] != $policies['branch_id']
// ) {
// continue;
// } else {
// $listed_pre[] = $policies['branch_id'].'-'.$policies['policy_no'];
// }
if(empty($value['pre_hr_id']) || $value['pre_branch_id'] !== $policies['branch_id']){
continue;
}
?>
<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="mdi mdi-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';
// if(
// in_array($policies['branch_id'].'-'.$policies['policy_no'] , $listed_post)
// &&
// $value['post_branch_id'] != $policies['branch_id']
// )
// {
// continue;
// }
// else
// {
// $listed_post[] = $policies['branch_id'].'-'.$policies['policy_no'];
// }
if(empty($value['post_hr_id']) || $value['post_branch_id'] !== $policies['branch_id']){
continue;
}
?>
<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';
} ?>>
&nbsp;&nbsp;
<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="mdi mdi-file 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="mdi mdi-clipboard-text 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">
<p align="center"> <b>There is no HR data</b></p>
</div>
<?php } ?>
</div>
</div>
</div>