GWM
This commit is contained in:
parent
91173c7cbd
commit
c8e06b4fc2
@ -264,8 +264,23 @@ public function add_or_edit_asset_value()
|
||||
{
|
||||
$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')));
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','asset_value');
|
||||
//fetch old_data before new_data update
|
||||
$this->audit->fetch('old_data');
|
||||
//update asset value
|
||||
$editAssetValueData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'asset_value');
|
||||
if($editAssetValueData)
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
|
||||
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
|
||||
}else{
|
||||
$data['asset_id'] = $this->input->post('asset_id_for_add');
|
||||
@ -277,7 +292,16 @@ public function add_or_edit_asset_value()
|
||||
$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')));
|
||||
if($createAssetValueData)
|
||||
{
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$createAssetValueData);
|
||||
$this->audit->set('table','asset_value');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
$this->session->set_flashdata(1);
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
|
||||
}
|
||||
@ -302,14 +326,28 @@ public function getAssetUsageForm($id)
|
||||
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')));
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','asset_usage');
|
||||
//fetch old_data before new_data update
|
||||
$this->audit->fetch('old_data');
|
||||
//update asset value
|
||||
$editAssetUsageData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'asset_usage');
|
||||
if($editAssetUsageData)
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
|
||||
}else{
|
||||
$data['asset_id'] = $this->input->post('asset_id_for_add');
|
||||
@ -320,7 +358,16 @@ public function add_or_edit_asset_usage()
|
||||
$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')));
|
||||
if($createAssetUsageData)
|
||||
{
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$createAssetUsageData);
|
||||
$this->audit->set('table','asset_usage');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
|
||||
}
|
||||
}
|
||||
@ -345,14 +392,28 @@ public function getAssetAMCForm($id)
|
||||
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')));
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','amc');
|
||||
//fetch old_data before new_data update
|
||||
$this->audit->fetch('old_data');
|
||||
//update asset value
|
||||
$editAMCData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'amc');
|
||||
if($editAMCData)
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
|
||||
}else{
|
||||
$data['asset_id'] = $this->input->post('asset_id_for_add');
|
||||
@ -365,7 +426,16 @@ public function add_or_edit_asset_amc()
|
||||
$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')));
|
||||
if($createAMCData)
|
||||
{
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$createAMCData);
|
||||
$this->audit->set('table','amc');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
|
||||
}
|
||||
}
|
||||
@ -397,7 +467,21 @@ public function add_or_edit_asset_insurance()
|
||||
{
|
||||
$value = $this->input->post();
|
||||
unset($value['asset_id_for_add']);
|
||||
$editInsuranceData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'amc');
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','amc');
|
||||
//fetch old_data before new_data update
|
||||
$this->audit->fetch('old_data');
|
||||
//update asset value
|
||||
$editInsuranceData = $this->MY_Model->edit_option($value, $this->input->post('id'), 'amc');
|
||||
if($editInsuranceData)
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
|
||||
}else{
|
||||
$data['asset_id'] = $this->input->post('asset_id_for_add');
|
||||
@ -410,6 +494,16 @@ public function add_or_edit_asset_insurance()
|
||||
$data['created_by'] = user()->id;
|
||||
$data['type'] = 4; //(insurance company type = 4 * in third_parties table)
|
||||
$createInsuranceData = $this->MY_Model->insert($data, 'amc');
|
||||
if($createInsuranceData)
|
||||
{
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$createInsuranceData);
|
||||
$this->audit->set('table','amc');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
|
||||
}
|
||||
}
|
||||
@ -496,10 +590,9 @@ public function deleteAssetInsurance($id)
|
||||
redirect('asset/view_asset_details/'.md5($asset_id));
|
||||
}
|
||||
|
||||
public function test()
|
||||
public function get_history()
|
||||
{
|
||||
$data = $this->Audit_model->get_history(13,'asset',user()->business_id);
|
||||
print_r($data);die();
|
||||
echo $this->input->post();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +67,8 @@
|
||||
<i class="fa fa-pencil"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/deleteAssetValue/<?php echo md5($value->id)."_".$value->asset_id;?>" style="font-size: 16px;"><i class="fa fa-trash"></i></a>
|
||||
|
||||
<a class="asset_value_history" id="<?php echo md5($value->id); ?>" data-toggle="modal" data-target=".bs-example-modal-sm" style="font-size: 16px;" ><i class="fa fa-eye"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
@ -25,6 +25,7 @@ public function __construct()
|
||||
{
|
||||
// To inherit directly the attributes of the parent class.
|
||||
parent::__construct();
|
||||
$this->load->model('Dashboard_model');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -36,14 +37,27 @@ public function __construct()
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$users = array('name' => 'user 1','age' => 35);
|
||||
$address = array('address' => 'street','pincode' => 741852);
|
||||
|
||||
// echo $this->security->get_csrf_token_name(); echo $this->security->get_csrf_hash();die();
|
||||
//pass data to views
|
||||
$this->layout->set('users', $users);
|
||||
$this->layout->set('address', $address);
|
||||
|
||||
if(is_admin())
|
||||
{
|
||||
$asset_count = $this->Dashboard_model->get_assets_count(user()->business_id);
|
||||
$this->layout->set('asset_count', $asset_count);
|
||||
|
||||
$user_count = $this->Dashboard_model->get_users_count(user()->business_id);
|
||||
$this->layout->set('user_count', $user_count);
|
||||
|
||||
$amc_count = $this->Dashboard_model->get_amc_count(user()->business_id);
|
||||
$this->layout->set('amc_count', $amc_count);
|
||||
|
||||
$expired_amc_count = $this->Dashboard_model->get_expired_amc_count(user()->business_id);
|
||||
$this->layout->set('expired_amc_count', $expired_amc_count);
|
||||
|
||||
$insurance_count = $this->Dashboard_model->get_insurance_count(user()->business_id);
|
||||
$this->layout->set('insurance_count', $insurance_count);
|
||||
|
||||
$expired_insurance_count = $this->Dashboard_model->get_expired_insurance_count(user()->business_id);
|
||||
$this->layout->set('expired_insurance_count', $expired_insurance_count);
|
||||
|
||||
}
|
||||
$this->layout->buffer('main_content', 'dashboard/dashboard');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
78
application/modules/Dashboard/models/Dashboard_model.php
Normal file
78
application/modules/Dashboard/models/Dashboard_model.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class Dashboard_model extends MY_Model {
|
||||
|
||||
public function get_assets_count($business_id)
|
||||
{
|
||||
$this->db->select();
|
||||
$this->db->from('asset');
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function get_users_count($business_id)
|
||||
{
|
||||
$this->db->select();
|
||||
$this->db->from('users');
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function get_amc_count($business_id)
|
||||
{
|
||||
$this->db->select();
|
||||
$this->db->from('amc');
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 3);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function get_expired_amc_count($business_id)
|
||||
{
|
||||
$this->db->select();
|
||||
$this->db->from('amc');
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 3);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function get_insurance_count($business_id)
|
||||
{
|
||||
$this->db->select();
|
||||
$this->db->from('amc');
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 4);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function get_expired_insurance_count($business_id)
|
||||
{
|
||||
$this->db->select();
|
||||
$this->db->from('amc');
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 4);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -2,35 +2,40 @@
|
||||
<!-- top tiles -->
|
||||
<div class="row" style="display: inline-block;" >
|
||||
<div class="tile_count">
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Assets</span>
|
||||
<div class="count">2500</div>
|
||||
<span class="count_bottom"><i class="green">4% </i> From last Week</span>
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Users</span>
|
||||
<div class="count"><?php echo $user_count; ?></div>
|
||||
<!--<span class="count_bottom"><i class="green">4% </i> From last Week</span> -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-clock-o"></i> Average Time</span>
|
||||
<div class="count">123.50</div>
|
||||
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>3% </i> From last Week</span>
|
||||
<span class="count_top"><i class="fa fa-university"></i> Total Assets</span>
|
||||
<div class="count"><?php echo $asset_count; ?></div>
|
||||
<!--<span class="count_bottom"><i class="green">4% </i> From last Week</span> -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Males</span>
|
||||
<div class="count green">2,500</div>
|
||||
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>34% </i> From last Week</span>
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total AMC</span>
|
||||
<div class="count"><?php echo $amc_count; ?></div>
|
||||
<span class="count_bottom"><i class="red"><i class="fa fa-sort-desc"></i>below 30</i> days left</span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Females</span>
|
||||
<div class="count">4,567</div>
|
||||
<span class="count_bottom"><i class="red"><i class="fa fa-sort-desc"></i>12% </i> From last Week</span>
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Insurance</span>
|
||||
<div class="count"><?php echo $insurance_count; ?></div>
|
||||
<span class="count_bottom"><i class="red"><i class="fa fa-sort-desc"></i>below 30 </i> days left</span>
|
||||
</div>
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Collections</span>
|
||||
<div class="count">2,315</div>
|
||||
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>34% </i> From last Week</span>
|
||||
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total AMC</span>
|
||||
<div class="count"><?php echo $expired_amc_count; ?></div>
|
||||
<span class="count_bottom"><i class="red"><i class="fa fa-warning"></i> Date Expired</i></span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-sm-4 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Connections</span>
|
||||
<div class="count">7,325</div>
|
||||
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>34% </i> From last Week</span>
|
||||
<span class="count_top"><i class="fa fa-user"></i> Total Insurance</span>
|
||||
<div class="count"><?php echo $expired_insurance_count; ?></div>
|
||||
<span class="count_bottom"><i class="red"><i class="fa fa-warning"></i> Date Expired</i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -123,6 +123,8 @@ $(document).on('click','#close-form',function(){
|
||||
$('#edit-form').css('display', 'none');
|
||||
|
||||
});
|
||||
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
|
||||
@ -136,9 +138,28 @@ $( document ).ready(function() {
|
||||
});
|
||||
|
||||
|
||||
//fetch history start
|
||||
|
||||
$(document).on('click','.asset_value_history',function(){
|
||||
var id = $(this).attr("id");
|
||||
var getUrl = window.location;
|
||||
var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
||||
var url = baseUrl+"/";
|
||||
var data = {id:id,table_name:"asset_value"};
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url:url+"asset/get_history",
|
||||
data: data,
|
||||
json: true,
|
||||
success: function(response) {
|
||||
alert(response);
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//fetch history end
|
||||
|
||||
|
||||
// ################################################################################################################################
|
||||
|
||||
Loading…
Reference in New Issue
Block a user