ENDRPrint_12CRelease/.svn/pristine/10/1033a1bd86f941eb09fc9da74bf10491102fa30d.svn-base
2024-08-14 10:58:03 +07:00

56 lines
1.7 KiB
Plaintext

// 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) {
// alert("printing" + url + "/" + new Date().getTime());
commonService.setUrlPath(url + "/" + new Date().getTime());
$location.path(url + "/" + new Date().getTime());
$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");
};
});