From 8b03f5b4aaae76a6832dab7e23751baeb2591f40 Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Wed, 13 Jul 2022 18:31:13 -0400 Subject: [PATCH] fix --- www/application/controllers/Jobs.php | 47 ++---------------- www/application/models/Offers_model.php | 55 +++++++++++---------- www/application/views/jobs/view_myoffer.php | 26 ++-------- 3 files changed, 40 insertions(+), 88 deletions(-) diff --git a/www/application/controllers/Jobs.php b/www/application/controllers/Jobs.php index 04459fc1..73c67fd5 100644 --- a/www/application/controllers/Jobs.php +++ b/www/application/controllers/Jobs.php @@ -745,53 +745,16 @@ echo $this->getMarketInterestMessage( $in['offer_code'], $out['client_id'] ); } public function myoffer() { - $data = array(); + // $data = array(); $data = $this->getSessionArray(); - $data['offer_dash'] = ''; - $this->load->library('table'); - $this->table->set_template($this->template); + $this->load->model('offers_model'); + $out = $this->offers_model->getUserPendingOffers($_SESSION['member_id']); - $data["offer_dash"] = "
\"Active
"; + $data['my_offer_rows'] = $out["query"]->result(); - $data["dash_title"] = "My Pending Offer(s)"; - $jbx = "''/jobs/viewmyjob''"; - $mysql = "SELECT jo.added::date||'
'||jo.expire::date,j.title||'
To :'||jo.email AS tRec," - . 'CASE WHEN jo.status = 1 THEN \'Pending\' ELSE \'Other\' END AS status,' - . "'' AS View " - . "FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id " - . "WHERE jo.expire > now() AND jo.status = 1 " - . "AND jo.member_id = " . $_SESSION['member_id'] . "LIMIT 400"; - $mysql = "SELECT jo.added::date||'
'||jo.expire::date AS job_dates,j.title||'
To :'||(CASE WHEN jo.public_view > 0 THEN '-Public View' ELSE jo.email END) AS tRec," - . "'' AS View " - . "FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id " - . "WHERE jo.expire > now() AND jo.status = 1 " - . "AND jo.member_id = " . $_SESSION['member_id'] . " ORDER BY jo.id DESC LIMIT 400"; -// . 'CASE WHEN jo.status = 1 AND jo.public_view =0 THEN \'Pending\' WHEN jo.status = 1 AND jo.public_view >0 THEN \'Active\' ELSE \'Other\' END AS status,' - $query = $this->db->query($mysql); - - $mysql2 = "SELECT jo.added::date AS start_job_date, jo.expire::date AS end_job_date, j.title, (CASE WHEN jo.public_view > 0 THEN '-Public View' ELSE jo.email END) AS job_to,jo.offer_code AS offer_code," - . "'' AS View " - . "FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id " - . "WHERE jo.expire > now() AND jo.status = 1 " - . "AND jo.member_id = " . $_SESSION['member_id'] . " ORDER BY jo.id DESC LIMIT 400"; - $query2 = $this->db->query($mysql2); - $data['offer_dash_rows'] = $query2->result(); - - $num = $query->num_rows(); - - if ($num > 0) { - // array('data' => 'Added/Expire', 'style' => 'width:100px') - - $this->table->set_heading(array('data' => 'Added/Expire', 'style' => 'width:100px'), 'Title/Recipient', array('data' => ' ', 'style' => 'width:80px')); - $data['offer_dash'] = $this->table->generate($query); - - $offer_found = true; - } - - $_SESSION['secure_data'] = $data; // all data needed for secure page - $data['page_title'] = "Offer(s)"; + $data['page_title'] = "Pending"; $this->renderSecurePage('jobs/view_myoffer', $data); } diff --git a/www/application/models/Offers_model.php b/www/application/models/Offers_model.php index b22e82c4..928180d1 100644 --- a/www/application/models/Offers_model.php +++ b/www/application/models/Offers_model.php @@ -1,52 +1,57 @@ db->query($mysql); $num = $query->num_rows(); if ($num == 1) { - - // $out = $query->result_array(); - // print_r($out); - $mysqlU = " UPDATE members_jobs_offer SET client_id ='". $query->row()->member_id ."' WHERE client_id = 0 AND email='$emailTrim' AND expire> now()"; + + // $out = $query->result_array(); + // print_r($out); + $mysqlU = " UPDATE members_jobs_offer SET client_id ='" . $query->row()->member_id . "' WHERE client_id = 0 AND email='$emailTrim' AND expire> now()"; $this->db->query($mysqlU); } } // NOT completed -- - public function getUserPendingOffers($member_id) { + public function getUserPendingOffers($member_id) + { $out = array(); $error_state = false; $out['error'] = ''; + $sqlOffer = "SELECT mo.member_id, to_char(mo.added, 'Day Mon dd, yyyy HH:MI AM') AS sent, + j.title,j.description,m.job_id,to_char( m.expire, 'Day Mon dd, yyyy HH:MI AM') AS expire , + m.offer_code + FROM members_offer_interest mo + LEFT JOIN members_jobs_offer m ON m.id = mo.offer_id + LEFT JOIN members_jobs j ON j.id=m.job_id + WHERE m.status = 1 AND m.client_id=0 + AND m.expire IS NOT NULL AND m.expire> now() AND m.public_view = 1 + AND mo.member_id = $member_id ORDER BY mo.added DESC LIMIT 20"; //, in["member_id"].Long(), in["limit"].Long()); - // $sqlOffer ="SELECT o.*,j.title,j.description,j.timeline_days,j.price FROM members_jobs_offer o LEFT JOIN members_jobs j ON j.id =o.job_id"; - $sqlOffer =" SELECT mj.id AS job_id, jo.id AS contract_id, - jo.added::date,mj.title, jo.offer_code, - mj.description AS description, - jo.job_description,mj.price, mj.timeline_days - FROM members_jobs_offer jo - LEFT JOIN members_jobs mj ON mj.id = jo.job_id - WHERE jo.expire > now() - AND jo.status = 1 - AND jo.client_id = $member_id LIMIT 20"; - return $this->db->query($sqlOffer); + $out["query"] = $this->db->query($sqlOffer); + + return $out; + /* + + */ + } - /* - - */ - -} +} \ No newline at end of file diff --git a/www/application/views/jobs/view_myoffer.php b/www/application/views/jobs/view_myoffer.php index ee396ad4..694d1f24 100644 --- a/www/application/views/jobs/view_myoffer.php +++ b/www/application/views/jobs/view_myoffer.php @@ -23,7 +23,7 @@

- + My Offers

@@ -39,29 +39,16 @@
- - - - - - - - - - - - -
Added
Expire
Title
Recipient
- start_job_date?>
- end_job_date?> -
title?> - To : job_to?> + description?> + Send : sent?>
+ Expire : expire?>
@@ -78,10 +65,7 @@ - -