|
23 | 23 | > |
24 | 24 | {{ allSelected ? 'Deselect all' : 'Select all' }} |
25 | 25 | </button> |
| 26 | + <button |
| 27 | + v-if="selected.filter(Boolean).length > 0" |
| 28 | + @click="showProcessModal" |
| 29 | + type="button" |
| 30 | + class="rounded-md bg-green-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-green-700" |
| 31 | + > |
| 32 | + Process ({{ selected.filter(Boolean).length }}) |
| 33 | + </button> |
26 | 34 | <span |
27 | 35 | v-if="selected.filter(Boolean).length > 0" |
28 | 36 | class="text-sm text-gray-500 dark:text-gray-400" |
29 | 37 | > |
30 | | - Selected: {{ selected.filter(Boolean).length }} of {{ tasks.length }} |
| 38 | + {{ selectedSummary }} |
31 | 39 | </span> |
32 | 40 | </div> |
33 | 41 |
|
|
519 | 527 | this.selected.every(Boolean) |
520 | 528 | ); |
521 | 529 | }, |
| 530 | + selectedSummary() { |
| 531 | + const tasks = this.getSelectedTasks(); |
| 532 | + if (!tasks.length) return ''; |
| 533 | + const totalSeconds = tasks.reduce((s, t) => s + (t.common_time || 0), 0); |
| 534 | + const totalHours = (totalSeconds / 3600).toFixed(1); |
| 535 | + let overtimeSeconds = 0; |
| 536 | + for (const task of tasks) { |
| 537 | + const expected = this.getApproximatelyTime(task); |
| 538 | + const actual = task.common_time || 0; |
| 539 | + if (expected > 0 && actual > expected) { |
| 540 | + overtimeSeconds += actual - expected; |
| 541 | + } |
| 542 | + } |
| 543 | + const overtimeHours = (overtimeSeconds / 3600).toFixed(1); |
| 544 | + let text = `${tasks.length} of ${this.tasks.length} · ${totalHours}h`; |
| 545 | + if (overtimeSeconds > 0) { |
| 546 | + text += ` · +${overtimeHours}h overtime`; |
| 547 | + } |
| 548 | + return text; |
| 549 | + }, |
522 | 550 | taskComputedData() { |
523 | 551 | return this.tasks.reduce((acc, task) => { |
524 | 552 | acc[task.id] = { |
|
841 | 869 | : !v && this.selected[i], |
842 | 870 | ); |
843 | 871 |
|
844 | | - this.isShowSelectedTasksCommonTime = |
845 | | - this.selected.filter(Boolean).length >= 1; |
846 | 872 | this.selecting = []; |
847 | | - if (this.isShowSelectedTasksCommonTime) { |
848 | | - this.countTimeForModal(); |
849 | | - } |
850 | 873 | }, |
851 | 874 | countTimeForModal() { |
852 | 875 | const time = this.getSelectedTasks().reduce( |
|
892 | 915 | ); |
893 | 916 | } |
894 | 917 | }, |
| 918 | + showProcessModal() { |
| 919 | + this.countTimeForModal(); |
| 920 | + this.isShowSelectedTasksCommonTime = true; |
| 921 | + }, |
895 | 922 | selectAll() { |
896 | 923 | if (this.allSelected) { |
897 | 924 | this.selected = []; |
898 | 925 | this.isShowSelectedTasksCommonTime = false; |
899 | 926 | } else { |
900 | 927 | this.selected = this.tasks.map(() => true); |
901 | | - this.isShowSelectedTasksCommonTime = this.selected.length > 0; |
902 | | - this.countTimeForModal(); |
903 | 928 | } |
904 | 929 | }, |
905 | 930 | onPageChange(page: number) { |
|
0 commit comments