forked from doubtfire-lms/doubtfire-web
-
Notifications
You must be signed in to change notification settings - Fork 137
Feature: Grant Extension Form #285
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
20b07c0
feat: add Grant Extension form component
JoeMacl 7c338a6
feat: updated grant extension form with validation and styling
JoeMacl 570433a
feat: update progress on grant extension form
JoeMacl b3b5f97
style: improve modal responsiveness and log form submission
JoeMacl 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
64 changes: 64 additions & 0 deletions
64
src/app/admin/modals/grant-extension-form/grant-extension-form.component.html
This file contains hidden or 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,64 @@ | ||
| <div class="mx-auto max-w-3xl p-8 bg-white rounded-md shadow-md"> | ||
| <h2 class="text-3xl font-bold text-gray-900 mb-10">Grant Extension</h2> | ||
|
|
||
| <form [formGroup]="grantExtensionForm" (ngSubmit)="onSubmit()" class="space-y-8"> | ||
|
|
||
| <!-- Student --> | ||
| <div> | ||
| <label class="block text-lg font-semibold text-gray-800 mb-2" for="student">Student</label> | ||
| <select | ||
| id="student" | ||
| formControlName="student" | ||
| class="w-full border border-gray-300 rounded-md px-4 py-3 text-base focus:ring-2 focus:ring-blue-500 focus:outline-none" | ||
| required | ||
| > | ||
| <option value="" disabled selected>Select a student</option> | ||
| <option *ngFor="let student of students" [value]="student.id"> | ||
| {{ student.name }} | ||
| </option> | ||
| </select> | ||
| </div> | ||
|
|
||
| <!-- Extension --> | ||
| <div> | ||
| <label class="block text-lg font-semibold text-gray-800 mb-2"> | ||
| Extension Duration: | ||
| <span class="font-bold">{{ grantExtensionForm.get('extension')?.value }}</span> day(s) | ||
| </label> | ||
| <input type="range" formControlName="extension" min="1" max="30" class="w-full" /> | ||
| </div> | ||
|
|
||
| <!-- Reason --> | ||
| <div> | ||
| <label for="reason" class="block text-lg font-semibold text-gray-800 mb-2">Reason</label> | ||
| <textarea | ||
| id="reason" | ||
| formControlName="reason" | ||
| rows="4" | ||
| class="w-full border border-gray-300 rounded-md px-4 py-3 text-base focus:ring-2 focus:ring-blue-500 focus:outline-none" | ||
| required | ||
| ></textarea> | ||
| </div> | ||
|
|
||
| <!-- Notes --> | ||
| <div> | ||
| <label for="notes" class="block text-lg font-semibold text-gray-800 mb-2">Additional Notes</label> | ||
JoeMacl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <textarea | ||
| id="notes" | ||
| formControlName="notes" | ||
| rows="3" | ||
| class="w-full border border-gray-300 rounded-md px-4 py-3 text-base focus:ring-2 focus:ring-blue-500 focus:outline-none" | ||
| ></textarea> | ||
| </div> | ||
|
|
||
| <!-- Submit --> | ||
JoeMacl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <div class="pt-4 text-right"> | ||
| <button | ||
JoeMacl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type="submit" | ||
| class="inline-flex items-center bg-blue-600 text-white text-lg font-medium px-6 py-3 rounded-md hover:bg-blue-700 transition" | ||
| > | ||
| Grant Extension | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
Empty file.
22 changes: 22 additions & 0 deletions
22
src/app/admin/modals/grant-extension-form/grant-extension-form.component.spec.ts
This file contains hidden or 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,22 @@ | ||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
| import { GrantExtensionFormComponent } from './grant-extension-form.component'; | ||
|
|
||
| describe('GrantExtensionFormComponent', () => { | ||
| let component: GrantExtensionFormComponent; | ||
| let fixture: ComponentFixture<GrantExtensionFormComponent>; | ||
|
|
||
| beforeEach(async () => { | ||
| await TestBed.configureTestingModule({ | ||
| imports: [GrantExtensionFormComponent] | ||
| }) | ||
| .compileComponents(); | ||
|
|
||
| fixture = TestBed.createComponent(GrantExtensionFormComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
JoeMacl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
| }); | ||
34 changes: 34 additions & 0 deletions
34
src/app/admin/modals/grant-extension-form/grant-extension-form.component.ts
This file contains hidden or 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,34 @@ | ||
| import {Component, OnInit} from '@angular/core'; | ||
| import {FormGroup, FormBuilder, Validators, ReactiveFormsModule} from '@angular/forms'; | ||
| import {CommonModule} from '@angular/common'; | ||
|
|
||
JoeMacl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @Component({ | ||
| selector: 'app-grant-extension-form', | ||
| standalone: true, | ||
| imports: [ReactiveFormsModule, CommonModule], | ||
| templateUrl: './grant-extension-form.component.html', | ||
| styleUrls: ['./grant-extension-form.component.scss'] | ||
| }) | ||
| export class GrantExtensionFormComponent implements OnInit { | ||
| grantExtensionForm!: FormGroup; | ||
| students = []; | ||
|
|
||
| constructor(private fb: FormBuilder) {} | ||
|
|
||
| ngOnInit(): void { | ||
| this.grantExtensionForm = this.fb.group({ | ||
| student: ['', Validators.required], | ||
| extension: [1, [Validators.required, Validators.min(1)]], | ||
| reason: ['', Validators.required], | ||
| notes: [''], | ||
| }); | ||
| } | ||
|
|
||
| onSubmit(): void { | ||
| console.log('Clicked!'); | ||
| if (this.grantExtensionForm.valid) { | ||
| console.log('Submitted', this.grantExtensionForm.value); | ||
| // API goes here | ||
| } | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.