-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A user can set a due date #27 #78
Closed
mohamedmahmoudkashif
wants to merge
9
commits into
mindsmash:master
from
mohamedmahmoudkashif:master
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
93b4357
Adding migration file for the dueDate attribute
mohamedmahmoudkashif ecbcddf
Adding dueDate attribute to DAO and DTO
mohamedmahmoudkashif c5a60e2
Adding function in repository layertoget tasksin ASC order
mohamedmahmoudkashif 78c9f2c
adding the dueDate attribute to the local task service
mohamedmahmoudkashif e660a7d
Adding the HTML for the date and time
mohamedmahmoudkashif 08416a2
edit in scss files to be more responsive
mohamedmahmoudkashif f862b9d
edit in scss and adding the due date to card view
mohamedmahmoudkashif 76a96ba
disable the past days in the date picker
mohamedmahmoudkashif 5a83749
reformatting code
mohamedmahmoudkashif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE task ADD due_date TIMESTAMP WITH TIME ZONE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 18 additions & 2 deletions
20
src/main/webapp/app/tasks/task-form/task-form.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
<form [formGroup]="taskForm" (ngSubmit)="onSubmit()"> | ||
<form (ngSubmit)="onSubmit()" [formGroup]="taskForm"> | ||
<mat-form-field> | ||
<input type="text" formControlName="name" matInput placeholder="Add a new tiny task…" data-cy="task-input"> | ||
<input data-cy="task-input" formControlName="name" matInput placeholder="Add a new tiny task…" type="text"> | ||
</mat-form-field> | ||
|
||
<mat-form-field> | ||
<input [matDatepicker]="picker" [min]="startDate" formControlName="dueDate" matInput | ||
placeholder="Choose a due date"> | ||
<mat-datepicker-toggle [for]="picker" matSuffix></mat-datepicker-toggle> | ||
<mat-datepicker #picker [startAt]="startDate"></mat-datepicker> | ||
|
||
</mat-form-field> | ||
|
||
<mat-form-field> | ||
<input formControlName="time" matInput placeholder="Time" type="time"> | ||
</mat-form-field> | ||
|
||
<button color="warn" mat-raised-button style="flex:1" type="submit">Add task</button> | ||
|
||
|
||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
form { | ||
display: flex; | ||
align-items: center; | ||
display: flex; | ||
align-items: center; | ||
flex-wrap:wrap; | ||
} | ||
|
||
.mat-form-field { | ||
flex: 1; | ||
flex: 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.mat-list-item { | ||
background: #fff; | ||
margin: 16px 0; | ||
margin: 35px 0; | ||
} | ||
|
||
.mat-list-icon { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ export interface TaskService { | |
* @param name the task's name | ||
* @returns an `Observable` holding the created task | ||
*/ | ||
create(name: string): Observable<Task>; | ||
create(name: string, dueDate: Date): Observable<Task>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dueDate should be optional in my opinion. |
||
|
||
/** | ||
* Removes the task with the given ID from the list of tasks. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
export interface Task { | ||
id: string; | ||
name: string; | ||
dueDate: Date; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use the patchValue method here and move the setting of the time to date into a specific private method. Like:
` onSubmit(): void {
if (this.taskForm.value.dueDate && this.taskForm.value.time) {
this.taskForm.patchValue({dueDate: this.setTimeToDate(this.taskForm.value.dueDate, this.taskForm.value.time)});
}
this.taskService.create(this.taskForm.value.name, this.taskForm.value.dueDate).subscribe(task => {
this.created.emit(task);
this.taskForm.reset();
});
}
private setTimeToDate(date: Date, time: string): string {
const hour = +time.split(':')[0];
const minute = +time.split(':')[1];
date.setHours(hour, minute);
return date.toISOString();
}`