Skip to content

Commit

Permalink
fix(vouchers): complex convention tool loads DGs (#164)
Browse files Browse the repository at this point in the history
This commit refactors the complex vouchers convention payment tool to
import all debtor groups -- since the client has no way of setting the
`is_convention` flag.

A minor bug was fixed where the form was not set to `$pristine` after
completing the payment.
  • Loading branch information
jniles authored and sfount committed Jan 19, 2017
1 parent d65b59e commit 089cdc4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions client/src/partials/vouchers/complex.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ function ComplexJournalVoucherController(Vouchers, $translate, Currencies, Sessi
.then(function (result) {
Receipts.voucher(result.uuid, true);
vm.Voucher.clear();
form.$setPristine();
})
.catch(Notify.handleError);
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/partials/vouchers/toolkit/convention_payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function ConventionPaymentKitController(Instance, DebtorGroup, Notify, Cashbox,
.catch(Notify.handleError);

// load conventions
DebtorGroup.read(null, { is_convention: 1})
DebtorGroup.read()
.then(function (list) {
vm.conventionGroupList = list;
})
Expand Down
28 changes: 14 additions & 14 deletions client/src/partials/vouchers/toolkit/convention_payment.modal.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="modal-header">
<ol class="headercrumb">
<li class="static">{{ ToolCtrl.tool.label | translate }}</li>
<li class="title">{{ "VOUCHERS.GLOBAL.IMPORT_TRANSACTION" | translate }}</li>
<li class="static" translate>{{ ToolCtrl.tool.label }}</li>
<li class="title" translate>VOUCHERS.GLOBAL.IMPORT_TRANSACTION</li>
</ol>
</div>

Expand All @@ -12,8 +12,8 @@
<div
class="form-group"
ng-class="{ 'has-error' : ToolForm.$submitted && ToolForm.cashbox.$invalid }">
<label class="control-label">
{{ "FORM.LABELS.CASHBOX" | translate }}
<label class="control-label" translate>
FORM.LABELS.CASHBOX
</label>

<ui-select
Expand All @@ -38,8 +38,8 @@
<div
class="form-group"
ng-class="{ 'has-error' : ToolForm.$submitted && ToolForm.convention.$invalid }">
<label class="control-label">
{{ "FORM.LABELS.CONVENTION" | translate }}
<label class="control-label" translate>
FORM.LABELS.CONVENTION
</label>

<ui-select
Expand Down Expand Up @@ -74,9 +74,9 @@
</div>
</div>

<div ng-show="ToolCtrl.convention" class="test-right">
<span>{{ 'FORM.LABELS.TOTAL_BILLED' | translate }}: <strong class="text-danger">{{ ToolCtrl.totalInvoices || 0 | currency: ToolCtrl.enterprise.currency_id }}</strong></span><br>
<span>{{ 'FORM.LABELS.TOTAL_SELECTED_INVOICES' | translate }}: <strong class="text-success">{{ ToolCtrl.totalSelected || 0 | currency: ToolCtrl.enterprise.currency_id }}</strong></span>
<div ng-show="ToolCtrl.convention" class="text-right">
<span translate>FORM.LABELS.TOTAL_BILLED</span>: <strong class="text-danger">{{ ToolCtrl.totalInvoices || 0 | currency: ToolCtrl.enterprise.currency_id }}</strong><br>
<span translate>FORM.LABELS.TOTAL_SELECTED_INVOICES</span>: <strong class="text-success">{{ ToolCtrl.totalSelected || 0 | currency: ToolCtrl.enterprise.currency_id }}</strong>
</div>
</div>

Expand All @@ -85,13 +85,13 @@
type="button"
class="btn btn-default"
ng-click="ToolCtrl.close()"
data-method="close">
{{ "FORM.BUTTONS.CANCEL" | translate }}
data-method="close"
translate>
FORM.BUTTONS.CANCEL
</button>

<bh-loading-button loading-state="ToolForm.$loading"
disabled="ToolCtrl.$invalid || !ToolCtrl.selectedRows.length">
{{ "FORM.BUTTONS.SUBMIT" | translate }}
<bh-loading-button loading-state="ToolForm.$loading" disabled="ToolCtrl.$invalid || !ToolCtrl.selectedRows.length">
<span translate>FORM.BUTTONS.SUBMIT</span>
</bh-loading-button>
</div>
</form>

0 comments on commit 089cdc4

Please sign in to comment.