Fix: Ledger (Alt+R/U) was not working because the $watchGroup does not

do object equality.  Reverted the change.
Fix: Major parts for keyboard navigation were missing.  Added.
Fix: Autocomplete="off" added to major parts
This commit is contained in:
tanshu 2016-04-15 00:02:28 +05:30
parent 9b516fa41c
commit 5b562051e7
11 changed files with 28 additions and 20 deletions

View File

@ -45,7 +45,7 @@
<label for="txtBatch" class="col-md-2 control-label">Product</label>
<div class="col-md-5">
<input type="text" id="txtBatch" class="form-control" ng-model="batch"
<input type="text" id="txtBatch" class="form-control" ng-model="batch" autocomplete="off"
typeahead="batch as batch.Name for batch in batches($viewValue)"
typeahead-editable="false" focus-on="foBatch"/>
</div>

View File

@ -24,7 +24,7 @@
</select>
</div>
<div class="col-md-4">
<input type="text" id="txtAccount" class="form-control" ng-model="account"
<input type="text" id="txtAccount" class="form-control" ng-model="account" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false" on-return="add()" focus-on="foAccount"/>
</div>
@ -86,7 +86,8 @@
<a href ng-click="deleteFile(item)" class="overlay"><i class="glyphicon glyphicon-trash"></i></a>
</div>
<label ng-href for="fileUp">
<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTUwIj48cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjE1MCIgZmlsbD0iI2VlZSIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjUwIiB5PSI3NSIgc3R5bGU9ImZpbGw6I2FhYTtmb250LXdlaWdodDpib2xkO2ZvbnQtc2l6ZToxMDBweDtmb250LWZhbWlseTpBcmlhbCxIZWx2ZXRpY2Esc2Fucy1zZXJpZjtkb21pbmFudC1iYXNlbGluZTpjZW50cmFsIj4rPC90ZXh0Pjwvc3ZnPg==" class="img-thumbnail">
<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTUwIj48cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjE1MCIgZmlsbD0iI2VlZSIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjUwIiB5PSI3NSIgc3R5bGU9ImZpbGw6I2FhYTtmb250LXdlaWdodDpib2xkO2ZvbnQtc2l6ZToxMDBweDtmb250LWZhbWlseTpBcmlhbCxIZWx2ZXRpY2Esc2Fucy1zZXJpZjtkb21pbmFudC1iYXNlbGluZTpjZW50cmFsIj4rPC90ZXh0Pjwvc3ZnPg=="
class="img-thumbnail">
</label>
<input type="file" id="fileUp" file-upload multiple style="display: none;" accept="image/*">
</div>

View File

@ -28,7 +28,7 @@
<div class="col-md-10">
<div class="input-group">
<input type="text" id="txtLedger" class="form-control" ng-model="info.Ledger"
<input type="text" id="txtLedger" class="form-control" ng-model="info.Ledger" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false" on-return="show()" focus-on="foLedger"/>
<span class="input-group-btn">
@ -51,7 +51,8 @@
</tr>
</thead>
<tbody>
<tr id="{{$index}}" ng-repeat="item in ledger" ng-class="{danger:!item.Posted && $index!=selected, warning:$index==selected}"
<tr id="{{$index}}" ng-repeat="item in ledger"
ng-class="{danger:!item.Posted && $index!=selected, warning:$index==selected}"
ng-click="setSelected($index)">
<td class="no-wrap">{{item.Date}}</td>
<td ng-if="!item.Url">{{item.Name}}</td>

View File

@ -28,7 +28,7 @@
<label for="txtAccount" class="col-md-2 control-label">Account</label>
<div class="col-md-6">
<input type="text" id="txtAccount" class="form-control" ng-model="account"
<input type="text" id="txtAccount" class="form-control" ng-model="account" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false" focus-on="foAccount"/>
</div>

View File

@ -15,7 +15,7 @@
</div>
<div class="col-md-6" ng-repeat="journal in voucher.Journals | journalDebit:1">
<div class="input-group">
<input type="text" class="form-control" ng-model="journal.Ledger"
<input type="text" class="form-control" ng-model="journal.Ledger" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false"/><span class="input-group-addon"></span><input type="text"
class="form-control"
@ -28,7 +28,7 @@
<label for="txtBatch" class="col-md-2 control-label">Batch</label>
<div class="col-md-6">
<input type="text" id="txtBatch" class="form-control" ng-model="batch"
<input type="text" id="txtBatch" class="form-control" ng-model="batch" autocomplete="off"
typeahead="batch as batch.Name for batch in batches($viewValue)"
typeahead-editable="false" focus-on="foBatch"/>
</div>

View File

@ -16,7 +16,7 @@
<div class="col-md-6" ng-repeat="journal in voucher.Journals | journalDebit:-1">
<div class="input-group">
<input type="text" class="form-control" ng-model="journal.Ledger"
<input type="text" class="form-control" ng-model="journal.Ledger" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false"/><span class="input-group-addon"></span>
<input type="text" class="form-control" placeholder="Amount" value="{{journal.Amount | number:2}}"/>
@ -27,7 +27,7 @@
<label for="txtProduct" class="col-md-2 control-label">Product</label>
<div class="col-md-4">
<input type="text" id="txtProduct" class="form-control" ng-model="product"
<input type="text" id="txtProduct" class="form-control" ng-model="product" autocomplete="off"
typeahead="product as product.Name for product in products($viewValue)"
typeahead-editable="false" on-return="add()" focus-on="foProduct"/>
</div>

View File

@ -28,7 +28,7 @@
<label for="txtAccount" class="col-md-2 control-label">Account</label>
<div class="col-md-6">
<input type="text" id="txtAccount" class="form-control" ng-model="account"
<input type="text" id="txtAccount" class="form-control" ng-model="account" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false" focus-on="foAccount"/>
</div>

View File

@ -28,7 +28,7 @@
<div class="col-md-10">
<div class="input-group">
<input type="text" id="txtLedger" class="form-control" ng-model="info.Account"
<input type="text" id="txtLedger" class="form-control" ng-model="info.Account" autocomplete="off"
typeahead="account as account.Name for account in accounts($viewValue)"
typeahead-editable="false" on-return="show()" typeahead-min-length="0" focus-on="foLedger"/>
<span class="input-group-btn">
@ -38,7 +38,7 @@
</div>
</div>
</div>
<table class="table table-condensed table-bordered table-striped" focus-on="foGrid">
<table class="table table-condensed table-bordered table-striped" keypress="shortcuts" focus-on="foGrid">
<thead>
<tr>
<th>Date</th>
@ -49,7 +49,7 @@
<th>Reconcile Date</th>
</tr>
</thead>
<tbody ng-repeat="item in body">
<tbody id="{{$index}}" ng-repeat="item in body" ng-click="setSelected($index)">
<tr ng-class="{danger:!item.IsReconciled && $index!=selected, warning:$index==selected}">
<td class="no-wrap">{{item.Date}}</td>
<td><a href="{{item.Url}}">{{item.Name}}</a></td>

View File

@ -35,7 +35,13 @@ var LedgerController = ['$scope', '$routeParams', '$location', 'asDateFilter', '
$scope.selected = index;
};
$scope.$watchGroup(['info', 'hidden'], function () {
$scope.$watch('hidden', function () {
var filtered = $scope.doFilter($scope.hidden, $scope.info.Body);
$scope.ledger = filtered.Body;
$scope.footer = filtered.Footer;
}, true);
$scope.$watch('info', function () {
var filtered = $scope.doFilter($scope.hidden, $scope.info.Body);
$scope.ledger = filtered.Body;
$scope.footer = filtered.Footer;

View File

@ -91,7 +91,7 @@ var ReconcileController = ['$scope', '$routeParams', '$location', 'asDateFilter'
'up': function (e) {
if ($scope.selected > 0) {
$scope.$apply(function () {
$scope.selected = Math.min(Math.max(0, $scope.selected - 1), $scope.ledger.length - 1);
$scope.selected = Math.min(Math.max(0, $scope.selected - 1), $scope.body.length - 1);
});
$("#" + $scope.selected).scrollintoview();
e.preventDefault();
@ -100,14 +100,14 @@ var ReconcileController = ['$scope', '$routeParams', '$location', 'asDateFilter'
'down': function (e) {
if ($scope.selected < $scope.info.Body.length - 1) {
$scope.$apply(function () {
$scope.selected = Math.min(Math.max(0, $scope.selected + 1), $scope.ledger.length - 1);
$scope.selected = Math.min(Math.max(0, $scope.selected + 1), $scope.body.length - 1);
});
$("#" + $scope.selected).scrollintoview();
e.preventDefault();
}
},
'enter': function (e) {
var path = $scope.info.Body[$scope.selected].Url.replace(/^(?:\/\/|[^\/]+)*/, "");
var path = $scope.body[$scope.selected].Url.replace(/^(?:\/\/|[^\/]+)*/, "");
$scope.$apply(function () {
$location.path(path).search('StartDate', null).search('FinishDate', null);
});

View File

@ -107,8 +107,8 @@ def opening_balance(ledgerID, start_date):
else:
debit = opening
credit = 0
return {'Date': start_date, 'ID': 'OB', 'Name': 'Opening Balance', 'Type': 'Opening Balance',
'Narration': '', 'Debit': debit, 'Credit': credit, 'Running': opening, 'Posted': True}
return {'Date': start_date, 'ID': 'OB', 'Name': 'Opening Balance', 'Type': 'Opening Balance', 'Narration': '',
'Debit': debit, 'Credit': credit, 'Running': opening, 'IsReconciled': True, 'ReconcileDate': start_date}
@view_config(request_method='POST', route_name='api_reconcile_id', renderer='json', permission='Reconcile')