Skip to content

NewProject

reference
3 min readUpdated

Kind: Class

Source: Frontend/src/app/components/market/projects/newProject.ts (line 52)

Part of: Frontend

NewProject manages the new market project workflow in the projects area. It handles component lifecycle setup, tracks data changes, checks branch state, opens related library or registration documents, and submits a new project through AddNew().

Implements: OnInit, AfterViewInit, ComponentCanDeactivate

Methods

MethodSignatureReturns
DataChangedDataChanged()void
ifSameBranchifSameBranch()boolean
ngOnInitngOnInit()void
ngAfterViewInitngAfterViewInit()void
getRecordgetRecord()void
getOpenedTabsgetOpenedTabs()void
selectTextselectText(e: undefined)void
openLibraryopenLibrary()void
openRegistrationDocsopenRegistrationDocs(reg: ProjectsSuppliersRegisteration)void
AddNewAddNew(e: undefined, type: undefined)void
validatevalidate(e: undefined)void
GetAuthorizationAccessGetAuthorizationAccess(url: string)void
checkAllowedToEditcheckAllowedToEdit()boolean
getClassgetClass(status: string)string
addNewPersonaddNewPerson()void
AddNewContactAddNewContact(ID: undefined)void
EmitRemoveContactEmitRemoveContact(ID: undefined)void
AddContactAddContact(e: undefined)void
RemoveContactRemoveContact(e: undefined)void
newOfnewOf()void
updateContactPersonImgupdateContactPersonImg()void
preview2preview2()void
addnewContactPersonContactaddnewContactPersonContact(type: undefined)void
deletePersonContactinfodeletePersonContactinfo(i: number)void
resestPersonresestPerson()void
geturlgeturl(path: undefined)void
setpersonsetperson(e: undefined)void
deletePersondeletePerson(e: undefined)void
EditPersonEditPerson()void
preview3preview3()void
EditContactPersonImgEditContactPersonImg()void
makeFileRequestmakeFileRequest(url: string, params: Array<string>, files: Array<File>)void
setPerson2setPerson2(e: any)void
gridItem_KeyPress_NumbergridItem_KeyPress_Number(event: undefined)void
addnewShareholderaddnewShareholder()void
onExpectedCompletionDateChangedonExpectedCompletionDateChanged(e: undefined)void
onCreatedAtChangedonCreatedAtChanged(e: undefined)void
onSalesResponsibleChangeonSalesResponsibleChange(e: undefined)void
onSalesResponsibleRemoveonSalesResponsibleRemove()void
matchSalesResposibleWithTeamsmatchSalesResposibleWithTeams()void
currencyChangecurrencyChange(e: any)void
getMarketSegmentsgetMarketSegments()void
setSelectedRegistrationsetSelectedRegistration(e: undefined)void
getRegistrationStatusgetRegistrationStatus()void
getRegistrationDatagetRegistrationData()void
formatCellsformatCells(e: undefined)void
OpenRegOpenReg(e: undefined)void
editnewRegistreationeditnewRegistreation()void
addnewRegistreationaddnewRegistreation()void
updateRegistreationupdateRegistreation(newOrUpdate: string, Registreation: ProjectsSuppliersRegisteration)void

Properties

PropertyType
marketSegmentsMarketSegment[]
firstInitializedboolean
_passIdAsInputnumber
gridDxDataGridComponent
grid2DxDataGridComponent
sharedPopupSharedPopupComponent
DataValidatorDxValidationGroupComponent
RegistrationValidatorDxValidationGroupComponent
EditeRegistrationValidatorDxValidationGroupComponent
printOptionsValidatorDxValidationGroupComponent
FileLibraryFilesComponent
attachedDropdownSharedAttachedDocsComponent
attachedProjectRegistrationDropdownSharedAttachedDocsComponent
contactListContactsComponent
logHistoryComponentLogHistoryComponent
environmentany
popupany
selectedDocsFileData[]
projectProject
oldDataProject
supplierListAccount[]
dataTypesany
List1string[]
List2string[]
List3string[]
List4string[]
List5string[]
List6string[]
usersPerson[]
errorMessagestring
NoChange_CanLeaveboolean
Change_Saved_CanLeaveboolean
Change_NoSave_WantLeaveboolean
pendingNavigationUrlRouterStateSnapshot
RelatedToTypesany
ModuleEnumIdany
LogModuleIdany
projectStatuListProjectStatus[]
TempNamestring
selectedRegistedAccount[]
TempPercntagenumber
projectJobsProjectJobs[]
ClientsListany[]
Commentstring
Replystring
currenFeaturenumber
subscriptionNotIncludeboolean
registerationFeatureIdnumber
registerationFeatureNotIncludeboolean
subscriptionSubscription

