+ Add documentation of Wallet Service Externe in the admin panel

This commit is contained in:
Djery-Tom 2020-11-28 09:18:58 +01:00
parent e3ef3222fe
commit dbd21edb01
7 changed files with 215 additions and 40 deletions

View File

@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/backofficeiLinkTest';
$config['base_url'] = 'https://'.$_SERVER['SERVER_NAME'].'/backofficeiLinkTest';
/*
|--------------------------------------------------------------------------

View File

@ -76,10 +76,11 @@ $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'djery-tom',
'password' => 'root',
'database' => 'iLink_test2',
'wallet_service_url' => 'http://localhost:8081',
'username' => 'root',
'password' => 'vps@2017GA',
'database' => 'iLink_preprod',
'wallet_service_url' => 'https://localhost:8081',
'wallet_service_externe_url' => 'https://localhost:8085',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,

View File

@ -143,8 +143,11 @@ class Admin_dash extends CI_Controller
if (isset($route) && $route = 'page') {
if ($this->input->get('view')) {
switch ($this->input->get('view')){
case 'walletService' :
$data['link'] = 'https://test.ilink-app.com:8081/api/documentation';
case 'walletServiceInterne' :
$data['link'] = $this->db->wallet_service_url.'/api/documentation';
break;
case 'walletServiceExterne' :
$data['link'] = $this->db->wallet_service_externe_url.'/api/documentation';
break;
case 'backoffice':
$data['link'] = base_url('docs/html/index.html');

View File

@ -2322,6 +2322,34 @@ class Gestion extends CI_Controller
}
}
public function add_operator_type()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$query = $this->db->get_where('type_operators', array('code' => $this->input->post('code')), 1);
$exist = $query->num_rows() > 0;
if($exist){
echo json_encode(422);
}else{
$data = array(
'code' => $this->input->post('code'),
'description_fr' => $this->input->post('description_fr'),
'description_en' => $this->input->post('description_fr')
);
$query = $this->db->insert('type_operators', $data);
if ($query) {
echo json_encode(200);
} else {
echo json_encode(500);
}
}
}
}
}
public function delete_operator()
{
if ($this->isLogged()) {

View File

@ -591,4 +591,13 @@ $lang['docs_title'] = "Toute la documentation de iLink App accessible à un seul
$lang['docs_api_overview'] = "L'ensemble des services REST qui communiquent avec l'application mobile et la base de données";
$lang['docs_web_overview'] = "La partie BackOffice developpée avec le framework CodeIgniter est dediée à l'administration de la plateforme";
$lang['docs_mobile_overview'] = "L'application mobile developpée avec le framework React Native, dediée aux clients";
/******/
$lang['add_operator_type'] = "Ajouter un nouveau type d'operateur";
$lang['new_operator_type'] = "Nouveau type d'operateur";
$lang['new_operator_added'] = "Nouveau type d'operateur ajouté";
$lang['description_en'] = "Description anglaise";
$lang['description_fr'] = "Description francaise";
$lang['operator_type_code_exists'] = "Ce code de type d'opérateur existe déjà";
$lang['unexpected_error'] = "Une erreur innatendue s'est produite";
$lang['operators_enabled_disabled'] = "Opérateur(s) activée(s)/désactivée(s)"
?>

View File

