Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cpp.ui.core",
"version": "19.0.5",
"version": "19.0.5-CCSPH2.9",
"repository": {
"type": "git",
"url": "https://github.com/hmcts/cpp-ui-core"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
ReferenceDataState
} from '../reducers/index';
import { AsyncPipe, CommonModule } from '@angular/common';
import { RotaBusinessType, RotaBusinessTypeJurisdiction } from '../reference-data.interfaces';
import { Jurisdiction, RotaBusinessType } from '../reference-data.interfaces';
import { sortSelectOptionAlphabetical } from '../utils/sort-select-options-Alphabetical';

@Component({
Expand Down Expand Up @@ -74,7 +74,7 @@ export class RotaBusinessTypeSelectComponent
this._filterBy = fn;
this._buildOptions$.next();
}
@Input() jurisdiction: RotaBusinessTypeJurisdiction | 'ALL' = 'MAGISTRATES';
@Input() jurisdiction: Jurisdiction | 'ALL' = 'MAGISTRATES';
@Output() change = new EventEmitter<SelectChangeEvent>();

@ViewChild(PdkSelectComponent, { static: true }) selectRef!: PdkSelectComponent;
Expand Down
6 changes: 4 additions & 2 deletions projects/reference-data/src/mocks/organisation-unit.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { OrganisationUnit } from '../reference-data.interfaces';
export const organisationUnitMockOne: OrganisationUnit = {
id: '4cc41e45-b594-5ba6-906e-1a4626b08fed',
oucodeL3Code: 'LH',
oucodeL3Name: 'Lark Hill'
oucodeL3Name: 'Lark Hill',
oucodeL1Code: 'B'
};

export const organisationUnitMockTwo: OrganisationUnit = {
id: '3cc41e45-b594-4ba6-906e-1a4626b08fed',
oucodeL3Code: 'LCC',
oucodeL3Name: 'Liverpool Crown Court'
oucodeL3Name: 'Liverpool Crown Court',
oucodeL1Code: 'C'
};
6 changes: 3 additions & 3 deletions projects/reference-data/src/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
referenceData,
ReferenceDataState as ReferenceDataFeatureState
} from './reference-data.reducer';
import { RotaBusinessTypeJurisdiction, RotaBusinessType } from '../reference-data.interfaces';
import { Jurisdiction, RotaBusinessType } from '../reference-data.interfaces';

