This commit is contained in:
sriramv 2023-01-05 14:26:20 +05:30
parent ae16527a95
commit 65be4e5963
22 changed files with 168 additions and 56 deletions

View File

@ -48,6 +48,7 @@ public function __construct()
// $this->global_data['copyright_from_mycontroller'] = $date;
// $this->load->vars($this->global_data);
$this->load->module('layout');
}
}

View File

@ -259,6 +259,16 @@ function get_settings()
$query = $query->row();
return $query;
}
function getData($table,$id,$business_id)
{
$this->db->select();
$this->db->from($table);
$this->db->where('business_id', $business_id);
$this->db->where('id', $id);
$query = $this->db->get();
$query = $query->row();
return $query;
}
}

View File

@ -180,4 +180,41 @@ function day_different($to){
return '';
}
}
}
// audit history function
if(!function_exists('audit_history')){
function audit_history($postData,$table,$business_id){
if($table != ''){
$id = $postData->id;
$ci =& get_instance();
$TableData = $ci->MY_Model->getData($table,$id,$business_id);
$Output = array();
foreach($postData as $postDatakey=>$postDatavalue)
{
foreach($TableData as $TableDatakey=>$TableDatavalue)
{
if($postDatakey == $TableDatakey)
{
if($postDatavalue != $TableDatavalue)
{
$data['table_name'] = $table;
$data['column_name'] = $postDatakey;
$data['old_value'] = $TableDatavalue;
$data['new_value'] = $postDatavalue;
$data['created_by'] = user()->id;
$data['business_id'] = $business_id;
$data['primary_id'] = $id;
array_push($Output,$data);
}
}
}
}
return $Output;
}else{
return '';
}
}
}

View File

@ -108,7 +108,7 @@ public function editAsset($id)
$assetData = $this->Asset_model->get_asset_by_md5_id($id,user()->business_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,'amc',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);
@ -130,8 +130,6 @@ public function editAssets()
$action['purchase_date'] = date_format($date,"Y-m-d");
//print_r($action);die();
$id = $this->input->post('id');
//file upload confic
$asset_image['upload_path'] = APPPATH. '../assets/uploads/';
@ -150,7 +148,8 @@ public function editAssets()
$action['asset_img'] = $upload_asset_image['file_name'];
}
$assetData = $this->MY_Model->edit_option($action, $id, $table);
@ -471,7 +470,27 @@ public function deleteAssetInsurance($id)
redirect('asset/view_asset_details/'.md5($asset_id));
}
public function test()
{
$id = 1;
$table = "asset";
$assetData = $this->MY_Model->getData($table,$id,user()->business_id);
$object = (object) $action;
$data = audit_history($object,$table,user()->business_id);
print_r($data);die();
echo "</br>";
$data = audit_history($assetData,$table,user()->business_id);
print_r($assetData);
}
}

View File

@ -107,5 +107,7 @@ public function delete_by_md5_id($id,$business_id,$table)
$this->db->update($table);
return;
}
}

View File

@ -188,7 +188,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-4">
<div class=" offset-md-8">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>

View File

@ -37,15 +37,21 @@
<input type="text" class="form-control" name="cost" value="<?php if(isset($assetAMCData)) { echo $assetAMCData->cost; } ?>">
</div>
</div>
<!-- bootstrap-daterangepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<!-- bootstrap-datetimepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Valid From</label>
<div class="col-md-9 col-sm-9 ">
<div class='input-group date' id='myDatepicker4'>
<input type='text' class="form-control" name="valid_from" value="<?php if(isset($assetAMCData)) { echo $assetAMCData->valid_from; } ?>" />
<input type='text' class="form-control" name="valid_from" value="<?php if(isset($assetAMCData)) { echo date("d-m-Y", strtotime($assetAMCData->valid_from)); } ?>" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -55,9 +61,9 @@
<label class="col-form-label col-md-3 col-sm-3 ">Valid To</label>
<div class="col-md-9 col-sm-9 ">
<div class='input-group date' id='myDatepicker5'>
<input type='text' class="form-control" name="valid_to" value="<?php if(isset($assetAMCData)) { echo $assetAMCData->valid_to; } ?>" />
<input type='text' class="form-control" name="valid_to" value="<?php if(isset($assetAMCData)) { echo date("d-m-Y", strtotime($assetAMCData->valid_to)); } ?>" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -79,3 +85,16 @@
</form>
</div>
</div>
<script>
$('#myDatepicker4').datetimepicker({
format: 'DD-MM-YYYY'
});
$('#myDatepicker5').datetimepicker({
format: 'DD-MM-YYYY'
});
</script>

