Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Smart 2024-10-05 10:45:38 +05:30
commit a911f7b862
6 changed files with 175 additions and 13 deletions

View File

@ -62,6 +62,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'rawmaterialListing/(:num)', 'Ra
$routes->post('materialExist','Rawmaterialdetails::checkmaterial');
$routes->get('viewRawmaterial','Rawmaterialdetails::viewRawmaterial');
$routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRawmaterial');
$routes->post('rawmaterialdetails/addMaterialCategories', 'Rawmaterialdetails::addMaterialCategories');
$routes->get('exportmaterial' , 'Rawmaterialdetails::exportmaterial');
$routes->get('rawmaterialdetailsautocomplete' , 'Rawmaterialdetails::autocomplete');
@ -400,7 +401,7 @@ $routes->post('createFactoryMachineMasterDetails' , 'FactoryMachineControlle
$routes->get ('readFactoryMachineMasterDetails' , 'FactoryMachineController::readFactoryMachineMasterDetails');
$routes->get ('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById');
$routes->post ('updateFactoryMachineMasterDetails' , 'FactoryMachineController::updateFactoryMachineMasterDetails');
$routes->post('deleteFactoryMachineMasterDetails' , 'FactoryMachineController::deleteFactoryMachineMasterDetails');
$routes->get('deleteFactoryMachineMasterDetails' , 'FactoryMachineController::deleteFactoryMachineMasterDetails');
$routes->get('loadView_createFactoryMachineMasterDetail','FactoryMachineController::loadView_createFactoryMachineMasterDetail');
$routes->get('loadView_updateFactoryMachineMasterDetail','FactoryMachineController::loadView_updateFactoryMachineMasterDetail');

View File

@ -59,7 +59,7 @@ class FactoryMachineController extends BaseController
$data['masterData']='';
return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL);
return $this->loadViews("factoryMachineMasterDetailsForm", $this->global, $data, NULL);
}
@ -72,10 +72,8 @@ class FactoryMachineController extends BaseController
$data['masterData'] = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first();
//here we are using same view - create Factory Machine Master Detail for
// updating Factory Machine Master Detail
return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL);
return $this->loadViews("factoryMachineMasterDetailsForm", $this->global, $data, NULL);
}
@ -83,7 +81,10 @@ class FactoryMachineController extends BaseController
$this->global['pageTitle'] = 'Factory Machine Master Details';
$data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1)->findAll();
$data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1)
->where('is_active', 1)
->orderBy('created_at','DESC')
->findAll();
return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL);
@ -95,7 +96,10 @@ class FactoryMachineController extends BaseController
$id = $this->request->getPost('id');
$data = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first();
$data = $this->factoryMachineMaster_model->where('id', $id)
->where('is_active', 1)
->orderBy('created_at','DESC')
->first();
return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL);
@ -133,11 +137,19 @@ class FactoryMachineController extends BaseController
$this->global['pageTitle'] = 'Delete Factory Machine Master Detail ';
$id = $this->request->getPost('id');
$id = $this->request->getGet('id');
$data['is_active']=0;
$data = $this->factoryMachineMaster_model->update($id,$data);
$updated = $this->factoryMachineMaster_model->update($id,$data);
if ($updated) {
// Set flashdata for success message
return redirect()->to('/readFactoryMachineMasterDetails')->with('success', 'Machine details deleted successfully');
} else {
// Set flashdata for error message
return redirect()->back()->with('error', 'Failed to delete machine details');
}
}

View File

@ -313,6 +313,29 @@ class Rawmaterialdetails extends BaseController
}
function addMaterialCategories(){
$data['category_name']=$this->request->getpost('category_name');
$insertResult=$this->materialCategories_model->insert($data);
if ($insertResult) {
// Send a success response as JSON
return $this->response->setJSON([
'status' => '201',
'message' => 'Category added successfully',
]);
} else {
// Send an error response as JSON
return $this->response->setJSON([
'status' => '400',
'message' => 'Failed to add category',
]);
}
}
function autocomplete()
{

View File

@ -68,7 +68,12 @@
</div>
<div class=" col-md-3">
<label class="col-form-label" for="MatCate">Material Caterogy<span class="badge">*</span></label>
<label class="col-form-label" for="MatCate">Material Caterogy
<span class="badge">*</span></label>
<i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
style="font-size: 16px; color:rgb(15, 155, 218);" data-toggle="modal" data-target="#addMaterialCaterogyModal"
title="Add Material Caterogy">
</i>
<select class="form-control select2" required id="MatCate" name="MatCate">
<option value="" required>Select Material Caterogy </option>
<?php
@ -186,6 +191,55 @@
</div> <!-- content -->
</div>
<!-- Modal -->
<div class="modal fade" id="addMaterialCaterogyModal" tabindex="-1" aria-labelledby="addMaterialCaterogyModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addMaterialCaterogyModalLabel">Add Material Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="addMaterialCategoryForm">
<div class="form-group">
<label for="materialCategoryInput">Material Category</label>
<input type="text" class="form-control" id="materialCategoryInput" placeholder="Enter material category">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="addMaterialCategory()">Save Category</button>
</div>
</div>
</div>
</div>
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<script>
//var tempARRAY = [];
@ -308,5 +362,52 @@
$("#MaterialType").focus();
return false;
}
}
</script>
<script>
function addMaterialCategory (){
$('#materialCategoryInput').val()
let materialCategory = $('#materialCategoryInput').val().trim();
if (materialCategory.length <= 2) {
alert('Material Category should have more than 2 letters.');
return false;
}
if (materialCategory.length > 20) {
alert('Material Category should have fewer than 20 letters.');
return false;
}
$.ajax({
url: "<?php echo base_url('/rawmaterialdetails/addMaterialCategories'); ?>",
type: 'POST',
data: {
category_name: materialCategory
},
success: function(response) {
if(response.status=="201"){
$("#addMaterialCaterogyModal").modal('hide');
$("#MatCate").append(`<option value="${materialCategory}" selected > ${materialCategory} </option>`)
}else{
$("#addMaterialCaterogyModal").modal('hide');
alert('Error Adding Category..!!');
}
},
error: function(xhr, status, error) {
// Handle errors
alert('Error adding category');
console.log(error);
}
});
}
</script>

View File

@ -126,11 +126,26 @@
<td align="center"><?php echo $record['energy_type'] ?></td>
<td align="center">
<a data-toggle="tooltip"
href="<?php echo base_url(); ?>loadView_updateFactoryMachineMasterDetail?id=<?php echo $record['id'] ?>"
><i class="fa fa-pencil-alt" data-toggle="tooltip"
title="- Click here to Edit "></i>
href="<?php echo base_url()?>loadView_updateFactoryMachineMasterDetail?id=<?php echo $record['id'] ?>"
>
<i class="fa fa-pencil-alt" data-toggle="tooltip"
title="Click here to Edit "></i>
&nbsp;&nbsp;&nbsp;
</a>
<a data-toggle="tooltip" onclick="confirmDelete(event)"
href="<?php echo base_url(); ?>deleteFactoryMachineMasterDetails?id=<?php echo $record['id'] ?>"
>
<i class="fa fa-trash" data-toggle="tooltip"
title="Click here to Delete "></i>
&nbsp;&nbsp;&nbsp;
</a>
</td>
</tr>
<?php
@ -200,4 +215,14 @@
table.draw();
});
});
</script>
<script>
function confirmDelete(event){
let result= confirm(` Do you Confirm to Delete the Factory Machine?`);
if(result){return result; }else{event.preventDefault();}
}
</script>