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
14 changes: 7 additions & 7 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
Expand Up @@ -44,7 +44,7 @@
"@ngrx/store-devtools": "12.4.0",
"@ngx-translate/core": "13.0.0",
"@ngx-translate/http-loader": "6.0.0",
"@resgrid/ngx-resgridlib": "^1.1.15",
"@resgrid/ngx-resgridlib": "^1.1.20",
"@sentry/angular": "6.16.1",
"@sentry/tracing": "6.16.1",
"@types/jquery": "3.5.6",
Expand Down
26 changes: 20 additions & 6 deletions src/app/features/calls/pages/edit-call/edit-call.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export class EditCallPage implements AfterViewInit {
.value();

if (units) {
this.selectedGroupName = units[0].groupName;
if (units[0] && units[0].groupName) {
this.selectedGroupName = units[0].groupName;
}

if (!this.selectedGroupName || this.selectedGroupName == "") {
this.selectedGroupName = "No Group";
Expand Down Expand Up @@ -159,7 +161,7 @@ export class EditCallPage implements AfterViewInit {
this.cdr.detectChanges();
});

this.callsState$.subscribe((callsState) => {
this.callsState$.pipe(take(1)).subscribe((callsState) => {
if (callsState && callsState.callToEdit) {
const editCallData = callsState.callToEdit;

Expand All @@ -172,8 +174,8 @@ export class EditCallPage implements AfterViewInit {
this.form["priority"].setValue(editCallData.Priority);
this.form["priority"].patchValue(editCallData.Priority);

this.form["type"].setValue(editCallData.Type);
this.form["type"].patchValue(editCallData.Type);
//this.form["type"].setValue(editCallData.Type);
//this.form["type"].patchValue(editCallData.Type);

this.form["reportingPartyName"].setValue(editCallData.ContactName);
this.form["reportingPartyName"].patchValue(editCallData.ContactName);
Expand Down Expand Up @@ -205,8 +207,20 @@ export class EditCallPage implements AfterViewInit {
this.form["w3w"].setValue(editCallData.What3Words);
this.form["w3w"].patchValue(editCallData.What3Words);

this.form["dispatchOn"].setValue(editCallData.DispatchedOnUtc);
this.form["dispatchOn"].patchValue(editCallData.DispatchedOnUtc);
this.form["dispatchOn"].setValue(editCallData.DispatchedOn);
this.form["dispatchOn"].patchValue(editCallData.DispatchedOn);

this.store
.select(selectHomeState)
.pipe(take(1))
.subscribe((state) => {
const selectedCallType = _.find(state.callTypes, ["Name", editCallData.Type]);

if (selectedCallType) {
this.form["type"].setValue(selectedCallType.Id);
this.form["type"].patchValue(selectedCallType.Id);
}
});

if (editCallData.Latitude && editCallData.Longitude) {
this.setupNewCallMap(parseInt(editCallData.Latitude), parseInt(editCallData.Longitude), 13);
Expand Down
16 changes: 14 additions & 2 deletions src/app/features/home/actions/home.actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Action } from '@ngrx/store';
import { CallFileResultData, CallNoteResultData, CallResultData, DepartmentVoiceResultData, GetCallTemplatesResultData, GpsLocation, MapDataAndMarkersData, UnitStatusResultData } from '@resgrid/ngx-resgridlib';
import { CallExtraDataResultData, CallFileResultData, CallNoteResultData, CallResultData, DepartmentVoiceResultData, GetCallTemplatesResultData, GpsLocation, MapDataAndMarkersData, UnitStatusResultData } from '@resgrid/ngx-resgridlib';
import { Call } from 'src/app/core/models/call';
import { PersonnelForCallResult } from 'src/app/core/models/personnelForCallResult';
import { UnitStatusResult } from 'src/app/core/models/unitStatusResult';
Expand Down Expand Up @@ -86,6 +86,8 @@ export enum HomeActionTypes {
SAVE_PERSONSTAFFING_SUCCESS = '[HOME] SAVE_PERSONSTAFFING_SUCCESS',
SAVE_PERSONSTAFFING_FAIL = '[HOME] SAVE_PERSONSTAFFING_FAIL',
UPDATE_PERSONSTAFFING = '[HOME] UPDATE_PERSONSTAFFING',
SHOW_VIEW_CALL_FORM = '[HOME] SHOW_VIEW_CALL_FORM',
OPEN_VIEW_CALL_FORM = '[HOME] OPEN_VIEW_CALL_FORM',
}

// Home
Expand Down Expand Up @@ -457,6 +459,16 @@ export class UpdatePersonStaffings implements Action {
constructor(public payload: PersonnelForCallResult[]) {}
}

export class ShowViewCallForm implements Action {
readonly type = HomeActionTypes.SHOW_VIEW_CALL_FORM;
constructor(public callId: string) {}
}

export class OpenViewCallForm implements Action {
readonly type = HomeActionTypes.OPEN_VIEW_CALL_FORM;
constructor(public payload: CallExtraDataResultData) {}
}

export class Done implements Action {
readonly type = HomeActionTypes.DONE;
constructor() {}
Expand All @@ -476,5 +488,5 @@ export type HomeActionsUnion = Loading | LoadingSuccess | LoadingFail | LoadingM
OpenCallFormModal | SetNewCallFormData | IsSavingCall | Done | UpdateSelectPerson | OpenSetPersonStatusModal |
OpenSetPersonStaffingModal | SavingPersonStatuses | UpdatePersonStatuses | SavingPersonStaffing | SavingPersonStaffing |
SavingPersonStaffingSuccess | SavingPersonStaffingFail | UpdatePersonStaffings | GetAddressForCoordinates |
GetAddressForCoordinatesSuccess | GetAddressForCoordinatesFail
GetAddressForCoordinatesSuccess | GetAddressForCoordinatesFail | ShowViewCallForm | OpenViewCallForm
;
103 changes: 68 additions & 35 deletions src/app/features/home/effects/home.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import * as _ from "lodash";
import { SetPersonStatusModalComponent } from "../modals/setPersonStatus/setPersonStatus.modal";
import { SetPersonStaffingModalComponent } from "../modals/setPersonStaffing/setPersonStaffing.modal";
import { GeocodingProvider } from "src/app/providers/geocoding";
import { ViewCallFormModalComponent } from "../modals/viewCallForm/view-callForm.modal";

@Injectable()
export class HomeEffects {
Expand Down Expand Up @@ -300,7 +301,7 @@ export class HomeEffects {
ofType<homeAction.GetCoordinatesForAddress>(homeAction.HomeActionTypes.GET_COORDINATESFORADDRESS),
mergeMap((action) =>
//this.locationProvider.getCoordinatesForAddressFromGoogle(action.address).pipe(
this.geocodingProvider.getLocationFromAddress(action.address).pipe(
this.geocodingProvider.getLocationFromAddress(action.address).pipe(
// If successful, dispatch success action with result
map((data) => ({
type: homeAction.HomeActionTypes.GET_COORDINATESFORADDRESS_SUCCESS,
Expand All @@ -321,7 +322,7 @@ export class HomeEffects {
ofType<homeAction.GetAddressForCoordinates>(homeAction.HomeActionTypes.GET_ADDRESSFORCOORDINATES),
mergeMap((action) =>
//this.locationProvider.getCoordinatesForAddressFromGoogle(action.address).pipe(
this.geocodingProvider.getAddressFromLocation(new GpsLocation(parseInt(action.latitude), parseInt(action.longitude))).pipe(
this.geocodingProvider.getAddressFromLocation(new GpsLocation(parseInt(action.latitude), parseInt(action.longitude))).pipe(
// If successful, dispatch success action with result
map((data) => ({
type: homeAction.HomeActionTypes.GET_ADDRESSFORCOORDINATES_SUCCESS,
Expand Down Expand Up @@ -382,25 +383,24 @@ export class HomeEffects {
);

saveCallSuccess$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.SaveCallSuccess>(homeAction.HomeActionTypes.SAVE_CALL_SUCCESS),
mergeMap((action) =>
this.callsProvider.getActiveCalls().pipe(
// If successful, dispatch success action with result
map((data) => ({
type: homeAction.HomeActionTypes.UPDATE_CALLS,
payload: data.Data,
})),
tap((data) => {
this.alertProvider.showAutoCloseSuccessAlert("Call has been saved and dispatched.");
}),
// If request fails, dispatch failed action
catchError(() => of({ type: homeAction.HomeActionTypes.SAVE_CALL_FAIL }))
this.actions$.pipe(
ofType<homeAction.SaveCallSuccess>(homeAction.HomeActionTypes.SAVE_CALL_SUCCESS),
mergeMap((action) =>
this.callsProvider.getActiveCalls().pipe(
// If successful, dispatch success action with result
map((data) => ({
type: homeAction.HomeActionTypes.UPDATE_CALLS,
payload: data.Data,
})),
tap((data) => {
this.alertProvider.showAutoCloseSuccessAlert("Call has been saved and dispatched.");
}),
// If request fails, dispatch failed action
catchError(() => of({ type: homeAction.HomeActionTypes.SAVE_CALL_FAIL }))
)
)
)
)
);

);

@Effect()
getLatestPersonnelData$: Observable<Action> = this.actions$.pipe(
Expand Down Expand Up @@ -617,19 +617,21 @@ export class HomeEffects {
tap((data) => this.closeModal())
);

showSetPersonStatusModal$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.OpenSetPersonStatusModal>(homeAction.HomeActionTypes.OPEN_SETPERSONSTATUSMODAL),
exhaustMap((data) => this.runModal(SetPersonStatusModalComponent, "md"))
),
showSetPersonStatusModal$ = createEffect(
() =>
this.actions$.pipe(
ofType<homeAction.OpenSetPersonStatusModal>(homeAction.HomeActionTypes.OPEN_SETPERSONSTATUSMODAL),
exhaustMap((data) => this.runModal(SetPersonStatusModalComponent, "md"))
),
{ dispatch: false }
);

savePersonnelStatus$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.SavingPersonStatuses>(homeAction.HomeActionTypes.SAVE_PERSONSTATUSES),
mergeMap((action) =>
this.personnelStatusesProvider.savePersonsStatuses({
this.personnelStatusesProvider
.savePersonsStatuses({
UserIds: action.payload.userIds,
Type: action.payload.stateType,
RespondingTo: action.payload.destination,
Expand All @@ -644,7 +646,8 @@ export class HomeEffects {
Speed: "",
Heading: "",
EventId: "",
}).pipe(
})
.pipe(
// If successful, dispatch success action with result
map((data) => ({
type: homeAction.HomeActionTypes.SAVE_PERSONSTATUSES_SUCCESS,
Expand All @@ -665,7 +668,11 @@ export class HomeEffects {
ofType<homeAction.SavingPersonStatusesFail>(homeAction.HomeActionTypes.SAVE_PERSONSTATUSES_FAIL),
tap(async (action) => {
this.closeModal();
this.alertProvider.showErrorAlert("Personnel Status Error", "", "There was an issue trying to set the personnel statuses, please try again.");
this.alertProvider.showErrorAlert(
"Personnel Status Error",
"",
"There was an issue trying to set the personnel statuses, please try again."
);
})
),
{ dispatch: false }
Expand All @@ -691,27 +698,29 @@ export class HomeEffects {
)
);

showSetPersonStaffingModal$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.OpenSetPersonStaffingModal>(homeAction.HomeActionTypes.OPEN_SETPERSONSTAFFINGMODAL),
exhaustMap((data) => this.runModal(SetPersonStaffingModalComponent, "md"))
),
showSetPersonStaffingModal$ = createEffect(
() =>
this.actions$.pipe(
ofType<homeAction.OpenSetPersonStaffingModal>(homeAction.HomeActionTypes.OPEN_SETPERSONSTAFFINGMODAL),
exhaustMap((data) => this.runModal(SetPersonStaffingModalComponent, "md"))
),
{ dispatch: false }
);


savePersonnelStaffing$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.SavingPersonStaffing>(homeAction.HomeActionTypes.SAVE_PERSONSTAFFING),
mergeMap((action) =>
this.personnelStaffingProvider.savePersonsStaffings({
this.personnelStaffingProvider
.savePersonsStaffings({
UserIds: action.payload.userIds,
Type: action.payload.staffingType,
TimestampUtc: action.payload.date.toUTCString().replace("UTC", "GMT"),
Timestamp: action.payload.date.toISOString(),
Note: action.payload.note,
EventId: "",
}).pipe(
})
.pipe(
// If successful, dispatch success action with result
map((data) => ({
type: homeAction.HomeActionTypes.SAVE_PERSONSTAFFING_SUCCESS,
Expand Down Expand Up @@ -746,6 +755,30 @@ export class HomeEffects {
)
);

showViewCallFormModal$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.ShowViewCallForm>(homeAction.HomeActionTypes.SHOW_VIEW_CALL_FORM),
mergeMap((action) =>
this.callsProvider.getCallExtraData(action.callId).pipe(
map((data) => ({
type: homeAction.HomeActionTypes.OPEN_VIEW_CALL_FORM,
payload: data.Data,
}))
)
)
)
);

openViewCallFormModal$ = createEffect(() =>
this.actions$.pipe(
ofType<homeAction.OpenCallFormModal>(homeAction.HomeActionTypes.OPEN_VIEW_CALL_FORM),
exhaustMap((data) => this.runModal(ViewCallFormModalComponent, "md")),
map((data) => ({
type: homeAction.HomeActionTypes.DONE
}))
)
);

done$ = createEffect(
() =>
this.actions$.pipe(
Expand Down
7 changes: 5 additions & 2 deletions src/app/features/home/home.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { CallFormModalComponent } from './modals/callForm/callForm.modal';
import { NgxResgridLibModule } from '@resgrid/ngx-resgridlib';
import { SetPersonStatusModalComponent } from './modals/setPersonStatus/setPersonStatus.modal';
import { SetPersonStaffingModalComponent } from './modals/setPersonStaffing/setPersonStaffing.modal';
import { ViewCallFormModalComponent } from './modals/viewCallForm/view-callForm.modal';

@NgModule({
declarations: [
Expand All @@ -34,7 +35,8 @@ import { SetPersonStaffingModalComponent } from './modals/setPersonStaffing/setP
CallFilesModalComponent,
CallFormModalComponent,
SetPersonStatusModalComponent,
SetPersonStaffingModalComponent
SetPersonStaffingModalComponent,
ViewCallFormModalComponent
],
imports: [
CommonModule,
Expand Down Expand Up @@ -66,7 +68,8 @@ import { SetPersonStaffingModalComponent } from './modals/setPersonStaffing/setP
CallFilesModalComponent,
CallFormModalComponent,
SetPersonStatusModalComponent,
SetPersonStaffingModalComponent
SetPersonStaffingModalComponent,
ViewCallFormModalComponent
]
})
export class HomeModule { }
22 changes: 22 additions & 0 deletions src/app/features/home/modals/viewCallForm/view-callForm.modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div>
<div class="modal-header">
<h5 class="modal-title" id="composemodalTitle">Call Form</h5>
<button type="button" class="close" (click)="dismiss()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div>
<div class="modal-body">
<perfect-scrollbar style="position: relative; height: 345px;">
<div class="row">
<div class="col-md-6">
<div id="fb-reader"></div>
</div>
</div>
</perfect-scrollbar>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="dismiss()">Close</button>
</div>
</div>
Empty file.
Loading