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