精简已完成待办重复展示
This commit is contained in:
parent
6cd209ea71
commit
be2d80c718
@ -74,10 +74,24 @@ class SystemizationTodo extends Model
|
||||
return $this->isCompleted() ? self::STATUS_COMPLETED : self::STATUS_INCOMPLETE;
|
||||
}
|
||||
|
||||
public function displayProgress(): string
|
||||
{
|
||||
$progress = trim((string) $this->progress);
|
||||
if ($progress === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$normalized = (string) preg_replace('/[\s。.]+$/u', '', $progress);
|
||||
|
||||
return $this->isCompleted() && $normalized === self::STATUS_COMPLETED
|
||||
? ''
|
||||
: $progress;
|
||||
}
|
||||
|
||||
public function reminder(): array
|
||||
{
|
||||
if ($this->isCompleted()) {
|
||||
return ['label' => '已完成', 'tone' => 'muted'];
|
||||
return ['label' => '—', 'tone' => 'muted'];
|
||||
}
|
||||
if ($this->due_date === null) {
|
||||
return ['label' => '时间待定', 'tone' => 'muted'];
|
||||
|
||||
@ -394,6 +394,8 @@
|
||||
$statusClass = $item->isCompleted()
|
||||
? 'sys-todo-badge--completed'
|
||||
: 'sys-todo-badge--incomplete';
|
||||
$displayProgress = $item->displayProgress();
|
||||
$displayNotes = trim((string) $item->notes);
|
||||
$todoPayload = [
|
||||
'id' => $item->id,
|
||||
'position' => (int) $item->item_sequence,
|
||||
@ -496,17 +498,17 @@
|
||||
<td><span class="sys-todo-table__reminder is-{{ $item->reminder_tone }}">{{ $item->reminder_label }}</span></td>
|
||||
<td><span class="sys-todo-badge {{ $statusClass }}">{{ $item->status_label }}</span></td>
|
||||
<td class="sys-todo-table__progress-notes">
|
||||
@if ($item->progress || $item->notes)
|
||||
@if ($item->progress)
|
||||
@if ($displayProgress !== '' || $displayNotes !== '')
|
||||
@if ($displayProgress !== '')
|
||||
<div class="sys-todo-table__detail">
|
||||
<span class="sys-todo-table__detail-label">完成情况</span>
|
||||
<span>{{ $item->progress }}</span>
|
||||
<span>{{ $displayProgress }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if ($item->notes)
|
||||
@if ($displayNotes !== '')
|
||||
<div class="sys-todo-table__detail">
|
||||
<span class="sys-todo-table__detail-label">备注</span>
|
||||
<span>{{ $item->notes }}</span>
|
||||
<span>{{ $displayNotes }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
|
||||
@ -466,6 +466,7 @@ class SystemizationTodosTest extends FeatureTestCase
|
||||
$completed->update([
|
||||
'status' => SystemizationTodo::STATUS_COMPLETED,
|
||||
'completed_at' => '2026-10-22',
|
||||
'progress' => '已完成',
|
||||
]);
|
||||
$legacy = $this->createTodo('收入', '提醒测试', '历史进行中事项', '2026-11-01', 5);
|
||||
$legacy->update(['status' => '进行中']);
|
||||
@ -480,7 +481,8 @@ class SystemizationTodosTest extends FeatureTestCase
|
||||
$this->assertSame('danger', $items['逾期事项']->reminder_tone);
|
||||
$this->assertSame('今天到期', $items['今天到期事项']->reminder_label);
|
||||
$this->assertSame('剩余 4 天', $items['未来事项']->reminder_label);
|
||||
$this->assertSame('已完成', $items['已完成事项']->reminder_label);
|
||||
$this->assertSame('—', $items['已完成事项']->reminder_label);
|
||||
$this->assertSame('', $items['已完成事项']->displayProgress());
|
||||
$this->assertSame(SystemizationTodo::STATUS_INCOMPLETE, $items['历史进行中事项']->status_label);
|
||||
|
||||
$incompleteTitles = $this->get(route('business.pages.show', [
|
||||
@ -504,6 +506,7 @@ class SystemizationTodosTest extends FeatureTestCase
|
||||
|
||||
public function test_page_filters_by_date_and_merges_adjacent_category_and_section_cells(): void
|
||||
{
|
||||
$this->travelTo(Carbon::parse('2026-10-26 12:00:00'));
|
||||
$this->loginAs();
|
||||
|
||||
$this->createTodo('1、收入', '1、平台收入核对', '1、收入事项 A', '2026-10-26', 1, '晨曦', '栎阳、秋香');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user