Commit 4823c71d authored by hasan khaddour's avatar hasan khaddour

Add compltetion reports

parent 382fb28b
...@@ -14,14 +14,13 @@ ...@@ -14,14 +14,13 @@
<div class="row align-items-center justify-content-between"> <div class="row align-items-center justify-content-between">
<div class="col text-center"> <div class="col text-center">
<small> <small>
<a class="btn btn-primary">تنزيل </a> <button class="btn btn-primary">تنزيل </button>
</small> </small>
</div> </div>
<div class="col text-center"> <div class="col text-center">
<small> <small>
<button data-bs-toggle="modal" <button (click)="onDelete()" class="btn btn-secondary">إزالة</button>
data-bs-target="#removeAttachmentModal" class="btn btn-secondary">إزالة</button>
</small> </small>
</div> </div>
......
...@@ -11,6 +11,7 @@ export class AttahmentItemComponent { ...@@ -11,6 +11,7 @@ export class AttahmentItemComponent {
@Input() attachment : Attachment @Input() attachment : Attachment
@Output() selected = new EventEmitter<Attachment>() @Output() selected = new EventEmitter<Attachment>()
@Output() detled = new EventEmitter<Attachment>()
constructor( constructor(
public config :ConfigurationService public config :ConfigurationService
...@@ -20,5 +21,8 @@ export class AttahmentItemComponent { ...@@ -20,5 +21,8 @@ export class AttahmentItemComponent {
this.selected.emit(this.attachment) this.selected.emit(this.attachment)
} }
onDelete() {
this.detled.emit(this.attachment);
}
} }
<!-- remove-participant-modal.component.html --> <div class="modal-header">
<div class="modal fade" id="removeAttachmentModal" tabindex="-1" aria-labelledby="removeParticipantModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="removeParticipantModalLabel">إزالة مرفق من المشروع</h5> <h5 class="modal-title" id="removeParticipantModalLabel">إزالة مرفق من المشروع</h5>
<button type="button" class="ml-4 mr-4 btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="ml-4 mr-4 btn-close"(click)="onClose()"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>هل أنت متأكد من أنك تريد إزالة المرفق {{attachment.attachmentName}}</p> <p>هل أنت متأكد من أنك تريد إزالة المرفق {{attachment.attachmentName}}</p>
...@@ -13,7 +10,3 @@ ...@@ -13,7 +10,3 @@
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">إلغاء</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">إلغاء</button>
<button type="button" class="btn btn-danger" (click)="onConfirmRemove()">إزالة</button> <button type="button" class="btn btn-danger" (click)="onConfirmRemove()">إزالة</button>
</div> </div>
</div>
</div>
</div>
\ No newline at end of file
...@@ -2,6 +2,8 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; ...@@ -2,6 +2,8 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Attachment } from '../../../models/responses/attachment'; import { Attachment } from '../../../models/responses/attachment';
import { RemoveParticipantRequest } from '../../../models/requests/project-requests/RemoveParticipant'; import { RemoveParticipantRequest } from '../../../models/requests/project-requests/RemoveParticipant';
import { ProjectService } from '../../../services/project.service'; import { ProjectService } from '../../../services/project.service';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
@Component({ @Component({
selector: 'remove-attachment-modal', selector: 'remove-attachment-modal',
...@@ -12,12 +14,32 @@ export class RemoveAttachmentModalComponent { ...@@ -12,12 +14,32 @@ export class RemoveAttachmentModalComponent {
@Input() attachment: Attachment; @Input() attachment: Attachment;
@Output() attachmentRemoved = new EventEmitter<void>(); @Output() attachmentRemoved = new EventEmitter<void>();
constructor(private projectService: ProjectService) {} constructor(
private projectService: ProjectService,
private activeModal : NgbActiveModal,
private toastr : ToastrService
) {}
onConfirmRemove() { onConfirmRemove() {
this
.projectService
.removeAttachment(this.attachment.projectId,this.attachment.id)
.subscribe({
next : ()=>{
this.attachmentRemoved.emit();
},
error:(err)=>{
this.toastr.error('تعذر حذف المرفق')
} }
});
}
onClose(){
this.activeModal.close();
}
} }
...@@ -49,6 +49,7 @@ export class ParticipantsListComponent { ...@@ -49,6 +49,7 @@ export class ParticipantsListComponent {
onParticipantRemoved(): void { onParticipantRemoved(): void {
this.isDetailMode=false ; this.isDetailMode=false ;
this.closeModal('removeParticipantModal')
this.loadParticipations(); this.loadParticipations();
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*ngFor="let attachment of attachments" *ngFor="let attachment of attachments"
(selected)="setSelectedAttachment(attachment)" (selected)="setSelectedAttachment(attachment)"
(detled)="openDeleteAttachment(attachment)"
[attachment]="attachment" [attachment]="attachment"
></attahment-item> ></attahment-item>
</div> </div>
...@@ -34,11 +35,7 @@ ...@@ -34,11 +35,7 @@
</div> </div>
<remove-attachment-modal *ngIf="selectedAtttachment"
[attachment]="attachments[0]"
(attachmentRemoved)="onAttahmentRemoved()"
>
</remove-attachment-modal>
</section> </section>
\ No newline at end of file
...@@ -5,6 +5,7 @@ import { ToastrService } from 'ngx-toastr'; ...@@ -5,6 +5,7 @@ import { ToastrService } from 'ngx-toastr';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
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 { RemoveAttachmentModalComponent } from '../../components/modals/remove-attachment-modal/remove-attachment-modal.component';
@Component({ @Component({
selector: 'project-attachments', selector: 'project-attachments',
...@@ -12,6 +13,7 @@ import { AddAttachmentModalComponent } from '../../components/modals/add-attachm ...@@ -12,6 +13,7 @@ import { AddAttachmentModalComponent } from '../../components/modals/add-attachm
styleUrl: './project-attachments.component.css' styleUrl: './project-attachments.component.css'
}) })
export class ProjectAttachmentsComponent implements OnInit{ export class ProjectAttachmentsComponent implements OnInit{
attachments : Attachment[] attachments : Attachment[]
projectId : number projectId : number
...@@ -59,6 +61,25 @@ export class ProjectAttachmentsComponent implements OnInit{ ...@@ -59,6 +61,25 @@ export class ProjectAttachmentsComponent implements OnInit{
this.selectedAtttachment = selected; this.selectedAtttachment = selected;
} }
openDeleteAttachment(attachment : Attachment) {
const modalRef = this.modalService.open(RemoveAttachmentModalComponent);
modalRef.componentInstance.attachment = attachment;
modalRef.result.then((result) => {
if (result) {
// Add the new project to the list
this.loadAttachment();
}
}, (reason) => {
});
}
openAddModal(): void { openAddModal(): void {
const modalRef = this.modalService.open(AddAttachmentModalComponent); const modalRef = this.modalService.open(AddAttachmentModalComponent);
modalRef.componentInstance.projectId = this.projectId; modalRef.componentInstance.projectId = this.projectId;
...@@ -67,6 +88,7 @@ export class ProjectAttachmentsComponent implements OnInit{ ...@@ -67,6 +88,7 @@ export class ProjectAttachmentsComponent implements OnInit{
{ {
next : ()=>{ next : ()=>{
this.loadAttachment() this.loadAttachment()
} }
} }
); );
......
...@@ -231,9 +231,13 @@ export class ProjectService { ...@@ -231,9 +231,13 @@ export class ProjectService {
return this.http.get<Attachment[]>(this.config.getServerUrl()+ "/Projects/Attachments/?projectId="+projectId); return this.http.get<Attachment[]>(this.config.getServerUrl()+ "/Projects/Attachments/?projectId="+projectId);
} }
public removeAttachment(projectId : number ,attachmentId : number ):Observable<Attachment[]>{ public removeAttachment(projectId : number ,attachmentId : number ):Observable<void>{
return this.http.get<Attachment[]>(this.config.getServerUrl()+ "/Projects/RemoveAttachment/?projectId="+projectId+"&attachmentId="+attachmentId); return this.http.post<void>(this.config.getServerUrl()+ "/Projects/RemoveAttachment/",{
'projectId':projectId,
'attachmentId':attachmentId
});
} }
......
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
<project-header [projectInfo]="project.projectInfo"></project-header> <project-header [projectInfo]="project.projectInfo"></project-header>
<project-subjective [project]="project"> </project-subjective> <project-subjective [project]="project"> </project-subjective>
<hr /> <hr />
<p><strong>مساهمات العاملين بالانجاز</strong></p> <p><strong>تقييم الجهة الطارحة</strong>{{completion.customerRate}}</p>
<p><strong>ملاحظات الجهة الطارحة</strong>{{completion.customerNotes}}</p>
<p><strong>تاريخ الانهاء</strong>{{completion.completionDate | date }}</p>
<employee-contribution-table <employee-contribution-table
[contributers]="contributers" [contributers]="contributers"
......
...@@ -43,7 +43,7 @@ export class ProjectCompletionComponent implements OnInit{ ...@@ -43,7 +43,7 @@ export class ProjectCompletionComponent implements OnInit{
this.toastr.error('المشروع لم ينجز بعد'); this.toastr.error('المشروع لم ينجز بعد');
this.router.navigate(['/']); this.router.navigate(['/']);
}else { }else {
// this.loadCompletion(); this.loadCompletion();
this.loadContributions(); this.loadContributions();
} }
} }
......
...@@ -5,23 +5,60 @@ ...@@ -5,23 +5,60 @@
<div class="col"> <div class="col">
<h2 class="h3 mb-0 page-title"> قائمة عمليات المتابعة </h2> <h2 class="h3 mb-0 page-title"> قائمة عمليات المتابعة </h2>
</div> </div>
<div class="col-4">
<div class="row">
<input class="mb-2 form-control col-8 " type="month" [(ngModel)]="month" placeholder="اختر شهر" />
<button class="btn btn-primary col " (click)="onFilter()">حسب الشهر </button>
</div></div>
</div>
<hr>
<div class="card shadow mb-4 col-8 offset-2" *ngFor="let track of tracks">
<div class="card-header py-3">
<div class="row align-items-center">
<div class="col-auto"> <div class="col-auto">
<input type="date" [(ngModel)]="month" placeholder="اختر شهر" /> <a href="profile-posts.html" class="avatar avatar-md">
<button class="btn btn-primary" (click)="onFilter()">حسب الشهر </button> <img src="./assets/images/users/4.jpg" alt="..." class="avatar-img rounded-circle">
</a>
</div> </div>
<div class="col ml-n2">
<strong class="mb-1">متابعة {{track.projectInfo.name}}</strong><span class=" ml-1"></span>
<p class="small text-muted mb-1">الوضع الراهن {{track.trackInfo.statusDescription}}</p>
</div> </div>
<hr> <div class="col-auto">
</div>
</div>
</div>
<div class="card-body ">
<div class="row align-items-center">
<div class="col-8 ">
<div class="small mb-2 d-flex">
<span class="text-muted flex-fill">الملاحظات {{track.notes}}</span>
<span class="text-muted">تاريخ المتابعة {{track.trackInfo.trackDate| date}}</span>
</div>
</div>
<div class="col-8 ">
<div class="small mb-2 d-flex">
<span class="text-muted badge flex-fill">{{track.trackInfo.isCompleted ? 'مكتملة':'غير مكتملة'}} </span>
</div>
<!-- <track-item class=" offset-2" <div class="col-auto">
*ngFor="let track of tracks" <button type="button" [routerLink]="['/tracks/detail/',track.id]" class="btn m-2 btn-sm btn-secondary">تفاصيل المتابعة</button>
[track]="track"
(delete)="openModal('delete', track)"
></track-item> --> </div>
</div>
</div>
</div> <!-- / .card-body -->
</div>
<div *ngIf="tracks.length==0"> <div *ngIf="tracks.length==0">
للأسف هذا المروع لايحوي على أية مراحل للأسف لايحوي على أية متابعات
</div> </div>
</div> </div>
</div> </div>
......
...@@ -17,7 +17,7 @@ import { RemoveTrackRequest } from '../../models/requests/RemoveTrackRequest'; ...@@ -17,7 +17,7 @@ import { RemoveTrackRequest } from '../../models/requests/RemoveTrackRequest';
export class TracksListComponent implements OnInit{ export class TracksListComponent implements OnInit{
month: Date; month: Date;
tracks : Track[] tracks : Track[]|null
constructor( constructor(
...@@ -38,31 +38,55 @@ export class TracksListComponent implements OnInit{ ...@@ -38,31 +38,55 @@ export class TracksListComponent implements OnInit{
loadTracks(){ loadTracks(){
// let request : Gettraks this.trackService
// this.trackService .getTracks()
// .ge .subscribe({
// .getTrackByProjectId(request)
// .subscribe({
// next : (data)=>{ next : (data)=>{
// this.toastr.success("تم تحميل عمليات المتابعة بنجاح"); this.toastr.success("تم تحميل عمليات المتابعة بنجاح");
// this.tracks= data; this.tracks= data;
// } }
// , ,
// error:(err)=>{ error:(err)=>{
// this.toastr.error("لقد حدث خطاء ما") this.toastr.error("لقد حدث خطاء ما")
// } }
// }); });
} }
onFilter() { onFilter() {
throw new Error('Method not implemented.'); if(this.month){
this.tracks = null ;
this.trackService
.getTracks()
.subscribe({
next : (data)=>{
this.tracks= data;
this.tracks=this.tracks!.filter(e =>new Date(e.trackInfo.trackDate).getMonth() == new Date(this.month).getMonth())
}
,
error:(err)=>{
this.toastr.error("لقد حدث خطاء ما")
}
});
}
} }
} }
...@@ -3,6 +3,7 @@ import { ToastrService } from 'ngx-toastr'; ...@@ -3,6 +3,7 @@ import { ToastrService } from 'ngx-toastr';
import { TrackService } from '../../services/track.service'; import { TrackService } from '../../services/track.service';
import { Track } from '../../models/responses/track'; import { Track } from '../../models/responses/track';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Toast } from 'bootstrap';
@Component({ @Component({
selector: 'tracks-uncomplete', selector: 'tracks-uncomplete',
...@@ -31,5 +32,13 @@ export class TracksUncompleteComponent implements OnInit { ...@@ -31,5 +32,13 @@ export class TracksUncompleteComponent implements OnInit {
this this
.trackService .trackService
.getUnCompletedTrack() .getUnCompletedTrack()
.subscribe({
next :(data)=>{
this.tracks=data
},
error:(err)=>{
this.toastrService.error('تعذر تحميل المتابعات غير المكتملة')
}
})
} }
} }
...@@ -37,7 +37,7 @@ export class TrackService { ...@@ -37,7 +37,7 @@ export class TrackService {
return this return this
.http .http
.get<Track[]> .get<Track[]>
(`${this.config.getServerUrl()}/UnCompleted`); (`${this.config.getServerUrl()}/Tracks/UnCompleted`);
} }
...@@ -105,6 +105,12 @@ export class TrackService { ...@@ -105,6 +105,12 @@ export class TrackService {
); );
} }
public getTracks():Observable<Track[]>{
return this
.http
.get<Track[]>(`${this.config.getServerUrl()}/Tracks/ByFilter/`);
}
// this method remove a track // this method remove a track
// //
public removeTrack(request :RemoveTrackRequest ):Observable<void>{ public removeTrack(request :RemoveTrackRequest ):Observable<void>{
......
...@@ -13,7 +13,7 @@ const routes: Routes = [ ...@@ -13,7 +13,7 @@ const routes: Routes = [
{path:'detail/:id',component:TrackDetailsComponent}, {path:'detail/:id',component:TrackDetailsComponent},
{path:'history/step/:id',component:StepTrackHistoryComponent} , {path:'history/step/:id',component:StepTrackHistoryComponent} ,
{path:'project/:projectId/employee/:employeeId',component:EmployeeTrackHistoryComponent}, {path:'project/:projectId/employee/:employeeId',component:EmployeeTrackHistoryComponent},
{path:'uncompleted/',component:TracksUncompleteComponent} , {path:'uncompleted',component:TracksUncompleteComponent} ,
{path:'',component:TracksListComponent} {path:'',component:TracksListComponent}
......
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