Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/components/decision-form/decision-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ <h2>{{ isEditMode ? 'Edit Decision' : 'Create New Decision' }}</h2>
<option value="CLOSED">Closed</option>
</select>
</div>

<div class="form-group">
<label for="dueDate">Due Date (Optional)</label>
<input type="date" id="dueDate" formControlName="dueDate" class="form-control">
</div>

<div class="form-actions">
<button type="button" routerLink="../" class="btn-secondary">Back</button>
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/decision-form/decision-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export class DecisionFormComponent implements OnInit {
this.decisionForm = this.fb.group({
title: ['', Validators.required],
description: [''],
status: ['DRAFT', Validators.required]
status: ['DRAFT', Validators.required],
dueDate: ['']
});
}

Expand All @@ -53,7 +54,8 @@ export class DecisionFormComponent implements OnInit {
this.decisionForm.patchValue({
title: decision.title,
description: decision.description,
status: decision.status
status: decision.status,
dueDate: decision.dueDate ? new Date(decision.dueDate).toISOString().split('T')[0] : ''
});
} else {
this.router.navigate(['../'], { relativeTo: this.route });
Expand Down
21 changes: 18 additions & 3 deletions src/app/components/decision-list/decision-list.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,22 @@
}

.decision-meta {
font-size: 12px;
color: #666;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
font-size: 0.85rem;
color: #6c757d;
margin-bottom: 1.5rem;
}

.due-date {
display: flex;
align-items: center;
font-weight: 500;
}

.due-date.overdue {
color: #dc3545;
background-color: #f8dbdf;
padding: 2px 6px;
border-radius: 4px;
}
3 changes: 3 additions & 0 deletions src/app/components/decision-list/decision-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ <h3>{{ decision.title }}</h3>
<p class="decision-desc">{{ decision.description || 'No description provided.' }}</p>
<div class="decision-meta">
<span>Created: {{ decision.createdAt | date:'shortDate' }}</span>
<span *ngIf="decision.dueDate" class="due-date" [ngClass]="{'overdue': isOverdue(decision)}">
Due: {{ decision.dueDate | date:'shortDate' }}
</span>
</div>
<div class="decision-actions">
<a [routerLink]="[decision.id, 'edit']" class="btn-secondary">Edit</a>
Expand Down
7 changes: 7 additions & 0 deletions src/app/components/decision-list/decision-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export class DecisionListComponent implements OnInit {
}
}

isOverdue(decision: Decision): boolean {
if (!decision.dueDate || decision.status === 'CLOSED') {
return false;
}
return new Date(decision.dueDate) < new Date();
}

private getWorkspaceIdFromRoute(): string | null {
for (const route of this.route.pathFromRoot) {
const id = route.snapshot.paramMap.get('id');
Expand Down
1 change: 1 addition & 0 deletions src/app/models/decision.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Decision {
status: 'DRAFT' | 'OPEN' | 'CLOSED';
workspaceId: string;
userId: string;
dueDate?: Date;
createdAt: Date;
updatedAt: Date;
isDeleted: boolean;
Expand Down
2 changes: 2 additions & 0 deletions src/app/services/decision.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class DecisionService {
status: 'CLOSED',
workspaceId: 'ws-1',
userId: 'user-1',
dueDate: new Date('2023-11-01'),
createdAt: new Date('2023-10-25'),
updatedAt: new Date('2023-10-26'),
isDeleted: false
Expand Down Expand Up @@ -63,6 +64,7 @@ export class DecisionService {
status: decision.status || 'DRAFT',
workspaceId: decision.workspaceId,
userId: 'user-1', // Mock user
dueDate: decision.dueDate,
createdAt: new Date(),
updatedAt: new Date(),
isDeleted: false
Expand Down
Loading