@ -71,7 +71,8 @@
<nav id="docs-nav" class="docs-nav navbar">
<ul class="section-items list-unstyled nav flex-column pb-3">
<li class="nav-item section-title"><a class="nav-link scrollto active" href="#api"><span class="theme-icon-holder mr-2"><i class="fas fa-box fa-fw"></i></span>APIs</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-1">Wallet Service</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-1">Wallet Service Interne</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-1-2">Wallet Service Externe</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#web"><span class="theme-icon-holder mr-2"><i class="fas fa-laptop-code"></i></span>Web</a></li>
<li class="nav-item"><a class="nav-link scrollto" href="#item-2-1">Backoffice</a></li>
<li class="nav-item section-title mt-3"><a class="nav-link scrollto" href="#mobile"><span class="theme-icon-holder mr-2"><i class="fas fa-tablet-alt"></i></span>Mobile</a></li>
@ -86,16 +87,15 @@
<header class="docs-header">
<h1 class="docs-heading">APIs <span class="docs-time"><?= $this->lang->line('last_updated')?> : 05-12-2020</span></h1>
<section class="docs-intro">
<p><?= $this->lang->line('docs_api_overview')?>. Encore appelé arriere-plan, est lensemble des microservices qui per-
mettent la communication entre lapplication mobile, lapplication web et les bases de données. Ces différents microservices ne sont pas visibles par lutilisateur et sont chargés du traitement et de la restitution des données.</p>
<p><?= $this->lang->line('docs_api_overview')?>. Encore appelé arriere-plan, est lensemble des microservices qui permettent la communication entre lapplication mobile, lapplication web et les bases de données. Ces différents microservices ne sont pas visibles par lutilisateur et sont chargés du traitement et de la restitution des données.</p>
</section><!--//docs-intro-->
</header>
<section class="docs-section" id="item-1-1">
<h2 class="section-heading">Wallet Service</h2>
<h2 class="section-heading">Wallet Service Interne</h2>
<p>Ce service est responsable de tout ce qui concerne le <strong class="mr-1">Wallet</strong>au sein des applications web et mobile.</p>
Accedez à sa documentation via <a class="theme-link" href="<?= current_url().'?view=walletService'?>"><i class="fas fa-external-link-alt"></i> ce lien</a>
Accedez à sa documentation via <a class="theme-link" href="<?= current_url().'?view=walletServiceInterne'?>"><i class="fas fa-external-link-alt"></i> ce lien</a>
<div class="callout-block callout-block-info">
<div class="content">
@ -110,6 +110,25 @@
</div><!--//callout-block-->
</section><!--//section-->
<section class="docs-section" id="item-1-2">
<h2 class="section-heading">Wallet Service Externe</h2>
<p>Ce service est destiné au tiers opérateurs externes qui voudront communiquer avec notre api sur tout ce qui concerne le <strong class="mr-1">Wallet</strong> .</p>
Accedez à sa documentation via <a class="theme-link" href="<?= current_url().'?view=walletServiceExterne'?>"><i class="fas fa-external-link-alt"></i> ce lien</a>
<div class="callout-block callout-block-info">
<div class="content">
<h4 class="callout-title">
<span class="callout-icon-holder mr-1">
<i class="fas fa-info-circle"></i>
</span><!--//icon-holder-->
Note
</h4>
<p>Utilisez ce jeton d'autorisation : <code class="callout-title">JeJMx6KNW1qo2h01rCVOLfX3f1nmcF2I</code> afin de pouvoir tester les routes qui y figurent.</p>
</div><!--//content-->
</div><!--//callout-block-->
</section><!--//section-->
</article>
<article class="docs-article" id="web">

View File