Where it refuses work

  • NewProject stops the work with an early return when this.project && this.project.CompanyBranchID == this.auth.User.CompanyBranchID.
  • NewProject stops the work with an early return when this.allowedtoEdit.
  • NewProject stops the work with an early return when this.allowedtoNew.
  • NewProject stops the work with an early return when !path || path.length < 1.
  • NewProject stops the work with an early return when !this.EditeRegistrationValidator.instance.validate().isValid.
  • NewProject stops the work with an early return when !this.RegistrationValidator.instance.validate().isValid.

Diagram

mermaid
graph LR
  Init[ngOnInit] --> Load[getRecord]
  Init --> Tabs[getOpenedTabs]
  ViewInit[ngAfterViewInit] --> Select[selectText]
  Change[DataChanged] --> Branch[ifSameBranch]
  Branch --> Add[AddNew]
  Library[openLibrary] --> Docs[Project library]
  Registration[openRegistrationDocs] --> Docs

Usage

ts
import { NewProject } from './newProject';

export class ProjectHostComponent {
  newProject!: NewProject;

  submitProject(): void {
    this.newProject.DataChanged();

    if (this.newProject.ifSameBranch()) {
      this.newProject.AddNew();
    }
  }

  showReferenceMaterial(): void {
    this.newProject.openLibrary();
  }

  showRegistrationDocuments(): void {
    this.newProject.openRegistrationDocs();
  }
}

AI Coding Instructions

  • Keep initialization work in ngOnInit() and view-dependent work in ngAfterViewInit().
  • Call DataChanged() when editable project data changes so the component can update its pending state.
  • Check ifSameBranch() before calling AddNew() when project creation depends on branch selection.
  • Use openLibrary() and openRegistrationDocs() for their respective navigation actions rather than duplicating document-opening logic.

Relationships

  • IMPORTS → Shareholder
  • IMPORTS → AppSettings
  • IMPORTS → DataTypes
  • IMPORTS → PermissionForSheetResponce
  • IMPORTS → SubscriptionPackagesEnum
  • IMPORTS → PrintOption
  • IMPORTS → AuthService
  • IMPORTS → ListOfNewResponse
  • IMPORTS → Project
  • IMPORTS → ProjectJobs
  • IMPORTS → ProjectImportanceEnum
  • IMPORTS → ProjectService
  • IMPORTS → ProjectStatusService
  • IMPORTS → RelatedToTypes
  • IMPORTS → ContactInfo
  • IMPORTS → PersonService
  • IMPORTS → Account
  • IMPORTS → AccountsService
  • IMPORTS → Person
  • IMPORTS → Departments
  • IMPORTS → MarketSegmentService
  • IMPORTS → MarketSegment
  • IMPORTS → ContactPersons
  • IMPORTS → ProjectsSuppliersRegisteration
  • IMPORTS → ContactPersonService
  • IMPORTS → RegistrationStatus
  • IMPORTS → PreviousPageService
  • IMPORTS → AlertsService
  • IMPORTS → SharedPopupComponent
  • IMPORTS → SharedAttachedDocsComponent
  • IMPORTS → File
  • IMPORTS → GeneralListView
  • IMPORTS → FilesComponent
  • IMPORTS → ContactsComponent
  • IMPORTS → FilesPortService
  • IMPORTS → FilesService
  • IMPORTS → ComponentCanDeactivate
  • IMPORTS → RecentlyOpenedService
  • IMPORTS → checkChanges
  • IMPORTS → environment
  • IMPORTS → ModuleEnumId
  • IMPORTS → LogHistoryModulesEnum
  • IMPORTS → LogHistoryComponent
  • IMPORTS → RegisterationsData
  • IMPORTS → NewJobService

Used by

3 references from 3 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (3)

  • MarketComponentsModuleFrontend/src/app/components/market/market-components.module.ts:1
  • MarketModuleFrontend/src/app/components/market/market.module.ts:1
  • ProjectsModuleFrontend/src/app/components/market/projects.module.ts:1

Was this page helpful?

Download as PDF