Skip to content

Commit

Permalink
fix: added create custom project modal for project details page
Browse files Browse the repository at this point in the history
  • Loading branch information
onehanddev authored and alexeh committed Nov 28, 2024
1 parent de5b2d8 commit ef20bd0
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 13 deletions.
4 changes: 4 additions & 0 deletions admin/resources/base-increase/base-increase.resource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { BaseIncrease } from "@shared/entities/base-increase.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const BaseIncreaseResource: ResourceWithOptions = {
resource: BaseIncrease,
Expand All @@ -12,5 +13,8 @@ export const BaseIncreaseResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
4 changes: 4 additions & 0 deletions admin/resources/base-size/base-size.resource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { BaseSize } from "@shared/entities/base-size.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const BaseSizeResource: ResourceWithOptions = {
resource: BaseSize,
Expand All @@ -12,5 +13,8 @@ export const BaseSizeResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { BaselineReassessment } from "@shared/entities/cost-inputs/baseline-reassessment.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const BaselineReassessmentResource: ResourceWithOptions = {
resource: BaselineReassessment,
Expand All @@ -12,5 +13,8 @@ export const BaselineReassessmentResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BlueCarbonProjectPlanning } from "@shared/entities/cost-inputs/blue-carbon-project-planning.entity.js";
import { ResourceWithOptions } from "adminjs";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const BlueCarbonProjectPlanningResource: ResourceWithOptions = {
resource: BlueCarbonProjectPlanning,
Expand All @@ -26,6 +27,9 @@ export const BlueCarbonProjectPlanningResource: ResourceWithOptions = {
blueCarbon: {
isVisible: { list: true, show: true, edit: false, filter: true },
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
sort: {
sortBy: "blueCarbon",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { CarbonStandardFees } from "@shared/entities/cost-inputs/carbon-standard-fees.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const CarbonStandardFeesResource: ResourceWithOptions = {
resource: CarbonStandardFees,
Expand All @@ -12,5 +13,8 @@ export const CarbonStandardFeesResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
4 changes: 4 additions & 0 deletions admin/resources/carbon-righs/carbon-rights.resource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { CarbonRights } from "@shared/entities/cost-inputs/establishing-carbon-rights.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const CarbonRightsResource: ResourceWithOptions = {
resource: CarbonRights,
Expand All @@ -12,5 +13,8 @@ export const CarbonRightsResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
6 changes: 6 additions & 0 deletions admin/resources/common/common.resources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { ResourceOptions } from "adminjs";

export const GLOBAL_COMMON_PROPERTIES: ResourceOptions["properties"] = {
id: {
isVisible: { list: false, show: false, edit: false, filter: false },
},
};

export const COMMON_RESOURCE_LIST_PROPERTIES: ResourceOptions["properties"] = {
countryName: {
isVisible: { list: true, show: true, edit: false, filter: true },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CommunityBenefitSharingFund } from "@shared/entities/cost-inputs/community-benefit-sharing-fund.entity.js";
import { ResourceWithOptions } from "adminjs";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const CommunityBenefitResource: ResourceWithOptions = {
resource: CommunityBenefitSharingFund,
Expand All @@ -12,5 +13,8 @@ export const CommunityBenefitResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CommunityCashFlow } from "@shared/entities/cost-inputs/community-cash-flow.entity.js";
import { ResourceWithOptions } from "adminjs";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const CommunityCashFlowResource: ResourceWithOptions = {
resource: CommunityCashFlow,
Expand All @@ -12,5 +13,8 @@ export const CommunityCashFlowResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { CommunityRepresentation } from "@shared/entities/cost-inputs/community-representation.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const CommunityRepresentationResource: ResourceWithOptions = {
resource: CommunityRepresentation,
Expand All @@ -12,5 +13,8 @@ export const CommunityRepresentationResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { ResourceWithOptions } from "adminjs";
import { ConservationPlanningAndAdmin } from "@shared/entities/cost-inputs/conservation-and-planning-admin.entity.js";
import { GLOBAL_COMMON_PROPERTIES, COMMON_RESOURCE_LIST_PROPERTIES } from "../common/common.resources.js";

export const ConservationAndPlanningAdminResource: ResourceWithOptions = {
resource: ConservationPlanningAndAdmin,
options: {
properties: {...COMMON_RESOURCE_LIST_PROPERTIES, ...GLOBAL_COMMON_PROPERTIES},
sort: {
sortBy: "planningCost",
direction: "desc",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { DataCollectionAndFieldCosts } from "@shared/entities/cost-inputs/data-collection-and-field-costs.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const DataCollectionAndFieldCostResource: ResourceWithOptions = {
resource: DataCollectionAndFieldCosts,
Expand All @@ -12,5 +13,8 @@ export const DataCollectionAndFieldCostResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
5 changes: 4 additions & 1 deletion admin/resources/ecosystem-loss/ecosystem-loss.resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { EcosystemLoss } from "@shared/entities/carbon-inputs/ecosystem-loss.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const EcosystemLossResource: ResourceWithOptions = {
resource: EcosystemLoss,
options: {
Expand All @@ -12,5 +12,8 @@ export const EcosystemLossResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { EmissionFactors } from "@shared/entities/carbon-inputs/emission-factors.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const EmissionFactorsResource: ResourceWithOptions = {
resource: EmissionFactors,
options: {
Expand All @@ -12,5 +12,8 @@ export const EmissionFactorsResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { FeasibilityAnalysis } from "@shared/entities/cost-inputs/feasability-analysis.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const FeasibilityAnalysisResource: ResourceWithOptions = {
resource: FeasibilityAnalysis,
Expand All @@ -12,5 +13,8 @@ export const FeasibilityAnalysisResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
5 changes: 4 additions & 1 deletion admin/resources/financing-cost/financing-cost.resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { FinancingCost } from "@shared/entities/cost-inputs/financing-cost.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const FinancingCostResource: ResourceWithOptions = {
resource: FinancingCost,
options: {
Expand All @@ -12,5 +12,8 @@ export const FinancingCostResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { ImplementationLaborCost } from "@shared/entities/cost-inputs/implementation-labor-cost.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const ImplementationLaborCostResource: ResourceWithOptions = {
resource: ImplementationLaborCost,
Expand All @@ -12,5 +13,8 @@ export const ImplementationLaborCostResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { LongTermProjectOperating } from "@shared/entities/cost-inputs/long-term-project-operating.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const LongTermProjectOperatingResource: ResourceWithOptions = {
resource: LongTermProjectOperating,
options: {
Expand All @@ -12,5 +12,8 @@ export const LongTermProjectOperatingResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
5 changes: 4 additions & 1 deletion admin/resources/maintenance/maintenance.resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { Maintenance } from "@shared/entities/cost-inputs/maintenance.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const MaintenanceResource: ResourceWithOptions = {
resource: Maintenance,
options: {
Expand All @@ -12,5 +12,8 @@ export const MaintenanceResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { ModelAssumptions } from "@shared/entities/model-assumptions.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const ModelAssumptionResource: ResourceWithOptions = {
resource: ModelAssumptions,
Expand All @@ -12,5 +13,8 @@ export const ModelAssumptionResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
4 changes: 4 additions & 0 deletions admin/resources/monitoring-cost/monitoring-cost.resource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { MonitoringCost } from "@shared/entities/cost-inputs/monitoring.entity.js";
import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const MonitoringCostResource: ResourceWithOptions = {
resource: MonitoringCost,
Expand All @@ -12,5 +13,8 @@ export const MonitoringCostResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
5 changes: 4 additions & 1 deletion admin/resources/mrv/mrv.resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { MRV } from "@shared/entities/cost-inputs/mrv.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const MRVResource: ResourceWithOptions = {
resource: MRV,
options: {
Expand All @@ -12,5 +12,8 @@ export const MRVResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
5 changes: 4 additions & 1 deletion admin/resources/project-size/project-size.resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourceWithOptions } from "adminjs";
import { ProjectSize } from "@shared/entities/cost-inputs/project-size.entity.js";

import { GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";
export const ProjectSizeResource: ResourceWithOptions = {
resource: ProjectSize,
options: {
Expand All @@ -12,5 +12,8 @@ export const ProjectSizeResource: ResourceWithOptions = {
name: "Data Management",
icon: "Database",
},
properties: {
...GLOBAL_COMMON_PROPERTIES,
},
},
};
7 changes: 5 additions & 2 deletions admin/resources/projects/projects.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import {
import { dataSource } from "../../datasource.js";
import { Project } from "@shared/entities/projects.entity.js";
import { Country } from "@shared/entities/country.entity.js";
import { COMMON_RESOURCE_LIST_PROPERTIES } from "../common/common.resources.js";
import { COMMON_RESOURCE_LIST_PROPERTIES, GLOBAL_COMMON_PROPERTIES } from "../common/common.resources.js";

export const ProjectsResource: ResourceWithOptions = {
resource: Project,
options: {
properties: COMMON_RESOURCE_LIST_PROPERTIES,
properties: {
...GLOBAL_COMMON_PROPERTIES,
...COMMON_RESOURCE_LIST_PROPERTIES,
},
listProperties: [
"projectName",
"projectSize",
Expand Down
Loading

0 comments on commit ef20bd0

Please sign in to comment.