Added Compliance date.
Showing the next hearing date in the case list Showing cases on home
This commit is contained in:
parent
08d9e9ab8e
commit
361d012d34
luthor
otis/src/app
@ -255,6 +255,7 @@ def upgrade():
|
||||
sa.Column("item_number", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("bench", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("proceedings", sa.Unicode(length=2000), nullable=True),
|
||||
sa.Column("compliance_date", sa.DateTime(), nullable=True),
|
||||
sa.Column("next_hearing_date", sa.DateTime(), nullable=True),
|
||||
sa.Column("court_status_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_court_status_id", sa.Integer(), nullable=True),
|
||||
|
@ -25,6 +25,7 @@ class Hearing(Base):
|
||||
bench = Column("bench", Unicode(255), nullable=False, unique=True)
|
||||
proceedings = Column("proceedings", Unicode(255), nullable=False, unique=True)
|
||||
next_hearing_date = Column("next_hearing_date", DateTime, nullable=False, index=True)
|
||||
compliance_date = Column("compliance_date", DateTime, nullable=False, index=True)
|
||||
court_status_id = Column("court_status_id", UUID(as_uuid=True), ForeignKey("court_statuses.id"), nullable=True)
|
||||
|
||||
court_status = relationship("CourtStatus", back_populates="hearings")
|
||||
@ -37,6 +38,7 @@ class Hearing(Base):
|
||||
item_number=None,
|
||||
bench=None,
|
||||
proceedings=None,
|
||||
compliance_date=None,
|
||||
next_hearing_date=None,
|
||||
court_status_id=None,
|
||||
id_=None,
|
||||
@ -47,5 +49,6 @@ class Hearing(Base):
|
||||
self.item_number = item_number
|
||||
self.bench = bench
|
||||
self.proceedings = proceedings
|
||||
self.compliance_date = compliance_date
|
||||
self.next_hearing_date = next_hearing_date
|
||||
self.court_status_id = court_status_id
|
||||
|
@ -74,6 +74,7 @@ def save(
|
||||
item_number=h.item_number,
|
||||
bench=h.bench,
|
||||
proceedings=h.proceedings,
|
||||
compliance_date=h.compliance_date,
|
||||
next_hearing_date=h.next_hearing_date,
|
||||
court_status_id=h.court_status.id_ if h.court_status is not None else None,
|
||||
)
|
||||
@ -103,7 +104,7 @@ def update(
|
||||
) -> schemas.Case:
|
||||
try:
|
||||
item: Case = db.query(Case).filter(Case.id == id_).first()
|
||||
item.case_source_id = data.case_source.id_,
|
||||
item.case_source_id = data.case_source.id_
|
||||
item.office_file_number = data.office_file_number
|
||||
item.court_case_number = data.court_case_number
|
||||
item.year = data.year
|
||||
@ -150,6 +151,7 @@ def update(
|
||||
h.item_number = d.item_number
|
||||
h.bench = d.bench
|
||||
h.proceedings = d.proceedings
|
||||
h.compliance_date = d.compliance_date
|
||||
h.next_hearing_date = d.next_hearing_date
|
||||
h.court_status_id = d.court_status.id_ if d.court_status is not None else None
|
||||
for d in [d for d in data.hearings if d.id_ is None]:
|
||||
@ -158,6 +160,7 @@ def update(
|
||||
item_number=d.item_number,
|
||||
bench=d.bench,
|
||||
proceedings=d.proceedings,
|
||||
compliance_date=d.compliance_date,
|
||||
next_hearing_date=d.next_hearing_date,
|
||||
court_status_id=d.court_status.id_ if d.court_status is not None else None,
|
||||
)
|
||||
@ -294,6 +297,7 @@ def case_info(item: Case) -> schemas.Case:
|
||||
itemNumber=h.item_number if h.item_number is not None else "",
|
||||
bench=h.bench if h.bench is not None else "",
|
||||
proceedings=h.proceedings if h.proceedings is not None else "",
|
||||
complianceDate=h.compliance_date,
|
||||
nextHearingDate=h.next_hearing_date,
|
||||
courtStatus=schemas.CourtStatusLink(id=h.court_status.id, name=h.court_status.name)
|
||||
if h.court_status is not None
|
||||
|
@ -14,6 +14,7 @@ class HearingIn(BaseModel):
|
||||
item_number: str
|
||||
bench: str
|
||||
proceedings: str
|
||||
compliance_date: Optional[date]
|
||||
next_hearing_date: Optional[date]
|
||||
court_status: Optional[CourtStatusLink]
|
||||
|
||||
@ -22,6 +23,14 @@ class HearingIn(BaseModel):
|
||||
alias_generator = to_camel
|
||||
json_encoders = {datetime: lambda v: v.strftime("%d-%b-%Y %H:%M"), date: lambda v: v.strftime("%d-%b-%Y")}
|
||||
|
||||
@validator("compliance_date", pre=True)
|
||||
def parse_compliance_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
if value is None:
|
||||
return None
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
@validator("next_hearing_date", pre=True)
|
||||
def parse_next_hearing_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user