Sum of cards. In Progress.

Thanks to xet7 !

Related #3796
This commit is contained in:
Lauri Ojansivu 2021-09-08 15:55:53 +03:00
parent a80ab6e47a
commit 8626b466b8
6 changed files with 53 additions and 0 deletions

View file

@ -4,6 +4,17 @@ template(name="listBody")
if cards.count
+inlinedForm(autoclose=false position="top")
+addCardForm(listId=_id position="top")
ul.sidebar-list
each customFieldsSum
li
+viewer
= name
if $eq customFieldsSum.type "number"
+viewer
= value
if $eq customFieldsSum.type "currency"
+viewer
= formattedCurrencyCustomFieldValue(value)
each (cardsWithLimit (idOrNull ../../_id))
a.minicard-wrapper.js-minicard(href=originRelativeUrl
class="{{#if cardIsSelected}}is-selected{{/if}}"

View file

@ -13,6 +13,13 @@ BlazeComponent.extendComponent({
return [];
},
customFieldsSum() {
return CustomFields.find({
boardIds: { $in: [Session.get('currentBoard')] },
showSumAtTopOfList: true,
});
},
openForm(options) {
options = options || {};
options.position = options.position || 'top';

View file

@ -77,6 +77,12 @@ template(name="createCustomFieldPopup")
span {{_ 'showLabel-field-on-card'}}
a.flex.js-field-show-sum-at-top-of-list(class="{{#if showSumAtTopOfList}}is-checked{{/if}}")
.materialCheckBox(class="{{#if showSumAtTopOfList}}is-checked{{/if}}")
span {{_ 'showSum-field-on-list'}}
button.primary.wide.left(type="button")
| {{_ 'save'}}
if _id

View file

@ -234,6 +234,14 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
$target.find('.materialCheckBox').toggleClass('is-checked');
$target.toggleClass('is-checked');
},
'click .js-field-show-sum-at-top-of-list'(evt) {
let $target = $(evt.target);
if (!$target.hasClass('js-field-show-sum-at-top-of-list')) {
$target = $target.parent();
}
$target.find('.materialCheckBox').toggleClass('is-checked');
$target.toggleClass('is-checked');
},
'click .primary'(evt) {
evt.preventDefault();
@ -248,6 +256,8 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
this.find('.js-field-automatically-on-card.is-checked') !== null,
alwaysOnCard:
this.find('.js-field-always-on-card.is-checked') !== null,
showSumAtTopOfList:
this.find('.js-field-show-sum-at-top-of-list.is-checked') !== null,
};
// insert or update