Added Compliance date.
Showing the next hearing date in the case list Showing cases on home
This commit is contained in:
@ -3,7 +3,6 @@ import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { LoginComponent } from './auth/login/login.component';
|
||||
import { LogoutComponent } from './auth/logout/logout.component';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -72,7 +71,7 @@ const routes: Routes = [
|
||||
},
|
||||
{ path: 'login', component: LoginComponent },
|
||||
{ path: 'logout', component: LogoutComponent },
|
||||
{ path: '', component: HomeComponent },
|
||||
{ path: '', redirectTo: '/cases', pathMatch: 'full' },
|
||||
];
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
||||
@ -27,14 +27,13 @@ import { AppComponent } from './app.component';
|
||||
import { LoginComponent } from './auth/login/login.component';
|
||||
import { LogoutComponent } from './auth/logout/logout.component';
|
||||
import { CoreModule } from './core/core.module';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { NavBarComponent } from './nav-bar/nav-bar.component';
|
||||
import { SharedModule } from './shared/shared.module';
|
||||
|
||||
registerLocaleData(enIN);
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent, LoginComponent, LogoutComponent, HomeComponent, NavBarComponent],
|
||||
declarations: [AppComponent, LoginComponent, LogoutComponent, NavBarComponent],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
|
||||
@ -52,7 +52,14 @@
|
||||
>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Title</mat-label>
|
||||
<input matInput placeholder="Title" formControlName="title" />
|
||||
<textarea
|
||||
matInput
|
||||
placeholder="Title"
|
||||
formControlName="title"
|
||||
autocomplete="off"
|
||||
cdkTextareaAutosize
|
||||
cdkAutosizeMinRows="2"
|
||||
></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div
|
||||
@ -447,11 +454,11 @@
|
||||
fx
|
||||
>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Proceedings</mat-label>
|
||||
<mat-label>Proceedings / Action to be taken</mat-label>
|
||||
<textarea
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="Proceedings"
|
||||
placeholder="Proceedings / Action to be taken"
|
||||
formControlName="proceedings"
|
||||
autocomplete="off"
|
||||
cdkTextareaAutosize
|
||||
@ -468,7 +475,21 @@
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
>
|
||||
<mat-form-field fxFlex="80%">
|
||||
<mat-form-field fxFlex="40%">
|
||||
<mat-label>Compliance Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="complianceDate"
|
||||
placeholder="Compliance Date"
|
||||
formControlName="complianceDate"
|
||||
autocomplete="off"
|
||||
#complianceDateElement
|
||||
(focus)="complianceDateElement.select()"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="complianceDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #complianceDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="40%">
|
||||
<mat-label>Next Hearing Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
@ -482,7 +503,7 @@
|
||||
<mat-datepicker-toggle matSuffix [for]="nextHearingDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nextHearingDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<button mat-raised-button color="primary" (click)="addHearing()" fxFlex="80%">Add</button>
|
||||
<button mat-raised-button color="primary" (click)="addHearing()" fxFlex="20%">Add</button>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
|
||||
<!-- Item Number Column -->
|
||||
@ -509,6 +530,12 @@
|
||||
<mat-cell *matCellDef="let row" class="right">{{ row.proceedings }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Compliance Date Column -->
|
||||
<ng-container matColumnDef="complianceDate">
|
||||
<mat-header-cell *matHeaderCellDef class="right">Compliance Date</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row" class="right">{{ row.complianceDate }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Next Hearing Date Column -->
|
||||
<ng-container matColumnDef="nextHearingDate">
|
||||
<mat-header-cell *matHeaderCellDef class="right">Next Hearing</mat-header-cell>
|
||||
|
||||
@ -50,6 +50,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
'bench',
|
||||
'courtStatus',
|
||||
'proceedings',
|
||||
'complianceDate',
|
||||
'nextHearingDate',
|
||||
'action',
|
||||
];
|
||||
@ -100,6 +101,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
bench: '',
|
||||
latestStatus: '',
|
||||
proceedings: '',
|
||||
complianceDate: '',
|
||||
nextHearingDate: '',
|
||||
}),
|
||||
});
|
||||
@ -358,10 +360,12 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
|
||||
const proceedings = formValue.proceedings;
|
||||
const nextHearingDate =
|
||||
formValue.nextHearingDate === ''
|
||||
? null
|
||||
: moment(formValue.nextHearingDate).format('DD-MMM-YYYY');
|
||||
const complianceDate = formValue.complianceDate
|
||||
? moment(formValue.complianceDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
const nextHearingDate = formValue.nextHearingDate
|
||||
? moment(formValue.nextHearingDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
|
||||
this.item.hearings.push(
|
||||
new Hearing({
|
||||
@ -370,6 +374,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
bench,
|
||||
courtStatus: latestStatus,
|
||||
proceedings,
|
||||
complianceDate,
|
||||
nextHearingDate,
|
||||
}),
|
||||
);
|
||||
@ -384,6 +389,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
bench: '',
|
||||
courtStatus: '',
|
||||
proceedings: '',
|
||||
complianceDate: '',
|
||||
nextHearingDate: '',
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<h1 mat-dialog-title>Edit Journal Entry</h1>
|
||||
<h1 mat-dialog-title>Edit Hearing</h1>
|
||||
<div mat-dialog-content>
|
||||
<form [formGroup]="form">
|
||||
<div
|
||||
@ -65,18 +65,16 @@
|
||||
fx
|
||||
>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Proceedings</mat-label>
|
||||
<mat-label>Proceedings / Action to be taken</mat-label>
|
||||
<textarea
|
||||
type="text"
|
||||
matInput
|
||||
placeholder="Proceedings"
|
||||
placeholder="Proceedings / Action to be taken"
|
||||
formControlName="proceedings"
|
||||
autocomplete="off"
|
||||
cdkTextareaAutosize
|
||||
cdkAutosizeMinRows="5"
|
||||
>
|
||||
></textarea
|
||||
>
|
||||
></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div
|
||||
@ -86,7 +84,21 @@
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
>
|
||||
<mat-form-field fxFlex="80%">
|
||||
<mat-form-field fxFlex="40%">
|
||||
<mat-label>Compliance Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="complianceDate"
|
||||
placeholder="Compliance Date"
|
||||
formControlName="complianceDate"
|
||||
autocomplete="off"
|
||||
#complianceDateElement
|
||||
(focus)="complianceDateElement.select()"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="complianceDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #complianceDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="40%">
|
||||
<mat-label>Next Hearing Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
|
||||
@ -25,6 +25,7 @@ export class HearingDialogComponent implements OnInit {
|
||||
bench: '',
|
||||
latestStatus: '',
|
||||
proceedings: '',
|
||||
complianceDate: '',
|
||||
nextHearingDate: '',
|
||||
});
|
||||
}
|
||||
@ -36,6 +37,9 @@ export class HearingDialogComponent implements OnInit {
|
||||
bench: this.data.hearing.bench,
|
||||
latestStatus: this.data.hearing.courtStatus ? this.data.hearing.courtStatus.id : '',
|
||||
proceedings: this.data.hearing.proceedings,
|
||||
complianceDate: this.data.hearing.complianceDate
|
||||
? moment(this.data.hearing.complianceDate, 'DD-MMM-YYYY').toDate()
|
||||
: '',
|
||||
nextHearingDate: this.data.hearing.nextHearingDate
|
||||
? moment(this.data.hearing.nextHearingDate, 'DD-MMM-YYYY').toDate()
|
||||
: '',
|
||||
@ -58,12 +62,12 @@ export class HearingDialogComponent implements OnInit {
|
||||
) as CourtStatus).name,
|
||||
});
|
||||
this.data.hearing.proceedings = formValue.proceedings;
|
||||
if (formValue.nextHearingDate === '') {
|
||||
this.data.hearing.nextHearingDate = null;
|
||||
} else {
|
||||
this.data.hearing.nextHearingDate = moment(formValue.nextHearingDate).format('DD-MMM-YYYY');
|
||||
}
|
||||
|
||||
this.data.hearing.complianceDate = formValue.complianceDate
|
||||
? moment(formValue.complianceDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
this.data.hearing.nextHearingDate = formValue.nextHearingDate
|
||||
? moment(formValue.nextHearingDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
this.dialogRef.close(this.data.hearing);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
<!-- Next Hearing Date Column -->
|
||||
<ng-container matColumnDef="nextHearingDate">
|
||||
<mat-header-cell *matHeaderCellDef>Next Hearing Date</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">Not Implemented</mat-cell>
|
||||
<mat-cell *matCellDef="let row">{{ nextHearingDate(row) }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Court Satus Column -->
|
||||
|
||||
@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { distinctUntilChanged, startWith, switchMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { Case } from '../../core/case';
|
||||
@ -61,4 +61,9 @@ export class CaseListComponent implements OnInit {
|
||||
});
|
||||
this.dataSource = new CaseListDataSource(this.list, this.paginator);
|
||||
}
|
||||
|
||||
nextHearingDate(row: Case): string {
|
||||
const date = row.hearings.map((x) => x.nextHearingDate).find((x) => !!x);
|
||||
return date ? date : '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ export class Hearing {
|
||||
bench: string;
|
||||
courtStatus: CourtStatus | null;
|
||||
proceedings: string;
|
||||
complianceDate: string | null;
|
||||
nextHearingDate: string | null;
|
||||
|
||||
public constructor(init?: Partial<Hearing>) {
|
||||
@ -16,7 +17,8 @@ export class Hearing {
|
||||
this.bench = '';
|
||||
this.courtStatus = null;
|
||||
this.proceedings = '';
|
||||
this.nextHearingDate = '';
|
||||
this.complianceDate = null;
|
||||
this.nextHearingDate = null;
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
.square-button {
|
||||
min-width: 150px;
|
||||
max-width: 150px;
|
||||
min-height: 150px;
|
||||
max-height: 150px;
|
||||
cursor: pointer;
|
||||
margin: 20px;
|
||||
}
|
||||
.item-name {
|
||||
text-align: center;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
<footer class="footer">
|
||||
<p>Backend: v{{ auth.user?.ver }} / Frontend: v{{ version }}</p>
|
||||
</footer>
|
||||
@ -1,26 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [HomeComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,17 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.css'],
|
||||
})
|
||||
export class HomeComponent {
|
||||
version: string;
|
||||
|
||||
constructor(public auth: AuthService) {
|
||||
this.version = environment.version;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user