Commit 983d0da4 authored by hasan khaddour's avatar hasan khaddour

add filters

parent 96142935
......@@ -6,7 +6,9 @@
<h2 class="h3 mb-0 page-title"> قائمة المشاريع </h2>
</div>
<div class="col-auto">
<button type="button" (click)="this.router.navigate(['projects/create'])" class="btn btn-primary"><span class="fe fe-file-plus fe-12 mr-2"></span>طرح مشروع</button>
<button (click)="openFilter()" class="m-4 btn btn-primary">فلترة</button>
<button type="button" (click)="this.router.navigate(['projects/create'])" class="m-4 btn btn-primary"><span class="fe fe-file-plus fe-12 mr-2"></span>طرح مشروع</button>
</div>
</div>
......@@ -15,9 +17,10 @@
<div class="row" *ngIf="projects.length > 0">
<project-item class="col-4" *ngFor="let project of projects" [project]="project"></project-item>
</div>
<div class="row" *ngIf="projects.length == 0">
لا يوجد أي مشروع
</div>
<div class="row text-center" *ngIf="projects.length == 0">
<strong> لا يوجد أي مشروع </strong>
</div>
</div>
</div>
</div>
......@@ -6,6 +6,9 @@ import { LoadingService } from '../../../core/services/loading/loading-service.s
import { GetProjectsByProjectManagerRequest, GetProjectsByTeamLeaderRequest } from '../../models/requests/project-requests/GetProjectsByProjectManagerRequest';
import { Project } from '../../models/responses/project';
import { ProjectService } from '../../services/project.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { FilterModalComponent } from '../../components/filter-modal/filter-modal.component';
import { GetProjecByFilterRequest } from '../../models/requests/project-requests/getProjectAttachmentsRequest';
@Component({
selector: 'project-bycreterion',
......@@ -15,12 +18,13 @@ import { ProjectService } from '../../services/project.service';
export class ProjectBycreterionComponent {
listType : string
request :GetProjecByFilterRequest
projects : Project[]
constructor(
private projectService : ProjectService,
private toastr: ToastrService,
public router: Router,
private modalService :NgbModal,
private route :ActivatedRoute,
private userService : UserService,
private loadingService: LoadingService
......@@ -112,4 +116,50 @@ export class ProjectBycreterionComponent {
}
handleByFilter() {
this
.projectService
.getByRequestFilter(this.request)
.subscribe(
{
next: (res)=>{
this.projects = res;
this.loadingService.hide()
},
error: (err)=>{
this.toastr.error("لقد حدث خظاء ما");
this.loadingService.hide()
}
}
);
}
openFilter() {
const modalRef = this.modalService.open(FilterModalComponent);
modalRef.result.then(
(data :GetProjecByFilterRequest) => {
if (data ) {
this.request=data;
this.loadProjects();
}
},
(reason) => {
});
}
}
......@@ -20,6 +20,7 @@
<div class="row text-center" *ngIf="projects.length == 0">
<strong> لا يوجد أي مشروع </strong>
</div>
</div>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment