master module 4 vadivel J 26-12-2024
This commit is contained in:
parent
9eb7c54b97
commit
3e46d6568f
@ -323,6 +323,7 @@ class Rawmaterialdetails_model extends Model
|
||||
$builder->where('REPLACE(MaterialName, " ", "")' , $materialName);
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return $query->getResultArray();
|
||||
} else {
|
||||
|
||||
@ -42,14 +42,14 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="p-2">
|
||||
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewRawmaterial" method="post">
|
||||
<form role="form" id="addMaterialForm" action="<?php echo base_url() ?>addNewRawmaterial" method="post">
|
||||
<div class="box-body">
|
||||
<!-- Supplier Information -->
|
||||
<div class="col-md-12" style="margin-bottom: 27px;">
|
||||
<div class="form-row">
|
||||
<div class=" col-md-3">
|
||||
<label class="col-form-label" for="MaterialName">Material Name<span class="badge">*</span></label>
|
||||
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255">
|
||||
<input type="text" class="form-control required " required id="MaterialName" name="MaterialName" maxlength="255">
|
||||
</div>
|
||||
<div class=" col-md-3">
|
||||
<label class="col-form-label" for="MaterialType">Material Type<span class="badge">*</span></label>
|
||||
@ -137,7 +137,7 @@
|
||||
</div>
|
||||
<div class="col-md-12 text-right">
|
||||
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
|
||||
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
|
||||
<input type="button" id="addMaterialBtnId" value="Submit" class="btn btn-success">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -291,9 +291,18 @@
|
||||
|
||||
|
||||
|
||||
$('#MaterialName').change(function() {
|
||||
$('#addMaterialBtnId').click(function() {
|
||||
|
||||
var materialName = $('#MaterialName').val();
|
||||
|
||||
//validate
|
||||
|
||||
let validation = Validate();
|
||||
|
||||
if(!validation){
|
||||
return false;
|
||||
}
|
||||
|
||||
var materialName = $('#MaterialName').val().trim();
|
||||
var materialCode = '';
|
||||
|
||||
if(materialName == ''){
|
||||
@ -311,15 +320,19 @@
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>materialExist",
|
||||
success: function(data) {
|
||||
var count = data.length;
|
||||
if (count >= 1) {
|
||||
|
||||
if (data && data.length >= 1) {
|
||||
$('#loader').hide();
|
||||
|
||||
if(data[0]?.IsActive == 1){
|
||||
alert('Material name already existed ! ');
|
||||
$('#MaterialName').val('');
|
||||
|
||||
}else{
|
||||
|
||||
alert('Material name already existing in the deleted section.!!');
|
||||
$('#MaterialName').val('');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -330,11 +343,15 @@
|
||||
|
||||
});
|
||||
|
||||
alert("'" + materialname + "' - related materials are , " + " \n \n" + related_name);
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
} else {
|
||||
alert("'" + materialName + "' - related materials are , " + " \n \n" + related_name);
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
|
||||
|
||||
} else{
|
||||
$('#loader').hide();
|
||||
|
||||
$('addMaterialForm').submit();
|
||||
}
|
||||
|
||||
},
|
||||
@ -350,6 +367,7 @@
|
||||
});
|
||||
|
||||
function Validate() {
|
||||
|
||||
if ($("#MaterialName").val().length < 1) {
|
||||
alert('Please Enter MaterialName');
|
||||
$("#MaterialName").focus();
|
||||
@ -371,6 +389,8 @@
|
||||
$("#MaterialType").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -434,4 +454,15 @@
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -158,7 +158,7 @@
|
||||
</div>
|
||||
<div class="col-md-12 text-right">
|
||||
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
|
||||
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
|
||||
<input type="button" id="addAssetBtnId" value="Submit" class="btn btn-success">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -383,8 +383,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
@ -431,43 +430,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#AssetName').on('change',function(){
|
||||
$('#addAssetBtnId').on('click',function(){
|
||||
|
||||
let assetName = $(this).val().trim();
|
||||
let assetId = $('#AssetCode').val() ?? '';
|
||||
let validation = validate();
|
||||
|
||||
$('#loader').show();
|
||||
if(validation){
|
||||
|
||||
let assetName = $('#AssetName').val().trim();
|
||||
let assetId = $('#AssetCode').val() ?? '';
|
||||
|
||||
$('#loader').show();
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url:'<?php echo base_url()?>assetdetails/checkAssetName',
|
||||
data:{assetId,assetName},
|
||||
success: function(data){
|
||||
if(data && data.length>0){
|
||||
let IsActive = data[0]?.IsActive;
|
||||
if(IsActive == 1){
|
||||
alert("Asset Name Exists..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
}else{
|
||||
alert("Asset Name Existing in deleted section..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
}
|
||||
}else{
|
||||
$('#addAsset').submit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
error: function(error){
|
||||
//error
|
||||
console.error('error ocurred' + error);
|
||||
},
|
||||
complete :function (){
|
||||
$('#loader').hide();
|
||||
console.log('ajax call completed..!!');
|
||||
}
|
||||
})
|
||||
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url:'<?php echo base_url()?>assetdetails/checkAssetName',
|
||||
data:{assetId,assetName},
|
||||
success: function(data){
|
||||
if(data && data.length>0){
|
||||
let IsActive = data[0]?.IsActive;
|
||||
if(IsActive == 1){
|
||||
alert("Asset Name Exists..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
}else{
|
||||
alert("Asset Name Existing in deleted section..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(error){
|
||||
//error
|
||||
console.error('error ocurred' + error);
|
||||
},
|
||||
complete :function (){
|
||||
$('#loader').hide();
|
||||
console.log('ajax call completed..!!');
|
||||
}
|
||||
})
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -92,7 +92,7 @@
|
||||
<div class="col-md-12 text-right">
|
||||
<input type="hidden" name="txtRowCount" id="txtRowCount" />
|
||||
<a class="btn btn-secondary" href="<?php echo base_url() ?>configlisting" class="btn btn-secondary">Cancel</a>
|
||||
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
|
||||
<input type="button" id="addConFigBtnId" value="Submit" class="btn btn-success">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -388,7 +388,7 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#configurationname').change(function () {
|
||||
$('#addConFigBtnId').click(function (){
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
|
||||
@ -408,7 +408,9 @@
|
||||
$('#configurationname').val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$('#addconfig').submit();
|
||||
}
|
||||
|
||||
},
|
||||
error:function(error){
|
||||
@ -438,4 +440,16 @@
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -429,4 +429,15 @@
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -156,7 +156,7 @@ if (!empty($assetList)) {
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form role="form" id="addAsset" action="<?php echo base_url() ?>editasset" method="post">
|
||||
<form role="form" id="editAsset" action="<?php echo base_url() ?>editasset" method="post">
|
||||
<div class="form-row">
|
||||
|
||||
<input type="text" class="form-control" id="AssetCode" name="AssetCode" value="<?php echo $AssetCode; ?>" hidden>
|
||||
@ -272,7 +272,7 @@ if (!empty($assetList)) {
|
||||
<div class="form-row mt-4 text-right">
|
||||
<div class="col-md-12">
|
||||
<a href="<?php echo base_url() ?>assetListing" class="btn btn-secondary">Cancel</a>
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
<button type="button" id="editAssetBtnId" class="btn btn-success">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -426,7 +426,7 @@ if (!empty($assetList)) {
|
||||
|
||||
|
||||
|
||||
$('#AssetName').on('change',function(){
|
||||
$('#editAssetBtnId').on('click',function(){
|
||||
|
||||
let assetId = $('#AssetCode').val();
|
||||
let assetName = $(this).val().trim();
|
||||
@ -438,18 +438,22 @@ if (!empty($assetList)) {
|
||||
url:'<?php echo base_url()?>assetdetails/checkAssetName',
|
||||
data:{assetId,assetName},
|
||||
success: function(data){
|
||||
if(data && data.length>0){
|
||||
let IsActive = data[0]?.IsActive;
|
||||
if(IsActive == 1){
|
||||
alert("Asset Name Exists..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
if(data && data.length>0){
|
||||
let IsActive = data[0]?.IsActive;
|
||||
if(IsActive == 1){
|
||||
alert("Asset Name Exists..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
}else{
|
||||
alert("Asset Name Existing in deleted section..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
}
|
||||
}else{
|
||||
alert("Asset Name Existing in deleted section..!!");
|
||||
$('#AssetName').val('');
|
||||
$('#AssetName').focus();
|
||||
|
||||
$('#editAsset').submit();
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(error){
|
||||
//error
|
||||
@ -465,4 +469,15 @@ if (!empty($assetList)) {
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -289,7 +289,7 @@ if ($total <= $reorder) {
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back()">
|
||||
<span class="bold">Cancel</span>
|
||||
</button>
|
||||
<input type="submit" class="btn btn-success" value="Submit" />
|
||||
<input type="button" id="editRawMaterialBtnId" class="btn btn-success" value="Submit" />
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.card-body -->
|
||||
@ -438,7 +438,7 @@ if ($total <= $reorder) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$('#MaterialName').change(function() {
|
||||
$('#editRawMaterialBtnId').click(function(){
|
||||
|
||||
var materialName = $('#MaterialName').val();
|
||||
var materialCode = $('#RMcode').val();
|
||||
@ -458,15 +458,15 @@ if ($total <= $reorder) {
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>materialExist",
|
||||
success: function(data) {
|
||||
var count = data.length;
|
||||
|
||||
if (count >= 1) {
|
||||
if (data && data.length >= 1) {
|
||||
$('#loader').hide();
|
||||
if(data[0]?.IsActive == 1){
|
||||
alert('Material name already existed ! ');
|
||||
$('#MaterialName').val('');
|
||||
}else{
|
||||
alert('Material name already existing in the deleted section.!!');
|
||||
$('#MaterialName').val('');
|
||||
}
|
||||
var related_name = "";
|
||||
$.each(data, function(i, obj) {
|
||||
@ -475,12 +475,13 @@ if ($total <= $reorder) {
|
||||
|
||||
});
|
||||
|
||||
alert("'" + materialname + "' - related materials are , " + " \n \n" + related_name);
|
||||
alert("'" + materialName + "' - related materials are , " + " \n \n" + related_name);
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
} else {
|
||||
$('#loader').hide();
|
||||
// alert("empty data");
|
||||
console.log("working")
|
||||
$('#editRawmaterial').submit();
|
||||
}
|
||||
|
||||
},
|
||||
@ -556,4 +557,15 @@ if ($total <= $reorder) {
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -37,7 +37,7 @@ if (!empty($master)) {
|
||||
helper('form');
|
||||
$error = session()->getFlashdata('error');
|
||||
if ($error) {
|
||||
?>
|
||||
?>
|
||||
<div class="alert alert-danger alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<?php echo session()->getFlashdata('error'); ?>
|
||||
@ -47,7 +47,7 @@ if (!empty($master)) {
|
||||
<?php
|
||||
$success = session()->getFlashdata('success');
|
||||
if ($success) {
|
||||
?>
|
||||
?>
|
||||
<div class="alert alert-info alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<?php echo session()->getFlashdata('success'); ?>
|
||||
@ -61,7 +61,7 @@ if (!empty($master)) {
|
||||
<div class="card-body">
|
||||
<?php
|
||||
$attributes = array('class' => 'form-horizontal', 'id' => 'editConfig');
|
||||
echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes);?>
|
||||
echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes); ?>
|
||||
|
||||
<div class="form-row" style="margin-top:10px">
|
||||
<div class="col-md-3">
|
||||
@ -77,13 +77,13 @@ if (!empty($master)) {
|
||||
<label class="col-form-label" for="ConfigName">Configuration Name</label>
|
||||
<font color="Red">*</font>
|
||||
<?php
|
||||
$data = array('name' => 'ConfigName', 'value' => set_value('ConfigName', $ConfigName), 'id' => 'ConfigName', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
|
||||
$data = array('name' => 'ConfigName', 'value' => set_value('ConfigName', $ConfigName), 'id' => 'ConfigName', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '30');
|
||||
echo form_input($data);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="col-form-label" for="Remarks">Comments</label>
|
||||
<label class="col-form-label" for="Remarks"> Comments </label>
|
||||
<font color="Red">*</font>
|
||||
<?php
|
||||
$data = array('name' => 'Remarks', 'value' => set_value('Remarks', $Comments), 'id' => 'Remarks', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
|
||||
@ -95,8 +95,8 @@ if (!empty($master)) {
|
||||
<div class="form-row" style="margin-top:10px">
|
||||
<div class="col-md-12 text-right">
|
||||
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;"
|
||||
class="btn btn-success"><i class="fa fa-plus"></i> Add
|
||||
Configuration</a>
|
||||
class="btn btn-success"><i class="fa fa-plus"></i>
|
||||
Configuration Value</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -134,7 +134,7 @@ if (!empty($master)) {
|
||||
$index = 0;
|
||||
foreach ($child as $con) {
|
||||
$index++;
|
||||
?>
|
||||
?>
|
||||
|
||||
<input type="hidden" name="DbKey<?php echo $index ?>"
|
||||
id="DbKey<?php echo $index ?>" value="<?php echo $con->Key ?>">
|
||||
@ -143,10 +143,10 @@ if (!empty($master)) {
|
||||
value="<?php echo $con->ConfigValue ?>">
|
||||
|
||||
<tr class="<?php if ($con->isActive == 0) {
|
||||
echo "deactivatedRow";
|
||||
} ?>" style="<?php if ($con->isActive == 0) {
|
||||
echo "display:none";
|
||||
} ?>">
|
||||
echo "deactivatedRow";
|
||||
} ?>" style="<?php if ($con->isActive == 0) {
|
||||
echo "display:none";
|
||||
} ?>">
|
||||
|
||||
<td><?php echo $index; ?></td>
|
||||
<td><?php echo $con->ConfigValue; ?></td>
|
||||
@ -168,8 +168,8 @@ if (!empty($master)) {
|
||||
title="Click here to Edit Config Value"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a onclick="confirmDeleteConfig(event)" href="<?php echo base_url() . 'configurationctrl/deleteConfigValue
|
||||
?ConfigValue=' . $con->ConfigValue . '
|
||||
&ConfigID=' . $con->Config_ID; ?>">
|
||||
@ -182,7 +182,7 @@ if (!empty($master)) {
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
<?php }
|
||||
} ?>
|
||||
<input type="hidden" name="txtRowCount" id="txtRowCount"
|
||||
value="<?php echo $index ?>" />
|
||||
@ -194,7 +194,7 @@ if (!empty($master)) {
|
||||
<div class="form-row text-right" style="margin-top:10px; text-align:right">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="<?php echo base_url() ?>configlisting" class="btn btn-secondary">Cancel</a>
|
||||
<input type="submit" class="btn btn-success" value="Update" />
|
||||
<input type="button" id="updateConfigBtnId" class="btn btn-success" value="Update" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -234,8 +234,7 @@ if (!empty($master)) {
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px"
|
||||
data-dismiss="modal">Cancel</a>
|
||||
<a class="btn btn-success font tempClickAdd" id="tempClickAdd"><i
|
||||
class="fa fa-plus"></i> Add</a>
|
||||
<a class="btn btn-success font tempClickAdd" id="tempClickAdd"> Add </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -330,13 +329,14 @@ if (!empty($master)) {
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
var index = $('#txtRowCount').val();
|
||||
var userid = '';
|
||||
|
||||
$("#Edit").on("shown.bs.modal", function (e) {
|
||||
$("#Edit").on("shown.bs.modal", function(e) {
|
||||
userid = $(e.relatedTarget).data('userid');
|
||||
$('#key').val($('#configtable tr:eq(' + userid + ') td:eq(0)').text());
|
||||
$('#Config_ID').val($('#ConfigId').val());
|
||||
@ -345,7 +345,7 @@ if (!empty($master)) {
|
||||
|
||||
});
|
||||
|
||||
$('.tempClickAdd').click(function () {
|
||||
$('.tempClickAdd').click(function() {
|
||||
|
||||
var cid = $('#ConfigId').val()
|
||||
if ($("#AddConfigValue").val() != '-1' && $("#AddConfigValue").val() != null && $("#AddConfigValue").val() != '') {
|
||||
@ -404,7 +404,7 @@ if (!empty($master)) {
|
||||
theForm.append(input);
|
||||
}
|
||||
|
||||
$('.tempClickUpdate').click(function () {
|
||||
$('.tempClickUpdate').click(function() {
|
||||
|
||||
|
||||
if ($("#configValue").val() != '') {
|
||||
@ -450,7 +450,7 @@ if (!empty($master)) {
|
||||
}
|
||||
|
||||
//var baseurl = "<?php print base_url(); ?>";
|
||||
$(".editConfig").submit(function (e) {
|
||||
$(".editConfig").submit(function(e) {
|
||||
if (validate()) {
|
||||
|
||||
$('#loader').show();
|
||||
@ -458,7 +458,7 @@ if (!empty($master)) {
|
||||
data: $('.editConfig').serialize(),
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>configurationctrl/configedit",
|
||||
success: function (data) {
|
||||
success: function(data) {
|
||||
//alert(data);
|
||||
$('#loader').hide();
|
||||
|
||||
@ -493,57 +493,60 @@ if (!empty($master)) {
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#ConfigName').change(function () {
|
||||
$('#updateConfigBtnId').click(function() {
|
||||
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
data: {
|
||||
configName: $('#ConfigName').val().trim(),
|
||||
configId : $('#ConfigId').val().trim()
|
||||
},
|
||||
configId: $('#ConfigId').val().trim()
|
||||
},
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>configurationctrl/configNameCheck",
|
||||
success: function (data) {
|
||||
success: function(data) {
|
||||
|
||||
if (data && data.length > 0) {
|
||||
|
||||
if (data[0]?.isActive == 1) {
|
||||
alert("This Configuration Name is already present. kindly change it..!!");
|
||||
$('#ConfigName').val('');
|
||||
return;
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
alert("This Configuration Name is already present in deleted section. kindly reactivate it If needed..!!");
|
||||
$('#ConfigName').val('');
|
||||
return;
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
$('#editConfig').submit();
|
||||
}
|
||||
|
||||
},
|
||||
error: function (error) {
|
||||
error: function(error) {
|
||||
console.log("error occured..!!", error);
|
||||
},
|
||||
complete: function () {
|
||||
complete: function() {
|
||||
$('#loader').hide();
|
||||
console.log('ajax call completed..!!');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
$('#AddConfigValue, #configValue').change(function () {
|
||||
$('#AddConfigValue, #configValue').change(function() {
|
||||
|
||||
let configValue = $(this).val();
|
||||
let configTable = customTableToJson();
|
||||
let configValueExisting = configTable.filter(element => element['Configuration Value'] == configValue);
|
||||
let configTable = customTableToJson();
|
||||
let configValueExisting = configTable.filter(element => element['Configuration Value'] == configValue);
|
||||
|
||||
if(configValueExisting && configValueExisting.length > 0){
|
||||
alert('configuration value is already present , Kindly check in Table and archive too..!!');
|
||||
$(this).val('');
|
||||
if (configValueExisting && configValueExisting.length > 0) {
|
||||
alert('configuration value is already present , Kindly check in Table and archive too..!!');
|
||||
$(this).val('');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -553,14 +556,14 @@ if (!empty($master)) {
|
||||
let headers = [];
|
||||
|
||||
// Get table headers
|
||||
$(`#configtable thead tr th`).each(function () {
|
||||
$(`#configtable thead tr th`).each(function() {
|
||||
headers.push($(this).text().trim());
|
||||
});
|
||||
|
||||
// Get table rows including hidden ones
|
||||
$(`#configtable tbody tr`).each(function () {
|
||||
$(`#configtable tbody tr`).each(function() {
|
||||
let row = {};
|
||||
$(this).find('td').each(function (index) {
|
||||
$(this).find('td').each(function(index) {
|
||||
// Use the headers as keys for JSON
|
||||
let header = headers[index];
|
||||
row[header] = $(this).text().trim();
|
||||
@ -570,19 +573,17 @@ if (!empty($master)) {
|
||||
}
|
||||
});
|
||||
|
||||
return rows;
|
||||
return rows;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
function showChildArchiveList() {
|
||||
let isChecked = $("#showChildArchiveId").prop('checked');
|
||||
|
||||
// Show or hide the rows based on checkbox status
|
||||
$(".deactivatedRow").each(function () {
|
||||
$(".deactivatedRow").each(function() {
|
||||
if (isChecked) {
|
||||
$(this).show();
|
||||
} else {
|
||||
@ -593,12 +594,12 @@ if (!empty($master)) {
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
let table = $('#configtable');
|
||||
|
||||
showChildArchiveList();
|
||||
|
||||
table.on('draw', function () {
|
||||
table.on('draw', function() {
|
||||
showChildArchiveList();
|
||||
});
|
||||
|
||||
@ -606,12 +607,28 @@ if (!empty($master)) {
|
||||
|
||||
function confirmDeleteConfig(event) {
|
||||
let result = confirm("Do You want to delete this configuration ?");
|
||||
if (result) { return; } else { event.preventDefault(); }
|
||||
if (result) {
|
||||
return;
|
||||
} else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function confirmReActivateConfig(event) {
|
||||
let result = confirm("Do You want to Re activate deleted configuration ?");
|
||||
if (result) { return; } else { event.preventDefault(); }
|
||||
if (result) {
|
||||
return;
|
||||
} else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -54,10 +54,18 @@ $energyType = $masterData['energy_type'] ?? '';
|
||||
|
||||
|
||||
|
||||
<form action="<?= empty($masterData)
|
||||
<form
|
||||
|
||||
|
||||
|
||||
action="<?= empty($masterData)
|
||||
? base_url('createFactoryMachineMasterDetails')
|
||||
: base_url('updateFactoryMachineMasterDetails?id=' . $masterData['id']); ?>" method="post"
|
||||
class="form-label-left">
|
||||
|
||||
id="factoryFormId"
|
||||
class="form-label-left">
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
@ -79,7 +87,7 @@ $energyType = $masterData['energy_type'] ?? '';
|
||||
class="text-danger">*</span></label>
|
||||
<select name="energyType" id="energyType"
|
||||
class="form-control searchabledropdown" data-toggle="select2" required>
|
||||
<option value="-1">Select Energy Type</option>
|
||||
<option value="">Select Energy Type</option>
|
||||
<option value="diesel" <?= $energyType == 'diesel' ? 'selected' : '' ?>> Diesel
|
||||
</option>
|
||||
<option value="petrol" <?= $energyType == 'petrol' ? 'selected' : '' ?>> Petrol
|
||||
@ -102,7 +110,7 @@ $energyType = $masterData['energy_type'] ?? '';
|
||||
|
||||
<div class="form-group col">
|
||||
|
||||
<button type="submit"
|
||||
<button type="button" id="submitBtnId"
|
||||
class="btn btn-info waves-effect waves-light">Submit</button>
|
||||
|
||||
<button type="button" class="btn btn-secondary"
|
||||
@ -127,8 +135,42 @@ $energyType = $masterData['energy_type'] ?? '';
|
||||
|
||||
|
||||
<script>
|
||||
$('#machineName').on('change', function () {
|
||||
let machineName = $(this).val().trim();
|
||||
|
||||
function validate(){
|
||||
|
||||
let machineName = $('#machineName').val().trim();
|
||||
let machineType = $('#machineType').val().trim();
|
||||
let energyType = $('#energyType').val().trim();
|
||||
|
||||
if(machineName == ''){
|
||||
alert('Machine Name is required..!!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(machineType == ''){
|
||||
alert('Machine Type is required..!!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(energyType == ''){
|
||||
alert('Energy Type is required..!!');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
$('#submitBtnId').on('click', function () {
|
||||
|
||||
|
||||
let validation = validate();
|
||||
|
||||
if(!validation){
|
||||
return;
|
||||
}
|
||||
|
||||
let machineName = $('#machineName').val().trim();
|
||||
let machineId = $('#machineId').val()??'';
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
@ -145,6 +187,9 @@ $energyType = $masterData['energy_type'] ?? '';
|
||||
alert("Machine Name already existing in the deleted section ..!!");
|
||||
$('#machineName').val('');
|
||||
}
|
||||
}else{
|
||||
|
||||
validation === true ? $('#factoryFormId').submit():'' ;
|
||||
}
|
||||
|
||||
},
|
||||
@ -158,4 +203,17 @@ $energyType = $masterData['energy_type'] ?? '';
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -52,7 +52,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
helper('form');
|
||||
helper('form');
|
||||
$error = session()->getFlashdata('error');
|
||||
if ($error) {
|
||||
$type = "error";
|
||||
|
||||
@ -251,10 +251,11 @@
|
||||
$('#tempClick').click(function () {
|
||||
//loader is initiated
|
||||
$('#loader').show();
|
||||
|
||||
if ($('#transportername').val() === '') {
|
||||
|
||||
if ($('#transportername').val().trim() === '') {
|
||||
alert('Please Enter the Transporter Name');
|
||||
return;
|
||||
$('#loader').hide();
|
||||
return false;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
@ -448,4 +449,15 @@
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault(); // Prevent default Enter key behavior
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user