Commit 96142935 authored by hasan khaddour's avatar hasan khaddour

add project filter

parent 5fb13678
<div class="modal-header">
<button type="button" class="btn-close" (click)="onClose()" ></button>
<h5 class="modal-title text-center">فلترة المشاريع </h5>
</div>
<div class="modal-body">
<form #form="ngForm" (ngSubmit)="onSubmit()" #projectForm="ngForm">
<div class="row">
<div class="mb-3 col-12 ">
<label for="stepName" class="form-label">اسم رئيس فريق العمل</label>
<input type="text" name="tem" id="tem" class="form-control" [(ngModel)]="request.teamLeaderName" >
</div>
</div>
<div class="row">
<div class="mb-3 ">
<label for="fgdg" class="form-label">اسم الجهة الطارحة</label>
<input type="fgdg" id="fgdg" class="form-control" [(ngModel)]="request.proposerName" name="start" >
</div>
</div>
<div class="row">
<div class="mb-3 col-12">
<label for="worrker" class="form-label">اسم المشروع</label>
<input id="worrker" class="form-control" [(ngModel)]="request.projectName" name="worker" >
</div>
</div>
<div class="row">
<div class="mb-3 col-12">
<label for="duration" class="form-label">القسم المنفذ</label>
<select id="duration" class="form-control select " [(ngModel)]="request.departmentName" name="duration" >
<option *ngFor="let dept of departments" [value]="dept.name">{{dept.name}}</option>
</select>
</div>
</div>
<div class="row ">
<button [disabled]="form.invalid" type="submit" class=" m-4 col-3 btn btn-primary">بحث</button>
<div class="btn m-4 btn-secondary col-3" (click)="onClose()" >إغلاق</div>
</div>
</form>
</div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { Department } from '../../models/responses/department';
import { EmployeesService } from '../../../employees/services/employees.service';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { GetProjecByFilterRequest } from '../../models/requests/project-requests/getProjectAttachmentsRequest';
@Component({
selector: 'filter-modal',
templateUrl: './filter-modal.component.html',
styleUrl: './filter-modal.component.css'
})
export class FilterModalComponent implements OnInit{
departments : Department[]
request : GetProjecByFilterRequest
constructor(
private employeeService :EmployeesService,
private activeModal :NgbActiveModal
) {
}
ngOnInit(): void {
this.request= {
projectName:'',
proposerName:'',
teamLeaderName:'',
departmentName:''
}
this
.employeeService
.getDepartments()
.subscribe({
next:(data)=>{
this.departments=data
}
});
}
onSubmit(){
this
.activeModal
.close(this.request);
}
onClose(){
this.activeModal.close();
}
}
...@@ -3,3 +3,11 @@ export interface GetProjectAttachmentsRequest { ...@@ -3,3 +3,11 @@ export interface GetProjectAttachmentsRequest {
pageNumber: number | null; pageNumber: number | null;
pageSize: number | null; pageSize: number | null;
} }
export class GetProjecByFilterRequest {
projectName :string
teamLeaderName : string
departmentName :string
proposerName : string
}
...@@ -6,17 +6,19 @@ ...@@ -6,17 +6,19 @@
<h2 class="h3 mb-0 page-title"> قائمة المشاريع </h2> <h2 class="h3 mb-0 page-title"> قائمة المشاريع </h2>
</div> </div>
<div class="col-auto"> <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>
</div> </div>
<hr> <hr>
<div *ngIf="projects"> <div *ngIf="projects">
<div class="row" *ngIf="projects.length > 0"> <div class="row" *ngIf="projects.length > 0">
<project-item class="col-4" *ngFor="let project of projects" [project]="project"></project-item> <project-item class="col col-4 " *ngFor="let project of projects" [project]="project"></project-item>
</div> </div>
<div class="row" *ngIf="projects.length == 0"> <div class="row text-center" *ngIf="projects.length == 0">
لا يوجد أي مشروع <strong> لا يوجد أي مشروع </strong>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -6,6 +6,9 @@ import { Project } from '../../models/responses/project'; ...@@ -6,6 +6,9 @@ import { Project } from '../../models/responses/project';
import { ProjectService } from '../../services/project.service'; import { ProjectService } from '../../services/project.service';
import { GetProjectsByProjectManagerRequest, GetProjectsByTeamLeaderRequest } from '../../models/requests/project-requests/GetProjectsByProjectManagerRequest'; import { GetProjectsByProjectManagerRequest, GetProjectsByTeamLeaderRequest } from '../../models/requests/project-requests/GetProjectsByProjectManagerRequest';
import { UserService } from '../../../core/services/authentication/user.service'; import { UserService } from '../../../core/services/authentication/user.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({ @Component({
selector: 'project-list', selector: 'project-list',
...@@ -15,7 +18,7 @@ import { UserService } from '../../../core/services/authentication/user.service' ...@@ -15,7 +18,7 @@ import { UserService } from '../../../core/services/authentication/user.service'
export class ProjectListComponent implements OnInit{ export class ProjectListComponent implements OnInit{
projects : Project[] projects : Project[]
request :GetProjecByFilterRequest
constructor( constructor(
private projectService : ProjectService, private projectService : ProjectService,
...@@ -23,6 +26,7 @@ export class ProjectListComponent implements OnInit{ ...@@ -23,6 +26,7 @@ export class ProjectListComponent implements OnInit{
public router: Router, public router: Router,
private route :ActivatedRoute, private route :ActivatedRoute,
private userService : UserService, private userService : UserService,
private modalService :NgbModal,
private loadingService: LoadingService private loadingService: LoadingService
) { ) {
...@@ -36,9 +40,16 @@ export class ProjectListComponent implements OnInit{ ...@@ -36,9 +40,16 @@ export class ProjectListComponent implements OnInit{
loadProjects():void{ loadProjects():void{
this.loadingService.show() this.loadingService.show()
if(this.request){
this.handleByFilter();
}else {
this.handelAll() this.handelAll()
} }
}
handelAll() { handelAll() {
this.projectService.getByFilter() this.projectService.getByFilter()
...@@ -60,5 +71,49 @@ export class ProjectListComponent implements OnInit{ ...@@ -60,5 +71,49 @@ export class ProjectListComponent implements OnInit{
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) => {
});
}
} }
\ No newline at end of file
...@@ -46,6 +46,7 @@ import { ChangeLeaderModalComponent } from './components/projectModals/change-le ...@@ -46,6 +46,7 @@ import { ChangeLeaderModalComponent } from './components/projectModals/change-le
import { EditStepModalComponent } from './components/step-modals/edit-step-modal/edit-step-modal.component'; import { EditStepModalComponent } from './components/step-modals/edit-step-modal/edit-step-modal.component';
import { EditWeightModalComponent } from './components/step-modals/edit-weight-modal/edit-weight-modal.component'; import { EditWeightModalComponent } from './components/step-modals/edit-weight-modal/edit-weight-modal.component';
import { ProjectBycreterionComponent } from './pages/project-bycreterion/project-bycreterion.component'; import { ProjectBycreterionComponent } from './pages/project-bycreterion/project-bycreterion.component';
import { FilterModalComponent } from './components/filter-modal/filter-modal.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -82,7 +83,8 @@ import { ProjectBycreterionComponent } from './pages/project-bycreterion/project ...@@ -82,7 +83,8 @@ import { ProjectBycreterionComponent } from './pages/project-bycreterion/project
ChangeLeaderModalComponent, ChangeLeaderModalComponent,
EditStepModalComponent, EditStepModalComponent,
EditWeightModalComponent, EditWeightModalComponent,
ProjectBycreterionComponent ProjectBycreterionComponent,
FilterModalComponent
], ],
providers: [ providers: [
ProjectService, ProjectService,
......
...@@ -22,6 +22,7 @@ import { ChangeEmployeeParticipationRequest } from '../models/requests/project-r ...@@ -22,6 +22,7 @@ import { ChangeEmployeeParticipationRequest } from '../models/requests/project-r
import { ParticipationChange } from '../models/responses/participationChange'; import { ParticipationChange } from '../models/responses/participationChange';
import { ProjectCompletion } from '../models/responses/ProjectCompletion'; import { ProjectCompletion } from '../models/responses/ProjectCompletion';
import { EmployeeContribution } from '../models/responses/employeeContribution'; import { EmployeeContribution } from '../models/responses/employeeContribution';
import { GetProjecByFilterRequest } from '../models/requests/project-requests/getProjectAttachmentsRequest';
//#endregion Imports //#endregion Imports
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -43,6 +44,13 @@ export class ProjectService { ...@@ -43,6 +44,13 @@ export class ProjectService {
return this.http.get<Project[]>(this.config.getServerUrl()+ "/Projects/ByFilter"); return this.http.get<Project[]>(this.config.getServerUrl()+ "/Projects/ByFilter");
} }
public getByRequestFilter(request : GetProjecByFilterRequest):Observable<Project[]>{
return this.http.get<Project[]>(this.config.getServerUrl()+ "/Projects/ByFilter",{params:{...request}});
}
public getParticipationChangeHistory(projectId :number ):Observable<ParticipationChange[]>{ public getParticipationChangeHistory(projectId :number ):Observable<ParticipationChange[]>{
return this return this
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<li class="nav-item" *ngIf="hasRole(alroles.SCIENTIFIC_DEPUTY)"> <li class="nav-item" *ngIf="hasRole(alroles.SCIENTIFIC_DEPUTY)">
<a <a
[routerLink]="['/projects']" [routerLink]="['/projects']"
[queryParams]="{ listType: 'all' }"
class="nav-link collapsed" class="nav-link collapsed"
> >
<i class="fe fe-clipboard"></i><span>استعراض المشاريع</span> <i class="fe fe-clipboard"></i><span>استعراض المشاريع</span>
......
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