Subversion Repositories SmartDukaan

Rev

Rev 36787 | Rev 36792 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36787 Rev 36788
Line 37... Line 37...
37
		url: context + "/beatPlan/getAuthUsers", type: "GET", dataType: "json",
37
		url: context + "/beatPlan/getAuthUsers", type: "GET", dataType: "json",
38
		data: {categoryId: $('#bp-category').val(), escalationType: level},
38
		data: {categoryId: $('#bp-category').val(), escalationType: level},
39
		success: function (r) {
39
		success: function (r) {
40
			var data = r.response || r;
40
			var data = r.response || r;
41
			var html = '<option value="">Select User</option>';
41
			var html = '<option value="">Select User</option>';
-
 
42
			// Show "Name (#authUserId)" so the head can quickly match identities
-
 
43
			// (useful when grabbing an id for the Visit-Request Reassign prompt etc).
42
			data.forEach(function (u) {
44
			data.forEach(function (u) {
43
				html += '<option value="' + u.id + '">' + u.name + '</option>';
45
				html += '<option value="' + u.id + '">' + u.name + ' (#' + u.id + ')</option>';
44
			});
46
			});
45
			$('#bp-auth-user').html(html);
47
			$('#bp-auth-user').html(html);
46
		}
48
		}
47
	});
49
	});
48
});
50
});
Line 2676... Line 2678...
2676
function loadVisitRequests() {
2678
function loadVisitRequests() {
2677
	if (!state.authUserId) return;
2679
	if (!state.authUserId) return;
2678
	$.ajax({
2680
	$.ajax({
2679
		url: context + '/visitRequest/list',
2681
		url: context + '/visitRequest/list',
2680
		type: 'GET', dataType: 'json',
2682
		type: 'GET', dataType: 'json',
-
 
2683
		// Force a fresh fetch — otherwise the browser HTTP cache can serve the
-
 
2684
		// pre-reassign list and the panel won't reflect the new ownership.
-
 
2685
		cache: false,
2681
		data: {assigneeAuthId: state.authUserId, status: 'PENDING'},
2686
		data: {assigneeAuthId: state.authUserId, status: 'PENDING'},
2682
		success: function (r) {
2687
		success: function (r) {
2683
			var data = r.response || r;
2688
			var data = r.response || r;
2684
			var rows = (data && data.rows) || [];
2689
			var rows = (data && data.rows) || [];
2685
			state.visitRequests = rows;
2690
			state.visitRequests = rows;
Line 2760... Line 2765...
2760
	$.ajax({
2765
	$.ajax({
2761
		url: context + '/visitRequest/' + rid + '/reassign',
2766
		url: context + '/visitRequest/' + rid + '/reassign',
2762
		type: 'POST', contentType: 'application/json',
2767
		type: 'POST', contentType: 'application/json',
2763
		data: JSON.stringify({newAssigneeAuthId: newIdInt}),
2768
		data: JSON.stringify({newAssigneeAuthId: newIdInt}),
2764
		success: function () {
2769
		success: function () {
-
 
2770
			alert('Reassigned to user #' + newIdInt + '. The request will drop off this panel.');
2765
			loadVisitRequests();
2771
			loadVisitRequests();
2766
		},
2772
		},
2767
		error: function (xhr) {
2773
		error: function (xhr) {
2768
			var msg = 'Reassign failed';
2774
			var msg = 'Reassign failed';
2769
			try {
2775
			try {
Line 2783... Line 2789...
2783
	$.ajax({
2789
	$.ajax({
2784
		url: context + '/visitRequest/' + rid + '/reject',
2790
		url: context + '/visitRequest/' + rid + '/reject',
2785
		type: 'POST', contentType: 'application/json',
2791
		type: 'POST', contentType: 'application/json',
2786
		data: JSON.stringify({rejectReason: reason.trim()}),
2792
		data: JSON.stringify({rejectReason: reason.trim()}),
2787
		success: function () {
2793
		success: function () {
-
 
2794
			alert('Request rejected. It will drop off this panel.');
2788
			loadVisitRequests();
2795
			loadVisitRequests();
2789
		},
2796
		},
2790
		error: function (xhr) {
2797
		error: function (xhr) {
2791
			var msg = 'Reject failed';
2798
			var msg = 'Reject failed';
2792
			try {
2799
			try {