Bid
Extends:
Bids are self assessing classes representing the totality of a bid estimate. A bid contains collections of the following type of BidEntitys: LineItem, Metric, Field, Component, Datatable, Assembly, FieldGroup, ComponentGroup.
Constructor Summary
Public Constructor | ||
public |
constructor(bidData: object, bidService: BidService) Creates an instance of Bid. |
Member Summary
Public Members | ||
public |
|
|
public get |
|
|
public set |
|
|
public get |
|
|
public set |
|
|
public get |
|
|
public set |
Overrides bid cost. |
|
public get |
Cost including Markup |
|
public get |
Cost including Tax |
|
public get |
|
|
public |
|
|
public get |
Persistent id of the bid. |
|
public get |
Determines if the bid is active. |
|
public set |
Sets the bid active state. |
|
public get |
Determine if the full bid and all its entities are currently loaded. |
|
public get |
|
|
public get |
|
|
public set |
|
|
public get |
Markup Property |
|
public set |
|
|
public get |
|
|
public set |
|
|
public |
|
|
public |
|
|
public get |
|
|
public set |
|
|
public get |
Tax Property |
|
public get |
Tax Percent Property |
|
public set |
|
|
public get |
Gets the type of bid entity. |
|
public get |
|
|
public get |
|
Method Summary
Public Methods | ||
public |
async addAssemblies(assemblyMapIds: number[]): Promise<null> Adds assemblies to bid. |
|
public |
Adds a new bid variable to the bid |
|
public |
async addDynamicGroup(title: string): Promise<DynamicGroup> Adds Dynamic Groups to bid. |
|
public |
Adds a new field to the bid. |
|
public |
async addLineItem(title: string): Promise<LineItem> Adds a new line item to the bid. |
|
public |
Adds a new metric to the bid. |
|
public |
this method was deprecated.
|
|
public |
Assess bid values. |
|
public |
bind() Binds all interconnected bid entity "update" events |
|
public |
Determines if bid can be locked by user. |
|
public |
Determines if bid can be unlocked by user. |
|
public |
Clear the locally cached values |
|
public |
Removes all event listeners for the bid entities in a bid. |
|
public |
Clones the current bid and returns the cloned bid. |
|
public |
async createSnapshot(title: string, description: string): Promise<object> Creates a snapshot of current Bid data. |
|
public |
Deletes bid. |
|
public |
dirtyAll() Flags all fields, metrics, lineItems, and components as dirty. |
|
public |
exportData(): object Exports the bid's data to an object. |
|
public |
Exports the bid data along with all of the bid entities included. |
|
public |
getIndicativePrice(bidPrice: *, isLow: boolean): number Gets indicative price |
|
public |
Gets the margin of error for indicative pricing. |
|
public |
Calculates and returns the Bid Margin Percent. |
|
public |
getPredictedValue(): sum | null Gets the predicted value of the bid by calculating the sum total of the predicted values for all line items |
|
public |
getStoplightIndicator(predictionType: string): * |
|
public |
getUncategorizedLineItems(componentGroupId: number): {[id: string]} Gets all the uncategorized Line Items by component group. |
|
public |
getWeightedNormalValue(distributionIndex: *): T | null For each line item, get all of its weightedNormalValues return the sum of all line item's weightedNormalValues at distributionIndex |
|
public |
getWeightedNormalValues(): array Calculates the weighted normal value given a set of distribution ranges. |
|
public |
hasNullDependency(property: string): boolean Determines if a property depends on a null dependency somewhere in it's calculation |
|
public |
includeMarkupInTax(): * |
|
public |
Determines if markup should also be assessed on the tax. |
|
public |
Determines if bid is in an "assessable" state. |
|
public |
Determines if indicative pricing is enabled. |
|
public |
Determines if the bid is locked. |
|
public |
isPredicted(property: string): boolean Determines if a bid property is predicted. |
|
public |
Determines if bid can be modified by the user. |
|
public |
Determines if is a shell bid. |
|
public |
this method was deprecated.
Determines if bid is updatable by the user. |
|
public |
Determines if bid has valid dependency references and configurations.. |
|
public |
Fully loads the bid with its entities (if not already loaded). |
|
public |
Locks bid, forcing read-only mode for everyone. |
|
public |
async moveToProject(project: *): Promise<*> Moves a bid from its current project to another |
|
public |
Analyzes line items and components calculations. |
|
public |
pristine() Marks bid and all bid entities as clean. |
|
public |
reassessAll(forceReassessment: boolean) Reassess all LineItems, Fieldss, Metricss, and {@ linkComponents}s. |
|
public |
async reassessAsync(): Promise<void> Helper method to re-assess the bid until price converges. |
|
public |
Recovers bid to previous snapshot. |
|
public |
async removeAssembly(assemblyId: number): * Removes assembly from a bid. |
|
public |
Globally resets markup on all line items in the bid. |
|
public |
setPredictionService(predictionType: *) Sets the predictionType |
|
public |
this method was deprecated. use isActive property.
|
|
public |
Unlocks bid, making it writable for those with permission. |
|
public |
|
|
public |
Validates bid and returns a resultset of issues, if exists. |
Inherited Summary
From class AdvanceEventEmitter | ||
public |
Maximum number of events fired for the requester before events stop. |
|
public |
|
|
public |
|
|
public |
removeListenerByRequester(eventName: string, requesterId: string) Removes event listeners by event and requesterId. |
From class BidEntity | ||
public get |
Determine if the entity is in an assembly |
|
public get |
Gets the id of the bid entity. |
|
public get |
Gets the bid entity title. |
|
public set |
Sets the bid entity title. |
|
public get |
Gets the bid entity type. |
|
public abstract |
Assesses bid entity. |
|
public |
dependants(): BidEntity[] Gets an array of depndants that rely on the bid entity. |
|
public |
dependencies(): BidEntity[] Gets all the dependencies that the bid entity relies on. |
|
public |
dirty() Flags the bid entity as dirty and to be saved. |
|
public |
exportData(): object Exports the internal data for the bid entity. |
|
public |
hasNullDependency(field: string): boolean Determines if bid entity relies on a null or undefined dependency value |
|
public |
async initSaveChangeLog(originalValue: *, newValue: *, valueType: *, entityProperty: *, metaData: *): * |
|
public |
Determines of bid entity is dirty. |
|
public |
pristine() Marks the bid entity as clean. |
Public Constructors
public constructor(bidData: object, bidService: BidService) source
Creates an instance of Bid.
Override:
BidEntity#constructorParams:
Name | Type | Attribute | Description |
bidData | object | ||
bidService | BidService |
Public Members
public accountStoplightIndicator: * source
public set cost: number source
Overrides bid cost. Overrides are distibuted proportionally to the included line items.
public entities: BidEntityRelationsHelper source
public get id: number source
Persistent id of the bid. NOTE: id will soon be in alpha-numerical format
Override:
BidEntity#idpublic get isLoaded: boolean source
Determine if the full bid and all its entities are currently loaded. A bid cannot be edited or assessed until it is loaded. Bid can be loaded with bid.load().
public maxEvents: number source
Maximum number of events fired for the requester before events stop.
Override:
AdvanceEventEmitter#maxEventspublic predictionType: * source
Public Methods
public async addAssemblies(assemblyMapIds: number[]): Promise<null> source
Adds assemblies to bid. A wrapper function for BidService.addAssemblies
Params:
Name | Type | Attribute | Description |
assemblyMapIds | number[] | An array of assembly mapping ids to add. |
public async addDynamicGroup(title: string): Promise<DynamicGroup> source
Adds Dynamic Groups to bid. A wrapper function for BidService.addDynamicGroup
Params:
Name | Type | Attribute | Description |
title | string | The title of the Dynamic Group to add |
public async addField(title: string, type: string): Promise<Field> source
Adds a new field to the bid. This is a wrapper function for BidService.addField
Throw:
If bid is read only |
public async addLineItem(title: string): Promise<LineItem> source
Adds a new line item to the bid. The added line item is uncategorized in all component groups. This is a wrapper function for BidService.addLineItem
Params:
Name | Type | Attribute | Description |
title | string |
|
Throw:
If bid is read only |
public async addMetric(title: string): Promise<Metric> source
Adds a new metric to the bid. This is a wrapper function for BidService.addMetric
Params:
Name | Type | Attribute | Description |
title | string |
|
Throw:
If bid is read only |
public assess(dependency: BidEntity, forceUpdate: boolean) source
Assess bid values. If bid values changes, the bid will be flagged as dirty and an "updated" event will fire.
Override:
BidEntity#assessEmit:
assessing |
assessed |
updated |
public clearEntityBindings() source
Removes all event listeners for the bid entities in a bid. It does not remove any event listeners for the bid itself.
public async clone(): Promise<Bid> source
Clones the current bid and returns the cloned bid. The cloned bid is also added to the project automatically.
public async createSnapshot(title: string, description: string): Promise<object> source
Creates a snapshot of current Bid data.
public exportData(): object source
Exports the bid's data to an object.
Override:
BidEntity#exportDataReturn:
object |
Return Properties:
Name | Type | Attribute | Description |
id | number | NOTE: id will soon be in UUID format. |
|
title | string | ||
cost | number | ||
taxable_cost | number | ||
labor_cost | number | ||
labor_hours | number | ||
price | number | ||
margin_percent | number | ||
markup | number | ||
markup_percent | number | ||
tax | number | ||
tax_percent | number | ||
price | number | ||
actual_cost | number | ||
actual_hours | number | ||
watts | number | ||
is_active | boolean | ||
is_locked | boolean | ||
created_at | string | ||
updated_at | string |
public exportDataWithEntities(): object source
Exports the bid data along with all of the bid entities included.
public getIndicativePrice(bidPrice: *, isLow: boolean): number source
Gets indicative price
Params:
Name | Type | Attribute | Description |
bidPrice | * | ||
isLow | boolean | The lower or upper bounds (low | high) |
public getPredictedValue(): sum | null source
Gets the predicted value of the bid by calculating the sum total of the predicted values for all line items
public getStoplightIndicator(predictionType: string): * source
Params:
Name | Type | Attribute | Description |
predictionType | string |
|
Return:
* |
public getUncategorizedLineItems(componentGroupId: number): {[id: string]} source
Gets all the uncategorized Line Items by component group.
Params:
Name | Type | Attribute | Description |
componentGroupId | number | The component group id. |
Return:
{[id: string]} | Uncategorized Line Items keyed by ID. |
public getWeightedNormalValue(distributionIndex: *): T | null source
For each line item, get all of its weightedNormalValues return the sum of all line item's weightedNormalValues at distributionIndex
Params:
Name | Type | Attribute | Description |
distributionIndex | * |
public getWeightedNormalValues(): array source
Calculates the weighted normal value given a set of distribution ranges.
Return:
array | Array of weighted normal values |
public hasNullDependency(property: string): boolean source
Determines if a property depends on a null dependency somewhere in it's calculation
Override:
BidEntity#hasNullDependencyParams:
Name | Type | Attribute | Description |
property | string | The bid property name |
public includeTaxInMarkup(): boolean source
Determines if markup should also be assessed on the tax.
public isAssessable(): boolean source
Determines if bid is in an "assessable" state. Factors include if the bid is as shell bid, if the bid is in read only mode, and if the bid has no validation issues.
public isPredicted(property: string): boolean source
Determines if a bid property is predicted.
Params:
Name | Type | Attribute | Description |
property | string | The bid property |
public isReadOnly(): boolean source
Determines if bid can be modified by the user. Considers if the bid is locked, if the project is closed, and the user permissions.
public isShell(): boolean source
Determines if is a shell bid. Shell bids are simple data stores for past bids that can not be assesed. Shell bids do not have line items. Typically shell bids are created to import old bid data prior a companies using PVBid.
public isUpdateable(): boolean source
Determines if bid is updatable by the user. This method is deprecated. Use Bid.isReadOnly instead.
public isValid(): boolean source
Determines if bid has valid dependency references and configurations..
public async load(options: object) source
Fully loads the bid with its entities (if not already loaded).
public async lock(): Promise<null> source
Locks bid, forcing read-only mode for everyone. Bid must be unlocked before it can be modified again. This function immediately saves the bid. Will return a rejected promise if the bid cannot be locked.
public async moveToProject(project: *): Promise<*> source
Moves a bid from its current project to another
Params:
Name | Type | Attribute | Description |
project | * |
public needsReassessment(): boolean source
Analyzes line items and components calculations. If the sum up correctly to match the bid, reassessment is considered unnecessary.
public reassessAll(forceReassessment: boolean) source
Reassess all LineItems, Fieldss, Metricss, and {@ linkComponents}s. This function checks Bid.needsReassessment first, to determine if reassessment is necessary. Use the force flag to reasses reguardless of necessity.
Params:
Name | Type | Attribute | Description |
forceReassessment | boolean |
public async reassessAsync(): Promise<void> source
Helper method to re-assess the bid until price converges. Returns a promise that will resolve once the price has stabilized.
Return:
Promise<void> | Resolves once the bid has been assessed twice in a row with the same price. Rejects if the price does not stabilize. |
public async recover(snapshotId: number): Promise<null> source
Recovers bid to previous snapshot. An auto snapshot of the current state will be created. This is a wrapper function for BidService.recoverBid
Params:
Name | Type | Attribute | Description |
snapshotId | number |
public async removeAssembly(assemblyId: number): * source
Removes assembly from a bid. A wrapper function for BidService.removeAssembly
Params:
Name | Type | Attribute | Description |
assemblyId | number |
Return:
* |
public setPredictionService(predictionType: *) source
Sets the predictionType
Params:
Name | Type | Attribute | Description |
predictionType | * |
public async unlock(): Promise<null> source
Unlocks bid, making it writable for those with permission. This function immediately saves the bid.