MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/demo.imensosoftware.com/matrix/js/date_format.js
var app= {};
app.document={docId:"", rowId:""};
$(document).ready(function(){
	if ($('ul.list-group > li').hasClass('default')) {
		var default_length = $('ul.list-group > li.default').length;
		var done_length = $('ul.list-group > li.done').length;
		$('#doc_default').html(default_length);
		$('#doc_done').html(done_length);
		$('#total_doc').html(default_length+done_length);
		if(length>0)
		{
			$('ul.list-group > li.default:first>a').trigger('click');
			$('ul.list-group > li.default:first').addClass('active');
			// $('ul.list-group > li.default:first').removeClass('default');
		} 	
	}
});

$(document).on('click', '#row_link', function(){
	app.document.docId = $(this).attr('data-doc_id');
	app.document.rowId = $(this).attr('data-row_id');
	app.clickToDocId();
});

$(document).on('click', '#submit_button', function(e){
	e.preventDefault(); 
	// app.submitForm();
	app.addForm();
	
});

app.clickToDocId = function(){
	$("#row_iframe").attr("src","360893/"+app.document.docId+".pdf");
	$("#rowId").val(app.document.rowId);
	$("#docId").val(app.document.docId);
	$('ul.list-group > li.active').removeClass('active');
	$(this).closest('li').addClass('active');
	// $(this).closest('li').removeClass('default');
}

app.addForm = function() {
   app.dataForm={
    docId:app.document.docId,
    rowId:app.document.rowId,
    title:$('#title').val().trim(),
    date:$('#date').val().trim(),
    description:$('#description').val().trim(),
  }

 // app.log(app.projectForm);

}

app.submitForm = function(){
	$.ajax({
		url: "post_data.php",
		type: "POST",
		data: $('#formAddRow').serialize(),
		dataType:"json",
		success:function(result){
			console.log(result.status);
			if(result.status==true)
			{
				alert("success");
				if($('ul.list-group > li.active>a').attr('data-doc_id')==app.document.docId);
				{
					$('ul.list-group > li.active').addClass('done');
					$('ul.list-group > li.active').removeClass('default');
				}
				$('ul.list-group > li.active').removeClass('active');
				if ($('ul.list-group > li').hasClass('default')) {
					var length = $('ul.list-group > li.default').length;
					if(length>0)
					{
						$('ul.list-group > li.default:first>a').trigger('click');
						$('ul.list-group > li.default:first').addClass('active');
						// $('ul.list-group > li.default:first').removeClass('default');
					} 	
				}
				
				$( '#formAddRow' ).each(function(){
			   	 this.reset();
				});
			}
			else{
				alert("Can't open file. It may be in use");
			}	
		},
		error:function(error){
			alert("error");
		}
	});

}