| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class CustomersManagement extends MY_Controller {
function __construct()
{
parent::__construct();
$this->load->helper("url");
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('javascript');
$this->load->library('Ajax_pagination');
$this->perPage = ROW_PER_PAGE;
$this->load->model('customersmanagement_model');
$this->load->model('restaurantmanagement_model');
$this->load->model('dashboard_model');
$this->load->model('frontend_model');
$session_data = $this->session->userdata('logged_in');
//if(empty($session_data)) { redirect('superadmin', 'refresh'); }
if($this->session->userdata('user_language'))
{
$language = $this->session->userdata('user_language');
}
else
{
$language = $this->config->item("language");
}
$data['user_language'] = $language;
$this->lang->load('superAdmin', $language);
}
function index( $offset = 0 )
{
if ($this->input->server('REQUEST_METHOD') == 'POST')
{
if ($this->input->post('EditId') == '' && $this->input->post('AddEdit')) {
$this->addCustomer();
}
else if($this->input->post('EditId') != '' && $this->input->post('AddEdit')) {
$this->editCustomer();
}
if($this->input->post('ActionTab')=='SiteInfo')
{
$this->websettings_site();
}
if($this->input->post('ActionTab')=='SiteContact')
{
$this->websettings_contact();
}
if($this->input->post('ActionTab')=='SiteVAT')
{
$this->websettings_VAT();
}
if($this->input->post('ActionTab')=='SiteOffline')
{
$this->websettings_Offline();
}
if($this->input->post('ActionTab')=='SiteTwilio')
{
$this->websettings_Twilio();
}
if($this->input->post('ActionTab')=='SiteDocusign')
{
$this->websettings_DocuSign();
}
}else
{
$this->showCustomerList();
}
}
function showCustomerList() {
$SearchBy = '';
$PerPage = $this->input->post('Per_Page');
if(!$PerPage){
$PerPage = $this->perPage;
}else{
$PerPage = $PerPage;
}
//total rows count
$totalRec = count($this->customersmanagement_model->get_customer_list());
//pagination configuration
$config['target'] = '#postList';
$config['base_url'] = base_url().'customersmanagement/ajaxPaginationDataCustomer/'.$SearchBy;
$config['total_rows'] = $totalRec;
$config['per_page'] = $PerPage;
$this->ajax_pagination->initialize($config);
//get the posts data
$data['CustomerList'] = $this->customersmanagement_model->get_customer_list(array('limit'=>$PerPage), $SearchBy);
//$query['StateList'] =$this->dashboard_model->StateList();
$query['StateList'] = $this->frontend_model->StateList();
$query['CityList'] = $this->frontend_model->CityList();
#$query['CityList'] =$this->dashboard_model->GetCityByState($restaurant_state);
$query['RestaurantList'] = $this ->customersmanagement_model -> RestaurantList();
$data['title']="Customer List";
$query['SiteTab'] ='customer_list';
$data['page']="customer_list";
$this->load->view('superadmin/header',$data);
$this->load->view('superadmin/main-sidebar');
$this->load->view('superadmin/customer_list',$query);
$this->load->view('superadmin/footer');
}
function ajaxPaginationDataCustomer(){
$page = $this->input->post('page');
if(!$page){
$offset = 0;
}else{
$offset = $page;
}
$action = $this->input->post('action');
/*if(!$action){
$action = '';
}else{
$action = $action;
}*/
$perpage = $this->input->post('per_page');
if(!$perpage){
$perpage = $this->perPage;
}else{
$perpage = $perpage;
}
$action2 = $this->input->post('action2');
if(!$action2){
$action2 = '0';
}else{
$action2 = $action2;
}
//total rows count
$totalRec = count($this->customersmanagement_model->get_customer_list($params = array(), $action,$action2));
//pagination configuration
$config['target'] = '#postList';
$config['base_url'] = base_url().'customersmanagement/ajaxPaginationDataCustomer';
$config['total_rows'] = $totalRec;
$config['per_page'] = $perpage;
$config['action'] = $action;
$config['action2'] = $action2;
$this->ajax_pagination->initialize($config);
//get the posts data
$data['CustomerList'] = $this->customersmanagement_model->get_customer_list(array('start'=>$offset,'limit'=>$perpage),$action,$action2);
$data['title']="Customer List";
$query['SiteTab'] ='customer_list';
$data['page']="customer_list";
$data['perPageCount'] = $page;
/*** Remember what was the last page start ***/
if ($this->input->post('pagination') != '') {
$myPage = $this->input->post('page');
$myAction = $this->input->post('action');
$myPerPage = $this->input->post('per_page');
$myAction2 = $this->input->post('action2');
$paginationArray = array('page' => $myPage, 'action' => $myAction, 'per_page' => $myPerPage, 'action2' => $myAction2, 'page_name' => $data['page'], 'pagination' => $this->input->post('pagination'));
if ($this->session->userdata('paginationArray')) {
$this->session->unset_userdata('paginationArray');
}
$this->session->set_userdata('paginationArray', $paginationArray);
}
/*** Remember what was the last page end ***/
$this->load->view('superadmin/customer_list_ajax', $data, false);
}
function addCustomer() {
/*echo "<pre>";
print_r ($this->input->post());
echo "</pre>";
exit();*/
$now = date('Y-m-d H:i:s');
//$this->form_validation->set_rules('customer_email', 'Email', 'trim|required|is_unique[rt_customer.customer_email]');
$this->form_validation->set_rules('customer_email', 'Email', 'trim|required|callback_isEmailExist');
$this->form_validation->set_rules('customer_name', 'customer_name', 'trim|xss_clean');
$this->form_validation->set_rules('customer_lastname', 'customer_lastname', 'trim|xss_clean');
$this->form_validation->set_rules('customer_buildtype', 'customer_buildtype', 'trim|xss_clean');
$this->form_validation->set_rules('customer_street', 'customer_street', 'trim|xss_clean');
$this->form_validation->set_rules('customer_state', 'customer_state', 'trim|xss_clean');
$this->form_validation->set_rules('customer_city', 'customer_city', 'trim|xss_clean');
$this->form_validation->set_rules('customer_phone', 'customer_phone', 'trim|xss_clean');
$this->form_validation->set_rules('customer_landline', 'customer_landline', 'trim|xss_clean');
$this->form_validation->set_rules('customer_landmark', 'customer_landmark', 'trim|xss_clean');
$this->form_validation->set_rules('customer_addresslabel', 'customer_addresslabel', 'trim|xss_clean');
$this->form_validation->set_rules('customer_password', 'customer_password', 'trim|xss_clean');
if ($this->form_validation->run() == FALSE) {
$this->showCustomerList();
}
else {
$data_in = array(
'customer_name' => $this->input->post('customer_name'),
'customer_lastname' => $this->input->post('customer_lastname'),
'customer_buildtype' => $this->input->post('customer_buildtype'),
'customer_street' => $this->input->post('customer_street'),
'customer_state' => $this->input->post('customer_state'),
'customer_city' => $this->input->post('customer_city'),
'customer_phone' => $this->input->post('customer_phone'),
'customer_landline' => $this->input->post('customer_landline'),
'customer_landmark' => $this->input->post('customer_landmark'),
'customer_addresslabel' => $this->input->post('customer_addresslabel'),
'customer_email' => $this->input->post('customer_email'),
'customer_password' => md5($this->input->post('customer_password')),
'addeddate' => $now
);
$this->db->trans_start();
$this->db->insert('rt_customer', $data_in);
$this->db->trans_complete();
$this->session->set_flashdata('success_msg', 'Customer successfully saved');
redirect('superadmin/customersmanagement');
}
}
function editCustomer() {
$now = date('Y-m-d H:i:s');
$EditId = $this->input->post('EditId');
$this->form_validation->set_rules('customer_email', 'Email', 'trim|required|callback_isEmailExist');
$this->form_validation->set_rules('customer_name', 'customer_name', 'trim|xss_clean');
$this->form_validation->set_rules('customer_lastname', 'customer_lastname', 'trim|xss_clean');
$this->form_validation->set_rules('customer_buildtype', 'customer_buildtype', 'trim|xss_clean');
$this->form_validation->set_rules('customer_street', 'customer_street', 'trim|xss_clean');
$this->form_validation->set_rules('customer_state', 'customer_state', 'trim|xss_clean');
$this->form_validation->set_rules('customer_city', 'customer_city', 'trim|xss_clean');
$this->form_validation->set_rules('customer_phone', 'customer_phone', 'trim|xss_clean');
$this->form_validation->set_rules('customer_landline', 'customer_landline', 'trim|xss_clean');
$this->form_validation->set_rules('customer_landmark', 'customer_landmark', 'trim|xss_clean');
$this->form_validation->set_rules('customer_addresslabel', 'customer_addresslabel', 'trim|xss_clean');
$this->form_validation->set_rules('customer_password', 'customer_password', 'trim|xss_clean');
if ($this->form_validation->run() == FALSE) {
$this->showCustomerList();
}
else {
if ($this->input->post('customer_password') != '') {
$data_up = array(
'customer_name' => $this->input->post('customer_name'),
'customer_lastname' => $this->input->post('customer_lastname'),
'customer_buildtype' => $this->input->post('customer_buildtype'),
'customer_street' => $this->input->post('customer_street'),
'customer_state' => $this->input->post('customer_state'),
'customer_city' => $this->input->post('customer_city'),
'customer_phone' => $this->input->post('customer_phone'),
'customer_landline' => $this->input->post('customer_landline'),
'customer_landmark' => $this->input->post('customer_landmark'),
'customer_addresslabel' => $this->input->post('customer_addresslabel'),
'customer_email' => $this->input->post('customer_email'),
'customer_password' => md5($this->input->post('customer_password'))
);
}
else {
$data_up = array(
'customer_name' => $this->input->post('customer_name'),
'customer_lastname' => $this->input->post('customer_lastname'),
'customer_buildtype' => $this->input->post('customer_buildtype'),
'customer_street' => $this->input->post('customer_street'),
'customer_state' => $this->input->post('customer_state'),
'customer_city' => $this->input->post('customer_city'),
'customer_phone' => $this->input->post('customer_phone'),
'customer_landline' => $this->input->post('customer_landline'),
'customer_landmark' => $this->input->post('customer_landmark'),
'customer_addresslabel' => $this->input->post('customer_addresslabel'),
'customer_email' => $this->input->post('customer_email')
);
}
$this->db->trans_start();
$this->db->where('customer_id', $EditId);
$this->db->update('rt_customer', $data_up);
$this->db->trans_complete();
$this->session->set_flashdata('success_msg', 'Customer successfully updated');
redirect('superadmin/customersmanagement');
}
}
function isEmailExist() {
$customer_id = $this->input->post('EditId');
if ($customer_id == '') {
$customer_id = 0;
}
$customer_email = $this->input->post('customer_email');
$isEmailExist = $this->customersmanagement_model->isEmailExist($customer_id, $customer_email);
if ($isEmailExist) {
$this->form_validation->set_message('isEmailExist', 'Email already exist');
return false;
}
else {
return true;
}
}
function customerpayment()
{
$SearchBy = '';
$PerPage = $this->input->post('Per_Page');
if(!$PerPage){
$PerPage = $this->perPage;
}else{
$PerPage = $PerPage;
}
//total rows count
$totalRec = count($this->customersmanagement_model->get_customer_payment_list());
//pagination configuration
$config['target'] = '#postList';
$config['base_url'] = base_url().'customersmanagement/ajaxPaginationDataPaymet/'.$SearchBy;
$config['total_rows'] = $totalRec;
$config['per_page'] = $PerPage;
$this->ajax_pagination->initialize($config);
//get the posts data
$data['PaymentList'] = $this->customersmanagement_model->get_customer_payment_list(array('limit'=>$PerPage), $SearchBy);
$query['RestaurantList'] = $this ->restaurantmanagement_model-> RestaurantList();
$data['title']="Payment List";
$data['page']="paymet_list";
$query['SiteTab'] ='paymet_list';
$this->load->view('superadmin/header',$data);
$this->load->view('superadmin/main-sidebar');
$this->load->view('superadmin/customer_payment_list',$query);
$this->load->view('superadmin/footer');
}
function ajaxPaginationDataPaymet(){
$page = $this->input->post('page');
if(!$page){
$offset = 0;
}else{
$offset = $page;
}
$action = $this->input->post('action');
/*if(!$action){
$action = '';
}else{
$action = $action;
}*/
$perpage = $this->input->post('per_page');
if(!$perpage){
$perpage = $this->perPage;
}else{
$perpage = $perpage;
}
$action2 = $this->input->post('action2');
if(!$action2){
$action2 = '0';
}else{
$action2 = $action2;
}
//total rows count
$totalRec = count($this->customersmanagement_model->get_customer_payment_list());
//pagination configuration
$config['target'] = '#postList';
$config['base_url'] = base_url().'customersmanagement/ajaxPaginationDataPaymet';
$config['total_rows'] = $totalRec;
$config['per_page'] = $perpage;
$config['action'] = $action;
$config['action2'] = $action2;
$this->ajax_pagination->initialize($config);
//get the posts data
$data['PaymentList'] = $this->customersmanagement_model->get_customer_payment_list(array('start'=>$offset,'limit'=>$perpage),$action,$action2);
$data['title']="Payment List";
$data['page']="paymet_list";
$query['SiteTab'] ='paymet_list';
$data['perPageCount'] = $page;
/*** Remember what was the last page start ***/
if ($this->input->post('pagination') != '') {
$myPage = $this->input->post('page');
$myAction = $this->input->post('action');
$myPerPage = $this->input->post('per_page');
$myAction2 = $this->input->post('action2');
$paginationArray = array('page' => $myPage, 'action' => $myAction, 'per_page' => $myPerPage, 'action2' => $myAction2, 'page_name' => $data['page'], 'pagination' => $this->input->post('pagination'));
if ($this->session->userdata('paginationArray')) {
$this->session->unset_userdata('paginationArray');
}
$this->session->set_userdata('paginationArray', $paginationArray);
}
/*** Remember what was the last page end ***/
$this->load->view('superadmin/customer_payment_list_ajax', $data, false);
}
}