From 103ca3ec2ed6477fe1cce18f82f504cbdb265985 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Sat, 8 Oct 2022 23:35:03 +0100 Subject: [PATCH] Add payment aggregators settings to admin panel --- application/controllers/Gestion.php | 15 + application/controllers/PaymentController.php | 82 +++++ application/language/english/message_lang.php | 16 + application/language/french/message_lang.php | 16 + application/views/gestion_aggregators.php | 343 ++++++++++++++++++ application/views/header_gestion.php | 5 + 6 files changed, 477 insertions(+) create mode 100644 application/controllers/PaymentController.php create mode 100755 application/views/gestion_aggregators.php diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index edea78a3..636bb726 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -2479,5 +2479,20 @@ class Gestion extends CI_Controller } } + public function aggregators() + { + if ($this->isLogged()) { + $data['active'] = "aggregators"; + $data['alert'] = ""; + $data['aggregators'] = $this->db->get_where('payment_aggregators'); +// $data['pays'] = $this->user_model->getAllPays(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $this->load->view('header_gestion', $data); + $this->load->view('gestion_aggregators'); + $this->load->view('footer'); + } + } + + } diff --git a/application/controllers/PaymentController.php b/application/controllers/PaymentController.php new file mode 100644 index 00000000..4724b2d6 --- /dev/null +++ b/application/controllers/PaymentController.php @@ -0,0 +1,82 @@ +isLogged()) { + if (isset($_POST)) { + $emailExist = $this->db->get_where('payment_aggregators', ['email' => $_POST['email']]); + if ($emailExist->num_rows() == 0) { + $_POST['created_at'] = (new DateTime())->format('Y-m-d H:i:s'); + $_POST['updated_at'] = (new DateTime())->format('Y-m-d H:i:s'); + $this->db->insert('payment_aggregators', $_POST); + echo json_encode(['code' => 200]); + } else { + echo json_encode(['code'=> 419 , 'message' => $this->lang->line("L'email entré est déjà utilisé")]); + } + } + } + } + + public function updatePaymentAggregator() + { + if($this->isLogged()) { + if (isset($_POST)) { + $emailExist = $this->db->get_where('payment_aggregators', ['id !=' => $_POST['id'], 'email' => $_POST['email']]); + if ($emailExist->num_rows() == 0) { + $_POST['updated_at'] = (new DateTime())->format('Y-m-d H:i:s'); + $this->db->where('id',$_POST['id']); + $this->db->update('payment_aggregators',$_POST); + echo json_encode(['code' => 200]); + }else{ + echo json_encode(['code'=> 419 , 'message' => $this->lang->line("L'email entré est déjà utilisé")]); + } + } + } + } + + public function deletePaymentAggregator(){ + if($this->isLogged()) { + if (isset($_POST)) { + $this->db->delete('payment_aggregators', ['id' => $_POST['id']]); + echo json_encode(['code' => 200]); + } + } + } + + public function enableAggregator() + { + if($this->isLogged()) { + if (isset($_POST)) { + $date = (new DateTime())->format('Y-m-d H:i:s'); + $this->db->update('payment_aggregators',['status' => 0 , 'updated_at' => $date]); + $this->db->where('id',$_POST['id']); + $this->db->update('payment_aggregators',['status' => 1 , 'updated_at' => $date]); + echo json_encode(['code' => 200]); + } + } + } + + + + + public function isLogged() + { + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + $this->load->view('login', $data); + return false; + } + return true; + } + +} diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 561b7751..b4aa1f76 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -947,4 +947,20 @@ $lang['STOPPED'] = "Stopped"; $lang['profile_image'] = "Profile image"; $lang['open_wallet_at_mobile_login'] = "Open wallet at mobile login"; $lang['MODIFIED'] = "Modified"; +$lang['opening_amount'] = "Opening amount"; +$lang['name_already_used'] = "The name entered is already in use"; +$lang['add_customer_account_type'] = 'Add a customer account type'; +$lang['customer_account_type_created'] = "Customer account type created"; +$lang['customer_account_type_updated'] = "Customer account type modified"; +$lang['customer_account_type_deleted'] = "Customer account type deleted"; +$lang['customer_account_types'] = 'customer account types'; +$lang['customers_accounts_configuration'] = 'Configuration of opening customer accounts'; +$lang['aggregators'] = "Aggregators"; +$lang['payment_aggregators'] = "Payment aggregators"; +$lang['add_aggregator'] = "Add an aggregator"; +$lang['aggregator_updated'] = "Payment aggregator updated"; +$lang['aggregator_deleted'] = "Payment aggregator deleted"; +$lang['aggregator_created'] = "Payment aggregator created"; +$lang['aggregator_activated'] = "Agrégateur de paiement activated" ; + ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 3b80b4e2..95452372 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -956,4 +956,20 @@ $lang['STOPPED'] = "Arretée"; $lang['profile_image'] = "Photo de profil"; $lang['open_wallet_at_mobile_login'] = "Ouverture du wallet à la connexion mobile"; $lang['MODIFIED'] = "Modifiée"; +$lang['opening_amount'] = "Montant à l'ouverture"; +$lang['name_already_used'] = "Le nom entré est déjà utilisé"; +$lang['add_customer_account_type'] = 'Ajouter un type de compte client'; +$lang['customer_account_type_created'] = "Type de compte client crée"; +$lang['customer_account_type_updated'] = "Type de compte client modifié"; +$lang['customer_account_type_deleted'] = "Type de compte client supprimé"; +$lang['customer_account_types'] = 'Types de comptes clients'; +$lang['customers_accounts_configuration'] = 'Configuration ouverture des comptes clients'; +$lang['aggregators'] = "Agrégateurs"; +$lang['payment_aggregators'] = "Agrégateurs de paiement"; +$lang['add_aggregator'] = "Ajouter un agrégateur"; +$lang['aggregator_updated'] = "Agrégateur de paiement mis à jour" ; +$lang['aggregator_deleted'] = "Agrégateur de paiement supprimé" ; +$lang['aggregator_created'] = "Agrégateur de paiement créé" ; +$lang['aggregator_activated'] = "Agrégateur de paiement activé" ; + ?> diff --git a/application/views/gestion_aggregators.php b/application/views/gestion_aggregators.php new file mode 100755 index 00000000..e19e538e --- /dev/null +++ b/application/views/gestion_aggregators.php @@ -0,0 +1,343 @@ + + +
+ +
+

+ lang->line('payment_aggregators') ; ?> +

+
+ +
+
+
+
+
+

lang->line('payment_aggregators'); ?>

+
+
+ + + + + + + + + + + + + + + result() as $i => $row) { + ?> + + + + + + + + + + + + +
#lang->line('Nom'); ?>lang->line('Email'); ?>lang->line('Adresse'); ?>lang->line('Contact'); ?>lang->line('Statut'); ?>lang->line('Activer'); ?>Action
name ?>email?>address?>phone?>lang->line($row->status ? 'Active' : 'Inactive'); ?> + status ? 'checked' : '' ?>> + + + +
+ +
+
+
+
+
+
+

lang->line('add_aggregator'); ?>

+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+ + + load->view('include/delete_modal') ?> + load->view('include/loader') ?> +
+
+ + + + + + + + + + + + + + + + + + diff --git a/application/views/header_gestion.php b/application/views/header_gestion.php index 8da6c70b..f73010fd 100755 --- a/application/views/header_gestion.php +++ b/application/views/header_gestion.php @@ -190,6 +190,11 @@ lang->line('operators'); ?> +
  • "> + + lang->line('aggregators'); ?> + +
  • "> lang->line('settings'); ?>