Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feature request) a handlbars helper for rendering filters #1979

Closed
jniles opened this issue Aug 14, 2017 · 0 comments
Closed

(feature request) a handlbars helper for rendering filters #1979

jniles opened this issue Aug 14, 2017 · 0 comments

Comments

@jniles
Copy link
Collaborator

jniles commented Aug 14, 2017

It would save an awful lot of space of we made a handlebars partial for rendering filters in the handlebars PDF reports. This way, we could do something like:

{{!-- this will render the filters in a partial call "filter bar" --}}
{{> filterbar filters=filters }}

The code for the filterbar should look something like the ones found in the patient registry handlebars file.

  <p class="pills">
    {{#each filters}}
      <span class="label label-primary text-capitalize">
        <i class="fa fa-filter"></i> {{translate this.displayName}}

        {{#if this.comparitor}} {{this.comparitor}}
        {{else}}: {{/if}}

        {{#if this.isDate}} {{date this.value}}
        {{else}} {{translate this.value}} {{/if}}
      </span>
    {{/each}}
  </p>
@jniles jniles self-assigned this Oct 20, 2017
jniles added a commit to jniles/bhima that referenced this issue Oct 22, 2017
This commit implements a filterbar partial to enable rendering filters
on the server.  It implements a giant shared filter to render the
correctly translated display value based on the filter passed in.
A prototype implementation is available in cash's registry.

Closes Third-Culture-Software#1979.
jniles added a commit to jniles/bhima that referenced this issue Oct 22, 2017
This commit adds the filter bar to the patients and employees
registries.

Closes Third-Culture-Software#2229.  Closes Third-Culture-Software#1979.  Closes Third-Culture-Software#1980.
jniles added a commit to jniles/bhima that referenced this issue Oct 22, 2017
This commit implements a filterbar partial to enable rendering filters
on the server.  It implements a giant shared filter to render the
correctly translated display value based on the filter passed in.
A prototype implementation is available in cash's registry.

Closes Third-Culture-Software#1979.
jniles added a commit to jniles/bhima that referenced this issue Oct 22, 2017
This commit adds the filter bar to the patients and employees
registries.

Closes Third-Culture-Software#2229.  Closes Third-Culture-Software#1979.  Closes Third-Culture-Software#1980.
jniles added a commit to jniles/bhima that referenced this issue Oct 22, 2017
This commit adds the filter bar to the patients and employees
registries.

Closes Third-Culture-Software#2229.  Closes Third-Culture-Software#1979.  Closes Third-Culture-Software#1980.
jniles added a commit to jniles/bhima that referenced this issue Oct 22, 2017
This commit adds the filter bar to the patients and employees
registries.

Closes Third-Culture-Software#2229.  Closes Third-Culture-Software#1979.  Closes Third-Culture-Software#1980.
bors bot added a commit that referenced this issue Oct 23, 2017
2230: Create filter handlebars helper r=DedrickEnc a=jniles

This commit implements a filterbar partial to enable rendering filters on the server.  It implements a giant shared filter to render the correctly translated display value based on the filter passed in.  The basic usage pattern is like this:
```js
const shared = require('reports/shared');

function build(req, res, next) {
  const filters = shared.formatFilters(req.query);

  const data = { filters };

  // ... later ...
  report.render(data);
}
```
.. and in handlebars template ...
```hbs
{{> filterbar filters=filters }}
```

The following reports now use this partial for rendering filters:
 1. The Invoices Registry
![invoiceregistryfilterbar](https://user-images.githubusercontent.com/896472/31859473-6a40cfe0-b704-11e7-9cbb-cc39b38495d4.png)

 2. The Cash Payments Registry
![cashpaymentsregistryfilterbar](https://user-images.githubusercontent.com/896472/31859477-7a9fb0c2-b704-11e7-93d5-9d2b890acec3.png)

 3. The Patients Registry
![patientregistryfilterbar](https://user-images.githubusercontent.com/896472/31859479-806d1db4-b704-11e7-85ab-58f9be969a62.png)

 4. The Voucher Registry
![voucherregistryfilterbar](https://user-images.githubusercontent.com/896472/31859482-8a9eef60-b704-11e7-9a3c-3af9c97aa05d.png)

 5. The Employees Registry
![employeemanagementfilterbar](https://user-images.githubusercontent.com/896472/31859484-95aaceec-b704-11e7-81ca-01ec4e0b8b7c.png)

Closes #2229.  Closes #1979.  Closes #1980.
@bors bors bot closed this as completed in #2230 Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant