@rentman/rm-core 66.10.0 → 67.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/rm-core.js +2 -1
  2. package/dist/rm-core.js.LICENSE.txt +3 -0
  3. package/dist/rm-core.js.map +1 -1
  4. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +1 -1
  5. package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/LinkedTimeItemSubprojectBusinessLogicRule.d.ts +2 -2
  6. package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/TimeColumnUtil.d.ts +1 -1
  7. package/dist/types/src/classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalFactorBusinessLogicRuleBase.d.ts +40 -0
  8. package/dist/types/src/classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalFactorCreateBusinessLogicRule.d.ts +17 -0
  9. package/dist/types/src/classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalFactorUpdateBusinessLogicRule.d.ts +16 -0
  10. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalCalculateDuurBusinessLogicRule.d.ts +29 -0
  11. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalCombinationChildrenBusinessLogicRuleBase.d.ts +31 -0
  12. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalCreatePeriodBusinessLogicRule.d.ts +28 -0
  13. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalEditTijdSchemaPlanningBusinessLogicRule.d.ts +16 -0
  14. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalEditTijdSchemaUsageBusinessLogicRule.d.ts +16 -0
  15. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalFactorUpdateBusinessLogicRule.d.ts +25 -0
  16. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule.d.ts +10 -19
  17. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalParentSchemaBusinessLogicRule.d.ts +23 -0
  18. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/{PlanningmateriaalParentBusinessLogicRule.d.ts → PlanningmateriaalParentSetcontentBusinessLogicRule.d.ts} +6 -1
  19. package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdCalculatePlanningmateriaalDuurBusinessLogicRule.d.ts +28 -0
  20. package/dist/types/src/classes/BusinessLogicManager/registeredBusinessLogicRules.d.ts +16 -8
  21. package/dist/types/src/classes/cache/AbstractCache.d.ts +1 -1
  22. package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +1 -1
  23. package/dist/types/src/index.d.ts +6 -1
  24. package/dist/types/src/internal.d.ts +1 -1
  25. package/dist/types/src/models/CollectionResource.d.ts +1 -1
  26. package/dist/types/src/services/rm-factor.service.d.ts +72 -0
  27. package/dist/types/src/services/rm-project-default-time.service.d.ts +72 -0
  28. package/package.json +4 -4
  29. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule.d.ts +0 -24
  30. /package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/LinkedTimeItemBusinessLogicRuleBase.d.ts +0 -0
  31. /package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/LinkedTimeItemDurationBusinessLogicRule.d.ts +0 -0
  32. /package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/LinkedTimeItemTimeSchemeBusinessLogicRule.d.ts +0 -0
  33. /package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/LinkedTimeItemTimeSchemeStartBusinessLogicRule.d.ts +0 -0
  34. /package/dist/types/src/classes/BusinessLogicManager/{MateriaalCatFunctieFunctiegroep → FunctieFunctiegroep}/LinkedTimeItemTimeValueStartBusinessLogicRule.d.ts +0 -0
@@ -49,7 +49,7 @@ export declare abstract class BusinessLogicRule<ConditionResult, DependencyType,
49
49
  * @param transaction The transaction that the delta is being applied on
50
50
  * @param conditionResult The result of the {@link BusinessLogicRule.condition `condition`} call
51
51
  */
52
- abstract dependency(transaction: TransactionCache, conditionResult: ConditionResult, context: BusinessLogicRuleContextBase): Promise<DependencyType>;
52
+ abstract dependency(transaction: TransactionCache, conditionResult: ConditionResult, context: BusinessLogicRuleContextBase): Promise<DependencyType | typeof BLR_SKIP_RULE>;
53
53
  /**
54
54
  * @description
55
55
  * The {@link BusinessLogicRule.apply `apply`} function gets the result of the
@@ -15,8 +15,8 @@ export type LinkedTimeItemSubprojectBusinessLogicRuleConditionResult = {
15
15
  [ItemType in LinkedTimeItemType]: InvalidTimesTuple<ItemType>[];
16
16
  };
17
17
  /**
18
- * When updating the subproject of a function / function group / equipment group, or creating a new
19
- * function / function group / equipment group, and one of the times of these items is not in the project / subproject
18
+ * When updating the subproject of a function / function group or creating a new
19
+ * function / function group and one of the times of these items is not in the project / subproject
20
20
  * the created or updated item is in, set the associated item field to `null`.
21
21
  */
