From 3e46d6568f95bbfb7c35647191c4d3e566bf5154 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Thu, 26 Dec 2024 18:15:46 +0530 Subject: [PATCH] master module 4 vadivel J 26-12-2024 --- app/Models/Rawmaterialdetails_model.php | 1 + app/Views/addRawMaterial.php | 53 ++++++-- app/Views/addasset.php | 94 ++++++++----- app/Views/addconfig.php | 20 ++- app/Views/costListing.php | 11 ++ app/Views/editOldasset.php | 41 ++++-- app/Views/editRawmaterial.php | 26 +++- app/Views/editconfig.php | 125 ++++++++++-------- app/Views/factoryMachineMasterDetailsForm.php | 70 +++++++++- app/Views/rawmaterialListing.php | 2 +- app/Views/transporterListing.php | 18 ++- 11 files changed, 328 insertions(+), 133 deletions(-) diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index f55d0740..bafa376a 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -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 { diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index f4d04b62..5204b22b 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -42,14 +42,14 @@
-
+
- +
@@ -137,7 +137,7 @@
- +
@@ -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: "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; } @@ -434,4 +454,15 @@ } + + + + \ No newline at end of file diff --git a/app/Views/addasset.php b/app/Views/addasset.php index 2736f2cf..4458c5e9 100755 --- a/app/Views/addasset.php +++ b/app/Views/addasset.php @@ -158,7 +158,7 @@
- +
@@ -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:'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:'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; + } + + }); + + + + + + \ No newline at end of file diff --git a/app/Views/addconfig.php b/app/Views/addconfig.php index 81a5f4e6..a77a1c03 100755 --- a/app/Views/addconfig.php +++ b/app/Views/addconfig.php @@ -92,7 +92,7 @@
Cancel - +
@@ -388,7 +388,7 @@ + + + + \ No newline at end of file diff --git a/app/Views/costListing.php b/app/Views/costListing.php index cc7011d1..95306a3f 100755 --- a/app/Views/costListing.php +++ b/app/Views/costListing.php @@ -429,4 +429,15 @@ }); }); + + + + \ No newline at end of file diff --git a/app/Views/editOldasset.php b/app/Views/editOldasset.php index d8cf9059..35c903af 100755 --- a/app/Views/editOldasset.php +++ b/app/Views/editOldasset.php @@ -156,7 +156,7 @@ if (!empty($assetList)) {
-
+
@@ -272,7 +272,7 @@ if (!empty($assetList)) {
Cancel - +
@@ -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:'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)) { + + + + \ No newline at end of file diff --git a/app/Views/editRawmaterial.php b/app/Views/editRawmaterial.php index 43562a7a..7e92c24d 100755 --- a/app/Views/editRawmaterial.php +++ b/app/Views/editRawmaterial.php @@ -289,7 +289,7 @@ if ($total <= $reorder) { - +
@@ -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: "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) { } - \ No newline at end of file + + + + \ No newline at end of file diff --git a/app/Views/editconfig.php b/app/Views/editconfig.php index bbec5608..ffbd6771 100755 --- a/app/Views/editconfig.php +++ b/app/Views/editconfig.php @@ -37,7 +37,7 @@ if (!empty($master)) { helper('form'); $error = session()->getFlashdata('error'); if ($error) { - ?> + ?>
getFlashdata('error'); ?> @@ -47,7 +47,7 @@ if (!empty($master)) { getFlashdata('success'); if ($success) { - ?> + ?>
getFlashdata('success'); ?> @@ -61,7 +61,7 @@ if (!empty($master)) {
'form-horizontal', 'id' => 'editConfig'); - echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes);?> + echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes); ?>
@@ -77,13 +77,13 @@ if (!empty($master)) { * '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); ?>
- + * 'Remarks', 'value' => set_value('Remarks', $Comments), 'id' => 'Remarks', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20'); @@ -95,8 +95,8 @@ if (!empty($master)) {
  Add - Configuration + class="btn btn-success">   + Configuration Value
@@ -134,7 +134,7 @@ if (!empty($master)) { $index = 0; foreach ($child as $con) { $index++; - ?> + ?> @@ -143,10 +143,10 @@ if (!empty($master)) { value="ConfigValue ?>"> " style="isActive == 0) { - echo "display:none"; - } ?>"> + echo "deactivatedRow"; + } ?>" style="isActive == 0) { + echo "display:none"; + } ?>"> ConfigValue; ?> @@ -168,8 +168,8 @@ if (!empty($master)) { title="Click here to Edit Config Value"> -       - +       + @@ -182,7 +182,7 @@ if (!empty($master)) { - @@ -194,7 +194,7 @@ if (!empty($master)) {
@@ -234,8 +234,7 @@ if (!empty($master)) {
@@ -330,13 +329,14 @@ if (!empty($master)) { + @@ -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; } + + + \ No newline at end of file diff --git a/app/Views/factoryMachineMasterDetailsForm.php b/app/Views/factoryMachineMasterDetailsForm.php index acf72a75..912f269f 100644 --- a/app/Views/factoryMachineMasterDetailsForm.php +++ b/app/Views/factoryMachineMasterDetailsForm.php @@ -54,10 +54,18 @@ $energyType = $masterData['energy_type'] ?? ''; -
" method="post" - class="form-label-left"> + + id="factoryFormId" + class="form-label-left"> + +
@@ -79,7 +87,7 @@ $energyType = $masterData['energy_type'] ?? ''; class="text-danger">*