'after saving the add resource form i want to navigate to the month of which the resource plan is saved
Create a resource plan for an upcoming month Save the resource plans You'll get redirected back to resource plan calendar view, but you'll see the current month. You should see the month where the new resource plan was created
public save(): void {
let resourcePlanSub: Observable<any>;
let msg: string;
if (!this.resourcePlan?.valid) {
return;
}
const resourcePlanData: IResourcePlanModel = this.resourcePlan?.value;
resourcePlanData.rooms = resourcePlanData.rooms.map((room: any) => ({ roomUid: room } as IResourcePlanRoomModel));
resourcePlanData.devices = resourcePlanData.devices.map((device: any) => ({ deviceUid: device } as IResourcePlanDeviceModel));
resourcePlanData.humanResources = resourcePlanData.humanResources.map((humanResource: any) =>
({ humanResourceUid: humanResource } as IResourcePlanHumanResourceModel));
const startDate = moment(resourcePlanData.startDate).format('YYYY-MM-DD');
resourcePlanData.startDate = new Date(moment(`${startDate}T${resourcePlanData.startTime}`).format('YYYY-MM-DDTHH:mm:ss'));
resourcePlanData.startTime = moment(resourcePlanData.startDate).utc().format('HH:mm:ss');
const endDate = moment(resourcePlanData.endDate).format('YYYY-MM-DD');
resourcePlanData.endDate = new Date(moment(`${endDate}T${resourcePlanData.endTime}`).format('YYYY-MM-DDTHH:mm:ss'));
resourcePlanData.endTime = moment(resourcePlanData.endDate).utc().format('HH:mm:ss');
if (this.resourcePlanUid === undefined) {
resourcePlanSub = this.resourcePlanService.save(resourcePlanData);
msg = 'Resoure Plan created successfully.';
} else {
resourcePlanSub = this.resourcePlanService.updateResourcePlan(resourcePlanData, this.resourcePlanUid);
msg = 'Resoure Plan updated successfully.';
}
this.$subscription.push(resourcePlanSub.subscribe(() => {
const alertDialog = this.alertDialogService.openDialog('Success', msg);
this.$subscription.push(
alertDialog.afterClosed().subscribe(() => {
this.navigate();
})
public navigate(): void {
this.router.navigate([serviceProductCalendarPath]);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
