Commit 3c7b981a authored by hasan khaddour's avatar hasan khaddour

add project manager and leader change

parent cdc26eca
......@@ -14,7 +14,7 @@
<span class="fe fe-credit-card fe-16 text-white"></span>
</div>
<div class="flex-fill ml-4 fname">
<strong> إدارة المراحل</strong><br />
<strong> المراحل</strong><br />
</div>
</div>
</div>
......@@ -64,7 +64,9 @@
</div>
<!-- .row -->
</div>
<div class="col-md-6 col-lg-4" >
<div class="col-md-6 col-lg-4" (click)="onChangeManger()">
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
......@@ -78,7 +80,8 @@
</div> <!-- .card-body -->
</div> <!-- .card -->
</div>
<div class="col-md-6 col-lg-4" >
<div class="col-md-6 col-lg-4" (click)="onChangeLeader()">
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
......
import { Component, Input } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Project } from '../../../models/responses/project';
@Component({
......@@ -7,5 +7,16 @@ import { Project } from '../../../models/responses/project';
styleUrl: './info-controll.component.css'
})
export class InfoControllComponent {
@Input() project : Project
@Input() project : Project
@Output() changeLeader = new EventEmitter<void>()
@Output() changeManager = new EventEmitter<void>()
onChangeManger(){
this.changeManager.emit();
}
onChangeLeader(){
this.changeLeader.emit();
}
}
......@@ -7,7 +7,7 @@
class="col-md-6 col-lg-4"
[routerLink]="['/reports/definition/', project.id]"
>
<div class="card shadow mb-4">
<div class="card shadow mb-4" >
<div class="card-body file-list">
<div class="d-flex align-items-center">
<div class="circle circle-md bg-secondary">
......@@ -46,7 +46,7 @@
class="col-md-6 col-lg-4"
>
<div class="card shadow mb-4">
<div class="card shadow mb-4" [routerLink]="['/reports/completion',project.id]">
<div class="card-body file-list">
<div class="d-flex align-items-center">
<div class="circle circle-md bg-secondary">
......@@ -63,7 +63,7 @@
</div>
<!-- .row -->
</div>
<div class="col-md-6 col-lg-4" >
<div class="col-md-6 col-lg-4" [routerLink]="['/rerports/history',project.id]">
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
......@@ -71,26 +71,10 @@
<span class="fe fe-map fe-16 text-white"></span>
</div>
<div class="flex-fill ml-4 fname">
<strong>بطاقة الانشغالية </strong><br />
<strong>بطاقة تاريخ متابعة </strong><br />
</div>
</div>
</div> <!-- .card-body -->
</div> <!-- .card -->
</div>
<div class="col-md-6 col-lg-4" >
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
<div class="circle circle-md bg-secondary">
<span class="fe fe-map fe-16 text-white"></span>
</div>
<div class="flex-fill ml-4 fname">
<strong>بطاقة متابعة المراحل</strong><br />
</div>
</div>
</div> <!-- .card-body -->
</div> <!-- .card -->
</div>
</div>
\ No newline at end of file
\ No newline at end of file
......@@ -18,7 +18,7 @@
</div> <!-- .card-body -->
</div> <!-- .card -->
</div>
<div class="col-md-6 col-lg-4" (click)="onComplete()" >
<div class="col-md-6 col-lg-4" *ngIf="project.currentState.toLowerCase()=='inplan'" (click)="onComplete()" >
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
......
<div class="modal-header">
<h5 class="modal-title" id="addEmployeeTrackModalLable">تغيير مدير المشروع</h5>
<button type="button" class="mr-4 ml-4 btn-close" (click)="onClose()"></button>
</div>
<div class="modal-body">
<form [formGroup]="employeeForm" (ngSubmit)="onSubmit()">
<div class="row ">
<div class="mb-3 col-8 offset-2 ">
<label for="hiastIdM" class="form-label">الرقم الذاتي لرئيس فريق العمل للجديد</label>
<input id="hiastIdM" formControlName="employee"
class="form-control"
[ngbTypeahead]="searchEmployees"
[inputFormatter]="employeeFormatter"
[resultFormatter]="employeeFormatter"
(selectItem)="onStepSelected($event.item)">
</div>
</div>
<div class="row ">
<div class="mb-3 col-8 offset-2 ">
<label class="form-label">رئيس فريق العمل القديم </label>
<label class="form-label">{{project.teamLeader.personalInfo | fullname }} </label>
</div>
</div>
<button type="submit" class="btn mr-4 ml-4 btn-primary" [disabled]="!employeeForm.valid">تغيير </button>
<button data-bs-dismiss="modal" aria-label="Close" class=" mr-4 ml-4 btn btn-primary" >إلغاء</button>
</form>
</div>
import { Component, Input } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
import { Observable, debounceTime, distinctUntilChanged, map } from 'rxjs';
import { Employee } from '../../../../employees/models/responses/employee';
import { EmployeesService } from '../../../../employees/services/employees.service';
import { ChangeProjectManagerRequest } from '../../../models/requests/project-requests/ChangeProjectManagerRequest';
import { Project } from '../../../models/responses/project';
import { ProjectService } from '../../../services/project.service';
import { ChangeProjectTeamLeaderRequest } from '../../../models/requests/project-requests/ChangeProjectTeamLeaderRequest';
@Component({
selector: 'change-leader-modal',
templateUrl: './change-leader-modal.component.html',
styleUrl: './change-leader-modal.component.css'
})
export class ChangeLeaderModalComponent {
@Input() project :Project
employees :Employee[]
request : ChangeProjectTeamLeaderRequest
employeeForm: FormGroup;
constructor(
private fb :FormBuilder,
private projectService :ProjectService ,
private employeeService :EmployeesService,
private toastr :ToastrService,
private activeModal :NgbActiveModal
){}
ngOnInit(): void {
this.employeeForm = this.fb.group({
employee: [],
})
this
.employeeService
.getAvailableEmployees()
.subscribe({
next: (data)=> {
console.log(data)
this.employees=data
}
})
}
onClose() {
this.activeModal.close();
}
onSubmit(){
this.request= {
projectId:this.project.id ,
employeeId:this.employeeForm.value.employee.id
}
this
.projectService
.changeTeamLeader(this.request)
.subscribe({
next : (data)=>{
this
.toastr
.success('تم تغيير رئيس فريق العمل بنجاح');
},
error:(err)=>{
this
.toastr
.error('لقد حدث خطاء ما');
}
});
}
searchEmployees = (text$: Observable<string>) =>
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
map((term) =>
term.length < 1
? []
: this.employees
.filter((v) => v.hiastId.toString().toLowerCase().includes(term.toLowerCase()))
.slice(0, 10)
)
)
onStepSelected(step: Employee): void {
this.employeeForm.patchValue({ employeeId: step.id });
}
employeeFormatter = (result: any) :string=> {
if(result == undefined){
return ''
}
return ` ${result.hiastId} - ${result.personalInfo.firstName } ${result.personalInfo.lastName}`;
}
}
<div class="modal-header">
<h5 class="modal-title" id="addEmployeeTrackModalLable">تغيير مدير المشروع</h5>
<button type="button" class="mr-4 ml-4 btn-close" (click)="onClose()"></button>
</div>
<div class="modal-body">
<form [formGroup]="employeeForm" (ngSubmit)="onSubmit()">
<div class="row ">
<div class="mb-3 col-8 offset-2 ">
<label for="hiastIdM" class="form-label">الرقم الذاتي للمدير للجديد</label>
<input id="hiastIdM" formControlName="employee"
class="form-control"
[ngbTypeahead]="searchEmployees"
[inputFormatter]="employeeFormatter"
[resultFormatter]="employeeFormatter"
(selectItem)="onStepSelected($event.item)">
</div>
</div>
<div class="row ">
<div class="mb-3 col-8 offset-2 ">
<label class="form-label">المدير القديم </label>
<label class="form-label">{{project.projectManager.personalInfo | fullname }} ,{{project.projectManager.email }} </label>
</div>
</div>
<button type="submit" class="btn mr-4 ml-4 btn-primary" [disabled]="!employeeForm.valid">تغيير </button>
<button data-bs-dismiss="modal" aria-label="Close" class=" mr-4 ml-4 btn btn-primary" >إلغاء</button>
</form>
</div>
import { Component, Input, OnInit } from '@angular/core';
import { Project } from '../../../models/responses/project';
import { ChangeProjectManagerRequest } from '../../../models/requests/project-requests/ChangeProjectManagerRequest';
import { ProjectService } from '../../../services/project.service';
import { EmployeesService } from '../../../../employees/services/employees.service';
import { ToastrService } from 'ngx-toastr';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { debounceTime, distinctUntilChanged, map, Observable } from 'rxjs';
import { Employee } from '../../../../employees/models/responses/employee';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'change-manager-modal',
templateUrl: './change-manager-modal.component.html',
styleUrl: './change-manager-modal.component.css'
})
export class ChangeManagerModalComponent implements OnInit{
@Input() project :Project
employees :Employee[]
request : ChangeProjectManagerRequest
employeeForm: FormGroup;
constructor(
private fb :FormBuilder,
private projectService :ProjectService ,
private employeeService :EmployeesService,
private toastr :ToastrService,
private activeModal :NgbActiveModal
){}
ngOnInit(): void {
this.employeeForm = this.fb.group({
employee: [],
})
this
.employeeService
.getAvailableEmployees()
.subscribe({
next: (data)=> {
console.log(data)
this.employees=data
}
})
}
onClose() {
this.activeModal.close();
}
onSubmit(){
debugger
this.request= {
projectId:this.project.id ,
employeeId:this.employeeForm.value.employee.id
}
this
.projectService
.changeProjectManager(this.request)
.subscribe({
next : (data)=>{
this
.toastr
.success('تم تغيير مدير المشروع بنجاح');
},
error:(err)=>{
this
.toastr
.error('لقد حدث خطاء ما');
}
});
}
searchEmployees = (text$: Observable<string>) =>
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
map((term) =>
term.length < 1
? []
: this.employees
.filter((v) => v.hiastId.toString().toLowerCase().includes(term.toLowerCase()))
.slice(0, 10)
)
)
onStepSelected(step: Employee): void {
this.employeeForm.patchValue({ employeeId: step.id });
//this.stepTrackForm.patchValue({id: step.id});
}
employeeFormatter = (result: any) :string=> {
if(result == undefined){
return ''
}
return ` ${result.hiastId} - ${result.personalInfo.firstName } ${result.personalInfo.lastName}`;
}
}
......@@ -30,6 +30,7 @@ export class ProjectCompleteModalComponent {
}
onClose() {
this.activeModal.close();
}
......
......@@ -79,7 +79,7 @@
<track-controll
[project]="project"
(complete)="openProjectComplete()"
(replan)="openRepan()"
(replan)="openReplan()"
>
</track-controll>
......@@ -89,6 +89,9 @@
<info-controll
[project]="project"
(changeLeader)="openChangeTeamLeader()"
(changeManager)="openChangeProjectManager()"
>
</info-controll>
......
......@@ -9,6 +9,8 @@ import { NgModel } from '@angular/forms';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ProjectCompleteModalComponent } from '../../components/projectModals/project-complete-modal/project-complete-modal.component';
import { ProjectReplanModalComponent } from '../../components/projectModals/project-replan-modal/project-replan-modal.component';
import { ChangeManagerModalComponent } from '../../components/projectModals/change-manager-modal/change-manager-modal.component';
import { ChangeLeaderModalComponent } from '../../components/projectModals/change-leader-modal/change-leader-modal.component';
@Component({
......@@ -44,20 +46,49 @@ export class ProjectDetailsComponent implements OnInit {
modalRef.result.then((result) => {
if (result) {
this.loadProject();
}
})
}
openChangeProjectManager(){
const modalRef = this.modalService.open(ChangeManagerModalComponent);
modalRef.componentInstance.project = this.project;
modalRef.result.then((result) => {
// Add the new project to the list
if (result) {
this.loadProject();
}
}, (reason) => {
})
}
openChangeTeamLeader(){
});
const modalRef = this.modalService.open(ChangeLeaderModalComponent);
modalRef.componentInstance.project = this.project;
modalRef.result.then((result) => {
if (result) {
this.loadProject();
}
})
}
openRepan() {
openReplan() {
const modalRef = this.modalService.open(ProjectReplanModalComponent);
modalRef.componentInstance.project = this.project;
......@@ -88,8 +119,6 @@ export class ProjectDetailsComponent implements OnInit {
if (result) {
// Add the new project to the list
this.loadProject();
}
......@@ -101,10 +130,7 @@ export class ProjectDetailsComponent implements OnInit {
}
public downloadAsPdf(): void {
this.pdfDownloader.downloadAsPdf('pdfContent');
}
loadProject(){
this
.projectService
......@@ -122,4 +148,8 @@ export class ProjectDetailsComponent implements OnInit {
});
}
public downloadAsPdf(): void {
this.pdfDownloader.downloadAsPdf('pdfContent');
}
}
......@@ -8,6 +8,7 @@
<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>
</div>
</div>
<hr>
<div *ngIf="projects">
......
......@@ -41,6 +41,8 @@ import { RemoveStepModalComponent } from './components/steps/remove-step-modal/r
import { ProjectToprogressModalComponent } from './components/projectModals/project-toprogress-modal/project-toprogress-modal.component';
import { ProjectCompleteModalComponent } from './components/projectModals/project-complete-modal/project-complete-modal.component';
import { ProjectReplanModalComponent } from './components/projectModals/project-replan-modal/project-replan-modal.component';
import { ChangeManagerModalComponent } from './components/projectModals/change-manager-modal/change-manager-modal.component';
import { ChangeLeaderModalComponent } from './components/projectModals/change-leader-modal/change-leader-modal.component';
@NgModule({
declarations: [
......@@ -72,7 +74,9 @@ import { ProjectReplanModalComponent } from './components/projectModals/project-
RemoveStepModalComponent,
ProjectToprogressModalComponent,
ProjectCompleteModalComponent,
ProjectReplanModalComponent
ProjectReplanModalComponent,
ChangeManagerModalComponent,
ChangeLeaderModalComponent
],
providers: [
ProjectService,
......
......@@ -93,7 +93,7 @@ export class AddEmployeeTrackModalComponent {
employeeFormatter = (result: any) :string=> {
if(result.employee == undefined){
if(result.employee === undefined){
return ''
}
return ` ${result.employee.hiastId} - ${result.employee.personalInfo.firstName } ${result.employee.personalInfo.lastName}`;
......
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