Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
PSManagementUI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
PSManagementUI
Commits
badb52e4
Commit
badb52e4
authored
Aug 24, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the main domains for traks
parent
3f48d457
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
439 additions
and
34 deletions
+439
-34
step-row-item.component.html
...cts/components/step-row-item/step-row-item.component.html
+1
-1
step-row-item.component.ts
...jects/components/step-row-item/step-row-item.component.ts
+6
-1
step-list.component.html
src/app/projects/pages/step-list/step-list.component.html
+76
-2
step-list.component.ts
src/app/projects/pages/step-list/step-list.component.ts
+55
-1
add-employee-track-modal.component.html
...loyee-track-modal/add-employee-track-modal.component.html
+65
-1
add-employee-track-modal.component.ts
...mployee-track-modal/add-employee-track-modal.component.ts
+118
-1
add-step-track-modal.component.html
.../add-step-track-modal/add-step-track-modal.component.html
+10
-6
add-step-track-modal.component.ts
...ls/add-step-track-modal/add-step-track-modal.component.ts
+30
-10
AddStepTrackRequest.ts
src/app/tracks/models/requests/AddStepTrackRequest.ts
+0
-1
track-details.component.html
...p/tracks/pages/track-details/track-details.component.html
+16
-5
track-details.component.ts
...app/tracks/pages/track-details/track-details.component.ts
+62
-5
No files found.
src/app/projects/components/step-row-item/step-row-item.component.html
View file @
badb52e4
...
...
@@ -35,7 +35,7 @@
<div
class=
"col-auto"
>
<button
type=
"button"
class=
"btn m-2 btn-sm btn-primary"
>
استعراض تارخ متابعتها
</button>
<button
type=
"button"
class=
"btn m-2 btn-sm btn-secondary"
>
تعديل المعلومات
</button>
<button
type=
"button"
class=
"btn m-2 btn-sm btn-danger"
>
إزالة
</button>
<button
type=
"button"
(
click
)="
onDelete
()"
class=
"btn m-2 btn-sm btn-danger"
>
إزالة
</button>
</div>
</div>
...
...
src/app/projects/components/step-row-item/step-row-item.component.ts
View file @
badb52e4
import
{
Component
,
In
put
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
Input
,
Out
put
}
from
'@angular/core'
;
import
{
Step
}
from
'../../models/responses/Step'
;
@
Component
({
...
...
@@ -9,4 +9,9 @@ import { Step } from '../../models/responses/Step';
export
class
StepRowItemComponent
{
@
Input
()
step
:
Step
@
Output
()
delete
=
new
EventEmitter
<
void
>
();
onDelete
()
{
this
.
delete
.
emit
();
}
}
src/app/projects/pages/step-list/step-list.component.html
View file @
badb52e4
...
...
@@ -12,11 +12,85 @@
<hr>
<step-row-item
class=
" offset-2"
*
ngFor=
"let step of steps"
[
step
]="
step
"
></step-row-item>
<step-row-item
class=
" offset-2"
*
ngFor=
"let step of steps"
[
step
]="
step
"
(
delete
)="
openModal
('
delete
',
step
)"
></step-row-item>
<div
*
ngIf=
"steps.length==0"
>
للأسف هذا المروع لايحوي على أية مراحل
</div>
</div>
</div>
</section>
\ No newline at end of file
</section>
<div
class=
"modal fade"
id=
"stepModal"
tabindex=
"-1"
aria-labelledby=
"modalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog modal-dialog-centered"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
<h5
class=
"modal-title"
id=
"modalLabel"
>
{{ modalTitle }}
</h5>
</div>
<div
class=
"modal-body"
>
<!-- Edit Form -->
<!-- <div *ngIf="modalMode === 'edit'">
<form (ngSubmit)="saveProject()">
<div class="row">
<div class="mb-3 col-5 offset-1">
<label for="stepName" class="form-label">نوع الكلفة</label>
<input type="text" name="stepName" id="stepName" class="form-control" [(ngModel)]="selectedItem.costType" required>
</div>
<div class="mb-3 col-5">
<label for="expectedSpendingDate" class="form-label">تاريخ الانفاق المتوقع</label>
<input type="date" id="expectedSpendingDate" class="form-control" [(ngModel)]="selectedItem.expectedSpendingDate" name="expectedSpendingDate" required>
</div>
<div class="mb-3 col-4 offset-1">
<label for="local" class="form-label">الشراء المحلي</label>
<input id="local" class="form-control" [(ngModel)]="selectedItem.localPurchase" name="local" required>
</div>
<div class="mb-3 col-4 ">
<label for="completion" class="form-label">الشراء الخارجي </label>
<input id="completion" class="form-control" [(ngModel)]="selectedItem.externalPurchase.ammount" name="completion" required>
</div>
<div class="mb-3 col-2">
<label for="duration" class="form-label">نوغ القطع</label>
<select id="duration" class="form-control select " [(ngModel)]="selectedItem.externalPurchase.currency" name="duration" required>
<option value="USA">USA</option>
<option value="EUR">EUR</option>
</select>
</div>
</div>
<div class="row">
<div class="mb-3 col-10 offset-1 " >
<label for="decription" class="form-label">البيان</label>
<textarea col="3" name="worker" id="decription" class="form-control" [(ngModel)]="selectedItem.description" required>
</textarea>
</div>
</div>
<div class="row">
</div>
<button type="submit" class="btn btn-success">حفظ</button>
</form>
</div> -->
<!-- Delete Confirmation -->
<div
*
ngIf=
"modalMode === 'delete'"
>
<p>
هل أنت متأكد من أنك تريد حذف المرحلة {{ selectedItem.stepInfo.stepName }}?
</p>
<button
type=
"button"
class=
"btn m-4 btn-danger"
(
click
)="
delete
()"
>
حذف
</button>
<button
type=
"button"
class=
"btn m-4 btn-secondary"
(
click
)="
closeModal
()"
>
إلغاء
</button>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/projects/pages/step-list/step-list.component.ts
View file @
badb52e4
...
...
@@ -6,6 +6,7 @@ import { ActivatedRoute, Route, Router } from '@angular/router';
import
{
StepService
}
from
'../../services/step.service'
;
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
AddStepModalComponent
}
from
'../../components/modals/add-step-modal/add-step-modal.component'
;
import
{
Modal
}
from
'bootstrap'
;
@
Component
({
selector
:
'step-list'
,
templateUrl
:
'./step-list.component.html'
,
...
...
@@ -13,7 +14,9 @@ import { AddStepModalComponent } from '../../components/modals/add-step-modal/ad
})
export
class
StepListComponent
{
steps
:
Step
[]
modalMode
:
'edit'
|
'delete'
=
'edit'
;
modalTitle
:
string
=
''
;
selectedItem
:
Step
;
projectId
=
Number
(
this
.
route
.
snapshot
.
paramMap
.
get
(
'id'
));
constructor
(
...
...
@@ -63,4 +66,55 @@ export class StepListComponent {
});
}
openModal
(
mode
:
'edit'
|
'delete'
,
item
:
Step
):
void
{
this
.
modalMode
=
mode
;
this
.
selectedItem
=
{
...
item
};
// Clone project to prevent direct mutation
console
.
log
(
this
.
selectedItem
)
if
(
mode
===
'edit'
)
{
this
.
modalTitle
=
'تعديل عنصر '
;
}
else
if
(
mode
===
'delete'
)
{
this
.
modalTitle
=
'حذف عنصر'
;
}
const
modalElement
=
document
.
getElementById
(
'stepModal'
);
if
(
modalElement
)
{
new
Modal
(
modalElement
).
show
();
// Open the modal
}
}
delete
():
void
{
this
.
stepService
.
deleteSep
(
this
.
selectedItem
.
id
).
subscribe
({
next
:()
=>
{
this
.
steps
=
this
.
steps
.
filter
(
p
=>
p
.
id
!==
this
.
selectedItem
.
id
);
this
.
toastr
.
success
(
"تم الحذف بنجاح"
)
this
.
closeModal
();
}
,
error
:(
err
)
=>
{
this
.
toastr
.
error
(
"لقد حدث خطاء ما "
)
this
.
closeModal
();
}
}
);
}
closeModal
():
void
{
const
modalElement
=
document
.
getElementById
(
'stepModal'
);
if
(
modalElement
)
{
new
Modal
(
modalElement
).
hide
();
// Close the modal
}
}
}
src/app/tracks/components/modals/add-employee-track-modal/add-employee-track-modal.component.html
View file @
badb52e4
<p>
add-employee-track-modal works!
</p>
<div
class=
"modal modal-md fade"
id=
"addEmployeeTrackModal"
tabindex=
"-1"
aria-labelledby=
"addEmployeeTrackModalLable"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
id=
"addEmployeeTrackModalLable"
>
إضافة متابعة مشارك
</h5>
<button
type=
"button"
class=
"mr-4 ml-4 btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<div
class=
"modal-body"
>
<form
[
formGroup
]="
stepTrackForm
"
(
ngSubmit
)="
onSubmit
()"
>
<div
class=
"row "
>
<div
class=
"mb-3 col-4"
>
<label
for=
"hiastId"
class=
"form-label"
>
الرقم الذاتي لمشارك
</label>
<input
type=
"text"
id=
"hiastId"
formControlName=
"hiastId"
class=
"form-control"
[
ngbTypeahead
]="
search
"
(
selectItem
)="
onStepSelected
($
event
.
item
)"
>
</div>
<input
type=
"number"
hidden
id=
"id"
formControlName=
"id"
class=
"form-control"
>
<div
class=
"mb-3 col-6"
>
<label
for=
"notes"
class=
"form-label"
>
الملاحظات
</label>
<input
type=
"text"
id=
"notes"
formControlName=
"notes"
class=
"form-control"
>
</div>
</div>
<div
class=
"row"
>
<div
class=
"mb-3 col-4"
>
<label
for=
"assignedWork"
class=
"form-label"
>
العمل المسند
</label>
<input
id=
"assignedWork"
formControlName=
"assignedWork"
class=
"form-control"
>
</div>
<div
class=
"mb-3 col-4"
>
<label
for=
"performedWork"
class=
"form-label"
>
العمل المنجز
</label>
<input
id=
"performedWork"
formControlName=
"performedWork"
class=
"form-control"
>
</div>
<div
class=
"mb-3 col-4"
>
<label
for=
"assignedWorkEnd"
class=
"form-label"
>
تاريخ تنفيذ العمل المسند
</label>
<input
type=
"date"
id=
"assignedWorkEnd"
formControlName=
"assignedWorkEnd"
class=
"form-control"
>
</div>
</div>
<div
class=
"row"
>
<div
class=
"mb-3 col-4"
>
<label
for=
"assignedWorkingHours"
class=
"form-label"
>
ساعات العمل المسندة
</label>
<input
type=
"number"
id=
"assignedWorkingHours"
formControlName=
"assignedWorkingHours"
class=
"form-control"
>
</div>
<div
class=
"mb-3 col-4"
>
<label
for=
"workedHours"
class=
"form-label"
>
ساعات العمل الفعلية
</label>
<input
type=
"number"
id=
"workedHours"
formControlName=
"workedHours"
class=
"form-control"
>
</div>
<div
class=
"mb-3 col-4"
>
<label
for=
"contributingRatio"
class=
"form-label"
>
نسبة المساهمة في العمل
</label>
<input
type=
"number"
id=
"contributingRatio"
formControlName=
"contributingRatio"
class=
"form-control"
>
</div>
</div>
<button
type=
"submit"
class=
"btn mr-4 ml-4 btn-primary"
[
disabled
]="!
stepTrackForm
.
valid
"
>
إضافة
</button>
<button
data-bs-dismiss=
"modal"
aria-label=
"Close"
class=
" mr-4 ml-4 btn btn-primary"
>
إلغاء
</button>
</form>
</div>
</div>
</div>
</div>
\ No newline at end of file
src/app/tracks/components/modals/add-employee-track-modal/add-employee-track-modal.component.ts
View file @
badb52e4
import
{
Component
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
Input
,
Output
}
from
'@angular/core'
;
import
{
FormGroup
,
FormBuilder
,
Validators
}
from
'@angular/forms'
;
import
{
Modal
}
from
'bootstrap'
;
import
{
Observable
,
map
}
from
'rxjs'
;
import
{
Step
}
from
'../../../../projects/models/responses/Step'
;
import
{
StepService
}
from
'../../../../projects/services/step.service'
;
import
{
AddStepTrackRequest
}
from
'../../../models/requests/AddStepTrackRequest'
;
import
{
Employee
}
from
'../../../../employees/models/responses/employee'
;
import
{
AddEmployeeTrackRequest
}
from
'../../../models/requests/AddEmployeeTrackRequest'
;
import
{
ProjectService
}
from
'../../../../projects/services/project.service'
;
import
{
EmployeeParticipate
}
from
'../../../../employees/models/responses/employeeParticipate'
;
import
{
EmployeeTrack
}
from
'../../../models/responses/employeeTrack'
;
import
{
FullnamePipe
}
from
'../../../../shared/pipes/fullName/fullname.pipe'
;
@
Component
({
selector
:
'add-employee-track-modal'
,
...
...
@@ -6,5 +18,110 @@ import { Component } from '@angular/core';
styleUrl
:
'./add-employee-track-modal.component.css'
})
export
class
AddEmployeeTrackModalComponent
{
@
Input
()
isVisible
=
false
;
participants
:
EmployeeParticipate
[]
=
[];
// All steps available for the project
@
Input
()
trackedParticipants
:
EmployeeTrack
[]
=
[];
// Steps that are already tracked
@
Input
()
projectId
:
number
@
Input
()
trackId
:
number
@
Output
()
addEmployeeTrack
=
new
EventEmitter
<
AddEmployeeTrackRequest
>
();
stepTrackForm
:
FormGroup
;
filteredParticipants
:
Employee
[]
=
[];
constructor
(
private
fb
:
FormBuilder
,
private
projectService
:
ProjectService
)
{
this
.
stepTrackForm
=
this
.
fb
.
group
({
id
:
[],
hiastId
:
[
''
,
Validators
.
required
],
notes
:
[
''
,
Validators
.
required
],
assignedWork
:
[
''
,
Validators
.
required
],
performedWork
:
[
''
,
Validators
.
required
],
assignedWorkEnd
:
[
new
Date
(),
Validators
.
required
],
assignedWorkingHours
:
[
0
,[
Validators
.
required
,,
Validators
.
min
(
0
)]],
workedHours
:
[
0
,
[
Validators
.
required
,,
Validators
.
min
(
0
)]],
contributingRatio
:
[
0
,
[
Validators
.
required
,
Validators
.
min
(
0
),,
Validators
.
max
(
100
)]]
}
);
}
ngOnInit
():
void
{
this
.
projectService
.
getParticipants
(
this
.
projectId
)
.
subscribe
({
next
:
(
data
)
=>
{
console
.
log
(
data
)
this
.
participants
=
data
this
.
filteredParticipants
=
this
.
participants
.
filter
(
track
=>
!
this
.
trackedParticipants
.
some
(
participate
=>
participate
.
emloyeeId
===
track
.
employeeId
)
).
map
(
e
=>
e
.
employee
);
}
})
}
search
=
(
text
$
:
Observable
<
string
>
)
=>
text$
.
pipe
(
map
(
term
=>
term
.
length
<
1
?
[]
:
this
.
filteredParticipants
.
filter
(
v
=>
v
.
hiastId
.
toString
().
includes
(
term
.
toLowerCase
())).
slice
(
0
,
10
).
map
(
e
=>
e
.
personalInfo
.
firstName
+
" "
+
e
.
personalInfo
.
lastName
))
);
onStepSelected
(
step
:
Employee
):
void
{
debugger
this
.
stepTrackForm
.
patchValue
({
hiastId
:
step
.
hiastId
});
//this.stepTrackForm.patchValue({id: step.id});
}
onSubmit
():
void
{
if
(
this
.
stepTrackForm
.
valid
)
{
debugger
const
selectedStep
=
this
.
filteredParticipants
.
find
(
emp
=>
emp
.
hiastId
==
this
.
stepTrackForm
.
value
.
hiastId
);
if
(
selectedStep
)
{
const
newEmployeeTrack
:
AddEmployeeTrackRequest
=
{
employeeId
:
selectedStep
.
id
,
trackId
:
this
.
trackId
,
employeeWork
:
{
workedHours
:
this
.
stepTrackForm
.
value
.
workedHours
,
assignedWorkingHours
:
this
.
stepTrackForm
.
value
.
assignedWork
,
contributingRatio
:
this
.
stepTrackForm
.
value
.
contributingRatio
},
employeeWorkInfo
:{
assignedWork
:
this
.
stepTrackForm
.
value
.
assignedWork
,
performedWork
:
this
.
stepTrackForm
.
value
.
performedWork
,
assignedWorkEnd
:
this
.
stepTrackForm
.
value
.
assignedWorkEnd
},
notes
:
this
.
stepTrackForm
.
value
.
notes
,
projectId
:
this
.
projectId
};
this
.
closeModal
();
this
.
addEmployeeTrack
.
emit
(
newEmployeeTrack
);
}
}
}
closeModal
():
void
{
const
modal
=
document
.
getElementById
(
'addEmployeeTrackModal'
);
if
(
modal
)
{
const
bootstrapModal
=
new
Modal
(
modal
);
bootstrapModal
.
hide
();
}
}
}
src/app/tracks/components/modals/add-step-track-modal/add-step-track-modal.component.html
View file @
badb52e4
...
...
@@ -2,25 +2,29 @@
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
id=
"addStepTrackModalLabel"
>
Add Step Track
</h5>
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
<h5
class=
"modal-title"
id=
"addStepTrackModalLabel"
>
إضافة متابعة مرحلة
</h5>
<button
type=
"button"
class=
"
mr-4 ml-4
btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<div
class=
"modal-body"
>
<form
[
formGroup
]="
stepTrackForm
"
(
ngSubmit
)="
onSubmit
()"
>
<div
class=
"mb-3"
>
<label
for=
"stepName"
class=
"form-label"
>
Step Name
</label>
<label
for=
"stepName"
class=
"form-label"
>
اسم المرحلة
</label>
<input
type=
"text"
id=
"stepName"
formControlName=
"stepName"
class=
"form-control"
[
ngbTypeahead
]="
search
"
(
selectItem
)="
onStepSelected
($
event
.
item
)"
>
</div>
<input
type=
"number"
hidden
id=
"id"
formControlName=
"id"
class=
"form-control"
>
<div
class=
"mb-3"
>
<label
for=
"executionState"
class=
"form-label"
>
Execution State
</label>
<label
for=
"executionState"
class=
"form-label"
>
طبيعية التنفيذ
</label>
<input
type=
"text"
id=
"executionState"
formControlName=
"executionState"
class=
"form-control"
>
</div>
<div
class=
"mb-3"
>
<label
for=
"trackExecutionRatio"
class=
"form-label"
>
Track Execution Ratio
</label>
<label
for=
"trackExecutionRatio"
class=
"form-label"
>
نسبة التنفيذ خلال المتابعة
</label>
<input
type=
"number"
id=
"trackExecutionRatio"
formControlName=
"trackExecutionRatio"
class=
"form-control"
min=
"0"
max=
"100"
>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
[
disabled
]="!
stepTrackForm
.
valid
"
>
Add Step Track
</button>
<button
type=
"submit"
class=
"btn mr-4 ml-4 btn-primary"
[
disabled
]="!
stepTrackForm
.
valid
"
>
إضافة
</button>
<button
data-bs-dismiss=
"modal"
aria-label=
"Close"
class=
"btn mr-4 ml-4 btn-primary"
>
إلغاء
</button>
</form>
</div>
</div>
...
...
src/app/tracks/components/modals/add-step-track-modal/add-step-track-modal.component.ts
View file @
badb52e4
...
...
@@ -19,8 +19,9 @@ import { StepService } from '../../../../projects/services/step.service';
})
export
class
AddStepTrackModalComponent
{
@
Input
()
isVisible
=
false
;
@
Input
()
steps
:
Step
[]
=
[];
// All steps available for the project
steps
:
Step
[]
=
[];
// All steps available for the project
@
Input
()
trackedSteps
:
Step
[]
=
[];
// Steps that are already tracked
@
Input
()
projectId
:
number
@
Input
()
trackId
:
number
@
Output
()
addStepTrack
=
new
EventEmitter
<
AddStepTrackRequest
>
();
...
...
@@ -31,6 +32,7 @@ export class AddStepTrackModalComponent {
private
stepService
:
StepService
)
{
this
.
stepTrackForm
=
this
.
fb
.
group
({
id
:
[],
stepName
:
[
''
,
Validators
.
required
],
executionState
:
[
''
,
Validators
.
required
],
trackExecutionRatio
:
[
0
,
[
Validators
.
required
,
Validators
.
min
(
0
),
Validators
.
max
(
100
)]],
...
...
@@ -38,36 +40,54 @@ export class AddStepTrackModalComponent {
}
ngOnInit
():
void
{
this
.
filteredSteps
=
this
.
steps
.
filter
(
step
=>
!
this
.
trackedSteps
.
some
(
trackedStep
=>
trackedStep
.
id
===
step
.
id
)
);
this
.
stepService
.
getStepsByProject
(
this
.
projectId
)
.
subscribe
({
next
:
(
data
)
=>
{
console
.
log
(
data
)
this
.
steps
=
data
console
.
log
(
this
.
steps
)
this
.
filteredSteps
=
this
.
steps
.
filter
(
step
=>
!
this
.
trackedSteps
.
some
(
trackedStep
=>
trackedStep
.
id
===
step
.
id
)
);
}
})
}
search
=
(
text
$
:
Observable
<
string
>
)
=>
text$
.
pipe
(
map
(
term
=>
term
.
length
<
2
?
[]
:
this
.
filteredSteps
.
filter
(
v
=>
v
.
stepInfo
.
stepName
.
toLowerCase
().
includes
(
term
.
toLowerCase
())).
slice
(
0
,
10
))
this
.
filteredSteps
.
filter
(
v
=>
v
.
stepInfo
.
stepName
.
toLowerCase
().
includes
(
term
.
toLowerCase
())).
slice
(
0
,
10
)
.
map
(
e
=>
e
.
stepInfo
.
stepName
)
)
);
onStepSelected
(
step
:
Step
):
void
{
this
.
stepTrackForm
.
patchValue
({
stepName
:
step
.
stepInfo
.
stepName
});
this
.
stepTrackForm
.
patchValue
({
stepName
:
step
.
stepInfo
?.
stepName
});
//this.stepTrackForm.patchValue({id: step.id});
}
onSubmit
():
void
{
if
(
this
.
stepTrackForm
.
valid
)
{
const
selectedStep
=
this
.
filteredSteps
.
find
(
step
=>
step
.
stepInfo
.
stepName
===
this
.
stepTrackForm
.
value
.
stepName
);
debugger
const
selectedStep
=
this
.
filteredSteps
.
find
(
step
=>
step
.
stepInfo
.
stepName
==
this
.
stepTrackForm
.
value
.
stepName
);
if
(
selectedStep
)
{
const
newStepTrack
:
AddStepTrackRequest
=
{
stepId
:
selectedStep
.
id
,
trackId
:
this
.
trackId
,
executionState
:
this
.
stepTrackForm
.
value
.
executionState
,
trackDate
:
new
Date
(),
trackExecutionRatio
:
this
.
stepTrackForm
.
value
.
trackExecutionRatio
,
};
this
.
addStepTrack
.
emit
(
newStepTrack
);
this
.
closeModal
();
this
.
addStepTrack
.
emit
(
newStepTrack
);
}
}
}
...
...
src/app/tracks/models/requests/AddStepTrackRequest.ts
View file @
badb52e4
...
...
@@ -3,6 +3,5 @@ export class AddStepTrackRequest {
stepId
:
number
;
trackId
:
number
;
executionState
:
string
;
trackDate
:
Date
;
trackExecutionRatio
:
number
;
}
src/app/tracks/pages/track-details/track-details.component.html
View file @
badb52e4
...
...
@@ -64,8 +64,7 @@
<div
class=
"tab-pane fade profile-edit pt-3 "
id=
"profile-edit"
role=
"tabpanel"
>
<button
class=
"btn btn-primary"
(
click
)="
showAddStepTrackModal
()"
>
متابعة مرحلة
</button>
<hr>
<step-track
*
ngFor=
"let stepTrack of stepTracks"
[
stepTrack
]="
stepTrack
"
></step-track>
<div
class=
"row"
*
ngIf=
"stepTracks.length ==0 "
>
لم تقم بمتابعة اية مراحل
...
...
@@ -98,14 +97,26 @@
</div>
</div>
<button
type=
"button"
class=
"btn btn-primary"
data-bs-toggle=
"modal"
data-bs-target=
"#addStepTrackModal"
>
Add Step Track
<button
type=
"button"
class=
"btn mr-4 ml-4 btn-primary"
data-bs-toggle=
"modal"
data-bs-target=
"#addStepTrackModal"
>
إضافة متابعة مرحلة
</button>
<button
type=
"button"
class=
"btn mr-4 ml-4 btn-primary"
data-bs-toggle=
"modal"
data-bs-target=
"#addEmployeeTrackModal"
>
إضافة متابعة مشارك
</button>
<add-step-track-modal
[
steps
]="
steps
"
[
trackId
]="
trackId
"
[
projectId
]="
track
.
projectId
"
[
trackedSteps
]="
trackedSteps
"
(
addStepTrack
)="
handleAddStepTrack
($
event
)"
>
</add-step-track-modal>
<add-employee-track-modal
[
trackId
]="
trackId
"
[
projectId
]="
track
.
projectId
"
[
trackedParticipants
]="
employeesTracks
"
(
addEmployeeTrack
)="
handleEmployeeTrack
($
event
)"
>
</add-employee-track-modal>
</section>
\ No newline at end of file
src/app/tracks/pages/track-details/track-details.component.ts
View file @
badb52e4
...
...
@@ -10,6 +10,9 @@ import { AddStepTrackRequest } from '../../models/requests/AddStepTrackRequest';
import
{
error
}
from
'jquery'
;
import
{
StepService
}
from
'../../../projects/services/step.service'
;
import
{
forkJoin
}
from
'rxjs'
;
import
{
AddEmployeeTrackRequest
}
from
'../../models/requests/AddEmployeeTrackRequest'
;
import
{
ProjectService
}
from
'../../../projects/services/project.service'
;
import
{
EmployeeParticipate
}
from
'../../../employees/models/responses/employeeParticipate'
;
@
Component
({
selector
:
'track-details'
,
...
...
@@ -24,12 +27,14 @@ export class TrackDetailsComponent implements OnInit {
employeesTracks
:
EmployeeTrack
[]
steps
:
Step
[]
=
[];
// Load steps from service or store
trackedSteps
:
Step
[]
=
[];
// Load already tracked steps
participants
:
EmployeeParticipate
[]
constructor
(
private
toastr
:
ToastrService
,
private
route
:
ActivatedRoute
,
private
trackService
:
TrackService
,
private
stepService
:
StepService
private
stepService
:
StepService
,
private
projectService
:
ProjectService
){}
...
...
@@ -51,12 +56,24 @@ export class TrackDetailsComponent implements OnInit {
this
.
track
=
track
;
this
.
stepTracks
=
stepTracks
;
this
.
employeesTracks
=
employeesTracks
;
this
.
loadParticipants
();
this
.
loadSteps
();
})
}
loadParticipants
(){
this
.
projectService
.
getParticipants
(
this
.
track
.
projectId
)
.
subscribe
({
next
:
(
data
)
=>
{
this
.
participants
=
data
}
});
}
loadSteps
(){
this
.
stepService
.
getStepsByProject
(
this
.
track
.
projectId
)
...
...
@@ -99,13 +116,13 @@ export class TrackDetailsComponent implements OnInit {
handleAddStepTrack
(
stepTrackRequest
:
AddStepTrackRequest
):
void
{
stepTrackRequest
.
trackDate
=
this
.
track
.
trackInfo
.
trackDate
debugger
this
.
trackService
.
addStepTrack
(
stepTrackRequest
).
subscribe
({
next
:
(
data
)
=>
{
this
.
loadTheNewStep
(
data
,
stepTrackRequest
);
this
.
toastr
.
success
(
'تمت إضافة متالعة المرحلة '
)
}
,
...
...
@@ -116,6 +133,9 @@ export class TrackDetailsComponent implements OnInit {
});
}
loadTheNewStep
(
stId
:
number
,
request
:
AddStepTrackRequest
){
let
s
=
this
.
steps
.
find
(
s
=>
s
.
id
==
request
.
stepId
)
let
st
:
StepTrack
=
{
...
...
@@ -143,4 +163,41 @@ export class TrackDetailsComponent implements OnInit {
}
handleEmployeeTrack
(
request
:
AddEmployeeTrackRequest
):
void
{
debugger
this
.
trackService
.
addEmployeeTrack
(
request
).
subscribe
({
next
:
(
data
)
=>
{
this
.
loadTheNewParticipant
(
data
,
request
);
this
.
toastr
.
success
(
'تمت إضافة متالعة المرحلة '
)
}
,
error
:(
err
)
=>
{
this
.
toastr
.
error
(
'لقد حدث خطاء ما'
)
}
});
}
loadTheNewParticipant
(
empTrackId
:
number
,
request
:
AddEmployeeTrackRequest
){
let
s
=
this
.
participants
.
find
(
s
=>
s
.
employeeId
==
request
.
employeeId
)
let
st
:
EmployeeTrack
=
{
trackId
:
this
.
trackId
,
trackInfo
:
this
.
track
.
trackInfo
,
emloyeeId
:
request
.
employeeId
,
employeeWork
:
request
.
employeeWork
,
employeeWorkInfo
:
request
.
employeeWorkInfo
,
employee
:
s
!
.
employee
,
notes
:
request
.
notes
}
this
.
employeesTracks
.
push
(
st
)
this
.
participants
=
this
.
participants
.
filter
(
e
=>
e
.
employeeId
==
s
?.
employeeId
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment