# AppSettings

**Kind:** Class

**Source:** `Pams/Web/Pams.Web/Client/app/settings/app/app.settings.ts` (line 126)

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

`AppSettings` centralizes client-side application setting checks and UI-related helper methods. It exposes methods for origin URL access, date handling, company and developer checks, page-leave behavior, dashboard display values, and equality checks.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `getOriginUrl` | `getOriginUrl()` | `void` |
| `addTimeZoneToDate` | `addTimeZoneToDate(date: Date)` | `void` |
| `isMeDeveloper` | `isMeDeveloper()` | `boolean` |
| `ifShotecCompany` | `ifShotecCompany()` | `void` |
| `if_ShotecSAE_ServiceCenter_Branches` | `if_ShotecSAE_ServiceCenter_Branches(BranchId: undefined)` | `boolean` |
| `leavePage` | `leavePage()` | `void` |
| `CalculateSize` | `CalculateSize(offset: number)` | `void` |
| `setYearsColorForDashboard` | `setYearsColorForDashboard(year: number)` | `string` |
| `GetPrecentage` | `GetPrecentage(val: undefined, total_val: undefined)` | `void` |
| `checkEquality` | `checkEquality(source: any, target: any, pro: string, CalculatedFields: any[])` | `boolean` |
| `DataChanged` | `DataChanged(source: any, target: any, CalculatedFields: any[])` | `boolean` |
| `formatDate` | `formatDate(e: Date)` | `void` |
| `formatDateTime` | `formatDateTime(e: Date)` | `void` |
| `ConvertDateToString` | `ConvertDateToString(dateX: Date)` | `string` |
| `ConvertDateToStringEU` | `ConvertDateToStringEU(dateX: Date)` | `string` |
| `ConvertStringToDate` | `ConvertStringToDate(data: string)` | `Date` |
| `ConvertStringToDateEU` | `ConvertStringToDateEU(data: string)` | `Date` |
| `NumeralConversionDefault` | `NumeralConversionDefault(data: undefined, format: undefined)` | `string` |
| `NumeralConversionForRate` | `NumeralConversionForRate(data: undefined, format: undefined)` | `string` |
| `NumeralConversion` | `NumeralConversion(data: undefined, format: undefined, currency: undefined)` | `string` |
| `NumeralUnConversion` | `NumeralUnConversion(data: undefined)` | `number` |
| `returnDecimalDigits` | `returnDecimalDigits(numOfDigits: number)` | `string` |
| `getDecimalDigits` | `getDecimalDigits(value: number)` | `string` |
| `ParseError` | `ParseError(error: any)` | `string` |
| `UlitizeTime` | `UlitizeTime(i: number, Sperator: string, title: string)` | `void` |
| `calculateTimePeriod` | `calculateTimePeriod(periodId: number)` | `number` |
| `returnTimePeriodForMoment` | `returnTimePeriodForMoment(periodId: number)` | `string` |
| `setCookie` | `setCookie(cName: undefined, cValue: undefined, expDays: undefined)` | `void` |
| `getCookie` | `getCookie(cName: undefined)` | `void` |
| `deleteCookie` | `deleteCookie(cName: string)` | `void` |
| `saveLocalStorage` | `saveLocalStorage()` | `void` |
| `ifSavePamsStorage` | `ifSavePamsStorage()` | `boolean` |
| `ifSaveUserLoggedInStorage` | `ifSaveUserLoggedInStorage()` | `boolean` |
| `readPamsLocalStorage` | `readPamsLocalStorage()` | `void` |
| `readUserLoggedInLocalStorage` | `readUserLoggedInLocalStorage()` | `void` |
| `clearLocalStorage` | `clearLocalStorage()` | `void` |
| `ifStorageUpdated` | `ifStorageUpdated()` | `boolean` |
| `save2WayAuthenticationLocalStorage` | `save2WayAuthenticationLocalStorage()` | `void` |
| `read2WayAuthenticationLocalStorage` | `read2WayAuthenticationLocalStorage()` | `void` |
| `if2WayAuthenticationSaveStorage` | `if2WayAuthenticationSaveStorage()` | `boolean` |
| `clear2WayAuthenticationLocalStorage` | `clear2WayAuthenticationLocalStorage()` | `void` |
| `if2WayAuthenticationStorageUpdated` | `if2WayAuthenticationStorageUpdated()` | `void` |
| `saveUserLoggedIn` | `saveUserLoggedIn()` | `void` |
| `ifSaveUserLoggedIn` | `ifSaveUserLoggedIn()` | `boolean` |
| `encodingString` | `encodingString(str: string)` | `string` |
| `decodingString` | `decodingString(str: string)` | `string` |
| `readUserLoggedIn` | `readUserLoggedIn()` | `void` |
| `checkUserDepartment` | `checkUserDepartment(checkDepartment: number)` | `boolean` |
| `getSelectedPrincipals` | `getSelectedPrincipals()` | `void` |
| `setSelectedPrincipals` | `setSelectedPrincipals(selectedPrincipals: number[])` | `void` |

