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

static.js.admin.clients.edit.js Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
function saveClient(sel, url, type) {

	var data = sel.serialize();
	
	$.ajax({
		type : 'POST',
		url  : url + "?" + data,
		contentType: 'application/json; charset=utf-8',
		dataType    : 'json',		
		success :  function(data) {
			hidemessages();			
			showsuccess(sel, "Client " + type);
		},
		error: function (data) {
			hidemessages();
			var text = JSON.parse(data.responseText)
			showerror(sel, "Unable to " + type + " Client - " + text.message);
		}
	});
}		

$(document).ready(function() {

	var client = $("#client").val();
	
	$.getJSON("/api/clients/get?client=" + client, function(data) {
		$.map(data.granttypes, function (item, index) {
			$("#" + item).prop('checked',true);
		});
	});
	
	$('.clientsave').submit(function(event) {
		saveClient($(this), "/api/clients/save", "Save")
		return false;
	});
	
	$("#generatetokens2").click(function() {
		var uuid = guid();
		$('#clientsecret2').attr("value", uuid);
	});
	
	$("#generatetokens").click(function() {
		$('.client').attr("value", guid());
		$('#clientsecret').attr("value", guid());
	})
});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy