Chore: Using angularjs 1.5.0 online hosted.
Refactor: Simplified MenuItem and Hierarchical Product table. Feature: Recipe now follows temporat (Point in time) feature. It should be fully working and records the recipe cost for a period based on the issue price and as on date. Feature: Using Angular Material for recipe form and also or product form.
This commit is contained in:
1 parent
2e670c06ec
commit
abc77fb5a6
32 files changed
+4649
-27241
No files matched your search
+32
-33
@@ -10,43 +10,42 @@ overlordService.factory('Voucher', ['$resource', function ($resource) {
|
||||
return $resource('/api/Voucher/:id',
|
||||
{id: '@VoucherID'}, {
|
||||
post: {method: 'POST', params: {post: true}},
|
||||
save: {method: 'POST', transformRequest: function (orgData, headersGetter) {
|
||||
var data = angular.copy(orgData);
|
||||
save: {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': undefined},
|
||||
transformRequest: function (orgData, headers) {
|
||||
var data = angular.copy(orgData);
|
||||
|
||||
function dataURLtoBlob(dataURL) {
|
||||
var re = /^data:([\w/\-\.]+);\w+,(.*)$/,
|
||||
m = dataURL.match(re),
|
||||
mimeString = m[1],
|
||||
byteString = atob(m[2]),
|
||||
ab = new ArrayBuffer(byteString.length),
|
||||
dw = new DataView(ab),
|
||||
function dataURLtoBlob(dataURL) {
|
||||
var re = /^data:([\w/\-\.]+);\w+,(.*)$/,
|
||||
m = dataURL.match(re),
|
||||
mimeString = m[1],
|
||||
byteString = atob(m[2]),
|
||||
ab = new ArrayBuffer(byteString.length),
|
||||
dw = new DataView(ab),
|
||||
i;
|
||||
|
||||
for (i = 0; i < byteString.length; i++) {
|
||||
dw.setUint8(i, byteString.charCodeAt(i));
|
||||
}
|
||||
return new Blob([ab], {type: mimeString});
|
||||
}
|
||||
|
||||
var fd = new FormData(),
|
||||
files = [],
|
||||
i;
|
||||
|
||||
for (i = 0; i < byteString.length; i++) {
|
||||
dw.setUint8(i, byteString.charCodeAt(i));
|
||||
for (i = data.Files.length - 1; i >= 0; i--) {
|
||||
var item = data.Files[i];
|
||||
if (!item.ID) {
|
||||
fd.append('f' + i, dataURLtoBlob(item.Resized));
|
||||
fd.append('t' + i, dataURLtoBlob(item.Thumbnail));
|
||||
data.Files.splice(i, 1);
|
||||
}
|
||||
}
|
||||
return new Blob([ab], {type: mimeString});
|
||||
fd.append('model', angular.toJson(data));
|
||||
return fd;
|
||||
}
|
||||
|
||||
var fd = new FormData(),
|
||||
files = [],
|
||||
i;
|
||||
for (i = data.Files.length - 1; i >= 0; i--) {
|
||||
var item = data.Files[i];
|
||||
if (!item.ID) {
|
||||
fd.append('f' + i, dataURLtoBlob(item.Resized));
|
||||
fd.append('t' + i, dataURLtoBlob(item.Thumbnail));
|
||||
data.Files.splice(i, 1);
|
||||
}
|
||||
}
|
||||
fd.append('model', angular.toJson(data));
|
||||
var headers = headersGetter();
|
||||
angular.forEach(headers, function (value, key) {
|
||||
delete headers[key];
|
||||
});
|
||||
headers['Content-Type'] = undefined;
|
||||
return fd;
|
||||
}}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var LoginController = ['$scope', '$http', '$location', '$routeParams', '$cookieStore', function ($scope, $http, $location, $routeParams, $cookieStore) {
|
||||
var LoginController = ['$scope', '$http', '$location', '$routeParams', '$cookies', function ($scope, $http, $location, $routeParams, $cookies) {
|
||||
$scope.showOTP = false;
|
||||
$scope.submit = function () {
|
||||
var data;
|
||||
@@ -23,7 +23,7 @@ var LoginController = ['$scope', '$http', '$location', '$routeParams', '$cookieS
|
||||
error(function (data, status, headers, config) {
|
||||
if (status === 403 && ['Unknown Client', 'OTP not supplied', 'OTP is wrong'].indexOf(data) !== -1) {
|
||||
$scope.showOTP = true;
|
||||
$scope.clientID = $cookieStore.get('ClientID');
|
||||
$scope.clientID = $cookies.get('ClientID');
|
||||
$scope.$apply();
|
||||
}
|
||||
$scope.toasts.push({Type: 'Danger', Message: data});
|
||||
|
||||
@@ -1,114 +1,413 @@
|
||||
'use strict';
|
||||
|
||||
var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filter', 'overlord.service', 'ngCookies', 'ngRoute', 'ui.bootstrap', 'chieffancypants.loadingBar'])
|
||||
var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filter', 'overlord.service', 'ngCookies', 'ngRoute', 'ui.bootstrap', 'chieffancypants.loadingBar', 'ngMaterial'])
|
||||
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
|
||||
$routeProvider.
|
||||
when('/', {templateUrl: '/partial/home.html', controller: HomeController, resolve: HomeController.resolve}).
|
||||
when('/login', {templateUrl: '/partial/login.html', controller: LoginController}).
|
||||
when('/logout', {templateUrl: '/partial/home.html', controller: LogoutController}).
|
||||
|
||||
when('/Journal', {templateUrl: '/partial/journal.html', controller: JournalController, resolve: JournalController.resolve}).
|
||||
when('/Journal/:id', {templateUrl: '/partial/journal.html', controller: JournalController, resolve: JournalController.resolve}).
|
||||
when('/Journal', {
|
||||
templateUrl: '/partial/journal.html',
|
||||
controller: JournalController,
|
||||
resolve: JournalController.resolve
|
||||
}).
|
||||
when('/Journal/:id', {
|
||||
templateUrl: '/partial/journal.html',
|
||||
controller: JournalController,
|
||||
resolve: JournalController.resolve
|
||||
}).
|
||||
|
||||
when('/Payment', {templateUrl: '/partial/payment.html', controller: PaymentController, resolve: PaymentController.resolve, reloadOnSearch:false}).
|
||||
when('/Payment/:id', {templateUrl: '/partial/payment.html', controller: PaymentController, resolve: PaymentController.resolve, reloadOnSearch:false}).
|
||||
when('/Payment', {
|
||||
templateUrl: '/partial/payment.html',
|
||||
controller: PaymentController,
|
||||
resolve: PaymentController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/Payment/:id', {
|
||||
templateUrl: '/partial/payment.html',
|
||||
controller: PaymentController,
|
||||
resolve: PaymentController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
|
||||
when('/Receipt', {templateUrl: '/partial/receipt.html', controller: ReceiptController, resolve: ReceiptController.resolve, reloadOnSearch:false}).
|
||||
when('/Receipt/:id', {templateUrl: '/partial/receipt.html', controller: ReceiptController, resolve: ReceiptController.resolve, reloadOnSearch:false}).
|
||||
when('/Receipt', {
|
||||
templateUrl: '/partial/receipt.html',
|
||||
controller: ReceiptController,
|
||||
resolve: ReceiptController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/Receipt/:id', {
|
||||
templateUrl: '/partial/receipt.html',
|
||||
controller: ReceiptController,
|
||||
resolve: ReceiptController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
|
||||
when('/Purchase', {templateUrl: '/partial/purchase.html', controller: PurchaseController, resolve: PurchaseController.resolve}).
|
||||
when('/Purchase/:id', {templateUrl: '/partial/purchase.html', controller: PurchaseController, resolve: PurchaseController.resolve}).
|
||||
when('/Purchase', {
|
||||
templateUrl: '/partial/purchase.html',
|
||||
controller: PurchaseController,
|
||||
resolve: PurchaseController.resolve
|
||||
}).
|
||||
when('/Purchase/:id', {
|
||||
templateUrl: '/partial/purchase.html',
|
||||
controller: PurchaseController,
|
||||
resolve: PurchaseController.resolve
|
||||
}).
|
||||
|
||||
when('/Return', {templateUrl: '/partial/purchase-return.html', controller: PurchaseReturnController, resolve: PurchaseReturnController.resolve}).
|
||||
when('/Return/:id', {templateUrl: '/partial/purchase-return.html', controller: PurchaseReturnController, resolve: PurchaseReturnController.resolve}).
|
||||
when('/Return', {
|
||||
templateUrl: '/partial/purchase-return.html',
|
||||
controller: PurchaseReturnController,
|
||||
resolve: PurchaseReturnController.resolve
|
||||
}).
|
||||
when('/Return/:id', {
|
||||
templateUrl: '/partial/purchase-return.html',
|
||||
controller: PurchaseReturnController,
|
||||
resolve: PurchaseReturnController.resolve
|
||||
}).
|
||||
|
||||
when('/Issue', {templateUrl: '/partial/issue.html', controller: IssueController, resolve: IssueController.resolve}).
|
||||
when('/Issue/:id', {templateUrl: '/partial/issue.html', controller: IssueController, resolve: IssueController.resolve}).
|
||||
when('/Issue', {
|
||||
templateUrl: '/partial/issue.html',
|
||||
controller: IssueController,
|
||||
resolve: IssueController.resolve
|
||||
}).
|
||||
when('/Issue/:id', {
|
||||
templateUrl: '/partial/issue.html',
|
||||
controller: IssueController,
|
||||
resolve: IssueController.resolve
|
||||
}).
|
||||
|
||||
when('/SalaryDeduction', {templateUrl: '/partial/salary-deduction.html', controller: SalaryDeductionController, resolve: SalaryDeductionController.resolve}).
|
||||
when('/SalaryDeduction/:id', {templateUrl: '/partial/salary-deduction.html', controller: SalaryDeductionController, resolve: SalaryDeductionController.resolve}).
|
||||
when('/SalaryDeduction', {
|
||||
templateUrl: '/partial/salary-deduction.html',
|
||||
controller: SalaryDeductionController,
|
||||
resolve: SalaryDeductionController.resolve
|
||||
}).
|
||||
when('/SalaryDeduction/:id', {
|
||||
templateUrl: '/partial/salary-deduction.html',
|
||||
controller: SalaryDeductionController,
|
||||
resolve: SalaryDeductionController.resolve
|
||||
}).
|
||||
|
||||
when('/ServiceCharge', {templateUrl: '/partial/employee-service-charge.html', controller: ServiceChargeController, resolve: ServiceChargeController.resolve}).
|
||||
when('/ServiceCharge/:id', {templateUrl: '/partial/employee-service-charge.html', controller: ServiceChargeController, resolve: ServiceChargeController.resolve}).
|
||||
when('/ServiceCharge', {
|
||||
templateUrl: '/partial/employee-service-charge.html',
|
||||
controller: ServiceChargeController,
|
||||
resolve: ServiceChargeController.resolve
|
||||
}).
|
||||
when('/ServiceCharge/:id', {
|
||||
templateUrl: '/partial/employee-service-charge.html',
|
||||
controller: ServiceChargeController,
|
||||
resolve: ServiceChargeController.resolve
|
||||
}).
|
||||
|
||||
when('/Ledger', {templateUrl: '/partial/ledger.html', controller: LedgerController, resolve: LedgerController.resolve}).
|
||||
when('/Ledger/:id', {templateUrl: '/partial/ledger.html', controller: LedgerController, resolve: LedgerController.resolve}).
|
||||
when('/Ledger', {
|
||||
templateUrl: '/partial/ledger.html',
|
||||
controller: LedgerController,
|
||||
resolve: LedgerController.resolve
|
||||
}).
|
||||
when('/Ledger/:id', {
|
||||
templateUrl: '/partial/ledger.html',
|
||||
controller: LedgerController,
|
||||
resolve: LedgerController.resolve
|
||||
}).
|
||||
|
||||
when('/Reconcile', {templateUrl: '/partial/reconcile.html', controller: ReconcileController, resolve: ReconcileController.resolve}).
|
||||
when('/Reconcile/:id', {templateUrl: '/partial/reconcile.html', controller: ReconcileController, resolve: ReconcileController.resolve}).
|
||||
when('/Reconcile', {
|
||||
templateUrl: '/partial/reconcile.html',
|
||||
controller: ReconcileController,
|
||||
resolve: ReconcileController.resolve
|
||||
}).
|
||||
when('/Reconcile/:id', {
|
||||
templateUrl: '/partial/reconcile.html',
|
||||
controller: ReconcileController,
|
||||
resolve: ReconcileController.resolve
|
||||
}).
|
||||
|
||||
when('/ProductLedger', {templateUrl: '/partial/product-ledger.html', controller: ProductLedgerController, resolve: ProductLedgerController.resolve}).
|
||||
when('/ProductLedger/:id', {templateUrl: '/partial/product-ledger.html', controller: ProductLedgerController, resolve: ProductLedgerController.resolve}).
|
||||
when('/ProductLedger', {
|
||||
templateUrl: '/partial/product-ledger.html',
|
||||
controller: ProductLedgerController,
|
||||
resolve: ProductLedgerController.resolve
|
||||
}).
|
||||
when('/ProductLedger/:id', {
|
||||
templateUrl: '/partial/product-ledger.html',
|
||||
controller: ProductLedgerController,
|
||||
resolve: ProductLedgerController.resolve
|
||||
}).
|
||||
|
||||
when('/CashFlow', {templateUrl: '/partial/cash-flow.html', controller: CashFlowController, resolve: CashFlowController.resolve}).
|
||||
when('/CashFlow/:id', {templateUrl: '/partial/cash-flow.html', controller: CashFlowController, resolve: CashFlowController.resolve}).
|
||||
when('/CashFlow', {
|
||||
templateUrl: '/partial/cash-flow.html',
|
||||
controller: CashFlowController,
|
||||
resolve: CashFlowController.resolve
|
||||
}).
|
||||
when('/CashFlow/:id', {
|
||||
templateUrl: '/partial/cash-flow.html',
|
||||
controller: CashFlowController,
|
||||
resolve: CashFlowController.resolve
|
||||
}).
|
||||
|
||||
when('/RawMaterialCost', {templateUrl: '/partial/raw-material-cost.html', controller: RawMaterialCostController, resolve: RawMaterialCostController.resolve}).
|
||||
when('/RawMaterialCost/:id', {templateUrl: '/partial/raw-material-cost-detail.html', controller: RawMaterialCostController, resolve: RawMaterialCostController.resolve}).
|
||||
when('/RawMaterialCost', {
|
||||
templateUrl: '/partial/raw-material-cost.html',
|
||||
controller: RawMaterialCostController,
|
||||
resolve: RawMaterialCostController.resolve
|
||||
}).
|
||||
when('/RawMaterialCost/:id', {
|
||||
templateUrl: '/partial/raw-material-cost-detail.html',
|
||||
controller: RawMaterialCostController,
|
||||
resolve: RawMaterialCostController.resolve
|
||||
}).
|
||||
|
||||
when('/Attendance', {templateUrl: '/partial/attendance.html', controller: AttendanceController, resolve: AttendanceController.resolve}).
|
||||
when('/Attendance/:date', {templateUrl: '/partial/attendance.html', controller: AttendanceController, resolve: AttendanceController.resolve}).
|
||||
when('/Attendance', {
|
||||
templateUrl: '/partial/attendance.html',
|
||||
controller: AttendanceController,
|
||||
resolve: AttendanceController.resolve
|
||||
}).
|
||||
when('/Attendance/:date', {
|
||||
templateUrl: '/partial/attendance.html',
|
||||
controller: AttendanceController,
|
||||
resolve: AttendanceController.resolve
|
||||
}).
|
||||
|
||||
when('/EmployeeAttendance', {templateUrl: '/partial/employee-attendance.html', controller: EmployeeAttendanceController, resolve: EmployeeAttendanceController.resolve}).
|
||||
when('/EmployeeAttendance/:id', {templateUrl: '/partial/employee-attendance.html', controller: EmployeeAttendanceController, resolve: EmployeeAttendanceController.resolve}).
|
||||
when('/EmployeeAttendance', {
|
||||
templateUrl: '/partial/employee-attendance.html',
|
||||
controller: EmployeeAttendanceController,
|
||||
resolve: EmployeeAttendanceController.resolve
|
||||
}).
|
||||
when('/EmployeeAttendance/:id', {
|
||||
templateUrl: '/partial/employee-attendance.html',
|
||||
controller: EmployeeAttendanceController,
|
||||
resolve: EmployeeAttendanceController.resolve
|
||||
}).
|
||||
|
||||
when('/Daybook', {templateUrl: '/partial/daybook.html', controller: DaybookController, resolve: DaybookController.resolve}).
|
||||
when('/Unposted', {templateUrl: '/partial/unposted.html', controller: UnpostedController, resolve: UnpostedController.resolve}).
|
||||
when('/ProfitLoss', {templateUrl: '/partial/profit-loss.html', controller: ProfitLossController, resolve: ProfitLossController.resolve}).
|
||||
when('/StockMovement', {templateUrl: '/partial/stock-movement.html', controller: StockMovementController, resolve: StockMovementController.resolve}).
|
||||
when('/NetTransactions', {templateUrl: '/partial/net-transactions.html', controller: NetTransactionsController, resolve: NetTransactionsController.resolve}).
|
||||
when('/PurchaseEntries', {templateUrl: '/partial/purchase-entries.html', controller: PurchaseEntriesController, resolve: PurchaseEntriesController.resolve}).
|
||||
when('/Purchases', {templateUrl: '/partial/purchases.html', controller: PurchasesController, resolve: PurchasesController.resolve}).
|
||||
when('/EmployeeFunctions', {templateUrl: '/partial/employee-functions.html', controller: EmployeeFunctionsController}).
|
||||
when('/Daybook', {
|
||||
templateUrl: '/partial/daybook.html',
|
||||
controller: DaybookController,
|
||||
resolve: DaybookController.resolve
|
||||
}).
|
||||
when('/Unposted', {
|
||||
templateUrl: '/partial/unposted.html',
|
||||
controller: UnpostedController,
|
||||
resolve: UnpostedController.resolve
|
||||
}).
|
||||
when('/ProfitLoss', {
|
||||
templateUrl: '/partial/profit-loss.html',
|
||||
controller: ProfitLossController,
|
||||
resolve: ProfitLossController.resolve
|
||||
}).
|
||||
when('/StockMovement', {
|
||||
templateUrl: '/partial/stock-movement.html',
|
||||
controller: StockMovementController,
|
||||
resolve: StockMovementController.resolve
|
||||
}).
|
||||
when('/NetTransactions', {
|
||||
templateUrl: '/partial/net-transactions.html',
|
||||
controller: NetTransactionsController,
|
||||
resolve: NetTransactionsController.resolve
|
||||
}).
|
||||
when('/PurchaseEntries', {
|
||||
templateUrl: '/partial/purchase-entries.html',
|
||||
controller: PurchaseEntriesController,
|
||||
resolve: PurchaseEntriesController.resolve
|
||||
}).
|
||||
when('/Purchases', {
|
||||
templateUrl: '/partial/purchases.html',
|
||||
controller: PurchasesController,
|
||||
resolve: PurchasesController.resolve
|
||||
}).
|
||||
when('/EmployeeFunctions', {
|
||||
templateUrl: '/partial/employee-functions.html',
|
||||
controller: EmployeeFunctionsController
|
||||
}).
|
||||
|
||||
when('/BalanceSheet', {templateUrl: '/partial/balance-sheet.html', controller: BalanceSheetController, resolve: BalanceSheetController.resolve}).
|
||||
when('/BalanceSheet/:date', {templateUrl: '/partial/balance-sheet.html', controller: BalanceSheetController, resolve: BalanceSheetController.resolve}).
|
||||
when('/BalanceSheet', {
|
||||
templateUrl: '/partial/balance-sheet.html',
|
||||
controller: BalanceSheetController,
|
||||
resolve: BalanceSheetController.resolve
|
||||
}).
|
||||
when('/BalanceSheet/:date', {
|
||||
templateUrl: '/partial/balance-sheet.html',
|
||||
controller: BalanceSheetController,
|
||||
resolve: BalanceSheetController.resolve
|
||||
}).
|
||||
|
||||
when('/TrialBalance', {templateUrl: '/partial/trial-balance.html', controller: TrialBalanceController, resolve: TrialBalanceController.resolve}).
|
||||
when('/TrialBalance/:date', {templateUrl: '/partial/trial-balance.html', controller: TrialBalanceController, resolve: TrialBalanceController.resolve}).
|
||||
when('/TrialBalance', {
|
||||
templateUrl: '/partial/trial-balance.html',
|
||||
controller: TrialBalanceController,
|
||||
resolve: TrialBalanceController.resolve
|
||||
}).
|
||||
when('/TrialBalance/:date', {
|
||||
templateUrl: '/partial/trial-balance.html',
|
||||
controller: TrialBalanceController,
|
||||
resolve: TrialBalanceController.resolve
|
||||
}).
|
||||
|
||||
when('/ClosingStock', {templateUrl: '/partial/closing-stock.html', controller: ClosingStockController, resolve: ClosingStockController.resolve}).
|
||||
when('/ClosingStock/:date', {templateUrl: '/partial/closing-stock.html', controller: ClosingStockController, resolve: ClosingStockController.resolve}).
|
||||
when('/ClosingStock', {
|
||||
templateUrl: '/partial/closing-stock.html',
|
||||
controller: ClosingStockController,
|
||||
resolve: ClosingStockController.resolve
|
||||
}).
|
||||
when('/ClosingStock/:date', {
|
||||
templateUrl: '/partial/closing-stock.html',
|
||||
controller: ClosingStockController,
|
||||
resolve: ClosingStockController.resolve
|
||||
}).
|
||||
|
||||
when('/Accounts', {templateUrl: '/partial/account-list.html', controller: AccountListController, resolve: AccountListController.resolve, reloadOnSearch:false}).
|
||||
when('/Account', {templateUrl: '/partial/account-detail.html', controller: AccountController, resolve: AccountController.resolve}).
|
||||
when('/Account/:id', {templateUrl: '/partial/account-detail.html', controller: AccountController, resolve: AccountController.resolve}).
|
||||
when('/Accounts', {
|
||||
templateUrl: '/partial/account-list.html',
|
||||
controller: AccountListController,
|
||||
resolve: AccountListController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/Account', {
|
||||
templateUrl: '/partial/account-detail.html',
|
||||
controller: AccountController,
|
||||
resolve: AccountController.resolve
|
||||
}).
|
||||
when('/Account/:id', {
|
||||
templateUrl: '/partial/account-detail.html',
|
||||
controller: AccountController,
|
||||
resolve: AccountController.resolve
|
||||
}).
|
||||
|
||||
when('/Employees', {templateUrl: '/partial/employee-list.html', controller: EmployeeListController, resolve: EmployeeListController.resolve, reloadOnSearch:false}).
|
||||
when('/Employee', {templateUrl: '/partial/employee-detail.html', controller: EmployeeController, resolve: EmployeeController.resolve}).
|
||||
when('/Employee/:id', {templateUrl: '/partial/employee-detail.html', controller: EmployeeController, resolve: EmployeeController.resolve}).
|
||||
when('/Employees', {
|
||||
templateUrl: '/partial/employee-list.html',
|
||||
controller: EmployeeListController,
|
||||
resolve: EmployeeListController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/Employee', {
|
||||
templateUrl: '/partial/employee-detail.html',
|
||||
controller: EmployeeController,
|
||||
resolve: EmployeeController.resolve
|
||||
}).
|
||||
when('/Employee/:id', {
|
||||
templateUrl: '/partial/employee-detail.html',
|
||||
controller: EmployeeController,
|
||||
resolve: EmployeeController.resolve
|
||||
}).
|
||||
|
||||
when('/CostCentres', {templateUrl: '/partial/cost-centre-list.html', controller: CostCentreListController, resolve: CostCentreListController.resolve}).
|
||||
when('/CostCentre', {templateUrl: '/partial/cost-centre-detail.html', controller: CostCentreController, resolve: CostCentreController.resolve}).
|
||||
when('/CostCentre/:id', {templateUrl: '/partial/cost-centre-detail.html', controller: CostCentreController, resolve: CostCentreController.resolve}).
|
||||
when('/CostCentres', {
|
||||
templateUrl: '/partial/cost-centre-list.html',
|
||||
controller: CostCentreListController,
|
||||
resolve: CostCentreListController.resolve
|
||||
}).
|
||||
when('/CostCentre', {
|
||||
templateUrl: '/partial/cost-centre-detail.html',
|
||||
controller: CostCentreController,
|
||||
resolve: CostCentreController.resolve
|
||||
}).
|
||||
when('/CostCentre/:id', {
|
||||
templateUrl: '/partial/cost-centre-detail.html',
|
||||
controller: CostCentreController,
|
||||
resolve: CostCentreController.resolve
|
||||
}).
|
||||
|
||||
when('/Products', {templateUrl: '/partial/product-list.html', controller: ProductListController, resolve: ProductListController.resolve, reloadOnSearch:false}).
|
||||
when('/Product', {templateUrl: '/partial/product-detail.html', controller: ProductController, resolve: ProductController.resolve}).
|
||||
when('/Product/:id', {templateUrl: '/partial/product-detail.html', controller: ProductController, resolve: ProductController.resolve}).
|
||||
when('/Products', {
|
||||
templateUrl: '/partial/product-list.html',
|
||||
controller: ProductListController,
|
||||
resolve: ProductListController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/Product', {
|
||||
templateUrl: '/partial/product-detail.html',
|
||||
controller: ProductController,
|
||||
resolve: ProductController.resolve
|
||||
}).
|
||||
when('/Product/:id', {
|
||||
templateUrl: '/partial/product-detail.html',
|
||||
controller: ProductController,
|
||||
resolve: ProductController.resolve
|
||||
}).
|
||||
|
||||
when('/Recipes', {templateUrl: '/partial/recipe-list.html', controller: RecipeListController, resolve: RecipeListController.resolve, reloadOnSearch:false}).
|
||||
when('/Recipe', {templateUrl: '/partial/recipe-detail.html', controller: RecipeController, resolve: RecipeController.resolve}).
|
||||
when('/Recipe/:id', {templateUrl: '/partial/recipe-detail.html', controller: RecipeController, resolve: RecipeController.resolve}).
|
||||
when('/Recipes', {
|
||||
templateUrl: '/partial/recipe-list.html',
|
||||
controller: RecipeListController,
|
||||
resolve: RecipeListController.resolve,
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/Recipe', {
|
||||
templateUrl: '/partial/recipe-detail.html',
|
||||
controller: RecipeController,
|
||||
resolve: RecipeController.resolve
|
||||
}).
|
||||
when('/Recipe/:id', {
|
||||
templateUrl: '/partial/recipe-detail.html',
|
||||
controller: RecipeController,
|
||||
resolve: RecipeController.resolve
|
||||
}).
|
||||
|
||||
when('/ProductGroups', {templateUrl: '/partial/product-group-list.html', controller: ProductGroupListController, resolve: ProductGroupListController.resolve}).
|
||||
when('/ProductGroup', {templateUrl: '/partial/product-group-detail.html', controller: ProductGroupController, resolve: ProductGroupController.resolve}).
|
||||
when('/ProductGroup/:id', {templateUrl: '/partial/product-group-detail.html', controller: ProductGroupController, resolve: ProductGroupController.resolve}).
|
||||
when('/ProductGroups', {
|
||||
templateUrl: '/partial/product-group-list.html',
|
||||
controller: ProductGroupListController,
|
||||
resolve: ProductGroupListController.resolve
|
||||
}).
|
||||
when('/ProductGroup', {
|
||||
templateUrl: '/partial/product-group-detail.html',
|
||||
controller: ProductGroupController,
|
||||
resolve: ProductGroupController.resolve
|
||||
}).
|
||||
when('/ProductGroup/:id', {
|
||||
templateUrl: '/partial/product-group-detail.html',
|
||||
controller: ProductGroupController,
|
||||
resolve: ProductGroupController.resolve
|
||||
}).
|
||||
|
||||
when('/Users', {templateUrl: '/partial/user-list.html', controller: UserListController, resolve: UserListController.resolve}).
|
||||
when('/User', {templateUrl: '/partial/user-detail.html', controller: UserController, resolve: UserController.resolve}).
|
||||
when('/User/:id', {templateUrl: '/partial/user-detail.html', controller: UserController, resolve: UserController.resolve}).
|
||||
when('/Users', {
|
||||
templateUrl: '/partial/user-list.html',
|
||||
controller: UserListController,
|
||||
resolve: UserListController.resolve
|
||||
}).
|
||||
when('/User', {
|
||||
templateUrl: '/partial/user-detail.html',
|
||||
controller: UserController,
|
||||
resolve: UserController.resolve
|
||||
}).
|
||||
when('/User/:id', {
|
||||
templateUrl: '/partial/user-detail.html',
|
||||
controller: UserController,
|
||||
resolve: UserController.resolve
|
||||
}).
|
||||
|
||||
when('/Groups', {templateUrl: '/partial/group-list.html', controller: GroupListController, resolve: GroupListController.resolve}).
|
||||
when('/Group', {templateUrl: '/partial/group-detail.html', controller: GroupController, resolve: GroupController.resolve}).
|
||||
when('/Group/:id', {templateUrl: '/partial/group-detail.html', controller: GroupController, resolve: GroupController.resolve}).
|
||||
when('/Groups', {
|
||||
templateUrl: '/partial/group-list.html',
|
||||
controller: GroupListController,
|
||||
resolve: GroupListController.resolve
|
||||
}).
|
||||
when('/Group', {
|
||||
templateUrl: '/partial/group-detail.html',
|
||||
controller: GroupController,
|
||||
resolve: GroupController.resolve
|
||||
}).
|
||||
when('/Group/:id', {
|
||||
templateUrl: '/partial/group-detail.html',
|
||||
controller: GroupController,
|
||||
resolve: GroupController.resolve
|
||||
}).
|
||||
|
||||
when('/Clients', {templateUrl: '/partial/client-list.html', controller: ClientListController, resolve: ClientListController.resolve}).
|
||||
when('/Client/:id', {templateUrl: '/partial/client-detail.html', controller: ClientController, resolve: ClientController.resolve}).
|
||||
when('/Clients', {
|
||||
templateUrl: '/partial/client-list.html',
|
||||
controller: ClientListController,
|
||||
resolve: ClientListController.resolve
|
||||
}).
|
||||
when('/Client/:id', {
|
||||
templateUrl: '/partial/client-detail.html',
|
||||
controller: ClientController,
|
||||
resolve: ClientController.resolve
|
||||
}).
|
||||
|
||||
when('/Message', {templateUrl: '/partial/message-detail.html', controller: MessageController, resolve: MessageController.resolve}).
|
||||
when('/Message/:id', {templateUrl: '/partial/message-detail.html', controller: MessageController, resolve: MessageController.resolve}).
|
||||
when('/Message', {
|
||||
templateUrl: '/partial/message-detail.html',
|
||||
controller: MessageController,
|
||||
resolve: MessageController.resolve
|
||||
}).
|
||||
when('/Message/:id', {
|
||||
templateUrl: '/partial/message-detail.html',
|
||||
controller: MessageController,
|
||||
resolve: MessageController.resolve
|
||||
}).
|
||||
|
||||
when('/Settings', {templateUrl: '/partial/settings.html', controller: SettingsController, resolve: SettingsController.resolve}).
|
||||
when('/Settings', {
|
||||
templateUrl: '/partial/settings.html',
|
||||
controller: SettingsController,
|
||||
resolve: SettingsController.resolve
|
||||
}).
|
||||
|
||||
otherwise({templateUrl: '/partial/404.html'});
|
||||
$locationProvider.html5Mode(true).hashPrefix('!');
|
||||
@@ -116,6 +415,14 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
||||
.config(['$httpProvider', function ($httpProvider) {
|
||||
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
}])
|
||||
.config(['$mdDateLocaleProvider', function ($mdDateLocaleProvider) {
|
||||
$mdDateLocaleProvider.formatDate = function (date) {
|
||||
return moment(date).format('DD-MMM-YYYY');
|
||||
};
|
||||
$mdDateLocaleProvider.parseDate = function (date) {
|
||||
return moment(date, 'DD-MMM-YYYY').toDate();
|
||||
};
|
||||
}])
|
||||
.config(['$controllerProvider', function ($controllerProvider) {
|
||||
$controllerProvider.allowGlobals();
|
||||
}])
|
||||
|
||||
@@ -86,7 +86,7 @@ ProductListController.resolve = {
|
||||
}]
|
||||
};
|
||||
|
||||
var ProductController = ['$scope', '$location', '$window', '$modal', 'product', 'productGroups', function ($scope, $location, $window, $modal, product, productGroups) {
|
||||
var ProductController = ['$scope', '$location', '$window', '$mdDialog', 'product', 'productGroups', function ($scope, $location, $window, $mdDialog, product, productGroups) {
|
||||
$scope.product = product;
|
||||
$scope.productGroups = productGroups;
|
||||
|
||||
@@ -108,23 +108,25 @@ var ProductController = ['$scope', '$location', '$window', '$modal', 'product',
|
||||
});
|
||||
};
|
||||
|
||||
$scope.confirm = function () {
|
||||
var modalInstance = $modal.open({
|
||||
backdrop: true,
|
||||
templateUrl: '/template/modal/confirm.html',
|
||||
controller: ['$scope', '$modalInstance', function ($scope, $modalInstance) {
|
||||
$scope.confirm = function (ev) {
|
||||
$mdDialog.show({
|
||||
templateUrl: '/template/modal/confirm-material.html',
|
||||
parent: angular.element(document.body),
|
||||
targetEvent: ev,
|
||||
clickOutsideToClose: false,
|
||||
fullscreen: true,
|
||||
controller: ['$scope', '$mdDialog', function ($scope, $mdDialog) {
|
||||
$scope.title = "Delete Product";
|
||||
$scope.body = "Are you sure? This cannot be undone.";
|
||||
$scope.body = "Are you sure that you want to delete this product? This cannot be undone.";
|
||||
$scope.isDelete = true;
|
||||
$scope.ok = function () {
|
||||
$modalInstance.close();
|
||||
$mdDialog.hide();
|
||||
};
|
||||
$scope.cancel = function () {
|
||||
$modalInstance.dismiss('cancel');
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
}]
|
||||
});
|
||||
modalInstance.result.then(function () {
|
||||
}).then(function () {
|
||||
$scope.delete();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,35 +2,6 @@
|
||||
|
||||
var RecipeListController = ['$scope', 'recipes', function ($scope, recipes) {
|
||||
$scope.info = recipes;
|
||||
$scope.display = $scope.info;
|
||||
$scope.productTypeSelected = 'all';
|
||||
$scope.showLatest = 'latest';
|
||||
$scope.showSummary = 'no';
|
||||
|
||||
$scope.$watch('productTypeSelected', function (value) {
|
||||
$scope.display = $scope.doFilter();
|
||||
}, true);
|
||||
$scope.$watch('showLatest', function (value) {
|
||||
$scope.display = $scope.doFilter();
|
||||
}, true);
|
||||
|
||||
$scope.doFilter = function (q) {
|
||||
return _.filter($scope.info, function (item) {
|
||||
if ($scope.productTypeSelected === 'menu') {
|
||||
if (item.IsSemi) {
|
||||
return false;
|
||||
}
|
||||
} else if ($scope.productTypeSelected === 'semi') {
|
||||
if (!item.IsSemi) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($scope.showLatest === 'latest' && !item.IsLatest) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}];
|
||||
|
||||
RecipeListController.resolve = {
|
||||
@@ -39,11 +10,11 @@ RecipeListController.resolve = {
|
||||
}]
|
||||
};
|
||||
|
||||
var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilter', 'Product', 'recipe', 'productGroups', function ($scope, $location, $window, $modal, asDate, Product, recipe, productGroups) {
|
||||
var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilter', 'Product', 'recipe', function ($scope, $location, $window, $modal, asDate, Product, recipe) {
|
||||
recipe.ValidFrom = moment(recipe.ValidFrom, 'DD-MMM-YYYY').toDate();
|
||||
recipe.ValidTo = moment(recipe.ValidTo, 'DD-MMM-YYYY').toDate();
|
||||
$scope.recipe = recipe;
|
||||
$scope.original = {};
|
||||
angular.copy($scope.recipe, $scope.original);
|
||||
$scope.productGroups = productGroups;
|
||||
|
||||
$scope.costPrice = 0;
|
||||
function getOld(productID, recipeItems) {
|
||||
return _.find(recipeItems, function (recipe_item) {
|
||||
@@ -88,36 +59,16 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
|
||||
}, true);
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.recipe.Date = asDate($scope.recipe.Date);
|
||||
if (angular.isUndefined($scope.recipe.Date) || $scope.recipe.Date === '') {
|
||||
$scope.toasts.push({Type: 'Danger', Message: 'Please Choose a date'});
|
||||
$scope.recipe.ValidFrom = asDate($scope.recipe.ValidFrom);
|
||||
if (angular.isUndefined($scope.recipe.ValidFrom) || $scope.recipe.ValidFrom === '') {
|
||||
$scope.toasts.push({Type: 'Danger', Message: 'Please Choose a proper validity period'});
|
||||
return;
|
||||
}
|
||||
if ($scope.recipe.Date === $scope.original.Date) {
|
||||
var modalInstance = $modal.open({
|
||||
backdrop: true,
|
||||
templateUrl: '/template/modal/confirm.html',
|
||||
controller: ['$scope', '$modalInstance', function ($scope, $modalInstance) {
|
||||
$scope.title = "Update Recipe?";
|
||||
$scope.body = "Are you sure? This will overwrite the original recipe.";
|
||||
$scope.isDelete = false;
|
||||
$scope.ok = function () {
|
||||
$modalInstance.close();
|
||||
};
|
||||
$scope.cancel = function () {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
}]
|
||||
});
|
||||
modalInstance.result.then(function () {
|
||||
$scope.doSave();
|
||||
});
|
||||
} else {
|
||||
$scope.doSave();
|
||||
$scope.recipe.ValidTo = asDate($scope.recipe.ValidTo);
|
||||
if (angular.isUndefined($scope.recipe.ValidTo) || $scope.recipe.ValidTo === '') {
|
||||
$scope.toasts.push({Type: 'Danger', Message: 'Please Choose a proper validity period'});
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.doSave = function () {
|
||||
$scope.recipe.$save(function (u, putResponseHeaders) {
|
||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||
$window.history.back();
|
||||
@@ -157,10 +108,11 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
|
||||
};
|
||||
$scope.foName = true;
|
||||
|
||||
$scope.products = function ($viewValue) {
|
||||
return Product.autocomplete({term: $viewValue, count: 20, a: true, e: true, t: 'S'}).$promise;
|
||||
$scope.products = function ($viewValue, options) {
|
||||
return Product.autocomplete(angular.extend({term: $viewValue, count: 20, a: true, e: true}, options)).$promise;
|
||||
};
|
||||
|
||||
|
||||
}];
|
||||
|
||||
RecipeController.resolve = {
|
||||
@@ -168,8 +120,5 @@ RecipeController.resolve = {
|
||||
var id = $route.current.params.id;
|
||||
|
||||
return Recipe.get({id: id}).$promise;
|
||||
}],
|
||||
productGroups: ['ProductGroup', function (ProductGroup) {
|
||||
return ProductGroup.query({}).$promise;
|
||||
}]
|
||||
};
|
||||
Reference in new issue
Block a user