View File

@ -1,4 +1,10 @@
<!-- bootstrap-daterangepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<!-- bootstrap-datetimepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
<div class="modal-dialog modal-lm">
<div class="modal-content">
@ -46,10 +52,10 @@
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Valid From</label>
<div class="col-md-9 col-sm-9 ">
<div class='input-group date' id='myDatepicker4'>
<input type='text' class="form-control" name="valid_from" value="<?php if(isset($assetInsuranceData)) { echo $assetInsuranceData->valid_from; } ?>" />
<div class='input-group date' id='myDatepicker6'>
<input type='text' class="form-control" name="valid_from" value="<?php if(isset($assetInsuranceData)) { echo date("d-m-Y", strtotime($assetInsuranceData->valid_from)); } ?>" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -58,10 +64,10 @@
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Valid To</label>
<div class="col-md-9 col-sm-9 ">
<div class='input-group date' id='myDatepicker5'>
<input type='text' class="form-control" name="valid_to" value="<?php if(isset($assetInsuranceData)) { echo $assetInsuranceData->valid_to; } ?>" />
<div class='input-group date' id='myDatepicker7'>
<input type='text' class="form-control" name="valid_to" value="<?php if(isset($assetInsuranceData)) { echo date("d-m-Y", strtotime($assetInsuranceData->valid_to)); } ?>" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -85,3 +91,15 @@
</form>
</div>
</div>
<script>
$('#myDatepicker6').datetimepicker({
format: 'DD-MM-YYYY'
});
$('#myDatepicker7').datetimepicker({
format: 'DD-MM-YYYY'
});
</script>

View File

@ -90,7 +90,7 @@
<tr class="headings">
<th class="column-title" width="20%" >From </th>
<th class="column-title" width="20%" >To </th>
<th class="column-title" width="20%" >Quater </th>
<th class="column-title" width="20%" >Quarter </th>
<th class="column-title" width="20%" >Shift </th>
<th class="column-title" width="20%" >Action </th>
</tr>

View File

@ -1,4 +1,10 @@
<!-- bootstrap-daterangepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<!-- bootstrap-datetimepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
<div class="modal-dialog modal-lm">
<div class="modal-content">
@ -24,9 +30,9 @@
<label class="col-form-label col-md-3 col-sm-3 ">From Date</label>
<div class="col-md-9 col-sm-9 ">
<div class='input-group date' id='myDatepicker2'>
<input type='text' class="form-control" name="date_from" value="<?php if(isset($assetUsageData)) { echo $assetUsageData->date_from; } ?>" />
<input type='text' class="form-control" name="date_from" value="<?php if(isset($assetUsageData)) { echo date("d-m-Y", strtotime($assetUsageData->date_from)); } ?>" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -36,9 +42,9 @@
<label class="col-form-label col-md-3 col-sm-3 ">To Date</label>
<div class="col-md-9 col-sm-9 ">
<div class='input-group date' id='myDatepicker3'>
<input type='text' class="form-control" name="date_to" value="<?php if(isset($assetUsageData)) { echo $assetUsageData->date_to; } ?>" />
<input type='text' class="form-control" name="date_to" value="<?php if(isset($assetUsageData)) { echo date("d-m-Y", strtotime($assetUsageData->date_to)); } ?>" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
<li class="fa fa-calendar"></li>
</span>
</div>
</div>
@ -73,3 +79,15 @@
</form>
</div>
</div>
<script>
$('#myDatepicker2').datetimepicker({
format: 'DD-MM-YYYY'
});
$('#myDatepicker3').datetimepicker({
format: 'DD-MM-YYYY'
});
</script>

View File