## Properties

| Property | Type |
|---|---|
| `APIUrl` | `any` |
| `APIOneDriveUrl` | `any` |
| `OriginFrontURL` | `any` |
| `newMailURL` | `any` |
| `AppVersionNumber` | `any` |
| `AppVersion` | `any` |
| `AppName` | `any` |
| `bottomActionBar` | `any` |
| `ImgPath` | `any` |
| `MainPageRoute` | `any` |
| `API_ProjectProcessWorkflowTypeController` | `any` |
| `API_CategoryController` | `any` |
| `API_ProductController` | `any` |
| `API_ProductVariantController` | `any` |
| `API_ProductSubSupplierController` | `any` |
| `API_AuthController` | `any` |
| `API_UnitController` | `any` |
| `API_CountryController` | `any` |
| `API_Activities` | `any` |
| `API_ActivitiesLookups` | `any` |
| `API_CompanyCurrencyController` | `any` |
| `API_OfferController` | `any` |
| `API_OfferItemController` | `any` |
| `API_ItemController` | `any` |
| `API_TimePeriodController` | `any` |
| `API_NewTimePeriod` | `any` |
| `API_OfferMileStoneController` | `any` |
| `API_OfferItemVersionController` | `any` |
| `API_InquiryController` | `any` |
| `API_GuaranteeTypeController` | `any` |
| `API_JobGuaranteeController` | `any` |
| `API_CurrencyController` | `any` |
| `API_ContactInfoTypesController` | `any` |
| `API_ContactInfoRelatedTypeController` | `any` |
| `API_JobProcessController` | `any` |
| `API_JobItemController` | `any` |
| `API_JobVersionController` | `any` |
| `API_CityController` | `any` |
| `API_GovernateController` | `any` |
| `API_SerialStatusController` | `any` |
| `API_SerialCombinationsController` | `any` |
| `API_SerialComponentsController` | `any` |
| `API_SerialTypeController` | `any` |
| `API_PaymentMethodController` | `any` |
| `API_DeliveryTermController` | `any` |
| `API_ClientsController` | `any` |
| `API_PersonController` | `any` |
| `API_ClientTypesController` | `any` |
| `API_SupplierTypesController` | `any` |
| `API_MarketSegmentController` | `any` |

## Where it refuses work

- `AppSettings` stops the work with an early return when `AppSettings.userLoggedInObj.userId == 1`.
- `AppSettings` stops the work with an early return when `AppSettings.userLoggedInObj && AppSettings.userLoggedInObj.companyId != 1`.
- `AppSettings` stops the work with an early return when `BranchId == 1 || BranchId == 4`.
- `AppSettings` stops the work with an early return when `new Date().getFullYear() - year >= 5`.
- `AppSettings` stops the work with an early return when `source && target && source[pro] && source[pro] != target[pro] && CalculatedFields.findInd…`.
- `AppSettings` stops the work with an early return when `date.trim() != ""`.

## Diagram

```mermaid
graph LR
  AppSettings --> Origin[getOriginUrl]
  AppSettings --> Date[addTimeZoneToDate]
  AppSettings --> Access[isMeDeveloper]
  AppSettings --> Company[ifShotecCompany]
  AppSettings --> Branches[if_ShotecSAE_ServiceCenter_Branches]
  AppSettings --> Navigation[leavePage]
  AppSettings --> Layout[CalculateSize]
  AppSettings --> Dashboard[setYearsColorForDashboard]
  AppSettings --> Percentage[GetPrecentage]
  AppSettings --> Validation[checkEquality]
```

## Usage

```ts
import { AppSettings } from './app.settings';

const appSettings = new AppSettings();

const originUrl = appSettings.getOriginUrl();
const isDeveloper = appSettings.isMeDeveloper();
const isServiceCenterBranch =
  appSettings.if_ShotecSAE_ServiceCenter_Branches();

if (isDeveloper) {
  console.log(`Developer session at ${originUrl}`);
}

const dashboardYearColor = appSettings.setYearsColorForDashboard();
const valuesMatch = appSettings.checkEquality();

if (!valuesMatch) {
  appSettings.leavePage();
}
```

## AI Coding Instructions

- Keep environment, company, and role checks inside `AppSettings` instead of duplicating conditional logic in components.
- Preserve existing method names, including `GetPrecentage` and `if_ShotecSAE_ServiceCenter_Branches`, because callers may depend on them.
- Check boolean return values from `isMeDeveloper`, `if_ShotecCompany`, and `checkEquality` before changing UI or navigation behavior.
- Call `addTimeZoneToDate` when working with dates that must follow the application's timezone handling rules.

## Relationships

- CALLS → `FilesController`
- CALLS → `MarketSegmentController`
- CALLS → `CategoryController`
- CALLS → `ProductController`
- CALLS → `ProductVariantController`
- CALLS → `ProductSupplierController`
- CALLS → `UnitController`
- CALLS → `CountryController`
- CALLS → `ActivitiesController`
- CALLS → `VisitPurposeController`
- CALLS → `CompanyCurrencyController`
- CALLS → `OfferController`
- CALLS → `ItemController`
- CALLS → `TimePeriodController`
- CALLS → `SalesJobController`
- CALLS → `OfferMileStoneController`
- CALLS → `InquiryController`
- CALLS → `GuaranteeTypesController`
- CALLS → `JobGuaranteesController`
- CALLS → `CurrencyController`
- CALLS → `ContactInfoTypeController`
- CALLS → `ContactInfoRelatedTypeController`
- CALLS → `JobProcessController`
- CALLS → `JobItemController`
- CALLS → `JobVersionController`
- CALLS → `CityController`
- CALLS → `GovernateController`
- CALLS → `SerialStatusController`
- CALLS → `SerialCombinationsController`
- CALLS → `SerialComponentsController`
- CALLS → `SerialTypeController`
- CALLS → `PaymentMethodController`
- CALLS → `DeliveryTermController`
- CALLS → `PersonController`
- CALLS → `ClientTypeController`
- CALLS → `SupplierTypeController`
- CALLS → `PersonEmailController`
- CALLS → `PersonPhoneController`
- CALLS → `CompanyBranchContactInfoController`
- CALLS → `ContactInfoController`
- CALLS → `CompanyBranchController`
- CALLS → `StoreController`
- CALLS → `StoreAreaController`
- CALLS → `WarehouseModelController`
- CALLS → `ReceivingShipmentController`
- CALLS → `InspectionSheetController`
- CALLS → `InspectionBaseController`
- CALLS → `TransferOrderReasonController`
- CALLS → `ExternalServiceTypeController`
- CALLS → `ProductWithdrawalController`
- CALLS → `BookingProductController`
- CALLS → `StoreProductController`
- CALLS → `ShippingOrderController`
- CALLS → `ProductionOrderController`
- CALLS → `IssuingGoodsController`
- CALLS → `ReturnNoteController`
- CALLS → `DeliveryNoteController`
- CALLS → `ExternalServiceController`
- CALLS → `TransferOrderController`
- CALLS → `BankController`
- CALLS → `BankAccountController`
- CALLS → `CompanyController`
- CALLS → `AddressController`
- CALLS → `AddressTypeController`
- CALLS → `CompanyBranchSettingController`
- CALLS → `ProcessReasonController`
- CALLS → `InquiryTypesController`
- CALLS → `OfferStatusController`
- CALLS → `OrderChanceController`
- CALLS → `OrderStatusController`
- CALLS → `JobListLayoutController`
- CALLS → `DefaultJobListLayoutController`
- CALLS → `ProductTypeController`
- CALLS → `MRQProductTypeController`
- CALLS → `BookingTargetController`
- CALLS → `ForecastedBookingController`
- CALLS → `TeamTargetController`
- CALLS → `PrincipalTargetController`
- CALLS → `AccountManagerTargetController`
- CALLS → `ProductTypeTargetController`
- CALLS → `FinanceBudgetController`
- CALLS → `ProductTypeGroupController`
- CALLS → `NationalityController`
- CALLS → `EmployeeTypesController`
- CALLS → `MaritalStatusController`
- CALLS → `CompanyBranchDepartmentController`
- CALLS → `ProjectCommentController`
- CALLS → `ProjectRegisteredController`
- CALLS → `ShareholdersController`
- CALLS → `ContactPersonController`
- CALLS → `ContactPersonReferenceController`
- CALLS → `ContactPersonRelatedTypeController`
- CALLS → `RegistrationStatusController`
- CALLS → `DataSourceController`
- CALLS → `DashboardController`
- CALLS → `DashboardDataController`
- CALLS → `OrderActivationConditionController`
- CALLS → `MyDeskController`
- CALLS → `ReactivationReasonsController`
- CALLS → `DefaultSerialStatusController`
- CALLS → `ConnectionTypeController`
- CALLS → `MailToController`
- CALLS → `NotificationController`
- CALLS → `NotificationTypeController`
- CALLS → `ReminderController`
- CALLS → `SytemNotificationController`
- CALLS → `SentEmailsController`
- CALLS → `TimeUnitTypeController`
- CALLS → `UserEmailSettingController`
- CALLS → `AssigneeController`
- CALLS → `AssigneeAccessTypeController`
- CALLS → `PriorityController`
- CALLS → `StatusController`
- CALLS → `TaskController`
- CALLS → `CommentsController`
- CALLS → `RelatedToTypesController`
- CALLS → `TagsController`
- CALLS → `ClientDelayController`
- CALLS → `DashboardWidgetController`
- CALLS → `AccountsController`
- CALLS → `ProductCategoryController`
- CALLS → `PersonUserController`
- CALLS → `RoleController`
- CALLS → `PersonTypeController`
- CALLS → `PermissionController`
- CALLS → `RolePermissionsController`
- CALLS → `JobVersionStatusLogController`
- CALLS → `JobItemStatusController`
- CALLS → `JobItemStatusDataController`
- CALLS → `ProjectController`
- CALLS → `ProjectStatusController`
- CALLS → `JobDocumentController`
- CALLS → `InvoiceController`
- CALLS → `UpcomingInvoiceController`
- CALLS → `PaymentController`
- CALLS → `ImportController`
- CALLS → `LetterOfGuaranteeController`
- CALLS → `PmSerialCombinationController`
- CALLS → `BillOfMaterialController`
- CALLS → `MaterialsRequisitionController`
- CALLS → `MRQJobController`
- CALLS → `MRQJobInquiryController`
- CALLS → `MRQJobOfferController`
- CALLS → `MRQJobOrderController`
- CALLS → `MRQJobProductController`
- CALLS → `SalesPotentialController`
- CALLS → `SalesFollowerController`
- CALLS → `SalesPotentialStatusController`
- CALLS → `SalesOfferController`
- CALLS → `SalesOrderController`
- CALLS → `SalesItemController`
- CALLS → `CustomFieldController`
- CALLS → `PrincipalInvoicePaymentController`
- CALLS → `PrincipalPaymentController`
- CALLS → `PrincipalDeductionController`
- CALLS → `UpcomingPrincipalInvoiceController`
- CALLS → `PurchasingJobController`
- CALLS → `purchasingInquiryController`
- CALLS → `PurchasingOfferController`
- CALLS → `PurchasingOrderController`
- CALLS → `PurchasingItemController`
- CALLS → `PurchasePaymentMilestoneController`
- CALLS → `WordTemplateController`
- CALLS → `AuditController`
- CALLS → `ColorMarkerController`
- CALLS → `ClientProfileController`

## Used by

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

### Imported by (291)

- `AppComponent` — `Pams/Web/Pams.Web/Client/app/app.component.ts`:1
- `TranslateHandler` — `Pams/Web/Pams.Web/Client/app/app.module.ts`:1
- `MrqDetailsComponent` — `Pams/Web/Pams.Web/Client/app/components/MRQ/mrq-details/mrq-details.component.ts`:1
- `MrqListComponent` — `Pams/Web/Pams.Web/Client/app/components/MRQ/mrq-list/mrq-list.component.ts`:1
- `MrqService` — `Pams/Web/Pams.Web/Client/app/components/MRQ/mrq.service.ts`:1
- `BillOfMaterialsListComponent` — `Pams/Web/Pams.Web/Client/app/components/bill-of-materials/bill-of-materials-list/bill-of-materials-list.component.ts`:1
- `BlogsComponent` — `Pams/Web/Pams.Web/Client/app/components/blogs/blogs.component.ts`:1
- `BlogsService` — `Pams/Web/Pams.Web/Client/app/components/blogs/blogs.service.ts`:1

…and 283 more.
