# UploadFileComponent

**Kind:** Class

**Source:** `Pams/Web/Pams.Web/Client/app/components/files/upload-file/upload-file.component.ts` (line 21)

**Part of:** [Pams](subsystem-pams)

`UploadFileComponent` manages file-upload UI state in the PAMS web client. It initializes upload-related data, synchronizes with an upload popup, loads tags and permissions, and handles post-upload updates.

**Implements:** `OnInit`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `ngOnInit` | `ngOnInit()` | `void` |
| `resizeWindow` | `resizeWindow()` | `void` |
| `getNumberFormatted` | `getNumberFormatted(x: undefined)` | `string` |
| `selectText` | `selectText(e: undefined)` | `void` |
| `stopPropagation` | `stopPropagation(e: undefined)` | `void` |
| `traceTypesListName` | `traceTypesListName(value: number)` | `string` |
| `syncWithUploadPopup` | `syncWithUploadPopup()` | `void` |
| `onUploaded` | `onUploaded()` | `void` |
| `GetTagsListByType` | `GetTagsListByType(Type: number, supplierId: number)` | `void` |
| `getUsersPermission` | `getUsersPermission()` | `void` |
| `getFilesList` | `getFilesList(parentId: string)` | `void` |
| `trace` | `trace(data: any)` | `void` |
| `getFoldersList` | `getFoldersList(parentId: string, levelIndex: number)` | `void` |
| `extractFilesExtension` | `extractFilesExtension(file: OneDriveFilesList)` | `string` |
| `onChooseTagType` | `onChooseTagType(e: undefined)` | `void` |
| `saveNewFile` | `saveNewFile()` | `void` |
| `selectFile` | `selectFile(file: OneDriveFilesList)` | `void` |
| `closePopup` | `closePopup()` | `void` |
| `LinkTag` | `LinkTag(doLinkDirectly: boolean)` | `void` |
| `DeleteTag` | `DeleteTag(idx: number)` | `void` |
| `addComment` | `addComment()` | `void` |
| `DeleteComment` | `DeleteComment(idx: number)` | `void` |
| `ngOnDestroy` | `ngOnDestroy()` | `void` |
| `changeTabs` | `changeTabs(targetTab: undefined)` | `void` |
| `selectItem` | `selectItem(e: any)` | `void` |
| `onInitialized` | `onInitialized(e: undefined)` | `void` |

## Properties

| Property | Type |
|---|---|
| `treeView` | `DxTreeViewComponent` |
| `uploadValidation` | `DxValidationGroupComponent` |
| `alerts` | `AlertsComponent` |
| `TagReferenceToTypeID` | `number` |
| `TagReferenceToID` | `number` |
| `ParentFileID` | `number` |
| `tempSelectedDataFile` | `FileData` |
| `SelectedDataFiles` | `FileData[]` |
| `tempShareFile` | `OneDriveShareFiles` |
| `ShareFiles` | `OneDriveShareFiles[]` |
| `usersPermission` | `DriveUser[]` |
| `SelectedList` | `OneDriveFilesList[]` |
| `FoldersList` | `OneDriveFilesList[]` |
| `fileNameAndExtension` | `FileNameAndExtension[]` |
| `currentTab` | `string` |
| `newTag` | `UploadNewFile` |
| `UploadedFiles` | `File[]` |
| `uploadPopup` | `boolean` |
| `CompanyBranchID` | `number` |
| `selectedTagReferenceToTypeID` | `number` |
| `selectedTagReferenceToID` | `number` |
| `selectedTagRegistrationReferenceToSupplierID` | `number` |
| `displayNamePattern` | `any` |
| `FileRelatedToTypes` | `any` |
| `modalOptions` | `any` |
| `TypesList` | `any[]` |
| `TagLists` | `GeneralListView[][]` |
| `TagListDataSources` | `DataSource[]` |
| `Comment` | `string` |
| `subscription` | `Subscription` |
| `DatagridHeight` | `number` |
| `TotalFilesCount` | `number` |
| `TotalFoldersCount` | `number` |
| `updateTopContent` | `any` |
| `updateBottomContent` | `any` |
| `updateContentTimer` | `any` |
| `updateContent` | `any` |

## Where it refuses work

- `UploadFileComponent` stops the work with an early return when `findIndex > -1`.
- `UploadFileComponent` stops the work with an early return when `!this.selectedTagReferenceToID || this.selectedTagReferenceToID == 0`.
- `UploadFileComponent` stops the work with an early return when `this.tempSelectedDataFile && this.tempSelectedDataFile.FileTags && this.tempSelectedDataF…`.
- `UploadFileComponent` stops the work with an early return when `!(this.Comment.trim() && this.Comment.trim().length > 0)`.

## Diagram

```mermaid
graph LR
  Init[ngOnInit] --> Resize[resizeWindow]
  Init --> Tags[GetTagsListByType]
  Init --> Permissions[getUsersPermission]
  UserAction[User interaction] --> Select[selectText]
  UserAction --> Stop[stopPropagation]
  UploadPopup[Upload popup] --> Sync[syncWithUploadPopup]
  UploadComplete[Upload completed] --> Uploaded[onUploaded]
  Uploaded --> Tags
  Display[Upload display] --> Format[getNumberFormatted]
  Display --> Trace[traceTypesListName]
```

## Usage

```ts
import { UploadFileComponent } from './upload-file.component';

function refreshUploadState(component: UploadFileComponent): void {
  component.GetTagsListByType();
  component.getUsersPermission();
  component.syncWithUploadPopup();
}

function handleUploadComplete(component: UploadFileComponent): void {
  component.onUploaded();

  const formattedValue = component.getNumberFormatted();
  console.log(formattedValue);
}
```

## AI Coding Instructions

- Keep upload initialization logic in `ngOnInit()` and preserve the existing lifecycle flow.
- Call `syncWithUploadPopup()` when popup state or upload context changes.
- Refresh dependent tag and permission data through `GetTagsListByType()` and `getUsersPermission()` after relevant changes.
- Use `stopPropagation()` for UI events that must not reach parent handlers.
- Keep post-upload handling in `onUploaded()` so upload completion updates remain in one place.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (1)

- `TranslateHandler` — `Pams/Web/Pams.Web/Client/app/app.module.ts`:1