@ -1,11 +1,11 @@
<!-- Body page content -->
<input type="hidden" id="current_tab" value="<?php if($tab){ echo $tab; }?>" >
<div class="">
<div class="page-title">
<div class="title_left"><h3><?php if(isset($viewData)) { echo "View Assets"; }else{ echo "Edit Assets"; } ?></h3></div>
<div class="title_left"><h3><?php if(isset($viewData)) { echo "View Asset"; }else{ echo "Edit Asset"; } ?></h3></div>
</div>
<a class="btn btn-sm btn-primary" style="float: right;" href="<?php echo base_url();?>asset/assetList">Assets List</a>
<div class="clearfix"></div>
@ -117,7 +117,8 @@
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<div class='input-group date' id='myDatepicker'>
<input type='text' class="form-control" name="purchase_date" value="<?php echo $editData->purchase_date; ?>" <?php if(isset($viewData)) { echo "readonly"; } ?>/>
<input type='text' class="form-control" name="purchase_date"
value="<?php echo date("d-m-Y", strtotime($editData->purchase_date)); ?>" <?php if(isset($viewData)) { echo "readonly"; } ?>/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
@ -153,14 +154,16 @@
<label class="control-label col-md-1 col-sm-1 " for="last-name">Warranty Information</label>
<div class="col-md-5 col-sm-5 ">
<textarea id="warranty" name="warranty" value="<?php echo $editData->warranty; ?>" class="form-control" type="text" <?php if(isset($viewData)) { echo "readonly"; } ?> ></textarea>
<textarea id="warranty" name="warranty" class="form-control" type="text" <?php if(isset($viewData)) { echo "readonly"; } ?> ><?php echo $editData->warranty; ?></textarea>
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Main Image </label>
<div class="col-md-5 col-sm-5 ">
<?php if(isset($viewData)) { ?>
<img src="<?php echo base_url(); ?>assets/uploads/<?php echo $editData->asset_img; ?>" alt="Girl in a jacket" width="180" height="150">
<?php if(isset($viewData)) { if($editData->asset_img == null || $editData->asset_img == '') { ?>
<img src="<?php echo base_url(); ?>assets/uploads/defauld-img.jpg" width="180" height="150">
<?php } else {?>
<img src="<?php echo base_url(); ?>assets/uploads/<?php echo $editData->asset_img; ?>" width="180" height="150">
<?php } } else {?>
<input id="formFile" name="asset_img" class="typeFile" type="file" >
<?php }?>
</div>
@ -177,7 +180,7 @@
<?php if(isset($viewData)) { }else{ ?>
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-10">
<div class="offset-md-8">
<button class="btn btn-primary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-success">Update</button>
</div>

View File

@ -120,11 +120,11 @@
<div class="col-md-1 col-sm-1">
<input type="checkbox" name="add_admin" class="form-control" value="1" >
</div>
<label class="control-label col-md-5 col-sm-5" for="first-name">do you want to add admin</label>
<label class="control-label col-md-5 col-sm-5" for="first-name"> add admin</label>
</div>
<div class="col-md-6 col-sm-6 offset-md-4">
<div class="col-md-5 col-sm-5 offset-md-1">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>

View File

@ -30,7 +30,6 @@
<th class="column-title">Pincode </th>
<th class="column-title">Country </th>
<th class="column-title">Logo </th>
<th class="column-title">Status </th>
<th class="column-title" >Action </th>
</tr>
@ -51,7 +50,6 @@
<td class=" "><?php echo $value->pincode; ?></td>
<td class=" "><?php echo $value->country; ?> </td>
<td class=" "><?php echo $value->logo; ?> </td>
<td class=" "><?php echo $value->status; ?></td>
<td style=" text-align: center; font-size: 16px;">
<a href="<?php echo base_url()?>business/get_business/<?php echo md5($value->id);?>" ><i class="fa fa-pencil"></i></a>

View File

@ -121,7 +121,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-7">
<div class="offset-md-8">
<button class="btn btn-primary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-success">Update</button>
</div>

View File

@ -1,5 +1,5 @@
<!-- Footer code -->
<footer class="footer_fixed">
<footer >
<div class="pull-right">
<?php if(check_auth() && is_admin() || is_user()){echo $business->business_name;}else{echo $settings->site_name;}?>
</div>

View File

@ -58,8 +58,8 @@
}
.logo
{
width:30px;
height:30px;
width:28px;
height:28px;
}
</style>
</head>

View File

@ -1,7 +1,7 @@
<div class="col-md-3 left_col menu_fixed">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="index.html" class="site_title">
<a class="site_title">
<?php if(check_auth() && is_superadmin()) { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/logo/<?php echo $settings->logo;?>" class="img-circle logo">
<?php } else if(check_auth() && is_admin() || is_user()) { ?>
@ -74,7 +74,7 @@
</ul>
</li>
<?php } ?>
</ul>

View File

@ -4,20 +4,7 @@
format: 'DD-MM-YYYY'
});
$('#myDatepicker2').datetimepicker({
format: 'DD-MM-YYYY'
});
$('#myDatepicker3').datetimepicker({
format: 'DD-MM-YYYY'
});
$('#myDatepicker4').datetimepicker({
format: 'DD-MM-YYYY'
});
$('#myDatepicker5').datetimepicker({
format: 'DD-MM-YYYY'
});
$(document).on('click','.test',function(){

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB