1 angular.module('egCoreMod')
4 * egPermLoginDialog.open(
5 * open("some message goes {{here}}", {
6 * here : 'foo', ok : function() {}, cancel : function() {}},
11 ['$uibModal','$interpolate', '$rootScope', '$q', 'egAuth', 'egStrings', 'egNet', 'ngToast',
12 function($uibModal, $interpolate, $rootScope, $q, egAuth, egStrings, egNet, ngToast) {
17 service.changeOperator = function(calledFromNavbar, failedRequest) {
18 var _op_changed = false;
20 templateUrl: './share/t_opchange',
22 ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) {
23 $scope.args = {username : '', password : '', type : 'temp'};
24 $scope.displayTypeField = calledFromNavbar;
25 $scope.title = egStrings.OP_CHANGE_TITLE;
27 $scope.title = failedRequest.perm_evt.desc + ": "
28 + failedRequest.perm_evt.ilsperm;
29 $scope.message = egStrings.OP_CHANGE_PERM_MESSAGE;
30 console.log($scope.message);
33 $scope.ok = function() { $uibModalInstance.close($scope.args) }
34 $scope.cancel = function () { $uibModalInstance.dismiss() }
36 }).result.then(function (args) {
37 if (!args || !args.username || !args.password) return;
38 args.type = args.type || 'temp';
39 args.workstation = egAuth.workstation();
40 egAuth.opChange(args).then(
44 console.log(js2JSON(failedRequest));
46 failedRequest.service,
49 failedRequest.params[1]
50 ).then(service.changeOperatorUndo());
52 ngToast.create(egStrings.OP_CHANGE_SUCCESS);
56 ngToast.warning(egStrings.OP_CHANGE_FAILURE);
63 service.changeOperatorUndo = function() {
64 egAuth.opChangeUndo();
65 var _op_changed = false;
66 ngToast.create(egStrings.OP_CHANGE_SUCCESS);
70 //Check for any permission failure broadcasts. then call changeOperator and retry the action
71 $rootScope.$on('egNetPermFailure', function(args, request_info) {
72 var op_changed = service.changeOperator(false, request_info);