641 lines
20 KiB
PHP
Executable File
641 lines
20 KiB
PHP
Executable File
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script> -->
|
|
<?php
|
|
$Mnt_Id = '';
|
|
$Type = '';
|
|
$Machinecode = '';
|
|
$Mnt_Subtype = '';
|
|
$Mnt_Supplier = '';
|
|
$Location = '';
|
|
$Mnt_Date ='';
|
|
$Mnt_Time = '';
|
|
$Mnt_Description = '';
|
|
$Mnt_Reason = '';
|
|
$Mnt_Time_from = '';
|
|
$Mnt_Time_to = '';
|
|
$Mnt_Date_Time = '';
|
|
$Mnt_Total_hrs = '';
|
|
$Cost_material = '';
|
|
$Cost_labour = '';
|
|
$Approved_by = '';
|
|
$Workdone_by = '';
|
|
// $filecount = '';
|
|
|
|
if(!empty($MaintEdit))
|
|
{
|
|
foreach($MaintEdit as $Me)
|
|
{
|
|
$Mnt_Id = $Me->Maint_ID;
|
|
$Machinecode = $Me->Machine_Code;
|
|
$Mnt_Subtype = $Me->Maint_Subtype;
|
|
$Mnt_Supplier = $Me->Maint_Supplier;
|
|
$Mnt_Date = $Me->Maint_Date;
|
|
$Mnt_Time = $Me->Maint_Time;
|
|
$Type = $Me->Type;
|
|
$Location = $Me->Maint_Location;
|
|
$Mnt_description = $Me->Maint_Description;
|
|
$Mnt_reason = $Me->Maint_Reason;
|
|
$Mnt_time_from = $Me->Maint_Time_from;
|
|
$Mnt_time_to = $Me->Maint_Time_to;
|
|
$Mnt_Date_Time = $Mnt_time_from.' - '.$Mnt_time_to ;
|
|
$Mnt_total_hrs = $Me->Maint_Total_hrs;
|
|
$Cost_material = $Me->Cost_Material;
|
|
$Cost_labour = $Me->Cost_Labour;
|
|
$Approved_by = $Me->Approved_By;
|
|
$Workdone_by = $Me->WorkDone_By;
|
|
}
|
|
}
|
|
|
|
// $approvedby = array(-1=>'Select Approver Name');
|
|
// foreach($emplist as $r)
|
|
// {
|
|
// $approvedby[$r->FirstName.' '.$r->LastName] = $r->FirstName.' '.$r->LastName.'-'.$r->shortName;
|
|
// }
|
|
|
|
// if(!empty($MaintFileEdit)){
|
|
// $filecount = count($MaintFileEdit);
|
|
// }
|
|
|
|
?>
|
|
<style>
|
|
.left-margin { margin-left: 10px; }
|
|
#divid1{
|
|
margin-top:14px;
|
|
}
|
|
</style>
|
|
|
|
<div class="content-wrapper" style="min-height: 537px;">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Siddharth Industries - Edit Maintenance And Breakdown </center>
|
|
</h1>
|
|
</section>
|
|
|
|
<section class="content">
|
|
<div style="text-align:right;">
|
|
<a href="<?php echo base_url() ?>batchcard/getMaintListing" class="btn btn-primary" value="Back"/>Back</a>
|
|
</div>
|
|
<br>
|
|
<div class="row">
|
|
<!-- left column -->
|
|
<div class="col-md-12">
|
|
|
|
<div class="box box-primary">
|
|
|
|
<!-- form start -->
|
|
<form role="form" id="editMnt" action="<?php echo base_url() ?>batchcard/editmntbr" enctype="multipart/form-data" method="post">
|
|
|
|
<div class="box-body">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
|
|
<legend>Maintenance Details</legend>
|
|
<!-- <div class="col-md-3">
|
|
<label>Breakdown/Prevention</label>
|
|
<input type="text" id="breakdown" name="breakdown" class="form-control" style="text-align:right;"/>
|
|
</div> -->
|
|
<div class="col-md-3">
|
|
<label>Select Machine:</label>
|
|
<select class="form-control select2" id="machine" name="machine">
|
|
<option value=" ">Select Machine</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Nature of Maintenance:</label></br>
|
|
<input type="radio" id="radiobtn1" name="radiobtn" value="0" >Preventive
|
|
<input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown
|
|
</div>
|
|
|
|
<div class="col-md-3" id ="subtype" style="display: none;">
|
|
<label>Select Maintenance Type:</label></br>
|
|
<input type="radio" id="mainttype1" name="maintenance_subtype" value="0" >Internal
|
|
<input type="radio" id="mainttype2" name="maintenance_subtype" value="1" >External
|
|
</div>
|
|
|
|
<div class="col-md-3" id ="suppdiv" style="display: none;">
|
|
<label>Select Supplier:</label></br>
|
|
<select class="form-control select2" id="supplier" name="supplier" style="width:230px !important;">
|
|
<option value=" ">Select Supplier</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- <div class="col-md-3">
|
|
<label>Date</label>
|
|
<input type="text" id="maintenance_date" name="maintenance_date" class="form-control" style="text-align:right;" value="<?php echo $Mnt_Date ?>"/>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Time</label>
|
|
<input type="text" id="maintenance_time" name="maintenance_time" class="form-control" style="text-align:right;" placeholder="<?php echo date('H:i');?>" title="Enter 24 Hrs Format" value="<?php echo $Mnt_Time ?>" onchange="ValidTime()"/>
|
|
</div> -->
|
|
|
|
<div class="col-md-3">
|
|
<label>Location</label>
|
|
<input type="text" id="location" name="location" class="form-control" style="text-align:right;" value="<?php echo $Location; ?>"/>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label>Description</label>
|
|
<textarea id="maintenance_description" name="maintenance_description" class="form-control" col="100"><?php echo $Mnt_description; ?></textarea>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label>Reason for Maintenance</label>
|
|
<textarea id="maintenance_reason" name="maintenance_reason" class="form-control" col="100"><?php echo $Mnt_reason;?></textarea>
|
|
</div>
|
|
|
|
</div>
|
|
<div> </div>
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<legend>Time Taken for Maintenance</legend>
|
|
<div class="col-md-9">
|
|
<label>From Date and To Date </label>
|
|
<input type="text" id="maintenance_date_time" name="maintenance_date_time" class="form-control" placeholder="Date and time" value="<?php echo $Mnt_Date_Time;?>"/>
|
|
</div>
|
|
<!-- <div class="col-md-3">
|
|
<label>From</label>
|
|
<input type="text" id="maintenance_time_from" name="maintenance_time_from" class="form-control" style="text-align:right;" onchange="calculateTime();" placeholder="<?php echo date('H:i');?>" title="Enter 24 Hrs Format" value="<?php echo $Mnt_time_from;?>" />
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>To</label>
|
|
<input type="text" id="maintenance_time_to" name="maintenance_time_to" class="form-control" style="text-align:right;" onchange="calculateTime();" placeholder="<?php echo date('H:i');?>" title="Enter 24 Hrs Format" value="<?php echo $Mnt_time_to;?>"/>
|
|
</div> -->
|
|
|
|
<div class="col-md-3">
|
|
<label>Total Hrs</label>
|
|
<input type="text" id="maintenance_total_hrs" name="maintenance_total_hrs" class="form-control" style="text-align:right;" onkeypress="return keyValidate(event);" readonly value="<?php echo $Mnt_total_hrs;?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
|
|
<legend>Cost</legend>
|
|
<div class="col-md-3">
|
|
<label>Material</label>
|
|
<input type="text" id="cost_material" name="cost_material" class="form-control" style="text-align:right;" onkeypress="return keyValidate(event);" value="<?php echo $Cost_material;?>"/>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Labour</label>
|
|
<input type="text" id="cost_labour" name="cost_labour" class="form-control" style="text-align:right;" onkeypress="return keyValidate(event);" value="<?php echo $Cost_labour;?>"/>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div> </div>
|
|
<div class="col-md-12">
|
|
|
|
<legend>Multiple File</legend>
|
|
<div class="col-md-offset-10 col-md-1" >
|
|
<input type="button" class="btn btn-primary" id ="addmorebutton" value=" + ADD FILES..">
|
|
</div>
|
|
</div>
|
|
|
|
<div id="newdiv"></div><!-- this div for add more section-->
|
|
<input type="hidden" id="mntid" name="mntid" class="readonly" value="<?php echo $Mnt_Id;?>"/>
|
|
<input type="hidden" id="hidecounter" name="hidecounter" class="readonly" value="0" />
|
|
<input type="hidden" id="hideconstant" name="hideconstant" class="readonly" value="0" />
|
|
|
|
</div>
|
|
|
|
<div> </div>
|
|
<div class="col-md-12">
|
|
<legend></legend>
|
|
<div class="col-md-3">
|
|
<label>Work Done By:</label>
|
|
<!-- <input type="text" name="work_done_by" id="work_done_by" value="<?php echo $this->session->userdata ( 'name' );?>" readonly class="form-control"> -->
|
|
<select class="form-control select2" id="workdoneby" name="workdoneby">
|
|
<option value=" ">Select Worker Name</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3 col-md-offset-6">
|
|
<label>Approved By:</label>
|
|
<select class="form-control select2" id="approvedby" name="approvedby">
|
|
<option value=" ">Select Approver Name</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div><!-- row -->
|
|
</div><!--box body -->
|
|
<div class="box-footer" style="text-align:right">
|
|
<input type="submit" class="btn btn-primary" value="Update" />
|
|
<!-- <input type="reset" class="btn btn-primary" value="Reset" /> -->
|
|
</div>
|
|
</form>
|
|
</div><!--box body primary-->
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<script>
|
|
var index = 0 ;
|
|
var counter = 0;
|
|
var counterConstant = 0;
|
|
|
|
$(function() {
|
|
$("#suppdiv").hide();
|
|
var mach_arr = [];
|
|
var file_arr = [];
|
|
var emp_arr = [];
|
|
var supp_arr = [];
|
|
|
|
$("#machine").select2();
|
|
$("#approvedby").select2();
|
|
$("#workdoneby").select2();
|
|
$("#supplier").select2();
|
|
|
|
$('#maintenance_date').datepicker({
|
|
//minDate : 'year+16',
|
|
maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'});
|
|
|
|
mach_arr = <?php echo json_encode($MachineList)?>;
|
|
file_arr = <?php echo json_encode($MaintFileEdit)?>;
|
|
emp_arr = <?php echo json_encode($emplist)?>;
|
|
supp_arr = <?php echo json_encode($supplist)?>;
|
|
|
|
$.each(emp_arr,function(e,ea){
|
|
$("#approvedby , #workdoneby").append( $('<option></option>').val(ea.EmpID).html(ea.FirstName+' '+ea.LastName));
|
|
});
|
|
|
|
$.each(mach_arr,function(m,ma){
|
|
$("#machine").append( $('<option></option>').val(ma.Machine_Code).html(ma.Machine_Code+'-'+ma.Machine_Name));
|
|
});
|
|
|
|
$.each(supp_arr,function(s,supp){
|
|
$("#supplier").append( $('<option></option>').val(supp.SupplierID).html(supp.SupplierID+' - '+supp.SupplierName));
|
|
});
|
|
|
|
$('#machine option[value="<?php echo $Machinecode ?>"]').prop('selected', true);
|
|
$('#approvedby option[value="<?php echo $Approved_by ?>"]').prop('selected', true);
|
|
$('#workdoneby option[value="<?php echo $Workdone_by ?>"]').prop('selected', true);
|
|
$('#supplier option[value="<?php echo $Mnt_Supplier; ?>"]').prop('selected', true);
|
|
|
|
|
|
var mybaseurl='<?php echo base_url('uploads/images');?>';
|
|
$.each(file_arr,function(f,fa){
|
|
|
|
var div = document.createElement('div');
|
|
div.id = "dbdivid"+index;
|
|
div.className="row";
|
|
div.style="margin-top:14px";
|
|
div.innerHTML='<div class="col-md-12">'+
|
|
'<div class="col-md-3">'+
|
|
'<label>File Name</label>'+
|
|
'<input type="text" id="db_machs_filename'+index+'" name="dbfilename'+index+'" class="form-control" value="'+fa.File_name+'" onkeypress="return false;" readonly/>'+
|
|
'</div>'+
|
|
'<div class="col-md-4">'+
|
|
'<label><br></label>'+
|
|
// '<input type="file" id="filepath'+index+'" name="browseFiles'+index+'" onchange="readURL(this);" placeholder= "'+fa.Machine_filepath+'" ><br>'+
|
|
'</div>'+
|
|
'<div class="col-md-3">'+
|
|
'<label><br><br></label>'+
|
|
'<input type="hidden" name="hidefileid'+index+'" id="hidefileid'+index+'" value="'+fa.File_No+'"/>'+
|
|
'<a href="'+mybaseurl+'/'+fa.File_name+'" class="btn btn-primary active" target="_blank" role="button"><i class="fa fa-download" ></i>Download</a>'+
|
|
'<button class="btn btn-danger left-margin" id="delbtn'+index+'" onclick="deleted(this.id)"><i class="fa fa-trash"></i> Remove</button>'+
|
|
'</div>'+
|
|
'</div>';
|
|
|
|
$('#newdiv').append(div);
|
|
index++;
|
|
});
|
|
|
|
$('#maintenance_date_time').daterangepicker({
|
|
autoUpdateInput: false,
|
|
//autoUpdateInput: true,
|
|
timePicker: true,
|
|
//timePicker24Hour: true,
|
|
timePickerIncrement: 1,
|
|
locale: {
|
|
format: 'D/MMMM/YYYY hh:mm A',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#maintenance_date_time').on('apply.daterangepicker', function(ev, picker) {
|
|
$(this).val(picker.startDate.format('D/MMMM/YYYY hh:mm A') + ' - ' + picker.endDate.format('D/MMMM/YYYY hh:mm A'));
|
|
var datetime = $(this).val();
|
|
//newcalculateTime(datetime);
|
|
//alert(datetime);
|
|
datetime = datetime.split(" - ");
|
|
var start_actual_time = datetime[0];
|
|
var end_actual_time = datetime[1];
|
|
//alert("start"+start_actual_time);
|
|
//alert("stop"+end_actual_time);
|
|
start_actual_time = new Date(start_actual_time);
|
|
end_actual_time = new Date(end_actual_time);
|
|
//alert("start converted"+start_actual_time);
|
|
//alert("stop converted"+end_actual_time);
|
|
var diff = end_actual_time - start_actual_time;
|
|
//alert(diff);
|
|
var sec = (diff/1000);
|
|
//alert('manual total sec'+(diff/1000));
|
|
//alert('current total sec'+sec);
|
|
var ttl_hrs = Math.floor(sec/3600);
|
|
//alert('curr total hour'+ttl_hrs);
|
|
var ttl_min = Math.floor(sec%3600)/60;
|
|
//alert('curr total min'+ttl_min);
|
|
var final_ttl = ((ttl_hrs < 10)?("0" + ttl_hrs):ttl_hrs) + ":" + ((ttl_min < 10)?("0" + ttl_min):ttl_min)
|
|
$('#maintenance_total_hrs').val(final_ttl);
|
|
//alert('curr final'+final_ttl);
|
|
|
|
|
|
});
|
|
|
|
$('#maintenance_date_time').on('cancel.daterangepicker', function(ev, picker) {
|
|
$(this).val('');
|
|
$('#maintenance_total_hrs').val('');
|
|
});
|
|
|
|
|
|
|
|
var type = "<?php echo $Type;?>";
|
|
var subtype = "<?php echo $Mnt_Subtype;?>";
|
|
|
|
if(type == "0" && subtype == '')
|
|
{
|
|
$('#radiobtn1').attr('checked','true');
|
|
$("#subtype").show();
|
|
}
|
|
else if(type == "0" && subtype == '0')
|
|
{
|
|
$('#radiobtn1').attr('checked','true');
|
|
$("#subtype").show();
|
|
$('#mainttype1').attr('checked','true');
|
|
$("#suppdiv").hide();
|
|
|
|
}
|
|
else if(type == "0" && subtype == '1')
|
|
{
|
|
$('#radiobtn1').attr('checked','true');
|
|
$("#subtype").show();
|
|
$('#mainttype2').attr('checked','true');
|
|
$("#suppdiv").show();
|
|
}
|
|
else if(type == "1" && subtype == '')
|
|
{
|
|
$('#radiobtn2').attr('checked','true');
|
|
$("#subtype").hide();
|
|
$("#suppdiv").hide();
|
|
}
|
|
|
|
$('input[name=radiobtn]').change(function(){
|
|
var value = $( 'input[name=radiobtn]:checked' ).val();
|
|
if(value == '0'){
|
|
$("#subtype").show();
|
|
$("#mainttype1").attr('checked','true');
|
|
$("#suppdiv").hide();
|
|
}
|
|
else{
|
|
$("#subtype").hide();
|
|
$("#suppdiv").hide();
|
|
}
|
|
});
|
|
|
|
$('input[name=maintenance_subtype]').change(function(){
|
|
var subtype_value = $( 'input[name=maintenance_subtype]:checked' ).val();
|
|
if(subtype_value == '1'){
|
|
$("#suppdiv").show();
|
|
}
|
|
else{
|
|
$("#suppdiv").hide();
|
|
}
|
|
});
|
|
|
|
// var value = $( 'input[name=radiobtn]:checked' ).val();
|
|
// if(value == '0'){
|
|
// $("#subtype").show();}
|
|
|
|
// $('#rdate').datepicker({
|
|
// //minDate : 'year+16',
|
|
// maxDate : 'now',
|
|
// dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
|
|
|
|
// });
|
|
|
|
|
|
} );
|
|
|
|
// function calculateTime()
|
|
// {
|
|
|
|
// var start = $('#maintenance_time_from').val();
|
|
// var stop = $('#maintenance_time_to').val();
|
|
|
|
|
|
|
|
// //alert(start+'-'+stop);
|
|
// if(start != '' && stop != '')
|
|
// {
|
|
|
|
// if(start.length != 5){
|
|
// alert('Please Enter Time in 24 Hrs Format.If time is 9:25,Feed like 09:25');
|
|
// document.getElementById('maintenance_time_from').value="";
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time_from').focus();},0
|
|
// );
|
|
|
|
// return false;
|
|
// }
|
|
|
|
|
|
// if(stop.length != 5){
|
|
// alert('Please Enter Time in 24 Hrs Format.If time is 9:25,Feed like 09:25');
|
|
// document.getElementById('maintenance_time_to').value="";
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time_to').focus();},0
|
|
// );
|
|
|
|
// return false;
|
|
// }
|
|
|
|
// var atime = '';
|
|
// start = start.split(":");
|
|
// stop = stop.split(":");
|
|
|
|
// if(isNaN(start[0]) || isNaN(start[1]) || parseFloat(start[0]) > 24 || parseFloat(start[1]) > 60)
|
|
// {
|
|
// alert("please Enter Valid Time");
|
|
// document.getElementById('maintenance_time_from').value = '';
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time_from').focus();},0
|
|
// );
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// if(isNaN(stop[0]) || isNaN(stop[1]) || parseFloat(stop[0]) > 24 || parseFloat(stop[1]) > 60)
|
|
// {
|
|
// alert("please Enter Valid Time");
|
|
// document.getElementById('maintenance_time_to').value = '';
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time_to').focus();},0
|
|
// );
|
|
// return false;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if((start[0] > stop[0]))
|
|
// {
|
|
// alert('Enter Valid Time');
|
|
// document.getElementById('maintenance_time_to').value = '';
|
|
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time_to').focus();},0
|
|
// );
|
|
// return false;
|
|
// }
|
|
|
|
// var h = parseFloat(stop[0]) - parseFloat(start[0]);
|
|
// var m = parseFloat(stop[1]) - parseFloat(start[1]);
|
|
// //console.log(h+'-'+m);
|
|
// if(parseFloat(m) > 60 )
|
|
// {
|
|
// h+=1;
|
|
// m -= 60;
|
|
// }
|
|
// else if(parseFloat(m) < 0)
|
|
// {
|
|
// h-=1;
|
|
// if(h < 0){h=0;}
|
|
// m+=60;
|
|
|
|
// }
|
|
// atime = h+':'+m;
|
|
// //console.log(atime);
|
|
// $('#maintenance_total_hrs').val((atime));
|
|
// }
|
|
// }
|
|
// function ValidTime(){
|
|
|
|
// var time = $('#maintenance_time').val();
|
|
|
|
// if(time.length != 5){
|
|
// alert('Please Enter Time in 24 Hrs Format.If time is 9:25,Feed like 09:25');
|
|
// document.getElementById('maintenance_time').value="";
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time').focus();},0
|
|
// );
|
|
|
|
// return false;
|
|
// }
|
|
// time = time.split(":");
|
|
|
|
// if(isNaN(time[0]) || isNaN(time[1]) || parseFloat(time[0]) > 24 || parseFloat(time[1]) > 60)
|
|
// {
|
|
// alert("please Enter Valid Time");
|
|
// document.getElementById('maintenance_time').value = '';
|
|
// setTimeout(function(){
|
|
// $('#maintenance_time').focus();},0
|
|
// );
|
|
// return false;
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
$("#addmorebutton").click(function(){
|
|
|
|
// alert('sda');
|
|
// alert(index);
|
|
// alert(counter);
|
|
// alert(counterConstant);
|
|
// var removenum = counterConstant+index;
|
|
|
|
// if(counter>4){
|
|
// alert("allow only 5 files");
|
|
// return false;
|
|
// }
|
|
// else{
|
|
|
|
counter++;
|
|
counterConstant++;
|
|
|
|
var div = document.createElement('div');
|
|
div.id = "divid"+counterConstant;
|
|
div.className="row";
|
|
div.innerHTML='<div class="col-md-12">'+
|
|
'<div class="col-md-3">'+
|
|
'<label>File Name</label>'+
|
|
// '<input type="text" id="machs_filename" name="filename'+counterConstant+'" class="form-control"/>'+
|
|
'<input type="text" id="maint_filename'+counterConstant+'" name="filename'+counterConstant+'" class="form-control" onkeypress="return false;" readonly/>'+
|
|
'</div>'+
|
|
'<div class="col-md-4">'+
|
|
'<label><br></label>'+
|
|
'<input type="file" name="browseFiles'+counterConstant+'" onchange="Copyfilename(this.name);"><br>'+
|
|
'</div>'+
|
|
'<div class="col-md-3">'+
|
|
'<label><br><br></label>'+
|
|
'<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button>'+
|
|
'</div>'+
|
|
'</div>';
|
|
$('#newdiv').append(div);
|
|
|
|
|
|
$('#hidecounter').val(counter);
|
|
$('#hideconstant').val(counterConstant);
|
|
|
|
//}
|
|
});
|
|
|
|
function deleted(deleteid) {
|
|
|
|
var number = deleteid.replace(/[^0-9]+/ig,"");
|
|
|
|
var fileid = $("#hidefileid"+number).val();
|
|
|
|
var filename = $("#machs_filename"+number).val();
|
|
|
|
$.ajax({
|
|
data:{id:fileid,name:filename},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>batchcard/Removefiledetails",
|
|
success:function(data) {
|
|
}
|
|
});
|
|
|
|
$("#dbdivid"+number).remove();
|
|
|
|
}
|
|
|
|
function removeRow(input) {
|
|
//alert(input);
|
|
var number = input.replace(/[^0-9]+/ig,"");
|
|
|
|
//if(counter >= 1){
|
|
counter--;
|
|
$("#divid"+number).remove();
|
|
$('#hidecounter').val(counter);
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Copyfilename(id)
|
|
{
|
|
|
|
var size = $('input[name='+id+']')[0].files[0].size;
|
|
|
|
var number = id.replace(/[^0-9]+/ig,"");
|
|
|
|
if(size > 2100000){
|
|
//alert(id);
|
|
alert('Sorry Your File is Large To 2MB');
|
|
removeRow(id);
|
|
//$('input[name = browseFiles'+number+']').val(' ');
|
|
}else {
|
|
var name = $('input[name='+id+']')[0].files[0].name;
|
|
//alert(name);
|
|
$("#maint_filename"+number).val(name);
|
|
}
|
|
}
|
|
|
|
</script>
|