| 1 |
import { ColumnProgress } from "@web/views/view_components/column_progress"; |
| 2 |
|
| 3 |
export class RottingColumnProgress extends ColumnProgress { |
| 4 |
static template = "mail.RottingColumnProgress"; |
| 5 |
static props = { |
| 6 |
...ColumnProgress.props, |
| 7 |
progressBarState: { type: Object }, |
| 8 |
onRotIconClicked: { type: Function }, |
| 9 |
}; |
| 10 |
|
| 11 |
getRottingGroupCount(group) { |
| 12 |
const isRottingField = group._config.fields.is_rotting; |
| 13 |
if (!isRottingField) { |
| 14 |
return {}; |
| 15 |
} |
| 16 |
return { |
| 17 |
title: isRottingField.string, |
| 18 |
value: group.list.records.filter((record) => record.data.is_rotting).length, |
| 19 |
}; |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Checks that a filter verifying rotting status exists for the current set view. |
| 24 |
* If that filter exists, it is toggled. |
| 25 |
*/ |
| 26 |
async onRottingIconClick() { |
| 27 |
await this.props.onRotIconClicked(this.props.group); |
| 28 |
} |
| 29 |
} |