Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
49c9884a93
@ -316,6 +316,19 @@ class Rawmaterialdetails extends BaseController
|
|||||||
|
|
||||||
$data['category_name']=$this->request->getpost('category_name');
|
$data['category_name']=$this->request->getpost('category_name');
|
||||||
|
|
||||||
|
$existingCategory = $this->materialCategories_model
|
||||||
|
->where('category_name', $data['category_name'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($existingCategory) {
|
||||||
|
// Data already exists, handle this case (e.g., return an error or ignore the insert)
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => '409',
|
||||||
|
'message' => 'Category Already Exists..!!',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$insertResult=$this->materialCategories_model->insert($data);
|
$insertResult=$this->materialCategories_model->insert($data);
|
||||||
|
|
||||||
if ($insertResult) {
|
if ($insertResult) {
|
||||||
|
|||||||
@ -192,7 +192,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal -->
|
<!-- addMaterialCaterogyModal -->
|
||||||
|
|
||||||
<div class="modal fade" id="addMaterialCaterogyModal" tabindex="-1" aria-labelledby="addMaterialCaterogyModalLabel" aria-hidden="true">
|
<div class="modal fade" id="addMaterialCaterogyModal" tabindex="-1" aria-labelledby="addMaterialCaterogyModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -234,9 +235,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
|
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
//var tempARRAY = [];
|
//var tempARRAY = [];
|
||||||
@ -390,10 +388,25 @@
|
|||||||
if(response.status=="201"){
|
if(response.status=="201"){
|
||||||
|
|
||||||
$("#addMaterialCaterogyModal").modal('hide');
|
$("#addMaterialCaterogyModal").modal('hide');
|
||||||
$("#MatCate").append(`<option value="${materialCategory}" selected > ${materialCategory} </option>`)
|
$("#MatCate").append(`<option value="${materialCategory}" selected > ${materialCategory} </option>`);
|
||||||
}else{
|
|
||||||
|
}else if(response.status=="409"){
|
||||||
|
|
||||||
$("#addMaterialCaterogyModal").modal('hide');
|
$("#addMaterialCaterogyModal").modal('hide');
|
||||||
alert('Error Adding Category..!!');
|
|
||||||
|
$('#MatCate').val(materialCategory);
|
||||||
|
|
||||||
|
$('#MatCate').trigger('change');
|
||||||
|
|
||||||
|
setTimeout(()=>{ alert(`${response.message}`) },1000)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#addMaterialCaterogyModal").modal('hide');
|
||||||
|
|
||||||
|
setTimeout(()=>{ alert('Error Adding Category..!!'); },1000)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -162,7 +162,12 @@ if ($total <= $reorder) {
|
|||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="MaterialCategory">Material Category <span class="text-danger">*</span></label>
|
<label for="MaterialCategory">Material Category
|
||||||
|
<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" id="MaterialCategory" name="MaterialCategory" required>
|
<select class="form-control select2" id="MaterialCategory" name="MaterialCategory" required>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($materialCategoryList)) {
|
if (!empty($materialCategoryList)) {
|
||||||
@ -290,6 +295,71 @@ if ($total <= $reorder) {
|
|||||||
</div><!-- /.container-fluid -->
|
</div><!-- /.container-fluid -->
|
||||||
</div><!-- /.content -->
|
</div><!-- /.content -->
|
||||||
</div><!-- /.content-page -->
|
</div><!-- /.content-page -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 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">×</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -409,3 +479,64 @@ if ($total <= $reorder) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</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');
|
||||||
|
$("#MaterialCategory").append(`<option value="${materialCategory}" selected > ${materialCategory} </option>`)
|
||||||
|
}
|
||||||
|
else if(response.status=="409"){
|
||||||
|
|
||||||
|
$("#addMaterialCaterogyModal").modal('hide');
|
||||||
|
|
||||||
|
$('#MaterialCategory').val(materialCategory);
|
||||||
|
|
||||||
|
$('#MaterialCategory').trigger('change');
|
||||||
|
|
||||||
|
setTimeout(()=>{ alert(`${response.message}`) },1000)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#addMaterialCaterogyModal").modal('hide');
|
||||||
|
|
||||||
|
setTimeout(()=>{ alert('Error Adding Category..!!'); },1000)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
// Handle errors
|
||||||
|
alert('Error adding category');
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -82,13 +82,16 @@ $energyType=$masterData['energy_type']??'';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row" >
|
<br>
|
||||||
|
|
||||||
<div class="form-group" >
|
<!-- submit and cancel button section -->
|
||||||
|
<div class="form-row" align="right" >
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success">Submit</button>
|
<div class="form-group col" >
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-info waves-effect waves-light">Submit</button>
|
||||||
|
|
||||||
<button type="button" class="btn btn-danger" onclick="window.history.back();">
|
<button type="button" class="btn btn-secondary" onclick="window.history.back();">
|
||||||
Cancel</button>
|
Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user