Compliance done field added to hearings.
Also the compliance list is not based on it and not the compliance date.
This commit is contained in:
parent
78e1ccd756
commit
cd4a091b63
luthor
alembic/versions
luthor
otis/src/app
cases
case-detail
case-detail.component.csscase-detail.component.htmlcase-detail.component.tshearing-dialog.component.htmlhearing-dialog.component.ts
cases.module.tscompliance-list
compliance-list-datasource.tscompliance-list-item.tscompliance-list-resolver.service.tscompliance-list.component.htmlcompliance-list.component.tscompliance-list.module.tscompliance-list.service.tscompliance-list.ts
core
@ -256,6 +256,7 @@ def upgrade():
|
||||
sa.Column("bench", sa.Unicode(length=255), nullable=True),
|
||||
sa.Column("proceedings", sa.Unicode(length=2000), nullable=True),
|
||||
sa.Column("compliance_date", sa.Date(), nullable=True),
|
||||
sa.Column("compliance_done", sa.Boolean(), nullable=False, server_default=expression.true()),
|
||||
sa.Column("next_hearing_date", sa.Date(), nullable=False),
|
||||
sa.Column("court_status_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("old_court_status_id", sa.Integer(), nullable=True),
|
||||
|
@ -1,8 +1,17 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, Date, ForeignKey, Unicode, UniqueConstraint, text
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
Column,
|
||||
Date,
|
||||
ForeignKey,
|
||||
Unicode,
|
||||
UniqueConstraint,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import expression
|
||||
|
||||
from .meta import Base
|
||||
|
||||
@ -28,6 +37,9 @@ class Hearing(Base):
|
||||
next_hearing_date = Column("next_hearing_date", Date, nullable=False, index=True)
|
||||
compliance_date = Column("compliance_date", Date, nullable=False, index=True)
|
||||
court_status_id = Column("court_status_id", UUID(as_uuid=True), ForeignKey("court_statuses.id"), nullable=False)
|
||||
compliance_done = Column(
|
||||
"compliance_done", Boolean, nullable=False, server_default=expression.true(), default=False
|
||||
)
|
||||
|
||||
court_status = relationship("CourtStatus", back_populates="hearings")
|
||||
case = relationship("Case", back_populates="hearings")
|
||||
@ -41,6 +53,7 @@ class Hearing(Base):
|
||||
proceedings=None,
|
||||
compliance_date=None,
|
||||
next_hearing_date=None,
|
||||
compliance_done=None,
|
||||
court_status_id=None,
|
||||
id_=None,
|
||||
):
|
||||
@ -51,5 +64,6 @@ class Hearing(Base):
|
||||
self.bench = bench
|
||||
self.proceedings = proceedings
|
||||
self.compliance_date = compliance_date
|
||||
self.compliance_done = compliance_done
|
||||
self.next_hearing_date = next_hearing_date
|
||||
self.court_status_id = court_status_id
|
||||
|
@ -75,8 +75,9 @@ def save(
|
||||
bench=h.bench,
|
||||
proceedings=h.proceedings,
|
||||
compliance_date=h.compliance_date,
|
||||
compliance_done=h.compliance_done,
|
||||
next_hearing_date=h.next_hearing_date,
|
||||
court_status_id=h.court_status.id_ if h.court_status is not None else None,
|
||||
court_status_id=h.court_status.id_,
|
||||
)
|
||||
for h in data.hearings
|
||||
],
|
||||
@ -152,6 +153,7 @@ def update(
|
||||
h.bench = d.bench
|
||||
h.proceedings = d.proceedings
|
||||
h.compliance_date = d.compliance_date
|
||||
h.compliance_done = d.compliance_done
|
||||
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]:
|
||||
@ -161,8 +163,9 @@ def update(
|
||||
bench=d.bench,
|
||||
proceedings=d.proceedings,
|
||||
compliance_date=d.compliance_date,
|
||||
compliance_done=d.compliance_done,
|
||||
next_hearing_date=d.next_hearing_date,
|
||||
court_status_id=d.court_status.id_ if d.court_status is not None else None,
|
||||
court_status_id=d.court_status.id_,
|
||||
)
|
||||
item.hearings.append(h)
|
||||
db.add(h)
|
||||
@ -298,6 +301,7 @@ def case_info(item: Case) -> schemas.Case:
|
||||
bench=h.bench if h.bench is not None else "",
|
||||
proceedings=h.proceedings if h.proceedings is not None else "",
|
||||
complianceDate=h.compliance_date,
|
||||
complianceDone=h.compliance_date is not None and h.compliance_done,
|
||||
nextHearingDate=h.next_hearing_date,
|
||||
courtStatus=schemas.CourtStatusLink(id=h.court_status.id, name=h.court_status.name),
|
||||
)
|
||||
|
@ -99,6 +99,7 @@ def case_info(item: Case) -> schemas.Case:
|
||||
bench=h.bench if h.bench is not None else "",
|
||||
proceedings=h.proceedings if h.proceedings is not None else "",
|
||||
complianceDate=h.compliance_date,
|
||||
complianceDone=h.compliance_date is None and h.compliance_done,
|
||||
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
|
||||
|
@ -1,4 +1,3 @@
|
||||
from datetime import date, datetime
|
||||
from typing import List
|
||||
|
||||
import luthor.schemas.compliance_list as schemas
|
||||
@ -25,34 +24,29 @@ def get_db():
|
||||
db.close()
|
||||
|
||||
|
||||
@router.get("", response_model=schemas.ComplianceList)
|
||||
@router.get("", response_model=List[schemas.ComplianceList])
|
||||
def report_blank(
|
||||
d: str = None,
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||
) -> schemas.ComplianceList:
|
||||
d = date.today() if d is None else datetime.strptime(d, "%d-%b-%Y").date()
|
||||
return schemas.ComplianceList(
|
||||
date=d,
|
||||
items=get_items(d, db),
|
||||
)
|
||||
) -> List[schemas.ComplianceList]:
|
||||
return get_items(db)
|
||||
|
||||
|
||||
def get_items(d: date, db: Session) -> List[schemas.ComplianceListItem]:
|
||||
def get_items(db: Session) -> List[schemas.ComplianceList]:
|
||||
items = [
|
||||
case_info(item, d)
|
||||
case_info(item)
|
||||
for item in db.query(Case)
|
||||
.join(Case.hearings)
|
||||
.filter(Hearing.compliance_date >= d)
|
||||
.filter(Hearing.compliance_date != None, Hearing.compliance_done == False) # noqa: E712, E711
|
||||
.order_by(Hearing.compliance_date)
|
||||
.all()
|
||||
]
|
||||
return [item for sublist in items for item in sublist]
|
||||
|
||||
|
||||
def case_info(item: Case, date_: date) -> List[schemas.ComplianceListItem]:
|
||||
def case_info(item: Case) -> List[schemas.ComplianceList]:
|
||||
return [
|
||||
schemas.ComplianceListItem(
|
||||
schemas.ComplianceList(
|
||||
id=item.id,
|
||||
officeFileNumber=f"{item.case_source.prefix}-{item.office_file_number}",
|
||||
courtNumber=h.court_number if h.court_number is not None else "",
|
||||
@ -62,5 +56,5 @@ def case_info(item: Case, date_: date) -> List[schemas.ComplianceListItem]:
|
||||
complianceDate=h.compliance_date,
|
||||
)
|
||||
for h in item.hearings
|
||||
if h.compliance_date is not None and h.compliance_date >= date_
|
||||
if h.compliance_date is not None and h.compliance_done is False
|
||||
]
|
||||
|
@ -1,14 +1,13 @@
|
||||
import uuid
|
||||
|
||||
from datetime import date, datetime
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel, validator
|
||||
|
||||
from . import to_camel
|
||||
|
||||
|
||||
class ComplianceListItem(BaseModel):
|
||||
class ComplianceList(BaseModel):
|
||||
id_: uuid.UUID
|
||||
office_file_number: str
|
||||
court_number: str
|
||||
@ -27,19 +26,3 @@ class ComplianceListItem(BaseModel):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
|
||||
class ComplianceList(BaseModel):
|
||||
date_: date
|
||||
items: List[ComplianceListItem]
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
json_encoders = {date: lambda v: v.strftime("%d-%b-%Y")}
|
||||
|
||||
@validator("date_", pre=True)
|
||||
def parse_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
@ -15,6 +15,7 @@ class HearingIn(BaseModel):
|
||||
bench: str
|
||||
proceedings: str
|
||||
compliance_date: Optional[date]
|
||||
compliance_done: bool
|
||||
next_hearing_date: date
|
||||
court_status: Optional[CourtStatusLink]
|
||||
|
||||
|
@ -4,3 +4,12 @@
|
||||
.right-align {
|
||||
text-align: right;
|
||||
}
|
||||
.checkbox-align {
|
||||
align-self: center;
|
||||
}
|
||||
.not-complied {
|
||||
background-color: #f8cbad;
|
||||
}
|
||||
.complied {
|
||||
background-color: #c6e0b4;
|
||||
}
|
||||
|
@ -417,6 +417,20 @@
|
||||
autocomplete="off"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Next Hearing Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="nextHearingDate"
|
||||
placeholder="Next Hearing Date"
|
||||
formControlName="nextHearingDate"
|
||||
autocomplete="off"
|
||||
#nextHearingDateElement
|
||||
(focus)="nextHearingDateElement.select()"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="nextHearingDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nextHearingDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div
|
||||
fxLayout="row"
|
||||
@ -488,20 +502,9 @@
|
||||
<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
|
||||
[matDatepicker]="nextHearingDate"
|
||||
placeholder="Next Hearing Date"
|
||||
formControlName="nextHearingDate"
|
||||
autocomplete="off"
|
||||
#nextHearingDateElement
|
||||
(focus)="nextHearingDateElement.select()"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="nextHearingDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nextHearingDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-checkbox formControlName="complianceDone" class="checkbox-align" fxFlex="40%"
|
||||
>Compliance Done?</mat-checkbox
|
||||
>
|
||||
<button mat-raised-button color="primary" (click)="addHearing()" fxFlex="20%">Add</button>
|
||||
</div>
|
||||
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
|
||||
@ -555,7 +558,11 @@
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
<mat-row
|
||||
*matRowDef="let row; columns: displayedColumns"
|
||||
[class.complied]="row.complianceDate && row.complianceDone"
|
||||
[class.not-complied]="row.complianceDate && !row.complianceDone"
|
||||
></mat-row>
|
||||
</mat-table>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
|
@ -102,6 +102,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
latestStatus: '',
|
||||
proceedings: '',
|
||||
complianceDate: '',
|
||||
complianceDone: '',
|
||||
nextHearingDate: '',
|
||||
}),
|
||||
});
|
||||
@ -360,6 +361,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
const complianceDate = formValue.complianceDate
|
||||
? moment(formValue.complianceDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
const complianceDone = formValue.complianceDone;
|
||||
const nextHearingDate = formValue.nextHearingDate
|
||||
? moment(formValue.nextHearingDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
@ -372,6 +374,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
courtStatus: latestStatus,
|
||||
proceedings,
|
||||
complianceDate,
|
||||
complianceDone,
|
||||
nextHearingDate,
|
||||
}),
|
||||
);
|
||||
@ -387,6 +390,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||
courtStatus: '',
|
||||
proceedings: '',
|
||||
complianceDate: '',
|
||||
complianceDone: '',
|
||||
nextHearingDate: '',
|
||||
});
|
||||
}
|
||||
|
@ -28,6 +28,20 @@
|
||||
autocomplete="off"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Next Hearing Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="nextHearingDate"
|
||||
placeholder="Next Hearing Date"
|
||||
formControlName="nextHearingDate"
|
||||
autocomplete="off"
|
||||
#nextHearingDateElement
|
||||
(focus)="nextHearingDateElement.select()"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="nextHearingDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nextHearingDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div
|
||||
fxLayout="row"
|
||||
@ -83,7 +97,7 @@
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
>
|
||||
<mat-form-field fxFlex="40%">
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Compliance Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
@ -97,20 +111,9 @@
|
||||
<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
|
||||
[matDatepicker]="nextHearingDate"
|
||||
placeholder="Next Hearing Date"
|
||||
formControlName="nextHearingDate"
|
||||
autocomplete="off"
|
||||
#nextHearingDateElement
|
||||
(focus)="nextHearingDateElement.select()"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="nextHearingDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nextHearingDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-checkbox formControlName="complianceDone" class="checkbox-align" fxFlex
|
||||
>Compliance Done?</mat-checkbox
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -26,6 +26,7 @@ export class HearingDialogComponent implements OnInit {
|
||||
latestStatus: '',
|
||||
proceedings: '',
|
||||
complianceDate: '',
|
||||
complianceDone: '',
|
||||
nextHearingDate: '',
|
||||
});
|
||||
}
|
||||
@ -40,6 +41,7 @@ export class HearingDialogComponent implements OnInit {
|
||||
complianceDate: this.data.hearing.complianceDate
|
||||
? moment(this.data.hearing.complianceDate, 'DD-MMM-YYYY').toDate()
|
||||
: '',
|
||||
complianceDone: this.data.hearing.complianceDone,
|
||||
nextHearingDate: this.data.hearing.nextHearingDate
|
||||
? moment(this.data.hearing.nextHearingDate, 'DD-MMM-YYYY').toDate()
|
||||
: '',
|
||||
@ -61,6 +63,7 @@ export class HearingDialogComponent implements OnInit {
|
||||
this.data.hearing.complianceDate = formValue.complianceDate
|
||||
? moment(formValue.complianceDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
this.data.hearing.complianceDone = formValue.complianceDone;
|
||||
this.data.hearing.nextHearingDate = formValue.nextHearingDate
|
||||
? moment(formValue.nextHearingDate).format('DD-MMM-YYYY')
|
||||
: null;
|
||||
|
@ -6,6 +6,7 @@ import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import {
|
||||
DateAdapter,
|
||||
MAT_DATE_FORMATS,
|
||||
@ -55,6 +56,7 @@ export const MY_FORMATS = {
|
||||
MatPaginatorModule,
|
||||
MatDatepickerModule,
|
||||
MatDialogModule,
|
||||
MatCheckboxModule,
|
||||
],
|
||||
declarations: [CaseListComponent, CaseDetailComponent, HearingDialogComponent],
|
||||
providers: [
|
||||
|
@ -4,15 +4,15 @@ import { MatPaginator, PageEvent } from '@angular/material/paginator';
|
||||
import { merge, Observable, of as observableOf } from 'rxjs';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
|
||||
import { ComplianceListItem } from './compliance-list-item';
|
||||
import { ComplianceList } from './compliance-list';
|
||||
|
||||
export class ComplianceListDatasource extends DataSource<ComplianceListItem> {
|
||||
constructor(public data: ComplianceListItem[], private paginator?: MatPaginator) {
|
||||
export class ComplianceListDatasource extends DataSource<ComplianceList> {
|
||||
constructor(public data: ComplianceList[], private paginator?: MatPaginator) {
|
||||
super();
|
||||
}
|
||||
|
||||
connect(): Observable<ComplianceListItem[]> {
|
||||
const dataMutations: (Observable<ComplianceListItem[]> | EventEmitter<PageEvent>)[] = [
|
||||
connect(): Observable<ComplianceList[]> {
|
||||
const dataMutations: (Observable<ComplianceList[]> | EventEmitter<PageEvent>)[] = [
|
||||
observableOf(this.data),
|
||||
];
|
||||
if (this.paginator) {
|
||||
@ -21,18 +21,18 @@ export class ComplianceListDatasource extends DataSource<ComplianceListItem> {
|
||||
|
||||
return merge(...dataMutations)
|
||||
.pipe(
|
||||
tap((x: ComplianceListItem[]) => {
|
||||
tap((x: ComplianceList[]) => {
|
||||
if (this.paginator) {
|
||||
this.paginator.length = x.length;
|
||||
}
|
||||
}),
|
||||
)
|
||||
.pipe(map((x: ComplianceListItem[]) => this.getPagedData(this.data)));
|
||||
.pipe(map((x: ComplianceList[]) => this.getPagedData(this.data)));
|
||||
}
|
||||
|
||||
disconnect() {}
|
||||
|
||||
private getPagedData(data: ComplianceListItem[]) {
|
||||
private getPagedData(data: ComplianceList[]) {
|
||||
if (this.paginator === undefined) {
|
||||
return data;
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
export class ComplianceListItem {
|
||||
id: string;
|
||||
officeFileNumber: string;
|
||||
courtNumber: string;
|
||||
itemNumber: string;
|
||||
title: string;
|
||||
proceedings: string;
|
||||
complianceDate: string;
|
||||
|
||||
public constructor(init?: Partial<ComplianceListItem>) {
|
||||
this.id = '';
|
||||
this.officeFileNumber = '';
|
||||
this.courtNumber = '';
|
||||
this.itemNumber = '';
|
||||
this.title = '';
|
||||
this.proceedings = '';
|
||||
this.complianceDate = '';
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { ComplianceList } from './compliance-list';
|
||||
@ -11,8 +11,7 @@ import { ComplianceListService } from './compliance-list.service';
|
||||
export class ComplianceListResolver implements Resolve<ComplianceList> {
|
||||
constructor(private ser: ComplianceListService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<ComplianceList> {
|
||||
const date = route.queryParamMap.get('date') || null;
|
||||
return this.ser.list(date);
|
||||
resolve(): Observable<ComplianceList> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
|
@ -3,29 +3,6 @@
|
||||
<mat-card-title>Compliances</mat-card-title>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<form [formGroup]="form" fxLayout="column">
|
||||
<div
|
||||
fxLayout="row"
|
||||
fxLayout.lt-md="column"
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
fxLayoutAlign="space-around start"
|
||||
>
|
||||
<mat-form-field fxFlex="60%">
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="date"
|
||||
(focus)="date.open()"
|
||||
placeholder="Date"
|
||||
formControlName="date"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
|
||||
<mat-datepicker #date></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<button mat-raised-button color="primary" (click)="show()" fxFlex="40%">Show</button>
|
||||
</div>
|
||||
</form>
|
||||
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
|
||||
<!-- Office File Number Column -->
|
||||
<ng-container matColumnDef="officeFileNumber">
|
||||
|
@ -14,45 +14,19 @@ import { ComplianceListDatasource } from './compliance-list-datasource';
|
||||
})
|
||||
export class ComplianceListComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
form: FormGroup;
|
||||
info: ComplianceList = new ComplianceList();
|
||||
dataSource: ComplianceListDatasource = new ComplianceListDatasource(this.info.items);
|
||||
info: ComplianceList[] = [];
|
||||
dataSource: ComplianceListDatasource = new ComplianceListDatasource(this.info);
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['officeFileNumber', 'title', 'proceedings', 'complianceDate'];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, private fb: FormBuilder) {
|
||||
// Create form
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
});
|
||||
}
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: ComplianceList };
|
||||
const data = value as { info: ComplianceList[] };
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
});
|
||||
this.dataSource = new ComplianceListDatasource(this.info.items, this.paginator);
|
||||
});
|
||||
}
|
||||
|
||||
show() {
|
||||
const info = this.getInfo();
|
||||
this.router.navigate(['compliance-list'], {
|
||||
queryParams: {
|
||||
date: info.date,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getInfo(): ComplianceList {
|
||||
const formModel = this.form.value;
|
||||
|
||||
return new ComplianceList({
|
||||
date: moment(formModel.date).format('DD-MMM-YYYY'),
|
||||
this.dataSource = new ComplianceListDatasource(this.info, this.paginator);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2,23 +2,12 @@ import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import {
|
||||
DateAdapter,
|
||||
MAT_DATE_FORMATS,
|
||||
MAT_DATE_LOCALE,
|
||||
MatNativeDateModule,
|
||||
} from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
|
||||
import { ComplianceListRoutingModule } from './compliance-list-routing.module';
|
||||
@ -47,17 +36,9 @@ export const MY_FORMATS = {
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
ComplianceListRoutingModule,
|
||||
MatSelectModule,
|
||||
MatPaginatorModule,
|
||||
MatDatepickerModule,
|
||||
MatDialogModule,
|
||||
],
|
||||
declarations: [ComplianceListComponent],
|
||||
providers: [
|
||||
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
|
||||
],
|
||||
})
|
||||
export class ComplianceListModule {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
@ -16,13 +16,9 @@ const serviceName = 'ComplianceListService';
|
||||
export class ComplianceListService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
list(date: string | null): Observable<ComplianceList> {
|
||||
const options = { params: new HttpParams() };
|
||||
if (date !== null) {
|
||||
options.params = options.params.set('d', date);
|
||||
}
|
||||
list(): Observable<ComplianceList> {
|
||||
return this.http
|
||||
.get<ComplianceList>(url, options)
|
||||
.get<ComplianceList>(url)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<ComplianceList>;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,20 @@
|
||||
import { ComplianceListItem } from './compliance-list-item';
|
||||
|
||||
export class ComplianceList {
|
||||
date: string;
|
||||
items: ComplianceListItem[];
|
||||
id: string;
|
||||
officeFileNumber: string;
|
||||
courtNumber: string;
|
||||
itemNumber: string;
|
||||
title: string;
|
||||
proceedings: string;
|
||||
complianceDate: string;
|
||||
|
||||
public constructor(init?: Partial<ComplianceList>) {
|
||||
this.date = '';
|
||||
this.items = [];
|
||||
this.id = '';
|
||||
this.officeFileNumber = '';
|
||||
this.courtNumber = '';
|
||||
this.itemNumber = '';
|
||||
this.title = '';
|
||||
this.proceedings = '';
|
||||
this.complianceDate = '';
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ export class Hearing {
|
||||
courtStatus: CourtStatus;
|
||||
proceedings: string;
|
||||
complianceDate: string | null;
|
||||
complianceDone: boolean;
|
||||
nextHearingDate: string | null;
|
||||
|
||||
public constructor(init?: Partial<Hearing>) {
|
||||
@ -18,6 +19,7 @@ export class Hearing {
|
||||
this.courtStatus = new CourtStatus();
|
||||
this.proceedings = '';
|
||||
this.complianceDate = null;
|
||||
this.complianceDone = true;
|
||||
this.nextHearingDate = null;
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user