text: (function () {
      'use strict';
  
      var bootstrapModule = angular.module('common.bootstrap', ['ui.bootstrap']);
  
      bootstrapModule.factory('bootstrap.dialog', ['$modal', '$templateCache', modalDialog]);
  
      function modalDialog($modal, $templateCache) {
          var service = {
              deleteDialog: deleteDialog,
              confirmationDialog: confirmationDialog,
              alertErrorDialog: alertErrorDialog
          };
  
          $templateCache.put('modalDialog.tpl.html', 
              '<div>' +
              '    <div class="modal-header">' +
              '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" data-ng-click="cancel()">&times;</button>' +
              '        <h3>{{title}}</h3>' +
              '    </div>' +
              '    <div class="modal-body">' +
              '        <p>{{message}}</p>' +
              '    </div>' +
              '    <div class="modal-footer">' +
              '        <button class="btn btn-primary" data-ng-click="ok()">{{okText}}</button>' +
              '        <button class="btn btn-info" data-ng-click="cancel()">{{cancelText}}</button>' +
              '    </div>' +
              '</div>');
  
          $templateCache.put('modalDialogWarning.tpl.html',
            '<div>' +
            '    <div class="modal-header">' +
            '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" data-ng-click="cancel()">&times;</button>' +
            '        <h3><span>{{title}}</span></h3>' +
            '    </div>' +
            '    <div class="modal-body alert-danger">' +
            '        <p><span class="alert-danger">{{message}}</span></p>' +
            '    </div>' +
            '    <div class="modal-footer">' +         
            '        <button class="btn btn-danger" data-ng-click="ok()">{{cancelText}}</button>' +
            '    </div>' +
            '</div>');
  
          return service;
  
          function deleteDialog(itemName) {
              var title = 'Confirm Delete';
              itemName = itemName || 'item';
              var msg = 'Delete ' + itemName + '?';
              return confirmationDialog(title, msg);
          }
  
          function confirmationDialog(title, msg, okText, cancelText) {
  
              var modalOptions = {
                  templateUrl: 'modalDialog.tpl.html',
                  controller: ModalInstance,
                  keyboard: true,
                  resolve: {
                      options: function () {
                          return {
                              title: title,
                              message: msg,
                              okText: okText,
                              cancelText: cancelText
                          };
                      }
                  }
              };
              return $modal.open(modalOptions).result; 
          }
  
          function alertErrorDialog(title, msg, cancelText)
          {
              var modalOptions = {
                  templateUrl: 'modalDialogWarning.tpl.html',
                  controller: ModalInstance,
                  keyboard: true,
                  resolve: {
                      options: function () {
                          return {
                              title: title,
                              message: msg,                         
                              cancelText: cancelText
                          };
                      }
                  }
              };
              return $modal.open(modalOptions).result;
          }
      }
  
  
  
  
      var ModalInstance = ['$scope', '$modalInstance', 'options',
          function ($scope, $modalInstance, options) {
              $scope.title = options.title || 'Title';
              $scope.message = options.message || '';
              $scope.okText = options.okText || 'OK';
              $scope.cancelText = options.cancelText || 'Cancel';
              $scope.ok = function () { $modalInstance.close('ok'); };
              $scope.cancel = function () { $modalInstance.dismiss('cancel'); };
          }];
  })();