22
22
  export declare class LinkedTimeItemSubprojectBusinessLogicRule extends LinkedTimeItemBusinessLogicRuleBase<typeof conditionColumns, LinkedTimeItemSubprojectBusinessLogicRuleConditionResult, null> {
@@ -15,7 +15,7 @@ type TimeItemFields = {
15
15
  van: moment.Moment;
16
16
  tot: moment.Moment;
17
17
  };
18
- export declare const LINKED_TIME_ITEM_TYPES: ["MateriaalCat", "Functie", "Functiegroep"];
18
+ export declare const LINKED_TIME_ITEM_TYPES: ["Functie", "Functiegroep"];
19
19
  export type LinkedTimeItemType = (typeof LINKED_TIME_ITEM_TYPES)[number];
20
20
  export type LinkedItemTypeFieldMap<ItemTypeType extends LinkedTimeItemType> = ItemTypeType extends 'Functie' ? FieldMap<'Functie', TimeColumnId[]> : FieldMap<ItemTypeType, TimeColumnIdExcludingTimeFrame[]>;
21
21
  declare const nonReferenceProperties: readonly ["type", "isStart", "defaultValue"];
@@ -0,0 +1,40 @@
1
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
2
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
3
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
4
+ import { ItemResource } from '../../../models/ItemResource';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import moment from 'moment/moment';
7
+ import { FactorUpdate } from '../../../services/rm-factor.service';
8
+ export declare const subhireEquipmentColumns: readonly ["id", "staffel", "parent", {
9
+ readonly materiaal: readonly ["staffelgroep", "verhuur"];
10
+ }];
11
+ export type InhuurmateriaalResource = ItemResource<'Inhuurmateriaal', typeof subhireEquipmentColumns>;
12
+ /**
13
+ * A single Inhuurmateriaal item together with the usage duration of its governing Inhuur.
14
+ */
15
+ export interface InhuurmateriaalEquipmentDurationInput {
16
+ item: InhuurmateriaalResource;
17
+ currentDuration: moment.Duration;
18
+ initialDuration: moment.Duration;
19
+ treatAsNewlyCreatedItem: boolean;
20
+ }
21
+ export type InhuurmateriaalFactorLogicRuleBaseDependency = FactorUpdate<InhuurmateriaalResource>[];
22
+ /**
23
+ * @description
24
+ * Shared logic for recalculating the factor (staffel) of Inhuurmateriaal items based on the usage duration of their
25
+ * governing Inhuur. The duration is the difference between the Inhuur's `gebruikvan` and `gebruiktot` fields.
26
+ *
27
+ * Subclasses decide *which* items to (re)calculate and *how* the governing duration is resolved (see
28
+ * {@link InhuurmateriaalFactorBusinessLogicRuleBase.condition condition} and
29
+ * {@link InhuurmateriaalFactorBusinessLogicRuleBase.dependency dependency}), then delegate to
30
+ * {@link InhuurmateriaalFactorBusinessLogicRuleBase.buildDependency buildDependency}. The actual factor calculation is
31
+ * shared with other factor rules via {@link RmFactorService}.
32
+ */
33
+ export declare abstract class InhuurmateriaalFactorBusinessLogicRuleBase<ConditionResult> extends BusinessLogicRule<ConditionResult, InhuurmateriaalFactorLogicRuleBaseDependency> {
34
+ private factorService;
35
+ abstract condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
36
+ abstract dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<InhuurmateriaalFactorLogicRuleBaseDependency | typeof BLR_SKIP_RULE>;
37
+ apply(context: BusinessLogicRuleApplyContext, dependency: InhuurmateriaalFactorLogicRuleBaseDependency): void;
38
+ protected buildDependency(transaction: TransactionCache, equipmentDurationInputs: InhuurmateriaalEquipmentDurationInput[]): Promise<InhuurmateriaalFactorLogicRuleBaseDependency | typeof BLR_SKIP_RULE>;
39
+ protected calculateDuration(gebruikvan: moment.Moment | null, gebruiktot: moment.Moment | null): moment.Duration;
40
+ }
@@ -0,0 +1,17 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
3
+ import { BLR_SKIP_RULE } from '../BusinessLogicRule';
4
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
5
+ import { InhuurmateriaalFactorBusinessLogicRuleBase, InhuurmateriaalFactorLogicRuleBaseDependency } from './InhuurmateriaalFactorBusinessLogicRuleBase';
6
+ type ConditionResult = ItemId<'Inhuurmateriaal'>[];
7
+ /**
8
+ * @description
9
+ * When an Inhuurmateriaal is added, set its factor (staffel) based on the usage duration of the Inhuur it belongs to
10
+ * (traced via Inhuurmateriaal -> Inhuurgroep -> Inhuur). Since the item is new there is no custom value to preserve,
11
+ * so the factor is always set to the schema-derived value.
12
+ */
13
+ export declare class InhuurmateriaalFactorCreateBusinessLogicRule extends InhuurmateriaalFactorBusinessLogicRuleBase<ConditionResult> {
14
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
15
+ dependency(transaction: TransactionCache, createdItemIds: ConditionResult): Promise<InhuurmateriaalFactorLogicRuleBaseDependency | typeof BLR_SKIP_RULE>;
16
+ }
17
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
3
+ import { BLR_SKIP_RULE } from '../BusinessLogicRule';
4
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
5
+ import { InhuurmateriaalFactorBusinessLogicRuleBase, InhuurmateriaalFactorLogicRuleBaseDependency } from './InhuurmateriaalFactorBusinessLogicRuleBase';
6
+ type ConditionResult = ItemId<'Inhuur'>;
7
+ /**
8
+ * @description
9
+ * When the usage duration of an Inhuur changes, recalculate the factor (staffel) of all Inhuurmateriaal items in its
10
+ * groups. Items whose factor was custom set keep their value (see the base class' guard).
11
+ */
12
+ export declare class InhuurmateriaalFactorUpdateBusinessLogicRule extends InhuurmateriaalFactorBusinessLogicRuleBase<ConditionResult> {
13
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
14
+ dependency(transaction: TransactionCache, inhuurId: ConditionResult): Promise<InhuurmateriaalFactorLogicRuleBaseDependency | typeof BLR_SKIP_RULE>;
15
+ }
16
+ export {};
@@ -0,0 +1,29 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
3
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
4
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
5
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
6
+ import { ItemResource } from '../../../models/ItemResource';
7
+ import { Duration } from 'moment';
8
+ type ConditionResult = ItemId<'Planningmateriaal'>[];
9
+ type Dependency = ItemResource<'Planningmateriaal', typeof columnExtensions>[];
10
+ declare const columnExtensions: readonly ["schema_pt", "schema_pv", {
11
+ readonly schema_gv: readonly ["van", "tot"];
12
+ }, {
13
+ readonly schema_gt: readonly ["van", "tot"];
14
+ }, "schema_gv_begin", "schema_gt_begin", "duur", {
15
+ readonly parent: readonly [{
16
+ readonly materiaal: readonly ["is_physical"];
17
+ }];
18
+ }];
19
+ /**
20
+ * @description
21
+ * When any of the schema planning or usage fields are updated, we want to calculate the duration (duur) based on the linked schema fields and update it.
22
+ */
23
+ export declare class PlanningmateriaalCalculateDuurBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
24
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
25
+ dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency | typeof BLR_SKIP_RULE>;
26
+ apply(context: BusinessLogicRuleApplyContext, dependencies: Dependency): void;
27
+ static calculateDuration(planningmateriaalResource: Dependency[number], context: BusinessLogicRuleApplyContext): Duration;
28
+ }
29
+ export {};
@@ -0,0 +1,31 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { ApiRequestColumnArray, ItemTypeColumnIds } from '../../../types/ItemTypesCollection';
4
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
5
+ import { ChangesDelta } from '../../ChangesDelta';
6
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
7
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
8
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
9
+ export declare const baseChildColumns: readonly ["id", "parent", "naam"];
10
+ export declare const baseChangedColumns: readonly ["id", "categorie", "parent", "naam", {
11
+ readonly materiaal: readonly ["is_combination", "is_physical"];
12
+ }];
13
+ export type ExtendedChildResource<T extends ItemTypeColumnIds<'Planningmateriaal'>> = ItemResource<'Planningmateriaal', typeof baseChildColumns> & ItemResource<'Planningmateriaal', T>;
14
+ export type ExtendedChangedResource<T extends ItemTypeColumnIds<'Planningmateriaal'>> = ItemResource<'Planningmateriaal', typeof baseChangedColumns> & ItemResource<'Planningmateriaal', T>;
15
+ type CombinationChildrenDependency<T extends ItemTypeColumnIds<'Planningmateriaal'>> = {
16
+ childResources: ExtendedChildResource<T>[];
17
+ changedResources: ExtendedChangedResource<T>[];
18
+ };
19
+ export declare abstract class PlanningmateriaalCombinationChildrenBusinessLogicRuleBase<T extends ItemTypeColumnIds<'Planningmateriaal'>> extends BusinessLogicRule<ItemId<'Planningmateriaal'>[], CombinationChildrenDependency<T>> {
20
+ protected childColumns: ApiRequestColumnArray<'Planningmateriaal'>;
21
+ protected changedColumns: ApiRequestColumnArray<'Planningmateriaal'>;
22
+ protected abstract columnExtensions: T;
23
+ protected abstract getConditionResult(context: BusinessLogicRuleConditionContext): ItemId<'Planningmateriaal'>[] | typeof BLR_SKIP_RULE;
24
+ protected abstract applyChangesToChild(parentResource: ExtendedChangedResource<T>, childResource: ExtendedChildResource<T>, destinationChangesDelta: ChangesDelta): void;
25
+ protected shouldSkipChangedResource(changedResource: ExtendedChangedResource<T>): boolean;
26
+ condition(context: BusinessLogicRuleConditionContext): ItemId<'Planningmateriaal'>[] | typeof BLR_SKIP_RULE;
27
+ dependency(transaction: TransactionCache, changedPlanningmateriaalIds: ItemId<'Planningmateriaal'>[]): Promise<CombinationChildrenDependency<T>>;
28
+ apply(context: BusinessLogicRuleApplyContext, dependency: CombinationChildrenDependency<T>): void;
29
+ private updateChildrenRecursively;
30
+ }
31
+ export {};
@@ -0,0 +1,28 @@
1
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
2
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
3
+ import { ItemId } from '@rentman/backend-types';
4
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
5
+ import { ItemResource } from '../../../models/ItemResource';
6
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
7
+ import { RmProjectDefaultTimeResources } from '../../../services/rm-project-default-time.service';
8
+ declare const planningmateriaalColumns: readonly ["id", "parent", {
9
+ readonly categorie: readonly ["subproject", "project"];
10
+ }];
11
+ type ConditionResult = Set<ItemId> | typeof BLR_SKIP_RULE;
12
+ type DependencyResult = {
13
+ planningmateriaalItems: ItemResource<'Planningmateriaal', typeof planningmateriaalColumns>[];
14
+ defaultTimesPerSubprojectMap: Map<ItemId<'Subproject'>, RmProjectDefaultTimeResources>;
15
+ };
16
+ type Dependency = DependencyResult | typeof BLR_SKIP_RULE;
17
+ /**
18
+ * @description
19
+ * If the planningmateriaal is created, set the schema fields to the (sub)project's planperiode and gebruiksperiode.'
20
+ * If these are not available, we fall back to last created schema values
21
+ */
22
+ export declare class PlanningmateriaalCreatePeriodBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
23
+ private timeResourceFallbackService;
24
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult;
25
+ dependency(transaction: TransactionCache, createdItems: Set<ItemId<'Planningmateriaal'>>): Promise<Dependency>;
26
+ apply(context: BusinessLogicRuleApplyContext, dependency: DependencyResult): void;
27
+ }
28
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ChangesDelta } from '../../ChangesDelta';
2
+ import { BLR_SKIP_RULE } from '../BusinessLogicRule';
3
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
4
+ import { ExtendedChangedResource, ExtendedChildResource, PlanningmateriaalCombinationChildrenBusinessLogicRuleBase } from './PlanningmateriaalCombinationChildrenBusinessLogicRuleBase';
5
+ import { ItemId } from '@rentman/backend-types';
6
+ declare const columnExtensions: readonly ["schema_pv", "schema_pv_begin", "schema_pt", "schema_pt_begin", "is_delayed"];
7
+ /**
8
+ * @description
9
+ * If planningmateriaal schema fields are edited, the same edits should be applied to the children of Planningmateriaal combinations.
10
+ */
11
+ export declare class PlanningmateriaalEditTijdSchemaPlanningBusinessLogicRule extends PlanningmateriaalCombinationChildrenBusinessLogicRuleBase<typeof columnExtensions> {
12
+ protected readonly columnExtensions: typeof columnExtensions;
13
+ protected getConditionResult(context: BusinessLogicRuleConditionContext): ItemId<'Planningmateriaal'>[] | typeof BLR_SKIP_RULE;
14
+ protected applyChangesToChild(parentResource: ExtendedChangedResource<typeof columnExtensions>, childResource: ExtendedChildResource<typeof columnExtensions>, destinationChangesDelta: ChangesDelta): void;
15
+ }
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ChangesDelta } from '../../ChangesDelta';
2
+ import { BLR_SKIP_RULE } from '../BusinessLogicRule';
3
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
4
+ import { ExtendedChangedResource, ExtendedChildResource, PlanningmateriaalCombinationChildrenBusinessLogicRuleBase } from './PlanningmateriaalCombinationChildrenBusinessLogicRuleBase';
5
+ import { ItemId } from '@rentman/backend-types';
6
+ declare const columnExtensions: readonly ["schema_gv", "schema_gv_begin", "schema_gt", "schema_gt_begin", "duur", "is_delayed"];
7
+ /**
8
+ * @description
9
+ * If planningmateriaal schema fields are edited, the same edits should be applied to the children of Planningmateriaal combinations.
10
+ */
11
+ export declare class PlanningmateriaalEditTijdSchemaUsageBusinessLogicRule extends PlanningmateriaalCombinationChildrenBusinessLogicRuleBase<typeof columnExtensions> {
12
+ protected readonly columnExtensions: typeof columnExtensions;
13
+ protected getConditionResult(context: BusinessLogicRuleConditionContext): ItemId<'Planningmateriaal'>[] | typeof BLR_SKIP_RULE;
14
+ protected applyChangesToChild(parentResource: ExtendedChangedResource<typeof columnExtensions>, childResource: ExtendedChildResource<typeof columnExtensions>, destinationChangesDelta: ChangesDelta): void;
15
+ }
16
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
3
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
4
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
5
+ import { ItemResource } from '../../../models/ItemResource';
6
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
7
+ import { FactorUpdate } from '../../../services/rm-factor.service';
8
+ declare const plannedEquipmentColumns: readonly ["id", "staffel", "duur", "parent", {
9
+ readonly materiaal: readonly ["staffelgroep", "verhuur"];
10
+ }];
11
+ type ConditionResult = ItemId<'Planningmateriaal'>[];
12
+ type PlanningmateriaalFactorLogicRuleBaseDependency = FactorUpdate<ItemResource<'Planningmateriaal', typeof plannedEquipmentColumns>>[];
13
+ /**
14
+ * @description
15
+ * If the planningmateriaal duur has changed, we should update the factor (staffel).
16
+ * The update should only trigger when the initial duration matches the factor from the staffelgroup.
17
+ * Otherwise, it means its custom set and the factor should keep its original value.
18
+ */
19
+ export declare class PlanningmateriaalFactorUpdateBusinessLogicRule extends BusinessLogicRule<ConditionResult, PlanningmateriaalFactorLogicRuleBaseDependency> {
20
+ private factorService;
21
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
22
+ dependency(transaction: TransactionCache, planningmateriaalIds: ConditionResult, context: BusinessLogicRuleConditionContext): Promise<PlanningmateriaalFactorLogicRuleBaseDependency | typeof BLR_SKIP_RULE>;
23
+ apply(context: BusinessLogicRuleApplyContext, dependency: PlanningmateriaalFactorLogicRuleBaseDependency): void;
24
+ }
25
+ export {};
@@ -1,26 +1,17 @@
1
- import { ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
- import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
1
+ import { ChangesDelta } from '../../ChangesDelta';
2
+ import { BLR_SKIP_RULE } from '../BusinessLogicRule';
6
3
  import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
- type ConditionResult = ItemId[];
8
- declare const childPlanningmateriaalColumns: readonly ["id", "optie", "parent"];
9
- declare const changedPlanningMateriaalColumns: readonly ["id", "optie", "categorie", "parent", {
10
- readonly materiaal: readonly ["is_combination", "is_physical"];
11
- }];
12
- type Dependency = {
13
- childPlanningmateriaalResourcesInCategories: ItemResource<'Planningmateriaal', typeof childPlanningmateriaalColumns>[];
14
- changedPlanningmateriaalResources: ItemResource<'Planningmateriaal', typeof changedPlanningMateriaalColumns>[];
15
- };
4
+ import { ExtendedChangedResource, ExtendedChildResource, PlanningmateriaalCombinationChildrenBusinessLogicRuleBase } from './PlanningmateriaalCombinationChildrenBusinessLogicRuleBase';
5
+ import { ItemId } from '@rentman/backend-types';
6
+ declare const columnExtensions: readonly ["optie"];
16
7
  /**
17
8
  * @description
18
9
  * If the kit's 'optie' is changed then the children should follow
19
10
  */
20
- export declare class PlanningmateriaalOptieBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
21
- condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
22
- dependency(transaction: TransactionCache, changedPlanningmateriaalIds: ConditionResult): Promise<Dependency>;
23
- apply(context: BusinessLogicRuleApplyContext, dependency: Dependency): void;
24
- private updatePlanningmateriaalByParent;
11
+ export declare class PlanningmateriaalOptieBusinessLogicRule extends PlanningmateriaalCombinationChildrenBusinessLogicRuleBase<typeof columnExtensions> {
12
+ protected readonly columnExtensions: typeof columnExtensions;
13
+ protected shouldSkipChangedResource(changedResource: ExtendedChangedResource<typeof columnExtensions>): boolean;
14
+ protected getConditionResult(context: BusinessLogicRuleConditionContext): ItemId<'Planningmateriaal'>[] | typeof BLR_SKIP_RULE;
15
+ protected applyChangesToChild(parentResource: ExtendedChangedResource<typeof columnExtensions>, childResource: ExtendedChildResource<typeof columnExtensions>, destinationChangesDelta: ChangesDelta): void;
25
16
  }
26
17
  export {};
@@ -0,0 +1,23 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ declare const planningmateriaalColumns: readonly [{
8
+ readonly parent: readonly ["schema_gv", "schema_pv", "schema_gt", "schema_pt", "schema_gv_begin", "schema_gt_begin", "schema_pv_begin", "schema_pt_begin", "duur", "is_delayed"];
9
+ }];
10
+ type ConditionResult = ItemId<'Planningmateriaal'>[];
11
+ type Dependency = ItemResource<'Planningmateriaal', typeof planningmateriaalColumns>[];
12
+ /**
13
+ * @description
14
+ * Set schema fields to the parent's values. Schema values of equipment children should not be editable by the
15
+ * user and always inherit parent schema values. This runs both when an item is created with a parent and when an
16
+ * item's parent changes, so the inherited values stay in sync.
17
+ */
18
+ export declare class PlanningmateriaalParentSchemaBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
19
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
20
+ dependency(transaction: TransactionCache, planningmateriaalIds: ConditionResult): Promise<Dependency>;
21
+ apply(context: BusinessLogicRuleApplyContext, planningmateriaalResources: Dependency): void;
22
+ }
23
+ export {};
@@ -7,7 +7,12 @@ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleCondition
7
7
  declare const planningmateriaalColumns: readonly ["parent", "setcontent"];
