PageSourceSearch

https://www.americancoachlimousine.com/wp-content/plugins/limolabs…/controllers/login-widget.js?ver=0.6.11

js americancoachlimousine.com collected 2026-10-08 02:16:18 UTC 7,872 bytes, 203 lines download raw bytes

1LimoLabsAutoCabLoginWidget.controller("loginWidgetController", ["$scope", "AuthService", "EVENTS", "CONFIG", '$modal', '$document', 'BookingsService', '$interval', '$timeout', 'UsersService',
2    function($scope, Auth, EVENTS, CONFIG, $modal, $document, Bookings, $interval, $timeout, Users) {
3        
4        $scope.CONFIG = CONFIG;
5
6        $scope.registerClick = function() {
7            if (isPluginPage()) {
8                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_REGISTER_CLICKED, false);
9            } else {
10                window.location.href = CONFIG.plugin_page_url + "#/admin/register";
11            }
12        };
13
14        $scope.myProfileClick = function() {
15            if (isPluginPage()) {
16                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_MY_PROFILE_CLICKED, false);
17            } else {
18                window.location.href = CONFIG.plugin_page_url + "#/admin/account";
19            }
20        };
21        $scope.goToBillingInfo = function() {
22            if (isPluginPage()) {
23                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_PAYMENT_INFO_CLICKED, false);
24            } else {
25                window.location.href = CONFIG.plugin_page_url + "#/admin/payment";
26            }
27        };
28        $scope.goToReservations = function() {
29            if (isPluginPage()) {
30                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_RESERVATIONS_CLICKED, false);
31            } else {
32                window.location.href = CONFIG.plugin_page_url + "#/admin/reservations";
33            }
34        };
35        $scope.goToAccounts = function() {
36            if (isPluginPage()) {
37                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_ACCOUNTS_CLICKED, false);
38            } else {
39                window.location.href = CONFIG.plugin_page_url + "#/admin/accounts";
40            }
41        };
42
43        $scope.newReservation = function() {
44            if (isPluginPage()) {
45                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_NEW_RESERVATION_CLICKED, false);
46            } else {
47                window.location.href = CONFIG.plugin_page_url + "#/booking";
48            }
49        };
50
51        $scope.goToLogin = function() {
52            if (isPluginPage()) {
53                sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_GOTO_LOGIN_CLICKED, false);
54            } else {
55                window.location.href = CONFIG.plugin_page_url + "#/admin/login";
56            }
57        };
58
59        $scope.loginClick = function() {
60
61            $modal.open({
62                controller: 'ModalLoginCtrl',
63                size: 'sm',
64                templateUrl: CONFIG.plugin_folder_url + CONFIG.view_folder_path + 'appTpl/login-model-form.html',
65            });
66
67        };
68
69        $scope.logout = function() {
70            Auth.clearIdentity();
71            sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_LOGGED_OUT, false);
72            initForm();
73        };
74
75        var initForm = function() {
76            $scope.hasLocalCredentials = Auth.hasIdentity();
77            $scope.localCredentials = Auth.getIdentity();
78            if ($scope.hasLocalCredentials) {
79                $scope.FirstName = $scope.localCredentials.profile.firstName;
80                $scope.LastName = $scope.localCredentials.profile.lastName;
81
82                // Users.getMyProfile($scope.localCredentials.id).then(function(res) {
83                   
84                // });
85                
86                // Users.insertCustomer({
87                //     email : $scope.localCredentials.MyProfile.UserName,
88                //     first_name : $scope.localCredentials.MyProfile.FirstName,
89                //     last_name : $scope.localCredentials.MyProfile.LastName,
90                //     phone : $scope.localCredentials.MyProfile.Telephone
91                // });
92            }
93        };
94
95        var sendEventToLimoLabsIcabbiBookingApp = function(eventName, data) {
96            var el = document.getElementById('LimoLabsAutoCabApp');
97            if (el) {
98                angular.element(el).scope().$broadcast(eventName, data);
99            }
100        };
101
102        $scope.$on(EVENTS.BOOKING_WIDGET_LOGGED_IN, initForm);
103        $scope.$on(EVENTS.BOOKING_WIDGET_LOGGED_OUT, initForm);
104        $scope.$on(EVENTS.BOOKING_WIDGET_REGISTERED, initForm);
105        $scope.$on(EVENTS.MODAL_LOGIN_LOGGED_IN, initForm);
106        $scope.$on(EVENTS.BOOKING_WIDGET_LOGIN_OPEN_CLICK, $scope.loginClick);
107
108        initForm();
109
110        $scope.showAcountDropDown = false;
111
112        $scope.toggleAcountDropDown = function() {
113            $scope.showAcountDropDown = !$scope.showAcountDropDown;
114        };
115
116        $document.on('click', function(e) {
117            if ($scope.showAcountDropDown && 'LimoLabsAutoCabUserMenuToggleButton' != e.target.id) {
118                $scope.toggleAcountDropDown();
119                //                    $scope.showAcountDropDown = false;
120                $scope.$apply();
121            }
122        });
123
124        $scope.activeBookings = new Array();
125        $scope.refreshActiveBookings = function() {
126            // if(!Auth.hasIdentity()){
127            //     return;
128            // }
129
130            // Bookings.listActiveBookings(1, 500, true, true).then(function(res) {
131            //     if ('SUCCESS' === res.Info.Status) {
132            //         $scope.activeBookings = res.Content.BookingSummary;
133            //     }
134            // });
135        };
136
137        $timeout(function(){
138            $interval($scope.refreshActiveBookings, 1000 * 20);
139        }, 1000 * 10);
140
141        $scope.trackRide = function(activeBooking){
142            var modalInstance = $modal.open({
143                templateUrl: CONFIG.plugin_folder_url + CONFIG.view_folder_path + '/appTpl/route-preview.html',
144                controller: 'RoutePreviewController',
145                backdrop: false,
146                scope: $scope,
147                resolve: {
148                    booking: function() {
149                        return null;
150                    },
151                    reservation: function() {
152                        return activeBooking;
153                    }
154                }
155            });
156        };
157    }
158]);
159
160LimoLabsAutoCabLoginWidget.controller('ModalLoginCtrl', ['$rootScope', '$scope', '$modalInstance', 'AuthService', 'EVENTS', '$analytics', 'toastr',
161    function($rootScope, $scope, $modalInstance, Auth, EVENTS, $analytics, toastr) {
162
163        $scope.cancel = function() {
164            $modalInstance.dismiss('cancel');
165        };
166
167        $scope.incorrectUsernamePassword = false;
168
169        $scope.logMeIn = function(c) {
170
171            if (!angular.isDefined(c)) {
172                $scope.incorrectUsernamePassword = true;
173            } else {
174
175                $analytics.eventTrack('Login Account', {
176                    category: 'LimoLabs Service',
177                    label: 'Login From Widget'
178                });
179
180                Auth.authenticate(c.username, c.password).then(function(res) {
181                    if (res.status) {
182                        toastr.success(res.msg, 'Success');
183                        sendEventToLimoLabsIcabbiBookingApp(EVENTS.LOGIN_WIDGET_LOGGED_IN, false);
184                        $rootScope.$broadcast(EVENTS.MODAL_LOGIN_LOGGED_IN, false);
185                        $scope.incorrectUsernamePassword = false;
186                        $scope.cancel();
187                    } else {
188                        toastr.warning(res.msg, 'Warning');
189                        $scope.incorrectUsernamePassword = true;
190                    }
191                });
192            }
193        };
194
195        var sendEventToLimoLabsIcabbiBookingApp = function(eventName, data) {
196            var el = document.getElementById('LimoLabsAutoCabApp');
197            if (el) {
198                angular.element(el).scope().$broadcast(eventName, data);
199            }
200        };
201
202    }
203]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.