Example #1
0
		deleteExpense : function(event){
			var expense = this.expenseHitoryMap[$(event.currentTarget).data('expense-id')];
			var confirmation = confirm('Are you sure you want to delete this expense, ' + expense.name + ' ?');
			
			if(!confirmation){
				return;
			}
			
			
			var updatedGroup = updatedIOUForDelete(expense, this.groupMap[expense.groupId]);
			
			console.log(JSON.stringify(updatedGroup));
			
			Sandbox.doDelete({
				url : '_ah/api/expenseentityendpoint/v1/expenseentity/deleteandupdateiou', 
				data : JSON.stringify(expense),
				type : 'POST',
				dataType: 'json',
				contentType: 'application/json',
				callback : function(response){
					console.log('Successfully deleted', response);
				}, 
				errorCallback : function(err){
					console.log('error occured');
				}
			});
			
			/*Sandbox.publish('FEM:NAVIGATE', '#expensedetail');*/
		}
		deleteExpense : function(event){
			var expense = this.expenseHitoryMap[$(event.currentTarget).data('expense-id')];
			var confirmation = confirm('Are you sure you want to delete this expense, ' + expense.name + ' ?');
			
			if(!confirmation){
				return;
			}
			
			Sandbox.doDelete({
				url : '_ah/api/expenseentityendpoint/v1/expenseentity/deleteandupdateiou', 
				data : expense,
				type : 'POST',
				dataType: 'json',
				contentType: 'application/json',
				callback : function(response){
					$('.li-' + expense.expenseEntityId).slideUp('slow', function(){
						this.remove();
					});
				}, 
				errorCallback : function(err){
					console.log('error occured');
				}
			});
		},