-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(VoucherForm): Service-powered voucher grid
This commit implements modular validation for the complex journal vouchers page by creating a VoucherFormService and a VoucherFormItemService similar to the PatientInvoice services. These services are charged with validating the VoucherForm and items, respectively. The following errors are caught by the item-level validation: 1. Negative Values 2. Values of too small precision 3. Missing account_id The following errors are caught by the form-level validation: 1. Imbalanced totals 2. Missing (and required) transaction type: 3. Missing metadata These allows fine-grained control over the error states of the module. Errors for particular lines are displayed in the status column next to the row on a mouse hover. There are still some TODOs: 1. The import tool hasn't been updated to work with the vouchers properly. 2. The create() method now needs to clean up all unused properties before submitting to the server. 3. Error messages should be centralized and translated for better error handling.
- Loading branch information
Jonathan Niles
committed
Dec 22, 2016
1 parent
7c7720a
commit 00cae5b
Showing
20 changed files
with
683 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
<div class="modal-header"> | ||
<ol class="headercrumb"> | ||
<li class="static">{{ ReportConfigCtrl.report.title_key | translate }}</li> | ||
<li class="title">{{ "FORM.LABELS.CREATE" | translate }}</li> | ||
<li class="title"> | ||
{{ ReportConfigCtrl.report.title_key | translate }} | ||
<span class="badge badge-success text-uppercase">{{ "FORM.LABELS.CREATE" | translate }}</span> | ||
</li> | ||
</ol> | ||
</div> | ||
|
||
<form name="ConfigForm" bh-submit="ReportConfigCtrl.generate()" bh-form-defaults novalidate> | ||
<div class="modal-body"> | ||
<div class="form-group" | ||
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.label.$invalid }"> | ||
<label class="control-label">{{ "FORM.LABELS.LABEL" | translate }}</label> | ||
<input class="form-control" id="label" name="label" ng-model="ReportConfigCtrl.label" autocomplete="off" required /> | ||
<form name="ConfigForm" bh-submit="ReportConfigCtrl.generate(ConfigForm)" bh-form-defaults novalidate> | ||
<div class="modal-body"> | ||
|
||
<div class="help-block" ng-messages="ConfigForm.label.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="partials/templates/messages.tmpl.html"></div> | ||
</div> | ||
<div class="form-group" | ||
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.label.$invalid }"> | ||
<label class="control-label">{{ "FORM.LABELS.LABEL" | translate }}</label> | ||
<input class="form-control" id="label" name="label" ng-model="ReportConfigCtrl.label" autocomplete="off" required /> | ||
|
||
</div> | ||
<!-- Date interval --> | ||
<bh-date-interval | ||
date-from="ReportConfigCtrl.dateFrom" | ||
date-to="ReportConfigCtrl.dateTo"> | ||
</bh-date-interval> | ||
<div class="help-block" ng-messages="ConfigForm.label.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="partials/templates/messages.tmpl.html"></div> | ||
</div> | ||
</div> | ||
|
||
<!-- by week --> | ||
<div class="form-group"> | ||
<label class="text-action"> | ||
<input type="checkbox" name="weekly" ng-model="ReportConfigCtrl.weekly" ng-true-value="1" ng-false-value="0"> | ||
{{ 'FORM.LABELS.WEEKLY_REPORT' | translate }} | ||
</label> | ||
</div> | ||
<!-- date interval --> | ||
<bh-date-interval | ||
date-from="ReportConfigCtrl.dateFrom" | ||
date-to="ReportConfigCtrl.dateTo" | ||
required="true"> | ||
</bh-date-interval> | ||
|
||
<!-- by week --> | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" name="weekly" ng-model="ReportConfigCtrl.weekly" ng-true-value="1" ng-false-value="0"> | ||
{{ 'FORM.LABELS.WEEKLY_REPORT' | translate }} | ||
</label> | ||
</div> | ||
|
||
<!-- cashbox selection --> | ||
<div class="form-group" | ||
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.cashbox.$invalid }"> | ||
<label class="control-label"> | ||
<span class="fa fa-briefcase"></span> {{ 'FORM.SELECT.CASHBOX' | translate }} | ||
</label> | ||
<select | ||
class="form-control" | ||
name="cashbox" | ||
ng-model="ReportConfigCtrl.cashbox" | ||
ng-options="cash as cash.hrlabel for cash in ReportConfigCtrl.cashboxes" | ||
required> | ||
<option value="" disabled>-- {{ 'FORM.SELECT.CASHBOX' | translate }} --</option> | ||
</select> | ||
<div class="help-block" ng-messages="ConfigForm.cashbox.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="partials/templates/messages.tmpl.html"></div> | ||
<!-- cashbox selection --> | ||
<div class="form-group" | ||
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.cashbox.$invalid }"> | ||
<label class="control-label"> | ||
<span class="fa fa-briefcase"></span> {{ 'FORM.SELECT.CASHBOX' | translate }} | ||
</label> | ||
<select | ||
class="form-control" | ||
name="cashbox" | ||
ng-model="ReportConfigCtrl.cashbox" | ||
ng-options="cash as cash.hrlabel for cash in ReportConfigCtrl.cashboxes track by cash.id" | ||
required> | ||
<option value="" disabled>{{ 'FORM.SELECT.CASHBOX' | translate }}</option> | ||
</select> | ||
<div class="help-block" ng-messages="ConfigForm.cashbox.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="partials/templates/messages.tmpl.html"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button | ||
type="button" | ||
class="btn btn-default" | ||
ng-click="ReportConfigCtrl.cancel()" | ||
data-method="cancel"> | ||
{{ "FORM.BUTTONS.CANCEL" | translate }} | ||
</button> | ||
<div class="modal-footer"> | ||
<button | ||
type="button" | ||
class="btn btn-default" | ||
ng-click="ReportConfigCtrl.cancel()" | ||
data-method="cancel"> | ||
{{ "FORM.BUTTONS.CANCEL" | translate }} | ||
</button> | ||
|
||
<!-- <div data-submit-area> --> | ||
<bh-loading-button loading-state="ReportConfigCtrl.$loading" | ||
ng-disabled="ConfigForm.$invalid"> | ||
<bh-loading-button loading-state="ConfigForm.$loading"> | ||
{{ "FORM.BUTTONS.GENERATE" | translate }} | ||
</bh-loading-button> | ||
<!-- </div> --> | ||
</div> | ||
</div> | ||
</form> |
Oops, something went wrong.