From d2ac8aecb8461ef4be6762f7d74f1aedb96c665f Mon Sep 17 00:00:00 2001 From: Chris LOMAME Date: Fri, 2 Jun 2017 14:07:04 +0200 Subject: [PATCH] feat: implement searching on debtor groups for each registry (#1740) * test(Complete insuffisance test E2E) - Complete test E2E for the research with the inventorie group uuid in Cash registry, Patient Registry and Invoice Registry - Update some function the test E2E - Update API for cash and patient invoice * perf(Test e2e and best practice) - Use ui-select instead select - Use componant bhClear and fix issue 1702 - Update test E2E closes #1702 --- client/src/modules/cash/cash.service.js | 1 + .../cash/payments/templates/search.modal.html | 16 +++++ .../cash/payments/templates/search.modal.js | 9 ++- .../inventory/list/modals/search.modal.html | 32 +++------ .../invoices/patientInvoice.service.js | 5 +- .../invoices/registry/search.modal.html | 30 ++++++-- .../modules/invoices/registry/search.modal.js | 9 ++- .../patients/registry/search.modal.html | 70 ++++++------------- server/controllers/finance/cash.js | 3 +- server/controllers/finance/patientInvoice.js | 4 +- test/end-to-end/cash/registry.spec.js | 7 ++ test/end-to-end/cash/search.page.js | 4 ++ .../patient/invoice/registry.search.js | 6 +- test/end-to-end/patient/registry.search.js | 10 +++ 14 files changed, 120 insertions(+), 86 deletions(-) diff --git a/client/src/modules/cash/cash.service.js b/client/src/modules/cash/cash.service.js index 027488f99d..c15ff8b732 100644 --- a/client/src/modules/cash/cash.service.js +++ b/client/src/modules/cash/cash.service.js @@ -144,6 +144,7 @@ function CashService(Modal, Api, Exchange, Session, moment, $translate, Filters, { key : 'defaultPeriod', label : 'TABLE.COLUMNS.PERIOD', valueFilter : 'translate' }, { key : 'invoiceReference', label : 'FORM.LABELS.INVOICE' }, { key : 'patientReference', label : 'FORM.LABELS.REFERENCE_PATIENT' }, + { key : 'debtor_group_uuid', label : 'FORM.LABELS.DEBTOR_GROUP' }, { key : 'invoice_uuid', label : 'FORM.LABELS.INVOICE' }]); if (filterCache.filters) { diff --git a/client/src/modules/cash/payments/templates/search.modal.html b/client/src/modules/cash/payments/templates/search.modal.html index ade29121fd..a22b180217 100644 --- a/client/src/modules/cash/payments/templates/search.modal.html +++ b/client/src/modules/cash/payments/templates/search.modal.html @@ -53,6 +53,22 @@ +
+ + + + + {{$select.selected.name}} + + + + +
+
- - - FORM.BUTTONS.CLEAR - - + +
diff --git a/client/src/modules/invoices/patientInvoice.service.js b/client/src/modules/invoices/patientInvoice.service.js index d79cca8ea6..868253e04e 100644 --- a/client/src/modules/invoices/patientInvoice.service.js +++ b/client/src/modules/invoices/patientInvoice.service.js @@ -132,7 +132,8 @@ function PatientInvoiceService(Modal, util, Session, Api, Filters) { { field: 'reversed', displayName : 'FORM.INFO.CREDIT_NOTE' }, { field: 'defaultPeriod', displayName : 'TABLE.COLUMNS.PERIOD', ngFilter : 'translate' }, { field: 'cash_uuid', displayName : 'FORM.INFO.PAYMENT' }, - { field: 'defaultPeriod', displayName : 'TABLE.COLUMNS.PERIOD', ngFilter : 'translate' } + { field: 'defaultPeriod', displayName : 'TABLE.COLUMNS.PERIOD', ngFilter : 'translate' }, + { field: 'debtor_group_uuid', displayName: 'FORM.LABELS.DEBTOR_GROUP' } ]; // returns columns from filters @@ -143,7 +144,7 @@ function PatientInvoiceService(Modal, util, Session, Api, Filters) { if (angular.isDefined(value)) { column.value = value; - if (column.field === 'cash_uuid') { + if (column.field === 'cash_uuid' || column.field === 'debtor_group_uuid') { column.value = column.value.slice(0, LIMIT_UUID_LENGTH).concat('...'); } diff --git a/client/src/modules/invoices/registry/search.modal.html b/client/src/modules/invoices/registry/search.modal.html index fe239c8e37..714338069c 100644 --- a/client/src/modules/invoices/registry/search.modal.html +++ b/client/src/modules/invoices/registry/search.modal.html @@ -59,16 +59,34 @@
+
+ + + + + + {{$select.selected.name}} + + + + +
+
- + ng-model="ModalCtrl.params.service_id"> + {{$select.selected.name}} + + + +
{{ 'FORM.LABELS.NAME' | translate }} - - - FORM.BUTTONS.CLEAR - - + +
@@ -50,11 +47,8 @@ - - - FORM.BUTTONS.CLEAR - - + +
@@ -65,11 +59,8 @@ - - - FORM.BUTTONS.CLEAR - - + +
@@ -79,12 +70,7 @@

FORM.LABELS.GENDER - - - - FORM.BUTTONS.CLEAR - - +

- - - - FORM.BUTTONS.CLEAR - - + - + {{$select.selected.name}} + + + +
@@ -130,24 +109,17 @@ PATIENT_GROUP.PATIENT_GROUP - - - - FORM.BUTTONS.CLEAR - - + - + {{$select.selected.name}} + + + +
{ modal.setPaymentReference('Test Primary Cashbox A'); modal.submit(); @@ -70,6 +71,12 @@ function CashPaymentsRegistryTests() { GU.expectRowCount('payment-registry', PAYMENT_INSIDE_REGISTRY); }); + it('finds all payments for creditor group Second Test Debtor Group', () => { + modal.setDebtorGroup('Second Test Debtor Group'); + modal.submit(); + GU.expectRowCount('payment-registry', PAYMENT_INSIDE_REGISTRY); + }); + it('finds no payments for the disallowed user', () => { modal.setUser('Regular User'); modal.submit(); diff --git a/test/end-to-end/cash/search.page.js b/test/end-to-end/cash/search.page.js index be76e33989..ca71355036 100644 --- a/test/end-to-end/cash/search.page.js +++ b/test/end-to-end/cash/search.page.js @@ -59,6 +59,10 @@ class SearchModal { bhPeriodSelect.select(period); } + setDebtorGroup(debtorGroup) { + FU.uiSelect('$ctrl.searchQueries.debtor_group_uuid', debtorGroup, this.element); + } + setCustomPeriod(start, end) { bhPeriodSelect.custom(start, end); } diff --git a/test/end-to-end/patient/invoice/registry.search.js b/test/end-to-end/patient/invoice/registry.search.js index 272a4a08df..638d43d4f9 100644 --- a/test/end-to-end/patient/invoice/registry.search.js +++ b/test/end-to-end/patient/invoice/registry.search.js @@ -99,12 +99,14 @@ function InvoiceRegistrySearch() { it('filters by