All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.js.formdetails.js Maven / Gradle / Ivy

function updateFormsTable2(token) {
	
	var type = $("#type").val();
	var client = $("#client").val();
	var uuid = $("#parent").val();
	
	$.getJSON("/api/" + type + "s/list?client=" + client + "&uuid=" + uuid + "&token=" + token, function(data) {
		
		var list = data.forms;
		if (type == "workflow") {
			list = data.workflows;
		}
		
		var count = 0;
		$("#formlisttable2 > tbody").html("");
		$("#formlisttable2").append(
			    $.map(list, function (item, index) {
			    	count++;
			    	return '' 
			    		+ '' + item.label1 + ''
			    		+ '' + item.label2 + ''
			    		+ '' + item.label3 + ''
			    		+ '' + item.updated_date + ''
			    		+ ''
			    		+ ''
			    		+ '  '
			    		+ ''
			    		+ '';
		}).join());
			
		if (data.prevtoken === undefined) {
			$('#prev-button').hide();
		} else {
			$('#prev-button').show();
			$('#prev-button').data('token', data.prevtoken);
		}
		
		if (data.nexttoken === undefined) {
			$('#next-button').hide();
		} else {
			$("#next-button").data("token", data.nexttoken );			
			$('#next-button').show();
		}
		
		if (count == 0) {
			$("#formlisttable2").append("No " + type + "s");
		}
	});
}

function backbutton() {
	
	updateFormsTable2("");
	$("#formlist").slideDown( "slow", function() {    				
		$("#formdelete").hide();		
		hidemessages();
	});
}

$(document).ready(function() {
	
	$("#formdelete").hide();
	updateFormsTable2("");	
	
	$(".deleteform").submit(function(event) {
		deleteForm($(this));
		return false;
	});
	
	$("#formlisttable2").on( "click", "button", function() {
		
		if ($(this).text() == "Delete") {
			var type = $("#type").val();
			var client = $("#client").val();
			
			var uuid = $(this).data("uuid");
			$('.uuid').attr("value", uuid);
			$('.client').attr("value", client);
			
			var label1 = $(this).data("label1");
			var label2 = $(this).data("label2");
			var label3 = $(this).data("label3");
			
			$('#label1').attr("value", label1);
			$('#label2').attr("value", label2);
			$('#label3').attr("value", label3);
			
			$("#formdelete").show();
			$("#formlist").slideUp( "slow", function() {			
			});
		}
	});

	$("#next-button").click(function() {
		var token = $("#next-button").data("token");
		updateFormsTable2(token);
	});
	
	$("#prev-button").click(function() {
		var token = $("#prev-button").data("token");
		updateFormsTable2(token);
	});
	
	$(".backbutton").click(function(){
		 backbutton();
	});
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy