implement user, role, product, and task management components along with associated services and UI updates
This commit is contained in:
@@ -87,4 +87,62 @@ export class UsersService {
|
||||
const httpParams = new HttpParams().set('officeId', officeId.toString()).set('status', 'all');
|
||||
return this.http.get('/staff', { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} status Status filter (e.g. 'PENDING')
|
||||
* @param {string} username Username filter
|
||||
* @param {string} fromDate From date filter
|
||||
* @param {string} toDate To date filter
|
||||
* @param {number} offset Offset
|
||||
* @param {number} limit Limit
|
||||
* @returns {Observable<any>} Pending users
|
||||
*/
|
||||
getPendingUsers(
|
||||
status?: string,
|
||||
username?: string,
|
||||
fromDate?: string,
|
||||
toDate?: string,
|
||||
offset: number = 0,
|
||||
limit: number = 20
|
||||
): Observable<any> {
|
||||
let httpParams = new HttpParams().set('offset', offset.toString()).set('limit', limit.toString());
|
||||
if (status) {
|
||||
httpParams = httpParams.set('status', status);
|
||||
}
|
||||
if (username) {
|
||||
httpParams = httpParams.set('username', username);
|
||||
}
|
||||
if (fromDate) {
|
||||
httpParams = httpParams.set('fromDate', fromDate);
|
||||
}
|
||||
if (toDate) {
|
||||
httpParams = httpParams.set('toDate', toDate);
|
||||
}
|
||||
return this.http.get('/users/pending', { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} id Pending request ID
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getPendingUser(id: string | number): Observable<any> {
|
||||
return this.http.get(`/users/pending/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} id Pending request ID
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
approvePendingUser(id: string | number): Observable<any> {
|
||||
return this.http.post(`/users/pending/${id}/approve`, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} id Pending request ID
|
||||
* @param {string} reason Rejection reason
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
rejectPendingUser(id: string | number, reason: string): Observable<any> {
|
||||
return this.http.post(`/users/pending/${id}/reject`, { reason });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user