first commit
This commit is contained in:
48
frontend/app/utils/api/productOfProjectApi/index.tsx
Normal file
48
frontend/app/utils/api/productOfProjectApi/index.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import { ProjectFormData } from "@/app/main/planning/projects/projectModal/zodProject";
|
||||
import { Project } from "@/app/main/planning/projects/types/project";
|
||||
import { ProductOfProject } from "../../interface/productOfProject";
|
||||
import { baseApiRequest } from "../apiRequests/baseApiRequest";
|
||||
|
||||
const PROJECT_API = `${process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL}/api/v1/projects`;
|
||||
const USER_API =
|
||||
"https://ikoncloud-dev.keross.com/ikon-api/platform/user/current";
|
||||
|
||||
// READ
|
||||
export const getProductsApi = async (projectId: string) => {
|
||||
return baseApiRequest(
|
||||
`${PROJECT_API}/${projectId}/products`,
|
||||
{
|
||||
method: "GET",
|
||||
cache: "no-store",
|
||||
},
|
||||
{ isAccessTokenRequird: true },
|
||||
);
|
||||
};
|
||||
|
||||
// UPDATE
|
||||
export const updateProductApi = async (product: ProductOfProject) => {
|
||||
return baseApiRequest(
|
||||
`${PROJECT_API}/${product.projectIdentifier}/products/${product.productIdentifier}`,
|
||||
{
|
||||
method: "PUT",
|
||||
body: JSON.stringify(product),
|
||||
},
|
||||
{ isAccessTokenRequird: true },
|
||||
);
|
||||
};
|
||||
|
||||
// WORKFLOW TRANSITION
|
||||
export const transitionProductStatusApi = async (
|
||||
projectId: string,
|
||||
productId: string,
|
||||
targetStatus: string,
|
||||
) => {
|
||||
return baseApiRequest(
|
||||
`${PROJECT_API}/${projectId}/products/${productId}/transition`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ targetStatus }),
|
||||
},
|
||||
{ isAccessTokenRequird: true, isReturnErrorResult: true },
|
||||
);
|
||||
};
|
||||
112
frontend/app/utils/api/productOfProjectApi/type.ts
Normal file
112
frontend/app/utils/api/productOfProjectApi/type.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
export interface ProductPSData {
|
||||
productIdentifier: string; // UUID
|
||||
|
||||
dealName: string;
|
||||
projectManager: string;
|
||||
productStatus: string;
|
||||
updatedOn: string;
|
||||
updatedBy: string;
|
||||
dealStatus: string;
|
||||
dealIdentifier: string; // UUID
|
||||
leadIdentifier: string; // UUID
|
||||
|
||||
quotation: Record<string, QuotationItemDto>;
|
||||
|
||||
productType: string;
|
||||
productDescription: string;
|
||||
|
||||
scheduleData: ScheduleDataDto;
|
||||
|
||||
resourceDataWithAllocation: ResourceAllocationDto[];
|
||||
|
||||
discountPercent: number | null;
|
||||
expenseDetails: Record<string, ExpenseDetailDto>;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
export interface QuotationItemDto {
|
||||
id: string;
|
||||
role: string;
|
||||
totalFTE: number;
|
||||
scr: number;
|
||||
expenses: number;
|
||||
otherCosts: number;
|
||||
billingAmount: number;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
export interface ScheduleDataDto {
|
||||
task: TaskDto[];
|
||||
dependency: DependencyDto[];
|
||||
group: Record<string, GroupItem>;
|
||||
}
|
||||
|
||||
export interface GroupItem {
|
||||
id?: string | number;
|
||||
name?: string;
|
||||
type?: string;
|
||||
order?: number;
|
||||
color?: string;
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
export interface TaskDto {
|
||||
id: number;
|
||||
parentId: number;
|
||||
taskName: string;
|
||||
taskDuration: number;
|
||||
taskPredecessor: string;
|
||||
dependencyType: number;
|
||||
taskColour: string;
|
||||
delayDuration: number;
|
||||
taskDescription: string;
|
||||
taskStart: string;
|
||||
taskEnd: string;
|
||||
milestoneTask: boolean;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
export interface DependencyDto {
|
||||
id: number;
|
||||
predecessorId: number;
|
||||
dependencyType: number;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
export interface ResourceAllocationDto {
|
||||
id?: string;
|
||||
allocation: Record<string, number>;
|
||||
detailedAllocation: Record<string, DetailedAllocationValue>;
|
||||
resourceType: string;
|
||||
role: string;
|
||||
gradeId: number;
|
||||
employeeName: string;
|
||||
taskName: string;
|
||||
resourceId: string;
|
||||
taskId: number;
|
||||
}
|
||||
|
||||
export interface DetailedAllocationValue {
|
||||
hours?: number;
|
||||
date?: string;
|
||||
cost?: number;
|
||||
comments?: string;
|
||||
approved?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface ExpenseDetailDto {
|
||||
expenseName: string;
|
||||
location: string;
|
||||
currency: string;
|
||||
cost: number;
|
||||
quantity: number;
|
||||
totalCost: number;
|
||||
remarks: string;
|
||||
}
|
||||
Reference in New Issue
Block a user