+ is-open="sdOpen" ng-focus="sdOpen = true" ng-model="info.StartDate" focus-on="foDate"/>
diff --git a/brewman/static/partial/trial-balance.html b/brewman/static/partial/trial-balance.html
index 6286cc54..101b71b8 100644
--- a/brewman/static/partial/trial-balance.html
+++ b/brewman/static/partial/trial-balance.html
@@ -7,7 +7,7 @@
diff --git a/brewman/static/scripts/account.js b/brewman/static/scripts/account.js
index 1e0858c5..98534cd9 100644
--- a/brewman/static/scripts/account.js
+++ b/brewman/static/scripts/account.js
@@ -120,7 +120,7 @@ var AccountController = ['$scope', '$location', '$modal', 'account', 'accountTyp
$scope.delete();
});
};
- $('#txtName').focus();
+ $scope.foName = true;
}];
AccountController.resolve = {
diff --git a/brewman/static/scripts/angular_directive.js b/brewman/static/scripts/angular_directive.js
index d9a9d36e..5a809e27 100644
--- a/brewman/static/scripts/angular_directive.js
+++ b/brewman/static/scripts/angular_directive.js
@@ -153,7 +153,7 @@ overlordDirective.directive('onReturn', ['$parse', function ($parse) {
overlordDirective.directive('tanSse', ['$parse', function ($parse) {
- return{
+ return {
restrict: 'EM',
link: function ($scope, element, attrs) {
var url = attrs.url,
@@ -371,9 +371,28 @@ overlordDirective.directive('fileUpload', function () {
//iterate files since 'multiple' may be specified on the element
for (var i = 0; i < files.length; i++) {
//emit event upward
- scope.$emit("fileSelected", { file: files[i] });
+ scope.$emit("fileSelected", {file: files[i]});
}
});
}
};
});
+
+overlordDirective.directive('focusOn', ['$timeout', function ($timeout) {
+ return {
+ restrict: 'A',
+ scope: {
+ focusOn: '='
+ },
+ link: function (scope, element, attrs) {
+ scope.$watch('focusOn', function (value) {
+ if (value === true) {
+ //$timeout(function () {
+ element[0].focus();
+ scope.focusOn = false;
+ //});
+ }
+ });
+ }
+ };
+}]);
\ No newline at end of file
diff --git a/brewman/static/scripts/attendance.js b/brewman/static/scripts/attendance.js
index 1ec038cf..c2690ce1 100644
--- a/brewman/static/scripts/attendance.js
+++ b/brewman/static/scripts/attendance.js
@@ -15,7 +15,7 @@ var AttendanceController = ['$scope', '$location', 'asDateFilter', 'Attendance',
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtDate').focus();
+ $scope.foDate = true;
}];
var AttendanceSubController = ['$scope', function ($scope) {
diff --git a/brewman/static/scripts/balance-sheet.js b/brewman/static/scripts/balance-sheet.js
index 9129fc19..56b9cd4d 100644
--- a/brewman/static/scripts/balance-sheet.js
+++ b/brewman/static/scripts/balance-sheet.js
@@ -6,7 +6,7 @@ var BalanceSheetController = ['$scope', '$location', 'asDateFilter', 'info', fun
var date = asDate($scope.info.Date);
$location.path('/BalanceSheet/' + date);
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
BalanceSheetController.resolve = {
diff --git a/brewman/static/scripts/cash-flow.js b/brewman/static/scripts/cash-flow.js
index de89ce58..d2f3fc01 100644
--- a/brewman/static/scripts/cash-flow.js
+++ b/brewman/static/scripts/cash-flow.js
@@ -7,7 +7,7 @@ var CashFlowController = ['$scope', '$routeParams', '$location', 'asDateFilter',
finishDate = asDate($scope.info.FinishDate);
$location.path('/CashFlow').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
CashFlowController.resolve = {
cashFlow: ['$route', 'CashFlow', function ($route, CashFlow) {
diff --git a/brewman/static/scripts/client.js b/brewman/static/scripts/client.js
index 7f56e0e7..372467b5 100644
--- a/brewman/static/scripts/client.js
+++ b/brewman/static/scripts/client.js
@@ -51,7 +51,7 @@ var ClientController = ['$scope', '$location', '$modal', 'client', function ($sc
$scope.delete();
});
};
- $('#txtName').focus();
+ $scope.foName = true;
}];
ClientController.resolve = {
diff --git a/brewman/static/scripts/closing-stock.js b/brewman/static/scripts/closing-stock.js
index c330f896..c6399937 100644
--- a/brewman/static/scripts/closing-stock.js
+++ b/brewman/static/scripts/closing-stock.js
@@ -6,7 +6,7 @@ var ClosingStockController = ['$scope', '$location', 'asDateFilter', 'info', fun
var date = asDate($scope.info.Date);
$location.path('/ClosingStock/' + date);
};
- $('#txtDate').focus();
+ $scope.foDate = true;
}];
ClosingStockController.resolve = {
diff --git a/brewman/static/scripts/cost-center.js b/brewman/static/scripts/cost-center.js
index 312b0b2f..90e4f6ec 100644
--- a/brewman/static/scripts/cost-center.js
+++ b/brewman/static/scripts/cost-center.js
@@ -30,7 +30,7 @@ var CostCenterController = ['$scope', '$routeParams', '$location', 'costCenter',
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtName').focus();
+ $scope.foName = true;
}];
CostCenterController.resolve = {
diff --git a/brewman/static/scripts/daybook.js b/brewman/static/scripts/daybook.js
index ca8d54b3..27a18aef 100644
--- a/brewman/static/scripts/daybook.js
+++ b/brewman/static/scripts/daybook.js
@@ -7,7 +7,7 @@ var DaybookController = ['$scope', '$location', 'asDateFilter', 'info', function
finishDate = asDate($scope.info.FinishDate);
$location.path('/Daybook').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
DaybookController.resolve = {
info: ['$route', 'Daybook', function ($route, Daybook) {
diff --git a/brewman/static/scripts/employee-attendance.js b/brewman/static/scripts/employee-attendance.js
index bcafee03..d6f0d637 100644
--- a/brewman/static/scripts/employee-attendance.js
+++ b/brewman/static/scripts/employee-attendance.js
@@ -28,7 +28,7 @@ var EmployeeAttendanceController = ['$scope', '$location', '$routeParams', 'asDa
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtEmployee').focus();
+ $scope.foEmployee = true;
}];
var EmployeeAttendanceSubController = ['$scope', function ($scope) {
diff --git a/brewman/static/scripts/employee.js b/brewman/static/scripts/employee.js
index 935d0065..3d4d7d94 100644
--- a/brewman/static/scripts/employee.js
+++ b/brewman/static/scripts/employee.js
@@ -124,8 +124,7 @@ var EmployeeController = ['$scope', '$routeParams', '$location', 'asDateFilter',
$scope.delete();
});
};
-
- $('#txtName').focus();
+ $scope.foName = true;
}];
EmployeeController.resolve = {
diff --git a/brewman/static/scripts/group.js b/brewman/static/scripts/group.js
index 5073fb4e..a2bd1be7 100644
--- a/brewman/static/scripts/group.js
+++ b/brewman/static/scripts/group.js
@@ -30,7 +30,7 @@ var GroupController = ['$scope', '$location', 'group', function ($scope, $locati
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtName').focus();
+ $scope.foName = true;
}];
GroupController.resolve = {
diff --git a/brewman/static/scripts/issue.js b/brewman/static/scripts/issue.js
index 1430d083..81be1272 100644
--- a/brewman/static/scripts/issue.js
+++ b/brewman/static/scripts/issue.js
@@ -33,7 +33,7 @@ var IssueController = ['$scope', '$routeParams', '$location', 'asDateFilter', 'v
oldInventory.Quantity += quantity;
delete $scope.batch;
delete $scope.quantity;
- $('#txtBatch').focus();
+ $scope.foBatch = true;
}
if (angular.isUndefined(oldInventory) && (!consumption || quantity <= $scope.batch.QuantityRemaining)) {
@@ -49,7 +49,7 @@ var IssueController = ['$scope', '$routeParams', '$location', 'asDateFilter', 'v
});
delete $scope.batch;
delete $scope.quantity;
- $('#txtBatch').focus();
+ $scope.foBatch = true;
}
};
$scope.removeInventory = function (inventory) {
diff --git a/brewman/static/scripts/journal.js b/brewman/static/scripts/journal.js
index e7a9b39f..7e61c3fc 100644
--- a/brewman/static/scripts/journal.js
+++ b/brewman/static/scripts/journal.js
@@ -1,7 +1,7 @@
'use strict';
var JournalController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'Account', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, Account) {
- $('#txtAccount').focus();
+ $scope.foAccount = true;
$scope.voucher = voucher;
$scope.debit = 1;
@@ -53,7 +53,7 @@ var JournalController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploa
}
delete $scope.account;
delete $scope.amount;
- $('#txtAccount').focus();
+ $scope.foAccount = true;
};
$scope.removeJournal = function (journal) {
diff --git a/brewman/static/scripts/ledger.js b/brewman/static/scripts/ledger.js
index 765255ad..7ae22923 100644
--- a/brewman/static/scripts/ledger.js
+++ b/brewman/static/scripts/ledger.js
@@ -25,9 +25,9 @@ var LedgerController = ['$scope', '$routeParams', '$location', 'asDateFilter', '
};
if ($routeParams.id) {
- $('#gvGrid').focus();
+ $scope.foGrid = true;
} else {
- $('#txtLedger').focus();
+ $scope.foLedger = true;
}
$scope.selected = -1;
diff --git a/brewman/static/scripts/login.js b/brewman/static/scripts/login.js
index 2b95bf48..8d40df29 100644
--- a/brewman/static/scripts/login.js
+++ b/brewman/static/scripts/login.js
@@ -29,7 +29,7 @@ var LoginController = ['$scope', '$http', '$location', '$routeParams', '$cookieS
$scope.toasts.push({Type: 'Danger', Message: data});
});
};
- $('#username').focus();
+ $scope.foUsername = true;
}];
var LogoutController = ['$scope', '$http', '$location', function ($scope, $http, $location) {
diff --git a/brewman/static/scripts/message.js b/brewman/static/scripts/message.js
index 839da4a4..0145e83f 100644
--- a/brewman/static/scripts/message.js
+++ b/brewman/static/scripts/message.js
@@ -33,7 +33,7 @@ var MessageController = ['$scope', '$location', 'asDateFilter', 'message', 'tags
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtTitle').focus();
+ $scope.foTitle = true;
}];
MessageController.resolve = {
diff --git a/brewman/static/scripts/net-transactions.js b/brewman/static/scripts/net-transactions.js
index 1fed5ef4..60c9a776 100644
--- a/brewman/static/scripts/net-transactions.js
+++ b/brewman/static/scripts/net-transactions.js
@@ -7,7 +7,7 @@ var NetTransactionsController = ['$scope', '$location', 'asDateFilter', 'netTran
finishDate = asDate($scope.info.FinishDate);
$location.path('/NetTransactions').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
NetTransactionsController.resolve = {
diff --git a/brewman/static/scripts/payment.js b/brewman/static/scripts/payment.js
index 61e9a0f1..ac3b52a8 100644
--- a/brewman/static/scripts/payment.js
+++ b/brewman/static/scripts/payment.js
@@ -1,7 +1,7 @@
'use strict';
var PaymentController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'ledgers', 'Account', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, ledgers, Account) {
- $('#txtAccount').focus();
+ $scope.foAccount = true;
$scope.voucher = voucher;
$scope.ledgers = ledgers;
@@ -50,7 +50,7 @@ var PaymentController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploa
}
delete $scope.account;
delete $scope.amount;
- $('#txtAccount').focus();
+ $scope.foAccount = true;
};
$scope.removeJournal = function (journal) {
diff --git a/brewman/static/scripts/product-group.js b/brewman/static/scripts/product-group.js
index d71a2b89..e9a67f08 100644
--- a/brewman/static/scripts/product-group.js
+++ b/brewman/static/scripts/product-group.js
@@ -30,7 +30,7 @@ var ProductGroupController = ['$scope', '$location', 'productGroup', function ($
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtName').focus();
+ $scope.foName = true;
}];
ProductGroupController.resolve = {
diff --git a/brewman/static/scripts/product-ledger.js b/brewman/static/scripts/product-ledger.js
index b4f03fc2..81141920 100644
--- a/brewman/static/scripts/product-ledger.js
+++ b/brewman/static/scripts/product-ledger.js
@@ -24,8 +24,7 @@ var ProductLedgerController = ['$scope', '$routeParams', '$location', 'asDateFil
$scope.products = function ($viewValue) {
return Product.autocomplete({term: $viewValue, count: 20}).$promise;
};
-
- $('#txtProduct').focus();
+ $scope.foProduct = true;
}];
ProductLedgerController.resolve = {
productLedger: ['$route', 'ProductLedger', function ($route, ProductLedger) {
diff --git a/brewman/static/scripts/product.js b/brewman/static/scripts/product.js
index dd981dc5..d2f7f839 100644
--- a/brewman/static/scripts/product.js
+++ b/brewman/static/scripts/product.js
@@ -128,8 +128,7 @@ var ProductController = ['$scope', '$location', '$window', '$modal', 'product',
$scope.delete();
});
};
-
- $('#txtName').focus();
+ $scope.foName = true;
}];
ProductController.resolve = {
diff --git a/brewman/static/scripts/profit-loss.js b/brewman/static/scripts/profit-loss.js
index bcd6cd86..ca99085b 100644
--- a/brewman/static/scripts/profit-loss.js
+++ b/brewman/static/scripts/profit-loss.js
@@ -7,7 +7,7 @@ var ProfitLossController = ['$scope', '$location', 'asDateFilter', 'profit_loss'
finishDate = asDate($scope.info.FinishDate);
$location.path('/ProfitLoss').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
ProfitLossController.resolve = {
diff --git a/brewman/static/scripts/purchase-entries.js b/brewman/static/scripts/purchase-entries.js
index 2162f0d4..c186aaae 100644
--- a/brewman/static/scripts/purchase-entries.js
+++ b/brewman/static/scripts/purchase-entries.js
@@ -8,7 +8,7 @@ var PurchaseEntriesController = ['$scope', '$location', 'asDateFilter', 'purchas
finishDate = asDate($scope.info.FinishDate);
$location.path('/PurchaseEntries').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
PurchaseEntriesController.resolve = {
diff --git a/brewman/static/scripts/purchase-return.js b/brewman/static/scripts/purchase-return.js
index 979e92f1..e159fbed 100644
--- a/brewman/static/scripts/purchase-return.js
+++ b/brewman/static/scripts/purchase-return.js
@@ -53,8 +53,7 @@ var PurchaseReturnController = ['$scope', '$location', 'asDateFilter', '$modal',
});
delete $scope.batch;
delete $scope.quantity;
- $('#txtBatch').val('');
- $('#txtBatch').focus();
+ $scope.foBatch = true;
}
};
$scope.removeInventory = function (inventory) {
diff --git a/brewman/static/scripts/purchase.js b/brewman/static/scripts/purchase.js
index b7ffcd40..55917015 100644
--- a/brewman/static/scripts/purchase.js
+++ b/brewman/static/scripts/purchase.js
@@ -56,7 +56,7 @@ var PurchaseController = ['$scope', '$location', 'asDateFilter', '$modal', 'uplo
delete $scope.quantity;
delete $scope.tax;
delete $scope.discount;
- $('#txtProduct').focus();
+ $scope.foProduct = true;
}
};
$scope.removeInventory = function (inventory) {
diff --git a/brewman/static/scripts/raw-material-cost.js b/brewman/static/scripts/raw-material-cost.js
index 592c2a73..6d273c61 100644
--- a/brewman/static/scripts/raw-material-cost.js
+++ b/brewman/static/scripts/raw-material-cost.js
@@ -7,7 +7,7 @@ var RawMaterialCostController = ['$scope', '$location', 'asDateFilter', 'rawMate
finishDate = asDate($scope.info.FinishDate);
$location.path('/RawMaterialCost').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
RawMaterialCostController.resolve = {
diff --git a/brewman/static/scripts/receipt.js b/brewman/static/scripts/receipt.js
index 1ef2d0b3..790897c4 100644
--- a/brewman/static/scripts/receipt.js
+++ b/brewman/static/scripts/receipt.js
@@ -1,8 +1,7 @@
'use strict';
var ReceiptController = ['$scope', '$routeParams', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'ledgers', 'Voucher', 'Account', function ($scope, $routeParams, $location, asDate, $modal, uploadedImageResizer, voucher, ledgers, Voucher, Account) {
- $('#txtAccount').focus();
-
+ $scope.foAccount = true;
$scope.voucher = voucher;
$scope.ledgers = ledgers;
function getOld(ledgerID, journals) {
@@ -50,7 +49,7 @@ var ReceiptController = ['$scope', '$routeParams', '$location', 'asDateFilter',
}
delete $scope.account;
delete $scope.amount;
- $('#txtAccount').focus();
+ $scope.foAccount = true;
};
$scope.removeJournal = function (journal) {
diff --git a/brewman/static/scripts/recipe.js b/brewman/static/scripts/recipe.js
index c870a42d..8715c081 100644
--- a/brewman/static/scripts/recipe.js
+++ b/brewman/static/scripts/recipe.js
@@ -69,7 +69,7 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
}
delete $scope.quantity;
delete $scope.product;
- $('#txtProduct').focus();
+ $scope.foProduct = true;
};
$scope.removeItem = function (item) {
@@ -155,7 +155,7 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
$scope.delete();
});
};
- $('#txtName').focus();
+ $scope.foName = true;
$scope.products = function ($viewValue) {
return Product.autocomplete({term: $viewValue, count: 20, a: true, e: true, t: 'S'}).$promise;
diff --git a/brewman/static/scripts/reconcile.js b/brewman/static/scripts/reconcile.js
index 5026c3c1..3fc98a7a 100644
--- a/brewman/static/scripts/reconcile.js
+++ b/brewman/static/scripts/reconcile.js
@@ -36,9 +36,9 @@ var ReconcileController = ['$scope', '$routeParams', '$location', 'asDateFilter'
};
if ($routeParams.id) {
- $('#gvGrid').focus();
+ $scope.foGrid = true;
} else {
- $('#txtLedger').focus();
+ $scope.foLedger = true;
}
$scope.selected = -1;
diff --git a/brewman/static/scripts/salary-deduction.js b/brewman/static/scripts/salary-deduction.js
index 6c754b6a..d63427c9 100644
--- a/brewman/static/scripts/salary-deduction.js
+++ b/brewman/static/scripts/salary-deduction.js
@@ -79,7 +79,7 @@ var SalaryDeductionController = ['$scope', '$location', 'asDateFilter', '$modal'
delete $scope.employee;
delete $scope.grossSalary;
delete $scope.daysWorked;
- $('#txtEmployee').focus();
+ $scope.foEmployee = true;
};
$scope.remove = function (deduction) {
diff --git a/brewman/static/scripts/stock-movement.js b/brewman/static/scripts/stock-movement.js
index bc25938b..a2c56683 100644
--- a/brewman/static/scripts/stock-movement.js
+++ b/brewman/static/scripts/stock-movement.js
@@ -7,7 +7,7 @@ var StockMovementController = ['$scope', '$location', 'asDateFilter', 'stockMove
finishDate = asDate($scope.info.FinishDate);
$location.path('/StockMovement').search({StartDate: startDate, FinishDate: finishDate});
};
- $('#txtStartDate').focus();
+ $scope.foDate = true;
}];
StockMovementController.resolve = {
diff --git a/brewman/static/scripts/trial-balance.js b/brewman/static/scripts/trial-balance.js
index 655c5dd2..4c6b7cc5 100644
--- a/brewman/static/scripts/trial-balance.js
+++ b/brewman/static/scripts/trial-balance.js
@@ -5,7 +5,7 @@ var TrialBalanceController = ['$scope', '$location', 'asDateFilter', 'trialBalan
$scope.show = function () {
$location.path('/TrialBalance/' + asDate($scope.info.Date));
};
- $('#txtDate').focus();
+ $scope.foDate = true;
}];
TrialBalanceController.resolve = {
trialBalance: ['$route', 'TrialBalance', function ($route, TrialBalance) {
diff --git a/brewman/static/scripts/user.js b/brewman/static/scripts/user.js
index 1905ccf6..641108b2 100644
--- a/brewman/static/scripts/user.js
+++ b/brewman/static/scripts/user.js
@@ -30,7 +30,7 @@ var UserController = ['$scope', '$location', 'user', function ($scope, $location
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
- $('#txtName').focus();
+ $scope.foName = true;
}];
UserController.resolve = {