feat: add edit center action (#1222)

Fixes: #1221
This commit is contained in:
Muskan Khedia
2020-08-23 21:50:55 +05:30
committed by GitHub
parent a783f92ce1
commit e4791d5761
10 changed files with 438 additions and 182 deletions
+199 -179
View File
@@ -12,6 +12,7 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class CentersService {
/**
* @param {HttpClient} http Http Client to send requests.
*/
@@ -42,209 +43,209 @@ export class CentersService {
return this.http.get('/centers', { params: httpParams });
}
/**
* @param {any} center Center to be created.
* @returns {Observable<any>}
*/
createCenter(center: any): Observable<any> {
return this.http.post('/centers', center);
}
/**
* @param {any} center Center to be created.
* @returns {Observable<any>}
*/
createCenter(center: any): Observable<any> {
return this.http.post('/centers', center);
}
/**
* @param {number} officeId Office Id of office to get staff for.
* @returns {Observable<any>}
*/
getStaff(officeId: number): Observable<any> {
const httpParams = new HttpParams()
.set('officeId', officeId.toString())
.set('staffInSelectedOfficeOnly', 'true');
return this.http.get('/centers/template', { params: httpParams });
}
/**
* @param centerId CenterID
* @returns {Observable<any>} Group Data for Center
*/
getCenterData(centerId: string): Observable<any> {
/**
* @param {number} officeId Office Id of office to get staff for.
* @returns {Observable<any>}
*/
getStaff(officeId: number): Observable<any> {
const httpParams = new HttpParams()
.set('associations', 'groupMembers,collectionMeetingCalendar');
return this.http.get(`/centers/${centerId}`, { params: httpParams } );
}
.set('officeId', officeId.toString())
.set('staffInSelectedOfficeOnly', 'true');
return this.http.get('/centers/template', { params: httpParams });
}
/**
* @param centerId Center ID
* @returns {Observable<any>} Returns the entire details of the Center ID
*/
getCenterSummary(centerId: string): Observable<any> {
const httpParams = new HttpParams().set('R_groupId', centerId)
.set('genericResultSet', 'false');
return this.http.get(`/runreports/GroupSummaryCounts`, { params: httpParams });
}
/**
* @param centerId CenterID
* @returns {Observable<any>} Group Data for Center
*/
getCenterData(centerId: string): Observable<any> {
const httpParams = new HttpParams()
.set('associations', 'groupMembers,collectionMeetingCalendar');
return this.http.get(`/centers/${centerId}`, { params: httpParams } );
}
/**
* @param centerId Center ID
* @returns {Observable<any>} Returns the saving account for that center
*/
getSavingsAccountDetails(centerId: string): Observable<any> {
return this.http.get(`/centers/${centerId}/accounts`);
}
/**
* @param centerId Center ID
* @returns {Observable<any>} Returns the entire details of the Center ID
*/
getCenterSummary(centerId: string): Observable<any> {
const httpParams = new HttpParams().set('R_groupId', centerId)
.set('genericResultSet', 'false');
return this.http.get(`/runreports/GroupSummaryCounts`, { params: httpParams });
}
/**
* @param centerId Center Id
* @returns The notes for particular center
*/
getCenterNotes(centerId: string): Observable<any> {
return this.http.get(`/groups/${centerId}/notes`);
}
/**
* @param centerId Center ID
* @returns {Observable<any>} Returns the saving account for that center
*/
getSavingsAccountDetails(centerId: string): Observable<any> {
return this.http.get(`/centers/${centerId}/accounts`);
}
/**
* Adds a note to the particular Center Id
* @param centerId Center ID
* @param noteData Note Data to be added
* @returns {Observable<any>}
*/
createCenterNote(centerId: string, noteData: any): Observable<any> {
return this.http.post(`/groups/${centerId}/notes`, noteData);
}
/**
* @param centerId Center Id
* @returns The notes for particular center
*/
getCenterNotes(centerId: string): Observable<any> {
return this.http.get(`/groups/${centerId}/notes`);
}
/**
* Edits the Center Note
* @param centerId Center ID
* @param noteId Note ID
* @param noteData Note Data
*/
editCenterNote(centerId: string, noteId: string, noteData: any) {
return this.http.put(`/groups/${centerId}/notes/${noteId}`, noteData);
}
/**
* Adds a note to the particular Center Id
* @param centerId Center ID
* @param noteData Note Data to be added
* @returns {Observable<any>}
*/
createCenterNote(centerId: string, noteData: any): Observable<any> {
return this.http.post(`/groups/${centerId}/notes`, noteData);
}
/**
* Deletes the particular Note
* @param centerId Center ID
* @param noteId Note ID
*/
deleteCenterNote(centerId: string, noteId: string) {
return this.http.delete(`/groups/${centerId}/notes/${noteId}`);
}
/**
* Edits the Center Note
* @param centerId Center ID
* @param noteId Note ID
* @param noteData Note Data
*/
editCenterNote(centerId: string, noteId: string, noteData: any) {
return this.http.put(`/groups/${centerId}/notes/${noteId}`, noteData);
}
/**
* Get Center Datatables
*/
getcenterDatatables() {
const httpParams = new HttpParams().set('apptable', 'm_center');
return this.http.get(`/datatables`, { params: httpParams });
}
/**
* Deletes the particular Note
* @param centerId Center ID
* @param noteId Note ID
*/
deleteCenterNote(centerId: string, noteId: string) {
return this.http.delete(`/groups/${centerId}/notes/${noteId}`);
}
/**
* Get Center Datatable
* @param centerId Center ID
* @param datatableName Datatable Name
*/
getCenterDatatable(centerId: string, datatableName: string) {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.get(`/datatables/${datatableName}/${centerId}`, { params: httpParams });
}
/**
* Get Center Datatables
*/
getcenterDatatables() {
const httpParams = new HttpParams().set('apptable', 'm_center');
return this.http.get(`/datatables`, { params: httpParams });
}
/**
* @param centerId Center Id of center to get add datatable entry for.
* @param datatableName Data Table name.
* @param data Data.
* @returns {Observable<any>}
*/
addCenterDatatableEntry(centerId: string, datatableName: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.post(`/datatables/${datatableName}/${centerId}`, data, { params: httpParams });
}
/**
* Get Center Datatable
* @param centerId Center ID
* @param datatableName Datatable Name
*/
getCenterDatatable(centerId: string, datatableName: string) {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.get(`/datatables/${datatableName}/${centerId}`, { params: httpParams });
}
/**
* @param centerId Center Id of center to get add datatable entry for.
* @param datatableName Data Table name.
* @param data Data.
* @returns {Observable<any>}
*/
editCenterDatatableEntry(centerId: string, datatableName: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.put(`/datatables/${datatableName}/${centerId}`, data, { params: httpParams });
}
/**
* @param centerId Center Id of center to get add datatable entry for.
* @param datatableName Data Table name.
* @param data Data.
* @returns {Observable<any>}
*/
addCenterDatatableEntry(centerId: string, datatableName: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.post(`/datatables/${datatableName}/${centerId}`, data, { params: httpParams });
}
/**
* @param centerId Center Id of center to get add datatable entry for.
* @param datatableName Data Table name.
* @returns {Observable<any>}
*/
deleteDatatableContent(centerId: string, datatableName: string): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.delete(`/datatables/${datatableName}/${centerId}`, { params: httpParams });
}
/**
* @param centerId Center Id of center to get add datatable entry for.
* @param datatableName Data Table name.
* @param data Data.
* @returns {Observable<any>}
*/
editCenterDatatableEntry(centerId: string, datatableName: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.put(`/datatables/${datatableName}/${centerId}`, data, { params: httpParams });
}
/**
* @param {string} centerId Center Id
* @param {string} command Command
* @param {any} data Data
* @returns {Observable<any>}
*/
executeCenterActionCommand(centerId: string, command: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('command', command);
return this.http.post(`/centers/${centerId}`, data, { params: httpParams });
}
/**
* @param centerId Center Id of center to get add datatable entry for.
* @param datatableName Data Table name.
* @returns {Observable<any>}
*/
deleteDatatableContent(centerId: string, datatableName: string): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.delete(`/datatables/${datatableName}/${centerId}`, { params: httpParams });
}
/**
* @param {string} centerId Center Id
* @param {string} command Command
* @param {any} data Data
* @returns {Observable<any>}
*/
executeGroupActionCommand(centerId: string, command: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('command', command);
return this.http.post(`/groups/${centerId}`, data, { params: httpParams });
}
/**
* @param {string} centerId Center Id
* @param {string} command Command
* @param {any} data Data
* @returns {Observable<any>}
*/
executeCenterActionCommand(centerId: string, command: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('command', command);
return this.http.post(`/centers/${centerId}`, data, { params: httpParams });
}
/**
* @param centerId Center Id of center to get data for.
* @returns {Observable<any>} Center data.
*/
getGroupStaffData(centerId: string): Observable<any> {
const httpParams = new HttpParams().set('groupOrCenter', 'centers')
.set('staffInSelectedOfficeOnly', 'true')
.set('template', 'true');
return this.http.get(`/groups/${centerId}`, { params: httpParams });
}
/**
* @param {string} centerId Center Id
* @param {string} command Command
* @param {any} data Data
* @returns {Observable<any>}
*/
executeGroupActionCommand(centerId: string, command: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('command', command);
return this.http.post(`/groups/${centerId}`, data, { params: httpParams });
}
deleteCenter(centerId: any): Observable<any> {
return this.http.delete(`/centers/${centerId}`);
}
/**
* @param centerId Center Id of center to get data for.
* @returns {Observable<any>} Center data.
*/
getGroupStaffData(centerId: string): Observable<any> {
const httpParams = new HttpParams().set('groupOrCenter', 'centers')
.set('staffInSelectedOfficeOnly', 'true')
.set('template', 'true');
return this.http.get(`/groups/${centerId}`, { params: httpParams });
}
getCentersData(centerId: string, associations: string, template?: string) {
let httpParams = new HttpParams().set('associations', associations);
httpParams = template ? httpParams.set('template', template) : httpParams;
return this.http.get(`/centers/${centerId}`, {params: httpParams});
}
deleteCenter(centerId: any): Observable<any> {
return this.http.delete(`/centers/${centerId}`);
}
getMeetingsTemplate(centerId: any, calendarId: any): Observable<any> {
const httpParams = new HttpParams().set('calenderId', calendarId);
return this.http.get(`/centers/${centerId}/meetings/template`);
}
getCentersData(centerId: string, associations: string, template?: string) {
let httpParams = new HttpParams().set('associations', associations);
httpParams = template ? httpParams.set('template', template) : httpParams;
return this.http.get(`/centers/${centerId}`, {params: httpParams});
}
assignCenterAttendance(centerId: any, calendarId: any, data: any): Observable<any> {
const httpParams = new HttpParams().set('calenderId', calendarId);
return this.http.post(`/centers/${centerId}/meetings`, data, {params: httpParams});
}
getMeetingsTemplate(centerId: any, calendarId: any): Observable<any> {
const httpParams = new HttpParams().set('calenderId', calendarId);
return this.http.get(`/centers/${centerId}/meetings/template`);
}
getCalendarTemplate(centerId: any): Observable<any> {
return this.http.get(`/centers/${centerId}/calendars/template`);
}
assignCenterAttendance(centerId: any, calendarId: any, data: any): Observable<any> {
const httpParams = new HttpParams().set('calenderId', calendarId);
return this.http.post(`/centers/${centerId}/meetings`, data, {params: httpParams});
}
createCenterMeeting(centerId: any, data: any): Observable<any> {
return this.http.post(`/centers/${centerId}/calendars`, data);
}
getCalendarTemplate(centerId: any): Observable<any> {
return this.http.get(`/centers/${centerId}/calendars/template`);
}
getCalendarAndTemplate(centerId: any, calendarId: any): Observable<any> {
const httpParams = new HttpParams().set('template', 'true');
return this.http.get(`/centers/${centerId}/calendars/${calendarId}`, { params: httpParams });
}
createCenterMeeting(centerId: any, data: any): Observable<any> {
return this.http.post(`/centers/${centerId}/calendars`, data);
}
updateCenterMeeting(centerId: any, data: any, calendarId: any): Observable<any> {
return this.http.put(`/centers/${centerId}/calendars/${calendarId}`, data);
}
getCalendarAndTemplate(centerId: any, calendarId: any): Observable<any> {
const httpParams = new HttpParams().set('template', 'true');
return this.http.get(`/centers/${centerId}/calendars/${calendarId}`, { params: httpParams });
}
updateCenterMeeting(centerId: any, data: any, calendarId: any): Observable<any> {
return this.http.put(`/centers/${centerId}/calendars/${calendarId}`, data);
}
/**
* Run Report Data for Staff Assignement History.
@@ -260,4 +261,23 @@ export class CentersService {
return this.http.get(`/runreports/${reportName}`, { responseType: 'arraybuffer', observe: 'response', params: httpParams });
}
/**
* @param centerId Center Id of center to get data for.
* @returns {Observable<any>} Center data and template.
*/
getCenterAndTemplateData(centerId: string): Observable<any> {
const httpParams = new HttpParams().set('staffInSelectedOfficeOnly', 'true')
.set('template', 'true');
return this.http.get(`/centers/${centerId}`, { params: httpParams });
}
/**
* @param centerId Center Id.
* @param data Data to be submitted
* @returns {Observable<any>} Returns the change.
*/
executeEditCenter(centerId: string, data: any): Observable<any> {
return this.http.put(`/groups/${centerId}`, data);
}
}