8
8
  type ConditionResult = ItemId<'Planningmateriaal'>[];
9
9
  type Dependency = ItemResource<'Planningmateriaal', typeof planningmateriaalColumns>[];
10
- export declare class PlanningmateriaalParentBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
10
+ /**
11
+ * @description
12
+ * When an existing planningmateriaal with a parent set & setcontent>is_fixed is false (meaning you CAN drag/drop)
13
+ * is moved outside its current parent, we clear `setcontent` since it would no longer be correct.
14
+ */
15
+ export declare class PlanningmateriaalParentSetcontentBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
11
16
  condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
12
17
  dependency(transaction: TransactionCache, planningmateriaalIds: ConditionResult): Promise<Dependency>;
13
18
  apply(context: BusinessLogicRuleApplyContext, planningmateriaalResources: Dependency): void;
@@ -0,0 +1,28 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
3
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
4
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
5
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
6
+ import { ItemResource } from '../../../models/ItemResource';
7
+ type ConditionResult = ItemId<'Tijd'>[];
8
+ type Dependency = ItemResource<'Planningmateriaal', typeof planningmateriaalColumns>[];
9
+ declare const planningmateriaalColumns: readonly ["schema_pv", "schema_pt", {
10
+ readonly schema_gv: readonly ["van", "tot"];
11
+ }, {
12
+ readonly schema_gt: readonly ["van", "tot"];
13
+ }, "schema_gv_begin", "schema_gt_begin", "duur", {
14
+ readonly parent: readonly [{
15
+ readonly materiaal: readonly ["is_physical"];
16
+ }];
17
+ }];
18
+ /**
19
+ * @description
20
+ * When `van` or `tot` fields of a Tijd resource are changed, we want to keep the planningmateriaal duur in sync with these updated times.
21
+ * We fetch all relevant planningmateriaal that use these tijd items and re-calculate the duur field
22
+ */
23
+ export declare class TijdCalculatePlanningmateriaalDuurBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
24
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
25
+ dependency(transaction: TransactionCache, tijdIds: ConditionResult): Promise<Dependency | typeof BLR_SKIP_RULE>;
26
+ apply(context: BusinessLogicRuleApplyContext, dependencies: Dependency): void;
27
+ }
28
+ export {};
@@ -20,6 +20,8 @@ import { FunctieTwowayBusinessLogicRule } from './Functie/FunctieTwowayBusinessL
20
20
  import { FunctiegroepSubprojectBusinessLogicRule } from './Functiegroep/FunctiegroepSubprojectBusinessLogicRule';
