diff --git a/application/config/testing/database.php b/application/config/testing/database.php index 74aa34f..365385b 100644 --- a/application/config/testing/database.php +++ b/application/config/testing/database.php @@ -75,14 +75,14 @@ $db['default'] = array( 'dsn' => '', - // 'hostname' => 'localhost', - // 'username' => 'root', - // 'password' => '', - // 'database' => 'test', - 'hostname' => '119.18.54.85', - 'username' => 'venbaehn_ams', - 'password' => 'L;nD7Z@f)1ZT', - 'database' => 'venbaehn_ams', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => '', + 'database' => 'testbbone', + // 'hostname' => '119.18.54.85', + // 'username' => 'venbaehn_ams', + // 'password' => 'L;nD7Z@f)1ZT', + // 'database' => 'venbaehn_ams', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, diff --git a/application/modules/Asset/controllers/Asset.php b/application/modules/Asset/controllers/Asset.php index 1b78633..ca042f7 100644 --- a/application/modules/Asset/controllers/Asset.php +++ b/application/modules/Asset/controllers/Asset.php @@ -38,14 +38,14 @@ public function __construct() //print_r($business);die(); } - + public function index() { $this->layout->set('users', "gowtham"); $this->layout->buffer('main_content', 'Asset/index'); - $this->layout->render('default_layout'); + $this->layout->render('default_layout'); } - + public function addAsset($id='empty') { if($id != 'empty') @@ -58,10 +58,10 @@ public function addAsset($id='empty') $this->layout->set('locationsData', $this->MY_Model->select_by_business_id('locations',user()->business_id)); $this->layout->set('categoriesData', $this->MY_Model->select_by_business_id('categories',user()->business_id)); $this->layout->set('statusData', $this->MY_Model->select('status')); - + $this->layout->buffer('main_content', 'Asset/add_asset'); $this->layout->render('default_layout'); - + } public function assetLandingPage() @@ -71,12 +71,12 @@ public function assetLandingPage() $this->layout->set('tableData', $assets_list); $this->layout->buffer('main_content', 'Asset/asset_landing_page'); $this->layout->render('default_layout'); - + } - + public function assetList($category , $purchase_date_from = null , $purchase_date_to = null) { - + $table = 'asset'; $assets_list = $this->Asset_model->get_assets(user()->business_id , $category ); foreach ($assets_list as $key => $value) { @@ -94,13 +94,13 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat // echo $nxt_year;die(); // echo $interval->y; die(); // year intervel greater than 0 - if($interval->y > 0) + if($interval->y > 0) { $curr_month = date('n', strtotime($value->purchase_date)); - + // echo $curr_month;die(); $month_array_for_50_percentage = array(10 , 11 , 12 , 1 , 2 ,3); - if (in_array($curr_month, $month_array_for_50_percentage) && date('Y-m-d') > $nxt_year) + if (in_array($curr_month, $month_array_for_50_percentage) && date('Y-m-d') > $nxt_year) { $cost = $value->cost; // get depreciation value @@ -111,8 +111,8 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat $cost = abs($depreciate_value - $cost); // echo $cost;die(); $category_percentage = $this->Asset_model->get_by_category_id($value->category); - for ($i=0 ; $i < $interval->y ; $i++) - { + for ($i=0 ; $i < $interval->y ; $i++) + { // $category_percentage = $this->Asset_model->get_by_category_id($value->category); $category_per = $category_percentage[0]['depreciation_percentage']; $depreciate_value = $cost * $category_per / 100; @@ -134,8 +134,8 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat // $cost = $value->cost; // get depreciation value $category_percentage = $this->Asset_model->get_by_category_id($value->category); - for ($i=0 ; $i < $interval->y ; $i++) - { + for ($i=0 ; $i < $interval->y ; $i++) + { $category_per = $category_percentage[0]['depreciation_percentage']; $depreciate_value = $cost * $category_per / 100; // echo $depreciate_value; die(); @@ -143,14 +143,14 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat $editCurrentValue = $this->MY_Model->edit_option($data, $value->id, $table); $cost = abs($depreciate_value - $cost); } - } + } } // year intervel less than 0 - else + else { $curr_month = date('n', strtotime($value->purchase_date)); $month_array_for_50_percentage = array(10 , 11 , 12 , 1 , 2 , 3); - if (in_array($curr_month, $month_array_for_50_percentage)) + if (in_array($curr_month, $month_array_for_50_percentage)) { $cost = $value->cost; // get depreciation value @@ -183,19 +183,19 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat $this->layout->set('tableData', $assets_list); $this->layout->buffer('main_content', 'Asset/asset_list'); $this->layout->render('default_layout'); - + } public function createAssets() { - + $data=$this->input->post(); $data['business_id'] = user()->business_id; $data['created_by'] = user()->name; $date = date_create($this->input->post('purchase_date')); $data['purchase_date'] = date_format($date,"Y-m-d"); - + //file upload confic $asset_image['upload_path'] = APPPATH. '../assets/uploads/'; $asset_image['allowed_types'] = 'gif|jpg|png|jpeg'; @@ -210,10 +210,10 @@ public function createAssets() $upload_asset_image = $this->upload->data(); $data['asset_img'] = $upload_asset_image['file_name']; } - + $table="asset"; - - + + //create asset $create_assets = $this->MY_Model->insert($data,$table); @@ -230,17 +230,17 @@ public function createAssets() $this->audit->set('table',$table); //fetch new_data after post data insert $this->audit->fetch('new_data'); - //audit history generation for insert + //audit history generation for insert $test = $this->audit->create_history('insert'); } - + redirect('Asset/assetList/'.md5($this->input->post('category'))); - + } - - + + public function editAsset($id) - { + { //select dropdown values $this->layout->set('manufacturerData', $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,1)); $this->layout->set('suppliorData', $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,2)); @@ -262,19 +262,19 @@ public function editAsset($id) $this->layout->set('editData', $assetData); $this->layout->buffer('main_content', 'Asset/edit_asset'); $this->layout->render('default_layout'); - + } - + public function editAssets() { $table="asset"; $action = $this->input->post(); - + $date = date_create($this->input->post('purchase_date')); $action['purchase_date'] = date_format($date,"Y-m-d"); - - + + $id = $this->input->post('id'); //file upload confic $asset_image['upload_path'] = APPPATH. '../assets/uploads/'; @@ -286,14 +286,14 @@ public function editAssets() if ( ! $this->upload->do_upload('asset_img')) { $error = array('error' => $this->upload->display_errors()); - + unset($action['asset_img']); } else{ $upload_asset_image = $this->upload->data(); $action['asset_img'] = $upload_asset_image['file_name']; - + } - + // print_r( $action);die(); //set id $ table name for audit history $this->audit->set('id',$this->input->post('id')); @@ -306,11 +306,11 @@ public function editAssets() { //fetch new_data after post data update $this->audit->fetch('new_data'); - //audit history generation for update + //audit history generation for update $test = $this->audit->create_history('update'); } redirect('Asset/assetList/'.md5($this->input->post('category'))); - + } public function deleteAsset() @@ -320,7 +320,7 @@ public function deleteAsset() $Data = $this->Asset_model->delete_by_md5_id($id,user()->business_id,'asset'); redirect('Asset/assetList/'.md5($assetdata->category)); } - + public function deleteMultipleAsset() { @@ -342,16 +342,16 @@ public function view_qrcode() array_push($output , $qr); } $data['data'] = $output; - $data['htmlPage'] = $this->load->view('view_qr.php',$data,true); + $data['htmlPage'] = $this->load->view('view_qr.php',$data,true); $data['csrf_hash'] = $this->security->get_csrf_hash(); echo json_encode($data); - + } public function view_asset_details($id) - { - $tab = $this->session->flashdata(); + { + // $tab = $this->session->flashdata(); // $tab = 1; //print_r($tab);die(); // select asset value by id @@ -371,16 +371,16 @@ public function view_asset_details($id) $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); // } @@ -389,18 +389,18 @@ public function view_asset_details($id) public function getAssetValueForm($id) { - + $split = preg_split('/_/', $id); if(count($split) > 1) - { + { $data = array('asset_id'=> $split[0], 'heading'=>'Add Asset Value' , '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 Value' , 'submit_button_title'=>'Update'); } - + $htmlPage = $this->load->view('asset_value_form.php',$data,true); - echo json_encode($htmlPage); + echo json_encode($htmlPage); } @@ -411,7 +411,7 @@ public function add_or_edit_asset_value() { $value = $this->input->post(); unset($value['asset_id_for_add']); - + //set id $ table name for audit history $this->audit->set('id',$this->input->post('id')); $this->audit->set('table','asset_value'); @@ -423,10 +423,10 @@ public function add_or_edit_asset_value() { //fetch new_data after post data update $this->audit->fetch('new_data'); - //audit history generation for update + //audit history generation for update $this->audit->create_history('update'); } - + $this->session->set_flashdata('msg', "asset_value"); redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id'))); }else{ @@ -456,23 +456,23 @@ public function add_or_edit_asset_value() $this->audit->set('table','asset_value'); //fetch new_data after post data insert $this->audit->fetch('new_data'); - //audit history generation for insert + //audit history generation for insert $this->audit->create_history('insert'); } $this->session->set_flashdata(1); $this->session->set_flashdata('msg', "asset_value"); 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) - { + { //month year for dropdown $date_output = array(); $start = new DateTime; @@ -502,9 +502,9 @@ public function getAssetUsageForm($id) $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); + echo json_encode($htmlPage); } @@ -514,7 +514,7 @@ public function add_or_edit_asset_usage() { $value = $this->input->post(); unset($value['asset_id_for_add']); - + //set id $ table name for audit history $this->audit->set('id',$this->input->post('id')); $this->audit->set('table','asset_usage'); @@ -526,7 +526,7 @@ public function add_or_edit_asset_usage() { //fetch new_data after post data update $this->audit->fetch('new_data'); - //audit history generation for update + //audit history generation for update $this->audit->create_history('update'); } $this->session->set_flashdata('msg', "asset_usage"); @@ -547,7 +547,7 @@ public function add_or_edit_asset_usage() $this->audit->set('table','asset_usage'); //fetch new_data after post data insert $this->audit->fetch('new_data'); - //audit history generation for insert + //audit history generation for insert $this->audit->create_history('insert'); } $this->session->set_flashdata('msg', "asset_usage"); @@ -564,15 +564,15 @@ 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); + echo json_encode($htmlPage); } @@ -586,7 +586,7 @@ public function add_or_edit_asset_amc() $valid_to = date_create($this->input->post('valid_to')); $value['valid_to'] = date_format($valid_to,"Y-m-d"); unset($value['asset_id_for_add']); - + //set id $ table name for audit history $this->audit->set('id',$this->input->post('id')); $this->audit->set('table','amc'); @@ -598,7 +598,7 @@ public function add_or_edit_asset_amc() { //fetch new_data after post data update $this->audit->fetch('new_data'); - //audit history generation for update + //audit history generation for update $this->audit->create_history('update'); } $this->session->set_flashdata('msg', "asset_amc"); @@ -615,7 +615,7 @@ public function add_or_edit_asset_amc() $data['valid_to'] = date_format($valid_to,"Y-m-d"); $data['created_by'] = user()->id; $data['type'] = 3; //(amc service provider type = 3 * in third_parties table) - + $createAMCData = $this->MY_Model->insert($data, 'amc'); if($createAMCData) { @@ -624,7 +624,7 @@ public function add_or_edit_asset_amc() $this->audit->set('table','amc'); //fetch new_data after post data insert $this->audit->fetch('new_data'); - //audit history generation for insert + //audit history generation for insert $this->audit->create_history('insert'); } $this->session->set_flashdata('msg', "asset_amc"); @@ -639,15 +639,15 @@ 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 Insurence' , '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 Insurence' , 'submit_button_title'=>'Update'); } - + $htmlPage = $this->load->view('asset_insurance_form.php',$data,true); - echo json_encode($htmlPage); + echo json_encode($htmlPage); } @@ -663,7 +663,7 @@ public function add_or_edit_asset_insurance() $valid_to = date_create($this->input->post('valid_to')); $value['valid_to'] = date_format($valid_to,"Y-m-d"); unset($value['asset_id_for_add']); - + //set id $ table name for audit history $this->audit->set('id',$this->input->post('id')); $this->audit->set('table','amc'); @@ -675,7 +675,7 @@ public function add_or_edit_asset_insurance() { //fetch new_data after post data update $this->audit->fetch('new_data'); - //audit history generation for update + //audit history generation for update $this->audit->create_history('update'); } $this->session->set_flashdata('msg', "asset_insurance"); @@ -700,34 +700,34 @@ public function add_or_edit_asset_insurance() $this->audit->set('table','amc'); //fetch new_data after post data insert $this->audit->fetch('new_data'); - //audit history generation for insert + //audit history generation for insert $this->audit->create_history('insert'); } $this->session->set_flashdata('msg', "asset_insurance"); redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id_for_add'))); } } - - - - - + + + + + public function getAssetImageForm($id) { - + $data = array('asset_id'=> $id, 'heading'=>'Add File' , 'submit_button_title'=>'Submit'); $htmlPage = $this->load->view('asset_image_form.php',$data,true); - echo json_encode($htmlPage); + 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|jpeg|pdf'; @@ -747,7 +747,7 @@ public function add_asset_image() $create_assets = $this->MY_Model->insert($data,$table); $this->session->set_flashdata('msg', "asset_image"); redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id'))); - + } public function deleteAssetValue($id) @@ -806,31 +806,31 @@ public function depreciation_report() $this->layout->set('tableData', $Data); $this->layout->buffer('main_content', 'Asset/depreciation_list'); $this->layout->render('default_layout'); - + } - + public function amc_report() { $Data = $this->Asset_model->amc_insurance_report(3,user()->business_id); $this->layout->set('tableData', $Data); $this->layout->buffer('main_content', 'Asset/amc_reports_list'); $this->layout->render('default_layout'); - + } - + public function insurance_report() { $Data = $this->Asset_model->amc_insurance_report(4,user()->business_id); $this->layout->set('tableData', $Data); $this->layout->buffer('main_content', 'Asset/insurance_reports_list'); $this->layout->render('default_layout'); - + } - - + + public function masterDataList() { $this->layout->set('manufacturerData', $this->Asset_model->get_third_party_value_by_md5_id(user()->business_id,1)); @@ -844,29 +844,29 @@ public function masterDataList() $this->layout->set('enum_value', $this->MY_Model->select_by_department_data('enum',user()->business_id)); $this->layout->buffer('main_content', 'Asset/master_list'); $this->layout->render('default_layout'); - + } public function getThirdPartyForm($id) { - + $state = $this->MY_Model->select('state'); if ($id == "manufacture") { $data = array('heading'=> "Manufacturer Details", 'type' => 1 , 'states' => $state , 'submit_button_title'=>'Add' ); $htmlPage = $this->load->view('third_party_master_form.php',$data,true); echo json_encode($htmlPage); - } + } else if ($id == "supplier") { $data = array('heading'=> "supplier Details", 'type' => 2 , 'states' => $state , 'submit_button_title'=>'Add' ); $htmlPage = $this->load->view('third_party_master_form.php',$data,true); echo json_encode($htmlPage); - } + } else if ($id == "service_privoder") { $data = array('heading'=> "Service Privoder Details", 'type' => 3 , 'states' => $state , 'submit_button_title'=>'Add' ); $htmlPage = $this->load->view('third_party_master_form.php',$data,true); echo json_encode($htmlPage); - } + } else if ($id == "insurence") { $data = array('heading'=> "Insurence Details", 'type' => 4 , 'states' => $state , 'submit_button_title'=>'Add' ); $htmlPage = $this->load->view('third_party_master_form.php',$data,true); @@ -879,8 +879,8 @@ public function getThirdPartyForm($id) $htmlPage = $this->load->view('third_party_master_form.php',$data,true); echo json_encode($htmlPage); } - - + + } @@ -900,7 +900,7 @@ public function add_or_edit_ThirdPartyForm() // $this->session->set_flashdata('msg', $type); redirect('Asset/masterDataList'); } - + } public function getLocationForm($id) @@ -936,7 +936,7 @@ public function add_or_edit_LocationForm() // $this->session->set_flashdata('msg', "location"); redirect('Asset/masterDataList'); } - + } @@ -975,7 +975,7 @@ public function add_or_edit_CategoriesForm() // $this->session->set_flashdata('msg', "categories"); redirect('Asset/masterDataList'); } - + } public function getDepartmentForm($id) @@ -1013,7 +1013,7 @@ public function add_or_edit_DepartmentForm() // $this->session->set_flashdata('msg', "department"); redirect('Asset/masterDataList'); } - + } public function deleteDepartmentFormData() @@ -1063,7 +1063,7 @@ public function add_or_edit_LeaveForm() // $this->session->set_flashdata('msg', "leave"); redirect('Asset/masterDataList'); } - + } public function deleteLeaveFormData() @@ -1075,7 +1075,7 @@ public function deleteLeaveFormData() redirect('Asset/masterDataList'); } -/// decline reason +/// decline reason public function getDeclineForm($id) { @@ -1112,7 +1112,7 @@ public function add_or_edit_DeclineForm() // $this->session->set_flashdata('msg', "decline"); redirect('Asset/masterDataList'); } - + } @@ -1126,7 +1126,7 @@ public function deleteDeclineFormData() } - + public function deleteThirdPartyData() { @@ -1153,7 +1153,7 @@ public function getDeleteConfirmationPopup() { $data = array(); $htmlPage = $this->load->view('confirmation_popup.php',$data,true); - echo json_encode($htmlPage); + echo json_encode($htmlPage); } public function filterAssets() diff --git a/application/modules/Asset/views/add_asset.php b/application/modules/Asset/views/add_asset.php index 4ce7bf1..1a89dcd 100644 --- a/application/modules/Asset/views/add_asset.php +++ b/application/modules/Asset/views/add_asset.php @@ -27,15 +27,15 @@

-
+ - +
- - - + + +
@@ -115,7 +115,7 @@
-
Order Related Information

+
Order Related Information

@@ -135,7 +135,7 @@
- + @@ -160,7 +160,7 @@ -
Additional Information

+
Additional Information

@@ -189,7 +189,7 @@
- +
@@ -207,8 +207,8 @@ -
-
+ + \ No newline at end of file + + diff --git a/application/modules/Asset/views/asset_list.php b/application/modules/Asset/views/asset_list.php index b1d4db2..09fc1c3 100644 --- a/application/modules/Asset/views/asset_list.php +++ b/application/modules/Asset/views/asset_list.php @@ -1,14 +1,14 @@ - +

Assets Details

- +
@@ -131,7 +131,7 @@
-
@@ -146,7 +146,7 @@
- +
@@ -161,7 +161,7 @@
- +
@@ -178,7 +178,7 @@ - +
@@ -187,7 +187,7 @@
- +
@@ -205,7 +205,7 @@
-
+
@@ -225,17 +225,17 @@
- - + + @@ -419,7 +419,7 @@ function createAndAppendFormGroup() { const datepickerInput = document.getElementById('datepicker'+i); flatpickr(datepickerInput, { - dateFormat: 'd-m-Y', + dateFormat: 'd-m-Y', maxDate: new Date(), autoclose:true, allowInput: true, @@ -445,7 +445,7 @@ function removebutton(index) { diff --git a/application/modules/Expence/views/expence_list_view.php b/application/modules/Expence/views/expence_list_view.php index e743e75..cda5476 100644 --- a/application/modules/Expence/views/expence_list_view.php +++ b/application/modules/Expence/views/expence_list_view.php @@ -1,6 +1,6 @@ - + @@ -92,7 +92,7 @@ Back

Expense Approval List

- +
@@ -102,7 +102,7 @@
-
+
@@ -110,7 +110,7 @@
- + @@ -121,7 +121,7 @@
-
+
@@ -131,7 +131,7 @@
- + @@ -154,11 +154,11 @@ else { echo $expense_name[0]->status; - } - } - ?>" + } + } + ?>" autocomplete='off' required /> - + @@ -166,7 +166,7 @@
- + @@ -183,8 +183,8 @@
- - + + @@ -214,14 +214,14 @@ status == 'Draft'){?> - + - +
Claim Date Date of Expense Amountstatus; ?> at
cancelled_at; ?>
status; ?> -
+
status == 'pending') { ?> @@ -246,7 +246,7 @@

Decline Reason

- +
@@ -263,14 +263,14 @@ var expence_id = document.getElementById('expense_id').value; var url = "Expence/Approve_Child_Expence"; - $.ajax({ + $.ajax({ url: "Expence/getDeleteConfirmationPopup", type:"GET", success:function(data){ $('#popup').html(JSON.parse(data)); $('.delete_id').attr('value',id); $('.expence_id').attr('value',expence_id); - $('.delete_url').attr('action',url); + $('.delete_url').attr('action',url); } }); }); @@ -280,14 +280,14 @@ var expence_id = document.getElementById('expense_id').value; var url = "Expence/Approve_Child_Expence"; - $.ajax({ + $.ajax({ url: "Expence/getDeclineConfirmationPopup", type:"GET", success:function(data){ $('#popup').html(JSON.parse(data)); $('.delete_id').attr('value',id); $('.expence_id').attr('value',expence_id); - $('.delete_url').attr('action',url); + $('.delete_url').attr('action',url); } }); }); @@ -302,7 +302,7 @@ function showCustomPrompt() { } function submitCustomPrompt() { - + var id = $('.test').attr("id"); var reason = document.getElementById("decline_reason").value; var expence_id = document.getElementById('expense_id').value; @@ -314,22 +314,22 @@ function submitCustomPrompt() { url:"", type:"get", success: function(response) { - + console.log(response); window.location ="Expence/expence_list_view/"+expence_id; console.log(response); } - }); - else + }); + else alert('Decline Reason is required'); } - + - + + @@ -241,42 +241,44 @@ var currentUserName = 'name; ?>'; var currentUserId = 'id; ?>'; - $('#user_dropdown').append(''); $('#user_dropdown').prop('disabled', true); $('#user_dropdown').on('change',function() { - + $('#type').prop('selectedIndex',0); - + }); $('#type').on('change',function() { let id = $("#user_dropdown").val(); - var type_id = $('option:selected', this).attr('id'); + var type_id = $('option:selected', this).val(); + console.log('type_id : ', type_id) var fromdate = document.getElementById("fromdate").value; + console.log('userID : ', id) if (id) { - $.ajax({ - data: {id : id, type_id : type_id}, + $.ajax({ + data: {id : id, type_id : type_id}, type: 'get', url: "Leave/get_leave_count/", success: function(response) { response = JSON.parse(response); if(response.length == 0 ) - { - $.ajax({ + { + $.ajax({ type: "get", data: {type_id : type_id}, url: "Leave/get_all_leave_count/", success: function(response) { response = JSON.parse(response); $('#leave_bal').val( response[0].days + ' days'); - }, + }, }); } else @@ -288,7 +290,7 @@ else { $('#leave_bal').val(response[0].remaining_days + ' days'); - } + } } }, @@ -307,15 +309,15 @@ $userDropdown.empty(); if (selectedValue === 'self') { - + var currentUserName = 'name; ?>'; var currentUserId = 'id; ?>'; $userDropdown.append(''); $userDropdown.prop('disabled', true); } else if (selectedValue === 'name; ?>') { - + $.ajax({ - url: '"', + url: '"', method: 'GET', dataType: 'json', success: function(response) { @@ -328,12 +330,12 @@ }); } }); - + }); function get_all_count(id) { - - $.ajax({ + + $.ajax({ type: "get", url: "Leave/get_all_leave_count/"+id, success: function(response) { @@ -371,13 +373,13 @@ function get_all_count(id) { dateFormat: dateFormat, changeYear: true, changeMonth: true, - minDate: 0, + minDate: 0, onSelect: function (dateText, inst) { calculateDateDifference(); DateValidate(); } }); - + // Function to validate the date range function validateDateRange() { var fromDate = fromDateInput.datepicker("getDate"); @@ -414,25 +416,29 @@ function calculateDateDifference() { { $("#dateDifference").val(difference + ' days'); } - + } else { $("#dateDifference").val(""); } } - + @@ -520,7 +530,7 @@ function filterTimeSlots(startingTime, numberOfHours) { const startIndex = timeSlots.findIndex(time => time === startingTime); console.log(startIndex); if (startIndex !== -1) { - + const endIndex = startIndex + (numberOfHours * 2) - 1; return timeSlots.slice(startIndex, endIndex + 2); @@ -547,14 +557,14 @@ function filterTimeSlots(startingTime, numberOfHours) { - - + +