Skip to content

NewProject

reference
3 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/market/projects/newProject.ts (line 51)

Part of: Pams

NewProject is the client-side component for creating a market project. It tracks data changes and branch checks, reads project and tab state, opens supporting views, and submits the 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
alertsAlertsComponent
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
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
    User[User action] --> NewProject[NewProject]
    NewProject --> DataChanged[DataChanged]
    NewProject --> BranchCheck[ifSameBranch]
    NewProject --> Record[getRecord]
    NewProject --> Tabs[getOpenedTabs]
    NewProject --> Library[openLibrary]
    NewProject --> RegistrationDocs[openRegistrationDocs]
    NewProject --> Create[AddNew]

Usage

ts
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { NewProject } from './newProject';

@Component({
  selector: 'app-project-host',
  template: '<app-new-project></app-new-project>',
})
export class ProjectHostComponent implements AfterViewInit {
  @ViewChild(NewProject) newProject!: NewProject;

  ngAfterViewInit(): void {
    this.newProject.getRecord();

    if (this.newProject.ifSameBranch()) {
      this.newProject.openLibrary();
    } else {
      this.newProject.openRegistrationDocs();
    }
  }

  createProject(): void {
    this.newProject.AddNew();
  }
}

AI Coding Instructions

  • Let Angular call ngOnInit() and ngAfterViewInit() through the component lifecycle; do not call them directly from application code.
  • Check ifSameBranch() before actions that depend on the selected branch context.
  • Call getRecord() and getOpenedTabs() when current project or workspace state is needed.
  • Keep AddNew() as the submission action after required project data has been prepared.
  • Use openLibrary() and openRegistrationDocs() for their respective navigation flows rather than duplicating their routing 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 → AlertsComponent
  • IMPORTS → SharedPopupComponent
  • IMPORTS → SharedAttachedDocsComponent
  • IMPORTS → File
  • IMPORTS → GeneralListView
  • IMPORTS → FilesComponent
  • IMPORTS → ContactsComponent
  • IMPORTS → FilesPortService
  • IMPORTS → FilesService
  • IMPORTS → ComponentCanDeactivate
  • IMPORTS → RecentlyOpenedService

Used by

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

Imported by (2)

  • AppRoutingModulePams/Web/Pams.Web/Client/app/app-routing.module.ts:1
  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1

Was this page helpful?

Download as PDF