From a9eba367b64ca4522cb71edbb24b8c42e1520580 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 16 Nov 2024 18:42:53 -0500 Subject: [PATCH] testaccount --- app/Config/Routes.php | 5 +- app/Controllers/Auth.php | 20 ++++-- app/Controllers/PromoAdmin.php | 50 ++++++++++++++ app/Views/admin/index.php | 121 ++++++--------------------------- 4 files changed, 88 insertions(+), 108 deletions(-) create mode 100644 app/Controllers/PromoAdmin.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 73806a9..a989445 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -10,9 +10,10 @@ use CodeIgniter\Router\RouteCollection; $routes->get('/promoadmin', 'Auth::AuthPromoAdmin'); $routes->post('/promoadmin/auth', 'Auth::AuthPromoLogin'); $routes->post('/promoauth', 'Auth::AuthPromoLogin'); -$routes->get('/promodash', 'Auth::AuthPromoDash'); -$routes->get('/addRefMember', 'Auth::addRefMember'); +$routes->get('/promodash', 'PromoAdmin::AuthPromoDash'); +$routes->get('/promolist', 'PromoAdmin::AuthPromoDash'); +$routes->get('/addRefMember', 'PromoAdmin::addRefMember'); diff --git a/app/Controllers/Auth.php b/app/Controllers/Auth.php index bf05ad0..cb5db42 100644 --- a/app/Controllers/Auth.php +++ b/app/Controllers/Auth.php @@ -18,12 +18,22 @@ class Auth extends BaseController public function AuthPromoLogin(){ $raw_json = file_get_contents('php://input'); - $in = json_decode($raw_json, true); + $in = $_POST; ///json_decode($raw_json, true); $out=[]; - //exit(); - $out["login_result"] = $this->APIcall('POST', $this->wrenchAdminApiServer(). 'auth',$in); -var_dump( $out ); - return view('admin/index', $out); + + $out = $this->APIcall('POST', $this->wrenchAdminApiServer(). 'auth',$in); + if (is_array($out) && isset($out['sessionid']) && isset($out['promo_admin_id'])){ + session_status(); + $_SESSION['firstname'] = $out['firstname']; + $_SESSION['lastname'] = $out['lastname']; + $_SESSION['email'] = $out['email']; + $_SESSION['promo_admin_id'] =$out['promo_admin_id']; + $_SESSION['sessionid'] = $out['sessionid']; + + return view('admin/index', $out); + } + + return view('promo_admin_home', $out); } public function AuthPromoDash(){ diff --git a/app/Controllers/PromoAdmin.php b/app/Controllers/PromoAdmin.php new file mode 100644 index 0000000..03aa969 --- /dev/null +++ b/app/Controllers/PromoAdmin.php @@ -0,0 +1,50 @@ +request = $request; +// } + + public function index(): string + { + return view('welcome_message'); + } + + + public function AuthPromoDash(){ + $out=[]; + //exit(); + return view('admin/index', $out); + } + + public function addRefMember(){ +// $raw_json = file_get_contents('php://input'); +// $in = json_decode($raw_json, true); +// $id_booking = $this->input->post('id_booking'); + // $in = $this->request->get; + // var_dump( $_GET ); + // exit; + $data['email'] = $_GET['email']; // strtolower($this->input->get('email')); // '08174596144'; + $data['firstname'] = $_GET['firstname']; // $this->input->get('firstname'); //'7978'; + $data['lastname'] = $_GET['lastname']; // strtolower($this->input->get('lastname')); // '08174596144'; + + $out=[]; + //exit(); + $out["add_result"] = $this->APIcall('POST', $this->wrenchAdminApiServer(). 'list',$data); + //var_dump( $data ); + + echo "Ameye Olu Test 0000 "; + } +//$routes->post('/en/promoadmin/api/v1/auth', 'Promo::promoAuth'); +//$routes->get('/en/promoadmin/api/v1/list', 'Promo::promoList'); +//$routes->post('/en/promoadmin/api/v1/list', 'Promo::promoAddRef'); + +} diff --git a/app/Views/admin/index.php b/app/Views/admin/index.php index 7faad8c..0833424 100644 --- a/app/Views/admin/index.php +++ b/app/Views/admin/index.php @@ -78,8 +78,8 @@
-

Alice Williams

- Henry@example.com +

+
@@ -291,20 +291,15 @@
-
+
@@ -313,10 +308,10 @@ No. - User Name - Position - Department - Location + Email + Firstname + Lastname + Action Status @@ -324,108 +319,32 @@ #00001 -

Brian Joedro

+

james@bond.com

- Sale associate - Marketing + Firstname + Lastname - Los Angeles + Initial Task - - - - - #00002 - -

Smithdro

- - Product designer - Graphics - - Menlo Park, CA - - - - - - - #00003 - -

Adrian Demiandro

- - Python engineer - Development - - Dallas - - - - - - - #00004 - -

Sandradro Garett

- - Account executive - Account - - New york - - - - - - - #00005 - -

Garydro

- - Front-end developer - Developer - - Los Angeles - - - - - - - #00003 - -

Demiandro

- - Python engineer - Development - - Dallas - - - + +
-
+

Recent Actions

@@ -564,7 +483,7 @@ var firstname = document.getElementById('firstname').value; var lastname = document.getElementById('lastname').value; - alert (email + firstname + lastname ); + // alert (email + firstname + lastname ); if (email ==='' || firstname==='' || lastname==='' ){ return; @@ -573,7 +492,7 @@ $('#result_box').html('Processing...'); $('#action_button').prop('disabled', true); $.ajax({ - url: "/addRefMember?proc=TRANSDETAIL&email="+email + url: "/addRefMember?proc=TRANSDETAIL&email="+email+"&firstname="+firstname+"&lastname="+lastname }).done(function (data) { $('#result_box').html(data);