Implements QR code
This commit is contained in:
parent
783001659a
commit
435eb3b9f2
|
@ -34,8 +34,8 @@ class GeolocatedUsers extends CI_Controller
|
||||||
$row->lastname,$row->adresse, $row->code_membre , $row->email, $row->phone , $row->provider_class ,$status);
|
$row->lastname,$row->adresse, $row->code_membre , $row->email, $row->phone , $row->provider_class ,$status);
|
||||||
|
|
||||||
if($_POST['category'] == 'geolocated'){
|
if($_POST['category'] == 'geolocated'){
|
||||||
if($row->has_qr_code)
|
if($row->qr_code)
|
||||||
$data[] = "<a href='" . WALLET_SERVICE_URL . "/qrcodes/agents/" . $row->id . ".pdf' class='btn btn-success btn-center' target='_blank'>" . $this->lang->line('display') . "</a>";
|
$data[] = "<a href='".$row->qr_code."' class='btn btn-success btn-center' target='_blank'>" . $this->lang->line('display') . "</a>";
|
||||||
else
|
else
|
||||||
$data[] = "<button class='btn btn-primary btn-center generateQRCode' data-id_agent='$row->id'>" . $this->lang->line('generate') . "</button>";
|
$data[] = "<button class='btn btn-primary btn-center generateQRCode' data-id_agent='$row->id'>" . $this->lang->line('generate') . "</button>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,4 +853,6 @@ $lang['total_insurance_part'] = "Total Insurance Share";
|
||||||
$lang['invoices_history'] = "Invoice history";
|
$lang['invoices_history'] = "Invoice history";
|
||||||
$lang['health_care_sheets_history'] = "History of health care sheets";
|
$lang['health_care_sheets_history'] = "History of health care sheets";
|
||||||
$lang['invoice_id'] = "Invoice ID";
|
$lang['invoice_id'] = "Invoice ID";
|
||||||
|
$lang['generate_qr_code'] = "Generate QR code";
|
||||||
|
$lang['display_qr_code'] = "Display QR code";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -864,4 +864,6 @@ $lang['total_insurance_part'] = "Total Part de assurance";
|
||||||
$lang['invoices_history'] = "Historique des factures";
|
$lang['invoices_history'] = "Historique des factures";
|
||||||
$lang['health_care_sheets_history'] = "Historique des feuilles de soins";
|
$lang['health_care_sheets_history'] = "Historique des feuilles de soins";
|
||||||
$lang['invoice_id'] = "ID de la facture";
|
$lang['invoice_id'] = "ID de la facture";
|
||||||
|
$lang['generate_qr_code'] = "Génerer le QR code";
|
||||||
|
$lang['display_qr_code'] = "Afficher le QR code"
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1724,7 +1724,7 @@ class User_model extends CI_Model
|
||||||
*/
|
*/
|
||||||
public function get_user($where_clause){
|
public function get_user($where_clause){
|
||||||
$query = $this->db->query("SELECT agents.lastname, agents.adresse,agents.email,agents.date_created,agents.id AS userID,
|
$query = $this->db->query("SELECT agents.lastname, agents.adresse,agents.email,agents.date_created,agents.id AS userID,
|
||||||
codeGenerer.category,
|
codeGenerer.category,agents.id, agents.qr_code,'agent' as type,
|
||||||
networks.name AS network_name,towns.name AS town_name,
|
networks.name AS network_name,towns.name AS town_name,
|
||||||
codeGenerer.code_parrain AS parrain,codeGenerer.code_membre AS code,
|
codeGenerer.code_parrain AS parrain,codeGenerer.code_membre AS code,
|
||||||
networks_agents.id AS networkAgent_id,networks_agents.phone,networks_agents.transactionNumber AS transac
|
networks_agents.id AS networkAgent_id,networks_agents.phone,networks_agents.transactionNumber AS transac
|
||||||
|
@ -1735,7 +1735,7 @@ class User_model extends CI_Model
|
||||||
INNER JOIN towns ON towns.id=agents.town_id
|
INNER JOIN towns ON towns.id=agents.town_id
|
||||||
".$where_clause);
|
".$where_clause);
|
||||||
$statement = "SELECT agents.lastname, agents.adresse,agents.email,agents.date_created,agents.id AS userID,
|
$statement = "SELECT agents.lastname, agents.adresse,agents.email,agents.date_created,agents.id AS userID,
|
||||||
codeGenerer.category,
|
codeGenerer.category,agents.id, agents.qr_code,'agent' as type,
|
||||||
networks.name AS network_name,towns.name AS town_name,
|
networks.name AS network_name,towns.name AS town_name,
|
||||||
codeGenerer.code_parrain AS parrain,codeGenerer.code_membre AS code,
|
codeGenerer.code_parrain AS parrain,codeGenerer.code_membre AS code,
|
||||||
networks_agents.id AS networkAgent_id,networks_agents.phone,networks_agents.transactionNumber AS transac
|
networks_agents.id AS networkAgent_id,networks_agents.phone,networks_agents.transactionNumber AS transac
|
||||||
|
@ -1757,7 +1757,7 @@ class User_model extends CI_Model
|
||||||
*/
|
*/
|
||||||
public function get_simple_user($phone, $name , $country = null){
|
public function get_simple_user($phone, $name , $country = null){
|
||||||
$end_query = $country ? "AND countries.name = '".$country."'" : '';
|
$end_query = $country ? "AND countries.name = '".$country."'" : '';
|
||||||
$query = $this->db->query("SELECT users.id AS id_user,users.active AS etat,users.lastname,users.phone,users.email,users.adresse,users.date_created,
|
$query = $this->db->query("SELECT users.id AS id_user,users.active AS etat,users.lastname,users.phone,users.email,users.adresse,users.date_created,users.id , users.qr_code, 'user' as type,
|
||||||
networks.name AS network,countries.name AS country,i.firstname as id_firstname , i.lastname as id_lastname , i.birth_date , i.gender, i.town as id_town , i.country as id_country,
|
networks.name AS network,countries.name AS country,i.firstname as id_firstname , i.lastname as id_lastname , i.birth_date , i.gender, i.town as id_town , i.country as id_country,
|
||||||
i.identity_document , i.id_identity_document ,i.expiry_date_document , i.status, i.user_image , i.document_image_back , i.document_image_front
|
i.identity_document , i.id_identity_document ,i.expiry_date_document , i.status, i.user_image , i.document_image_back , i.document_image_front
|
||||||
FROM users
|
FROM users
|
||||||
|
|
|
@ -217,6 +217,15 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?php if($row->qr_code) { ?>
|
||||||
|
<a href="<?= $row->qr_code ?>" class='btn btn-success btn-block mb3' target='_blank'>
|
||||||
|
<b><?= $this->lang->line('display_qr_code')?> </b>
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<button class='btn btn-primary btn-block generateQRCode mb-3' data-id="<?=$row->id?>" data-type="<?=$row->type?>">
|
||||||
|
<b> <?= $this->lang->line('generate_qr_code') ?> </b>
|
||||||
|
</button>
|
||||||
|
<?php } ?>
|
||||||
<a href="#" class="btn btn-primary btn-block" data-toggle="modal"
|
<a href="#" class="btn btn-primary btn-block" data-toggle="modal"
|
||||||
data-target="#infos<?php echo $num; ?>"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
|
data-target="#infos<?php echo $num; ?>"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -358,6 +367,16 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?php if($row->qr_code) { ?>
|
||||||
|
<a href="<?= $row->qr_code ?>" class='btn btn-success btn-block mb3' target='_blank'>
|
||||||
|
<b><?= $this->lang->line('display_qr_code')?> </b>
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<button class='btn btn-primary btn-block generateQRCode mb-3' data-id="<?=$row->id?>" data-type="<?=$row->type?>">
|
||||||
|
<b> <?= $this->lang->line('generate_qr_code') ?> </b>
|
||||||
|
</button>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<a href="#" class="btn btn-success btn-block" data-toggle="modal"
|
<a href="#" class="btn btn-success btn-block" data-toggle="modal"
|
||||||
data-target="#infos-s"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
|
data-target="#infos-s"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -568,6 +587,16 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?php if($row->qr_code) { ?>
|
||||||
|
<a href="<?= $row->qr_code ?>" class='btn btn-success btn-block mb3' target='_blank'>
|
||||||
|
<b><?= $this->lang->line('display_qr_code')?> </b>
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<button class='btn btn-primary btn-block generateQRCode mb-3' data-id="<?=$row->id?>" data-type="<?=$row->type?>">
|
||||||
|
<b> <?= $this->lang->line('generate_qr_code') ?> </b>
|
||||||
|
</button>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<a href="#" class="btn btn-success btn-block" data-toggle="modal"
|
<a href="#" class="btn btn-success btn-block" data-toggle="modal"
|
||||||
data-target="#infos-s"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
|
data-target="#infos-s"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -769,6 +798,7 @@
|
||||||
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
|
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
||||||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||||
|
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//Date picker
|
//Date picker
|
||||||
|
@ -895,4 +925,32 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("click", ".generateQRCode", function () {
|
||||||
|
let id_agent = $(this).data('id');
|
||||||
|
let type = $(this).data('type');
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url('index.php/Hyperviseur_dash/generateQRCode')?>',
|
||||||
|
type: 'POST',
|
||||||
|
data: {'user_id': id_agent , 'type' : type},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
if(data.status === 200){
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?= $this->lang->line('qr_code_generated')?>",
|
||||||
|
text: "<?= $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
toastr.error(data.error , "<?= $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (error) {
|
||||||
|
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -422,8 +422,6 @@
|
||||||
data: {'user_id': id_agent , 'type' : 'agent'},
|
data: {'user_id': id_agent , 'type' : 'agent'},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
console.log('status',data.status)
|
|
||||||
console.log('respon',data.response)
|
|
||||||
if(data.status === 200){
|
if(data.status === 200){
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
|
|
Loading…
Reference in New Issue