Added the office_file_number to case in frontend.
Get new office file number in new case. Convert the office_file_number field in the databse to integer
This commit is contained in:
parent
15f04b4cf1
commit
6e37690736
|
@ -25,7 +25,7 @@ sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/k-offices.csv
|
||||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy offices(old_id, old_department_id, name, address, email) from /mnt/k-offices.csv"'
|
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy offices(old_id, old_department_id, name, address, email) from /mnt/k-offices.csv"'
|
||||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy role_permissions(old_user_id, old_permission_id) from /mnt/l-user-roles.csv"'
|
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy role_permissions(old_user_id, old_permission_id) from /mnt/l-user-roles.csv"'
|
||||||
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/m-cases.csv
|
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/m-cases.csv
|
||||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy cases(old_id, office_file_number, court_case_number, year, title, docket_number, receipt_date, limitation_date, filing_date, appear_on_behalf_of, question_of_law, aor_name, opposing_council_aor, lower_court_case_number, date_of_impugned_judgement, brief_description, remarks, slp_counter, contact_detail, case_connected_with, old_court_id, old_department_id, old_office_id, old_case_type_id, old_act_id, old_nature_id, old_court_status_id, old_office_status_id, opposing_council_detail, bunch_cases) from /mnt/m-cases.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy cases(old_id, old_office_file_number, office_file_number, court_case_number, year, title, docket_number, receipt_date, limitation_date, filing_date, appear_on_behalf_of, question_of_law, aor_name, opposing_council_aor, lower_court_case_number, date_of_impugned_judgement, brief_description, remarks, slp_counter, contact_detail, case_connected_with, old_court_id, old_department_id, old_office_id, old_case_type_id, old_act_id, old_nature_id, old_court_status_id, old_office_status_id, opposing_council_detail, bunch_cases) from /mnt/m-cases.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
||||||
#docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy contacts(old_id, old_office_id, old_department_id, brief, next_hearing_date, court_status_id, court_number, item_number) from /mnt/n-contact-persons.csv"'
|
#docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy contacts(old_id, old_office_id, old_department_id, brief, next_hearing_date, court_status_id, court_number, item_number) from /mnt/n-contact-persons.csv"'
|
||||||
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/o-hearings.csv
|
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/o-hearings.csv
|
||||||
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy hearings(old_id, old_case_id, judges, brief, next_hearing_date, old_court_status_id, court_number, item_number) from /mnt/o-hearings.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy hearings(old_id, old_case_id, judges, brief, next_hearing_date, old_court_status_id, court_number, item_number) from /mnt/o-hearings.csv with delimiter E'\''\t'\'' null as '\'''\''"'
|
||||||
|
|
|
@ -166,7 +166,8 @@ def upgrade():
|
||||||
"cases",
|
"cases",
|
||||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||||
sa.Column("old_id", sa.Integer(), nullable=False),
|
sa.Column("old_id", sa.Integer(), nullable=False),
|
||||||
sa.Column("office_file_number", sa.Unicode(length=255), nullable=False),
|
sa.Column("old_office_file_number", sa.Unicode(length=255), nullable=False),
|
||||||
|
sa.Column("office_file_number", sa.Integer(), nullable=False),
|
||||||
sa.Column("court_case_number", sa.Unicode(length=255), nullable=True),
|
sa.Column("court_case_number", sa.Unicode(length=255), nullable=True),
|
||||||
sa.Column("year", sa.Unicode(length=255), nullable=False),
|
sa.Column("year", sa.Unicode(length=255), nullable=False),
|
||||||
sa.Column("title", sa.Unicode(length=255), nullable=True),
|
sa.Column("title", sa.Unicode(length=255), nullable=True),
|
||||||
|
@ -221,7 +222,6 @@ def upgrade():
|
||||||
["case_source_id"], ["case_sources.id"], name=op.f("fk_cases_case_source_id_case_sources")
|
["case_source_id"], ["case_sources.id"], name=op.f("fk_cases_case_source_id_case_sources")
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_cases")),
|
sa.PrimaryKeyConstraint("id", name=op.f("pk_cases")),
|
||||||
sa.UniqueConstraint("office_file_number", name=op.f("uq_cases_office_file_number")),
|
|
||||||
)
|
)
|
||||||
op.create_index(op.f("ix_cases_date_of_impugned_judgement"), "cases", ["date_of_impugned_judgement"], unique=False)
|
op.create_index(op.f("ix_cases_date_of_impugned_judgement"), "cases", ["date_of_impugned_judgement"], unique=False)
|
||||||
op.create_index(op.f("ix_cases_filing_date"), "cases", ["filing_date"], unique=False)
|
op.create_index(op.f("ix_cases_filing_date"), "cases", ["filing_date"], unique=False)
|
||||||
|
|
|
@ -320,7 +320,7 @@ def add_case_sources():
|
||||||
)
|
)
|
||||||
op.execute(sources.insert().values(name="HLC Cases", prefix="HRC"))
|
op.execute(sources.insert().values(name="HLC Cases", prefix="HRC"))
|
||||||
op.execute(sources.insert().values(name="HUDA Cases", prefix="AHC"))
|
op.execute(sources.insert().values(name="HUDA Cases", prefix="AHC"))
|
||||||
op.execute(sources.insert().values(name="Private Cases", prefix="APC"))
|
op.execute(sources.insert().values(id="08efc7cc-e4a1-4d24-bcba-58ca9bc29994", name="Private Cases", prefix="APC"))
|
||||||
op.execute(sources.insert().values(name="Board & Corp. Cases", prefix="A"))
|
op.execute(sources.insert().values(name="Board & Corp. Cases", prefix="A"))
|
||||||
op.execute(sources.insert().values(name="Opinion Cases", prefix="AOC"))
|
op.execute(sources.insert().values(name="Opinion Cases", prefix="AOC"))
|
||||||
op.execute(sources.insert().values(name="Misc", prefix="Misc"))
|
op.execute(sources.insert().values(name="Misc", prefix="Misc"))
|
||||||
|
@ -329,19 +329,21 @@ def add_case_sources():
|
||||||
|
|
||||||
cases = table(
|
cases = table(
|
||||||
"cases",
|
"cases",
|
||||||
column("office_file_number", sa.Unicode(length=255)),
|
column("old_office_file_number", sa.Unicode(length=255)),
|
||||||
column("case_source_id", postgresql.UUID(as_uuid=True)),
|
column("case_source_id", postgresql.UUID(as_uuid=True)),
|
||||||
)
|
)
|
||||||
op.execute(
|
op.execute(
|
||||||
cases.update(
|
cases.update(
|
||||||
values={
|
values={
|
||||||
"case_source_id": select([sources.c.id]).where(
|
"case_source_id": select([sources.c.id]).where(
|
||||||
cases.c.office_file_number.ilike(sources.c.prefix + "-%")
|
cases.c.old_office_file_number.ilike(sources.c.prefix + "-%")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
op.alter_column('cases', 'case_source_id', existing_type=postgresql.UUID(), nullable=False)
|
op.alter_column('cases', 'case_source_id', existing_type=postgresql.UUID(), nullable=False)
|
||||||
|
op.drop_column("cases", "old_office_file_number")
|
||||||
|
op.create_unique_constraint(op.f("uq_cases_office_file_number"), "cases", ["office_file_number", "case_source_id"])
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
|
|
|
@ -23,3 +23,7 @@ class CaseSource(Base):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
self.id = id_
|
self.id = id_
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def private(cls):
|
||||||
|
return uuid.UUID("08efc7cc-e4a1-4d24-bcba-58ca9bc29994")
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from datetime import date
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import luthor.schemas.case as schemas
|
import luthor.schemas.case as schemas
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||||
from sqlalchemy import desc
|
from luthor.models.case_source import CaseSource
|
||||||
|
from sqlalchemy import desc, func
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
@ -164,13 +166,27 @@ def show_list(db: Session = Depends(get_db), user: UserToken = Depends(get_user)
|
||||||
return [case_info(item) for item in db.query(Case).order_by(desc(Case.receipt_date)).all()]
|
return [case_info(item) for item in db.query(Case).order_by(desc(Case.receipt_date)).all()]
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/id/{case_type_id}", response_model=int)
|
||||||
|
def show_case_type_id(
|
||||||
|
case_type_id: uuid.UUID,
|
||||||
|
db: Session = Depends(get_db),
|
||||||
|
user: UserToken = Security(get_user, scopes=["cases"]),
|
||||||
|
) -> int:
|
||||||
|
code = db.query(func.max(Case.office_file_number)).filter(Case.case_source_id == case_type_id).one()[0]
|
||||||
|
code = 1 if code is None else code + 1
|
||||||
|
return code
|
||||||
|
|
||||||
|
|
||||||
@router.get("/list/{source_id}", response_model=List[schemas.Case])
|
@router.get("/list/{source_id}", response_model=List[schemas.Case])
|
||||||
def show_list_of_source(
|
def show_list_of_source(
|
||||||
source_id: uuid.UUID, db: Session = Depends(get_db), user: UserToken = Depends(get_user)
|
source_id: uuid.UUID, db: Session = Depends(get_db), user: UserToken = Depends(get_user)
|
||||||
) -> List[schemas.Case]:
|
) -> List[schemas.Case]:
|
||||||
return [
|
return [
|
||||||
case_info(item)
|
case_info(item)
|
||||||
for item in db.query(Case).filter(Case.case_source_id == source_id).order_by(desc(Case.receipt_date)).all()
|
for item in db.query(Case)
|
||||||
|
.filter(Case.case_source_id == source_id)
|
||||||
|
.order_by(desc(Case.office_file_number))
|
||||||
|
.all()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,6 +203,9 @@ def show_id(
|
||||||
def case_info(item: Case) -> schemas.Case:
|
def case_info(item: Case) -> schemas.Case:
|
||||||
return schemas.Case(
|
return schemas.Case(
|
||||||
id=item.id,
|
id=item.id,
|
||||||
|
caseSource=schemas.CaseSourceLink(
|
||||||
|
id=item.case_source.id, name=item.case_source.name, prefix=item.case_source.prefix
|
||||||
|
),
|
||||||
officeFileNumber=item.office_file_number if item.office_file_number is not None else "",
|
officeFileNumber=item.office_file_number if item.office_file_number is not None else "",
|
||||||
courtCaseNumber=item.court_case_number if item.court_case_number is not None else "",
|
courtCaseNumber=item.court_case_number if item.court_case_number is not None else "",
|
||||||
year=item.year,
|
year=item.year,
|
||||||
|
@ -229,7 +248,9 @@ def case_info(item: Case) -> schemas.Case:
|
||||||
|
|
||||||
def case_blank() -> schemas.CaseBlank:
|
def case_blank() -> schemas.CaseBlank:
|
||||||
return schemas.CaseBlank(
|
return schemas.CaseBlank(
|
||||||
|
caseSource=schemas.CaseSourceLink(id=CaseSource.private(), name="Private Cases"),
|
||||||
officeFileNumber="",
|
officeFileNumber="",
|
||||||
|
receiptDate=date.today(),
|
||||||
courtCaseNumber="",
|
courtCaseNumber="",
|
||||||
year="",
|
year="",
|
||||||
title="",
|
title="",
|
||||||
|
|
|
@ -7,6 +7,7 @@ from pydantic import BaseModel, Field, validator
|
||||||
|
|
||||||
from . import to_camel
|
from . import to_camel
|
||||||
from .act import ActLink
|
from .act import ActLink
|
||||||
|
from .case_source import CaseSourceLink
|
||||||
from .case_type import CaseTypeLink
|
from .case_type import CaseTypeLink
|
||||||
from .court import CourtLink
|
from .court import CourtLink
|
||||||
from .court_status import CourtStatusLink
|
from .court_status import CourtStatusLink
|
||||||
|
@ -39,6 +40,7 @@ class CaseIn(BaseModel):
|
||||||
case_connected_with: str
|
case_connected_with: str
|
||||||
bunch_cases: str
|
bunch_cases: str
|
||||||
|
|
||||||
|
case_source: CaseSourceLink
|
||||||
court: Optional[CourtLink]
|
court: Optional[CourtLink]
|
||||||
department: Optional[DepartmentLink]
|
department: Optional[DepartmentLink]
|
||||||
office: Optional[OfficeLink]
|
office: Optional[OfficeLink]
|
||||||
|
|
|
@ -32,6 +32,7 @@ class CaseSourceBlank(BaseModel):
|
||||||
class CaseSourceLink(BaseModel):
|
class CaseSourceLink(BaseModel):
|
||||||
id_: uuid.UUID = Field(...)
|
id_: uuid.UUID = Field(...)
|
||||||
name: Optional[str]
|
name: Optional[str]
|
||||||
|
prefix: Optional[str]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
fields = {"id_": "id"}
|
fields = {"id_": "id"}
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
fxLayoutGap="20px"
|
fxLayoutGap="20px"
|
||||||
fxLayoutGap.lt-md="0px"
|
fxLayoutGap.lt-md="0px"
|
||||||
>
|
>
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>Source</mat-label>
|
||||||
|
<mat-select placeholder="Source" formControlName="caseSource">
|
||||||
|
<mat-option *ngFor="let cs of caseSources" [value]="cs.id">
|
||||||
|
{{ cs.name }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex>
|
<mat-form-field fxFlex>
|
||||||
<mat-label>Office File Number</mat-label>
|
<mat-label>Office File Number</mat-label>
|
||||||
<input
|
<input
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { distinctUntilChanged, startWith, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { Act } from '../../core/act';
|
import { Act } from '../../core/act';
|
||||||
import { Case } from '../../core/case';
|
import { Case } from '../../core/case';
|
||||||
|
import { CaseSource } from '../../core/case-source';
|
||||||
import { CaseType } from '../../core/case-type';
|
import { CaseType } from '../../core/case-type';
|
||||||
import { Court } from '../../core/court';
|
import { Court } from '../../core/court';
|
||||||
import { CourtStatus } from '../../core/court-status';
|
import { CourtStatus } from '../../core/court-status';
|
||||||
|
@ -28,6 +29,7 @@ import { CaseService } from '../case.service';
|
||||||
export class CaseDetailComponent implements OnInit, AfterViewInit {
|
export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
|
caseSources: CaseSource[] = [];
|
||||||
caseTypes: CaseType[] = [];
|
caseTypes: CaseType[] = [];
|
||||||
courts: Court[] = [];
|
courts: Court[] = [];
|
||||||
departments: Department[] = [];
|
departments: Department[] = [];
|
||||||
|
@ -45,10 +47,10 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private toaster: ToasterService,
|
private toaster: ToasterService,
|
||||||
private ser: CaseService,
|
private ser: CaseService,
|
||||||
private officeService: OfficeService,
|
|
||||||
) {
|
) {
|
||||||
// Create form
|
// Create form
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
|
caseSource: '',
|
||||||
officeFileNumber: '',
|
officeFileNumber: '',
|
||||||
courtCaseNumber: '',
|
courtCaseNumber: '',
|
||||||
year: '',
|
year: '',
|
||||||
|
@ -85,6 +87,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||||
this.route.data.subscribe((value) => {
|
this.route.data.subscribe((value) => {
|
||||||
const data = value as {
|
const data = value as {
|
||||||
item: Case;
|
item: Case;
|
||||||
|
caseSources: CaseSource[];
|
||||||
caseTypes: CaseType[];
|
caseTypes: CaseType[];
|
||||||
courts: Court[];
|
courts: Court[];
|
||||||
departments: Department[];
|
departments: Department[];
|
||||||
|
@ -93,6 +96,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||||
acts: Act[];
|
acts: Act[];
|
||||||
natures: Nature[];
|
natures: Nature[];
|
||||||
};
|
};
|
||||||
|
this.caseSources = data.caseSources;
|
||||||
this.caseTypes = data.caseTypes;
|
this.caseTypes = data.caseTypes;
|
||||||
this.courts = data.courts;
|
this.courts = data.courts;
|
||||||
this.departments = data.departments;
|
this.departments = data.departments;
|
||||||
|
@ -107,6 +111,7 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||||
showItem(item: Case) {
|
showItem(item: Case) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.form.setValue({
|
this.form.setValue({
|
||||||
|
caseSource: this.item.caseSource.id,
|
||||||
officeFileNumber: this.item.officeFileNumber,
|
officeFileNumber: this.item.officeFileNumber,
|
||||||
courtCaseNumber: this.item.courtCaseNumber,
|
courtCaseNumber: this.item.courtCaseNumber,
|
||||||
year: this.item.year,
|
year: this.item.year,
|
||||||
|
@ -144,11 +149,21 @@ export class CaseDetailComponent implements OnInit, AfterViewInit {
|
||||||
officeStatus: this.item.officeStatus ? this.item.officeStatus.id : '',
|
officeStatus: this.item.officeStatus ? this.item.officeStatus.id : '',
|
||||||
courtStatus: this.item.courtStatus ? this.item.courtStatus.id : '',
|
courtStatus: this.item.courtStatus ? this.item.courtStatus.id : '',
|
||||||
});
|
});
|
||||||
this.offices = (this.form.get('department') as FormControl).valueChanges.pipe(
|
(this.form.get('caseSource') as FormControl).valueChanges
|
||||||
startWith(this.item.department ? this.item.department.id : ''),
|
.pipe(
|
||||||
distinctUntilChanged(),
|
startWith(this.item.caseSource.id),
|
||||||
switchMap((x) => this.officeService.filteredList(x)),
|
distinctUntilChanged(),
|
||||||
);
|
switchMap((x) => this.ser.newOfficeFileNumber(x)),
|
||||||
|
)
|
||||||
|
.subscribe((x) => {
|
||||||
|
if (
|
||||||
|
this.item.officeFileNumber === null ||
|
||||||
|
this.item.officeFileNumber === undefined ||
|
||||||
|
this.item.officeFileNumber === ''
|
||||||
|
) {
|
||||||
|
this.form.patchValue({ officeFileNumber: x });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
<ng-container matColumnDef="officeFileNumber">
|
<ng-container matColumnDef="officeFileNumber">
|
||||||
<mat-header-cell *matHeaderCellDef>File No.</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef>File No.</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"
|
<mat-cell *matCellDef="let row"
|
||||||
><a [routerLink]="['/cases', row.id]">{{ row.officeFileNumber }}</a></mat-cell
|
><a [routerLink]="['/cases', row.id]"
|
||||||
|
>{{ row.caseSource.prefix }}-{{ row.officeFileNumber }}</a
|
||||||
|
></mat-cell
|
||||||
>
|
>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,13 @@ export class CaseListComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.data.subscribe((value) => {
|
this.route.data.subscribe((value) => {
|
||||||
const data = value as { list: Case[]; caseSources: CaseSource[] };
|
const data = value as { caseSources: CaseSource[] };
|
||||||
this.caseSources = data.caseSources;
|
this.caseSources = data.caseSources;
|
||||||
this.list = observableOf(data.list);
|
this.form.setValue({
|
||||||
|
caseSource: '08efc7cc-e4a1-4d24-bcba-58ca9bc29994',
|
||||||
|
});
|
||||||
this.list = (this.form.get('caseSource') as FormControl).valueChanges.pipe(
|
this.list = (this.form.get('caseSource') as FormControl).valueChanges.pipe(
|
||||||
startWith(''),
|
startWith('08efc7cc-e4a1-4d24-bcba-58ca9bc29994'),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
switchMap((x) => this.ser.list(x)),
|
switchMap((x) => this.ser.list(x)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -56,4 +56,12 @@ export class CaseService {
|
||||||
.delete<Case>(`${url}/${id}`, httpOptions)
|
.delete<Case>(`${url}/${id}`, httpOptions)
|
||||||
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<Case>;
|
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<Case>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newOfficeFileNumber(caseTypeId: string): Observable<number> {
|
||||||
|
return this.http
|
||||||
|
.get<number>(`${url}/id/${caseTypeId}`)
|
||||||
|
.pipe(
|
||||||
|
catchError(this.log.handleError(serviceName, `get newOfficeFileNumber=${caseTypeId}`)),
|
||||||
|
) as Observable<number>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ const advocatesRoutes: Routes = [
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
caseSources: CaseSourceListResolver,
|
caseSources: CaseSourceListResolver,
|
||||||
list: CaseListResolver,
|
// list: CaseListResolver,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,7 @@ const advocatesRoutes: Routes = [
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
item: CaseResolver,
|
item: CaseResolver,
|
||||||
|
caseSources: CaseSourceListResolver,
|
||||||
caseTypes: CaseTypeListResolver,
|
caseTypes: CaseTypeListResolver,
|
||||||
courts: CourtListResolver,
|
courts: CourtListResolver,
|
||||||
departments: DepartmentListResolver,
|
departments: DepartmentListResolver,
|
||||||
|
@ -61,6 +62,7 @@ const advocatesRoutes: Routes = [
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
item: CaseResolver,
|
item: CaseResolver,
|
||||||
|
caseSources: CaseSourceListResolver,
|
||||||
caseTypes: CaseTypeListResolver,
|
caseTypes: CaseTypeListResolver,
|
||||||
courts: CourtListResolver,
|
courts: CourtListResolver,
|
||||||
departments: DepartmentListResolver,
|
departments: DepartmentListResolver,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Act } from './act';
|
import { Act } from './act';
|
||||||
|
import { CaseSource } from './case-source';
|
||||||
import { CaseType } from './case-type';
|
import { CaseType } from './case-type';
|
||||||
import { Court } from './court';
|
import { Court } from './court';
|
||||||
import { CourtStatus } from './court-status';
|
import { CourtStatus } from './court-status';
|
||||||
|
@ -9,6 +10,7 @@ import { OfficeStatus } from './office-status';
|
||||||
|
|
||||||
export class Case {
|
export class Case {
|
||||||
id: string | undefined;
|
id: string | undefined;
|
||||||
|
caseSource: CaseSource;
|
||||||
officeFileNumber: string;
|
officeFileNumber: string;
|
||||||
courtCaseNumber: string;
|
courtCaseNumber: string;
|
||||||
year: string;
|
year: string;
|
||||||
|
@ -41,6 +43,7 @@ export class Case {
|
||||||
|
|
||||||
public constructor(init?: Partial<Case>) {
|
public constructor(init?: Partial<Case>) {
|
||||||
this.id = undefined;
|
this.id = undefined;
|
||||||
|
this.caseSource = new CaseSource();
|
||||||
this.officeFileNumber = '';
|
this.officeFileNumber = '';
|
||||||
this.courtCaseNumber = '';
|
this.courtCaseNumber = '';
|
||||||
this.year = '';
|
this.year = '';
|
||||||
|
|
Loading…
Reference in New Issue