Skip to content

Commit

Permalink
fix(integration): Fix integration test and correct the client side typo
Browse files Browse the repository at this point in the history
  • Loading branch information
DedrickEnc committed Dec 11, 2017
1 parent dceff3a commit 8336d40
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 148 deletions.
2 changes: 0 additions & 2 deletions client/src/modules/invoicing-fees/desktop.ini

This file was deleted.

16 changes: 8 additions & 8 deletions client/src/modules/invoicing-fees/invoicing-fees-create.ctrl.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
angular.module('bhima.controllers')
.controller('BillingServicesCreateController', BillingServicesCreateController);
.controller('InvoicingFeesCreateController', InvoicingFeesCreateController);

BillingServicesCreateController.$inject = [
'BillingServicesService', '$uibModalInstance', 'util',
InvoicingFeesCreateController.$inject = [
'InvoicingFeesService', '$uibModalInstance', 'util',
];

/**
* Billing Services Create Controller
* Invoicing Fees Create Controller
*
* This controller allows the user to create a new billing service using a form.
* This controller allows the user to create a new invoicing fees using a form.
* Note that this uses the same HTML form as the update controller
*/
function BillingServicesCreateController(BillingServices, ModalInstance, util) {
function InvoicingFeesCreateController(InvoicingFees, ModalInstance, util) {
var vm = this;

// the form title is defined in the JS to allow us to reuse templates
Expand All @@ -38,7 +38,7 @@ function BillingServicesCreateController(BillingServices, ModalInstance, util) {
* validation, the function will immediately exit.
*
* @param {Object} form - the CreateForm object
* @returns {Promise} promise - the $http promise from the BillingServiceService's
* @returns {Promise} promise - the $http promise from the InvoicingFeeservice's
* create() method
*/
function submit(form) {
Expand All @@ -52,7 +52,7 @@ function BillingServicesCreateController(BillingServices, ModalInstance, util) {
}

// submit data to the server
return BillingServices.create(vm.model)
return InvoicingFees.create(vm.model)
.then(function (data) {
ModalInstance.close(data.id);
})
Expand Down
16 changes: 8 additions & 8 deletions client/src/modules/invoicing-fees/invoicing-fees-delete.ctrl.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
angular.module('bhima.controllers')
.controller('BillingServicesDeleteController', BillingServicesDeleteController);
.controller('InvoicingFeesDeleteController', InvoicingFeesDeleteController);

BillingServicesDeleteController.$inject = [
'$state', '$uibModalInstance', 'BillingServicesService'
InvoicingFeesDeleteController.$inject = [
'$state', '$uibModalInstance', 'InvoicingFeesService'
];

/**
* Billing Services Delete Controller
* invoicing fees Delete Controller
*
* This is a super simple controller to ensure that errors are properly handled
* and translated on the billing services modal. It leverages the shared
* and translated on the invoicing fees modal. It leverages the shared
* ConfirmModal template.
*
* This controller is instantiated in a modal.
*/
function BillingServicesDeleteController($state, Instance, BillingServices) {
function InvoicingFeesDeleteController($state, Instance, InvoicingFees) {
var vm = this;

// bind methods to the view
Expand All @@ -27,8 +27,8 @@ function BillingServicesDeleteController($state, Instance, BillingServices) {
// clear the error, if it exists
delete vm.error;

// attempt to delete the billing service
return BillingServices.delete($state.params.id)
// attempt to delete the invoicing fee
return InvoicingFees.delete($state.params.id)
.then(function () {
// if successful, close the modal instance
Instance.close();
Expand Down
50 changes: 25 additions & 25 deletions client/src/modules/invoicing-fees/invoicing-fees-modal.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<!-- billing service form -->
<form name="BillingServicesForm" bh-submit="BillingServicesFormCtrl.submit(BillingServicesForm)" novalidate>
<!-- invoicing fee form -->
<form name="InvoicingFeesForm" bh-submit="InvoicingFeesFormCtrl.submit(InvoicingFeesForm)" novalidate>

<div class="modal-header">
<ol class="headercrumb">
<li class="static" translate>TREE.INVOICING_FEES</li>
<li class="title" translate>{{ BillingServicesFormCtrl.title }}</li>
<li class="title" translate>{{ InvoicingFeesFormCtrl.title }}</li>
</div>
</div>

<div class="modal-body">

<!-- account input -->
<bh-account-select
account-id="BillingServicesFormCtrl.model.account_id"
on-select-callback="BillingServicesFormCtrl.onSelectAccount(account)"
account-id="InvoicingFeesFormCtrl.model.account_id"
on-select-callback="InvoicingFeesFormCtrl.onSelectAccount(account)"
exclude-title-accounts="true"
required="true">
</bh-account-select>

<!-- label input -->
<div class="form-group" ng-class="{ 'has-error' : BillingServicesForm.$submitted && BillingServicesForm.label.$invalid }">
<div class="form-group" ng-class="{ 'has-error' : InvoicingFeesForm.$submitted && InvoicingFeesForm.label.$invalid }">
<label class="control-label" translate>
FORM.LABELS.LABEL
</label>
<input
class="form-control"
name="label"
autocomplete="off"
ng-model="BillingServicesFormCtrl.model.label"
ng-maxlength="BillingServicesFormCtrl.length200"
ng-model="InvoicingFeesFormCtrl.model.label"
ng-maxlength="InvoicingFeesFormCtrl.length200"
required>
<div class="help-block" ng-messages="BillingServicesForm.label.$error" ng-show="BillingServicesForm.$submitted">
<div class="help-block" ng-messages="InvoicingFeesForm.label.$error" ng-show="InvoicingFeesForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>

<!-- description textarea -->
<div class="form-group" ng-class="{ 'has-error' : BillingServicesForm.$submitted && BillingServicesForm.description.$invalid }">
<div class="form-group" ng-class="{ 'has-error' : InvoicingFeesForm.$submitted && InvoicingFeesForm.description.$invalid }">
<label class="control-label" translate>
FORM.LABELS.DESCRIPTION
</label>
Expand All @@ -47,18 +47,18 @@
style="resize:vertical;"
class="form-control"
name="description"
ng-model="BillingServicesFormCtrl.model.description"
ng-model="InvoicingFeesFormCtrl.model.description"
placeholder="{{ 'FORM.PLACEHOLDERS.DESCRIPTION' | translate }}"
ng-maxlength="BillingServicesFormCtrl.maxLength"
ng-maxlength="InvoicingFeesFormCtrl.maxLength"
required>
</textarea>
<div class="help-block" ng-messages="BillingServicesForm.description.$error" ng-show="BillingServicesForm.$submitted">
<div class="help-block" ng-messages="InvoicingFeesForm.description.$error" ng-show="InvoicingFeesForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>

<!-- value input -->
<div class="form-group" ng-class="{ 'has-error' : BillingServicesForm.$submitted && BillingServicesForm.value.$invalid }">
<div class="form-group" ng-class="{ 'has-error' : InvoicingFeesForm.$submitted && InvoicingFeesForm.value.$invalid }">
<label class="control-label">
<span translate>FORM.LABELS.VALUE</span> (%)
</label>
Expand All @@ -67,10 +67,10 @@
class="form-control"
name="value"
autocomplete="off"
ng-model="BillingServicesFormCtrl.model.value"
ng-model="InvoicingFeesFormCtrl.model.value"
ng-min="0"
required>
<div class="help-block" ng-messages="BillingServicesForm.value.$error" ng-show="BillingServicesForm.$submitted">
<div class="help-block" ng-messages="InvoicingFeesForm.value.$error" ng-show="InvoicingFeesForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>
Expand All @@ -79,37 +79,37 @@
<div
class="form-group"
ng-class="{
'has-error' : (BillingServicesForm.$submitted && BillingServicesForm.$invalid) || BillingServicesFormCtrl.error,
'has-success' : BillingServicesFormCtrl.created || BillingServicesFormCtrl.updated
'has-error' : (InvoicingFeesForm.$submitted && InvoicingFeesForm.$invalid) || InvoicingFeesFormCtrl.error,
'has-success' : InvoicingFeesFormCtrl.created || InvoicingFeesFormCtrl.updated
}">

<div class="help-block">

<!-- there are (client-side) errors on the form -->
<p ng-show="BillingServicesForm.$submitted && BillingServicesForm.$invalid">
<p ng-show="InvoicingFeesForm.$submitted && InvoicingFeesForm.$invalid">
<span class="glyphicon glyphicon-alert"></span> <span translate>FORM.ERRORS.HAS_ERRORS</span>
</p>

<!-- show http errors sent from the server -->
<p ng-show="BillingServicesFormCtrl.error">
<p ng-show="InvoicingFeesFormCtrl.error">
<span class="glyphicon glyphicon-alert"></span>
<span ng-show="BillingServicesFormCtrl.error.status === 404" translate>
<span ng-show="InvoicingFeesFormCtrl.error.status === 404" translate>
INVOICING_FEES.NOT_FOUND
</span>
<span ng-hide="BillingServicesFormCtrl.error.status === 404" translate>
{{ BillingServicesFormCtrl.error.code }}
<span ng-hide="InvoicingFeesFormCtrl.error.status === 404" translate>
{{ InvoicingFeesFormCtrl.error.code }}
</span>
</p>
</div>
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-default" data-method="back" ng-click="BillingServicesFormCtrl.dismiss()" translate>
<button type="button" class="btn btn-default" data-method="back" ng-click="InvoicingFeesFormCtrl.dismiss()" translate>
FORM.BUTTONS.BACK
</button>

<bh-loading-button loading-state="BillingServicesForm.$loading">
<bh-loading-button loading-state="InvoicingFeesForm.$loading">
<span translate>FORM.BUTTONS.SUBMIT</span>
</bh-loading-button>
</div>
Expand Down
26 changes: 13 additions & 13 deletions client/src/modules/invoicing-fees/invoicing-fees-update.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ angular.module('bhima.controllers')
.controller('InvoicingFeesUpdateController', InvoicingFeesUpdateController);

InvoicingFeesUpdateController.$inject = [
'$state', 'BillingServicesService', '$uibModalInstance', 'util', 'appcache'
'$state', 'InvoicingFeesService', '$uibModalInstance', 'util', 'appcache'
];

/**
* Updates a billing service passed in via a URL parameter. For example,
* invoicingFees/1 will update the billing service with id 1.
* Updates a invoicing fee passed in via a URL parameter. For example,
* invoicingFees/1 will update the invoicing fee with id 1.
*
* Importantly, both this controller and the InvoicingFeesUpdateController
* use the same template, billing-services/form.html.
* use the same template, invoicing-fees/form.html.
*/
function InvoicingFeesUpdateController($state, BillingServices, ModalInstance, util, AppCache) {
function InvoicingFeesUpdateController($state, InvoicingFees, ModalInstance, util, AppCache) {
var vm = this;
var cache = AppCache('BillingServices');
var cache = AppCache('InvoicingFees');

if($state.params.id){
vm.stateParams = cache.stateParams = $state.params;
Expand All @@ -25,10 +25,10 @@ function InvoicingFeesUpdateController($state, BillingServices, ModalInstance, u
// the form title is defined in the JS to allow us to reuse templates
vm.title = 'INVOICING_FEES.FORM.UPDATE';

// the label will contain a copy of the billing service's label we are updating
// the label will contain a copy of the invoicing fee's label we are updating
vm.label = '';

// this is the BillingServicesForm's model
// this is the InvoicingFeesForm's model
vm.model = {};

// the submit method to POST data to the server
Expand All @@ -48,8 +48,8 @@ function InvoicingFeesUpdateController($state, BillingServices, ModalInstance, u
// fired on application startup
function startup() {

// load the billing service by id
BillingServices.read(vm.stateParams.id)
// load the invoicing fee by id
InvoicingFees.read(vm.stateParams.id)
.then(function (service) {

// set the label to the label of the fetched service
Expand All @@ -67,8 +67,8 @@ function InvoicingFeesUpdateController($state, BillingServices, ModalInstance, u
* submits the form to the server. If the form does not pass angular form
* validation, the function will immediately exit.
*
* @param {Object} form - the BillingServicesForm object
* @returns {Promise} promise - the $http promise from the BillingServiceService's
* @param {Object} form - the InvoicingFeesForm object
* @returns {Promise} promise - the $http promise from the InvoicingFeeService's
* update() method
*/
function submit(form) {
Expand All @@ -82,7 +82,7 @@ function InvoicingFeesUpdateController($state, BillingServices, ModalInstance, u
}

// submit data to the server
return BillingServices.update(vm.stateParams.id, vm.model)
return InvoicingFees.update(vm.stateParams.id, vm.model)
.then(function (data) {
ModalInstance.close(data.id);
})
Expand Down
26 changes: 13 additions & 13 deletions client/src/modules/invoicing-fees/invoicing-fees.ctrl.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
angular.module('bhima.controllers')
.controller('BillingServicesController', BillingServicesController);
.controller('InvoicingFeesController', InvoicingFeesController);

BillingServicesController.$inject = [
'$state', 'BillingServicesService', 'NotifyService', 'bhConstants', '$timeout', 'uiGridConstants',
InvoicingFeesController.$inject = [
'$state', 'InvoicingFeesService', 'NotifyService', 'bhConstants', '$timeout', 'uiGridConstants',
];

/**
* The Billing Services Controller
* The invoicing fees Controller
*
* This is the default controller for the billing services URL endpoint. It
* downloads and displays all billing services in the application via a ui-grid.
* This is the default controller for the invoicing fees URL endpoint. It
* downloads and displays all invoicing fees in the application via a ui-grid.
*/
function BillingServicesController($state, BillingServices, Notify, bhConstants, $timeout, uiGridConstants) {
function InvoicingFeesController($state, InvoicingServices, Notify, bhConstants, $timeout, uiGridConstants) {
var vm = this;

var actionTemplate =
'modules/billing-services/templates/action.cell.html';
'modules/invoicing-fees/templates/action.cell.html';

var columns;

Expand Down Expand Up @@ -103,19 +103,19 @@ function BillingServicesController($state, BillingServices, Notify, bhConstants,
function startup() {
toggleLoadingIndicator();

// retrieve a detailed list of the billing services in the application
BillingServices.read(null, { detailed : 1 })
.then(function (billingServices) {
// retrieve a detailed list of the invoicing fees in the application
InvoicingServices.read(null, { detailed : 1 })
.then(function (invoicingServices) {

// make a pretty human readable account label
// TODO(@jniles) - make this use the account_label. Requires changing
// the server
billingServices.forEach(function (service) {
invoicingServices.forEach(function (service) {
service.account = service.number;
});

// populate the grid
vm.options.data = billingServices;
vm.options.data = invoicingServices;

// scroll to the indicated id in the grid an id was passed in
if ($state.params.id) {
Expand Down
16 changes: 8 additions & 8 deletions client/src/modules/invoicing-fees/invoicing-fees.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="toolbar-item">
<a class="btn btn-default text-capitalize"
data-method="create"
ui-sref="billingServices.create"
ui-sref="invoicingFees.create"
ui-sref-opts="{notify:false}">
<span class="fa fa-plus"></span> <span translate>INVOICING_FEES.BTN.CREATE</span>
</a>
Expand All @@ -18,10 +18,10 @@
<div class="toolbar-item">
<button
type="button"
ng-click="BillingServicesCtrl.toggleFilter()"
ng-click="InvoicingFeesCtrl.toggleFilter()"
data-method="filter"
class="btn btn-default"
ng-class="{ 'btn-info' : BillingServicesCtrl.filterEnabled }">
ng-class="{ 'btn-info' : InvoicingFeesCtrl.filterEnabled }">
<i class="fa fa-filter"></i>
</button>
</div>
Expand All @@ -35,14 +35,14 @@
<div class="container-fluid">
<div
class="grid-full-height"
id="BillingServicesGrid"
ui-grid="BillingServicesCtrl.options"
id="InvoicingFeesGrid"
ui-grid="InvoicingFeesCtrl.options"
ui-grid-auto-resize>

<bh-grid-loading-indicator
loading-state="BillingServicesCtrl.loading"
empty-state="BillingServicesCtrl.options.data.length === 0"
error-state="BillingServicesCtrl.hasError">
loading-state="InvoicingFeesCtrl.loading"
empty-state="InvoicingFeesCtrl.options.data.length === 0"
error-state="InvoicingFeesCtrl.hasError">
</bh-grid-loading-indicator>

</div>
Expand Down
Loading

0 comments on commit 8336d40

Please sign in to comment.