-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BRS-817 locking records/fiscal years front end (#163)
BRS-817 adding keycloaksettings for new lock-records route BRS-817 Locked records show as locked
- Loading branch information
1 parent
29ee817
commit c1b44c2
Showing
46 changed files
with
841 additions
and
18 deletions.
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
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
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
6 changes: 6 additions & 0 deletions
6
src/app/lock-records/fiscal-year-lock-table/fiscal-year-lock-table.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h2>Locked records</h2> | ||
<app-table | ||
[columnSchema]="columnSchema" | ||
[data]="tableRows" | ||
[emptyTableMsg]="'There are currently no locked fiscal years.'" | ||
></app-table> |
Empty file.
24 changes: 24 additions & 0 deletions
24
src/app/lock-records/fiscal-year-lock-table/fiscal-year-lock-table.component.spec.ts
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,24 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { FiscalYearLockTableComponent } from './fiscal-year-lock-table.component'; | ||
|
||
describe('FiscalYearLockTableComponent', () => { | ||
let component: FiscalYearLockTableComponent; | ||
let fixture: ComponentFixture<FiscalYearLockTableComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [FiscalYearLockTableComponent], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(FiscalYearLockTableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
82 changes: 82 additions & 0 deletions
82
src/app/lock-records/fiscal-year-lock-table/fiscal-year-lock-table.component.ts
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,82 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { Subscription } from 'rxjs'; | ||
import { DataService } from 'src/app/services/data.service'; | ||
import { columnSchema } from 'src/app/shared/components/table/table.component'; | ||
import { Constants } from 'src/app/shared/utils/constants'; | ||
import { FiscalYearUnlockerComponent } from './fiscal-year-unlocker/fiscal-year-unlocker.component'; | ||
|
||
@Component({ | ||
selector: 'app-fiscal-year-lock-table', | ||
templateUrl: './fiscal-year-lock-table.component.html', | ||
styleUrls: ['./fiscal-year-lock-table.component.scss'], | ||
}) | ||
export class FiscalYearLockTableComponent implements OnInit { | ||
@Input() data: any[]; | ||
|
||
private subscriptions = new Subscription(); | ||
public columnSchema: columnSchema[] = []; | ||
public tableRows: any[] = []; | ||
|
||
constructor(protected dataService: DataService) { | ||
this.subscriptions.add( | ||
dataService | ||
.getItemValue(Constants.dataIds.LOCK_RECORDS_FISCAL_YEARS_DATA) | ||
.subscribe((res) => { | ||
if (res && res.length) { | ||
this.tableRows = this.filterLockedYears(res); | ||
} | ||
}) | ||
); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.createColumnSchema(); | ||
} | ||
|
||
filterLockedYears(data) { | ||
let lockedYears: any[] = []; | ||
for (const year of data) { | ||
if (year.isLocked) { | ||
lockedYears.push(year); | ||
} | ||
} | ||
return lockedYears; | ||
} | ||
|
||
// fiscalYearEndObject schema | ||
// pk: fiscalYearEnd | ||
// sk: 2022 | ||
// isLocked: true | ||
createColumnSchema() { | ||
this.columnSchema = [ | ||
{ | ||
id: 'year', | ||
displayHeader: 'Year', | ||
columnClasses: 'ps-3 pe-5', | ||
mapValue: (row) => row.sk, | ||
}, | ||
{ | ||
id: 'parkName', | ||
displayHeader: 'Park', | ||
width: '70%', | ||
columnClasses: 'px-5', | ||
mapValue: () => 'All Parks', | ||
}, | ||
{ | ||
id: 'lockedStatus', | ||
displayHeader: 'Unlock', | ||
width: '10%', | ||
columnClasses: 'ps-5 pe-3', | ||
mapValue: (row) => row.isLocked, | ||
cellTemplate: (row) => { | ||
return { | ||
component: FiscalYearUnlockerComponent, | ||
data: { | ||
data: row, | ||
}, | ||
}; | ||
}, | ||
}, | ||
]; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...k-records/fiscal-year-lock-table/fiscal-year-unlocker/fiscal-year-unlocker.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<button class="btn btn-outline-primary" (click)="unlockFiscalYear()"> | ||
<i class="bi bi-unlock-fill"></i> | ||
</button> |
Empty file.
28 changes: 28 additions & 0 deletions
28
...ecords/fiscal-year-lock-table/fiscal-year-unlocker/fiscal-year-unlocker.component.spec.ts
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,28 @@ | ||
import { HttpClientModule } from '@angular/common/http'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ConfigService } from 'src/app/services/config.service'; | ||
|
||
import { FiscalYearUnlockerComponent } from './fiscal-year-unlocker.component'; | ||
|
||
describe('FiscalYearUnlockerComponent', () => { | ||
let component: FiscalYearUnlockerComponent; | ||
let fixture: ComponentFixture<FiscalYearUnlockerComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [HttpClientModule], | ||
declarations: [FiscalYearUnlockerComponent], | ||
providers: [ConfigService], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(FiscalYearUnlockerComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
...ock-records/fiscal-year-lock-table/fiscal-year-unlocker/fiscal-year-unlocker.component.ts
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,20 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { FiscalYearLockService } from 'src/app/services/fiscal-year-lock.service'; | ||
|
||
@Component({ | ||
selector: 'app-fiscal-year-unlocker', | ||
templateUrl: './fiscal-year-unlocker.component.html', | ||
styleUrls: ['./fiscal-year-unlocker.component.scss'], | ||
}) | ||
export class FiscalYearUnlockerComponent { | ||
@Input() data: any; | ||
|
||
constructor(private fiscalYearLockService: FiscalYearLockService) {} | ||
|
||
unlockFiscalYear() { | ||
this.fiscalYearLockService.lockUnlockFiscalYear( | ||
this.data.year.value, | ||
false | ||
); | ||
} | ||
} |
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,51 @@ | ||
<section class="container mt-5"> | ||
<h1 class="mb-1">Lock or Unlock Records</h1> | ||
<p> | ||
Select a date rage below to lock or unlock all records for all parks for the | ||
selected dates. | ||
</p> | ||
</section> | ||
<section class="container mt-3"> | ||
<div> | ||
<label class="fw-bold mb-2">Date range:</label> | ||
<div class="row mb-3"> | ||
<div class="col-md-12 col-lg-4"> | ||
<button (click)="dp.toggle()" class="form-control"> | ||
<span | ||
autocomplete="off" | ||
bsDatepicker | ||
#dp="bsDatepicker" | ||
minMode="year" | ||
(onShown)="onOpenCalendar($event)" | ||
(bsValueChange)="datePickerOutput($event)" | ||
> | ||
</span> | ||
<div class="text-muted d-flex justify-content-left"> | ||
<i class="bi-calendar me-2 text-muted"></i> | ||
{{ fiscalYearRangeString }} | ||
</div> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-12 col-lg-4"> | ||
<button | ||
class="btn btn-primary w-100" | ||
type="button" | ||
(click)="submit()" | ||
[disabled]="fiscalYearRangeString === 'Select a fiscal year'" | ||
> | ||
<app-text-to-loading-spinner | ||
[text]="'Lock Records '" | ||
(loadingStatus)="loading = $event" | ||
></app-text-to-loading-spinner> | ||
</button> | ||
</div> | ||
</div> | ||
</section> | ||
<section class="container mt-5"> | ||
<app-fiscal-year-lock-table | ||
[data]="fiscalYearsList" | ||
></app-fiscal-year-lock-table> | ||
</section> |
Empty file.
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,34 @@ | ||
import { HttpClientModule } from '@angular/common/http'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; | ||
import { ConfigService } from '../services/config.service'; | ||
import { DatePickerModule } from '../shared/components/date-picker/date-picker.module'; | ||
|
||
import { LockRecordsComponent } from './lock-records.component'; | ||
|
||
describe('LockRecordsComponent', () => { | ||
let component: LockRecordsComponent; | ||
let fixture: ComponentFixture<LockRecordsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
HttpClientModule, | ||
DatePickerModule, | ||
BsDatepickerModule.forRoot(), | ||
], | ||
declarations: [LockRecordsComponent], | ||
providers: [ConfigService], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LockRecordsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.