Commit 14fd9a94 authored by hasan khaddour's avatar hasan khaddour

fix s

parent c63882b7
...@@ -8,6 +8,7 @@ import { catchError, Observable, tap, throwError } from 'rxjs'; ...@@ -8,6 +8,7 @@ import { catchError, Observable, tap, throwError } from 'rxjs';
import { ConfigurationService } from '../configuration/configuration.service'; import { ConfigurationService } from '../configuration/configuration.service';
import { DataStorageService } from '../dataStorage/data-storage.service'; import { DataStorageService } from '../dataStorage/data-storage.service';
import { CookieService } from 'ngx-cookie-service'; import { CookieService } from 'ngx-cookie-service';
import { Router } from '@angular/router';
//#endregion Imports //#endregion Imports
...@@ -22,7 +23,8 @@ export class AuthenticationService { ...@@ -22,7 +23,8 @@ export class AuthenticationService {
private http : HttpClient, private http : HttpClient,
private config : ConfigurationService, private config : ConfigurationService,
private dataStorage : DataStorageService, private dataStorage : DataStorageService,
private cookieService :CookieService private cookieService :CookieService ,
private router : Router
) { } ) { }
//#endregion Consrtuctor //#endregion Consrtuctor
...@@ -86,6 +88,7 @@ export class AuthenticationService { ...@@ -86,6 +88,7 @@ export class AuthenticationService {
logout(){ logout(){
this.cookieService.delete('token'); this.cookieService.delete('token');
this.dataStorage.removeItem("userDetails"); this.dataStorage.removeItem("userDetails");
this.router.navigate([''])
} }
//#endregion Logout //#endregion Logout
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button type="button" (click)="onEdit()" class="btn m-2 btn-sm btn-secondary">تعديل المعلومات</button> <button type="button" [disabled]="canSee()" (click)="onEdit()" class="btn m-2 btn-sm btn-secondary">تعديل المعلومات</button>
<button type="button" (click)="onDelete()"class="btn m-2 btn-sm btn-danger">إزالة</button> <button type="button" [disabled]="canSee()" (click)="onDelete()"class="btn m-2 btn-sm btn-danger">إزالة</button>
</div> </div>
</div> </div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ProjectType } from '../../models/responses/projectType'; import { ProjectType } from '../../models/responses/projectType';
import { UserService } from '../../../core/services/authentication/user.service';
import { ROLES } from '../../../core/constants/roles';
...@@ -14,6 +16,13 @@ export class TypeItemComponent { ...@@ -14,6 +16,13 @@ export class TypeItemComponent {
@Output() edit = new EventEmitter<void>(); @Output() edit = new EventEmitter<void>();
@Output() delete = new EventEmitter<void>(); @Output() delete = new EventEmitter<void>();
constructor(
private ser : UserService
){}
canSee(){
return this.ser.hasRole(ROLES.CUSTOMERS_PLANER)
}
onEdit() { onEdit() {
this.edit.emit(); this.edit.emit();
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</div> </div>
<button type="submit" class="col-4 offset-2 btn btn-primary" [disabled]="!editParticipantForm.valid">حفظ</button> <button type="submit" class="col-4 offset-2 btn btn-primary" [disabled]="!editParticipantForm.valid">حفظ</button>
<button type="button" (click)="closeModal()">إلغاء</button> <button type="button"class="col-4 offset-2 btn btn-secondary" (click)="closeModal()">إلغاء</button>
</form> </form>
</div> </div>
<!-- remove-participant-modal.component.html -->
<div class="modal fade" id="removeParticipantModal" tabindex="-1" aria-labelledby="removeParticipantModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"> <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)="close()"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p class="text-center text-danger">هل أنت متأكد من أنك تريد إزالة السيد {{participant.employee.personalInfo | fullname}} من قائمة المشاركين في المشروع</p> <p class="text-center text-danger">هل أنت متأكد من أنك تريد إزالة السيد {{participant.employee.personalInfo | fullname}} من قائمة المشاركين في المشروع</p>
...@@ -13,7 +9,4 @@ ...@@ -13,7 +9,4 @@
<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
...@@ -30,5 +30,8 @@ export class RemoveParticipantModalComponent { ...@@ -30,5 +30,8 @@ export class RemoveParticipantModalComponent {
}); });
} }
close (){
this.activeModal.close();
}
} }
...@@ -14,21 +14,19 @@ ...@@ -14,21 +14,19 @@
<div class="row"> <div class="row">
<p>
استمارة انجاز مشروع
</p>
<div class="mb-3 col-8 offset-1"> <div class="mb-3 col-8 offset-1">
<label for="stepName" class="form-label">ملاحظات الجهة الطارحة</label> <label for="stepName" class="form-label">ملاحظات الجهة الطارحة</label>
<textarea [cols]="4" type="text" name="stepName" id="stepName" class="form-control" [(ngModel)]="request.customerNotes" required> <textarea [cols]="4" type="text" name="stepName" id="stepName" class="form-control" [(ngModel)]="request.customerNotes" required>
</textarea> </textarea>
</div> </div>
<div class="mb-3 col-3 offset-1 "> <div class="mb-3 col-6 offset-1 ">
<label for="start" class="form-label">تاريخ الاكمال</label> <label for="start" class="form-label">تاريخ الاكمال</label>
<input type="date" id="start" class="form-control" [(ngModel)]="request.completionDate" name="start" required> <input type="date" id="start" class="form-control" [(ngModel)]="request.completionDate" name="start" required>
</div> </div>
<div class="mb-3 col-3"> <div class="mb-3 col-6 offset-1">
<label for="worker" class="form-label">تقييم الجهة الطارحة </label> <label for="worker" class="form-label">تقييم الجهة الطارحة </label>
<input id="worker" class="form-control" [(ngModel)]="request.customerRate" name="worker" required> <input id="worker" class="form-control" [(ngModel)]="request.customerRate" name="worker" required>
</div> </div>
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
</div> </div>
<div class="col-10"> <div class="col-10">
<button type="button" class="btn m-2 btn-sm btn-primary">استعراض تاريخ تبدلاته </button> <button type="button" [routerLink]="['/projects',projectId,'history','participationChange',selectedParticipant.employeeId]"class="btn m-2 btn-sm btn-primary">استعراض تاريخ تبدلاته </button>
<button type="button" (click)="onParticipantUpdated()" class="btn m-2 btn-sm btn-secondary">تعديل معلومات المشاركة</button> <button type="button" (click)="openUpdateModal()" class="btn m-2 btn-sm btn-secondary">تعديل معلومات المشاركة</button>
<button type="button" (click)="openDeleteModal()" class="btn m-2 btn-sm btn-danger">إزالة</button> <button type="button" (click)="openDeleteModal()" class="btn m-2 btn-sm btn-danger">إزالة</button>
<button type="button" [routerLink]="['/reports/contributions',selectedParticipant.projectId,'employee',selectedParticipant.employeeId]" class="btn btn-sm btn-secondary">المساهمات</button> <button type="button" [routerLink]="['/reports/contributions',selectedParticipant.projectId,'employee',selectedParticipant.employeeId]" class="btn btn-sm btn-secondary">المساهمات</button>
......
...@@ -94,7 +94,7 @@ export class ParticipantsListComponent { ...@@ -94,7 +94,7 @@ export class ParticipantsListComponent {
if (result) { if (result) {
// Add the new project to the list // Add the new project to the list
this.isDetailMode=false ; this.isDetailMode=false ;
this.participants=this.participants.filter(w => w.employeeId == this.selectedParticipant.employeeId) this.participants=this.participants.filter(w => w.employeeId != this.selectedParticipant.employeeId)
} }
...@@ -115,6 +115,8 @@ openUpdateModal(): void { ...@@ -115,6 +115,8 @@ openUpdateModal(): void {
let part= this.participants.find(w => w.employeeId == this.selectedParticipant.employeeId) let part= this.participants.find(w => w.employeeId == this.selectedParticipant.employeeId)
part!.partialTimeRatio=result.partialTimeRation; part!.partialTimeRatio=result.partialTimeRation;
this.selectedParticipant.partialTimeRatio=result.partialTimeRation
this.selectedParticipant.role=result.role
part!.role=result.role; part!.role=result.role;
......
...@@ -210,7 +210,7 @@ export class ProjectCreateComponent { ...@@ -210,7 +210,7 @@ export class ProjectCreateComponent {
next: (data)=>{ next: (data)=>{
this.toastr.success("تمت إضافة الجهة بنجاح") this.toastr.success("تمت إضافة الجهة بنجاح")
this.router.navigate(['/projects/detail/',data]) this.router.navigate(['/projects/detail/'+data.id])
}, },
error:(err)=>{ error:(err)=>{
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<i class="fe fe-map"></i><span> استعراض أنواع المشاريع</span> <i class="fe fe-map"></i><span> استعراض أنواع المشاريع</span>
</a> </a>
</li> </li>
<li class="nav-item" *ngIf="hasRole('Planner')"> <li class="nav-item" *ngIf="hasRole(alroles.PROJECTS_PLANNER)">
<a [routerLink]="['/types/create']" class="nav-link collapsed"> <a [routerLink]="['/types/create']" class="nav-link collapsed">
<i class="fe fe-edit-2"></i><span>إضافة نوع جديد</span> <i class="fe fe-edit-2"></i><span>إضافة نوع جديد</span>
</a> </a>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a <a
*ngIf="hasRole('Planner')" *ngIf="hasRole(alroles.CUSTOMERS_PLANER)"
[routerLink]="['/customers/create']" [routerLink]="['/customers/create']"
class="nav-link collapsed" class="nav-link collapsed"
> >
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="col-auto"> <div class="col-auto">
<button type="button " [routerLink]="['/tracks/project/',empoyeeTrack.trackId]" class="btn m-2 btn-sm btn-secondary">الاطلاع على عملية المتابعة</button> <button type="button " *ngIf="canSee()" [routerLink]="['/tracks/project/',empoyeeTrack.trackId]" class="btn m-2 btn-sm btn-secondary">الاطلاع على عملية المتابعة</button>
</div> </div>
</div> </div>
......
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { EmployeeTrack } from '../../../models/responses/employeeTrack'; import { EmployeeTrack } from '../../../models/responses/employeeTrack';
import { UserService } from '../../../../core/services/authentication/user.service';
import { ROLES } from '../../../../core/constants/roles';
@Component({ @Component({
selector: 'employee-history-item', selector: 'employee-history-item',
...@@ -9,4 +11,13 @@ import { EmployeeTrack } from '../../../models/responses/employeeTrack'; ...@@ -9,4 +11,13 @@ import { EmployeeTrack } from '../../../models/responses/employeeTrack';
export class EmployeeHistoryItemComponent { export class EmployeeHistoryItemComponent {
@Input() empoyeeTrack :EmployeeTrack @Input() empoyeeTrack :EmployeeTrack
constructor(
private userService : UserService
){}
canSee(): any {
return this.userService.hasRole(ROLES.SCIENTIFIC_DEPUTY)||this.empoyeeTrack.employeeId==this.userService.getEmployeeId();
}
} }
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<div class="col-auto"> <div class="col-auto">
<button type="button "[routerLink]="['/track/history/step',stepTrack.stepId]" class="btn m-2 btn-sm btn-secondary">تاريخ المتابعة</button> <button type="button "[routerLink]="['/tracks/history/step',stepTrack.stepId]" class="btn m-2 btn-sm btn-secondary">تاريخ المتابعة</button>
<button type="button" (click)="onEdit()" class="btn m-2 btn-sm btn-secondary">تعديل</button> <button type="button" (click)="onEdit()" class="btn m-2 btn-sm btn-secondary">تعديل</button>
</div> </div>
</div> </div>
......
...@@ -265,7 +265,7 @@ export class TrackDetailsComponent implements OnInit { ...@@ -265,7 +265,7 @@ export class TrackDetailsComponent implements OnInit {
this._canComplete(); this._canComplete();
this.stepTracks.push(st) this.stepTracks.push(st)
this.steps=this.steps.filter(e => e.id == s?.id) this.steps=this.steps.filter(e => e.id == s!.id)
this.trackedSteps.push(s!); this.trackedSteps.push(s!);
} }
......
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