Product Ledger Role missed earlier, fixed.
Almost all reports are using resolve now to prevent flicker when data is loading.
This commit is contained in:
parent
44bab156f3
commit
7594fd399a
|
@ -114,6 +114,8 @@ DELETE FROM Auth_Roles WHERE RoleID IN (X'9E02EEC8D498F844AB83EF2017BEE919', X'0
|
|||
UPDATE Auth_Roles SET Name = 'Trial Balance' WHERE RoleID = X'3B099FECDDC54243B30EAFB78D9CA14A';
|
||||
-- Users
|
||||
UPDATE Auth_Roles SET Name = 'Users' WHERE RoleID = X'C5B7D9D7F1780E458EA4BF4E08EC901B'
|
||||
-- Product Ledger
|
||||
UPDATE Auth_Roles SET Name = 'Product Ledger' WHERE RoleID = X'018A2408E804144690C5B015829DA6BA'
|
||||
-- Cleanup
|
||||
DELETE FROM Auth_RoleGroups WHERE RoleID IN (X'018A2408E804144690C5B015829DA6BA', X'CFAD44F0F2A9704589D79019CF0F371A');
|
||||
DELETE FROM Auth_Roles WHERE RoleID IN (X'018A2408E804144690C5B015829DA6BA', X'CFAD44F0F2A9704589D79019CF0F371A');
|
||||
DELETE FROM Auth_RoleGroups WHERE RoleID IN (X'CFAD44F0F2A9704589D79019CF0F371A');
|
||||
DELETE FROM Auth_Roles WHERE RoleID IN (X'CFAD44F0F2A9704589D79019CF0F371A');
|
||||
|
|
|
@ -1,12 +1,24 @@
|
|||
function AccountListCtrl($scope, Account) {
|
||||
$scope.info = Account.query();
|
||||
function AccountListCtrl($scope, accounts) {
|
||||
$scope.info = accounts;
|
||||
}
|
||||
AccountListCtrl.resolve = {
|
||||
accounts:function ($q, $route, Account) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Account.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function AccountCtrl($scope, $routeParams, $location, Account, AccountType, CostCenter) {
|
||||
$scope.account = Account.get({id: $routeParams.id});
|
||||
function AccountCtrl($scope, $location, account, account_types, cost_centers) {
|
||||
$scope.account = account
|
||||
|
||||
$scope.account_types = AccountType.query();
|
||||
$scope.cost_centers = CostCenter.query();
|
||||
$scope.account_types = account_types;
|
||||
$scope.cost_centers = cost_centers;
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.account.$save(function (u, putResponseHeaders) {
|
||||
|
@ -28,3 +40,37 @@ function AccountCtrl($scope, $routeParams, $location, Account, AccountType, Cost
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
AccountCtrl.resolve = {
|
||||
account:function ($q, $route, Account) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Account.get({id: id}, successCb);
|
||||
return deferred.promise;
|
||||
},
|
||||
account_types:function ($q, $route, AccountType) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
AccountType.query({}, successCb);
|
||||
return deferred.promise;
|
||||
},
|
||||
cost_centers:function ($q, $route, CostCenter) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
CostCenter.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
function CashFlowCtrl($scope, $routeParams, $location, CashFlow) {
|
||||
if (typeof $routeParams.StartDate === 'undefined') {
|
||||
$scope.info = CashFlow.get({});
|
||||
} else if (typeof $routeParams.id === 'undefined') {
|
||||
$scope.info = CashFlow.get({StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
} else {
|
||||
$scope.info = CashFlow.get({id:$routeParams.id, StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
}
|
||||
function CashFlowCtrl($scope, $routeParams, $location, cash_flow) {
|
||||
$scope.info = cash_flow;
|
||||
$scope.show = function () {
|
||||
$location.path('/CashFlow').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate});
|
||||
};
|
||||
$('#txtStartDate').focus();
|
||||
}
|
||||
CashFlowCtrl.resolve = {
|
||||
cash_flow:function ($q, $route, CashFlow) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var start_date = $route.current.params.StartDate;
|
||||
var finish_date = $route.current.params.FinishDate;
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
||||
CashFlow.get({}, successCb);
|
||||
} else if (typeof id === 'undefined') {
|
||||
CashFlow.get({StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
} else {
|
||||
CashFlow.get({id:id, StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
function CostCenterListCtrl($scope, CostCenter) {
|
||||
$scope.info = CostCenter.query();
|
||||
function CostCenterListCtrl($scope, cost_centers) {
|
||||
$scope.info = cost_centers;
|
||||
}
|
||||
|
||||
function CostCenterCtrl($scope, $routeParams, $location, CostCenter) {
|
||||
$scope.cost_center = CostCenter.get({id: $routeParams.id});
|
||||
CostCenterListCtrl.resolve = {
|
||||
cost_centers:function ($q, $route, CostCenter) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
CostCenter.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function CostCenterCtrl($scope, $routeParams, $location, cost_center) {
|
||||
$scope.cost_center = cost_center;
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.cost_center.$save(function (u, putResponseHeaders) {
|
||||
|
@ -25,3 +38,17 @@ function CostCenterCtrl($scope, $routeParams, $location, CostCenter) {
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
CostCenterCtrl.resolve = {
|
||||
cost_center:function ($q, $route, CostCenter) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
CostCenter.get({id:id}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
function EmployeeListCtrl($scope, Employee) {
|
||||
$scope.info = Employee.query();
|
||||
function EmployeeListCtrl($scope, employees) {
|
||||
$scope.info = employees;
|
||||
}
|
||||
EmployeeListCtrl.resolve = {
|
||||
employees:function ($q, $route, Employee) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Employee.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function EmployeeCtrl($scope, $routeParams, $location, Employee, CostCenter) {
|
||||
$scope.employee = Employee.get({id: $routeParams.id});
|
||||
function EmployeeCtrl($scope, $routeParams, $location, employee, cost_centers) {
|
||||
$scope.employee = employee;
|
||||
|
||||
$scope.cost_centers = CostCenter.query();
|
||||
$scope.cost_centers = cost_centers
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.employee.$save(function (u, putResponseHeaders) {
|
||||
|
@ -27,3 +39,27 @@ function EmployeeCtrl($scope, $routeParams, $location, Employee, CostCenter) {
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
EmployeeCtrl.resolve = {
|
||||
employee:function ($q, $route, Employee) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Employee.get({id: id}, successCb);
|
||||
return deferred.promise;
|
||||
},
|
||||
cost_centers:function ($q, $route, CostCenter) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
CostCenter.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
function Populate(response) {
|
||||
if (response != null) {
|
||||
var stateObj = { 'date':response.date };
|
||||
var stateObj = { 'id':response.id, 'Name':response.name, 'start_date':response.start_date, 'finish_date':response.finish_date };
|
||||
history.pushState(stateObj, 'Display', response.url);
|
||||
var $table = $('#tbodyMain')
|
||||
$table.html(response.body);
|
||||
}
|
||||
}
|
||||
|
||||
function Show(name, id, start_date, finish_date) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
data:JSON.stringify({ name:name, id:id, start_date:start_date, finish_date:finish_date }),
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
Populate(response);
|
||||
},
|
||||
error:function (jqXHR, textStatus) {
|
||||
$("#ctl00_statusDiv").removeClass().addClass("error");
|
||||
var msg = $.parseJSON(jqXHR.responseText).Message;
|
||||
$("#ctl00_statusDiv").html(msg);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function Save() {
|
||||
var data = GetFormData();
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:save_url,
|
||||
data:data,
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
// ResetForm();
|
||||
// $("#ctl00_statusDiv").removeClass().addClass("success");
|
||||
$("#toast").html(response);
|
||||
},
|
||||
error:function (jqXHR, textStatus) {
|
||||
// $("#ctl00_statusDiv").removeClass().addClass("error");
|
||||
// var msg = $.parseJSON(jqXHR.responseText);
|
||||
var msg = jqXHR.responseText;
|
||||
$("#toast").html(msg);
|
||||
// $("#ctl00_statusDiv").html(msg);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function GetFormData() {
|
||||
var list = new Array();
|
||||
$("tr.Entry").each(function () {
|
||||
$this = $(this);
|
||||
var date = $this.find("td.date").html();
|
||||
var attendance_type = $this.find("td select").val();
|
||||
list.push({ 'date':date, 'attendance_type':attendance_type });
|
||||
});
|
||||
|
||||
var id = getUrlFilename();
|
||||
return JSON.stringify({ id:id, attendances:list });
|
||||
}
|
|
@ -1,9 +1,22 @@
|
|||
function GroupListCtrl($scope, Group) {
|
||||
$scope.info = Group.query();
|
||||
function GroupListCtrl($scope, groups) {
|
||||
$scope.info = groups;
|
||||
}
|
||||
|
||||
function GroupCtrl($scope, $routeParams, $location, Group) {
|
||||
$scope.group = Group.get({id: $routeParams.id});
|
||||
GroupListCtrl.resolve = {
|
||||
groups:function ($q, Group) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Group.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function GroupCtrl($scope, $location, group) {
|
||||
$scope.group = group;
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.group.$save(function (u, putResponseHeaders) {
|
||||
|
@ -25,3 +38,17 @@ function GroupCtrl($scope, $routeParams, $location, Group) {
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
GroupCtrl.resolve = {
|
||||
group:function ($q, $route, Group) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Group.get({id:id}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,3 +11,15 @@
|
|||
}
|
||||
$('#username').focus();
|
||||
}
|
||||
|
||||
function LogoutCtrl($rootScope, $scope, $http, $location) {
|
||||
$http.
|
||||
post('/logout').
|
||||
success(function () {
|
||||
$scope.toasts.push({Type:'Success', Message:'Logged out'});
|
||||
$location.path('/')
|
||||
}).
|
||||
error(function (errorMessage) {
|
||||
$scope.toasts.push({Type:'Error', Message:errorMessage});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
|||
$routeProvider.
|
||||
when('/', {templateUrl:'/partial/home.html'}).
|
||||
when('/login', {templateUrl:'/partial/login.html', controller:LoginCtrl}).
|
||||
when('/logout', {templateUrl:'/partial/home.html', controller:LogoutCtrl}).
|
||||
|
||||
when('/Journal', {templateUrl:'/partial/journal.html', controller:JournalCtrl}).
|
||||
when('/Journal/:id', {templateUrl:'/partial/journal.html', controller:JournalCtrl}).
|
||||
|
@ -24,14 +25,14 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
|||
when('/Ledger', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve:LedgerCtrl.resolve}).
|
||||
when('/Ledger/:id', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve:LedgerCtrl.resolve}).
|
||||
|
||||
when('/ProductLedger', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl}).
|
||||
when('/ProductLedger/:id', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl}).
|
||||
when('/ProductLedger', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl, resolve:ProductLedgerCtrl.resolve}).
|
||||
when('/ProductLedger/:id', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl, resolve:ProductLedgerCtrl.resolve}).
|
||||
|
||||
when('/CashFlow', {templateUrl:'/partial/cash-flow.html', controller:CashFlowCtrl}).
|
||||
when('/CashFlow/:id', {templateUrl:'/partial/cash-flow.html', controller:CashFlowCtrl}).
|
||||
when('/CashFlow', {templateUrl:'/partial/cash-flow.html', controller:CashFlowCtrl, resolve:CashFlowCtrl.resolve}).
|
||||
when('/CashFlow/:id', {templateUrl:'/partial/cash-flow.html', controller:CashFlowCtrl, resolve:CashFlowCtrl.resolve}).
|
||||
|
||||
when('/RawMaterialCost', {templateUrl:'/partial/raw-material-cost.html', controller:RawMaterialCostCtrl}).
|
||||
when('/RawMaterialCost/:id', {templateUrl:'/partial/raw-material-cost-detail.html', controller:RawMaterialCostCtrl}).
|
||||
when('/RawMaterialCost', {templateUrl:'/partial/raw-material-cost.html', controller:RawMaterialCostCtrl, resolve:RawMaterialCostCtrl.resolve}).
|
||||
when('/RawMaterialCost/:id', {templateUrl:'/partial/raw-material-cost-detail.html', controller:RawMaterialCostCtrl, resolve:RawMaterialCostCtrl.resolve}).
|
||||
|
||||
when('/Attendance', {templateUrl:'/partial/attendance.html', controller:AttendanceCtrl, resolve:AttendanceCtrl.resolve}).
|
||||
when('/Attendance/:date', {templateUrl:'/partial/attendance.html', controller:AttendanceCtrl, resolve:AttendanceCtrl.resolve}).
|
||||
|
@ -40,44 +41,44 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
|||
when('/EmployeeAttendance/:id', {templateUrl:'/partial/employee-attendance.html', controller:EmployeeAttendanceCtrl, resolve:EmployeeAttendanceCtrl.resolve}).
|
||||
|
||||
when('/Daybook', {templateUrl:'/partial/daybook.html', controller:DaybookCtrl, resolve:DaybookCtrl.resolve}).
|
||||
when('/Unposted', {templateUrl:'/partial/unposted.html', controller:UnpostedCtrl}).
|
||||
when('/ProfitLoss', {templateUrl:'/partial/profit-loss.html', controller:ProfitLossCtrl}).
|
||||
when('/PurchaseEntries', {templateUrl:'/partial/purchase-entries.html', controller:PurchaseEntriesCtrl}).
|
||||
when('/Unposted', {templateUrl:'/partial/unposted.html', controller:UnpostedCtrl, resolve:UnpostedCtrl.resolve}).
|
||||
when('/ProfitLoss', {templateUrl:'/partial/profit-loss.html', controller:ProfitLossCtrl, resolve:ProfitLossCtrl.resolve}).
|
||||
when('/PurchaseEntries', {templateUrl:'/partial/purchase-entries.html', controller:PurchaseEntriesCtrl, resolve:PurchaseEntriesCtrl.resolve}).
|
||||
when('/EmployeeFunctions', {templateUrl:'/partial/employee-functions.html', controller:EmployeeFunctionsCtrl}).
|
||||
|
||||
when('/TrialBalance', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}).
|
||||
when('/TrialBalance/:date', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}).
|
||||
when('/TrialBalance', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl, resolve:TrialBalanceCtrl.resolve}).
|
||||
when('/TrialBalance/:date', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl, resolve:TrialBalanceCtrl.resolve}).
|
||||
|
||||
when('/ClosingStock', {templateUrl:'/partial/closing-stock.html', controller:ClosingStockCtrl, resolve:ClosingStockCtrl.resolve}).
|
||||
when('/ClosingStock/:date', {templateUrl:'/partial/closing-stock.html', controller:ClosingStockCtrl, resolve:ClosingStockCtrl.resolve}).
|
||||
|
||||
when('/Accounts', {templateUrl:'/partial/account-list.html', controller:AccountListCtrl}).
|
||||
when('/Account', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
|
||||
when('/Account/:id', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
|
||||
when('/Accounts', {templateUrl:'/partial/account-list.html', controller:AccountListCtrl, resolve:AccountListCtrl.resolve}).
|
||||
when('/Account', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl, resolve:AccountCtrl.resolve}).
|
||||
when('/Account/:id', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl, resolve:AccountCtrl.resolve}).
|
||||
|
||||
when('/Employees', {templateUrl:'/partial/employee-list.html', controller:EmployeeListCtrl}).
|
||||
when('/Employee', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl}).
|
||||
when('/Employee/:id', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl}).
|
||||
when('/Employees', {templateUrl:'/partial/employee-list.html', controller:EmployeeListCtrl, resolve:EmployeeListCtrl.resolve}).
|
||||
when('/Employee', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl, resolve:EmployeeCtrl.resolve}).
|
||||
when('/Employee/:id', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl, resolve:EmployeeCtrl.resolve}).
|
||||
|
||||
when('/CostCenters', {templateUrl:'/partial/cost-center-list.html', controller:CostCenterListCtrl}).
|
||||
when('/CostCenter', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl}).
|
||||
when('/CostCenter/:id', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl}).
|
||||
when('/CostCenters', {templateUrl:'/partial/cost-center-list.html', controller:CostCenterListCtrl, resolve:CostCenterListCtrl.resolve}).
|
||||
when('/CostCenter', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl, resolve:CostCenterCtrl.resolve}).
|
||||
when('/CostCenter/:id', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl, resolve:CostCenterCtrl.resolve}).
|
||||
|
||||
when('/Products', {templateUrl:'/partial/product-list.html', controller:ProductListCtrl}).
|
||||
when('/Product', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl}).
|
||||
when('/Product/:id', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl}).
|
||||
when('/Products', {templateUrl:'/partial/product-list.html', controller:ProductListCtrl, resolve:ProductListCtrl.resolve}).
|
||||
when('/Product', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl, resolve:ProductCtrl.resolve}).
|
||||
when('/Product/:id', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl, resolve:ProductCtrl.resolve}).
|
||||
|
||||
when('/ProductGroups', {templateUrl:'/partial/product-group-list.html', controller:ProductGroupListCtrl}).
|
||||
when('/ProductGroup', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl}).
|
||||
when('/ProductGroup/:id', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl}).
|
||||
when('/ProductGroups', {templateUrl:'/partial/product-group-list.html', controller:ProductGroupListCtrl, resolve:ProductGroupListCtrl.resolve}).
|
||||
when('/ProductGroup', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl, resolve:ProductGroupCtrl.resolve}).
|
||||
when('/ProductGroup/:id', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl, resolve:ProductGroupCtrl.resolve}).
|
||||
|
||||
when('/Users', {templateUrl:'/partial/user-list.html', controller:UserListCtrl}).
|
||||
when('/User', {templateUrl:'/partial/user-detail.html', controller:UserCtrl}).
|
||||
when('/User/:id', {templateUrl:'/partial/user-detail.html', controller:UserCtrl}).
|
||||
when('/Users', {templateUrl:'/partial/user-list.html', controller:UserListCtrl, resolve:UserListCtrl.resolve}).
|
||||
when('/User', {templateUrl:'/partial/user-detail.html', controller:UserCtrl, resolve:UserCtrl.resolve}).
|
||||
when('/User/:id', {templateUrl:'/partial/user-detail.html', controller:UserCtrl, resolve:UserCtrl.resolve}).
|
||||
|
||||
when('/Groups', {templateUrl:'/partial/group-list.html', controller:GroupListCtrl}).
|
||||
when('/Group', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl}).
|
||||
when('/Group/:id', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl}).
|
||||
when('/Groups', {templateUrl:'/partial/group-list.html', controller:GroupListCtrl, resolve:GroupListCtrl.resolve}).
|
||||
when('/Group', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl, resolve:GroupCtrl.resolve}).
|
||||
when('/Group/:id', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl, resolve:GroupCtrl.resolve}).
|
||||
|
||||
otherwise({templateUrl:'/partial/404.html'});
|
||||
$locationProvider.html5Mode(true).hashPrefix('!');
|
||||
|
@ -167,7 +168,8 @@ function BaseCtrl($rootScope, $scope, Auth, $location) {
|
|||
|
||||
$rootScope.$on("$routeChangeStart", function (event, next, current) {
|
||||
$rootScope.$broadcast('spinnerStart', 'route');
|
||||
$rootScope.auth = Auth.get(function (u, putResponseHeaders) {
|
||||
Auth.get(function (u, putResponseHeaders) {
|
||||
$rootScope.auth = u;
|
||||
$rootScope.perms = u.perms;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
function ProductGroupListCtrl($scope, ProductGroup) {
|
||||
$scope.info = ProductGroup.query();
|
||||
function ProductGroupListCtrl($scope, product_groups) {
|
||||
$scope.info = product_groups
|
||||
}
|
||||
|
||||
function ProductGroupCtrl($scope, $routeParams, $location, ProductGroup) {
|
||||
$scope.product_group = ProductGroup.get({id: $routeParams.id});
|
||||
ProductGroupListCtrl.resolve = {
|
||||
product_groups:function ($q, ProductGroup) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
ProductGroup.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function ProductGroupCtrl($scope, $location, product_group) {
|
||||
$scope.product_group = product_group;
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.product_group.$save(function (u, putResponseHeaders) {
|
||||
|
@ -25,3 +38,17 @@ function ProductGroupCtrl($scope, $routeParams, $location, ProductGroup) {
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
ProductGroupCtrl.resolve = {
|
||||
product_group:function ($q, $route, ProductGroup) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
ProductGroup.get({id:id}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
function ProductLedgerCtrl($scope, $routeParams, $location, ProductLedger) {
|
||||
if (typeof $routeParams.id === 'undefined') {
|
||||
$scope.info = ProductLedger.get({});
|
||||
} else {
|
||||
$scope.info = ProductLedger.get({id:$routeParams.id, StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
|
||||
}
|
||||
function ProductLedgerCtrl($scope, $routeParams, $location, product_ledger) {
|
||||
$scope.info = product_ledger;
|
||||
$scope.show = function () {
|
||||
$scope.info = ProductLedger.get({id:$scope.info.Product.ProductID, StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}, function (u, putResponseHeaders) {
|
||||
$location.path('/ProductLedger/' + u.Product.ProductID);
|
||||
$location.search('StartDate', u.StartDate);
|
||||
$location.search('FinishDate', u.FinishDate);
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type:'Error', Message:data.data});
|
||||
});
|
||||
$location.path('/ProductLedger/' + $scope.info.Product.ProductID).search('StartDate', $scope.info.StartDate).search('FinishDate', $scope.info.FinishDate);
|
||||
};
|
||||
$('#txtProduct').focus();
|
||||
}
|
||||
ProductLedgerCtrl.resolve = {
|
||||
product_ledger:function ($q, $route, ProductLedger) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var start_date = $route.current.params.StartDate;
|
||||
var finish_date = $route.current.params.FinishDate;
|
||||
|
||||
var successCb = function(result){
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof id === 'undefined') {
|
||||
ProductLedger.get({}, successCb);
|
||||
} else {
|
||||
ProductLedger.get({id:id, StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
function ProductListCtrl($scope, Product) {
|
||||
$scope.info = Product.query();
|
||||
function ProductListCtrl($scope, products) {
|
||||
$scope.info = products;
|
||||
}
|
||||
|
||||
function ProductCtrl($scope, $routeParams, $location, Product, ProductGroup) {
|
||||
$scope.product = Product.get({id:$routeParams.id});
|
||||
$scope.product_groups = ProductGroup.query();
|
||||
ProductListCtrl.resolve = {
|
||||
products:function ($q, $route, Product) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Product.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function ProductCtrl($scope, $location, product, product_groups) {
|
||||
$scope.product = product
|
||||
$scope.product_groups = product_groups;
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.product.$save(function (u, putResponseHeaders) {
|
||||
|
@ -26,3 +39,27 @@ function ProductCtrl($scope, $routeParams, $location, Product, ProductGroup) {
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
ProductCtrl.resolve = {
|
||||
product:function ($q, $route, Product) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Product.get({id: id}, successCb);
|
||||
return deferred.promise;
|
||||
},
|
||||
product_groups:function ($q, ProductGroup) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
ProductGroup.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,27 @@
|
|||
function ProfitLossCtrl($scope, $routeParams, $location, ProfitLoss) {
|
||||
if (typeof $routeParams.StartDate === 'undefined') {
|
||||
$scope.info = ProfitLoss.get({});
|
||||
} else {
|
||||
$scope.info = ProfitLoss.get({StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
}
|
||||
function ProfitLossCtrl($scope, $location, profit_loss) {
|
||||
$scope.info = profit_loss;
|
||||
$scope.show = function () {
|
||||
$scope.info = ProfitLoss.get({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}, function (u, putResponseHeaders) {
|
||||
$location.path('/ProfitLoss').search({StartDate:u.StartDate, FinishDate:u.FinishDate});
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type:'Error', Message:data.data});
|
||||
});
|
||||
$location.path('/ProfitLoss').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate});
|
||||
};
|
||||
$('#txtStartDate').focus();
|
||||
}
|
||||
|
||||
ProfitLossCtrl.resolve = {
|
||||
profit_loss:function ($q, $route, ProfitLoss) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var start_date = $route.current.params.StartDate;
|
||||
var finish_date = $route.current.params.FinishDate;
|
||||
|
||||
var successCb = function(result){
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
||||
ProfitLoss.get({}, successCb);
|
||||
} else {
|
||||
ProfitLoss.get({StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,30 @@
|
|||
function PurchaseEntriesCtrl($scope, $routeParams, $location, PurchaseEntries) {
|
||||
if (typeof $routeParams.StartDate === 'undefined') {
|
||||
$scope.info = PurchaseEntries.get({});
|
||||
} else {
|
||||
$scope.info = PurchaseEntries.get({StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
}
|
||||
function PurchaseEntriesCtrl($scope, $location, purchase_entries) {
|
||||
$scope.info = purchase_entries;
|
||||
|
||||
$scope.show = function () {
|
||||
$scope.info = PurchaseEntries.get({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}, function (u, putResponseHeaders) {
|
||||
$location.path('/PurchaseEntries').search({StartDate:u.StartDate, FinishDate:u.FinishDate});
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type:'Error', Message:data.data});
|
||||
});
|
||||
$location.path('/PurchaseEntries').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate});
|
||||
};
|
||||
$('#txtStartDate').focus();
|
||||
}
|
||||
|
||||
PurchaseEntriesCtrl.resolve = {
|
||||
purchase_entries:function ($q, $route, PurchaseEntries) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var start_date = $route.current.params.StartDate;
|
||||
var finish_date = $route.current.params.FinishDate;
|
||||
|
||||
var successCb = function(result){
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
||||
PurchaseEntries.get({}, successCb);
|
||||
} else {
|
||||
PurchaseEntries.get({StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,29 @@
|
|||
function RawMaterialCostCtrl($scope, $routeParams, $location, RawMaterialCost) {
|
||||
if (typeof $routeParams.StartDate === 'undefined') {
|
||||
$scope.info = RawMaterialCost.get({});
|
||||
} else if (typeof $routeParams.id === 'undefined') {
|
||||
$scope.info = RawMaterialCost.get({StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
} else {
|
||||
$scope.info = RawMaterialCost.get({id:$routeParams.id, StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
|
||||
}
|
||||
function RawMaterialCostCtrl($scope, $routeParams, $location, raw_material_cost) {
|
||||
$scope.info = raw_material_cost;
|
||||
$scope.show = function () {
|
||||
$scope.info = RawMaterialCost.get({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}, function (u, putResponseHeaders) {
|
||||
$location.path('/RawMaterialCost').search({StartDate:u.StartDate, FinishDate:u.FinishDate});
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type:'Error', Message:data.data});
|
||||
});
|
||||
$location.path('/RawMaterialCost').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate});
|
||||
};
|
||||
$('#txtStartDate').focus();
|
||||
}
|
||||
RawMaterialCostCtrl.resolve = {
|
||||
raw_material_cost:function ($q, $route, RawMaterialCost) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var start_date = $route.current.params.StartDate;
|
||||
var finish_date = $route.current.params.FinishDate;
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
||||
RawMaterialCost.get({}, successCb);
|
||||
} else if (typeof id === 'undefined') {
|
||||
RawMaterialCost.get({StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
} else {
|
||||
RawMaterialCost.get({id:id, StartDate:start_date, FinishDate:finish_date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
function TrialBalanceCtrl($scope, $routeParams, $location, TrialBalance) {
|
||||
if (typeof $routeParams.date === 'undefined') {
|
||||
$scope.info = TrialBalance.get({});
|
||||
} else {
|
||||
$scope.info = TrialBalance.get({date:$routeParams.date});
|
||||
function TrialBalanceCtrl($scope, $routeParams, $location, trial_balance) {
|
||||
$scope.info = trial_balance;
|
||||
|
||||
}
|
||||
$scope.show = function () {
|
||||
$scope.info = TrialBalance.get({id:$scope.info.Date}, function (u, putResponseHeaders) {
|
||||
$location.path('/TrialBalance/' + u.Date);
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type:'Error', Message:data.data});
|
||||
});
|
||||
$location.path('/TrialBalance/' + $scope.info.Date);
|
||||
};
|
||||
$('#txtDate').focus();
|
||||
}
|
||||
TrialBalanceCtrl.resolve = {
|
||||
trial_balance:function ($q, $route, TrialBalance) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var date = $route.current.params.date;
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof date === 'undefined') {
|
||||
TrialBalance.get({}, successCb);
|
||||
} else {
|
||||
TrialBalance.get({date:date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,15 @@
|
|||
function UnpostedCtrl($scope, Unposted) {
|
||||
$scope.info = Unposted.query();
|
||||
function UnpostedCtrl($scope, info) {
|
||||
$scope.info = info;
|
||||
}
|
||||
UnpostedCtrl.resolve = {
|
||||
info:function ($q, Unposted) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function(result){
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
Unposted.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,22 @@
|
|||
function UserListCtrl($scope, User) {
|
||||
$scope.info = User.query();
|
||||
function UserListCtrl($scope, users) {
|
||||
$scope.info = users;
|
||||
}
|
||||
|
||||
function UserCtrl($scope, $routeParams, $location, User) {
|
||||
$scope.user = User.get({id: $routeParams.id});
|
||||
UserListCtrl.resolve = {
|
||||
users:function ($q, User) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
User.query({}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
function UserCtrl($scope, $location, user) {
|
||||
$scope.user = user;
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.user.$save(function (u, putResponseHeaders) {
|
||||
|
@ -25,3 +38,17 @@ function UserCtrl($scope, $routeParams, $location, User) {
|
|||
$('#txtName').focus();
|
||||
|
||||
}
|
||||
|
||||
UserCtrl.resolve = {
|
||||
user:function ($q, $route, User) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var id = $route.current.params.id;
|
||||
var successCb = function (result) {
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
User.get({id:id}, successCb);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue