Commit 1eea8f3a authored by hasan khaddour's avatar hasan khaddour

add employee partiipate and project create

parent 67b886e0
<p>participate-item works!</p> <div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row align-items-center">
<div class="col-auto">
<a href="profile-posts.html" class="avatar avatar-md">
<img src="./assets/images/users/4.jpg" alt="..." class="avatar-img rounded-circle">
</a>
</div>
<div class="col ml-n2 ">
<strong class="mb-1">{{employeeParticipate.projectInfo.name}}</strong><span class=" ml-1"></span>
<p class="small text-muted mb-1">{{employeeParticipate.projectInfo.description}}</p>
</div>
<div class="col-auto">
</div>
</div>
</div>
<div class="card-body">
<div class="row align-items-center">
<div class="col">
<div class="small mb-2 d-flex">
<span class="text-muted flex-fill">نسبة التفرغ {{employeeParticipate.partialTimeRatio}}</span>
<span class="text-muted">صفة المساهمة {{employeeParticipate.role}}</span>
</div>
<div class="progress" style="height: 2px;">
<div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow=[employeeParticipate.partialTimeRatio] aria-valuemin="0" aria-valuemax="60"></div>
</div>
</div>
<div class="col-auto">
<button type="button" class="btn m-4 btn-sm btn-primary">استعراض المهام المكلف بها</button>
<button type="button" class="btn m-4 btn-sm btn-secondary">تقرير بمشاركتي</button>
</div>
</div>
</div> <!-- / .card-body -->
</div>
\ No newline at end of file
import { Component } from '@angular/core'; import { Component, Input } from '@angular/core';
import { EmployeeParticipate } from '../../models/responses/employeeParticipate';
@Component({ @Component({
selector: 'participate-item', selector: 'participate-item',
...@@ -7,4 +8,9 @@ import { Component } from '@angular/core'; ...@@ -7,4 +8,9 @@ import { Component } from '@angular/core';
}) })
export class ParticipateItemComponent { export class ParticipateItemComponent {
@Input() employeeParticipate :EmployeeParticipate
constructor(){}
} }
...@@ -6,7 +6,7 @@ import { Observable } from 'rxjs'; ...@@ -6,7 +6,7 @@ import { Observable } from 'rxjs';
import { Result } from '../core/models/result'; import { Result } from '../core/models/result';
import { Employee } from './models/responses/employee'; import { Employee } from './models/responses/employee';
import { EmployeeProfileComponent } from './pages/employee-profile/employee-profile.component'; import { EmployeeProfileComponent } from './pages/employee-profile/employee-profile.component';
import { EmployeeParticipateComponent } from './pages/employee-participate/employee-participate.component'; import { EmployeeParticipateComponent } from './components/employee-participate/employee-participate.component';
import { EmployeeParticipatesComponent } from './pages/employee-participates/employee-participates.component'; import { EmployeeParticipatesComponent } from './pages/employee-participates/employee-participates.component';
const routes: Routes = [ const routes: Routes = [
......
...@@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common'; ...@@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common';
import { EmployeesRoutingModule } from './employees-routing.module'; import { EmployeesRoutingModule } from './employees-routing.module';
import { EmployeeProfileComponent } from './pages/employee-profile/employee-profile.component'; import { EmployeeProfileComponent } from './pages/employee-profile/employee-profile.component';
import { EmployeeParticipatesComponent } from './pages/employee-participates/employee-participates.component'; import { EmployeeParticipatesComponent } from './pages/employee-participates/employee-participates.component';
import { EmployeeParticipateComponent } from './pages/employee-participate/employee-participate.component'; import { EmployeeParticipateComponent } from './components/employee-participate/employee-participate.component';
import { ParticipateItemComponent } from './components/participate-item/participate-item.component'; import { ParticipateItemComponent } from './components/participate-item/participate-item.component';
import { SharedModule } from '../shared/shared.module'; import { SharedModule } from '../shared/shared.module';
......
import { ProjectInfo } from "../../../projects/models/valueObjects/ProjectInfo"
import { Employee } from "./employee" import { Employee } from "./employee"
export class EmployeeParticipate { export class EmployeeParticipate {
employeeId :number employeeId :number
projectId : number projectId : number
projectInfo: ProjectInfo
employee :Employee employee :Employee
partialTimeRatio : number partialTimeRatio : number
role: string role: string
......
<section *ngIf="employeeParticipates" class="row"> <section *ngIf="employeeParticipates" class="row">
<employee-participate class="col-8 offset-2" *ngFor="let participate of employeeParticipates" [employeeParticipate]="participate"></employee-participate> <participate-item class="col-8 offset-2" *ngFor="let participate of employeeParticipates" [employeeParticipate]="participate"></participate-item>
<div *ngIf="employeeParticipates.length==0"> <div *ngIf="employeeParticipates.length==0">
للأسف أنت لم تشارك حتى الآن بأي مشروع للأسف أنت لم تشارك حتى الآن بأي مشروع
......
<div class="card profile shadow"> <div *ngIf="employee" class="card profile shadow">
<div class="card-body my-4"> <div class="card-body my-4">
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-md-3 text-center mb-5"> <div class="col-md-3 text-center mb-5">
......
<table class="table table-borderless table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">اسم المرحلة</th>
<th scope="col" class="text-left">الوصف</th>
<th scope="col" class="text-left">نسبة الانجاز</th>
<th scope="col" class="text-left">النسبة التثقيلية</th>
<th scope="col" class="text-left">تاريع البدء</th>
<th scope="col" class="text-left">مدة التنفيذ</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let step of steps " >
<th scope="row"></th>
<td> {{step.stepInfo.stepName}}
</td>
<td class="text-left">{{step.stepInfo.description}}</td>
<td class="text-left">{{step.currentCompletionRatio}}</td>
<td class="text-left">{{step.weight}}</td>
<td class="text-left">{{step.stepInfo.startDate | date}}</td>
<td class="text-left">{{step.stepInfo.duration}}</td>
</tr>
</tbody>
</table>
\ No newline at end of file
import { Component, Input } from '@angular/core';
import { Step } from '../../models/responses/Step';
@Component({
selector: 'step-table',
templateUrl: './step-table.component.html',
styleUrl: './step-table.component.css'
})
export class StepTableComponent {
@Input() steps : Step[]
}
...@@ -48,10 +48,6 @@ ...@@ -48,10 +48,6 @@
<mat-label for="description" class="form-label">وصف النشاط</mat-label> <mat-label for="description" class="form-label">وصف النشاط</mat-label>
<textarea matInput formControlName="description" placeholder="تعريف النشاط " class="form-control"></textarea> <textarea matInput formControlName="description" placeholder="تعريف النشاط " class="form-control"></textarea>
</mat-form-field> </mat-form-field>
</div>
<div class="row mb-4" formGroupName="projectInfo">
<mat-form-field class="col-4"> <mat-form-field class="col-4">
<mat-label for="code" class="form-label">رمز المشروع</mat-label> <mat-label for="code" class="form-label">رمز المشروع</mat-label>
<input matInput formControlName="code" class="form-control" id="code"> <input matInput formControlName="code" class="form-control" id="code">
...@@ -74,6 +70,10 @@ ...@@ -74,6 +70,10 @@
</div> </div>
<!-- <div class="row mb-4" formGroupName="projectInfo">
</div> -->
<div class="row mb-4" formGroupName="financialFund"> <div class="row mb-4" formGroupName="financialFund">
......
...@@ -9,6 +9,8 @@ import { Customer } from '../../../customers/models/customer'; ...@@ -9,6 +9,8 @@ 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 { Router } from '@angular/router';
@Component({ @Component({
selector: 'project-create', selector: 'project-create',
...@@ -30,44 +32,15 @@ export class ProjectCreateComponent { ...@@ -30,44 +32,15 @@ export class ProjectCreateComponent {
private fb: FormBuilder, private fb: FormBuilder,
private employeeService: EmployeesService, private employeeService: EmployeesService,
private customersService : CustomerService, private customersService : CustomerService,
private projectService :ProjectService private projectService :ProjectService,
private toastr : ToastrService,
private router :Router
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this.request= new CreateProjectRequest(); this.request= new CreateProjectRequest();
this._buildFrom();
this.projectForm = this.fb.group({
projectManager: [''],
teamLeader: [''],
customer: [''],
projectInfo: this.fb.group({
name: [''],
description: [''],
code: ['', Validators.required],
startDate: ['', Validators.required],
expectedEndDate: ['', Validators.required],
}),
financialFund: this.fb.group({
source: ['', Validators.required],
financialStatus: ['', Validators.required],
}),
projectAggreement: this.fb.group({
aggreementDate: ['', Validators.required],
aggreementNumber: ['', Validators.required],
}),
proposalInfo: this.fb.group({
proposingBookNumber :['', Validators.required],
proposingBookDate :['', Validators.required]
}),
projectClassification: this.fb.group({
projectStatus: ['', Validators.required],
projectNature: ['', Validators.required],
projectType: ['', Validators.required],
}),
executerId: ['', Validators.required],
});
console.log(this.request)
this.projectForm.valueChanges.subscribe(values => { this.projectForm.valueChanges.subscribe(values => {
this.request = { this.request = {
...this.request, // Preserve other properties ...this.request, // Preserve other properties
...@@ -118,13 +91,64 @@ export class ProjectCreateComponent { ...@@ -118,13 +91,64 @@ export class ProjectCreateComponent {
onSubmit(request : CreateProjectRequest){ onSubmit(request : CreateProjectRequest){
console.log(request) console.log(request)
debugger
console.log(this.projectForm.errors) console.log(this.projectForm.errors)
console.log(this.projectForm.valid)
if(this.projectForm.valid){ if(this.projectForm.valid){
console.log(request); this.projectService.createProject(request).subscribe({
this.projectService.createProject(request);
next: (data)=>{
this.toastr.success("تمت إضافة الجهة بنجاح")
this.router.navigate(['/projects/detail/',data])
}
,
error:(err)=>{
this.toastr.error("لقد حدث خطاء ما")
}
});
} }
}
_buildFrom(){
this.projectForm = this.fb.group({
projectManager: [''],
teamLeader: [''],
customer: [''],
projectInfo: this.fb.group({
name: ['',Validators.required],
description: ['',Validators.required],
code: ['', Validators.required],
startDate: ['', Validators.required],
expectedEndDate: ['', Validators.required],
}),
financialFund: this.fb.group({
source: ['', Validators.required],
financialStatus: ['', Validators.required],
}),
projectAggreement: this.fb.group({
aggreementDate: ['', Validators.required],
aggreementNumber: ['', Validators.required],
}),
proposalInfo: this.fb.group({
proposingBookNumber :['', Validators.required],
proposingBookDate :['', Validators.required]
}),
projectClassification: this.fb.group({
projectStatus: ['', Validators.required],
projectNature: ['', Validators.required],
projectType: ['', Validators.required],
}),
executerId: ['', Validators.required],
});
} }
} }
...@@ -39,41 +39,17 @@ ...@@ -39,41 +39,17 @@
<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.projectClassification.projectNature}} </small>
</p> </p>
</div> </div>
</div> <!-- /.row --> </div> <!-- /.row -->
<hr> <hr>
<p>مراحل المشروع</p> <p><strong>مراحل المشروع</strong></p>
<table class="table table-borderless table-striped"> <step-table [steps]="project.steps"></step-table>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">اسم المرحلة</th>
<th scope="col" class="text-left">الوصف</th>
<th scope="col" class="text-left">نسبة الانجاز</th>
<th scope="col" class="text-left">النسبة التثقيلية</th>
<th scope="col" class="text-left">تاريع البدء</th>
<th scope="col" class="text-left">مدة التنفيذ</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let step of project.steps " >
<th scope="row"></th>
<td> {{step.stepInfo.stepName}}
</td>
<td class="text-left">{{step.stepInfo.description}}</td>
<td class="text-left">{{step.currentCompletionRatio}}</td>
<td class="text-left">{{step.weight}}</td>
<td class="text-left">{{step.stepInfo.startDate | date}}</td>
<td class="text-left">{{step.stepInfo.duration}}</td>
</tr>
</tbody>
</table>
<hr> <hr>
<p>المشاركين في المشروع</p> <p><strong>المشاركين في المشروع</strong></p>
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<thead> <thead>
<tr> <tr>
...@@ -101,7 +77,7 @@ ...@@ -101,7 +77,7 @@
</tbody> </tbody>
</table> </table>
<p>خطة الانفاق</p> <p><strong>خطة الانفاق</strong></p>
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<thead> <thead>
<tr> <tr>
......
...@@ -29,6 +29,7 @@ export class ProjectListComponent implements OnInit{ ...@@ -29,6 +29,7 @@ export class ProjectListComponent implements OnInit{
loadProjects():void{ loadProjects():void{
this.loadingService.show()
this.projectService.getByFilter() this.projectService.getByFilter()
.subscribe( .subscribe(
{ {
...@@ -36,10 +37,11 @@ export class ProjectListComponent implements OnInit{ ...@@ -36,10 +37,11 @@ export class ProjectListComponent implements OnInit{
this.projects = res; this.projects = res;
this.toastr.success("تم تحميل المشاريع بنجاح"); this.toastr.success("تم تحميل المشاريع بنجاح");
this.loadingService.hide()
}, },
error: (err)=>{ error: (err)=>{
this.toastr.error("لقد حدث خظاء ما"); this.toastr.error("لقد حدث خظاء ما");
this.loadingService.hide()
} }
} }
); );
......
...@@ -20,6 +20,7 @@ import {MatSelectModule} from '@angular/material/select'; ...@@ -20,6 +20,7 @@ import {MatSelectModule} from '@angular/material/select';
import {MatDatepickerModule} from '@angular/material/datepicker'; import {MatDatepickerModule} from '@angular/material/datepicker';
import {provideNativeDateAdapter} from '@angular/material/core'; import {provideNativeDateAdapter} from '@angular/material/core';
import { ProjectAttachmentsComponent } from './pages/project-attachments/project-attachments.component'; import { ProjectAttachmentsComponent } from './pages/project-attachments/project-attachments.component';
import { StepTableComponent } from './components/step-table/step-table.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -30,7 +31,8 @@ import { ProjectAttachmentsComponent } from './pages/project-attachments/project ...@@ -30,7 +31,8 @@ import { ProjectAttachmentsComponent } from './pages/project-attachments/project
StepRowItemComponent, StepRowItemComponent,
ProjectHeaderComponent, ProjectHeaderComponent,
ProjectCreateComponent, ProjectCreateComponent,
ProjectAttachmentsComponent ProjectAttachmentsComponent,
StepTableComponent
], ],
providers: [ providers: [
ProjectService, ProjectService,
......
.spinner-wrapper { .spinner-wrapper {
display: flex; display:flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; height: 100%;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link " href="index.html"> <a class="nav-link " href="index.html">
<i class="fe fe-grid"></i> <i class="fe fe-grid"></i>
<span>الصفحة الئيسية</span> <span>الصفحة الرئيسية</span>
</a> </a>
</li><!-- End Dashboard Nav --> </li><!-- End Dashboard Nav -->
<li class="nav-heading">المتابعة</li> <li class="nav-heading">المتابعة</li>
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
</a> </a>
</li> </li>
<li class="nav-heading">العمل</li> <li class="nav-heading">العمل</li>
<li [routerLink]="['/employees/paticipation']" class="nav-item"> <li [routerLink]="['/employees/participates',id]" class="nav-item">
<a class="nav-link collapsed" > <a class="nav-link collapsed" >
<i class="bi bi-layout-text-window-reverse"></i><span>استعراض مساهماتي</span><i class="bi bi-chevron-down ms-auto"></i> <i class="bi bi-layout-text-window-reverse"></i><span>استعراض مساهماتي</span><i class="bi bi-chevron-down ms-auto"></i>
</a> </a>
......
import { Component, Input, input } from '@angular/core'; import { Component, Input, input, OnInit } from '@angular/core';
import { NavItem } from '../../componenets/nav-item/nav-item.component'; import { NavItem } from '../../componenets/nav-item/nav-item.component';
import { UserService } from '../../../core/services/authentication/user.service';
@Component({ @Component({
selector: 'app-sidebar', selector: 'app-sidebar',
...@@ -7,14 +8,14 @@ import { NavItem } from '../../componenets/nav-item/nav-item.component'; ...@@ -7,14 +8,14 @@ import { NavItem } from '../../componenets/nav-item/nav-item.component';
styleUrl: './sidebar.component.css' styleUrl: './sidebar.component.css'
}) })
export class SidebarComponent { export class SidebarComponent implements OnInit {
items : NavItem[ ]=[ id : number
{
name: "الصفحة الرئيسية",
haschild:false,
child:[]
}
] constructor(private userService : UserService){}
@Input() isToggled: Boolean; @Input() isToggled: Boolean;
ngOnInit(): void {
this.id= this.userService.getEmployeeId();
}
} }
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