Commit e007a8a7 authored by hasan khaddour's avatar hasan khaddour

add step serivce

parent e81337ba
export interface Attachment {
projectId: number;
attachmentUrl: string;
attachmentDescription: string;
attachmentName: string;
id : number
projectId :number
attachmentUrl :string
attachmentName :string
attachmentDescription :string
}
export class FinancialSpending {
id: number;
expectedSpendingDate: number;
costType: number;
description: string;
localPurchase: number;
externalPurchase: {
ammount: number;
currency: string;
};
}
......@@ -8,6 +8,7 @@ import { ProposalInfo } from "../valueObjects/proposalInfo"
import { ProjectClassification } from "../valueObjects/ProjectClassification"
import { Department } from "./Department"
import { Step } from "./Step"
import { FinancialSpending } from "./FinancialSpending"
export class Project
{
id:number
......@@ -24,6 +25,7 @@ export class Project
proposerId:number
proposer:Customer
steps :Step[]
financialSpending : FinancialSpending[]
employeeParticipates:EmployeeParticipate[]
financialFund:FinancialFund
}
......
......@@ -101,6 +101,35 @@
</tbody>
</table>
<p>خطة الانفاق</p>
<table class="table table-borderless table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col" clsss="text-center">نوع الكلفة</th>
<th scope="col" class="text-center">البيان</th>
<th scope="col" class="text-center">الشراء المحلي </th>
<th scope="col" class="text-center">الشراء الخارجي</th>
<th scope="col" class="text-center">نوع القطع</th>
<th scope="col" class="text-center">تاريخ الانفاق المتوقع</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let spend of project.financialSpending" >
<th scope="row"></th>
<td class="text-center"> {{spend.costType}}
</td>
<td class="text-center">{{spend.description }}</td>
<td class="text-center">{{spend.localPurchase}}</td>
<td class="text-center">{{spend.externalPurchase.ammount}}</td>
<td class="text-center">{{spend.externalPurchase.currency}}</td>
<td class="text-center">{{spend.expectedSpendingDate | date}}</td>
</tr>
</tbody>
</table>
<div class="row mt-5">
<div class="col-2 text-center">
......
import { HttpClient } from '@angular/common/http';
import { ChangeDetectorRef, Injectable } from '@angular/core';
import { ConfigurationService } from '../../core/services/configuration/configuration.service';
import { Observable } from 'rxjs';
import { Step } from '../models/responses/Step';
import { ChangeStepWeightRequest } from '../models/requests/step-requests/changeStepWeightRequest';
import { GetStepTrackHistoryRequest } from '../models/requests/step-requests/GetStepTrackHistoryRequest';
import { StepTrack } from '../../tracks/models/responses/steptrack';
import { UpdateCompletionRatioRequest } from '../models/requests/step-requests/UpdateCompletionRatioRequest';
@Injectable({
providedIn: 'root'
})
export class StepService {
constructor(private http :HttpClient ,private config : ConfigurationService) { }
// this method responsible for get a specificef step
//
public getStepById(stepId : number ):Observable<Step[]>{
return this.http.get<Step[]>(this.config.getServerUrl()+ "/Steps/"+stepId);
}
// this method responsible for get the steps of a specified project
//
public getStepsByProject(projectId : number ):Observable<Step[]>{
return this.http.get<Step[]>(this.config.getServerUrl()+ "/Steps/ByProject/"+projectId);
}
// this method responsible for change the step weight of a step
//
public changeStepWeight(request : ChangeStepWeightRequest ):Observable<void>{
return this.http.put<void>(this.config.getServerUrl()+ "/Steps/ChangeStepWeight/"+request.stepId, request);
}
// this method responsible for get a step track history
//
public getStepTrackHistory(request : GetStepTrackHistoryRequest ):Observable<StepTrack[]>{
let pagination = this.getPagination(request.pageSize,request.pageNumber);
return this.http.get<StepTrack[]>(`${this.config.getServerUrl()}/Steps/StepTrackHistory/?stepId=${request.stepId}${pagination}`);
}
// this method responsible for update the step completion ratio
//
public changeCompletionRatio(request : UpdateCompletionRatioRequest ):Observable<void>{
return this.http.put<void>(`${this.config.getServerUrl()}/Steps/ChangeCompletionRatio/?stepId=${request.stepId}`,request);
}
// this method responsible for delet the step
//
public deleteSep(stepId : number ):Observable<void>{
return this.http.delete<void>(`${this.config.getServerUrl()}/Steps/${stepId}`);
}
//#region pagination convert
private getPagination( pageSize:number | null , pageNumber : number |null ){
if(pageNumber == null || pageSize == null){
return "";
}
else {
return `&pageSize=${pageSize}&PageNumber=${pageNumber}`;
}
}
//#endregion pagination convert
}
import { StepInfo } from "../../../projects/models/valueObjects/StepInfo"
import { TrackInfo } from "../valueObjects/trackInfo"
export class StepTrack {
id :number
stepId :number
trackId :number
stepInfo :StepInfo
trackInfo :TrackInfo
executionState :number
trackExecutionRatio :number
oldExecutionRatio : number
}
\ No newline at end of file
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