/*
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
 *
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
 * graphic logo is a trademark of OpenMRS Inc.
 */
import toastr from 'angular-toastr';
import ngAnimate from 'angular-animate';

import css from './openmrs-notification.css'
/**
 * 
 * It's basically wrapper for angular-toastr, but with openmrs color palette and already managed dependencies
 * 
 */
export default angular.module('openmrs-contrib-uicommons.notification', ['ngAnimate', 'toastr'])
						.factory('openmrsNotification', openmrsNotification).name;

openmrsNotification.$inject=['toastr'];

function openmrsNotification(toastr) {
	var service = {
			success : success,
			info : info,
			error : error,
			warning : warning
	}	
	return service;
	
	function success (content, title){
		return toastr.success(content, title);
	}
	function info (content, title){
		return toastr.info(content, title);
	}
	function error (content, title){
		return toastr.error(content, title);
	}
	function warning (content, title){
		return toastr.warning(content, title);
	}
}


@@ -897,16 +897,32 @@
 'toastr'
+, '$routeParams'
 %5D;%0A%0Afunc
@@ -952,16 +952,30 @@
 n(toastr
+, $routeParams
 ) %7B%0A%09var
@@ -1063,16 +1063,58 @@
  warning
+,%0A%09%09%09routeNotification : routeNotification
 %0A%09%7D%09%0A%09re
@@ -1439,11 +1439,350 @@
 le);%0A%09%7D%0A
+%09function routeNotification()%7B%0A%09%09var types = %5B%22infoToast%22, %22errorToast%22, %22successToast%22, %22warningToast%22%5D;%0A%09%09var method;%0A%09%09for(var i=0; i%3C types.length; i++)%7B%0A%09%09%09if(angular.isDefined($routeParams%5Btypes%5Bi%5D%5D))%7B%0A%09%09%09%09method = types%5Bi%5D.substring(0, types%5Bi%5D.indexOf('Toast'));%0A%09%09%09%09service%5Bmethod%5D.call(this, $routeParams%5Btypes%5Bi%5D%5D);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A
 %7D%0A%0A

Add route notification service