21
21
  import { InhuurmateriaalAantalRoundUpBusinessLogicRule } from './Inhuurmateriaal/InhuurmateriaalAantalRoundUpBusinessLogicRule';
22
22
  import { InhuurmateriaalAantaltotaalBusinessLogicRule } from './Inhuurmateriaal/InhuurmateriaalAantaltotaalBusinessLogicRule';
23
+ import { InhuurmateriaalFactorUpdateBusinessLogicRule } from './Inhuurmateriaal/InhuurmateriaalFactorUpdateBusinessLogicRule';
24
+ import { InhuurmateriaalFactorCreateBusinessLogicRule } from './Inhuurmateriaal/InhuurmateriaalFactorCreateBusinessLogicRule';
23
25
  import { MateriaalBulkToSerialBusinessLogicRule } from './Materiaal/MateriaalBulkToSerialBusinessLogicRule';
24
26
  import { MateriaalIsCombinationBusinessLogicRule } from './Materiaal/MateriaalIsCombinationBusinessLogicRule';
25
27
  import { MateriaalIsPhysicalCombinationBulkBusinessLogicRule } from './Materiaal/MateriaalIsPhysicalCombinationBulkBusinessLogicRule';
@@ -29,17 +31,17 @@ import { MateriaalToVirtualBusinessLogicRule } from './Materiaal/MateriaalToVirt
29
31
  import { MateriaalTypePropertiesBusinessLogicRule } from './Materiaal/MateriaalTypePropertiesBusinessLogicRule';