@ -1,5 +1,6 @@
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
@ -106,7 +107,7 @@
<button data-toggle='modal' data-id-operator='<?=$row->id?>' data-name-operator='<?=$row->operator_name?>' data-type-operator="<?=$type?>"
data-address-operator='<?=$row->operator_address?>' data-code-operator='<?=$row->operator_code?>' data-country='<?=$row->country?>' data-id-country='<?=$row->country_id?>' class='open-modal btn btn-success' data-target='#editModal'><i class='fa fa-edit'></i></button>
<button data-toggle='modal' data-id-operator='<?=$row->id?>' data-id-country='<?=$row->country_id?>' class='delete-operator btn btn-danger' ><i class='fa fa-trash'></i></button>
<button data-id-operator='<?=$row->id?>' data-id-country='<?=$row->country_id?>' class='delete-operator btn btn-danger' ><i class='fa fa-trash'></i></button>
</td>
</tr>
<?php } ?>
@ -155,7 +156,8 @@
?>
</div>
<div class="form-group">
<input id="btn-add" type="submit" value="<?php echo $this->lang->line('Ajouter'); ?>" class="btn btn-primary">
<button type="submit" class="btn btn-primary"><?php echo $this->lang->line('Ajouter'); ?></button>
<button type="button" class="btn btn-success" data-toggle='modal' data-target='#addOperatorType' > <?php echo $this->lang->line('add_operator_type'); ?></button>
</div>
</form>
</div>
@ -203,7 +205,7 @@
?>
</div>
<div class="form-group">
<input id="btn-add" type="submit" value="<?php echo $this->lang->line('Ajouter'); ?>" class="btn btn-primary">
<input type="submit" value="<?php echo $this->lang->line('Ajouter'); ?>" class="btn btn-primary">
</div>
</form>
</div>
@ -236,14 +238,43 @@
</div>
<div class="form-group">
<label for=code">Code</label>
<input type="text" pattern=".{4,}" class="form-control input-lg" name="code" required id="code">
<input type="text" pattern=".{4,}" class="form-control input-lg" name="code" id="code">
</div>
<div class="form-group">
<label for="address"><?php echo $this->lang->line('Adresse'); ?></label>
<input type="text" class="form-control input-lg" name="address" required id="address">
<input type="text" class="form-control input-lg" name="address" id="address">
</div>
<div class="form-group">
<input id="btn-add" type="submit" value="Confirmer" class="btn btn-primary">
<input type="submit" value="Confirmer" class="btn btn-primary">
<button type="button" class="btn btn-default pull-right" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="addOperatorType">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title"><?php echo $this->lang->line('new_operator_type'); ?></h4>
</div>
<div class="modal-body">
<form id="add-operator-type-form" method="post" class="bottom-75 center-block">
<div class="form-group">
<label>Code</label>
<input type="text" class="form-control input-lg" name="code" required id="code">
</div>
<div class="form-group">
<label>Description</label>
<input type="text" class="form-control input-lg" name="description_fr" required id="description_fr">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary"><?php echo $this->lang->line('Confirmer'); ?></button>
<button type="button" class="btn btn-default pull-right" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
</div>
</form>
@ -273,7 +304,15 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
$(document).ready(function() {
var checkboxes = $("td input[type='checkbox']");
checkboxes.click(function() {
@ -309,12 +348,17 @@
dataType: 'json',
success: function(data){
if(data==='completed'){
alert('Banques(s) activée(s)/désactivée(s)');
location.reload();
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('operators_enabled_disabled')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
}else{
alert(data);
//alert("<?= $this->lang->line('error_message') ?>");
location.reload();
console.log('Error' , data);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
}
});
@ -374,12 +418,22 @@
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('operator_deleted') ?>");
location.reload();
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('operator_deleted')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload();
console.log("Error",data);
toastr.error("<?php echo $this->lang->line('unexpected_error')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
event.preventDefault();
@ -397,16 +451,25 @@
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('operator_assigned') ?>");
location.reload();
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('operator_assigned')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
}else if(data==='existe'){
alert('Ce réseau a déjà été assigné à certains des pays sélectionnés');
location.reload();
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload();
alert(data);
console.log("Error",data);
toastr.error("<?php echo $this->lang->line('unexpected_error')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
@ -423,12 +486,22 @@
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('operator_added') ?>");
location.reload();
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('operator_added')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload();
console.log("Error",data);
toastr.error("<?php echo $this->lang->line('unexpected_error')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
event.preventDefault();
@ -445,16 +518,58 @@
dataType: 'json',
success: function(data){
if(data==='completed'){
alert("<?= $this->lang->line('operator_modified') ?>");
location.reload();
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('operator_modified')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
}else{
alert("<?= $this->lang->line('error_message') ?>");
location.reload();
console.log("Error",data);
toastr.error("<?php echo $this->lang->line('unexpected_error')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
event.preventDefault();
});
$("#add-operator-type-form").submit(function(event){
var code = $("#add-operator-type-form #code").val();
// var description_en = $("#add-operator-type-form #description_en").val();
var description_fr = $("#add-operator-type-form #description_fr").val();
$.ajax({
url:'<?php echo base_url('index.php/Gestion/add_operator_type')?>',
type: 'post',
data: {code: code , description_fr :description_fr},
dataType: 'json',
success: function(data){
if(data===200){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('new_operator_added')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
}else if(data === 422){
toastr.error("<?php echo $this->lang->line('operator_type_code_exists')?>" , "<?php echo $this->lang->line('request_error')?>");
}else if(data === 500){
toastr.error("<?php echo $this->lang->line('unexpected_error')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
event.preventDefault();
});
</script>