ria/app/Views/qualitymasterlistview.php
2024-09-11 08:54:25 +05:30

308 lines
9.0 KiB
PHP
Executable File

<?php
//print_r($existspec);
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Product Test Specification List</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">-->
<div class="col-md-3">
<a href=" <?php echo base_url().'quality/addNewPage';?> " type="button" class="btn btn-success">Add New</a>
</div>
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<!-- <div class="row">
<div class="col-md-3">
<?php echo form_dropdown('name="product"',$products2,set_value('product',$products2[-1]),'id="product"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<?php echo form_dropdown('name="customer"',$customers2,set_value('customer',$customers2[-1]),'id="customer"' ,'class="form-control select2');?>
</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>Product Name</th>
<th>Company Name</th>
<th>Type</th>
<th>Total Specification</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
if(!empty($existspec))
{
foreach($existspec as $data)
{
//print_r($data);echo "</br></br>";
?>
<tr> <td><a href="<?php echo base_url()?>quality/viewSpec/<?php echo $data->product_id.'/'.$data->customer_id.'/'. $data->type ?>"><?php echo $data->product_name.'-'.$data->product_description?></a></td> <td><a href="<?php echo base_url()?>quality/viewSpec/<?php echo $data->product_id.'/'.$data->customer_id.'/'. $data->type ?>"><?php echo $data->client_name?></a></td> <td><?php echo $data->type?> </td><td><?php echo $data->count?></td></tr>
<?php
}
}
if(!empty($existspecinward))
{
foreach($existspecinward as $in)
{
//print_r($data);echo "</br></br>";
?>
<tr> <td><a href="<?php echo base_url()?>quality/viewSpec/<?php echo $in->MaterialCode.'/'.$in->SupplierID.'/'.$in->type ?>"><?php echo $in->MaterialName?></a></td> <td><a href="<?php echo base_url()?>quality/viewSpec/<?php echo $in->MaterialCode.'/'.$in->SupplierID.'/'.$in->type ?>"><?php echo $in->SupplierName?></a></td> <td><?php echo $in->type?> </td><td><?php echo $in->count?></td></tr>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</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">&times;</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>
</table>
</center>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-success" ID="addNewRow" onclick="addNewRow();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-success" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</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 () {
$('#testspecifications').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="center" contenteditable="false"><a data-target='#specmodel' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#specmodel">&nbsp;&nbsp;&nbsp;</a> <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();
if(sname == '' || uom =='' || min == '' || max == '')
{
alert('Please Enter all specification');
}
else
{
var rows = document.getElementById('testspecifications').rows.length;
//rows = rows-1;
var template = jQuery("#addList").html();
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max}));
$('#spname').val('');
$('#uom').val('');
$('#min').val('');
$('#max').val('');
}
}
$("#specmodel").on("shown.bs.modal", function(e) {
// userid = $(e.relatedTarget).data('userid');
// var tr= document.getElementById(userid);
// var cellval = tr.cells;
});
function getAllData()
{
var alldata = $("#testspecifications").tableToJSON();
//alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata)
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
$('#content').loader('show');
$.ajax({
data:{param1:alldata,param2:product,param3:customer},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/saveSpectficationData",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
//console.log(data);
}
}
});
}
}
function DeleteRow(rowid)
{
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
var d='';
var Row = $('#testspecifications').find('tr').eq(rowid).find('td');
$.each(Row,function(index,value){
if(index == 1 ){
d = value.textContent
}
});
$('#content').loader('show');
$.ajax({
data:{param1:d,param2:product,param3:customer},
type:"POST",
url:"<?php echo base_url() ?>quality/deleteSpecification",
success:function(data){
$('#content').loader('hide');
alert(data);
}
});
tr.parentNode.removeChild(tr);
}
}
</script>