1057 lines
48 KiB
PHP
1057 lines
48 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Proj extends Users_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
}
|
|
}
|
|
|
|
public function index() {
|
|
|
|
/* $data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
|
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
|
|
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
|
|
$data['email'] = $_SESSION['email']; // = $ret->email;
|
|
*
|
|
*/
|
|
$data = $this->getSessionArray();
|
|
|
|
// print_r($_SESSION);
|
|
//Array ( [__ci_last_regenerate] => 1474689025 [username] => ses66181+1@gmail.com [name] => ses66181+1@gmail.com [firstname] => Olusesan [lastname] => Amey [email] => ses66181+1@gmail.com )
|
|
//
|
|
$data = $this->getSessionArray();
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('users/view_dash', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
|
|
public function pastdue() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
|
|
$data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
|
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
|
|
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
|
|
$data['email'] = $_SESSION['email']; // = $ret->email;
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
|
|
|
|
$this->load->library('table');
|
|
$this->table->set_template($this->template);
|
|
$jbx = "''/proj/latejob''";
|
|
|
|
$mysql = "SELECT '<b>Project ID:</b>'||mc.contract||'<br><b>Title:</b>'||mc.title AS Project,m.firstname||' '||m.lastname AS Client,"
|
|
. " '<b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 ,mc.description,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info\" value=\"Manage\">' AS manage,"
|
|
. " (CASE WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'Active' WHEN mc.status = 1 AND mc.delivery_date <now() THEN 'Past Due' "
|
|
. " WHEN mc.status = 4 THEN 'Review' ELSE 'Not Set' END) AS status "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.member_id = " . $_SESSION['member_id'] . " AND mc.status IN (1,2) "
|
|
. " AND delivery_date < now()";
|
|
|
|
$this->load->library('pagination');
|
|
$config = array();
|
|
$query = $this->db->query($mysql);
|
|
$config["total_rows"] = $query->num_rows();
|
|
$config["base_url"] = base_url() . "/proj/pastdue";
|
|
$config["per_page"] = 5;
|
|
$config["uri_segment"] = 3;
|
|
$config["num_links"] = 5;
|
|
|
|
$config['full_tag_open'] = "<ul class='pagination'>";
|
|
$config['full_tag_close'] = "</ul>";
|
|
$config['num_tag_open'] = '<li>';
|
|
$config['num_tag_close'] = '</li>';
|
|
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
|
|
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
|
|
$config['next_tag_open'] = "<li>";
|
|
$config['next_tagl_close'] = "</li>";
|
|
$config['prev_tag_open'] = "<li>";
|
|
$config['prev_tagl_close'] = "</li>";
|
|
$config['first_tag_open'] = "<li>";
|
|
$config['first_tagl_close'] = "</li>";
|
|
$config['last_tag_open'] = "<li>";
|
|
$config['last_tagl_close'] = "</li>";
|
|
|
|
$this->pagination->initialize($config);
|
|
|
|
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
|
|
|
|
$page = is_numeric($page) ? $page : 0;
|
|
|
|
|
|
|
|
|
|
$mysql = "SELECT '<b>ID:</b>'||mc.contract||'<br><b>Timeline:</b>'||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " '<b>Title: </b>'||mc.title||'<br><b>Description: </b>'||mc.description AS description,"
|
|
. " (CASE WHEN mc.status=4 THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs btn-block\" value=\"Review\">' "
|
|
. " WHEN mc.status = 1 AND mc.delivery_date > now() THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-success btn-xs btn-block\" value=\"View\">' "
|
|
. " WHEN mc.status = 1 AND mc.delivery_date <now() THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-warning btn-xs btn-block\" value=\"Past Due\">' "
|
|
. " ELSE '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs btn-block\" value=\"View\">' END) AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id "
|
|
. " WHERE mc.member_id = " . $_SESSION['member_id'] . " AND mc.status IN (1,2) "
|
|
. " AND mc.delivery_date < now() "
|
|
. " LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
|
|
$query = $this->db->query($mysql);
|
|
|
|
$data['ref_site'] = "/proj/active/$page";
|
|
|
|
$this->table->set_heading(array('data' => 'Job', 'style' => 'width:180px'), 'Title/Description', array('data' => '', 'style' => 'width:100px; cellpadding:0px;'));
|
|
$data['job_table'] = $this->table->generate($query);
|
|
$data["links"] = $this->pagination->create_links();
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_activejob', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
|
|
public function active() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
|
|
/* $data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
|
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
|
|
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
|
|
$data['email'] = $_SESSION['email']; // = $ret->email;
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email; */
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
|
|
$this->load->library('table');
|
|
|
|
$this->table->set_template($this->template);
|
|
|
|
$jbx = "''/proj/thisjob''";
|
|
|
|
|
|
$mysql = "SELECT '<b>Project ID:</b>'||mc.contract||'<br><b>Title:</b>'||mc.title AS Project,m.firstname||' '||m.lastname AS Client,"
|
|
. " '<b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 ,mc.description,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info\" value=\"Manage\">' AS manage,"
|
|
. " (CASE WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'Active' WHEN mc.status = 1 AND mc.delivery_date <now() THEN '<span class=\"label label-flat border-danger text-danger-600\">PastDue</span>' "
|
|
. " WHEN mc.status = 4 THEN 'Review' ELSE 'Not Set' END) AS status "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.member_id = " . $_SESSION['member_id'] . " "
|
|
. " AND mc.status IN (1,2,4) OR mc.client_id =" . $_SESSION['member_id'] . " "
|
|
. " AND mc.status IN (1,2,4) ";
|
|
|
|
$this->load->library('pagination');
|
|
$config = array();
|
|
$query = $this->db->query($mysql);
|
|
$config["total_rows"] = $query->num_rows();
|
|
$config["base_url"] = base_url() . "/proj/active";
|
|
$config["per_page"] = 5;
|
|
$config["uri_segment"] = 3;
|
|
$config["num_links"] = 5;
|
|
|
|
$config['full_tag_open'] = "<ul class='pagination'>";
|
|
$config['full_tag_close'] = "</ul>";
|
|
$config['num_tag_open'] = '<li>';
|
|
$config['num_tag_close'] = '</li>';
|
|
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
|
|
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
|
|
$config['next_tag_open'] = "<li>";
|
|
$config['next_tagl_close'] = "</li>";
|
|
$config['prev_tag_open'] = "<li>";
|
|
$config['prev_tagl_close'] = "</li>";
|
|
$config['first_tag_open'] = "<li>";
|
|
$config['first_tagl_close'] = "</li>";
|
|
$config['last_tag_open'] = "<li>";
|
|
$config['last_tagl_close'] = "</li>";
|
|
|
|
$this->pagination->initialize($config);
|
|
|
|
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
|
|
|
|
$page = is_numeric($page) ? $page : 0;
|
|
|
|
|
|
|
|
$mysql = "SELECT '<b>ID:</b>'||mc.contract||'<br><b>Timeline:</b>'||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " '<b>Title: </b>'||mc.title||'<br><b>Description: </b>'||mc.description AS description,"
|
|
. " (CASE WHEN mc.status=4 THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs btn-block\" value=\"Review\">' "
|
|
. " WHEN mc.status = 1 AND mc.delivery_date > now() THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-success btn-xs btn-block\" value=\"View\">' "
|
|
. " WHEN mc.status = 1 AND mc.delivery_date <now() THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-warning btn-xs btn-block\" value=\"Past Due\">' "
|
|
. "ELSE '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs btn-block\" value=\"View\">' END) AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.member_id = " . $_SESSION['member_id'] . " AND mc.status IN (1,2,4) OR mc.client_id =" . $_SESSION['member_id'] . " AND mc.status IN (1,2,4) LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
$mysql = "SELECT '<b>ID:</b><a href=\"#\" onclick=\"showJobModal('''||mc.contract||''');\" >'||mc.contract||'</a><br><b>Timeline:</b>'||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " '<b>Title: </b>'||mc.title||'<br><b>Description: </b>'||mc.description AS description,"
|
|
. " (CASE WHEN mc.status=4 THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs btn-block\" value=\"Review\">' "
|
|
. " WHEN mc.status = 1 AND mc.delivery_date > now() THEN '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-success btn-xs btn-block\" value=\"View\">' "
|
|
. " WHEN mc.status = 1 AND mc.delivery_date <now() THEN '<span class=\"label label-flat border-danger text-danger-600\">PastDue</span>' "
|
|
. "ELSE '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs btn-block\" value=\"View\">' END) AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.member_id = " . $_SESSION['member_id'] . " AND mc.status IN (1,2,4) OR mc.client_id =" . $_SESSION['member_id'] . " AND mc.status IN (1,2,4) LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
|
|
$query = $this->db->query($mysql);
|
|
|
|
$data['ref_site'] = "/proj/active/$page";
|
|
|
|
|
|
$data['job_table'] = $this->table->generate($query);
|
|
$this->table->set_heading(array('data' => 'Job', 'style' => 'width:180px'), 'Title/Description', array('data' => '', 'style' => 'width:100px; cellpadding:0px;'));
|
|
//$this->table->set_heading('Job', 'Description', '');
|
|
$data['job_table'] = $this->table->generate($query);
|
|
$data["links"] = $this->pagination->create_links();
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_activejob', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
|
|
public function thisjobfiles() {
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
echo "Denied...";
|
|
return;
|
|
}
|
|
$jobID = $this->input->get('jobID');
|
|
|
|
$data['jobID'] = $jobID;
|
|
|
|
$mybalance = 10666;
|
|
$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->model('backend_model');
|
|
|
|
$data = $this->load_files($data, $jobID);
|
|
|
|
//echo $this->messageAccordion($data['message_result']); the loadfile will handle this call
|
|
|
|
echo $data['message_result_show'];
|
|
//echo $data['message_table'];
|
|
}
|
|
|
|
|
|
private function messageAccordion($message_result) {
|
|
|
|
$msgA = "<div class=\"panel-group\" id=\"accordion\">";
|
|
|
|
$ii = 0;
|
|
foreach ($message_result as $row) {
|
|
$ii++;
|
|
$clin = "";
|
|
if ($ii == 1) {
|
|
$clin = "in";
|
|
}
|
|
// echo $row->title;
|
|
// echo $row->name;
|
|
// echo $row->body;
|
|
$callapseName = "collapseP" . $ii;
|
|
|
|
$msgA .="<div class='panel panel-default'>
|
|
<div class='panel-heading'>
|
|
<h5 class='panel-title'>
|
|
<a data-toggle='collapse' data-parent='#accordion' href='#" . $callapseName . "'>" . $row->title . "-".$row->date1." </a>
|
|
</h5>
|
|
</div>
|
|
<div id='" . $callapseName . "' class='panel-collapse collapse' " . $clin . " >
|
|
<div class='panel-body'>
|
|
<p>" . $row->msg . "</p>
|
|
</div>
|
|
</div>
|
|
</div>";
|
|
}
|
|
|
|
$msgA .="</div>";
|
|
return $msgA;
|
|
}
|
|
|
|
public function latejob() {
|
|
// echo 'oooooooooooooooooooooooooo';
|
|
// $data['redirect_to'] = str_replace(base_url(),'',$_SERVER['HTTP_REFERER']);
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
$data['redirect_to'] = '/proj/pastdue/';
|
|
|
|
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
$message = "";
|
|
|
|
$ajax = $this->input->post('ajax');
|
|
$jobID = $this->input->post('jobID');
|
|
|
|
$data['jobID'] = $jobID;
|
|
|
|
//$mybalance = 10666;
|
|
//$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->model('backend_model');
|
|
|
|
if ($_POST && !isset($_POST['uploadForm'])) {
|
|
$msgArray = array();
|
|
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
|
$msgArray['contract'] = $this->input->post('contractId');
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
if ($msgArray['message'] != '') { // NOTE THAT IT msg_type is IMPORTTANT
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['action'] = WRENCHBOARD_CONTRACT_MESSAGE;
|
|
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($msgArray, $out);
|
|
// print_r( $out );
|
|
}
|
|
} else if ($_POST && isset($_POST['uploadForm']) && isset($_FILES["fileToUpload"])) {
|
|
$message = $this->process_files($_FILES["fileToUpload"]);
|
|
}
|
|
|
|
$data = $this->load_files($data, $jobID);
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
$data['message'] = $message;
|
|
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = false;
|
|
|
|
$data['disabled1'] = 'disabled';
|
|
$data['disabled2'] = 'disabled';
|
|
|
|
$data['disabled11'] = 'disabled';
|
|
$data['disabled22'] = 'disabled';
|
|
/*
|
|
$data['job_status'] = $jbD1->status;
|
|
$data['job_member_id'] = $jbD1->member_id;
|
|
$data['job_client_id'] = $jbD1->client_id;
|
|
*/
|
|
|
|
if ($data['job_member_id'] == $_SESSION['member_id']) {
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = true;
|
|
if ( $data["job_status"] == 1 or $data["job_status"] == 2 ) {
|
|
$data['disabled11'] = '';
|
|
$data['disabled22'] = '';
|
|
}
|
|
}
|
|
|
|
if ($ajax == 1) {
|
|
echo $res;
|
|
} else {
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_latejob', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function thisjob() {
|
|
// echo 'oooooooooooooooooooooooooo';
|
|
// $data['redirect_to'] = str_replace(base_url(),'',$_SERVER['HTTP_REFERER']);
|
|
$data = $this->getSessionArray();
|
|
$data['redirect_to'] = '/proj/active/';
|
|
|
|
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
$message = "";
|
|
|
|
|
|
$ajax = $this->input->post('ajax');
|
|
$jobID = $this->input->post('jobID');
|
|
|
|
$data['jobID'] = $jobID;
|
|
|
|
//$mybalance = 10666;
|
|
//$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->model('backend_model');
|
|
|
|
if ($_POST && !isset($_POST['uploadForm'])) {
|
|
$msgArray = array();
|
|
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
|
$msgArray['contract'] = $this->input->post('contractId');
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
if ($msgArray['message'] != '') { // NOTE THAT IT msg_type is IMPORTTANT
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['action'] = WRENCHBOARD_CONTRACT_MESSAGE;
|
|
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($msgArray, $out);
|
|
// print_r( $out );
|
|
}
|
|
} else if ($_POST && isset($_POST['uploadForm']) && isset($_FILES["fileToUpload"])) {
|
|
$message = $this->process_files($_FILES["fileToUpload"]);
|
|
}
|
|
|
|
$data = $this->load_files($data, $jobID);
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
$data['message'] = $message;
|
|
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = false;
|
|
|
|
$data['disabled1'] = 'disabled';
|
|
$data['disabled2'] = 'disabled';
|
|
|
|
$data['disabled11'] = 'disabled';
|
|
$data['disabled22'] = 'disabled';
|
|
/*
|
|
$data['job_status'] = $jbD1->status;
|
|
$data['job_member_id'] = $jbD1->member_id;
|
|
$data['job_client_id'] = $jbD1->client_id;
|
|
*/
|
|
if ($data['job_member_id'] == $_SESSION['member_id']) {
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = true;
|
|
if ($data["job_status"] == CONTRACT_NOTIFY_COMPLETE) {
|
|
$data['disabled11'] = '';
|
|
$data['disabled22'] = '';
|
|
}
|
|
} else {
|
|
$data['this_is_client'] = true;
|
|
$data['this_is_project_owner'] = false;
|
|
if ($data["job_status"] == 1 and $data['force_wait'] == false) {
|
|
|
|
$data['disabled1'] = '';
|
|
$data['disabled2'] = '';
|
|
}
|
|
}
|
|
|
|
if ($ajax == 1) {
|
|
echo $res;
|
|
} else {
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_thisjob', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function mycompltjob() {
|
|
// echo 'oooooooooooooooooooooooooo';
|
|
$data = $this->getSessionArray();
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
$message = "";
|
|
|
|
$ajax = $this->input->post('ajax');
|
|
$jobID = $this->input->post('jobID');
|
|
|
|
$data['jobID'] = $jobID;
|
|
|
|
$mybalance = 10666;
|
|
$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->model('backend_model');
|
|
|
|
$data = $this->load_files($data, $jobID);
|
|
|
|
if ($_POST && !isset($_POST['uploadForm'])) {
|
|
$msgArray = array();
|
|
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
|
$msgArray['contract'] = $this->input->post('contractId');
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
if ($msgArray['message'] != '') { // NOTE THAT IT msg_type is IMPORTTANT
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['action'] = WRENCHBOARD_CONTRACT_MESSAGE;
|
|
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($msgArray, $out);
|
|
// print_r( $out );
|
|
}
|
|
} else if ($_POST && isset($_POST['uploadForm']) && isset($_FILES["fileToUpload"])) {
|
|
$message = $this->process_files($_FILES["fileToUpload"]);
|
|
}
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
$data['message'] = $message;
|
|
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = false;
|
|
|
|
$data['disabled1'] = 'disabled';
|
|
$data['disabled2'] = 'disabled';
|
|
|
|
$data['disabled11'] = 'disabled';
|
|
$data['disabled22'] = 'disabled';
|
|
/*
|
|
$data['job_status'] = $jbD1->status;
|
|
$data['job_member_id'] = $jbD1->member_id;
|
|
$data['job_client_id'] = $jbD1->client_id;
|
|
*/
|
|
if ($data['job_member_id'] == $_SESSION['member_id']) {
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = true;
|
|
if ($data["job_status"] == CONTRACT_NOTIFY_COMPLETE) {
|
|
$data['disabled11'] = '';
|
|
$data['disabled22'] = '';
|
|
}
|
|
} else {
|
|
$data['this_is_client'] = true;
|
|
$data['this_is_project_owner'] = false;
|
|
if ($data["job_status"] == 1 and $data['force_wait'] == false) {
|
|
|
|
$data['disabled1'] = '';
|
|
$data['disabled2'] = '';
|
|
}
|
|
}
|
|
|
|
if ($ajax == 1) {
|
|
echo $res;
|
|
} else {
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_view_mycomplj', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function compltjob() {
|
|
// echo 'oooooooooooooooooooooooooo';
|
|
$data = $this->getSessionArray();
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
$message = "";
|
|
|
|
$ajax = $this->input->post('ajax');
|
|
$jobID = $this->input->post('jobID');
|
|
|
|
$data['jobID'] = $jobID;
|
|
|
|
$mybalance = 10666;
|
|
$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->model('backend_model');
|
|
|
|
$data = $this->load_files($data, $jobID);
|
|
|
|
if ($_POST && !isset($_POST['uploadForm'])) {
|
|
$msgArray = array();
|
|
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
|
$msgArray['contract'] = $this->input->post('contractId');
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
if ($msgArray['message'] != '') { // NOTE THAT IT msg_type is IMPORTTANT
|
|
$msgArray['msg_type'] = 'TEXT';
|
|
$msgArray['action'] = WRENCHBOARD_CONTRACT_MESSAGE;
|
|
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($msgArray, $out);
|
|
// print_r( $out );
|
|
}
|
|
} else if ($_POST && isset($_POST['uploadForm']) && isset($_FILES["fileToUpload"])) {
|
|
$message = $this->process_files($_FILES["fileToUpload"]);
|
|
}
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
$data['message'] = $message;
|
|
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = false;
|
|
|
|
$data['disabled1'] = 'disabled';
|
|
$data['disabled2'] = 'disabled';
|
|
|
|
$data['disabled11'] = 'disabled';
|
|
$data['disabled22'] = 'disabled';
|
|
/*
|
|
$data['job_status'] = $jbD1->status;
|
|
$data['job_member_id'] = $jbD1->member_id;
|
|
$data['job_client_id'] = $jbD1->client_id;
|
|
*/
|
|
if ($data['job_member_id'] == $_SESSION['member_id']) {
|
|
$data['this_is_client'] = false;
|
|
$data['this_is_project_owner'] = true;
|
|
if ($data["job_status"] == CONTRACT_NOTIFY_COMPLETE) {
|
|
$data['disabled11'] = '';
|
|
$data['disabled22'] = '';
|
|
}
|
|
} else {
|
|
$data['this_is_client'] = true;
|
|
$data['this_is_project_owner'] = false;
|
|
if ($data["job_status"] == 1 and $data['force_wait'] == false) {
|
|
|
|
$data['disabled1'] = '';
|
|
$data['disabled2'] = '';
|
|
}
|
|
}
|
|
|
|
if ($ajax == 1) {
|
|
echo $res;
|
|
} else {
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_view_complj', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
private function load_files($data, $jobID) {
|
|
|
|
$data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
|
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
|
|
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
|
|
$data['email'] = $_SESSION['email']; // = $ret->email;
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
//$detail_button = " '<button type=\"button\" class=\"btn btn-primary btn-xs\" data-toggle=\"modal\" data-target=\"#modal_theme_primary\">Delvery Detail<i class=\"icon-play3 position-right\"></i></button>' ";
|
|
|
|
$detail_button =" '<a href=\"#\" onclick=\"showJobModal('''||mc.contract||''');\" >Delivery Detail</a>' ";
|
|
//$detail_button = " '<a href=\"#modal_theme_primary\" class=\"label label-flat border-primary text-primary-600\" data-target=\"#modal_theme_primary\">Linked label</a>' "; // <button type=\"button\" class=\"btn btn-primary btn-xs\" data-toggle=\"modal\" data-target=\"#modal_theme_primary\">Delvery Detail<i class=\"icon-play3 position-right\"></i></button>' ";
|
|
|
|
|
|
$is_live = $this->backend_model->cfgReadChar("system.live");
|
|
|
|
$this->load->library('table');
|
|
$this->table->set_template($this->template_nohead);
|
|
$jbx = "''thisjob''";
|
|
$mysql = "SELECT '<b>Project ID :</b>'||mc.contract||' - <b>Name: </b><a href=\"#\" onclick=\"showModal('||m.id||');\" >'||m.firstname||'</a><br><b>Title:</b>'||mc.title||'<br>'||'<b>Description: </b>'||mc.description||'<br><b>Timeline: </b> '||mc.timeline_days||' day(s) <b>Price: </b>'||mc.price*0.01||'Naira'||' <b>Expected Delivery: </b>'||mc.delivery_date||' '||$detail_button AS this_job,"
|
|
. " mc.contract AS contract_id, mc.job_detail AS job_detail "
|
|
. "FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE (mc.member_id = " . $_SESSION['member_id'] . " OR mc.client_id=" . $_SESSION['member_id'] . ") AND mc.id=" . $jobID;
|
|
$query = $this->db->query($mysql);
|
|
$jbD = $query->row();
|
|
|
|
// $this->table->set_heading('Job', 'Client', 'Terms', 'Price', 'Manage', 'Status');
|
|
$data['job_table'] = $this->table->generate($query);
|
|
$data['this_job'] = $jbD->this_job;
|
|
$data['contract_id'] = $jbD->contract_id;
|
|
$data['job_detail'] = $jbD->job_detail;
|
|
|
|
$sqlMsg = "SELECT (CASE WHEN jc.msg_type='FILE' THEN '<a target=\"_blank\" href=\"/smedia/" . ($is_live ? "LIVE" : "TEST") . "/contract/" . $data['contract_id'] . "/'||jc.message||'\">'||jc.message||'</a>' ELSE '<b>['||m.firstname||']->'||jc.created||'</b><br>'||jc.message END) AS msg "
|
|
. "FROM jobs_contract_message jc "
|
|
. "LEFT JOIN members m ON m.id=jc.member_id "
|
|
. "WHERE jc.contract='" . $data['contract_id'] . "' ORDER by jc.id DESC";
|
|
|
|
|
|
|
|
|
|
|
|
$sqlMsg = "SELECT to_char(jc.created, 'YYYY-MM-DD HH24:MI') AS date1, '<b>'||(CASE WHEN jc.msg_type='FILE' THEN 'FILE' ELSE '' END) ||'</b>'||m.firstname AS title,"
|
|
. "(CASE WHEN jc.msg_type='FILE' THEN '<a target=\"_blank\" href=\"/smedia/" . ($is_live ? "LIVE" : "TEST") . "/contract/" . $data['contract_id'] . "/'||jc.message||'\">'||jc.message||'</a>' ELSE jc.message END) AS msg "
|
|
. "FROM jobs_contract_message jc "
|
|
. "LEFT JOIN members m ON m.id=jc.member_id "
|
|
. "WHERE jc.contract='" . $data['contract_id'] . "' ORDER by jc.id DESC";
|
|
|
|
|
|
$query_message = $this->db->query($sqlMsg);
|
|
|
|
//ABOUT TO BE RETIRED
|
|
$this->table->set_template($this->template_nohead);
|
|
$this->table->set_heading('');
|
|
$data['message_table'] = $this->table->generate($query_message);
|
|
//===================
|
|
|
|
$data['message_result'] = $query_message->result();
|
|
|
|
$data['message_result_show'] = $this->messageAccordion($data['message_result']);
|
|
|
|
|
|
$mysql3 = "SELECT *,(delivery_date::date- now()::date)::int AS remaining_days FROM members_jobs_contract WHERE id= " . $jobID;
|
|
$query3 = $this->db->query($mysql3);
|
|
$jbD1 = $query3->row();
|
|
$data['job_status'] = $jbD1->status;
|
|
$data['job_member_id'] = $jbD1->member_id;
|
|
$data['job_client_id'] = $jbD1->client_id;
|
|
$data['job_contract'] = $jbD1->contract;
|
|
$data['timeline_days'] = $jbD1->timeline_days;
|
|
$data['remaining_days'] = $jbD1->remaining_days;
|
|
$data['force_wait'] = false;
|
|
if ($data['remaining_days'] > 0) {
|
|
if ($data['timeline_days'] / 2 < $data['remaining_days']) {
|
|
$data['force_wait'] = true;
|
|
}
|
|
//lef us use just one day
|
|
if ($data['timeline_days'] - $data['remaining_days'] > 1) {
|
|
$data['force_wait'] = false;
|
|
}
|
|
}
|
|
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function processjob_status() {
|
|
|
|
$out = array();
|
|
$out["result"] = '';
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
$data['proc'] = $this->input->get('proc');
|
|
$data['job_id'] = $this->input->get('jobID');
|
|
$data['job_contract'] = $this->input->get('job_contract');
|
|
|
|
$mysql = "SELECT * FROM members_jobs_contract WHERE contract ='" . $data['job_contract'] . "' AND id =" . $data['job_id'];
|
|
$query = $this->db->query($mysql);
|
|
$jbD = $query->row();
|
|
|
|
$data['job_action'] = 0;
|
|
switch ($data['proc']) {
|
|
case 'NCOMPLETE':
|
|
$data['job_action'] = CONTRACT_NOTIFY_COMPLETE;
|
|
break;
|
|
case 'REQCANCEL':
|
|
$data['job_action'] = CONTRACT_REQUEST_CANCEL;
|
|
break;
|
|
case 'ACCEPTCMP':
|
|
$data['job_action'] = CONTRACT_ACCEPT_COMPLETE;
|
|
break;
|
|
case 'REJECTCMP':
|
|
$data['job_action'] = CONTRACT_REJECT_COMPLETE;
|
|
break;
|
|
case 'EXTENDLATE':
|
|
$data['extension'] = $this->input->get('extension');
|
|
$data['job_action'] = CONTRACT_EXTEND_TIMELINE;
|
|
break;
|
|
case 'REQCANCELLATE':
|
|
$data['job_action'] = CONTRACT_CANCEL_CONTRACT;
|
|
break;
|
|
}
|
|
|
|
$this->load->model('backend_model');
|
|
$data['action'] = WRENCHBOARD_CONTRACT_STATUS;
|
|
$res = $this->backend_model->wrenchboard_api($data, $out);
|
|
echo $out["result"];
|
|
|
|
/*
|
|
* Array ( [proc] => ACCEPTCMP [job_id] => 13 [job_contract] => 7BW9B9R8BB ) ameye
|
|
*
|
|
*
|
|
*
|
|
* define('CONTRACT_CANCEL_CONTRACT', 7 );
|
|
* define('CONTRACT_EXTEND_TIMELINE', 9 );
|
|
* define('CONTRACT_NOTIFY_COMPLETE', 4 );
|
|
define('CONTRACT_REQUEST_CANCEL', 3 );
|
|
define('CONTRACT_ACCEPT_COMPLETE', 5 );
|
|
define('CONTRACT_REJECT_COMPLETE', 1 );
|
|
*
|
|
proc=NCOMPLETE&
|
|
proc=REQCANCEL&
|
|
proc=ACCEPTCMP&
|
|
proc=REJECTCMP&
|
|
*/
|
|
// print_r($data);
|
|
|
|
}
|
|
|
|
public function complete() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
|
|
|
|
$data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
|
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
|
|
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
|
|
$data['email'] = $_SESSION['email']; // = $ret->email;
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
$mybalance = 10666;
|
|
$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->library('table');
|
|
|
|
|
|
|
|
|
|
$this->table->set_template($this->template);
|
|
|
|
$jbx = "''/proj/compltjob''";
|
|
|
|
$mysql = "SELECT '<b>Project:</b>'||mc.contract||'<br><b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " "
|
|
. " '<b>Title:</b>'||mc.title||'<br><b>Description:</b>'||mc.description,"
|
|
. " ( CASE WHEN mc.status=5 THEN 'Completed' Else '' END) AS status,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info\" value=\"View\">' AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.status=5 AND mc.member_id = " . $_SESSION['member_id'];
|
|
|
|
$mysql = "SELECT '<b>Date:</b>'||mc.created::date||'<br><b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " "
|
|
. " '<b>Project:</b>'||mc.contract||'-'||m.firstname||'<br><b>Title:</b>'||mc.title||'<br><b>Description:</b>'||mc.description,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs\" value=\"View\">' AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.status=5 AND mc.member_id = " . $_SESSION['member_id'];
|
|
$query = $this->db->query($mysql);
|
|
$this->load->library('pagination');
|
|
$config = array();
|
|
$query = $this->db->query($mysql);
|
|
$config["total_rows"] = $query->num_rows();
|
|
$config["base_url"] = base_url() . "/proj/complete";
|
|
$config["per_page"] = 5;
|
|
$config["uri_segment"] = 3;
|
|
$config["num_links"] = 5;
|
|
|
|
$config['full_tag_open'] = "<ul class='pagination'>";
|
|
$config['full_tag_close'] = "</ul>";
|
|
$config['num_tag_open'] = '<li>';
|
|
$config['num_tag_close'] = '</li>';
|
|
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
|
|
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
|
|
$config['next_tag_open'] = "<li>";
|
|
$config['next_tagl_close'] = "</li>";
|
|
$config['prev_tag_open'] = "<li>";
|
|
$config['prev_tagl_close'] = "</li>";
|
|
$config['first_tag_open'] = "<li>";
|
|
$config['first_tagl_close'] = "</li>";
|
|
$config['last_tag_open'] = "<li>";
|
|
$config['last_tagl_close'] = "</li>";
|
|
|
|
$this->pagination->initialize($config);
|
|
|
|
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
|
|
|
|
$page = is_numeric($page) ? $page : 0;
|
|
|
|
$mysql = "SELECT '<b>Date:</b>'||mc.created::date||'<br><b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " "
|
|
. " '<b>Project:</b>'||mc.contract||' by <a href=\"#\"><span class=\"label label-info\">'||m.firstname||'</span></a><br><b>Title:</b>'||mc.title||'<br><b>Description:</b>'||mc.description,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs\" value=\"View\">' AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.status=5 AND mc.member_id = " . $_SESSION['member_id'] . " ORDER BY mc.created DESC LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
|
|
// LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
|
|
|
|
|
|
|
|
$query = $this->db->query($mysql);
|
|
|
|
//array('data' => 'Job', 'style' => 'width:120px')
|
|
|
|
$this->table->set_heading(array('data' => 'Job', 'style' => 'width:180px'), 'Title/Description', array('data' => 'View', 'style' => 'width:40px; cellpadding:0px;'));
|
|
$data['job_table'] = $this->table->generate($query);
|
|
$data["links"] = $this->pagination->create_links();
|
|
|
|
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
|
|
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_completejob', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
|
|
public function mycomplete() {
|
|
|
|
$data = $this->getSessionArray();
|
|
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
|
|
|
|
$data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
|
$data['name'] = $_SESSION['name']; // = $this->input->post('username');
|
|
$data['firstname'] = $_SESSION['firstname']; // = $ret->firstname;
|
|
$data['lastname'] = $_SESSION['lastname']; // = $ret->lastname;
|
|
$data['email'] = $_SESSION['email']; // = $ret->email;
|
|
$data['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
|
|
$mybalance = 10666;
|
|
$data['mybalance'] = $mybalance;
|
|
|
|
$this->load->library('table');
|
|
|
|
|
|
|
|
|
|
$this->table->set_template($this->template);
|
|
|
|
$jbx = "''/proj/mycompltjob''";
|
|
|
|
$mysql = "SELECT '<b>Project:</b>'||mc.contract||'<br><b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " "
|
|
. " '<b>Title:</b>'||mc.title||'<br><b>Description:</b>'||mc.description,"
|
|
. " ( CASE WHEN mc.status=5 THEN 'Completed' Else '' END) AS status,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info\" value=\"View\">' AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.status=5 AND mc.member_id = " . $_SESSION['member_id'];
|
|
|
|
$mysql = "SELECT '<b>Date:</b>'||mc.created::date||'<br><b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " "
|
|
. " '<b>Project:</b>'||mc.contract||'-'||m.firstname||'<br><b>Title:</b>'||mc.title||'<br><b>Description:</b>'||mc.description,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs\" value=\"View\">' AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.status=5 AND mc.client_id = " . $_SESSION['member_id'];
|
|
$query = $this->db->query($mysql);
|
|
$this->load->library('pagination');
|
|
$config = array();
|
|
$query = $this->db->query($mysql);
|
|
$config["total_rows"] = $query->num_rows();
|
|
$config["base_url"] = base_url() . "/proj/mycomplete";
|
|
$config["per_page"] = 5;
|
|
$config["uri_segment"] = 3;
|
|
$config["num_links"] = 5;
|
|
|
|
$config['full_tag_open'] = "<ul class='pagination'>";
|
|
$config['full_tag_close'] = "</ul>";
|
|
$config['num_tag_open'] = '<li>';
|
|
$config['num_tag_close'] = '</li>';
|
|
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
|
|
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
|
|
$config['next_tag_open'] = "<li>";
|
|
$config['next_tagl_close'] = "</li>";
|
|
$config['prev_tag_open'] = "<li>";
|
|
$config['prev_tagl_close'] = "</li>";
|
|
$config['first_tag_open'] = "<li>";
|
|
$config['first_tagl_close'] = "</li>";
|
|
$config['last_tag_open'] = "<li>";
|
|
$config['last_tagl_close'] = "</li>";
|
|
|
|
$this->pagination->initialize($config);
|
|
|
|
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
|
|
|
|
$page = is_numeric($page) ? $page : 0;
|
|
|
|
$mysql = "SELECT '<b>Date:</b>'||mc.created::date||'<br><b>Timeline:</b> '||mc.timeline_days||' day(s)<br><b>Price:</b>'||mc.price*0.01 AS Project,"
|
|
. " "
|
|
. " '<b>Project:</b>'||mc.contract||' by <a href=\"#\"><span class=\"label label-info\">'||m.firstname||'</span></a><br><b>Title:</b>'||mc.title||'<br><b>Description:</b>'||mc.description,"
|
|
. " '<input type=submit onclick=\"return post_nav_find_action($jbx, '||mc.id||')\" name=\"manage\" class=\"btn btn-info btn-xs\" value=\"View\">' AS manage "
|
|
. " FROM members_jobs_contract mc LEFT JOIN members m ON m.id=mc.client_id WHERE mc.status=5 AND mc.client_id = " . $_SESSION['member_id'] . " ORDER BY mc.created DESC LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
|
|
// LIMIT " . $config["per_page"] . " OFFSET " . $page;
|
|
|
|
|
|
$query = $this->db->query($mysql);
|
|
|
|
//array('data' => 'Job', 'style' => 'width:120px')
|
|
|
|
$this->table->set_heading(array('data' => 'Job', 'style' => 'width:180px'), 'Title/Description', array('data' => 'View', 'style' => 'width:40px; cellpadding:0px;'));
|
|
$data['job_table'] = $this->table->generate($query);
|
|
$data["links"] = $this->pagination->create_links();
|
|
|
|
|
|
|
|
$this->load->model('dash_model');
|
|
$out = $this->dash_model->getDashData($data);
|
|
$data['active_task'] = $out['active_task'];
|
|
$data['active_pass_due'] = $out['active_pass_due'];
|
|
$data['current_balance'] = $out['current_balance'];
|
|
$data['new_message'] = $out['new_message'];
|
|
|
|
|
|
|
|
$this->load->view('users/view_header_user', $data);
|
|
$this->load->view('jobs/view_mycompletejob', $data);
|
|
$this->load->view('users/view_footer_user', $data);
|
|
}
|
|
}
|
|
|
|
|
|
private function process_files($files) {
|
|
$result = "";
|
|
$d_txt = "";
|
|
$is_live = $this->backend_model->cfgReadChar("system.live");
|
|
if ($this->input->post('contractId') == "" || (int) $_SESSION['member_id'] < 1) {
|
|
$result = "Invalid contract or member ID";
|
|
} else if (is_array($files)) {
|
|
$target_dir = "/opt/wrenchboard/" . ($is_live ? "LIVE" : "TEST") . "/contract/" . $this->input->post('contractId');
|
|
if (!file_exists($target_dir)) {
|
|
@mkdir($target_dir, 0777, true);
|
|
}
|
|
$i = 0;
|
|
foreach ($files["name"] as $key => $name) {
|
|
if ($files["error"][$key] == 0) {
|
|
$target_file = $target_dir . "/" . $name;
|
|
if (move_uploaded_file($files["tmp_name"][$key], $target_file)) {
|
|
$msgArray['action'] = WRENCHBOARD_CONTRACT_MESSAGE;
|
|
$msgArray['message'] = $name;
|
|
$msgArray['contract'] = $this->input->post('contractId');
|
|
$msgArray['msg_type'] = 'FILE';
|
|
$msgArray['member_id'] = $_SESSION['member_id']; // = $ret->email;
|
|
$out = array();
|
|
$res = $this->backend_model->wrenchboard_api($msgArray, $out);
|
|
// print_r( $out );
|
|
$i++;
|
|
}
|
|
}
|
|
}
|
|
$result = $i > 0 ? "Uploaded file(s): ${i}" : "Failed to process uploaded files${d_txt}";
|
|
} else {
|
|
$result = "Files were not uploaded${d_txt}";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
}
|