auto search box in add and edit material screen
This commit is contained in:
parent
c2e8210213
commit
69b87bddf9
@ -117,6 +117,9 @@ class rawmaterialdetails extends BaseController
|
|||||||
function addNewRawMaterial()
|
function addNewRawMaterial()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//echo "HI";die();
|
||||||
|
$TempArr = [];
|
||||||
|
|
||||||
$this->form_validation->set_rules('MaterialName','Material Name','trim|required|');
|
$this->form_validation->set_rules('MaterialName','Material Name','trim|required|');
|
||||||
$this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate');
|
$this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate');
|
||||||
$this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback_materialcategory_validate');
|
$this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback_materialcategory_validate');
|
||||||
@ -128,16 +131,34 @@ class rawmaterialdetails extends BaseController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$MaterialName = $this->input->post('MaterialName');//print_r($MaterialName);
|
$MaterialName = $this->input->post('MaterialName');
|
||||||
$MaterialType = $this->input->post('MaterialType');
|
$MaterialType = $this->input->post('MaterialType');
|
||||||
$UOM = $this->input->post('UOM');
|
$UOM = $this->input->post('UOM');
|
||||||
$MaterialCategory = $this->input->post('MaterialCategory');
|
$MaterialCategory = $this->input->post('MatCate');
|
||||||
|
$materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory();
|
||||||
|
|
||||||
|
foreach($materialcategoryarray as $mc){
|
||||||
|
$TempArr[] = $mc->ConfigValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
//print_r($TempArr);
|
||||||
|
if (in_array($MaterialCategory, $TempArr))
|
||||||
|
{
|
||||||
|
//echo "Match found";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//echo "Match not found";
|
||||||
|
$configcode = 'C023';
|
||||||
|
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$MaterialCategory);
|
||||||
|
$query= $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||||
|
}
|
||||||
$Remarks = $this->input->post('remarks');
|
$Remarks = $this->input->post('remarks');
|
||||||
$asset = $this->input->post('Assetcode');//print_r($AssetCode);
|
$asset = $this->input->post('Assetcode');
|
||||||
$costcentercode = $this->input->post('Costcenter');//print_r($CostCenterCode);
|
$costcentercode = $this->input->post('Costcenter');
|
||||||
$ConversionFactor = $this->input->post('conversionfactor');
|
$ConversionFactor = $this->input->post('conversionfactor');
|
||||||
$cfuom = $this->input->post('conversionfactorUOM');//print_r( $ConversionFactorUOM);
|
$cfuom = $this->input->post('conversionfactorUOM');
|
||||||
$HSN = $this->input->post('HSNcode');//print_r($HSNcode);
|
$HSN = $this->input->post('HSNcode');
|
||||||
$CreatedBy = $this->session->userdata('userId');
|
$CreatedBy = $this->session->userdata('userId');
|
||||||
|
|
||||||
$chked = $this->input->post('isactive');
|
$chked = $this->input->post('isactive');
|
||||||
@ -241,6 +262,7 @@ class rawmaterialdetails extends BaseController
|
|||||||
*/
|
*/
|
||||||
function editRawmaterial()
|
function editRawmaterial()
|
||||||
{
|
{
|
||||||
|
|
||||||
// if($this->isAdmin() == TRUE)
|
// if($this->isAdmin() == TRUE)
|
||||||
// {
|
// {
|
||||||
// $this->loadThis();
|
// $this->loadThis();
|
||||||
@ -264,6 +286,24 @@ class rawmaterialdetails extends BaseController
|
|||||||
$MaterialName = $this->input->post('MaterialName');
|
$MaterialName = $this->input->post('MaterialName');
|
||||||
$MaterialType = $this->input->post('MaterialType');
|
$MaterialType = $this->input->post('MaterialType');
|
||||||
$MaterialCategory =$this->input->post('MaterialCategory');
|
$MaterialCategory =$this->input->post('MaterialCategory');
|
||||||
|
$materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory();
|
||||||
|
|
||||||
|
foreach($materialcategoryarray as $mc){
|
||||||
|
$TempArr[] = $mc->ConfigValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
//print_r($TempArr);
|
||||||
|
if (in_array($MaterialCategory, $TempArr))
|
||||||
|
{
|
||||||
|
//echo "Match found";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//echo "Match not found";
|
||||||
|
$configcode = 'C023';
|
||||||
|
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$MaterialCategory);
|
||||||
|
$query= $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||||
|
}
|
||||||
$UOM = $this->input->post('UOM');
|
$UOM = $this->input->post('UOM');
|
||||||
$rmcode = $this->input->post('RMcode');
|
$rmcode = $this->input->post('RMcode');
|
||||||
$Remarks = $this->input->post('remarks');
|
$Remarks = $this->input->post('remarks');
|
||||||
@ -318,7 +358,7 @@ class rawmaterialdetails extends BaseController
|
|||||||
|
|
||||||
$RawMaterial = array();
|
$RawMaterial = array();
|
||||||
$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode);//,'RMCode'=>$rmcode);
|
$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode);//,'RMCode'=>$rmcode);
|
||||||
//print_r($RawMaterial);//die();
|
|
||||||
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
|
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
|
||||||
|
|
||||||
if($result == true)
|
if($result == true)
|
||||||
@ -336,6 +376,31 @@ class rawmaterialdetails extends BaseController
|
|||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
function autocomplete()
|
||||||
|
{
|
||||||
|
$this->load->model('model','rawmaterialdetails_model');
|
||||||
|
|
||||||
|
$mc = $this->input->get('query');
|
||||||
|
//echo $mc;die;
|
||||||
|
$query= $this->rawmaterialdetails_model->checkMaterialCategory($mc);
|
||||||
|
|
||||||
|
echo json_encode($query);
|
||||||
|
// foreach($query->result() as $row):
|
||||||
|
// echo "<li id='$row->id'>".$row->Category."</li>";
|
||||||
|
// endforeach;
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertvalueintoconfig(){
|
||||||
|
$this->load->model('model','rawmaterialdetails_model');
|
||||||
|
$mc = $this->input->post('id');
|
||||||
|
$configcode = 'C023';
|
||||||
|
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$mc);
|
||||||
|
|
||||||
|
$query= $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** this function can be use for excel report **/
|
/** this function can be use for excel report **/
|
||||||
|
|
||||||
|
|||||||
@ -97,6 +97,12 @@ class rawmaterialdetails_model extends CI_Model
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function insertvalueintoconfig($config){
|
||||||
|
|
||||||
|
$this->db->insert('T_ConfigDetails', $config);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function used to get user information by id
|
* This function used to get user information by id
|
||||||
* @param number $userId : This is user id
|
* @param number $userId : This is user id
|
||||||
@ -189,5 +195,35 @@ class rawmaterialdetails_model extends CI_Model
|
|||||||
return $query->result();
|
return $query->result();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function checkMaterialCategory($mc){
|
||||||
|
|
||||||
|
// $this->db->select('ConfigValue');
|
||||||
|
// $this->db->from('T_ConfigDetails');
|
||||||
|
// $this->db->where(Config_ID,'C023');
|
||||||
|
// $this->db->like('ConfigValue',$mc);
|
||||||
|
// $query = $this->db->get();
|
||||||
|
// //print_r($query->result());
|
||||||
|
// return $query->result();
|
||||||
|
|
||||||
|
// //return $this->db->get('T_MaterialMaster');
|
||||||
|
// }
|
||||||
|
$temp[] = '' ;
|
||||||
|
echo $materialcategory;
|
||||||
|
$this->db->distinct();
|
||||||
|
$this->db->select('ConfigValue');
|
||||||
|
$this->db->from('T_ConfigDetails');
|
||||||
|
$this->db->where('Config_ID','C023');
|
||||||
|
$this->db->like('ConfigValue',$mc);
|
||||||
|
$query = $this->db->get();
|
||||||
|
//print_r($query->result());die;
|
||||||
|
$temparr[] = '' ;
|
||||||
|
foreach($query->result() as $arr){
|
||||||
|
$temparr[] = $arr->ConfigValue ;
|
||||||
|
}
|
||||||
|
$temp['suggestions'] = $temparr;
|
||||||
|
//print_r($temp);
|
||||||
|
|
||||||
|
return $temp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -1,59 +1,17 @@
|
|||||||
<script>
|
<style>
|
||||||
function isNumberKey(evt)
|
.autocomplete-suggestion{
|
||||||
{
|
cursor:pointer;
|
||||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
background-color:skyblue;
|
||||||
if (charCode != 46 && charCode > 31
|
/* background-color: darkgrey; */
|
||||||
&& (charCode < 48 || charCode > 57))
|
outline: 1px solid slategrey;
|
||||||
return false;
|
}
|
||||||
|
</style>
|
||||||
return true;
|
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// function BlockSpecial(evt) {
|
|
||||||
// var charCode;
|
|
||||||
// if (window.event
|
|
||||||
// charCode = window.event.keyCode; //for IE
|
|
||||||
// else
|
|
||||||
// charCode = evt.which; //for firefox
|
|
||||||
|
|
||||||
// if (charCode >= 91 && charCode <= 96)
|
|
||||||
// return false;
|
|
||||||
// if (charCode >= 123 && charCode <= 126)
|
|
||||||
// return false;
|
|
||||||
// if (charCode >= 33 && charCode <= 47)
|
|
||||||
// return false;
|
|
||||||
// if (charCode >= 58&& charCode <= 64)
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
function onlyAlphabets(evt) {
|
|
||||||
var charCode;
|
|
||||||
if (window.event)
|
|
||||||
charCode = window.event.keyCode; //for IE
|
|
||||||
else
|
|
||||||
charCode = evt.which; //for firefox
|
|
||||||
if (charCode == 32) //for <space> symbol
|
|
||||||
return true;
|
|
||||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<div class="content-wrapper" style="min-height: 537px;">
|
<div class="content-wrapper" style="min-height: 537px;">
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<h1>
|
<h1>
|
||||||
|
|
||||||
<center>Siddharth Industries - Add New Material </center>
|
<center>Siddharth Industries - Add New Material </center>
|
||||||
|
|
||||||
</h1>
|
</h1>
|
||||||
@ -74,12 +32,14 @@ function isNumberKey(evt)
|
|||||||
<!-- form start -->
|
<!-- form start -->
|
||||||
|
|
||||||
<form id="addUser" action="<?php echo base_url() ?>rawmaterialdetails/addNewRawMaterial" method="post" role="form">
|
<form id="addUser" action="<?php echo base_url() ?>rawmaterialdetails/addNewRawMaterial" method="post" role="form">
|
||||||
|
|
||||||
|
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="MaterialName">Material Name</label><font color="Red">*</font>
|
<label for="MaterialName">Material Name</label><font color="Red">*</font>
|
||||||
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" onchange="hello()" required id="MaterialName" name="MaterialName" maxlength="255">
|
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -104,30 +64,20 @@ function isNumberKey(evt)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
<div class="col-md-3" >
|
||||||
<label for="MaterialCategory">Material Category</label><font color="Red">*</font>
|
<div class="form-group autoSearch" id="mc">
|
||||||
<select class="form-control required select2" id="MaterialCategory" name="MaterialCategory" onchange="changeTextBox()">
|
<label for="Matcate">Material Caterogy</label><font color="Red">*</font>
|
||||||
<option value="" requried>Select Material Category</option>
|
<input type="text" class="form-control required " required id="MatCate" name="MatCate" maxlength="255">
|
||||||
<?php
|
<!-- <div id="tagsname"></div> -->
|
||||||
if(!empty($materialcategory))
|
<!-- <input type="text" class="form-control" id="HideMatCate" name="HideMatCate" readonly> -->
|
||||||
{
|
|
||||||
foreach ($materialcategory as $MC)
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $MC->ConfigValue ?>"><?php echo $MC->ConfigValue ?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
||||||
<select class="form-control required select2" id="UOM" name="UOM">
|
<select class="form-control required select2" id="UOM" name="UOM" onchange="changeTextBox();" >
|
||||||
<option value="" required>Select UOM</option>
|
<option value="" required>Select UOM</option>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($UOM))
|
if(!empty($UOM))
|
||||||
@ -278,6 +228,71 @@ function isNumberKey(evt)
|
|||||||
</div>
|
</div>
|
||||||
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
|
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
//var tempARRAY = [];
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#MaterialType").select2();
|
||||||
|
|
||||||
|
// $("#MaterialCategory").select2();
|
||||||
|
$("#UOM").select2();
|
||||||
|
$("#Assetcode").select2();
|
||||||
|
$("#Costcenter").select2();
|
||||||
|
$("#conversionfactorUOM").select2();
|
||||||
|
|
||||||
|
$('#MatCate').autocomplete({
|
||||||
|
|
||||||
|
onSearchStart: function (query) {
|
||||||
|
//alert(query);
|
||||||
|
$('#MatCate').autocomplete("option", "minLength", 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||||
|
onSelect: function (suggestion) {
|
||||||
|
|
||||||
|
var data = suggestion.ConfigValue;
|
||||||
|
//var str = data.split('-');
|
||||||
|
|
||||||
|
//console.log(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function isNumberKey(evt)
|
||||||
|
{
|
||||||
|
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||||
|
if (charCode != 46 && charCode > 31
|
||||||
|
&& (charCode < 48 || charCode > 57))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onlyAlphabets(evt) {
|
||||||
|
var charCode;
|
||||||
|
if (window.event)
|
||||||
|
charCode = window.event.keyCode; //for IE
|
||||||
|
else
|
||||||
|
charCode = evt.which; //for firefox
|
||||||
|
if (charCode == 32) //for <space> symbol
|
||||||
|
return true;
|
||||||
|
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||||
|
return false;
|
||||||
|
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||||
|
return false;
|
||||||
|
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#MaterialName').change(function() {
|
$('#MaterialName').change(function() {
|
||||||
|
|
||||||
var materialname = $('#MaterialName').val();
|
var materialname = $('#MaterialName').val();
|
||||||
@ -345,35 +360,16 @@ function Validate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//corrected
|
|
||||||
$(document).ready(function(){
|
|
||||||
// $("#MaterialType").select2();
|
|
||||||
|
|
||||||
// $("#MaterialCategory").select2();
|
|
||||||
// $("#UOM").select2();
|
|
||||||
// $("#Assetcode").select2();
|
|
||||||
// $("#Costcenter").select2();
|
|
||||||
// $("#conversionfactorUOM").select2();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
function changeTextBox() {
|
function changeTextBox() {
|
||||||
var x = document.getElementById("MaterialCategory");
|
var x = document.getElementById("MatCate");
|
||||||
if(x.value=='Spares')
|
if(x.value=='Spares')
|
||||||
{
|
{
|
||||||
document.getElementById("Assetcode").disabled=false;
|
document.getElementById("Assetcode").disabled=false;
|
||||||
document.getElementById("Costcenter").disabled=false;
|
document.getElementById("Costcenter").disabled=false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
document.getElementById("Assetcode").disabled=true;
|
document.getElementById("Assetcode").disabled=true;
|
||||||
document.getElementById("Costcenter").disabled=true; }
|
document.getElementById("Costcenter").disabled=true; }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -46,100 +46,15 @@ if(!empty($materialDetails))
|
|||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<style>
|
||||||
|
.autocomplete-suggestion{
|
||||||
<script>
|
cursor:pointer;
|
||||||
$(document).ready(function(){
|
background-color:skyblue;
|
||||||
|
/* background-color: darkgrey; */
|
||||||
//$("#MaterialType").select2();
|
outline: 1px solid slategrey;
|
||||||
//$("#MaterialCategory").select2();
|
|
||||||
// $("#UOM").select2();
|
|
||||||
// $("#Assetcode").select2();
|
|
||||||
// $("#Costcenter").select2();
|
|
||||||
// $("#conversionfactorUOM").select2();
|
|
||||||
|
|
||||||
var x = $("#MaterialCategory").val() == 'Spares';
|
|
||||||
if(x)
|
|
||||||
{
|
|
||||||
document.getElementById("Assetcode").disabled=false;
|
|
||||||
document.getElementById("Costcenter").disabled=false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//alert('i am a else part');
|
|
||||||
document.getElementById("Assetcode").disabled=true;
|
|
||||||
document.getElementById("Costcenter").disabled=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
function onlyAlphabets(evt) {
|
|
||||||
var charCode;
|
|
||||||
if (window.event)
|
|
||||||
charCode = window.event.keyCode; //for IE
|
|
||||||
else
|
|
||||||
charCode = evt.which; //for firefox
|
|
||||||
if (charCode == 32) //for <space> symbol
|
|
||||||
return true;
|
|
||||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function isNumberKey(evt)
|
|
||||||
{
|
|
||||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
|
||||||
if (charCode != 46 && charCode > 31
|
|
||||||
&& (charCode < 48 || charCode > 57))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// $(function() {
|
|
||||||
// $('#MaterialCategory').change(function() {
|
|
||||||
// var x = $(this).val();
|
|
||||||
// alert(x);
|
|
||||||
// $('#mchiddenfield').val(x);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
function onlyAlphabets(evt) {
|
|
||||||
var charCode;
|
|
||||||
if (window.event)
|
|
||||||
charCode = window.event.keyCode; //for IE
|
|
||||||
else
|
|
||||||
charCode = evt.which; //for firefox
|
|
||||||
if (charCode == 32) //for <space> symbol
|
|
||||||
return true;
|
|
||||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function changeTextBox() {
|
|
||||||
//alert('changeTextBox entered');
|
|
||||||
var x = document.getElementById("MaterialCategory");
|
|
||||||
if(x.value=='Spares')
|
|
||||||
{
|
|
||||||
//alert('i am an if part');
|
|
||||||
document.getElementById("Assetcode").disabled=false;
|
|
||||||
document.getElementById("Costcenter").disabled=false;}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//alert('i am a else part');
|
|
||||||
document.getElementById("Assetcode").disabled=true;
|
|
||||||
document.getElementById("Costcenter").disabled=true;}
|
|
||||||
}
|
}
|
||||||
</script>
|
</style>
|
||||||
|
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
|
||||||
<div class="content-wrapper" style="min-height: 537px;">
|
<div class="content-wrapper" style="min-height: 537px;">
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
@ -208,11 +123,19 @@ function changeTextBox() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
|
||||||
<label for="MaterialCategory">Material Category</label>
|
<div class="form-group autoSearch" id="mc">
|
||||||
<input type="text" class="form-control" readonly id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" onChange="changeTextBox();">
|
<label for="Matcate">Material Caterogy</label><font color="Red">*</font>
|
||||||
<!-- <select class="form-control readonly select2" id="MaterialCategory" name="MaterialCategory" onChange="changeTextBox();">
|
<input type="text" class="form-control required " required id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" maxlength="255">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div class="form-group">
|
||||||
|
<label for="MaterialCategory">Material Category</label><font color="Red">*</font>
|
||||||
|
<input type="text" class="form-control required " required id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" onChange="changeTextBox();" maxlength="255">
|
||||||
|
|
||||||
|
< <select class="form-control readonly select2" id="MaterialCategory" name="MaterialCategory" onChange="changeTextBox();">
|
||||||
<option value="<?php echo $MaterialCategory;?> "><?php echo $MaterialCategory;?></option>
|
<option value="<?php echo $MaterialCategory;?> "><?php echo $MaterialCategory;?></option>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($materialCategory))
|
if(!empty($materialCategory))
|
||||||
@ -226,15 +149,15 @@ function changeTextBox() {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
--> <!-- <input type='hidden' id='mchiddenfield' name='mchiddenfield' value=''> -->
|
-> <!- <input type='hidden' id='mchiddenfield' name='mchiddenfield' value=''> ->
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
||||||
<select class="form-control required select2" id="UOM" name="UOM">
|
<select class="form-control required select2" id="UOM" name="UOM" onchange="changeTextBox();" >
|
||||||
<option value="<?php echo $UOM;?>"><?php echo $UOM;?></option>
|
<option value="<?php echo $UOM;?>"><?php echo $UOM;?></option>
|
||||||
<?php
|
<?php
|
||||||
if(!empty($UOMList))
|
if(!empty($UOMList))
|
||||||
@ -389,6 +312,115 @@ function changeTextBox() {
|
|||||||
|
|
||||||
<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>
|
<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
//$("#MaterialType").select2();
|
||||||
|
//$("#MaterialCategory").select2();
|
||||||
|
$("#UOM").select2();
|
||||||
|
$("#Assetcode").select2();
|
||||||
|
$("#Costcenter").select2();
|
||||||
|
$("#conversionfactorUOM").select2();
|
||||||
|
|
||||||
|
$('#MaterialCategory').autocomplete({
|
||||||
|
|
||||||
|
onSearchStart: function (query) {
|
||||||
|
//alert(query);
|
||||||
|
$('#MatCate').autocomplete("option", "minLength", 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||||
|
onSelect: function (suggestion) {
|
||||||
|
|
||||||
|
var data = suggestion.ConfigValue;
|
||||||
|
//var str = data.split('-');
|
||||||
|
|
||||||
|
//console.log(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
var x = $("#MaterialCategory").val() == 'Spares';
|
||||||
|
if(x)
|
||||||
|
{
|
||||||
|
document.getElementById("Assetcode").disabled=false;
|
||||||
|
document.getElementById("Costcenter").disabled=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//alert('i am a else part');
|
||||||
|
document.getElementById("Assetcode").disabled=true;
|
||||||
|
document.getElementById("Costcenter").disabled=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
function onlyAlphabets(evt) {
|
||||||
|
var charCode;
|
||||||
|
if (window.event)
|
||||||
|
charCode = window.event.keyCode; //for IE
|
||||||
|
else
|
||||||
|
charCode = evt.which; //for firefox
|
||||||
|
if (charCode == 32) //for <space> symbol
|
||||||
|
return true;
|
||||||
|
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||||
|
return false;
|
||||||
|
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||||
|
return false;
|
||||||
|
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function isNumberKey(evt)
|
||||||
|
{
|
||||||
|
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||||
|
if (charCode != 46 && charCode > 31
|
||||||
|
&& (charCode < 48 || charCode > 57))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// $(function() {
|
||||||
|
// $('#MaterialCategory').change(function() {
|
||||||
|
// var x = $(this).val();
|
||||||
|
// alert(x);
|
||||||
|
// $('#mchiddenfield').val(x);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
function onlyAlphabets(evt) {
|
||||||
|
var charCode;
|
||||||
|
if (window.event)
|
||||||
|
charCode = window.event.keyCode; //for IE
|
||||||
|
else
|
||||||
|
charCode = evt.which; //for firefox
|
||||||
|
if (charCode == 32) //for <space> symbol
|
||||||
|
return true;
|
||||||
|
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||||
|
return false;
|
||||||
|
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||||
|
return false;
|
||||||
|
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function changeTextBox() {
|
||||||
|
//alert('changeTextBox entered');
|
||||||
|
var x = document.getElementById("MaterialCategory");
|
||||||
|
if(x.value=='Spares')
|
||||||
|
{
|
||||||
|
//alert('i am an if part');
|
||||||
|
document.getElementById("Assetcode").disabled=false;
|
||||||
|
document.getElementById("Costcenter").disabled=false;}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//alert('i am a else part');
|
||||||
|
document.getElementById("Assetcode").disabled=true;
|
||||||
|
document.getElementById("Costcenter").disabled=true;}
|
||||||
|
}
|
||||||
|
|
||||||
$('#MaterialName').change(function() {
|
$('#MaterialName').change(function() {
|
||||||
|
|
||||||
var materialname = $('#MaterialName').val();
|
var materialname = $('#MaterialName').val();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user