export interface ReferenceDataState {
referenceData: ReferenceDataFeatureState;
Expand Down Expand Up @@ -83,9 +83,9 @@ export const getRotaBusinessTypes = createSelector(getRotaBusinesTypesState, (ro
);

export const getRotaBusinessTypesByJurisdiction = (
jurisdiction: RotaBusinessTypeJurisdiction | 'ALL'
jurisdiction: Jurisdiction | 'ALL'
): MemoizedSelector<ReferenceDataState, RotaBusinessType[]> =>
defaultMemoize((jurisdiction: RotaBusinessTypeJurisdiction | 'ALL') =>
defaultMemoize((jurisdiction: Jurisdiction | 'ALL') =>
createSelector(
getRotaBusinesTypesState,
(rotaBusinessTypes: RotaBusinessType[] | null | undefined) => {
Expand Down
6 changes: 4 additions & 2 deletions projects/reference-data/src/reference-data.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { UserGroupType } from '@cpp/users-groups';
import { JudiciaryTypePayload, RefDataJudiciaryType } from './helpers/judiciary-type.helper';

export type Jurisdiction = 'MAGISTRATES' | 'CROWN';

export enum BreachType {
GENERIC_BREACH = 'GENERIC_BREACH',
COMMISSION_OF_NEW_OFFENCE_BREACH = 'COMMISSION_OF_NEW_OFFENCE_BREACH',
Expand Down Expand Up @@ -197,7 +199,7 @@ export interface PleaType {
pleaStatusCode: string;
pleaTypeUIFlag: boolean;
pleaValue: string;
jurisdiction: 'MAGISTRATES' | 'CROWN' | 'EITHER';
jurisdiction: Jurisdiction | 'EITHER';
}

export interface PoliceForce {
Expand Down Expand Up @@ -371,7 +373,7 @@ export interface RotaBusinessType {
typeDescription: string;
slot: boolean;
duration: boolean;
jurisdiction?: RotaBusinessTypeJurisdiction;
jurisdiction?: Jurisdiction;
}

export interface WitnessCareUnit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
ResultDefinition,
ReusableInfoDefinitions,
RotaBusinessType,
RotaBusinessTypeJurisdiction,
Jurisdiction,
TrialType,
SelectedJudiciaryOptions,
WitnessCareUnit,
Expand Down Expand Up @@ -224,7 +224,7 @@ export class ReferenceDataService {
}

fetchRotaBusinessTypes(
params: { jurisdiction: RotaBusinessTypeJurisdiction | 'ALL' } = { jurisdiction: 'ALL' }
params: { jurisdiction: Jurisdiction | 'ALL' } = { jurisdiction: 'ALL' }
): Observable<RotaBusinessType[]> {
return this.cppHttp
.query<{ rotaBusinessTypes: RotaBusinessType[] }>({
Expand Down
6 changes: 3 additions & 3 deletions projects/scheduling/src/actions/scheduling.actions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { HearingSlot, SearchHearingSlotsParams } from '../types'; // adjust import if enums are elsewhere
import { HearingSlot, SearchHearingSlotsParams } from '../types';
import { loadHearingSlotsSuccess, resetHearingSlots } from './scheduling.actions';

describe('Scheduling slots actions', () => {
it('Should create a loadHearingSlotsSuccess action', () => {
const params: SearchHearingSlotsParams = {
const params = {
sessionStartDate: '2025-04-10'
};
} as SearchHearingSlotsParams;

const hearingSlots: HearingSlot[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<div class="scheduling-filters-wrapper">
<h2 pdk-typography="heading-medium">Search for a hearing slot</h2>
<form
#form="ngForm"
data-test-id="crownSchedulingFiltersForm"
pdk-form
novalidate
(errors)="errors.emit($event)"
(validSubmit)="handleFiltersSubmit()"
>
<scheduling-filters-court-and-booking
jurisdiction="CROWN"
[formModel]="formModel"
[operationalUnitOptions]="operationalUnitOptions"
[organisationUnitPlaceholder]="organisationUnitPlaceholder"
[filterByOperationalUnit]="filterByOperationalUnit"
[enableMultiDay]="enableMultiDay"
[slotFilterFn]="slotFilterFn"
[durationFilterFn]="durationFilterFn"
(operationalUnitChanged)="handleOperationalUnitChanged($event)"
(courtChanged)="handleCourtChanged()"
(bookingTypeChange)="bookingTypeChange($event)"
(multidayChange)="updateCourtSession($event)"
>
<div schedulingFiltersCourtroom>
<pdk-form-field label="Courtroom">
<pdk-select
[(ngModel)]="formModel.sessionStatusFilter"
(ngModelChange)="handleSessionStatusFilterChange($event)"
name="sessionStatusFilter"
justified
[options]="getCourtroomOptions()"
>
</pdk-select>
</pdk-form-field>
</div>
</scheduling-filters-court-and-booking>

<pdk-grid container>
<pdk-grid one-third>
<pdk-form-field label="Session type">
<pdk-radio-group
name="courtSession"
inline
small
[(ngModel)]="formModel.courtSession"
[options]="courtSessionOptions"
[hidden]="formModel.isMultiday"
>
</pdk-radio-group>
@if (formModel.isMultiday) {
<span style="margin-top: 20px; display: block"> All day </span>
}
</pdk-form-field>
</pdk-grid>
</pdk-grid>

<pdk-grid container>
<pdk-grid one-third>
<pdk-form-field
label="Start date"
[errorMessages]="[
{
rule: 'required',
message: 'Enter a start date'
}
]"
>
<div class="scheduling-filters__start-date">
<pdk-date-input
#sessionStartDate="ngModel"
[(ngModel)]="formModel.sessionStartDate"
name="sessionStartDate"
[minDate]="effectiveMinDate()"
required
picker
>
</pdk-date-input>
<div class="scheduling-filters__start-date-conjunction" pdk-padding-left="2">to</div>
</div>
@if (sessionStartDate.valid && sessionStartDate.value) {
<pdk-inset-text pdk-margin-bottom="0" pdk-margin-top="3" role="status" required>
Selected day:&nbsp;
<span>{{ sessionStartDate.value | date : 'EEEE' }}</span>
</pdk-inset-text>
}
</pdk-form-field>
</pdk-grid>
<pdk-grid one-third>
<pdk-form-field
[errorMessages]="[
{
rule: 'sessionEndDate',
message: 'End date must be later than start date'
}
]"
label="End date"
>
<pdk-date-input
#sessionEndDate="ngModel"
[(ngModel)]="formModel.sessionEndDate"
name="sessionEndDate"
[minDate]="sessionStartDate.value"
picker
data-test-id="sessionEndDate"
>
</pdk-date-input>

@if ( sessionEndDate.value && !sessionEndDate.errors?.dateExists &&
!sessionEndDate.errors?.dateFormat ) {
<pdk-inset-text pdk-margin-bottom="0" pdk-margin-top="3" role="status" required>
Selected day:&nbsp;
<span>{{ sessionEndDate.value | date : 'EEEE' }}</span>
</pdk-inset-text>
}
</pdk-form-field>
</pdk-grid>
</pdk-grid>

<div class="scheduling-filters__form-actions">
<button data-test-id="submit-filters" pdk-button pdk-margin-bottom="0" type="submit">
Search
</button>
<div pdk-margin-left="4">
<a
data-test-id="reset-filters"
href="javascript:void(0)"
pdk-link
(click)="handleResetForm()"
>Reset filters</a
>
</div>
</div>
</form>
</div>
Loading
Loading