377 lines
11 KiB
PHP
Executable File
377 lines
11 KiB
PHP
Executable File
<style>
|
|
th{
|
|
text-align:center ! important;
|
|
}
|
|
</style>
|
|
<?php
|
|
//print_r($specifications);
|
|
$pname = '';
|
|
$pdec = '';
|
|
$cnamme = '';
|
|
$pid='';
|
|
$cid='';
|
|
$type= '';
|
|
foreach($specifications as $s)
|
|
{
|
|
$pname = $s->product_name;
|
|
if(!empty($s->product_description)){
|
|
$pdec = $s->product_description;
|
|
}
|
|
$cname = $s->client_name;
|
|
$pid = $s->product_id;
|
|
$cid = $s->customer_id;
|
|
$type = $s->type;
|
|
break;
|
|
}
|
|
|
|
?>
|
|
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
|
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Product Customer Test Specification Master Screen</center>
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<!--<center><h3 class="box-title">-->
|
|
<div class="box-tools">
|
|
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
|
|
<form action="<?php echo base_url() ?>monthlypay/monthlyListing" method="POST" id="searchList">
|
|
|
|
</form>
|
|
</div><!--</h3></center>-->
|
|
|
|
</div><!-- /.box-header -->
|
|
|
|
|
|
<div class="box-body">
|
|
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<input type="text" name="p" id="p" class="form-control" value="<?php echo $pname;if(!empty($pdec)){echo '-'.$pdec;};?>" readonly>
|
|
<input type="hidden" name="product" id="product" value="<?php echo $pid;?>">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<input type="text" name="c" id="c" class="form-control" value="<?php echo $cname;?>" readonly>
|
|
<input type="hidden" name="customer" id="customer" value="<?php echo $cid;?>">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<input type="text" id="ttype" class="form-control" value = "<?php echo $type;?>" readonly>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="button" id="addspec" class="btn btn-success" value = "Add New Specification">
|
|
</div>
|
|
|
|
</div>
|
|
<br/>
|
|
<table id="testspecifications" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<thead>
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
<th>UOM</th>
|
|
<th>Min</th>
|
|
<th>Max</th>
|
|
<th>Temp</th>
|
|
<th style="width:100px;">Raw Sand Test</th>
|
|
|
|
<th>Action</th>
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="specAppend">
|
|
<?php
|
|
$index = 0;
|
|
if(!empty($specifications))
|
|
{
|
|
|
|
foreach($specifications as $data)
|
|
{
|
|
//print_r($data);
|
|
$index++;
|
|
?>
|
|
<tr id="<?php echo $index;?>"> <td><?php echo $data->testtype?></td> <td contenteditable="true"><?php echo $data->uom?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->min?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->max?></td> <td contenteditable="true" style="text-align:right;"><?php if(!empty($data->temp)){ echo $data->temp; } else { echo "-"; }?></td>
|
|
<td <?php if($type == 'INPROCESS'){ echo "contenteditable='true'";}else {echo "contenteditable='false'";}?> style="text-align:center;"><?php if($data->subtype == 0){echo 'NO';}else {echo 'YES';}?> <td style="text-align:center;"><a href='#' onclick = "DeleteRow(this.parentNode.parentNode.id);"> <span class="glyphicon glyphicon-trash"></span></td> </tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<p> </p>
|
|
<div class="row">
|
|
<div class="col-md-3" id="savebutton">
|
|
<input type="button" id="submit" value = "Save" class="btn btn-success" onclick="getAllData();">
|
|
</div>
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
<!-- <div class="box-footer clearfix">
|
|
|
|
</div> -->
|
|
</div><!-- /.box -->
|
|
|
|
<div id="specmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
|
|
<div class="modal-dialog">
|
|
|
|
<!-- Modal content-->
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<h4 class="modal-title">Add New Specification</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form>
|
|
<center>
|
|
<table >
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;">Specification Name</td><td style="padding:10px;"><input type="text" name="spname" id="spname"/> </td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;">UOM</td><td style="padding:10px;"><input type="text" name="uom" id="uom"/> </td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;">Min</td><td style="padding:10px;"><input type="text" name="min`" id="min"/> </td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;;">Max</td><td style="padding:10px;"><input type="text" name="max" id="max"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:center;padding:10px;;">Temp</td><td style="padding:10px;"><input type="text" name="temp" id="temp"/></td>
|
|
</tr>
|
|
<tr id="sub">
|
|
<td style="text-align:center;padding:10px;;">Sub Category</td><td style="padding:10px;"><input type="checkbox" name="subcata" id="subcata"/> Raw Sand Test</td>
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
|
</center>
|
|
</form>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
|
|
<button class="btn btn-success" ID="addNewRow" onclick="addNewRow();" style="margin-top: -10px;">OK</button>
|
|
<button class="btn btn-success" data-dismiss="modal" style="margin-top: -10px;" value="Cancel">Cancel</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
|
|
$('#monthlylisting').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"aaSorting": [[ 0, "asc" ]],
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script type="text/html" id="addList">
|
|
|
|
<tr id=<%=index%>>
|
|
<td align="left" contenteditable="false"><%=Name%></td>
|
|
<td align="left"contenteditable="true"><%=UOM%></td>
|
|
<td align="right" contenteditable="true"><%=Min%></td>
|
|
<td align="right" contenteditable="true"><%=Max%></td>
|
|
<td align="right" contenteditable="true"><%=Temp%></td>
|
|
<td align="center" contenteditable="true"><%=RawSandTest%></td>
|
|
|
|
<td align="center" contenteditable="false"> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
|
|
</tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
|
|
</script>
|
|
|
|
<script>
|
|
$('#addspec').click(function(){
|
|
|
|
var product = $('#product').val();
|
|
var customer = $('#customer').val();
|
|
if(product == -1 || customer == -1)
|
|
{
|
|
alert('Please Select Product and Customer.');
|
|
}
|
|
else
|
|
{
|
|
$('#specmodel').modal('show');
|
|
}
|
|
|
|
});
|
|
|
|
|
|
function addNewRow()
|
|
{
|
|
var sname = $('#spname').val();
|
|
sname = sname.toUpperCase();
|
|
var uom = $('#uom').val();
|
|
var min = $('#min').val();
|
|
var max = $('#max').val();
|
|
var temp = $('#temp').val();
|
|
var sub = 'NO';
|
|
|
|
if($('#subcata').is(':checked')){ sub = 'YES';}
|
|
|
|
if(sname == '' || uom =='' || min == '' || max == '' || temp == '')
|
|
{
|
|
alert('Please Enter all specification');
|
|
}
|
|
else
|
|
{
|
|
|
|
var rows = document.getElementById('testspecifications').rows.length;
|
|
//rows = rows-1;
|
|
//alert(rows);
|
|
var template = jQuery("#addList").html();
|
|
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp,RawSandTest:sub}));
|
|
|
|
$('#spname').val('');
|
|
$('#uom').val('');
|
|
$('#min').val('');
|
|
$('#max').val('');
|
|
$('#temp').val('');
|
|
document.getElementById('spname').focus();
|
|
}
|
|
}
|
|
|
|
$("#specmodel").on("shown.bs.modal", function(e) {
|
|
|
|
var type = $('#ttype').val();
|
|
//alert(type);
|
|
if(type == 'INPROCESS')
|
|
{
|
|
$('#sub').show();
|
|
|
|
}
|
|
else {$('#sub').hide(); }
|
|
document.getElementById('spname').focus();
|
|
|
|
});
|
|
|
|
function getAllData()
|
|
{
|
|
|
|
var alldata = $("#testspecifications").tableToJSON();
|
|
//alert(JSON.stringify(alldata));
|
|
alldata=JSON.stringify(alldata)
|
|
var product = $('#product').val();
|
|
var customer = $('#customer').val();
|
|
var type = $('#ttype').val();
|
|
if(product == -1 || customer == -1)
|
|
{
|
|
alert('Please Select Product and Customer.');
|
|
}
|
|
else{
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{param1:alldata,param2:product,param3:customer,param4:type},
|
|
//dataType:"json",
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>quality/saveSpectficationData",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
|
|
alert(data);
|
|
window.location = "<?php echo base_url().'quality';?>";
|
|
$('#content').loader('hide');
|
|
//console.log(data);
|
|
|
|
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function DeleteRow(r)
|
|
{
|
|
var product = $('#product').val();
|
|
var customer = $('#customer').val();
|
|
var type = $('#ttype').val();
|
|
if(product == '' || customer == '')
|
|
{
|
|
alert('Please Select Product and Customer.');
|
|
}
|
|
else{
|
|
var rowid = r;
|
|
//alert(rowid);
|
|
var d='';
|
|
|
|
var Row = $('#testspecifications').find('tr').eq(rowid).find('td');
|
|
//console.log(Row);
|
|
$.each(Row,function(index,value){
|
|
if(index == 0 ){
|
|
|
|
d = value.textContent
|
|
}
|
|
});
|
|
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{param1:d,param2:product,param3:customer,param4:type},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>quality/deleteSpecification",
|
|
|
|
success:function(data){
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
}
|
|
|
|
});
|
|
$('#testspecifications').find('tr').eq(rowid).remove();
|
|
//rowid.parentNode.removeChild(rowid);
|
|
//document.getElementById('#testspecifications').removeChild(document.getElementById('#'+rowid));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$('#resbatch').change(function(){
|
|
|
|
var curstatus = $('#resbatch').is(':checked');
|
|
if(curstatus == true)
|
|
{
|
|
document.getElementById('resintext').textContent='YES';
|
|
}
|
|
|
|
else
|
|
{
|
|
document.getElementById('resintext').textContent='NO';
|
|
}
|
|
//else{ $('#resintext').val('NO'); }
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|