PageSourceSearch

https://gradana.co.id/assets/js/controllers/frontend/nav-frontend.js

js gradana.co.id collected 2026-10-07 21:53:07 UTC 4,401 bytes, 147 lines download raw bytes

1"use strict";
2
3/* Controllers */
4
5angular
6  .module("app")
7  .controller("NavFrontendController", NavFrontendController);
8NavFrontendController.$inject = [
9  "$scope",
10  "$rootScope",
11  "ServerService",
12  "SettingsService",
13  "$state",
14  "$location",
15  "$http"
16];
17function NavFrontendController(
18  $scope,
19  $rootScope,
20  ServerService,
21  SettingsService,
22  $state,
23  $location,
24  $http
25) {
26  var currentUser = ""
27  const dataLender = SettingsService.GetCredentials() || {};
28  $scope.baseImageURL = "https://gradana-prod.oss-ap-southeast-5.aliyuncs.com/";
29
30  $scope.isValidLender = function () {
31    $scope.user = dataLender.user || {};
32    if ($scope.user.role === 'lender' && dataLender.token && $scope.user.phoneIsVerified && $scope.user.emailIsVerified) {
33      $scope.isLenderAuthenticated = true;
34      return true;
35    }
36    $scope.isLenderAuthenticated = false;
37    return false
38  }
39  $scope.isValidLender()
40
41  $scope.profileButton = function (userId) {
42    if ($scope.user.role == 'lender') {
43      $state.go("app.lender_profile", { userId })
44    }
45  }
46
47  $scope.logoutButton = function () {
48    ServerService.Logout(currentUser, function (response) {
49      SettingsService.ClearLocalStorage();
50      SettingsService.ClearCredentials();
51      window.sessionStorage.clear();
52
53      let roleLast = 'pendana';
54      if ($scope.user.role === 'lender') {
55        roleLast = 'pendana';
56      }
57      $state.go('access.login', { role: roleLast })
58    });
59  }
60
61  $scope.navigatePage = function (toPage) {
62    if (toPage === "pinjam") {
63      $state.go("pinjam");
64    } else if (toPage === "beriPinjaman") {
65      $state.go("beriPinjaman");
66    } else if (toPage === "sewaFlex") {
67      $state.go("sewaFlex");
68    } else if (toPage === "grakarya") {
69      $state.go("grakarya");
70    } else if (toPage === "grastrata") {
71      $state.go("grastrata");
72    } else if (toPage === "properti") {
73      $state.go("properti");
74    } else if (toPage === "properti-sewa") {
75      $state.go("propertyUnitSewa");
76    } else if (toPage === "daftar-rekanan") {
77      $state.go("daftar-rekanan");
78    } else if (toPage === "daftar-agen") {
79      $state.go("daftar-agen");
80    } else if (toPage === "hubungiKami") {
81      $state.go("hubungiKami");
82    } else if (toPage === "home") {
83      $state.go("home");
84    } else if (toPage === "login-borrower") {
85      $state.go("access.login", { role: "peminjam" });
86    } else if (toPage === "login-lender") {
87      $state.go("access.login", { role: "pendana" });
88    } else if (toPage === "login-agent") {
89      $state.go("access.login", { role: "agent" });
90    } else if (toPage === "signupBorrower") {
91      $state.go("access.signup", { role: "borrower" });
92    } else if (toPage === "berita") {
93      $state.go("berita");
94    } else if (toPage === "alif") {
95      $state.go("alif");
96    } else if (toPage === "tkb-detail") {
97      $state.go("detailTkb");
98    }
99
100
101  };
102  $scope.fetchTKBData = function () {
103    ServerService.GetGlobalSetting(currentUser, function (response) {
104      if (response) {
105        $scope.globalSetting = response.data;
106        $scope.tkb90 = 100 - parseFloat(response.data.tkb90).toFixed(2);
107        $scope.tkb60 = 100 - parseFloat(response.data.tkb60).toFixed(2);
108        $scope.tkb30 = 100 - parseFloat(response.data.tkb30).toFixed(2);
109        $scope.tkb0 = 100 - parseFloat(response.data.tkb0).toFixed(2);
110      }
111    })
112  }
113  $scope.fetchTKBData()
114
115  $scope.menuToggle = function (state) {
116    $rootScope.menuOpened = state;
117  };
118
119  $scope.frontendPageStatus = $location.path();
120
121  $scope.showDetailTkb = function () {
122    $scope.loading = true;
123    $('#modal-tkb-detail').appendTo("body").modal('show');
124    $scope.loading = false;
125  };
126
127  $scope.hideDialog = function () {
128    $("#modal-tkb-detail").modal("hide");
129  };
130
131  function loadLanguageContent(language) {
132    $http.get(`assets/i18n/navbar/${language}.json`).then(function (response) {
133      $scope.textContent = response.data;
134    }, function (error) {
135      console.error("Error loading language file:", error);
136    });
137  }
138
139  $scope.currentLanguage = localStorage.getItem("language") || "id";
140  loadLanguageContent($scope.currentLanguage);
141  
142  $scope.changeLanguage = function () {
143    $scope.currentLanguage = $scope.currentLanguage === 'id' ? 'en' : 'id';
144    loadLanguageContent($scope.currentLanguage);
145    localStorage.setItem("language", $scope.currentLanguage);
146  };
147}

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.