30
32
  import { MateriaalVerhuurBusinessLogicRule } from './Materiaal/MateriaalVerhuurBusinessLogicRule';
31
33
  import { SurfaceArticleSizeBusinessLogicRule } from './Materiaal/SurfaceArticleSizeBusinessLogicRule';
32
- import { LinkedTimeItemDurationBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule';
33
- import { LinkedTimeItemMateriaalCatBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule';
34
- import { LinkedTimeItemSubprojectBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule';
35
- import { LinkedTimeItemTimeSchemeBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule';
36
- import { LinkedTimeItemTimeSchemeStartBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule';
37
- import { LinkedTimeItemTimeValueStartBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule';
34
+ import { LinkedTimeItemDurationBusinessLogicRule } from './FunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule';
35
+ import { LinkedTimeItemSubprojectBusinessLogicRule } from './FunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule';
36
+ import { LinkedTimeItemTimeSchemeBusinessLogicRule } from './FunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule';
37
+ import { LinkedTimeItemTimeSchemeStartBusinessLogicRule } from './FunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule';
38
+ import { LinkedTimeItemTimeValueStartBusinessLogicRule } from './FunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule';
38
39
  import { OfferteContractDatumBusinessLogicRule } from './OfferteContract/OfferteContractDatumBusinessLogicRule';
39
40
  import { PlanningmateriaalAantalRoundUpBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalAantalRoundUpBusinessLogicRule';
40
41
  import { PlanningmateriaalAantaltotaalBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalAantaltotaalBusinessLogicRule';
41
42
  import { PlanningmateriaalOptieBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule';
42
- import { PlanningmateriaalParentBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalParentBusinessLogicRule';
43
+ import { PlanningmateriaalParentSchemaBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalParentSchemaBusinessLogicRule';
44
+ import { PlanningmateriaalParentSetcontentBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalParentSetcontentBusinessLogicRule';
43
45
  import { PlanningmateriaalStaysAtLocationBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalStaysAtLocationBusinessLogicRule';
44
46
  import { PlanningPersoneelTransportBusinessLogicRule } from './PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
45
47
  import { ProjectClientChangedBusinessLogicRule } from './Project/ProjectClientChangedBusinessLogicRule';
@@ -69,4 +71,10 @@ import { TaakDeadlineTypeBusinessLogicRule } from './Taak/TaakDeadlineTypeBusine
69
71
  import { TaakDeadlineOffsetBusinessLogicRule } from './Taak/TaakDeadlineOffsetBusinessLogicRule';
70
72
  import { TijdPropagateNameToFunctiegroepBusinessLogicRule } from './Tijd/TijdPropagateNameToFunctiegroepBusinessLogicRule';
71
73
  import { TijdSubprojectChangedBusinessLogicRule } from './Tijd/TijdSubprojectChangedBusinessLogicRule';
72
- export declare const registeredBusinessLogicRules: readonly [typeof DefaultContactPersonUpdateBusinessLogicRule, typeof ContactAddressBusinessLogicRule, typeof CustomFieldLinkedItemTypeBusinessLogicRule, typeof CustomFieldTypeBusinessLogicRule, typeof DocumentTemplateBusinessLogicRule, typeof ExemplaarAanschafdatumBusinessLogicRule, typeof ExemplaarBarcodeDeleteBusinessLogicRule, typeof FactuurBetalingsconditieBusinessLogicRule, typeof FactuurDatumBusinessLogicRule, typeof FactuurNumberseriesBusinessLogicRule, typeof FilesNameExtensionBusinessLogicRule, typeof FunctieNaaminternBusinessLogicRule, typeof FunctieTravelDistanceFromLocationBusinessLogicRule, typeof FunctieTravelDistanceUnlinkLocationBusinessLogicRule, typeof FunctieTravelTimeFromLocationBusinessLogicRule, typeof FunctieTwowayBusinessLogicRule, typeof FunctieRecureindBusinessLogicRule, typeof FunctiegroepSubprojectBusinessLogicRule, typeof InhuurmateriaalAantaltotaalBusinessLogicRule, typeof InhuurmateriaalAantalRoundUpBusinessLogicRule, typeof MateriaalIsCombinationBusinessLogicRule, typeof MateriaalIsPhysicalCombinationBulkBusinessLogicRule, typeof MateriaalToVirtualBusinessLogicRule, typeof MateriaalToPhysicalBusinessLogicRule, typeof MateriaalBulkToSerialBusinessLogicRule, typeof MateriaalSerialToBulkBusinessLogicRule, typeof MateriaalTypePropertiesBusinessLogicRule, typeof MateriaalVerhuurBusinessLogicRule, typeof SurfaceArticleSizeBusinessLogicRule, typeof LinkedTimeItemDurationBusinessLogicRule, typeof LinkedTimeItemTimeSchemeBusinessLogicRule, typeof LinkedTimeItemTimeSchemeStartBusinessLogicRule, typeof LinkedTimeItemTimeValueStartBusinessLogicRule, typeof LinkedTimeItemSubprojectBusinessLogicRule, typeof LinkedTimeItemMateriaalCatBusinessLogicRule, typeof OfferteContractDatumBusinessLogicRule, typeof PlanningmateriaalAantalRoundUpBusinessLogicRule, typeof PlanningmateriaalAantaltotaalBusinessLogicRule, typeof PlanningmateriaalOptieBusinessLogicRule, typeof PlanningmateriaalParentBusinessLogicRule, typeof PlanningmateriaalStaysAtLocationBusinessLogicRule, typeof PlanningPersoneelTransportBusinessLogicRule, typeof ProjectClientChangedBusinessLogicRule, typeof ProjectContactProjectNoteBusinessLogicRule, typeof ProjectOneSubLocationAlignBusinessLogicRule, typeof ProjectSubprojectDefaultTimeBusinessLogicRule, typeof PurchaseOrderOwnerBusinessLogicRule, typeof PurchaseOrderApprovalStatusBusinessLogicRule, typeof RateDeactivateExistingOnCreateBusinessLogicRule, typeof ReparatiesExemplaarAantalBusinessLogicRule, typeof ReparatieLostItemExemplaarLocationBusinessLogicRule, typeof RolEditOwnDataBusinessLogicRule, typeof RolFileAccessBusinessLogicRule, typeof RolLoginFieldsLastSeenBusinessLogicRule, typeof RolPersoneelsplannerToegangBusinessLogicRule, typeof RolProjectenBewerkenBusinessLogicRule, typeof RolProjectenToegangBusinessLogicRule, typeof RolVisibilityFinancialsBusinessLogicRule, typeof RolWarehouseTrackingLogAccessBusinessLogicRule, typeof RolPurchaseOrderAttachPlanningBusinessLogicRule, typeof SetinhoudCreateFixedBusinessLogicRule, typeof SetinhoudUpdateFixedBusinessLogicRule, typeof SubprojectOneSubLocationAlignBusinessLogicRule, typeof SubprojectOneSubNameAlignBusinessLogicRule, typeof SubprojectInPlanningBusinessLogicRule, typeof TaakDeadlineTypeBusinessLogicRule, typeof TaakDeadlineOffsetBusinessLogicRule, typeof TijdSubprojectChangedBusinessLogicRule, typeof TijdPropagateNameToFunctiegroepBusinessLogicRule, typeof AfspraakRecureindBusinessLogicRule, typeof BeschikbaarheidRecureindBusinessLogicRule];
74
+ import { PlanningmateriaalFactorUpdateBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalFactorUpdateBusinessLogicRule';
75
+ import { PlanningmateriaalCreatePeriodBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalCreatePeriodBusinessLogicRule';
76
+ import { PlanningmateriaalEditTijdSchemaUsageBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalEditTijdSchemaUsageBusinessLogicRule';
77
+ import { PlanningmateriaalCalculateDuurBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalCalculateDuurBusinessLogicRule';
78
+ import { TijdCalculatePlanningmateriaalDuurBusinessLogicRule } from './Tijd/TijdCalculatePlanningmateriaalDuurBusinessLogicRule';
79
+ import { PlanningmateriaalEditTijdSchemaPlanningBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalEditTijdSchemaPlanningBusinessLogicRule';
80
+ export declare const registeredBusinessLogicRules: readonly [typeof DefaultContactPersonUpdateBusinessLogicRule, typeof ContactAddressBusinessLogicRule, typeof CustomFieldLinkedItemTypeBusinessLogicRule, typeof CustomFieldTypeBusinessLogicRule, typeof DocumentTemplateBusinessLogicRule, typeof ExemplaarAanschafdatumBusinessLogicRule, typeof ExemplaarBarcodeDeleteBusinessLogicRule, typeof FactuurBetalingsconditieBusinessLogicRule, typeof FactuurDatumBusinessLogicRule, typeof FactuurNumberseriesBusinessLogicRule, typeof FilesNameExtensionBusinessLogicRule, typeof FunctieNaaminternBusinessLogicRule, typeof FunctieTravelDistanceFromLocationBusinessLogicRule, typeof FunctieTravelDistanceUnlinkLocationBusinessLogicRule, typeof FunctieTravelTimeFromLocationBusinessLogicRule, typeof FunctieTwowayBusinessLogicRule, typeof FunctieRecureindBusinessLogicRule, typeof FunctiegroepSubprojectBusinessLogicRule, typeof InhuurmateriaalAantaltotaalBusinessLogicRule, typeof InhuurmateriaalAantalRoundUpBusinessLogicRule, typeof InhuurmateriaalFactorUpdateBusinessLogicRule, typeof InhuurmateriaalFactorCreateBusinessLogicRule, typeof MateriaalIsCombinationBusinessLogicRule, typeof MateriaalIsPhysicalCombinationBulkBusinessLogicRule, typeof MateriaalToVirtualBusinessLogicRule, typeof MateriaalToPhysicalBusinessLogicRule, typeof MateriaalBulkToSerialBusinessLogicRule, typeof MateriaalSerialToBulkBusinessLogicRule, typeof MateriaalTypePropertiesBusinessLogicRule, typeof MateriaalVerhuurBusinessLogicRule, typeof SurfaceArticleSizeBusinessLogicRule, typeof LinkedTimeItemDurationBusinessLogicRule, typeof LinkedTimeItemTimeSchemeBusinessLogicRule, typeof LinkedTimeItemTimeSchemeStartBusinessLogicRule, typeof LinkedTimeItemTimeValueStartBusinessLogicRule, typeof LinkedTimeItemSubprojectBusinessLogicRule, typeof OfferteContractDatumBusinessLogicRule, typeof PlanningmateriaalAantalRoundUpBusinessLogicRule, typeof PlanningmateriaalAantaltotaalBusinessLogicRule, typeof PlanningmateriaalOptieBusinessLogicRule, typeof PlanningmateriaalParentSchemaBusinessLogicRule, typeof PlanningmateriaalParentSetcontentBusinessLogicRule, typeof PlanningmateriaalStaysAtLocationBusinessLogicRule, typeof PlanningmateriaalFactorUpdateBusinessLogicRule, typeof PlanningmateriaalCreatePeriodBusinessLogicRule, typeof PlanningmateriaalEditTijdSchemaUsageBusinessLogicRule, typeof PlanningmateriaalEditTijdSchemaPlanningBusinessLogicRule, typeof PlanningmateriaalCalculateDuurBusinessLogicRule, typeof PlanningPersoneelTransportBusinessLogicRule, typeof ProjectClientChangedBusinessLogicRule, typeof ProjectContactProjectNoteBusinessLogicRule, typeof ProjectOneSubLocationAlignBusinessLogicRule, typeof ProjectSubprojectDefaultTimeBusinessLogicRule, typeof PurchaseOrderOwnerBusinessLogicRule, typeof PurchaseOrderApprovalStatusBusinessLogicRule, typeof RateDeactivateExistingOnCreateBusinessLogicRule, typeof ReparatiesExemplaarAantalBusinessLogicRule, typeof ReparatieLostItemExemplaarLocationBusinessLogicRule, typeof RolEditOwnDataBusinessLogicRule, typeof RolFileAccessBusinessLogicRule, typeof RolLoginFieldsLastSeenBusinessLogicRule, typeof RolPersoneelsplannerToegangBusinessLogicRule, typeof RolProjectenBewerkenBusinessLogicRule, typeof RolProjectenToegangBusinessLogicRule, typeof RolVisibilityFinancialsBusinessLogicRule, typeof RolWarehouseTrackingLogAccessBusinessLogicRule, typeof RolPurchaseOrderAttachPlanningBusinessLogicRule, typeof SetinhoudCreateFixedBusinessLogicRule, typeof SetinhoudUpdateFixedBusinessLogicRule, typeof SubprojectOneSubLocationAlignBusinessLogicRule, typeof SubprojectOneSubNameAlignBusinessLogicRule, typeof SubprojectInPlanningBusinessLogicRule, typeof TaakDeadlineTypeBusinessLogicRule, typeof TaakDeadlineOffsetBusinessLogicRule, typeof TijdSubprojectChangedBusinessLogicRule, typeof TijdPropagateNameToFunctiegroepBusinessLogicRule, typeof TijdCalculatePlanningmateriaalDuurBusinessLogicRule, typeof AfspraakRecureindBusinessLogicRule, typeof BeschikbaarheidRecureindBusinessLogicRule];
@@ -39,7 +39,7 @@ export declare abstract class AbstractCache {
39
39
  getCurrentItemEntryCache(): ItemCache;
40
40
  abstract getServerCache(): ServerCache;
41
41
  abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry;
42
- abstract getLocalItemEntryByItemId<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemEntry<ItemTypeType>['itemId']): ItemEntry<ItemTypeType>;
42
+ abstract getLocalItemEntryByItemId<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemEntry<ItemTypeType>['itemId']): ItemEntry<ItemTypeType> | undefined;
43
43
  abstract containsLocalItemEntryByItemId(itemType: ApiItemType, itemId: ItemEntry['itemId']): boolean;
44
44
  /**
45
45
  * @description
@@ -395,7 +395,7 @@ export declare class TransactionCache extends AbstractCache {
395
395
  * @description
396
396
  * Gets an ItemEntry from the cache by ItemId. Looks at the current as well as the parent transaction.
397
397
  */
398
- getLocalItemEntryByItemId<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemEntry<ItemTypeType>['itemId']): ItemEntry<ItemTypeType>;
398
+ getLocalItemEntryByItemId<const ItemTypeType extends ApiItemType>(itemType: ItemTypeType, itemId: ItemEntry<ItemTypeType>['itemId']): ItemEntry<ItemTypeType> | undefined;
399
399
  containsLocalItemEntryByItemId(itemType: ApiItemType, itemId: ItemEntry['itemId']): boolean;
400
400
  /**
401
401
  * @description
@@ -4,8 +4,13 @@ export * from './classes/BusinessLogicManager/Materiaal/MateriaalBulkToSerialBus
4
4
  export * from './classes/BusinessLogicManager/Materiaal/MateriaalSerialToBulkBusinessLogicRule';
5
5
  export * from './classes/BusinessLogicManager/Materiaal/MateriaalToPhysicalBusinessLogicRule';
6
6
  export * from './classes/BusinessLogicManager/Materiaal/MateriaalToVirtualBusinessLogicRule';
7
- export * from './classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule';
7
+ export * from './classes/BusinessLogicManager/FunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule';
8
8
  export * from './classes/BusinessLogicManager/Project/ProjectClientChangedBusinessLogicRule';
9
9
  export * from './classes/BusinessLogicManager/PurchaseOrder/PurchaseOrderOwnerBusinessLogicRule';
10
10
  export * from './classes/BusinessLogicManager/Subproject/SubprojectInPlanningBusinessLogicRule';
11
+ export * from './classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalFactorUpdateBusinessLogicRule';
12
+ export * from './classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalFactorCreateBusinessLogicRule';
13
+ export * from './classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalFactorUpdateBusinessLogicRule';
11
14
  export * from './services/rm-holidays.service';
15
+ export * from './services/rm-project-default-time.service';
16
+ export * from './services/rm-factor.service';
@@ -84,7 +84,7 @@ export * from './classes/BusinessLogicManager/BusinessLogicRule';
84
84
  export * from './classes/BusinessLogicManager/businessLogicRule.decorator';
85
85
  export * from './classes/BusinessLogicManager/registeredBusinessLogicRules';
86
86
  export * from './classes/BusinessLogicManager/BusinessLogicManager';
87
- export * from './classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/TimeColumnUtil';
87
+ export * from './classes/BusinessLogicManager/FunctieFunctiegroep/TimeColumnUtil';
88
88
  export * from './factories/ApiResponseProcessorFactory';
89
89
  export * from './factories/CollectionResourceFactory';
90
90
  export * from './factories/ColumnExpansionFactory';
@@ -94,7 +94,7 @@ export declare class CollectionResource<ItemTypeType extends ApiItemType, Reques
94
94
  */
95
95
  onRemove(callback: OnRemoveCallback<this>): DeregFunction;
96
96
  getIdArray(): ItemId[];
97
- getItemById(itemId: ItemId): ItemResource<ItemTypeType, RequestColumns, Children>;
97
+ getItemById(itemId: ItemId): ItemResource<ItemTypeType, RequestColumns, Children> | undefined;
98
98
  triggerCollectionChangesListeners(changedItemResources: AddedRemovedItemResources<ItemResource<ItemTypeType, RequestColumns, Children>> & {
99
99
  changedItems?: undefined;
100
100
  }, sourceChangesDelta: null, itemIdConversionMap: ItemIdConversionMap | undefined, isCalledAfterSocketUpdate: boolean, isInitialCall: boolean, collectionChangesAccumulator: AggregatedChangesByListener | null): void;
@@ -0,0 +1,72 @@
1
+ import moment from 'moment';
2
+ import { ItemId } from '@rentman/backend-types';
3
+ import { ItemResource } from '../models/ItemResource';
4
+ import { CollectionResource } from '../models/CollectionResource';
5
+ import { TransactionCache } from '../classes/cache/transaction/TransactionCache';
6
+ export declare const factorColumns: readonly ["van", "tot", "staffel", "staffelgroep"];
7
+ export type FactorGroupResource = ItemResource<'Staffelgroep', [
8
+ 'id'
9
+ ], {
10
+ Staffel: CollectionResource<'Staffel', typeof factorColumns>;
11
+ }>;
12
+ export interface FactorUpdateInput<TItem> {
13
+ item: TItem;
14
+ staffelgroepId: ItemId<'Staffelgroep'> | null;
15
+ isRental: boolean;
16
+ currentStaffel: number;
17
+ parent: ItemId | null;
18
+ currentDuration: moment.Duration;
19
+ initialDuration: moment.Duration;
20
+ treatAsNewlyCreatedItem: boolean;
21
+ }
22
+ /**
23
+ * A single resolved factor (staffel) update produced by {@link RmFactorService.createFactorUpdateMap}.
24
+ *
25
+ * @template TItem The resource the update refers back to; passed through untouched from the matching
26
+ * {@link FactorUpdateInput}.
27
+ */
28
+ export interface FactorUpdate<TItem> {
29
+ /** The item whose factor should be updated. */
30
+ item: TItem;
31
+ /** The new factor (staffel) value to set on the item. */
32
+ factor: number;
33
+ /**
34
+ * Whether the confirmation modal should be skipped for this change.
35
+ * When the factor field is changed, in the frontend-redesign repo, the user gets a modal that allows them to optionally reject these changes.
36
+ * This modal should not be shown if this calculation is triggered by the creation of a new item or if the item is a child of a parent item.
37
+ */
38
+ shouldSkipConfirmationModal: boolean;
39
+ }
40
+ export declare class RmFactorService {
41
+ private static instance;
42
+ private constructor();
43
+ static construct(): RmFactorService;
44
+ /**
45
+ * Determines the factor (staffel) for a duration by finding the matching staffel range (`van`..`tot` in days).
46
+ * Falls back to the factor of the widest range when the duration exceeds all defined ranges.
47
+ * Returns `1` if duration is invalid, is zero or if no staffel resources are provided.
48
+ * @param duration - The duration to calculate the factor for.
49
+ * @param factorResources - The staffel resources to use for calculating the factor.
50
+ * @returns The factor (staffel) for the given duration.
51
+ */
52
+ getFactor(duration: moment.Duration, factorResources: ItemResource<'Staffel', typeof factorColumns>[]): number;
53
+ /**
54
+ * This function creates a map of staffel factors to update.
55
+ * It requires a mapped set of inputs that have been created or mutated.
56
+ * For every entry in the provided input map, it checks if the factor needs to be updated and returns those that do in a newly created array.
57
+ *
58
+ * @param transaction - The transaction cache to use.
59
+ * @param inputs - The inputs to use.
60
+ * @returns A map of staffel factors to update.
61
+ */
62
+ createFactorUpdateMap<TItem>(transaction: TransactionCache, inputs: FactorUpdateInput<TItem>[]): Promise<FactorUpdate<TItem>[]>;
63
+ /**
64
+ * This function creates the same map as createFactorUpdateMap but adjusts the inputs to satisfy the requirements of the forced factor update.
65
+ *
66
+ * @param transaction - The transaction cache to use.
67
+ * @param inputs - The inputs to use without the `initialDuration` and `treatAsNewlyCreatedItem`
68
+ * @returns A map of staffel factors to update.
69
+ * */
70
+ createForcedFactorUpdateMap<TItem>(transaction: TransactionCache, inputs: Omit<FactorUpdateInput<TItem>, 'initialDuration' | 'treatAsNewlyCreatedItem'>[]): Promise<FactorUpdate<TItem>[]>;
71
+ private getFactorGroupResources;
72
+ }