diff --git a/application/modules/Auth/views/login.php b/application/modules/Auth/views/login.php
index b554ba0..6bdf674 100644
--- a/application/modules/Auth/views/login.php
+++ b/application/modules/Auth/views/login.php
@@ -50,8 +50,8 @@
-
Create Account
-
+
diff --git a/application/modules/Auth/views/otp_verification.php b/application/modules/Auth/views/otp_verification.php
index b058e36..3b22d73 100644
--- a/application/modules/Auth/views/otp_verification.php
+++ b/application/modules/Auth/views/otp_verification.php
@@ -65,16 +65,16 @@
-
Already a member ?
+
-
Gentelella Alela!
-
©2016 All Rights Reserved. Gentelella Alela! is a Bootstrap 4 template. Privacy and Terms
+
diff --git a/application/modules/Business/controllers/Business.php b/application/modules/Business/controllers/Business.php
index 612ce43..acfc07a 100644
--- a/application/modules/Business/controllers/Business.php
+++ b/application/modules/Business/controllers/Business.php
@@ -88,6 +88,17 @@ public function create_business()
}
$create_business = $this->MY_Model->insert($data,$table);
+ // audit history
+ if($create_business)
+ {
+ //set id $ table name for audit history
+ $this->audit->set('id',$create_business);
+ $this->audit->set('table',$table);
+ //fetch new_data after post data insert
+ $this->audit->fetch('new_data');
+ //audit history generation for insert
+ $test = $this->audit->create_history('insert');
+ }
//print_r($create_business); die();
$create_business = 3;
if($add_admin == 1)
@@ -136,326 +147,40 @@ public function edit_business()
}
$table="business";
+ //set id $ table name for audit history
+ $this->audit->set('id',$this->input->post('id'));
+ $this->audit->set('table','business');
+ //fetch old_data before new_data update
+ $this->audit->fetch('old_data');
+ //insert new data
$assetData = $this->MY_Model->edit_option($action, $id, $table);
+ if($assetData)
+ {
+ //fetch new_data after post data update
+ $this->audit->fetch('new_data');
+ //audit history generation for update
+ $test = $this->audit->create_history('update');
+ }
if(is_superadmin()){ redirect('business/business_list');}
else if(is_admin()){ redirect('user/businessProfile/'.md5(user()->business_id)); }
}
- public function deleteAsset($id)
+ public function delete_business($id)
{
- $Data = $this->Asset_model->delete_by_md5_id($id,user()->business_id,'asset');
- redirect('asset/assetList');
+ $Data = $this->Business_model->delete_by_md5_id($id,user()->business_id,'asset');
+ redirect('business/business_list');
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public function view_asset_details($id)
- {
- $tab = $this->session->flashdata();
- // $tab = 1;
- //print_r($tab);die();
- // select asset value by id
- $table="asset";
- $assetData = $this->Asset_model->get_asset_by_md5_id($id,user()->business_id);
- // select asset sub values by id
- $asset_value = $this->Asset_model->get_by_asset_id($id,'asset_value',user()->business_id);
- $asset_usage = $this->Asset_model->get_by_asset_id($id,'asset_usage',user()->business_id);
- $asset_amc = $this->Asset_model->get_amc_with_join($id,user()->business_id);
- $asset_insurance = $this->Asset_model->get_insurance_with_join($id,user()->business_id);
- $asset_images = $this->Asset_model->get_by_asset_id($id,'asset_images',user()->business_id);
- $data = array('asset_id'=>$assetData->id,'asset_value' => $asset_value ,'asset_usage' => $asset_usage , 'asset_amc' =>$asset_amc ,'asset_insurance'=>$asset_insurance, 'asset_images'=>$asset_images,'tab'=>$tab);
- $sub_asset_value_htmlPage = $this->load->view('asset_sub_value_list.php',$data,true);
- $this->layout->set('sub_asset_value_htmlPage', $sub_asset_value_htmlPage);
- $this->layout->set('editData', $assetData);
- $this->layout->set('viewData', 1);
- $this->layout->buffer('main_content', 'Asset/edit_asset');
- $this->layout->render('default_layout');
-
- }
-
- // public function getAssetDetails($id)
- // {
- // $asset_value = $this->Asset_model->get_by_asset_id($id,'asset_value',user()->business_id);
- // $asset_usage = $this->Asset_model->get_by_asset_id($id,'asset_usage',user()->business_id);
- // $asset_amc = $this->Asset_model->get_by_asset_id($id,'amc',user()->business_id);
- // $data = array('asset_value' => $asset_value ,'asset_usage' => $asset_usage , 'asset_amc' =>$asset_amc);
-
- // $htmlPage = $this->load->view('asset_sub_value_list.php',$data,true);
- // echo json_encode($htmlPage);
- // }
-
-
-
- public function getAssetValueForm($id)
- {
-
- $split = preg_split('/_/', $id);
- if(count($split) > 1)
- {
- $data = array('asset_id'=> $split[0], 'heading'=>'Add Asset Values' , 'submit_button_title'=>'Submit');
- }else{
- $asset_value_data = $this->MY_Model->get_by_md5_id($id,'asset_value');
- $data = array('assetValueData'=>$asset_value_data ,'heading'=>'Edit Asset Values' , 'submit_button_title'=>'Update');
- }
-
- $htmlPage = $this->load->view('asset_value_form.php',$data,true);
- echo json_encode($htmlPage);
- }
-
-
-
- public function add_or_edit_asset_value()
- {
- if($this->input->post('id'))
- {
- $value = $this->input->post();
- unset($value['asset_id_for_add']);
- $editAssetValueData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'asset_value');
- //$this->view_asset_details(md5($this->input->post('asset_id')));
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
- }else{
- $data['asset_id'] = $this->input->post('asset_id_for_add');
- $data['business_id'] = user()->business_id;
- $data['type'] = $this->input->post('type');
- $data['name'] = $this->input->post('name');
- $data['value'] = $this->input->post('value');
- $data['percentage'] = $this->input->post('percentage');
- $data['description'] = $this->input->post('description');
- $data['created_by'] = user()->id;
- $createAssetValueData = $this->MY_Model->insert($data, 'asset_value');
- //$this->view_asset_details(md5($this->input->post('asset_id_for_add')));
- $this->session->set_flashdata(1);
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
- }
- }
-
-
-
-
- public function getAssetUsageForm($id)
- {
- $split = preg_split('/_/', $id);
-
- if(count($split) > 1)
- {
- $data = array('asset_id'=> $split[0], 'heading'=>'Add Asset Usage' , 'submit_button_title'=>'Submit');
- }else{
- $asset_usage_data = $this->MY_Model->get_by_md5_id($id,'asset_usage');
- $data = array('assetUsageData'=>$asset_usage_data ,'heading'=>'Edit Asset Usage' , 'submit_button_title'=>'Update');
- }
-
- $htmlPage = $this->load->view('asset_usage_form.php',$data,true);
- echo json_encode($htmlPage);
- }
-
- public function add_or_edit_asset_usage()
- {
- if($this->input->post('id'))
- {
- $value = $this->input->post();
- unset($value['asset_id_for_add']);
- $editAssetUsageData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'asset_usage');
- // $this->view_asset_details(md5($this->input->post('asset_id')));
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
- }else{
- $data['asset_id'] = $this->input->post('asset_id_for_add');
- $data['business_id'] = user()->business_id;
- $data['date_from'] = $this->input->post('date_from');
- $data['date_to'] = $this->input->post('date_to');
- $data['quater'] = $this->input->post('quater');
- $data['shift'] = $this->input->post('shift');
- $data['created_by'] = user()->id;
- $createAssetUsageData = $this->MY_Model->insert($data, 'asset_usage');
- //$this->view_asset_details(md5($this->input->post('asset_id_for_add')));
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
- }
- }
-
-
-
-
-
- public function getAssetAMCForm($id)
- {
- $split = preg_split('/_/', $id);
- $serviceProviderData = $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,3);
- if(count($split) > 1)
- {
- $data = array('asset_id'=> $split[0], 'serviceProviderData'=>$serviceProviderData, 'heading'=>'Add AMC' , 'submit_button_title'=>'Submit');
- }else{
- $asset_amc_data = $this->Asset_model->get_amc_by_id_with_join($id);
- $data = array('serviceProviderData'=>$serviceProviderData,'assetAMCData'=>$asset_amc_data ,'heading'=>'Edit AMC' , 'submit_button_title'=>'Update');
- }
-
- $htmlPage = $this->load->view('asset_amc_form.php',$data,true);
- echo json_encode($htmlPage);
- }
-
- public function add_or_edit_asset_amc()
- {
- if($this->input->post('id'))
- {
- $value = $this->input->post();
- unset($value['asset_id_for_add']);
- $editAMCData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'amc');
- //$this->view_asset_details(md5($this->input->post('asset_id')));
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
- }else{
- $data['asset_id'] = $this->input->post('asset_id_for_add');
- $data['business_id'] = user()->business_id;
- $data['service_provider'] = $this->input->post('service_provider');
- $data['cost'] = $this->input->post('cost');
- $data['description'] = $this->input->post('description');
- $data['valid_from'] = $this->input->post('valid_from');
- $data['valid_to'] = $this->input->post('valid_to');
- $data['created_by'] = user()->id;
- $data['type'] = 3; //(amc service provider type = 3 * in third_parties table)
- $createAMCData = $this->MY_Model->insert($data, 'amc');
- //$this->view_asset_details(md5($this->input->post('asset_id_for_add')));
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
- }
- }
-
-
-
-public function getAssetInsuranceForm($id)
- {
- $split = preg_split('/_/', $id);
- $insuranceData = $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,4);
- if(count($split) > 1)
- {
- $data = array('asset_id'=> $split[0], 'insuranceData'=>$insuranceData, 'heading'=>'Add AMC' , 'submit_button_title'=>'Submit');
- }else{
- $asset_insurance_data = $this->Asset_model->get_insurance_by_id_with_join($id);
- $data = array('insuranceData'=>$insuranceData,'assetInsuranceData'=>$asset_insurance_data ,'heading'=>'Edit AMC' , 'submit_button_title'=>'Update');
- }
-
- $htmlPage = $this->load->view('asset_insurance_form.php',$data,true);
- echo json_encode($htmlPage);
- }
-
-
-
-
- public function add_or_edit_asset_insurance()
- {
- if($this->input->post('id'))
- {
- $value = $this->input->post();
- unset($value['asset_id_for_add']);
- $editInsuranceData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'amc');
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
- }else{
- $data['asset_id'] = $this->input->post('asset_id_for_add');
- $data['business_id'] = user()->business_id;
- $data['insurance_company'] = $this->input->post('insurance_company');
- $data['cost'] = $this->input->post('cost');
- $data['description'] = $this->input->post('description');
- $data['valid_from'] = $this->input->post('valid_from');
- $data['valid_to'] = $this->input->post('valid_to');
- $data['created_by'] = user()->id;
- $data['type'] = 4; //(insurance company type = 4 * in third_parties table)
- $createInsuranceData = $this->MY_Model->insert($data, 'amc');
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
- }
- }
-
-
-
-
-
-
- public function getAssetImageForm($id)
- {
-
- $data = array('asset_id'=> $id, 'heading'=>'Add Image' , 'submit_button_title'=>'Submit');
- $htmlPage = $this->load->view('asset_image_form.php',$data,true);
- echo json_encode($htmlPage);
- }
-
- public function add_asset_image()
- {
-
- $data['business_id'] = user()->business_id;
- $data['created_by'] = user()->id;
- $data['asset_id'] = $this->input->post('asset_id');
-
- //file upload confic
- $asset_image['upload_path'] = APPPATH. '../assets/uploads/';
- $asset_image['allowed_types'] = 'gif|jpg|png';
- $asset_image['max_size'] = 80000;
- //upload
- $this->load->library('upload', $asset_image);
- $this->upload->initialize($asset_image);
- if ( ! $this->upload->do_upload('image'))
- {
- $error = array('error' => $this->upload->display_errors());
- } else{
- $upload_asset_image = $this->upload->data();
- $data['image'] = $upload_asset_image['file_name'];
- }
- //print_r($data);die();
- $table="asset_images";
- $create_assets = $this->MY_Model->insert($data,$table);
- redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
-
- }
-
- public function deleteAssetValue($id)
- {
- $split = preg_split('/_/', $id);
- $key = $split[0];
- $asset_id = $split[1];
- $Data = $this->Asset_model->delete_by_md5_id($key,user()->business_id,'asset_value');
- redirect('asset/view_asset_details/'.md5($asset_id));
- }
- public function deleteAssetUsage($id)
- {
- $split = preg_split('/_/', $id);
- $key = $split[0];
- $asset_id = $split[1];
- $Data = $this->Asset_model->delete_by_md5_id($key,user()->business_id,'asset_usage');
- redirect('asset/view_asset_details/'.md5($asset_id));
- }
- public function deleteAssetAMC($id)
- {
- $split = preg_split('/_/', $id);
- $key = $split[0];
- $asset_id = $split[1];
- $Data = $this->Asset_model->delete_by_md5_id($key,user()->business_id,'amc');
- redirect('asset/view_asset_details/'.md5($asset_id));
- }
- public function deleteAssetImage($id)
- {
- $split = preg_split('/_/', $id);
- $key = $split[0];
- $asset_id = $split[1];
- $Data = $this->Asset_model->delete_by_md5_id($key,user()->business_id,'asset_images');
- redirect('asset/view_asset_details/'.md5($asset_id));
- }
- public function deleteAssetInsurance($id)
- {
- $split = preg_split('/_/', $id);
- $key = $split[0];
- $asset_id = $split[1];
- $Data = $this->Asset_model->delete_by_md5_id($key,user()->business_id,'amc');
- redirect('asset/view_asset_details/'.md5($asset_id));
- }
-
-
-
-
}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/modules/User/controllers/User.php b/application/modules/User/controllers/User.php
index 8cc5691..8e33439 100644
--- a/application/modules/User/controllers/User.php
+++ b/application/modules/User/controllers/User.php
@@ -78,6 +78,17 @@ public function createUser()
$data['password'] = hash_password($this->input->post('password'));
$table="users";
$create_user = $this->MY_Model->insert($data,$table);
+ //audit
+ if($create_user)
+ {
+ //set id $ table name for audit history
+ $this->audit->set('id',$create_user);
+ $this->audit->set('table',$table);
+ //fetch new_data after post data insert
+ $this->audit->fetch('new_data');
+ //audit history generation for insert
+ $test = $this->audit->create_history('insert');
+ }
redirect('user/userList');
}
@@ -100,7 +111,21 @@ public function editUsers()
$action = $this->input->post();
$id = $this->input->post('id');
+ //set id $ table name for audit history
+ $this->audit->set('id',$this->input->post('id'));
+ $this->audit->set('table','users');
+ //fetch old_data before new_data update
+ $this->audit->fetch('old_data');
+ //update new data
$userData = $this->MY_Model->edit_option($action, $id, $table);
+ if($userData)
+ {
+ //fetch new_data after post data update
+ $this->audit->fetch('new_data');
+ //audit history generation for update
+ $test = $this->audit->create_history('update');
+ print_r( $test);die();
+ }
redirect('user/userList');
}