|
@@ -39,6 +39,7 @@ export class ReviewTraineeDataListComponent implements OnInit {
|
|
|
dataTableNumber: number = 5;
|
|
|
viewTableData: string = 'all';
|
|
|
serviceName: string = '';
|
|
|
+ filtterDepartmentVal: string = 'all';
|
|
|
pages = [];
|
|
|
|
|
|
|
|
@@ -113,24 +114,27 @@ export class ReviewTraineeDataListComponent implements OnInit {
|
|
|
);
|
|
|
|
|
|
//get list data
|
|
|
- this.dashBoardService.getListData(this.pageId, this.currentPage ,this.dataTableNumber).subscribe(
|
|
|
- (responce) => {
|
|
|
- console.log(responce);
|
|
|
- this.dataList = responce['requests'];
|
|
|
+ this.getListData(this.currentPage,
|
|
|
+ this.dataTableNumber ,
|
|
|
+ this.viewTableData,
|
|
|
+ this.filtterDepartmentVal,
|
|
|
+ '').subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ this.dataList = response['requests'];
|
|
|
if(this.dataList.length == 0) {
|
|
|
this.toastr.warning('القائمه فارغه من الطلبات ');
|
|
|
}
|
|
|
- this.count = responce['count'];
|
|
|
- this.perPagePagenation = responce['per_page'];
|
|
|
+ this.count = response['count'];
|
|
|
+ this.perPagePagenation = response['per_page'];
|
|
|
console.log('evennnnts', this.dataList);
|
|
|
this.spinner.hide();
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- console.log(error);
|
|
|
- this.spinner.hide();
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log('error list =>', error);
|
|
|
+ this.spinner.hide();
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
//make all checkbox of user checked
|
|
@@ -152,19 +156,27 @@ export class ReviewTraineeDataListComponent implements OnInit {
|
|
|
console.log(data.target.value);
|
|
|
const dataSearch = data.target.value;
|
|
|
this.currentPage = 1;
|
|
|
- this.dashBoardService.getDataUSerSearchBar(dataSearch, this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
- (responce) => {
|
|
|
- console.log(responce);
|
|
|
- this.dataList = responce['requests'];
|
|
|
- this.count = responce['count'];
|
|
|
- this.perPagePagenation = responce['per_page'];
|
|
|
- console.log('filtter count', this.count);
|
|
|
- console.log('filtter perPagePAgenation', this.perPagePagenation);
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- console.log(error)
|
|
|
- }
|
|
|
- );
|
|
|
+ this.filtterSearch(this.currentPage,
|
|
|
+ this.dataTableNumber ,
|
|
|
+ this.viewTableData,
|
|
|
+ this.filtterDepartmentVal,
|
|
|
+ dataSearch).subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ this.dataList = response['requests'];
|
|
|
+ if(this.dataList.length == 0) {
|
|
|
+ this.toastr.warning('القائمه فارغه من الطلبات ');
|
|
|
+ }
|
|
|
+ this.count = response['count'];
|
|
|
+ this.perPagePagenation = response['per_page'];
|
|
|
+ console.log('evennnnts', this.dataList);
|
|
|
+ this.spinner.hide();
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log('error list =>', error);
|
|
|
+ this.spinner.hide();
|
|
|
+ }
|
|
|
+ )
|
|
|
};
|
|
|
|
|
|
//change page
|
|
@@ -172,22 +184,29 @@ export class ReviewTraineeDataListComponent implements OnInit {
|
|
|
this.spinner.show();
|
|
|
this.currentPage = pagenationNumber;
|
|
|
this.dataList = [];
|
|
|
- //console.log(pagenationNumber);
|
|
|
- //console.log(this.pageId);
|
|
|
- this.dashBoardService.getListData(this.pageId, pagenationNumber, this.dataTableNumber).subscribe(
|
|
|
- (responce) => {
|
|
|
- console.log(responce);
|
|
|
- this.dataList = responce['requests'];
|
|
|
- this.count = responce['count'];
|
|
|
- this.perPagePagenation = responce['per_page'];
|
|
|
- console.log(this.dataList);
|
|
|
- this.spinner.hide();
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- console.log(error);
|
|
|
+ //get list data
|
|
|
+ this.getListData(this.currentPage,
|
|
|
+ this.dataTableNumber ,
|
|
|
+ this.viewTableData,
|
|
|
+ this.filtterDepartmentVal,
|
|
|
+ '').subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ this.dataList = response['requests'];
|
|
|
+ if(this.dataList.length == 0) {
|
|
|
+ this.toastr.warning('القائمه فارغه من الطلبات ');
|
|
|
+ }
|
|
|
+ this.count = response['count'];
|
|
|
+ this.perPagePagenation = response['per_page'];
|
|
|
+ console.log('evennnnts', this.dataList);
|
|
|
this.spinner.hide();
|
|
|
- }
|
|
|
- );
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log('error list =>', error);
|
|
|
+ this.spinner.hide();
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//determine the list count from select element
|
|
@@ -195,109 +214,123 @@ onGetValue(event) {
|
|
|
this.spinner.show();
|
|
|
this.dataList = [];
|
|
|
this.dataTableNumber = event.target.value;
|
|
|
- this.dashBoardService.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
- (responce) => {
|
|
|
- console.log(responce);
|
|
|
- this.dataList = responce['requests'];
|
|
|
- this.count = responce['count'];
|
|
|
- this.perPagePagenation = responce['per_page'];
|
|
|
+ //get list data
|
|
|
+ this.getListData(this.currentPage,
|
|
|
+ this.dataTableNumber ,
|
|
|
+ this.viewTableData,
|
|
|
+ this.filtterDepartmentVal,
|
|
|
+ '').subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ this.dataList = response['requests'];
|
|
|
if(this.dataList.length == 0) {
|
|
|
- this.toastr.warning('لا يوجد بيانات لعرضها');
|
|
|
+ this.toastr.warning('القائمه فارغه من الطلبات ');
|
|
|
}
|
|
|
+ this.count = response['count'];
|
|
|
+ this.perPagePagenation = response['per_page'];
|
|
|
+ console.log('evennnnts', this.dataList);
|
|
|
this.spinner.hide();
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- console.log(error);
|
|
|
- this.spinner.hide();
|
|
|
- }
|
|
|
- );
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log('error list =>', error);
|
|
|
+ this.spinner.hide();
|
|
|
+ }
|
|
|
+ )
|
|
|
};
|
|
|
|
|
|
onFiltterChosen(event) {
|
|
|
this.spinner.show();
|
|
|
this.dataList = [];
|
|
|
console.log(event.target.value);
|
|
|
- console.log(this.authSer.pathApi + '/page_list/' +this.pageId + '/' + this.currentPage + '/' + this.dataTableNumber + '/' + event.target.value);
|
|
|
- this.http.get(this.authSer.pathApi + '/page_list/' +this.pageId + '/' + this.currentPage + '/' + this.dataTableNumber + '/' + event.target.value).subscribe(
|
|
|
- (responce) => {
|
|
|
- console.log(responce);
|
|
|
- console.log(responce);
|
|
|
- this.dataList = responce['requests'];
|
|
|
+ this.viewTableData = event.target.value;
|
|
|
+ //get list data
|
|
|
+ this.getListData(this.currentPage,
|
|
|
+ this.dataTableNumber ,
|
|
|
+ this.viewTableData,
|
|
|
+ this.filtterDepartmentVal,
|
|
|
+ '').subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ this.dataList = response['requests'];
|
|
|
if(this.dataList.length == 0) {
|
|
|
- this.toastr.warning('لا يوجد بيانات لعرضها');
|
|
|
+ this.toastr.warning('القائمه فارغه من الطلبات ');
|
|
|
}
|
|
|
- this.count = responce['count'];
|
|
|
- this.perPagePagenation = responce['per_page'];
|
|
|
+ this.count = response['count'];
|
|
|
+ this.perPagePagenation = response['per_page'];
|
|
|
+ console.log('evennnnts', this.dataList);
|
|
|
this.spinner.hide();
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- console.log(error);
|
|
|
- }
|
|
|
- )
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log('error list =>', error);
|
|
|
+ this.spinner.hide();
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
-
|
|
|
-// onDelete() {
|
|
|
-// for(let i = 0; i < this.dataList.length; i++) {
|
|
|
-// if(this.dataList[i].selected == true) {
|
|
|
-// this.dataListIds.push(this.dataList[i].id);
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
-// console.log(this.dataListIds);
|
|
|
|
|
|
-// if(this.dataListIds.length > 0) {
|
|
|
-// const dialogRef = this.modal.alert()
|
|
|
-// .size('sm')
|
|
|
-// .showClose(true)
|
|
|
-// .title('تأكيد الحذف')
|
|
|
-// .body(`
|
|
|
-// <h4>هل ترغب في حذف العناصر المحدده ؟ </h4>
|
|
|
-// `)
|
|
|
-// .open();
|
|
|
-// dialogRef.result
|
|
|
-// .then( result =>
|
|
|
-// this.dashBoardService.deleteItem(this.dataListIds, this.pageId).subscribe(
|
|
|
-// (responce) => {
|
|
|
-// console.log(responce);
|
|
|
-// this.toastr.success('تم الحذف');
|
|
|
-// this.spinner.show();
|
|
|
-// this.dataList = [];
|
|
|
-// this.dashBoardService.getListData(this.pageId, this.currentPage, this.dataTableNumber).subscribe(
|
|
|
-// (responce) => {
|
|
|
-// console.log(responce);
|
|
|
-// this.dataList = responce['requests'];
|
|
|
-// this.count = responce['count'];
|
|
|
-// this.perPagePagenation = responce['per_page'];
|
|
|
-// this.spinner.hide();
|
|
|
-// },
|
|
|
-// (error) => {
|
|
|
-// console.log(error);
|
|
|
-// this.spinner.hide();
|
|
|
-// }
|
|
|
-// );
|
|
|
-// },
|
|
|
-// (error) => {
|
|
|
-// this.toastr.success('يوجد خطأ إنتظر قليلا وأعد المحاوله ');
|
|
|
-// console.log(error);
|
|
|
-// this.spinner.hide();
|
|
|
-// },
|
|
|
-// )
|
|
|
-// );
|
|
|
-// } else {
|
|
|
-// this.toastr.warning('لم يتم إختيار أي عنصر للمسح !');
|
|
|
-// }
|
|
|
-// };
|
|
|
-
|
|
|
-//add function
|
|
|
-onAdd() {
|
|
|
- console.log('service/' + this.userLoginId + '/' + this.serviceId + '/reviewTraineeData/add');
|
|
|
- this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/reviewTraineeData/add']);
|
|
|
+onFiltterDepartment(event) {
|
|
|
+ console.log(event.target.value);
|
|
|
+ this.filtterDepartmentVal = event.target.value;
|
|
|
+ //get list data
|
|
|
+ this.getListData(this.currentPage,
|
|
|
+ this.dataTableNumber ,
|
|
|
+ this.viewTableData,
|
|
|
+ this.filtterDepartmentVal,
|
|
|
+ '').subscribe(
|
|
|
+ (response) => {
|
|
|
+ console.log(response);
|
|
|
+ this.dataList = response['requests'];
|
|
|
+ if(this.dataList.length == 0) {
|
|
|
+ this.toastr.warning('القائمه فارغه من الطلبات ');
|
|
|
+ }
|
|
|
+ this.count = response['count'];
|
|
|
+ this.perPagePagenation = response['per_page'];
|
|
|
+ console.log('evennnnts', this.dataList);
|
|
|
+ this.spinner.hide();
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
+ console.log('error list =>', error);
|
|
|
+ this.spinner.hide();
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
-//edit function
|
|
|
+
|
|
|
+ //add function
|
|
|
+ onAdd() {
|
|
|
+ console.log('service/' + this.userLoginId + '/' + this.serviceId + '/reviewTraineeData/add');
|
|
|
+ this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/reviewTraineeData/add']);
|
|
|
+ }
|
|
|
+
|
|
|
+ //edit function
|
|
|
onEdit(editNewID) {
|
|
|
- this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/' + 'reviewTraineeData/edit/' + editNewID]);
|
|
|
-}
|
|
|
+ this.router.navigate(['service/' + this.userLoginId + '/' + this.serviceId + '/' + 'reviewTraineeData/edit/' + editNewID]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //function get list
|
|
|
+ getListData(currentPage: number, per_page: number, status: string, department: string, keySearch: string) {
|
|
|
+ return this.http.get(this.authSer.pathApi + '/training_requests_list/'
|
|
|
+ + currentPage + '/'
|
|
|
+ + per_page + '/'
|
|
|
+ + status + '/'
|
|
|
+ + department);
|
|
|
+ }
|
|
|
+
|
|
|
+ //filtter search function
|
|
|
+ filtterSearch(currentPage: number, per_page: number, status: string, department: string, keySearch: string) {
|
|
|
+ console.log(this.authSer.pathApi + '/training_requests_list/'
|
|
|
+ + this.currentPage + '/'
|
|
|
+ + this.dataTableNumber + '/'
|
|
|
+ + this.viewTableData + '/'
|
|
|
+ + this.filtterDepartmentVal + '/' + keySearch);
|
|
|
+
|
|
|
+ return this.http.get(this.authSer.pathApi + '/training_requests_list/'
|
|
|
+ + currentPage + '/'
|
|
|
+ + per_page + '/'
|
|
|
+ + status + '/'
|
|
|
+ + department + '/'
|
|
|
+ + keySearch);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|