303 lines
13 KiB
PHP
303 lines
13 KiB
PHP
<style>
|
||
.autocomplete-suggestion {
|
||
cursor: pointer;
|
||
background-color: skyblue;
|
||
/* background-color: darkgrey; */
|
||
outline: 1px solid slategrey;
|
||
}
|
||
</style>
|
||
<script>
|
||
$(function() {
|
||
$("#Date").datepicker({
|
||
//minDate :'now',
|
||
//maxDate : 'now',
|
||
dateFormat: 'dd-mm-yy',
|
||
changeMonth: true,
|
||
changeYear: true,
|
||
yearRange: '-100:+1'
|
||
});
|
||
});
|
||
</script>
|
||
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script>
|
||
<div class="content-wrapper" style="min-height: 537px;">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
<h1>
|
||
<center> Add New Material </center>
|
||
</h1>
|
||
</section>
|
||
|
||
<section class="content" id="content">
|
||
<div style="text-align:right;">
|
||
<a href="<?php echo base_url() ?>rawmaterialListing" class="btn btn-success" value="Back" />Back</a>
|
||
</div>
|
||
<br />
|
||
<div class="row">
|
||
<!-- left column -->
|
||
<div class="col-md-12">
|
||
<!-- general form elements -->
|
||
<div class="box box-success">
|
||
<!-- form start -->
|
||
<form id="addUser" action="<?php echo base_url() ?>addNewRawmaterial" method="post" role="form">
|
||
|
||
|
||
<div class="box-body">
|
||
<div class="col-md-12">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="MaterialName">Material Name</label>
|
||
<font color="Red">*</font>
|
||
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="MaterialType">Material Type</label>
|
||
<font color="Red">*</font>
|
||
<select class="form-control select2" required id="MaterialType" name="MaterialType">
|
||
<option value="" required>Select Material Type</option>
|
||
<?php
|
||
if (!empty($material)) {
|
||
foreach ($material as $SID) {
|
||
?>
|
||
<option value="<?php echo $SID->ConfigValue ?>"><?php echo $SID->ConfigValue ?></option>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group autoSearch" id="mc">
|
||
<label for="Matcate">Material Caterogy</label>
|
||
<font color="Red">*</font>
|
||
<input type="text" class="form-control required " required id="MatCate" name="MatCate" maxlength="255">
|
||
<!-- <div id="tagsname"></div> -->
|
||
<!-- <input type="text" class="form-control" id="HideMatCate" name="HideMatCate" readonly> -->
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="UOM">Unit of Measurement</label>
|
||
<font color="Red">*</font>
|
||
<select class="form-control required select2" id="UOM" name="UOM">
|
||
<option value="" required>Select UOM</option>
|
||
<?php
|
||
if (!empty($UOM)) {
|
||
foreach ($UOM as $SID) {
|
||
?>
|
||
<option value="<?php echo $SID->ConfigValue; ?>"><?php echo $SID->ConfigValue ?>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-12">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="HSNcode">HSN code</label>
|
||
<input type="text" class="form-control" id="HSNcode" onkeypress="return isNumberKey(event)" name="HSNcode" maxlength="8">
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="conversionfactor">Opening Stock</label>
|
||
<input type="text" class="form-control" id="openstock" name="openstock" maxlength="255">
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label>Open Stock Date</label>
|
||
<?php
|
||
$data = array('name' => 'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="conversionfactor">Reorder Level</label>
|
||
<input type="text" class="form-control" id="reorder" name="reorder" maxlength="255">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-12">
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<label for="remarks">Remarks</label>
|
||
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255">
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="Active">IsActive</label> <br>
|
||
<input type="checkbox" id="isactive" name="isactive">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="box-footer" style="text-align:right">
|
||
<input type="reset" class="btn btn-success" value="Reset" />
|
||
<input type="submit" onclick="Validate();" value="Submit" class="btn btn-success">
|
||
</div>
|
||
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<?php
|
||
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'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
<?php
|
||
$success = session()->getFlashdata('success');
|
||
if ($success) {
|
||
?>
|
||
<div class="alert alert-success alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo session()->getFlashdata('success'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
|
||
?> </div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
</div>
|
||
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
|
||
<script>
|
||
//var tempARRAY = [];
|
||
$(document).ready(function() {
|
||
$("#MaterialType").select2();
|
||
|
||
// $("#MaterialCategory").select2();
|
||
$("#UOM").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;
|
||
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
|
||
|
||
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() {
|
||
|
||
var materialname = $('#MaterialName').val();
|
||
|
||
//material = material.replace(/\s*$/,"");
|
||
var material = materialname.replace(/ /g, '');
|
||
//alert(m.length+" "+m+" "+s+" "+s.length);
|
||
$('#content').loader('show');
|
||
$.ajax({
|
||
data: { id: material },
|
||
type: "POST",
|
||
url: "<?php echo base_url(); ?>materialExist",
|
||
success: function(data) {
|
||
var count = data.length;
|
||
//alert(count);
|
||
|
||
if (count > 2) {
|
||
$('#content').loader('hide');
|
||
alert('Material name already existed ! ');
|
||
|
||
var related_name = "";
|
||
$.each(data, function(i, obj) {
|
||
|
||
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.Category + "\n";
|
||
|
||
});
|
||
|
||
alert("'" + materialname + "' - related materials are , " + " \n \n" + related_name);
|
||
$("#MaterialName").focus();
|
||
} else {
|
||
$('#content').loader('hide');
|
||
// alert("empty data");
|
||
}
|
||
|
||
},error: function() {
|
||
$('#content').loader('hide');
|
||
alert("Error Occur");
|
||
}
|
||
});
|
||
});
|
||
|
||
function Validate() {
|
||
if ($("#MaterialName").val().length < 1) {
|
||
alert('Please Enter MaterialName');
|
||
$("#MaterialName").focus();
|
||
return false;
|
||
}
|
||
|
||
if ($("option:selected", $("#UOM")).val() == "") {
|
||
alert('Please Select UOM ');
|
||
$("#UOM").focus();
|
||
return false;
|
||
}
|
||
if ($("option:selected", $("#MaterialCategory")).val() == "") {
|
||
alert('Please Select Material Category');
|
||
$("#MaterialCategory").focus();
|
||
return false;
|
||
}
|
||
if ($("option:selected", $("#MaterialType")).val() == "") {
|
||
alert('Please Select Material Type');
|
||
$("#MaterialType").focus();
|
||
return false;
|
||
}
|
||
}
|
||
</script>
|