diff --git a/client/src/css/structure.css b/client/src/css/structure.css index 0f62de597d..2042f97af7 100644 --- a/client/src/css/structure.css +++ b/client/src/css/structure.css @@ -931,6 +931,11 @@ a[disabled] { padding-left : 5px; } +.filter-text-link { + color: #fff; + margin-left: 5px; +} + .strike { text-decoration : line-through; } diff --git a/client/src/js/components/bhFilter.js b/client/src/js/components/bhFilter.js new file mode 100644 index 0000000000..c54c7f891a --- /dev/null +++ b/client/src/js/components/bhFilter.js @@ -0,0 +1,21 @@ +angular.module('bhima.components') + .component('bhFilter', { + templateUrl : 'modules/templates/bhFilter.tmpl.html', + controller : bhFilterController, + bindings : { + filter : '<', + onRemove : '&', + } + , + }); + +function bhFilterController() { + const $ctrl = this; + const DEFAULT_FILTER_COMPARITOR = ':'; + + $ctrl.$onInit = function onInit() { + // fill in label details required by the template + $ctrl.filter = $ctrl.filter || {}; + $ctrl.filter.comparitorLabel = $ctrl.filter._comparitor || DEFAULT_FILTER_COMPARITOR; + }; +} diff --git a/client/src/js/components/bhFilters.js b/client/src/js/components/bhFilters.js index b9afc34906..4c985ec935 100644 --- a/client/src/js/components/bhFilters.js +++ b/client/src/js/components/bhFilters.js @@ -1,22 +1,22 @@ angular.module('bhima.components') -.component('bhFilters', { - templateUrl : 'modules/templates/bhFilters.tmpl.html', - controller : bhFiltersController, - bindings : { - filters : '<', - onRemoveFilter : '&', // fires to remove the filter - }, -}); + .component('bhFilters', { + templateUrl : 'modules/templates/bhFilters.tmpl.html', + controller : bhFiltersController, + bindings : { + filters : '<', + onRemoveFilter : '&', + }, + }); bhFiltersController.$inject = ['$filter']; function bhFiltersController($filter) { - var $ctrl = this; + const $ctrl = this; // formats the $viewValue according to any filters passed in $ctrl.$onChanges = function onChanges(changes) { if (!changes.filters) { return; } - var filters = changes.filters.currentValue; + const filters = changes.filters.currentValue; if (!filters) { return; } diff --git a/client/src/modules/templates/bhFilter.tmpl.html b/client/src/modules/templates/bhFilter.tmpl.html new file mode 100644 index 0000000000..c72f0b392a --- /dev/null +++ b/client/src/modules/templates/bhFilter.tmpl.html @@ -0,0 +1,19 @@ + + + + + {{$ctrl.filter._label}} + {{$ctrl.filter.comparitorLabel}} + {{$ctrl.filter.displayValue}} + + + + + + + + diff --git a/client/src/modules/templates/bhFilters.tmpl.html b/client/src/modules/templates/bhFilters.tmpl.html index 082ada5c62..a42eff8ff6 100644 --- a/client/src/modules/templates/bhFilters.tmpl.html +++ b/client/src/modules/templates/bhFilters.tmpl.html @@ -7,11 +7,7 @@ - - - {{filter._label}} {{ filter._comparitor ? " " + filter._comparitor : ":" }} - {{ filter.displayValue }} - + @@ -19,19 +15,10 @@