Commit 452aa9c3 authored by hasan khaddour's avatar hasan khaddour

final commit

parent b294e671
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button type="button" [disabled]="canSee()" (click)="onEdit()" class="btn m-2 btn-sm btn-secondary">تعديل المعلومات</button> <button type="button" [disabled]="!canEdit()" (click)="onEdit()" class="btn m-2 btn-sm btn-secondary">تعديل المعلومات</button>
<button type="button" [disabled]="canSee()" (click)="onDelete()"class="btn m-2 btn-sm btn-danger">إزالة</button> <button type="button" [disabled]="!canEdit()" (click)="onDelete()"class="btn m-2 btn-sm btn-danger">إزالة</button>
</div> </div>
</div> </div>
......
...@@ -20,12 +20,14 @@ export class TypeItemComponent { ...@@ -20,12 +20,14 @@ export class TypeItemComponent {
private ser : UserService private ser : UserService
){} ){}
canSee(){
return this.ser.hasRole(ROLES.CUSTOMERS_PLANER)
}
onEdit() { onEdit() {
this.edit.emit(); this.edit.emit();
} }
canEdit(): boolean {
return this.ser.hasRole(ROLES.PROJECTS_PLANNER);
}
onDelete() { onDelete() {
this.delete.emit(); this.delete.emit();
......
...@@ -63,7 +63,7 @@ export class ProjectReplanModalComponent { ...@@ -63,7 +63,7 @@ export class ProjectReplanModalComponent {
private _setCanMove(){ private _setCanMove(){
this.project.currentState.toLowerCase() =="inprogress" ? true : false ; this.canRePlan=this.project.currentState.toLowerCase() =="inprogress" ? true : false ;
} }
} }
...@@ -151,8 +151,7 @@ export class ProjectCreateComponent { ...@@ -151,8 +151,7 @@ export class ProjectCreateComponent {
// 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.getCustomersByFilter(value)) switchMap(value => this.customersService.getCustomersByFilter(value).pipe( map ( e => e.filter(s => s.customerName.toLocaleLowerCase().includes(value)))))
); );
} }
......
...@@ -47,7 +47,7 @@ export class StepListComponent { ...@@ -47,7 +47,7 @@ export class StepListComponent {
this.projectService.getProjectById(this.projectId).subscribe({ this.projectService.getProjectById(this.projectId).subscribe({
next: (data)=> { next: (data)=> {
this.steps= data.steps this.steps= data.steps.sort( (e,p)=> Number(new Date (e.stepInfo.startDate)) - Number(new Date(p.stepInfo.startDate)) )
this.project=data; this.project=data;
this.toastr.success("تم تحميل المراحل بنجاح"); this.toastr.success("تم تحميل المراحل بنجاح");
} }
......
...@@ -15,11 +15,19 @@ ...@@ -15,11 +15,19 @@
طباعة طباعة
</button> </button>
<button <button
[routerLink]="['/reports/definition',projectId]"
type="button" class="btn mr-1 btn-secondary m-1">
بطاقة التعريف
</button>
<button
[routerLink]="['/reports',projectId,'steptracks',trackId]" [routerLink]="['/reports',projectId,'steptracks',trackId]"
type="button" class="btn mr-1 btn-secondary m-1"> type="button" class="btn mr-1 btn-secondary m-1">
تقرير متابعة العمالين تقرير متابعة العمالين
</button> </button>
<button *ngIf="project.currentState.toLowerCase()=='completed'" type="button" class="btn mr-1 btn-secondary m-1"> <button
[routerLink]="['/reports/completion',project.id]"
*ngIf="project.currentState.toLowerCase()=='completed'" type="button" class="btn mr-1 btn-secondary m-1">
تقرير انجاز تقرير انجاز
</button> </button>
<button <button
......
...@@ -7,7 +7,11 @@ ...@@ -7,7 +7,11 @@
<div class="mb-3"> <div class="mb-3">
<label for="stepName" class="form-label">اسم المرحلة</label> <label for="stepName" class="form-label">اسم المرحلة</label>
<input type="text" id="stepName" formControlName="stepName" class="form-control" <input type="text" id="stepName" formControlName="stepName" class="form-control"
[ngbTypeahead]="search" (selectItem)="onStepSelected($event.item)"> [ngbTypeahead]="search"
[resultFormatter]="resultFormatter"
[inputFormatter]="inputFormatter"
(selectItem)="onStepSelected($event)"
>
</div> </div>
<input type="number" hidden id="id" formControlName="id" class="form-control" > <input type="number" hidden id="id" formControlName="id" class="form-control" >
......
...@@ -65,11 +65,24 @@ export class AddStepTrackModalComponent { ...@@ -65,11 +65,24 @@ export class AddStepTrackModalComponent {
search = (text$: Observable<string>) => search = (text$: Observable<string>) =>
text$.pipe( text$.pipe(
map(term => term.length < 2 ? [] : map(term => term.length < 2 ? [] :
this.filteredSteps.filter(v => v.stepInfo.stepName.toLowerCase().includes(term.toLowerCase())).slice(0, 10).map( e =>{ this.stepTrackForm.patchValue({ id: e.id });return e.stepInfo.stepName +" % "+ e.currentCompletionRatio})) this
); .filteredSteps
.filter(v => v.stepInfo.stepName.toLowerCase().includes(term.toLowerCase()))
.slice(0, 10)
));
resultFormatter = (step: Step) => `${step.stepInfo.stepName} - ${step.currentCompletionRatio} %`;
onStepSelected(step: Step): void { inputFormatter = (step: Step) => step.stepInfo.stepName;
onStepSelected(event: any): void {
const selectedStep = event.item;
this.stepTrackForm.patchValue({
stepName: this.resultFormatter(selectedStep),
id: selectedStep.id
});
debugger debugger
// this.stepTrackForm.patchValue({ stepName1: step.stepInfo?.stepName }); // this.stepTrackForm.patchValue({ stepName1: step.stepInfo?.stepName });
......
<section *ngIf="tracks" class="row"> <section class="row">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12"> <div class="col-12">
<div class="row align-items-center my-4"> <div class="row align-items-center my-4">
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
</div> </div>
<hr /> <hr />
<div class="card shadow mb-4 col-8 offset-2" *ngFor="let track of tracks"> <card-skeleton *ngIf="!tracks">
</card-skeleton>
<div *ngIf="tracks">
<div class="card shadow mb-4 col-8 offset-2" *ngFor="let track of tracks">
<div class="card-header py-3"> <div class="card-header py-3">
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-auto"> <div class="col-auto">
...@@ -68,4 +73,6 @@ ...@@ -68,4 +73,6 @@
<div *ngIf="tracks.length == 0">لا يوجد أي عمليات متابعة غير مكتملة</div> <div *ngIf="tracks.length == 0">لا يوجد أي عمليات متابعة غير مكتملة</div>
</div> </div>
</div> </div>
</div>
</section> </section>
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