ENDRPrint/web/js/ctrl/leftMenuController.js
2024-08-14 10:33:27 +07:00

59 lines
1.8 KiB
JavaScript

// create the controller and inject Angular's $scope
scotchApp.controller('leftMenuController',
// create a message to display in our view
function ($scope, $location, $route, commonService) {
//alert("leftMenuController");
init();
function init() {
$scope.isAdmin = false;
//check user
var actLoadData = $.ajax(doGetPath('/json/getSessionLogin.json'),
{
ajax: true,
dataType: 'json',
type: "POST"
}).error(
function (data) {
$location.path("/login");
$scope.$apply();
});
actLoadData.success(
function (data) {
//alert(JSON.stringify(data));
if (data[3] == 'AD') {// AD = admin
$scope.isAdmin = true;//show Menu ENDR300 & ENDR400
}
$scope.$apply();
}
);
$scope.$apply();
}
$scope.printing = function (url) {
var url = url + "/" + new Date().getTime();
// alert("printing"+ url+"/"+new Date().getTime() );
commonService.setUrlPath(url);
// alert(commonService.urlPath);
// commonService.setUrlPath(url+"/"+new Date().getTime());
$location.path(url);
$scope.$apply();
};
$scope.redirectMainPage = function (url) {
commonService.setUrlPath(url + "/" + new Date().getTime());
$location.path(url + "/" + new Date().getTime());
$scope.$apply();
};
$scope.doLogout = function () {
commonService.setUrlPath("/logout");
$location.path("/logout");
};
});