FEAT_COMMON_ECARD_TEMPLATE : RV
This commit is contained in:
parent
f20a184f77
commit
c47072c2b2
@ -1086,6 +1086,7 @@ class EmployeeController extends AdminController
|
||||
return $response;
|
||||
}
|
||||
|
||||
//E-CARD DOWNLOAD FUNCTION
|
||||
public function generateIDCardForEmployee($rand_string, $people = 0)
|
||||
{
|
||||
// dd($rand_string, $people);
|
||||
@ -1187,6 +1188,8 @@ class EmployeeController extends AdminController
|
||||
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
||||
];
|
||||
|
||||
$placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id);
|
||||
|
||||
foreach ($placeholders as $placeholder => $replaceValue) {
|
||||
$htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
|
||||
}
|
||||
@ -2443,6 +2446,9 @@ class EmployeeController extends AdminController
|
||||
exit;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function test_members_list(){
|
||||
// $model = new EmployeeModel();
|
||||
// $list = [
|
||||
@ -2546,8 +2552,6 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function cloneWorksheet()
|
||||
{
|
||||
// Define file paths
|
||||
@ -2602,4 +2606,45 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function generateAcmAndMForEcard($client_id)
|
||||
{
|
||||
$db = db_connect();
|
||||
$builder = $db->table('client_rm');
|
||||
$builder->select('user_profiles.first_name, user_profiles.mobile, user_profiles.email, client_rm.level');
|
||||
$builder->join('user_profiles', 'client_rm.user_id = user_profiles.id');
|
||||
$builder->where('client_rm.client_id', $client_id);
|
||||
$builder->whereIn('client_rm.level', [2, 3]);
|
||||
$builder->where('client_rm.is_active', 1);
|
||||
$builder->orderBy('client_rm.level', 'desc');
|
||||
$query = $builder->get();
|
||||
$result = $query->getResultArray();
|
||||
|
||||
$levels = [
|
||||
3 => [],
|
||||
2 => []
|
||||
];
|
||||
|
||||
foreach ($result as $value) {
|
||||
$levels[$value['level']][] = $value;
|
||||
}
|
||||
|
||||
// Generate the HTML content
|
||||
$html = '';
|
||||
|
||||
foreach ($levels as $level => $contacts) {
|
||||
$displayLevel = $level == 3 ? 1 : 2; // Switch levels for display
|
||||
$html .= '<br>Level ' . $displayLevel . '<br>';
|
||||
foreach ($contacts as $index => $contact) {
|
||||
$html .= ($index + 1) . '. ' . $contact['first_name'] . ' / ' . $contact['mobile'] . ' / ' . $contact['email'] . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '<br><br><br>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user