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

Add compltetion reports

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