@@ -37,6 +37,9 @@ export class GroupActionsResolver implements Resolve<Object> {
|
|||||||
return this.groupsService.getGroupCommandTemplate('close');
|
return this.groupsService.getGroupCommandTemplate('close');
|
||||||
case 'Attach Meeting':
|
case 'Attach Meeting':
|
||||||
return this.groupsService.getGroupCalendarTemplate(groupId);
|
return this.groupsService.getGroupCalendarTemplate(groupId);
|
||||||
|
case 'Edit Meeting':
|
||||||
|
const calendarId = route.queryParamMap.get('calendarId');
|
||||||
|
return this.groupsService.getGroupCalendarAndTemplate(groupId, calendarId);
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="groupEditMeetingForm">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Repetition Frequency</mat-label>
|
||||||
|
<mat-select formControlName="frequency">
|
||||||
|
<mat-option *ngFor="let option of frequencyOptions" [value]="option.id">
|
||||||
|
{{ option.value }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="groupEditMeetingForm.controls.frequency.hasError('repeatsOnDay')">
|
||||||
|
Repetition Frequency is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Repetition Interval</mat-label>
|
||||||
|
<mat-select formControlName="interval">
|
||||||
|
<mat-option *ngFor="let interval of repetitionIntervals" [value]="interval">
|
||||||
|
{{ interval }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="groupEditMeetingForm.controls.interval.hasError('repeatsOnDay')">
|
||||||
|
Repeition Interval is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field *ngIf="groupEditMeetingForm.contains('repeatsOnDay')">
|
||||||
|
<mat-label>Repeats on Day</mat-label>
|
||||||
|
<mat-select formControlName="repeatsOnDay" required>
|
||||||
|
<mat-option *ngFor="let day of repeatsOnDays" [value]="day.id">
|
||||||
|
{{ day.value }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="groupEditMeetingForm.controls.repeatsOnDay.hasError('repeatsOnDay')">
|
||||||
|
At least <strong>one</strong> day must be selected
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="m-b-5">
|
||||||
|
<mat-label>Above Changes are Effective from</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="startDatePicker" required formControlName="startDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #startDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="groupEditMeetingForm.controls.startDate.hasError('required')">
|
||||||
|
Changes Affection Date is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
<mat-hint>
|
||||||
|
Note: 'Repeats' and 'Repeats every' cannot not be modified if there are active accounts <br>
|
||||||
|
(JLG Loans, Recurring Deposits etc) dependent on this meeting.
|
||||||
|
</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../../']">Cancel</button>
|
||||||
|
<button mat-raised-button color="primary" [disabled]="!groupEditMeetingForm.valid" (click)="submit()">Submit</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
.container {
|
||||||
|
max-width: 37rem;
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { EditGroupMeetingComponent } from './edit-group-meeting.component';
|
||||||
|
|
||||||
|
describe('EditGroupMeetingComponent', () => {
|
||||||
|
let component: EditGroupMeetingComponent;
|
||||||
|
let fixture: ComponentFixture<EditGroupMeetingComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ EditGroupMeetingComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EditGroupMeetingComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+132
@@ -0,0 +1,132 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { GroupsService } from 'app/groups/groups.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit Group Meetings Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-edit-group-meeting',
|
||||||
|
templateUrl: './edit-group-meeting.component.html',
|
||||||
|
styleUrls: ['./edit-group-meeting.component.scss']
|
||||||
|
})
|
||||||
|
export class EditGroupMeetingComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Group Meeting form. */
|
||||||
|
groupEditMeetingForm: FormGroup;
|
||||||
|
/** Calnedar Template Data */
|
||||||
|
calendarTemplate: any;
|
||||||
|
/** Group Id */
|
||||||
|
groupId: any;
|
||||||
|
/** Repetition Intervals */
|
||||||
|
repetitionIntervals: any[];
|
||||||
|
/** Frequency Options */
|
||||||
|
frequencyOptions: any;
|
||||||
|
/** Repetition Days Data */
|
||||||
|
repeatsOnDays: any;
|
||||||
|
/** CalendarI ID */
|
||||||
|
calendarId: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches Calendar Template from `resolve`
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder
|
||||||
|
* @param {GroupsService} groupsService Shares Service
|
||||||
|
* @param {DatePipe} datePipe Date Pipe
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
* @param {Router} router Router
|
||||||
|
*/
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private groupsService: GroupsService,
|
||||||
|
private datePipe: DatePipe,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router) {
|
||||||
|
this.route.data.subscribe((data: { groupActionData: any }) => {
|
||||||
|
this.calendarTemplate = data.groupActionData;
|
||||||
|
this.frequencyOptions = this.calendarTemplate.frequencyOptions;
|
||||||
|
this.repeatsOnDays = this.calendarTemplate.repeatsOnDayOptions;
|
||||||
|
});
|
||||||
|
this.calendarId = this.route.snapshot.queryParams['calendarId'];
|
||||||
|
this.groupId = this.route.parent.snapshot.params['groupId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.createEditGroupMeetingForm();
|
||||||
|
this.buildDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the Edit Group Meeting form.
|
||||||
|
*/
|
||||||
|
createEditGroupMeetingForm() {
|
||||||
|
this.groupEditMeetingForm = this.formBuilder.group({
|
||||||
|
'startDate': ['', Validators.required],
|
||||||
|
'frequency': ['', Validators.required],
|
||||||
|
'interval': ['', Validators.required]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribes to value changes of controls.
|
||||||
|
*/
|
||||||
|
buildDependencies() {
|
||||||
|
this.groupEditMeetingForm.get('frequency').valueChanges.subscribe((frequency: any) => {
|
||||||
|
this.groupEditMeetingForm.removeControl('repeatsOnDay');
|
||||||
|
switch (frequency) {
|
||||||
|
case 1: // Daily
|
||||||
|
this.repetitionIntervals = ['1', '2', '3'];
|
||||||
|
break;
|
||||||
|
case 2: // Weekly
|
||||||
|
this.repetitionIntervals = ['1', '2', '3'];
|
||||||
|
this.groupEditMeetingForm.addControl('repeatsOnDay', new FormControl('', Validators.required));
|
||||||
|
break;
|
||||||
|
case 3: // Monthly
|
||||||
|
this.repetitionIntervals = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'];
|
||||||
|
break;
|
||||||
|
case 4: // Yearly
|
||||||
|
this.repetitionIntervals = ['1', '2', '3', '4', '5'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.groupEditMeetingForm.patchValue({
|
||||||
|
'startDate': this.calendarTemplate.startDate && new Date(this.calendarTemplate.startDate),
|
||||||
|
'frequency': this.calendarTemplate.frequency.id,
|
||||||
|
'interval': this.calendarTemplate.interval
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and updates the meeting.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
// TODO: Update once language and date settings are setup
|
||||||
|
const locale = 'en';
|
||||||
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
|
const title = `groups_${this.groupId}_CollectionMeeting`;
|
||||||
|
const typeId = '1';
|
||||||
|
const prevStartDate: Date = this.groupEditMeetingForm.value.startDate;
|
||||||
|
this.groupEditMeetingForm.patchValue({
|
||||||
|
startDate: this.datePipe.transform(prevStartDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.groupEditMeetingForm.value,
|
||||||
|
repeating: true,
|
||||||
|
title,
|
||||||
|
typeId,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.groupsService.updateGroupMeeting(this.groupId, data, this.calendarId).subscribe((response: any) => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,3 +4,4 @@
|
|||||||
<mifosx-attach-group-meeting *ngIf="actions['Attach Meeting']"></mifosx-attach-group-meeting>
|
<mifosx-attach-group-meeting *ngIf="actions['Attach Meeting']"></mifosx-attach-group-meeting>
|
||||||
<mifosx-group-attendance *ngIf="actions['Attendance']"></mifosx-group-attendance>
|
<mifosx-group-attendance *ngIf="actions['Attendance']"></mifosx-group-attendance>
|
||||||
<mifosx-manage-group-members *ngIf="actions['Manage Members']"></mifosx-manage-group-members>
|
<mifosx-manage-group-members *ngIf="actions['Manage Members']"></mifosx-manage-group-members>
|
||||||
|
<mifosx-edit-group-meeting *ngIf="actions['Edit Meeting']"></mifosx-edit-group-meeting>
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ export class GroupActionsComponent {
|
|||||||
'Attach Meeting': boolean
|
'Attach Meeting': boolean
|
||||||
'Attendance': boolean
|
'Attendance': boolean
|
||||||
'Manage Members': boolean
|
'Manage Members': boolean
|
||||||
|
'Edit Meeting': boolean
|
||||||
} = {
|
} = {
|
||||||
'Assign Staff': false,
|
'Assign Staff': false,
|
||||||
'Close': false,
|
'Close': false,
|
||||||
'Activate': false,
|
'Activate': false,
|
||||||
'Attach Meeting': false,
|
'Attach Meeting': false,
|
||||||
'Attendance': false,
|
'Attendance': false,
|
||||||
'Manage Members': false
|
'Manage Members': false,
|
||||||
|
'Edit Meeting': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
<div class="group-meeting" fxLayoutAlign="start start">
|
<div class="group-meeting" fxLayoutAlign="start start">
|
||||||
<div *ngIf="groupViewData.collectionMeetingCalendar; else unassigned">
|
<div *ngIf="groupViewData.collectionMeetingCalendar; else unassigned">
|
||||||
<p>
|
<p>
|
||||||
Next Meeting on: {{groupViewData.collectionMeetingCalendar?.recentEligibleMeetingDate | date}}
|
Next Meeting on: {{groupViewData.collectionMeetingCalendar?.nextTenRecurringDates[0] | date}}
|
||||||
<i class="fa fa-calendar"></i><br/>
|
<i class="fa fa-edit" *ngIf="editMeeting" (click)="doAction('Edit Meeting')"></i><br/>
|
||||||
Meeting Frequency: {{groupViewData.collectionMeetingCalendar?.frequency.value | lowercase}}
|
Meeting Frequency: {{groupViewData.collectionMeetingCalendar?.frequency.value | lowercase}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ export class GroupsViewComponent {
|
|||||||
case 'Manage Members':
|
case 'Manage Members':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
|
case 'Edit Meeting':
|
||||||
|
const queryParams: any = { calendarId: this.groupViewData.collectionMeetingCalendar.id };
|
||||||
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route, queryParams: queryParams });
|
||||||
|
break;
|
||||||
case 'Edit':
|
case 'Edit':
|
||||||
this.router.navigate(['edit'], { relativeTo: this.route });
|
this.router.navigate(['edit'], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
@@ -65,6 +69,19 @@ export class GroupsViewComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if meeting is editable.
|
||||||
|
*/
|
||||||
|
get editMeeting() {
|
||||||
|
if (this.groupViewData.collectionMeetingCalendar) {
|
||||||
|
const entityType = this.groupViewData.collectionMeetingCalendar.entityType.value;
|
||||||
|
if (entityType === 'GROUPS' && this.groupViewData.hierarchy === '.' + this.groupViewData.id + '.' ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refetches data for the component
|
* Refetches data for the component
|
||||||
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import { EditGroupComponent } from './edit-group/edit-group.component';
|
|||||||
import { AttachGroupMeetingComponent } from './groups-view/group-actions/attach-group-meeting/attach-group-meeting.component';
|
import { AttachGroupMeetingComponent } from './groups-view/group-actions/attach-group-meeting/attach-group-meeting.component';
|
||||||
import { GroupAttendanceComponent } from './groups-view/group-actions/group-attendance/group-attendance.component';
|
import { GroupAttendanceComponent } from './groups-view/group-actions/group-attendance/group-attendance.component';
|
||||||
import { ManageGroupMembersComponent } from './groups-view/group-actions/manage-group-members/manage-group-members.component';
|
import { ManageGroupMembersComponent } from './groups-view/group-actions/manage-group-members/manage-group-members.component';
|
||||||
|
import { EditGroupMeetingComponent } from './groups-view/group-actions/edit-group-meeting/edit-group-meeting.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Groups Module
|
* Groups Module
|
||||||
@@ -62,7 +63,8 @@ import { ManageGroupMembersComponent } from './groups-view/group-actions/manage-
|
|||||||
EditGroupComponent,
|
EditGroupComponent,
|
||||||
AttachGroupMeetingComponent,
|
AttachGroupMeetingComponent,
|
||||||
GroupAttendanceComponent,
|
GroupAttendanceComponent,
|
||||||
ManageGroupMembersComponent
|
ManageGroupMembersComponent,
|
||||||
|
EditGroupMeetingComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
UnassignRoleDialogComponent,
|
UnassignRoleDialogComponent,
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ export class GroupsService {
|
|||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
*/
|
*/
|
||||||
createGroup(group: any): Observable<any> {
|
createGroup(group: any): Observable<any> {
|
||||||
return this.http.post('/groups', group);
|
return this.http.post('/groups', group);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,6 +242,15 @@ export class GroupsService {
|
|||||||
return this.http.get(`/groups/${groupId}/calendars/template`);
|
return this.http.get(`/groups/${groupId}/calendars/template`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {any} groupId Group Id
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
getGroupCalendarAndTemplate(groupId: any, calendarId: any): Observable<any> {
|
||||||
|
const httpParams = new HttpParams().set('template', 'true');
|
||||||
|
return this.http.get(`/groups/${groupId}/calendars/${calendarId}`, { params: httpParams });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {any} groupId Group Id
|
* @param {any} groupId Group Id
|
||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
@@ -250,6 +259,14 @@ export class GroupsService {
|
|||||||
return this.http.post(`/groups/${groupId}/calendars`, data);
|
return this.http.post(`/groups/${groupId}/calendars`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {any} groupId Group Id
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
updateGroupMeeting(groupId: any, data: any, calendarId: any): Observable<any> {
|
||||||
|
return this.http.put(`/groups/${groupId}/calendars/${calendarId}`, data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {any} groupId Group Id
|
* @param {any} groupId Group Id
|
||||||
* @param {any} calendarId Calendar Id
|
* @param {any} calendarId Calendar Id
|
||||||
|
|||||||
Reference in New Issue
Block a user