Commit ff0f181d authored by hasan khaddour's avatar hasan khaddour

add controll panel for proejcts

parent f38f0b7c
...@@ -18,6 +18,13 @@ export class CustomerService { ...@@ -18,6 +18,13 @@ export class CustomerService {
return this.http.get<Customer[]>(this.config.getServerUrl()+ "/Customers"); return this.http.get<Customer[]>(this.config.getServerUrl()+ "/Customers");
} }
public getCustomersByFilter(name : string ):Observable<Customer[]>{
return this
.http
.get<Customer[]>(this.config.getServerUrl()+ "/Customers")
;
}
public getCustomerById(id : number ):Observable<Customer>{ public getCustomerById(id : number ):Observable<Customer>{
......
...@@ -9,6 +9,7 @@ import { EmployeeParticipate } from '../models/responses/employeeParticipate'; ...@@ -9,6 +9,7 @@ import { EmployeeParticipate } from '../models/responses/employeeParticipate';
import { GetEmployeeTrackHistoryRequest } from '../models/requests/getEmployeeTrackHistoryRequest'; import { GetEmployeeTrackHistoryRequest } from '../models/requests/getEmployeeTrackHistoryRequest';
import { EmployeeTrack } from '../../tracks/models/responses/employeeTrack'; import { EmployeeTrack } from '../../tracks/models/responses/employeeTrack';
import { UpdateEmplyeeWorkHours } from '../models/requests/updateEmployeeWorkHoursRequest'; import { UpdateEmplyeeWorkHours } from '../models/requests/updateEmployeeWorkHoursRequest';
import { Department } from '../../projects/models/responses/Department';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -29,6 +30,12 @@ export class EmployeesService { ...@@ -29,6 +30,12 @@ export class EmployeesService {
return this.http.get<Employee>(this.config.getServerUrl()+ "/Employees/"+id); return this.http.get<Employee>(this.config.getServerUrl()+ "/Employees/"+id);
} }
public getDepartments( ):Observable<Department[]>{
return this.http.get<Department[]>(this.config.getServerUrl()+ "/Employees/GetDepartments/");
}
public getCurrentEmployee( ):Observable<Employee>{ public getCurrentEmployee( ):Observable<Employee>{
let id = this.userService.getEmployeeId(); let id = this.userService.getEmployeeId();
......
<p>info-controll works!</p> <div class="row align-items-center mb-4">
<div class=" mb-4 text-center">
<strong>معلومات المشروع</strong>
</div>
<div class="row">
<div
class="col-md-6 col-lg-4"
[routerLink]="['/projects/', project.id,'steps']"
>
<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-credit-card fe-16 text-white"></span>
</div>
<div class="flex-fill ml-4 fname">
<strong> إدارة المراحل</strong><br />
</div>
</div>
</div>
<!-- .card-body -->
</div>
<!-- .card -->
</div>
<!-- .col -->
<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="text-center">
<div class="circle circle-md bg-secondary">
<span class="fe fe-users fe-16 text-white"></span>
</div>
</div>
<div class="flex-fill ml-4 fname">
<strong>إضافة المرفقات</strong><br />
</div>
</div>
</div>
<!-- .card-body -->
</div>
<!-- .card -->
</div>
<!-- .col -->
<div
class="col-md-6 col-lg-4"
[routerLink]="['/projects/', project.id,'participants']"
>
<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>
<!-- .row -->
</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>
import { Component } from '@angular/core'; import { Component, Input } from '@angular/core';
import { Project } from '../../../models/responses/project';
@Component({ @Component({
selector: 'info-controll', selector: 'info-controll',
...@@ -6,5 +7,5 @@ import { Component } from '@angular/core'; ...@@ -6,5 +7,5 @@ import { Component } from '@angular/core';
styleUrl: './info-controll.component.css' styleUrl: './info-controll.component.css'
}) })
export class InfoControllComponent { export class InfoControllComponent {
@Input() project : Project
} }
<p>plan-controll works!</p> <div class="row align-items-center mb-4">
<div class=" text-center mb-4">
<strong>تخطيط المشروع</strong>
</div>
<div class="row">
<div class="col-md-6 col-lg-4" [routerLink]="['/projects/',project.id,'spending']">
<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-credit-card fe-16 text-white"></span>
</div>
<div class="flex-fill ml-4 fname">
<strong>إدارة خطة الانفاق</strong><br />
</div>
</div>
</div> <!-- .card-body -->
</div> <!-- .card -->
</div> <!-- .col -->
<div class="col-md-6 col-lg-4" [routerLink]="['/projects/',project.id,'participants/']">
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
<div class="text-center">
<div class="circle circle-md bg-secondary">
<span class="fe fe-users fe-16 text-white"></span>
</div>
</div>
<div class="flex-fill ml-4 fname">
<strong>إدارة المشاركين </strong><br />
</div>
</div>
</div> <!-- .card-body -->
</div> <!-- .card -->
</div> <!-- .col -->
<div class="col-md-6 col-lg-4" [routerLink]="['/projects/',project.id,'steps']">
<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> <!-- .row -->
<div class="col-md-6 col-lg-4" [routerLink]="['/projects/',project.id,'/steps']">
<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>
import { Component } from '@angular/core'; import { Component, Input } from '@angular/core';
import { Project } from '../../../models/responses/project';
@Component({ @Component({
selector: 'plan-controll', selector: 'plan-controll',
...@@ -7,4 +8,5 @@ import { Component } from '@angular/core'; ...@@ -7,4 +8,5 @@ import { Component } from '@angular/core';
}) })
export class PlanControllComponent { export class PlanControllComponent {
@Input() project : Project
} }
<div class="row align-items-center mb-4">
<div class=" mb-4 text-center">
<strong>تقارير المشروع</strong>
</div>
<div class="row">
<div
class="col-md-6 col-lg-4"
[routerLink]="['/reports/definition/', project.id]"
>
<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-credit-card fe-16 text-white"></span>
</div>
<div class="flex-fill ml-4 fname">
<strong> بطاقة المشروع</strong><br />
</div>
</div>
</div>
<!-- .card-body -->
</div>
<!-- .card -->
</div>
<!-- .col -->
<div class="col-md-6 col-lg-4" [routerLink]="['/reports/timeline',project.id]">
<div class="card shadow mb-4">
<div class="card-body file-list">
<div class="d-flex align-items-center">
<div class="text-center">
<div class="circle circle-md bg-secondary">
<span class="fe fe-users fe-16 text-white"></span>
</div>
</div>
<div class="flex-fill ml-4 fname">
<strong>بطاقة الخطة الزمنية</strong><br />
</div>
</div>
</div>
<!-- .card-body -->
</div>
<!-- .card -->
</div>
<!-- .col -->
<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>
<!-- .row -->
</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 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
import { Component, Input } from '@angular/core';
import { Project } from '../../../models/responses/project';
@Component({
selector: 'report-controll',
templateUrl: './report-controll.component.html',
styleUrl: './report-controll.component.css'
})
export class ReportControllComponent {
@Input() project : Project
}
<p>track-controll works!</p> <div class="row align-items-center mb-4">
<div class=" text-center mb-4 ">
<strong>متابعة المشروع</strong>
</div>
<div class="row">
<div class="col-md-6 col-lg-4" [routerLink]="['/tracks/project/',project.id]">
<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-compass 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 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 class="col-md-6 col-lg-4" [routerLink]="['/projects/',project.id,'/steps']">
<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
import { Component } from '@angular/core'; import { Component, Input } from '@angular/core';
import { Project } from '../../../models/responses/project';
@Component({ @Component({
selector: 'track-controll', selector: 'track-controll',
...@@ -7,4 +8,5 @@ import { Component } from '@angular/core'; ...@@ -7,4 +8,5 @@ import { Component } from '@angular/core';
}) })
export class TrackControllComponent { export class TrackControllComponent {
@Input() project : Project
} }
...@@ -6,3 +6,4 @@ export interface AddParticipantRequest { ...@@ -6,3 +6,4 @@ export interface AddParticipantRequest {
partialTimeRatio: number; partialTimeRatio: number;
role: string; role: string;
} }
export class ChangeEmployeeParticipationRequest {
participantId: number;
projectId: number;
partialTimeRation: number;
role: string;
}
export class CompleteProjectRequest {
projectId: number;
completionDate: Date;
customerNotes: string;
customerRate: number;
}
...@@ -14,7 +14,7 @@ export class CreateProjectRequest { ...@@ -14,7 +14,7 @@ export class CreateProjectRequest {
projectManagerId :number projectManagerId :number
proposerId :number proposerId :number
executerId :number executerId :number
projectTypeId :number
constructor(){ constructor(){
this.projectAggreement= { this.projectAggreement= {
...@@ -28,8 +28,7 @@ export class CreateProjectRequest { ...@@ -28,8 +28,7 @@ export class CreateProjectRequest {
this.projectClassification = { this.projectClassification = {
projectNature :'', projectNature :'',
projectStatus:'', projectStatus:''
projectType:''
} }
this.projectInfo ={ this.projectInfo ={
name :'', name :'',
......
...@@ -9,6 +9,7 @@ import { ProjectClassification } from "../valueObjects/ProjectClassification" ...@@ -9,6 +9,7 @@ import { ProjectClassification } from "../valueObjects/ProjectClassification"
import { Department } from "./Department" import { Department } from "./Department"
import { Step } from "./Step" import { Step } from "./Step"
import { FinancialSpending } from "./FinancialSpending" import { FinancialSpending } from "./FinancialSpending"
import { ProjectType } from "../../../projects-types/models/responses/projectType"
export class Project export class Project
{ {
id:number id:number
...@@ -24,6 +25,8 @@ export class Project ...@@ -24,6 +25,8 @@ export class Project
executer:Department executer:Department
proposerId:number proposerId:number
proposer:Customer proposer:Customer
projectType : ProjectType
projectTypeId :number
steps :Step[] steps :Step[]
financialSpending : FinancialSpending[] financialSpending : FinancialSpending[]
employeeParticipates:EmployeeParticipate[] employeeParticipates:EmployeeParticipate[]
......
export interface ProjectClassification { export interface ProjectClassification {
projectStatus: string; projectStatus: string;
projectType: string;
projectNature: string; projectNature: string;
} }
<div class="card col-10"> <div class="card col-10" *ngIf="types && departments">
<div class="card-body"> <div class="card-body">
<h5 class="card-title text-center"><strong>طرح مشروع جديد</strong></h5> <h5 class="card-title text-center"><strong>طرح مشروع جديد</strong></h5>
...@@ -69,11 +69,7 @@ ...@@ -69,11 +69,7 @@
</mat-form-field> </mat-form-field>
</div> </div>
<!-- <div class="row mb-4" formGroupName="projectInfo">
</div> -->
<div class="row mb-4" formGroupName="financialFund"> <div class="row mb-4" formGroupName="financialFund">
...@@ -124,13 +120,21 @@ ...@@ -124,13 +120,21 @@
<mat-form-field> <mat-form-field>
<mat-label>الفعالية المنفذة </mat-label> <mat-label>الفعالية المنفذة </mat-label>
<mat-select formControlName="executerId"> <mat-select formControlName="executerId">
<mat-option value="1">قسم المعلوميات</mat-option> <mat-option *ngFor="let department of departments " [value]="department.id">{{department.name}}</mat-option>
<mat-option value="2">قسم النظم الاكترونية</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="col-4">
<mat-form-field>
<mat-label for="projectTypeId" class="form-label">نوع النشاط </mat-label>
<mat-select id="projectTypeId" formControlName="projectTypeId">
<mat-option *ngFor="let type of types " [value]="type.id">{{type.typeName}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="row mb-4" formGroupName="projectClassification"> <div class="row mb-4" formGroupName="projectClassification">
<mat-form-field class="col-4"> <mat-form-field class="col-4">
...@@ -142,10 +146,6 @@ ...@@ -142,10 +146,6 @@
<mat-label for="projectNature" class="form-label" >طبيعة النشاط</mat-label> <mat-label for="projectNature" class="form-label" >طبيعة النشاط</mat-label>
<input formControlName="projectNature" class="form-control" id="projectNature" matInput /> <input formControlName="projectNature" class="form-control" id="projectNature" matInput />
</mat-form-field> </mat-form-field>
<mat-form-field class="col-4">
<mat-label for="projectType" class="form-label" >وضع النشاط</mat-label>
<input formControlName="projectType" class="form-control" id="projectType" matInput />
</mat-form-field>
</div> </div>
......
//#region imports
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { EmployeesService } from '../../../employees/services/employees.service'; import { EmployeesService } from '../../../employees/services/employees.service';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { debounceTime, distinctUntilChanged, map, Observable, startWith, switchMap } from 'rxjs'; import { debounceTime, distinctUntilChanged, map, Observable, startWith, switchMap } from 'rxjs';
import { Employee } from '../../../employees/models/responses/employee'; import { Employee } from '../../../employees/models/responses/employee';
import { Result } from '../../../core/models/result';
import { Project } from '../../models/responses/project';
import { Customer } from '../../../customers/models/customer'; import { Customer } from '../../../customers/models/customer';
import { CustomerService } from '../../../customers/services/customer.service'; import { CustomerService } from '../../../customers/services/customer.service';
import { ProjectService } from '../../services/project.service'; import { ProjectService } from '../../services/project.service';
import { CreateProjectRequest } from '../../models/requests/project-requests/createProjectRequest'; import { CreateProjectRequest } from '../../models/requests/project-requests/createProjectRequest';
import { ToastrComponentlessModule, ToastrService } from 'ngx-toastr'; import { ToastrComponentlessModule, ToastrService } from 'ngx-toastr';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Department } from '../../models/responses/Department';
import { ProjectType } from '../../../projects-types/models/responses/projectType';
import { ProjectsTypesService } from '../../../projects-types/services/projects-types.service';
//#endregion imports
@Component({ @Component({
selector: 'project-create', selector: 'project-create',
...@@ -18,92 +22,196 @@ import { Router } from '@angular/router'; ...@@ -18,92 +22,196 @@ import { Router } from '@angular/router';
styleUrl: './project-create.component.css' styleUrl: './project-create.component.css'
}) })
export class ProjectCreateComponent { export class ProjectCreateComponent {
//#region Forms and Filters
projectForm: FormGroup; projectForm: FormGroup;
filteredManagers: Observable<Employee[]>; filteredManagers: Observable<Employee[]>;
filteredLeaders: Observable<Employee[]>; filteredLeaders: Observable<Employee[]>;
filteredCustomers: Observable<Customer[]>; filteredCustomers: Observable<Customer[]>;
//#endregion Forms and Filters
//#region Selection options
departments: Department[]
types : ProjectType[]
projectManager :Employee projectManager :Employee
teamLeader :Employee teamLeader :Employee
proposer :Customer proposer :Customer
//#endregion Selection options
//#region Project request
request = new CreateProjectRequest() request = new CreateProjectRequest()
//#endregion Project request
//#region Constructor
constructor( constructor(
private fb: FormBuilder, private fb: FormBuilder,
private employeeService: EmployeesService, private employeeService: EmployeesService,
private customersService : CustomerService, private customersService : CustomerService,
private typesService : ProjectsTypesService,
private projectService :ProjectService, private projectService :ProjectService,
private toastr : ToastrService, private toastr : ToastrService,
private router :Router private router :Router
) {} ) {}
//#endregion Constructor
//#region On init
ngOnInit(): void { ngOnInit(): void {
this.request= new CreateProjectRequest(); this.request= new CreateProjectRequest();
this._buildFrom(); this._buildFrom();
this.valuesChangesSubscribtion();
this.loadDepartments();
this.loadProjectsTypes();
}
//#endregion On init
//#region Oninit Data Loaders
loadProjectsTypes(){
this
.typesService
.getAllTypes()
.subscribe({
next: (data)=>{
this.types= data ;
}
,
error: (err)=>{
this.toastr.error("تعذر تحميل أنواع المشاريع");
}
});
}
loadDepartments(){
this
.employeeService
.getDepartments()
.subscribe({
next: (data)=>{
this.departments =data
}
,
error: (err)=>{
this.toastr.error("تعذر تحميل الأقسام");
}
});
}
//#endregion Oninit Data Loaders
this.projectForm.valueChanges.subscribe(values => {
//#region Auto Complete Filters
valuesChangesSubscribtion(){
this
.projectForm
.valueChanges
.subscribe(values => {
this.request = { this.request = {
...this.request, // Preserve other properties ...this.request,
...values, // Overwrite properties with form values ...values,
projectInfo: { ...this.request.projectInfo, ...values.projectInfo }, projectInfo: { ...this.request.projectInfo, ...values.projectInfo },
financialFund: { ...this.request.financialFund, ...values.financialFund }, financialFund: { ...this.request.financialFund, ...values.financialFund },
projectAggreement: { ...this.request.projectAggreement, ...values.projectAggreement }, projectAggreement: { ...this.request.projectAggreement, ...values.projectAggreement },
projectClassification: { ...this.request.projectClassification, ...values.projectClassification }, projectClassification: { ...this.request.projectClassification, ...values.projectClassification },
}; };
}); });
// Autocomplete for Project Manager // Autocomplete for Project Manager
this.filteredManagers = this.projectForm.get('projectManager')!.valueChanges.pipe( this.filteredManagers = this.projectForm.get('projectManager')!.valueChanges.pipe(
debounceTime(300), debounceTime(300),
switchMap(value => this.employeeService.getByFilter(value)) switchMap(value => this.employeeService.getByFilter(value))
); );
// Autocomplete for Team Leader // Autocomplete for Team Leader
this.filteredLeaders = this.projectForm.get('teamLeader')!.valueChanges.pipe( this.filteredLeaders = this.projectForm.get('teamLeader')!.valueChanges.pipe(
debounceTime(300), debounceTime(300),
switchMap(value => this.employeeService.getByFilter(value)) switchMap(value => this.employeeService.getByFilter(value))
); );
// Autocomplete for Customer // Autocomplete for Customer
this.filteredCustomers = this.projectForm.get('customer')!.valueChanges.pipe( this.filteredCustomers = this.projectForm.get('customer')!.valueChanges.pipe(
debounceTime(300), debounceTime(300),
switchMap(value => this.customersService.getCustomers()) switchMap(value => this.customersService.getCustomersByFilter(value))
); );
}
}
//#endregion Auto omplete Filters
//#region On Selection
onManagerSelected(manager: Employee) { onManagerSelected(manager: Employee) {
this.projectManager = manager; this.projectManager = manager;
this.request.projectManagerId = manager.id; this.request.projectManagerId = manager.id;
this.projectForm.get('projectManager')!.setValue(manager.personalInfo.firstName+" " + manager.personalInfo.lastName +" , "+manager.email , { emitEvent: false });
this
.projectForm
.get('projectManager')!
.setValue(manager.personalInfo.firstName+" " + manager.personalInfo.lastName +" , "+manager.email , { emitEvent: false });
} }
onLeaderSelected(leader: Employee) { onLeaderSelected(leader: Employee) {
this.teamLeader = leader; this.teamLeader = leader;
this.request.teamLeaderId = leader.id; this.request.teamLeaderId = leader.id;
this.projectForm.get('teamLeader')!.setValue(leader.personalInfo.firstName+" " + leader.personalInfo.lastName +" , "+leader.email , { emitEvent: false });
this
.projectForm
.get('teamLeader')!
.setValue(leader.personalInfo.firstName+" " + leader.personalInfo.lastName +" , "+leader.email , { emitEvent: false });
} }
onCustomerSelected(customer: Customer) { onCustomerSelected(customer: Customer) {
this.proposer = customer; this.proposer = customer;
this.request.proposerId = customer.id; this.request.proposerId = customer.id;
this.projectForm.get('customer')!.setValue(customer.customerName, { emitEvent: false });
this
.projectForm
.get('customer')!
.setValue(customer.customerName, { emitEvent: false });
} }
onSubmit(request : CreateProjectRequest){ //#endregion On Selection
console.log(request) //#region On Submit
debugger
console.log(this.projectForm.errors) onSubmit(request : CreateProjectRequest){
console.log(this.projectForm.valid)
if(this.projectForm.valid){ if(this.projectForm.valid){
this.projectService.createProject(request).subscribe({
this
.projectService
.createProject(request)
.subscribe({
next: (data)=>{ next: (data)=>{
this.toastr.success("تمت إضافة الجهة بنجاح") this.toastr.success("تمت إضافة الجهة بنجاح")
this.router.navigate(['/projects/detail/',data]) this.router.navigate(['/projects/detail/',data])
},
}
,
error:(err)=>{ error:(err)=>{
this.toastr.error("لقد حدث خطاء ما") this.toastr.error("لقد حدث خطاء ما")
...@@ -116,6 +224,11 @@ export class ProjectCreateComponent { ...@@ -116,6 +224,11 @@ export class ProjectCreateComponent {
} }
//#endregion On Submit
//#region Form Builders
_buildFrom(){ _buildFrom(){
this.projectForm = this.fb.group({ this.projectForm = this.fb.group({
projectManager: [''], projectManager: [''],
...@@ -144,11 +257,14 @@ export class ProjectCreateComponent { ...@@ -144,11 +257,14 @@ export class ProjectCreateComponent {
projectClassification: this.fb.group({ projectClassification: this.fb.group({
projectStatus: ['', Validators.required], projectStatus: ['', Validators.required],
projectNature: ['', Validators.required], projectNature: ['', Validators.required],
projectType: ['', Validators.required],
}), }),
executerId: ['', Validators.required], projectTypeId: [1, Validators.required],
executerId: [1, Validators.required],
}); });
} }
//#endregion Form Builders
} }
...@@ -4,8 +4,7 @@ import { ToastrService } from 'ngx-toastr'; ...@@ -4,8 +4,7 @@ import { ToastrService } from 'ngx-toastr';
import { Project } from '../../models/responses/project'; import { Project } from '../../models/responses/project';
import { PdfDownloaderService } from '../../../core/services/pdfDownloader/pdf-downloader.service'; import { PdfDownloaderService } from '../../../core/services/pdfDownloader/pdf-downloader.service';
import { ProjectService } from '../../services/project.service'; import { ProjectService } from '../../services/project.service';
import { icons } from 'feather-icons/generated/feather-icons';
import { param } from 'jquery';
@Component({ @Component({
selector: 'project-details', selector: 'project-details',
...@@ -22,18 +21,28 @@ export class ProjectDetailsComponent implements OnInit { ...@@ -22,18 +21,28 @@ export class ProjectDetailsComponent implements OnInit {
private toastr: ToastrService, private toastr: ToastrService,
private pdfDownloader : PdfDownloaderService private pdfDownloader : PdfDownloaderService
) {} ) {}
ngOnInit(): void {
ngOnInit(): void {
const id = Number(this.route.snapshot.paramMap.get('id')); const id = Number(this.route.snapshot.paramMap.get('id'));
this.projectService.getProjectById(id).subscribe({
this
.projectService
.getProjectById(id)
.subscribe({
next :(data) => { next :(data) => {
this.project = data; this.project = data;
},
},
error : (err)=>{ console.log(err)} error : (err)=>{
console.log(err)
}
});
});
} }
public downloadAsPdf(): void { public downloadAsPdf(): void {
this.pdfDownloader.downloadAsPdf('pdfContent'); this.pdfDownloader.downloadAsPdf('pdfContent');
} }
......
...@@ -12,9 +12,9 @@ const routes: Routes = [ ...@@ -12,9 +12,9 @@ const routes: Routes = [
{path:'',component :ProjectListComponent}, {path:'',component :ProjectListComponent},
{ path: 'detail/:id', component: ProjectDetailsComponent }, { path: 'detail/:id', component: ProjectDetailsComponent },
{ path: 'create', component: ProjectCreateComponent }, { path: 'create', component: ProjectCreateComponent },
{ path: 'steps/:id', component: StepListComponent }, { path: ':id/steps', component: StepListComponent },
{ path: 'participants/:id', component: ParticipantsListComponent }, { path: ':id/participants', component: ParticipantsListComponent },
{ path: 'spending/:id', component: FinancialSpendingComponent } { path: ':id/spending', component: FinancialSpendingComponent }
......
...@@ -30,6 +30,7 @@ import { AddFinancialSpendModalComponent } from './components/modals/add-financi ...@@ -30,6 +30,7 @@ import { AddFinancialSpendModalComponent } from './components/modals/add-financi
import { AddAttachmentModalComponent } from './components/modals/add-attachment-modal/add-attachment-modal.component'; import { AddAttachmentModalComponent } from './components/modals/add-attachment-modal/add-attachment-modal.component';
import { FinancialSpendingComponent } from './pages/financial-spending/financial-spending.component'; import { FinancialSpendingComponent } from './pages/financial-spending/financial-spending.component';
import { FinancialItemComponent } from './components/financial-item/financial-item.component'; import { FinancialItemComponent } from './components/financial-item/financial-item.component';
import { ReportControllComponent } from './components/project-controll/report-controll/report-controll.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -50,7 +51,8 @@ import { FinancialItemComponent } from './components/financial-item/financial-it ...@@ -50,7 +51,8 @@ import { FinancialItemComponent } from './components/financial-item/financial-it
AddFinancialSpendModalComponent, AddFinancialSpendModalComponent,
AddAttachmentModalComponent, AddAttachmentModalComponent,
FinancialSpendingComponent, FinancialSpendingComponent,
FinancialItemComponent FinancialItemComponent,
ReportControllComponent
], ],
providers: [ providers: [
ProjectService, ProjectService,
......
...@@ -16,6 +16,8 @@ import { RePlanProjectRequest } from '../models/requests/project-requests/RePlan ...@@ -16,6 +16,8 @@ import { RePlanProjectRequest } from '../models/requests/project-requests/RePlan
import { CreateProjectRequest } from '../models/requests/project-requests/createProjectRequest'; import { CreateProjectRequest } from '../models/requests/project-requests/createProjectRequest';
import { AddAttachmentRequest } from '../models/requests/project-requests/AddAttachmentRequest'; import { AddAttachmentRequest } from '../models/requests/project-requests/AddAttachmentRequest';
import { Attachment } from '../models/responses/Attachment'; import { Attachment } from '../models/responses/Attachment';
import { CompleteProjectRequest } from '../models/requests/project-requests/completeProjectRequest';
import { ChangeEmployeeParticipationRequest } from '../models/requests/project-requests/ChangeEmployeeParticipationRequest';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -118,7 +120,11 @@ export class ProjectService { ...@@ -118,7 +120,11 @@ export class ProjectService {
return this.http.post<void>(this.config.getServerUrl()+ "/Projects/RemoveParticipant",request); return this.http.post<void>(this.config.getServerUrl()+ "/Projects/RemoveParticipant",request);
} }
public changeParticipation(request : ChangeEmployeeParticipationRequest ):Observable<void>{
return this.http.post<void>(this.config.getServerUrl()+ "/Projects/ChangeParticipation",request);
}
//tihs method responsible for adda new participant to the project //tihs method responsible for adda new participant to the project
// //
public addParticipant(request : AddParticipantRequest ):Observable<void>{ public addParticipant(request : AddParticipantRequest ):Observable<void>{
...@@ -157,9 +163,9 @@ export class ProjectService { ...@@ -157,9 +163,9 @@ export class ProjectService {
//tihs method responsible for changing the state of the project to completed //tihs method responsible for changing the state of the project to completed
// //
public completeProject(projectId : number ):Observable<void>{ public completeProject(request : CompleteProjectRequest ):Observable<void>{
return this.http.post<void>(this.config.getServerUrl()+ "/Projects/CompleteProject/"+projectId,{}); return this.http.post<void>(this.config.getServerUrl()+ "/Projects/CompleteProject/",request);
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<p class="mb-4"> <p class="mb-4">
<strong>معلومات حالة المشروع </strong> <strong>معلومات حالة المشروع </strong>
<br /> المرحلة التطويرير : <small>{{project.currentState }} </small> <br /> المرحلة التطويرير : <small>{{project.currentState }} </small>
<br />نوع المشروع : <small>{{project.projectClassification.projectType}} </small> <br />نوع المشروع : <small>{{project.projectType.typeName}} </small>
<br /> طبيعة المشروع : <small>{{project.projectClassification.projectNature}} </small> <br /> طبيعة المشروع : <small>{{project.projectClassification.projectNature}} </small>
</p> </p>
......
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