UNPKG

@salaxy/ng1

Version:

AngularJS libraries for Salaxy platform (Palkkaus.fi)

1,030 lines (1,027 loc) 5.33 MB
var hN = Object.defineProperty; var mN = (s, t, e) => t in s ? hN(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e; var _t = (s, t, e) => (mN(s, typeof t != "symbol" ? t + "" : t, e), e), gN = (s, t, e) => { if (!t.has(s)) throw TypeError("Cannot " + e); }; var Py = (s, t, e) => { if (t.has(s)) throw TypeError("Cannot add the same private member more than once"); t instanceof WeakSet ? t.add(s) : t.set(s, e); }; var Gu = (s, t, e) => (gN(s, t, "access private method"), e); import { Configs as xe, Cookies as US, Token as lo, PensionCompany as Cs, SettingsLogic as n1, Role as FS, Translations as D, WebSiteUserRole as Xs, OData as oo, Dates as I, Texts as zs, ExportMethod as ma, Tables as co, TableFormat as Ey, JsonSchemaCache as yN, JsonSchemaUtils as Mr, SitemapVisibility as $a, Arrays as qt, Objects as ca, RoleLogic as Hc, EmploymentRelationTaxcard as Ta, TaxcardKind as ea, TaxCard2019Logic as ga, EmploymentLogic as ka, Numeric as jt, Payrolls as pv, CalculatorLogic as ya, InvoicesLogic as le, PaymentChannel as ot, InvoiceStatus as zt, LegalEntityType as ki, PayrollStatus as Ia, SalaryDateKind as xn, SalaryDateLogic as Lo, CalculationStatus as Jt, CalculationResultLogic as hv, Payrolls4 as xo, InvoiceType as ve, ReportsLogic as gf, AccountingReportTableType as Ry, PeriodType as Ii, CalcRowsLogic as $r, CalculationRowType as Wt, CalculationRowSource as ws, Years as Sr, OAuthSalaxyAuthorizeMode as zS, Language as Te, OnboardingLogic as BS, UsecaseStatus as vi, ApiItemType as Dn, StorageLogic as WS, AvatarPictureType as as, SystemRole as mv, HrSuuntiImportLogic as Hu, DataMapper as Zi, FileParser as gv, ValidationHelper as fN, Brand as wo, HouseholdUsecasesLogic as Zs, CalculationRowUnit as yf, UnionPaymentType as bN, BootstrapStyle as Ao, AbsenceCauseCode as Le, IncomeTypesLogic as Yn, IrRowSourceType as vN, Unit as Zn, ReportType as ol, HolidaysLogic as en, HolidayCode as ke, WageBasis as xi, HolidayPayCalculation as Oa, CostAccountingDimensionScope as cs, UserDefinedRowLogic as s1, RowsUsecaseLogic as Lc, EnumerationsLogic as We, Barcodes as Do, QrCodes as yv, BicHelper as fv, Iban as bv, MessageThreadStatus as Mp, MessageFrom as ts, ThreadedMessageType as Ba, ContactType as Os, ApiValidationErrorType as Aa, kevaEmploymentRegCodes as xN, HolidayBonusPaymentMethod as vp, PensionCalculation as Qs, Occupations as Co, DateTimes as ds, CellRenderingLogic as i1, Calculations as _p, DataMappersLogic as Io, Culture as r1, ImportBatch as wN, ExportLogic as AN, ApiImportStatus as kn, DataMapperSelector as l1, ApiCheckStatus as o1, WorktimeApiConnector as CN, InvoicePaymentType as $N, PaymentChannelApi as ff, Promises as SN, SharingUriType as ql, HouseholdYearProcessingStatus as kN, TaxDeductionWorkCategories as TN, TimesheetInputModification as Dc, PeriodDateKind as Rd, AccountingTargetLogic as LN, AccountingChannel as _s, irepr as _e, irpsr as Uu, DatasetStatus as jS, DatasetType as VS, PaidSickLeaveKind as $o, TrainingKind as So, NonProfitOrgKind as qS, OtherCompensationKind as bn, RemunerationKind as Kl, WorkingTimeCompensationKind as xs, EmploymentTerminationKind as vc, AllowanceCode as Fu, DailyAllowanceKind as xc, AccountantType as Jr, AccountingTargets as c1, EmploymentRelationType as Ny, FileLogic as zu, FileDelimiter as DN, SettingsStatus as KS, WorkerSalarySlipDeliveryMethod as rs, LocalTapiolaInsuranceOrderType as Yy, TranslationsInstance as Bu, FormHelpers as Uc, Country as d1, EmploymentRelationSalaryPaymentMethod as IN, Validation as tn, HolidayAccrualSource as Wu, AnnualLeavePaymentKind as PN, TaxCardIncomeType as kr, RecurringEventCreateMode as JS, CalendarActionType as Jl, ActionExecutor as bf, UsecaseActionType as EN, CustomerInvoices as RN, Absences as NN, Accounts as YN, AccountSettings as XN, AuthorizedAccounts as ON, BeneficialOwnersApi as MN, Calculator as _N, CalendarEvents as GN, Certificates as HN, Client as UN, Credentials as FN, Datasets as zN, Employments as BN, Files as WN, HolidayYears as jN, Imports as VN, Invoices as qN, IrEarningsPayments as KN, IrPayerSummaries as JN, MessageThreads as ZN, OAuth2 as QN, Onboardings as tY, Overview as eY, PartnerServices as aY, ProApi as nY, Records as sY, ReferenceObjects as iY, Reports as rY, Session as lY, Taxcards as oY, Test as cY, Usecases as dY, Workers as uY, ServiceModels as pY, HouseholdYears as hY } from "@salaxy/core"; import { TotalsReportConfigGenerator as u1, ESalaryMapper as mY, CalculationMapper as Wi, Templates as Tl, RowsReportConfigGenerator as ZS, IrRowsReportConfigGenerator as p1, InvoiceMapper as ju, AccountingMapper as Xy, SummaryMapper as ko, WorkerSummaryMapper as Oy } from "@salaxy/reports"; const nl = class nl { /** * Creates a new instance of AjaxNg1 * @param $http - Angular http * @param $q - Angular q * @param config - Optional config containing keys which override the corresponding global Config keys. */ constructor(t, e, a = null) { this.$http = t, this.$q = e, this.useCookie = !0, this.useCredentials = !1, this.serverAddress = "https://test-api.salaxy.com"; const n = xe.current; if (n || a) { const i = a?.apiServer ?? n.apiServer; i && (this.serverAddress = i); const r = a?.useCredentials ?? n.useCredentials; r != null && (this.useCredentials = r); const l = a?.useCookie ?? n.useCookie; l != null && (this.useCookie = l); } } /** * Gets the API address with version information. E.g. 'https://test-api.salaxy.com/v03/api'. * Default version, as of writing 2.0 */ getApiAddress() { return this.serverAddress + "/v03/api"; } /** Gets the Server address that is used as bases to the HTML queries. E.g. 'https://test-api.salaxy.com' */ getServerAddress() { return this.serverAddress; } /** * Gets a JSON-message from server using the API * @param method The API method is the url path after the api version segments (e.g. '/v03/api') * and starts with a forward slash, e.g. '/calculator/new'. * @returns A Promise with result data. Standard Promise rejection to be used for error handling. */ getJSON(t) { const e = {}, a = this.getCurrentToken(); return a && (e.headers = { Authorization: "Bearer " + a }), e.url = this.getUrl(t), e.method = "GET", e.responseType = "json", e.withCredentials = a ? !1 : this.useCredentials, this.$http(e).then( (n) => n.data, (n) => this.handleError(n) ); } /** * Gets a HTML-message from server using the API * @param method - The API method is the url path after the api version segments (e.g. '/v03/api') * and starts with a forward slash, e.g. '/calculator/new'. * @returns A Promise with result data. Standard Promise rejection to be used for error handling. */ getHTML(t) { const e = {}, a = this.getCurrentToken(); return a && (e.headers = { Authorization: "Bearer " + a }), e.url = this.getUrl(t), e.method = "GET", e.responseType = "text", e.withCredentials = a ? !1 : this.useCredentials, this.$http(e).then( (n) => n.data, (n) => this.handleError(n) ); } /** * POSTS data to server and receives back a JSON-message. * @param method - The API method is the url path after the api version segments (e.g. '/v03/api') * and starts with a forward slash, e.g. '/calculator/new'. * @param data - The data that is posted to the server. * @returns A Promise with result data. Standard Promise rejection to be used for error handling. */ postJSON(t, e) { const a = {}, n = this.getCurrentToken(); return n && (a.headers = { Authorization: "Bearer " + n }), a.url = this.getUrl(t), a.method = "POST", a.data = e, a.responseType = "json", a.withCredentials = n ? !1 : this.useCredentials, this.$http(a).then( (i) => i.data, (i) => this.handleError(i) ); } /** * POSTS data to server and receives back HTML. * @param method - The API method is the url path after the api version segments (e.g. '/v03/api') * and starts with a forward slash, e.g. '/calculator/new'. * @param data - The data that is posted to the server. * @returns A Promise with result data. Standard Promise rejection to be used for error handling. */ postHTML(t, e) { const a = {}, n = this.getCurrentToken(); return n && (a.headers = { Authorization: "Bearer " + n }), a.url = this.getUrl(t), a.method = "POST", a.data = e, a.responseType = "text", a.withCredentials = n ? !1 : this.useCredentials, this.$http(a).then( (i) => i.data, (i) => this.handleError(i) ); } /** * Sends a DELETE-message to server using the API * @param method - The API method is the url path after the api version segments (e.g. '/v03/api') * and starts with a forward slash, e.g. '/calculator/new'. * @returns A Promise with result data. Standard Promise rejection to be used for error handling. */ remove(t) { const e = {}, a = this.getCurrentToken(); return a && (e.headers = { Authorization: "Bearer " + a }), e.url = this.getUrl(t), e.method = "DELETE", e.responseType = "json", e.withCredentials = a ? !1 : this.useCredentials, this.$http(e).then( (n) => n.data, (n) => this.handleError(n) ); } /** * Gets the current token. * Will check the salaxy-token cookie if the token is persisted there */ getCurrentToken() { return !this.token && this.useCookie && (this.token = new US().get("salaxy-token") || ""), this.token; } /** Gets the status of the current token. */ getTokenStatus() { const t = this.getCurrentToken(); return lo.validate(t); } /** * Sets the current token. Persists it to cookie until the browser window * @param token - the authentication token to persist. */ setCurrentToken(t) { this.useCookie && new US().setCookie("salaxy-token", t || ""), this.token = t; } /** If missing, append the API server address to the given url method string */ getUrl(t) { return !t || t.trim() === "" ? null : t.toLowerCase().startsWith("http") ? t : t.toLowerCase().startsWith("/v") ? this.getServerAddress() + t : this.getApiAddress() + t; } handleError(t) { let e; if (t ? t.data && t.data.messageHtml ? e = `<b>${t.data.error}:</b><br/>${t.data.messageHtml}` : t.data && t.data.message ? e = t.data.message : e = `HTTP error: ${t.statusText} (${t.status})` : e = "Unexpected error in HTTP request", nl.alertService) { if (nl.alertService.catchError) return nl.alertService.catchError(t); nl.alertService.addError(e); } return this.$q.reject(t); } }; nl.$inject = ["$http", "$q"]; let Gp = nl; const Px = class Px { /** * Creates a new WizardController * @param $scope - The Angular scope * @param wizardService - Maintains the state of the wizard * @param data - Any data to the controller * @ignore */ constructor(t, e, a = null) { this.$scope = t, this.wizardService = e, this.data = a, this.colWidthClasses = ["col-sm-12", "col-sm-12", "col-sm-6", "col-sm-4", "col-sm-3", "col-sm-fifth", "col-sm-2"]; } /** * Implement IController */ $onInit() { } /** Gets all the steps in the Wizard */ get steps() { return this.wizardService.getSteps(); } /** Gets the number of the currently active step */ get step() { return this.wizardService.activeStepNumber; } /** Sets the number of the currently active step */ set step(t) { this.wizardService.activeStepNumber = t; } /** The currently selected step object */ get currentStep() { return this.wizardService.getCurrentStepObject(); } /** Active styling properties */ get style() { return { colWidthClass: this.colWidthClasses[this.steps.length] }; } /** Returns true if goNext is enabled */ get canGoNext() { return !!(this.steps.length > this.step && this.steps[this.step] && !this.steps[this.step].disabled); } /** Returns true if goNext is enabled */ get canGoPrevious() { return this.step > 1 && !this.steps[this.step - 2].disabled; } /** * Navigates to the next step if possible */ goNext() { this.canGoNext && this.step++; } /** Navigates to the previous step if possible */ goPrevious() { this.canGoPrevious && this.step--; } }; Px.$inject = ["$scope", "WizardService", "data"]; let si = Px; const Ex = class Ex extends si { constructor(t, e, a, n, i, r, l, o) { super(t, e, o), this.onboardingService = a, this.sessionService = n, this.authorizedAccountService = i, this.ajax = r, this.$location = l, this.isStepProceeding = !1, this.linkCopied = !1; } /** * Implement IController */ $onInit() { this.wizardService.setSteps(this.getWizardSteps()), this.model && this.model.company.resolvedId && this.model.signature.personalId != null ? this.wizardService.activeStepNumber = this.wizardService.getSteps().length : this.wizardService.activeStepNumber = 1; } /** Company wizard configuration */ getWizardSteps() { const t = []; return t.push( { title: "SALAXY.NG1.CustomerOnboardingComponent.stepUserInfo.title", heading: "", intro: "", view: "salaxy-components/modals/onboarding/customer/user.html", buttonsView: "salaxy-components/modals/onboarding/customer/user-buttons.html" }, { title: "SALAXY.NG1.CustomerOnboardingComponent.stepCompanyInfo.title", heading: "", intro: "", view: "salaxy-components/modals/onboarding/customer/company.html", buttonsView: "salaxy-components/modals/onboarding/customer/buttons.html" }, { title: "SALAXY.NG1.CustomerOnboardingComponent.stepCompanyLegal.title", heading: "", intro: "", view: "salaxy-components/modals/onboarding/customer/company-legal.html", buttonsView: "salaxy-components/modals/onboarding/customer/buttons.html" }, { title: "SALAXY.NG1.CustomerOnboardingComponent.stepInsurance.title", heading: "", intro: "", view: "salaxy-components/modals/onboarding/customer/insurance.html", buttonsView: "salaxy-components/modals/onboarding/customer/commit-buttons.html" }, { title: "SALAXY.NG1.CustomerOnboardingComponent.stepInviteCompany.title", heading: "", intro: "", view: "salaxy-components/modals/onboarding/customer/finish.html", buttonsView: "salaxy-components/modals/onboarding/customer/finish-buttons.html" } ), t; } /** * The onboarding model is provided by the onboarding service. * */ get model() { return this.onboardingService.model; } /** * Navigates to the next step if possible and saves the data. */ goNext() { this.isStepProceeding || (this.isStepProceeding = !0, this.save().then(() => { super.goNext(), this.isStepProceeding = !1; }).catch((t) => { this.isStepProceeding = !1; })); } /** * Navigates to the previous step if possible and saves the data. */ goPrevious() { this.isStepProceeding || (this.isStepProceeding = !0, this.save().then(() => { super.goPrevious(), this.isStepProceeding = !1; }).catch((t) => { this.isStepProceeding = !1; })); } /** Returns true if user can go forward in wizard */ get canGoNext() { return !!(this.steps.length > this.step && this.steps[this.step] && !this.steps[this.step].disabled && this.formDataValidity); } /** Sharing link for singing. */ get signingLink() { return this.model ? xe.current.wwwServer + "/share/signing/" + encodeURIComponent(this.model.owner) + "/" + this.model.id : ""; } /** Sharing link for authorization mail. */ get sharingLink() { return this.model ? xe.current.wwwServer + "/share/authorization/" + encodeURIComponent(this.model.owner) + "/" + this.model.id : ""; } /** Copies link to clipboard */ copyLink(t) { navigator.clipboard.writeText(t), this.linkCopied = !0; } /** Mailto-link with sharing link. */ get mailtoLink() { if (!this.model || !this.model.person) return ""; let t = "mailto:"; t += this.model.person.contact.email, t += "?subject=" + encodeURIComponent("Palkkaus.fi-palvelun valtakirjan allekirjoitus"); let e = "Hei " + this.model.person.firstName + " " + this.model.person.lastName + `, `; return e += "Olemme ottamassa käyttöön Palkkaus.fi-palvelun yrityksesi palkanmaksuun.", e += " Jotta he voivat hoitaa kaikki viranomaisvelvoitteet, tarvitaan allekirjoitus sinulta.", e += " Se hoituu helposti pankkitunnuksilla seuraamalla tätä linkkiä: ", e += this.sharingLink + `. `, e += `Ystävällisin terveisin, `, e += this.sessionService.getAvatar().displayName, t += "&body=" + encodeURIComponent(e), t; } /** * Existing company alert. */ get existingCompanyAlert() { const t = this.sessionService.session?.currentAccount?.id; return this.model?.company?.resolvedId && this.model.company.resolvedId != t; } /** * Proceeds to company selection in e-authorization service. */ goToCompanySelection() { this.model.company.doYtjUpdate = !0, this.goNext(); } /** Commit onboarding */ commit() { this.isStepProceeding || (this.isStepProceeding = !0, this.model.signature.email = this.model.person.contact.email, this.model.signature.telephone = this.model.person.contact.telephone, this.model.signature.personName = (this.model.person.firstName + " " + this.model.person.lastName).trim(), this.onboardingService.commit().then(() => { this.authorizedAccountService.reloadAuthorizingAccounts(), super.goNext(), this.isStepProceeding = !1; }).catch((t) => { this.isStepProceeding = !1; })); } /** Sets pension fields (defaults) after user input. */ checkPensionCompanySelection() { this.model.products.pension.isPensionContractDone || (this.model.products.pension.pensionCompany = Cs.None, this.model.products.pension.pensionContractNumber = null); const t = this.model.products.pension.pensionCompany; this.model.products.pension.isPensionContractDone && t === Cs.Varma && (this.model.products.pension.isPendingContract = !1), (t === Cs.Veritas || t === Cs.Apteekkien || t === Cs.Verso || t === Cs.Valio || (t ?? "").startsWith("keva") || t === Cs.Other) && (this.model.products.pension.isPensionSelfHandling = !0), this.model.products.pension.isPendingContract && (this.model.products.pension.isPensionSelfHandling = !1); } /** Sets insurance fields (defaults) after user input. */ checkInsuranceCompanySelection() { this.model.products.insurance.isInsuranceContractDone || (this.model.products.insurance.insuranceCompany = null, this.model.products.insurance.insuranceContractNumber = null); } /** * Saves the data to server */ save() { return this.onboardingService.save(); } /** * Sets the pension contract number as a test number according to the selected company. */ setPensionNumberForTest() { this.model.products.pension.pensionContractNumber = n1.getPensionNumberForTest(this.model.products.pension.pensionCompany); } /** * Launches the wizard. * @param accountId Optional account id. */ launch(t = null) { return this.onboardingService.launchCustomerOnboarding(t); } }; Ex.$inject = ["$scope", "WizardService", "OnboardingService", "SessionService", "AuthorizedAccountService", "AjaxNg1", "$location", "data"]; let vf = Ex; const Rx = class Rx extends si { constructor(t, e, a, n, i) { super(t, e), this.onboardingService = a, this.sessionService = n, this.uiHelpers = i, this.wizardSteps = [ { title: "SALAXY.NG1.WorkerOnboardingComponent.stepUserInfo.title", heading: "SALAXY.NG1.WorkerOnboardingComponent.stepUserInfo.heading", intro: "", active: !0, view: "salaxy-components/modals/onboarding/worker/user-info.html", buttonsView: "salaxy-components/modals/onboarding/worker/firstPageButtons.html" }, /* { title: "SALAXY.NG1.WorkerOnboardingComponent.stepPhoneNumberVerify.title", heading: "SALAXY.NG1.WorkerOnboardingComponent.stepPhoneNumberVerify.heading", intro: "SALAXY.NG1.WorkerOnboardingComponent.stepPhoneNumberVerify.intro", view: "salaxy-components/modals/onboarding/worker/phonenumber-verify.html", buttonsView: "salaxy-components/modals/onboarding/worker/phoneNumberVerifyButtons.html", }, */ { title: "SALAXY.NG1.WorkerOnboardingComponent.stepContract.stepTitle", heading: "SALAXY.NG1.WorkerOnboardingComponent.stepContract.heading", intro: "SALAXY.NG1.WorkerOnboardingComponent.stepContract.intro", view: "salaxy-components/modals/onboarding/worker/contract-worker.html", buttonsView: "salaxy-components/modals/onboarding/worker/contractButtons.html" } ], this.isStepProceeding = !1; } /** * Implement IController */ $onInit() { this.wizardService.setSteps(this.wizardSteps), this.wizardService.activeStepNumber = 1; } /** * Navigates to the next step if possible and saves the data. */ goNext() { return this.isStepProceeding ? Promise.resolve(!1) : (this.isStepProceeding = !0, this.save().then(() => (super.goNext(), this.isStepProceeding = !1, !0)).catch((t) => (this.isStepProceeding = !1, !1))); } /** Returns true if user can go forward in wizard */ get canGoNext() { return !!(this.steps.length > this.step && this.steps[this.step] && !this.steps[this.step].disabled && this.formDataValidity); } /** Runs a check function before going forward */ goNextIf(t) { t(() => this.goNext()); } /** * Navigates to the previous step if possible and saves the data. */ goPrevious() { this.isStepProceeding || (this.isStepProceeding = !0, this.save().then(() => { super.goPrevious(), this.isStepProceeding = !1; }).catch((t) => { this.isStepProceeding = !1; })); } /** * Saves the data to server */ save() { return this.model.signature.email = this.model.person.contact.email, this.model.signature.telephone = this.model.person.contact.telephone, this.model.signature.personName = (this.model.person.firstName + " " + this.model.person.lastName).trim(), this.onboardingService.save(); } /** * Returns signing url. */ get vismaSignUrl() { const t = this.model.signature.method; return this.onboardingService.getDigitalSignUrl(t); } /** * The onboarding model is provided by the onboarding service. */ get model() { return this.onboardingService.model; } /** Returns the PDF preview address for the authorization pdf. */ getPdfPreviewAddress() { return this.onboardingService.getPdfPreviewAddress(); } /** * Returns validation error for key if exists. * @param key - Validation error key. */ getValidationError(t) { return this.model && this.model.validation ? this.model.validation.errors.find((e) => e.key === t) : null; } /** * Resets validation error for key if exists. * @param key - Validation error key. */ removeValidationError(t) { this.model && this.model.validation && (this.model.validation.errors = this.model.validation.errors.filter((e) => e.key !== t)); } /** * Checks if the given string is other identifier than Finnish Personal Identification Number * @param ssn given social security number */ isOtherIdentifier(t) { return /^.{7}[9]/.test((t || "").trim()); } /** * Launches the wizard. * @param id Optional onboarding id. */ launch(t = null) { return this.onboardingService.launchWorkerOnboarding(t); } }; Rx.$inject = ["$scope", "WizardService", "OnboardingService", "SessionService", "UiHelpers"]; let xf = Rx; const Nx = class Nx extends si { constructor(t, e, a, n, i) { super(t, e, i), this.onboardingService = a, this.sessionService = n, this.wizardSteps = [ { title: "Käyttäjän tiedot", heading: "Tervetuloa, Palkkamyllyyn!", intro: `Palkkamyllyn tarjoaa Rakennusliitto ry, joka toimii henkilötietojen käsittelijänä ja vastaa myös asiakaspalvelusta. Palvelun tuottajana, teknisenä toteuttajana ja myös henkilötietojen käsittelijä toimii Suomen Palkanlaskenta Oy (Palkkaus.fi).`, active: !0, view: "salaxy-components/modals/onboarding/household/wizard_index.html", buttonsView: "salaxy-components/modals/onboarding/household/firstPageButtons.html" }, /* { title: "Puhelinnumero", heading: "Puhelinnumero", intro: "Puhelinnumeroa tarvitsemme yhteydenpitoa varten. Jos rekisteröit Siirto-palvelussa olevan puhelinnumeron, voit maksaa ja vastaanottaa palkkoja mobiilimaksuilla. Vahvistamme antamasi numeron.", view: "salaxy-components/modals/onboarding/household/phoneNumber.html", buttonsView: "salaxy-components/modals/onboarding/household/phoneNumberButtons.html", }, { title: "Puhelinnumeron vahvistaminen", heading: "Puhelinnumeron vahvistaminen", intro: "Olemme lähettäneet sinulle SMS-viestin varmistaaksemme numerosi. Syötä viestissä oleva vahvistuskoodi tähän.", view: "salaxy-components/modals/onboarding/household/phoneNumberVerify.html", buttonsView: "salaxy-components/modals/onboarding/household/phoneNumberVerifyButtons.html", }, */ { title: "Palkanmaksun tiedot", heading: "Palkanmaksun tiedot", view: "salaxy-components/modals/onboarding/household/household.html", buttonsView: "salaxy-components/modals/onboarding/household/householdButtons.html" }, { title: "Palvelusopimus", heading: "Palvelusopimus ja valtuutus", view: "salaxy-components/modals/onboarding/household/contract.html", buttonsView: "salaxy-components/modals/onboarding/household/contractButtons.html" } ], this.isStepProceeding = !1; } /** * Implement IController */ $onInit() { this.wizardService.setSteps(this.wizardSteps), this.wizardService.activeStepNumber = 1; } /** * Navigates to the next step if possible and saves the data. */ goNext() { return this.isStepProceeding ? Promise.resolve(!1) : (this.isStepProceeding = !0, this.save().then(() => (super.goNext(), this.isStepProceeding = !1, !0)).catch((t) => (this.isStepProceeding = !1, !1))); } /** Returns true if user can go forward in wizard */ get canGoNext() { return !!(this.steps.length > this.step && this.steps[this.step] && !this.steps[this.step].disabled && this.formDataValidity); } /** Runs a check function before going forward */ goNextIf(t) { t(() => this.goNext()); } /** * Navigates to the previous step if possible and saves the data. */ goPrevious() { this.isStepProceeding || (this.isStepProceeding = !0, this.save().then(() => { super.goPrevious(), this.isStepProceeding = !1; }).catch((t) => { this.isStepProceeding = !1; })); } /** * Saves the data to server */ save() { return this.model.signature.email = this.model.person.contact.email, this.model.signature.telephone = this.model.person.contact.telephone, this.model.signature.personName = (this.model.person.firstName + " " + this.model.person.lastName).trim(), this.onboardingService.save(); } /** * Returns signing url. */ get vismaSignUrl() { const t = this.model.signature.method; return this.onboardingService.getDigitalSignUrl(t); } /** * The onboarding model is provided by the onboarding service. */ get model() { return this.onboardingService.model; } /** Returns the PDF preview address for the authorization pdf. */ getPdfPreviewAddress() { return this.onboardingService.getPdfPreviewAddress(); } /** * Returns validation error for key if exists. * @param key - Validation error key. */ getValidationError(t) { return this.model && this.model.validation ? this.model.validation.errors.find((e) => e.key === t) : null; } /** * Resets validation error for key if exists. * @param key - Validation error key. */ removeValidationError(t) { this.model && this.model.validation && (this.model.validation.errors = this.model.validation.errors.filter((e) => e.key !== t)); } /** * Launches the wizard. * @param id Optional onboarding id. */ launch(t = null) { return this.onboardingService.launchHouseholdOnboarding(t); } }; Nx.$inject = ["$scope", "WizardService", "OnboardingService", "SessionService", "data"]; let wf = Nx; const Yx = class Yx extends si { constructor(t, e, a, n, i, r, l, o) { super(t, e, l), this.onboardingService = a, this.sessionService = n, this.ajax = i, this.$location = r, this.uiHelpers = o, this.isStepProceeding = !1; } /** * Implement IController */ $onInit() { this.wizardService.setSteps(this.getWizardSteps()), this.model && this.model.signature.isProcura ? this.wizardService.activeStepNumber = 3 : this.wizardService.activeStepNumber = 1; } /** Company wizard configuration */ getWizardSteps() { const t = []; return t.push( { title: "SALAXY.NG1.CompanyOnboardingComponent.step1.title", intro: "SALAXY.NG1.CompanyOnboardingComponent.step1.intro", active: !0, view: "salaxy-components/modals/onboarding/company/wizard_index.html", buttonsView: "salaxy-components/modals/onboarding/company/firstPageButtons.html" } ), this.showCompanySelection && t.push( { title: "SALAXY.NG1.CompanyOnboardingComponent.stepSuomiFi.title", intro: "SALAXY.NG1.CompanyOnboardingComponent.stepSuomiFi.intro", view: "salaxy-components/modals/onboarding/company/suomifi.html", buttonsView: "salaxy-components/modals/onboarding/company/suomifiButtons.html" } ), t.push( { title: "SALAXY.NG1.CompanyOnboardingComponent.stepCompanyInfo.title", intro: "SALAXY.NG1.CompanyOnboardingComponent.stepCompanyInfo.intro", view: "salaxy-components/modals/onboarding/company/company.html", buttonsView: "salaxy-components/modals/onboarding/company/defaultWizardButtons.html" }, /* { title: "SALAXY.NG1.CompanyOnboardingComponent.stepCompanyLegal.title", view: "salaxy-components/modals/onboarding/company/company-legal.html", buttonsView: "salaxy-components/modals/onboarding/company/defaultWizardButtons.html", }, */ { title: "SALAXY.NG1.CompanyOnboardingComponent.stepContract.title", view: "salaxy-components/modals/onboarding/company/contract.html", buttonsView: "salaxy-components/modals/onboarding/company/contractButtons.html" } ), t; } /** * Navigates to the next step if possible and saves the data. */ goNext() { return this.isStepProceeding ? Promise.resolve(!1) : (this.isStepProceeding = !0, this.save().then(() => (super.goNext(), this.isStepProceeding = !1, !0)).catch((t) => (this.isStepProceeding = !1, !1))); } /** Returns true if user can go forward in wizard */ get canGoNext() { return !!(this.steps.length > this.step && this.steps[this.step] && !this.steps[this.step].disabled && this.formDataValidity); } /** * Navigates to the previous step if possible and saves the data. */ goPrevious() { this.isStepProceeding || (this.isStepProceeding = !0, this.save().then(() => { super.goPrevious(), this.isStepProceeding = !1; }).catch((t) => { this.isStepProceeding = !1; })); } /** * Saves the data to server */ save() { return this.model.signature.email = this.model.person.contact.email, this.model.signature.telephone = this.model.person.contact.telephone, this.model.signature.personName = (this.model.person.firstName + " " + this.model.person.lastName).trim(), this.onboardingService.save(); } /** * Returns signing url. */ get vismaSignUrl() { return this.onboardingService.getDigitalSignUrl(); } /** * The onboarding model is provided by the onboarding service. */ get model() { return this.onboardingService.model; } /** IF true, the Suomi.fi company selection is used. */ get showCompanySelection() { return this.model && this.model.company && this.model.company.roles && this.model.company.roles.some((e) => e === FS.Accountant || e === FS.AccountantCandidate); } /** Returns the PDF preview address for the authorization pdf. */ getPdfPreviewAddress() { return this.onboardingService.getPdfPreviewAddress(); } /** * Existing company alert. */ get existingCompanyAlert() { const t = this.sessionService.session?.currentAccount?.id; return this.model?.company?.resolvedId && this.model.company.resolvedId != t; } /** Go to suomi fi ypa */ goToSuomifi() { const t = this.$location.url(); let e = this.$location.absUrl(); t.length > 1 && (e = e.substring(0, e.indexOf(t))), e = e.replace(/\/$/, "").trim(); const a = this.ajax.getCurrentToken(), n = a ? `${encodeURIComponent(a)}` : "", i = e.indexOf("&") >= 0 || e.indexOf("?") >= 0 ? "&url=" : "", r = `${e}${i}/onboarding/company/${this.model.id}${n ? "&ob_token=" + n : ""}`, l = `${e}${i}/onboarding/company/${this.model.id}${n ? "&ob_token=" + n : ""}`; this.save().then(() => { window.location.assign(`${this.ajax.getServerAddress()}/Onboarding/CompanySelection?OnboardingId=${encodeURIComponent(this.model.id)}&Language=${encodeURIComponent(D.getLanguage())}&SuccessUrl=${encodeURIComponent(l)}&CancelUrl=${encodeURIComponent(r)}${n ? "&access_token=" + n : ""}`); }); } /** * Launches the wizard. * @param id Optional onboarding id. */ launch(t = null) { return this.onboardingService.launchCompanyOnboarding(t); } /** * Sets the company's business id, clears the YTJ search results fetches other company info's via YTJ search and saves * @param businessId The business id that is set as the company's business id */ chooseBusinessId(t) { this.model.company.businessId = t, this.model.company.ytjSearch = null, this.searchYtj(); } /** * Sets the DoYtjUpdate flag to true and saves. * @param searchType - If true, sets the business ID to null * Use this option to force a YTJ name search, even if there already is something written in business ID field. */ searchYtj(t) { this.model.company.companyType = null, this.model.company.contact.street = null, this.model.company.contact.city = null, this.model.company.contact.postalCode = null, this.model.company.ytjSearch = null, this.model.company.doYtjUpdate = !0, t === "name" && (this.model.company.businessId = null), t === "businessId" && (this.model.company.name = null), this.save(); } /** * Returns validation error for key if exists. * @param key - Validation error key. */ getValidationError(t) { return this.model && this.model.validation ? this.model.validation.errors.find((e) => e.key === t) : null; } /** Opens wizard as modal dialog */ openSigningWizardDialog(t = null) { const e = this.sessionService.getCurrentCss(), a = this.sessionService.getOrigin(), n = a + (e ? `popup.html#settings/signing?skin=${e}&lang=${D.getLanguage()}&id=${this.onboardingService.model?.id ?? ""}#access_token=${this.ajax.getCurrentToken()}` : `popup.html#settings/signing?lang=${D.getLanguage()}&id=${this.onboardingService.model?.id ?? ""}#access_token=${this.ajax.getCurrentToken()}`); return this.uiHelpers.showExternalDialog(t, n, { id: t, origin: a }, { width: 1080, height: 800 }).then((i) => { if (i?.action != "cancel") return this.checkSession(); }); } /** Launches company wizard. */ launchSigningWizard() { const t = this.readTokenFromUrl(this.$location.absUrl(), "data="), e = JSON.parse(atob(decodeURIComponent(t)))?.id, a = JSON.parse(atob(decodeURIComponent(t)))?.origin; return this.onboardingService.getOnboardingData(e).then(() => { const n = this.sessionService.getCurrentCss(); return this.onboardingService.model.ui.successUrl = a + (n ? `popup.html#settings/signing-success?skin=${n}&lang=${D.getLanguage()}&id=${this.onboardingService.model?.id ?? ""}#access_token=${this.ajax.getCurrentToken()}` : `popup.html#settings/signing-success?lang=${D.getLanguage()}&id=${this.onboardingService.model?.id ?? ""}#access_token=${this.ajax.getCurrentToken()}`), this.onboardingService.model.ui.cancelUrl = this.onboardingService.model.ui.successUrl.replace("/signing-success?", "/signing-cancel?"), this.onboardingService.save().then(() => this.onboardingService.launchCompanyOnboarding(this.onboardingService.model.id)); }); } /** Reloads the current session*/ checkSession() { return this.sessionService.checkSession(); } readTokenFromUrl(t, e) { const a = t.toLowerCase().indexOf(e); if (a >= 0) { const n = t.indexOf("&", a); return n >= 0 ? t.substring(a + e.length, n) : t.substring(a + e.length); } return null; } }; Yx.$inject = ["$scope", "WizardService", "OnboardingService", "SessionService", "AjaxNg1", "$location", "data", "UiHelpers"]; let Af = Yx; const Xx = class Xx { constructor(t, e, a, n, i, r, l, o) { this.$scope = t, this.onboardingService = e, this.sessionService = a, this.signatureService = n, this.$sce = i, this.uiHelpers = r, this.ajax = l, this.$timeout = o, this.showInPopup = !1, this.isSigninStarted = !1, this.$onInit = () => { this.init(), this.sessionService.subscribe(this.$scope, () => { this.init(); }), this.isContactPersonSigner = !0; }; } /** Saves the current onboarding model. */ save() { return this.isContactPersonSigner && (this.model.company.contact.email = this.model.signature.email, this.model.company.contact.telephone = this.model.signature.telephone), this.onboardingService.save().then((t) => (this.pdfPreviewUrl = null, t)); } /** * The onboarding model is provided by the onboarding service. */ get model() { return this.onboardingService.model?.company && (this.onboardingService.model.company.language = D.getLanguage()), this.onboardingService.model?.person && (this.onboardingService.model.person.language = D.getLanguage()), this.onboardingService.model; } /** Returns the PDF preview address for the authorization pdf. */ getPdfPreviewAddress() { return !this.pdfPreviewUrl && this.model?.id && (this.pdfPreviewUrl = this.$sce.trustAsResourceUrl(this.onboardingService.getPdfPreviewAddress(!0) + "&t=" + (/* @__PURE__ */ new Date()).getTime() + "&language=" + this.model.company.language)), this.pdfPreviewUrl; } /** * Starts Visma sign * If this.showInPopup is false, saves the model and starts the signature. * If this.showInPopup is true, saves the model, starts the signature and then opens success dialog. * @param authMethod Method of authentication (bank selection). * Only used for Persons (Telia methods), ignored for companies. */ startDigitalSignature(t) { this.isSigninStarted = !0, this.showInPopup ? this.save().then(() => { let e = this.sessionService.getCurrentCss() || ""; e && (e = `skin=${e}&`); const a = this.sessionService.getOrigin() + `popup.html#settings/signing-success?${e}lang=${D.getLanguage()}&id=${this.onboardingService.model?.id ?? ""}#access_token=${this.ajax.getCurrentToken()}`, n = this.onboardingService.getDigitalSignUrl(t, null, null, a, a.replace("/signing-success?", "/signing-cancel?")); return this.$timeout(() => this.isSigninStarted = !1, 2e3), this.uiHelpers.showExternalDialog("vismaSignPopup", n, {}, { width: 1080, height: 800 }).then((i) => { if (i?.action != "cancel") return this.sessionService.checkSession(); }); }) : (this.uiHelpers.showLoading("SALAXY.NG1.SigningComponent.dialog.header", `Siirrytään allekirjoitukseen (${t})`), this.save().then(() => { window.top.location.href = this.onboardingService.getDigitalSignUrl(t); })); } /** List of supported Signature methods */ get methods() { return this.signatureService.getMethods(); } /** * Returns the SignatureMethod for given value. * @param value - value for SignatureMethod, e.g. tupas-nordea. */ getMethod(t) { const e = this.methods.filter((a) => a.value === t); return e.length > 0 ? e[0] : null; } init() { if (this.isSigningOk = this.sessionService.isSigningOk(), this.pdfPreviewUrl = null, this.isSigningRequired = !this.sessionService.isSigningOk(), this.sessionService.isSessionChecked && this.sessionService.isAuthenticated) { const t = this.sessionService.session.currentAccount.id; if (this.onboardingService.model && this.onboardingService.model.company.resolvedId === t) return; this.onboardingService.model = null, this.onboardingService.id = null, this.onboardingService.getOnboardingDataForAccount(this.sessionService.session.currentAccount.id).then(() => { if (this.onboardingService.model) { this.onboardingService.model.signature.isPep = null, this.onboardingService.model.company.ownership.isRequiredTracking = null, this.onboardingService.model.id || this.onboardingService.save(); return; } else this.onboardingService.model = { accountType: Xs.Company, signature: {} }, this.onboardingService.save(); }); } } }; Xx.$inject = ["$scope", "OnboardingService", "SessionService", "SignatureService", "$sce", "UiHelpers", "AjaxNg1", "$timeout"]; let Hp = Xx; const Ox = class Ox { /** * Creates a new SignatureController * @param signatureService - Service that handles the communication to the server * @ignore */ constructor(t) { this.signatureService = t, this.$onInit = () => { }; } /** * Legacy list of supported Visma Sign Signature methods. */ get methods() { return this.getMethods("tupas"); } /** * List of supported Signature methods * @param methodGroup - Method group "telia" for Telia Tunnistus and "tupas" for Visma Sign. Default is "tupas". */ getMethods(t = "tupas") { return this.signatureService.getMethods(t); } /** * Returns the SignatureMethod for given value. * @param value - value for SignatureMethod, e.g. tupas-nordea. */ getMethod(t) { return this.signatureService.getMethods("tupas").find((e) => e.value === t) ?? this.signatureService.getMethods("telia").find((e) => e.value === t); } }; Ox.$inject = [ "SignatureService" ]; let Cf = Ox; const Mx = class Mx { /** * Creates a new CrudControllerBase. * @param crudService The the BaseService instance that is used for communicating to server. * @param $location Angular.js Location service that is used for navigation. Especially the list views. * @param $attrs Angular.js Attisbutes for determining whether events have been bound to. * @param uiHelpers - Salaxy ui helpers service. */ constructor(t, e, a, n) { if (this.crudService = t, this.$location = e, this.$attrs = a, this.uiHelpers = n, this.copyIdAsNew = (i) => { const r = this.list.find((l) => l.id === i); return r ? this.copyAsNew(r) : null; }, this.listSelect = (i) => { this.$attrs.onListSelect ? this.onListSelect({ item: i }) : this.detailsUrl ? this.$location.url(this.detailsUrl + (i.id || i.rowIndex)) : this.setCurrent(i); }, this.listSelectId = (i) => { const r = this.list.find((l) => l.id === i); r && this.listSelect(r); }, this.delete = (i, r) => this.uiHelpers.showConfirm(r || "SALAXY.NG1.ApiCrudObjectComponent.deleteDialog").then((l) => l ? this.$attrs.onDelete ? this.onDelete({ deleteResult: this.deleteNoConfirm(i) }) : (this.listUrl && this.$location.url(this.listUrl), this.deleteNoConfirm(i)) : Promise.resolve(!1)), !t) throw new Error("crudService is undefined in CrudControllerBase"); if (!e) throw new Error("$location is undefined in CrudControllerBase"); if (!n) throw new Error("uiHelpers is undefined in CrudControllerBase"); if (!a) throw new Error("$attrs is undefined in CrudControllerBase"); } /** * Implement IController by providing onInit method. * We currently do nothing here, but if you override this function, * you should call this method in base class for future compatibility. */ $onInit() { } /** Gets the Current selected item. */ get current() { return this.getBindingMode() === "model" ? this.model.$viewValue : this.crudService.current; } /** Gets the list of all CRUD objects listed. */ get list() { return this.crudService.list; } /** * Creates a new item. The item is not saved in this process yet. * Item is set as current unless onCreateNew is specified => Then you are responsible for doing it yourself. * If detailsUrl is specified, the browser is redirectedted there. * Current item is set also in this case (as opposed to listSelect) because the new item does not yet have an id * and passing it in current item is the only way using router. * Use onCreateNew event or crudService.getBlank() if you do not want to set the current item. * @param newItem Specify the new item if you want to initialize it with specific values. * In most cases, you should let the system create it with defaults. */ createNew(t = null) { return t || (t = this.crudService.getBlank()), this.$attrs.onCreateNew ? this.onCreateNew({ item: t }) : (this.setCurrent(t), this.detailsUrl && this.$location.url(this.detailsUrl + "new#" + (/* @__PURE__ */ new Date()).getTime())), t; } /** Copies the current item and sets it as the new current */ copyCurrent() { this.current && this.setCurrent(this.crudService.copyAsNew(this.current)); } /** * Creates a copy of a given item and sets it as current * unless onCreateNew is specified => Then you are responsible for doing it yourself. * If detailsUrl is specified, the browser is redirectedted there. * Current item is set also in this case (as opposed to listSelect) because the new item does not yet have an id * and passing it in current item is the only way using router. * Use onCreateNew event or crudService.copyAsNew() if you do not want to set the current item. * @param copySource The item to copy as new. * @returns The new item that is created. */ copyAsNew(t) { const e = this.crudService.copyAsNew(t); return this.createNew(e); } /** * Mode for data binding is "singleton" by default. * This means that this.current is bound to crudService.current. * If ng-model is defined for the component (this.ngModelController), * this.current is bound to ngModelController view value (as with form controls). */ getBindingMode() { return this.model ? "model" : "singleton"; } /** Saves the current item. */ saveCurrent() { return this.crudService.saveCurrent(); } /** * Sets the current item: Either to ng-model view value or crudService.setCurrent(). * @param item The item to set as Current. */ setCurrent(t) { this.getBindingMode() === "model" ? this.model.$setViewValue(t) : this.crudService.setCurrent(t); } /** * Deletes an item without showing the confirm dialog. * The method shows the "Please wait..." loader, but does not call onDelete * or move the browser to listUrl. The caller should take care * of the UX actions after delete if necessary. * @param id Identifier of the item to be deleted. * @returns Promise that resolves to true (never false). Fails if the deletion fails. */ deleteNoConfirm(t) { const e = this.uiHelpers.showLoading("SALAXY.UI_Terms.wait"); return this.crudService.delete(t).then(() => (e.dismiss(), !0)); } }; Mx.crudBindings = { /** * Function that is called when user selects an item in the list. * The selected item is the parameter of the function call. * @example <salaxy-payroll-list on-list-select="$ctrl.myCustomSelectFunc(item)"></salaxy-payroll-list> */ onListSelect: "&", /** * Function that is called when an item is deleted. * The event is intended for user interface logic after delete (promise resolve) * and potentially when waiting for server to respond (from function call until promise resolve). * It is not meant for delete validation and/or for preventing deletion. * If onDelete is not specified, the browser is redirected to listUrl if specified. * @example <salaxy-payroll-list on-delete="$ctrl.resetUiAfterDeleteFunc"></salaxy-payroll-list> */ onDelete: "&", /** * Function that is called after a new item has been created. * At this point, the item has been created, but not yet selected as current. * If onCreateNew is not specified the browser is redirected to detailsUrl if specified and if not, only current item is set. * @example <salaxy-payroll-list on-create-new="$ctrl.startMyCustomWizardFunc"></salaxy-payroll-list> */ onCreateNew: "&", /** * URL to which the component navigates when an item is clicked. * The "id" or "rowIndex" property of the selected item is added to the URL. * URL is ignored if onListSelect is set. In this case, you may navigate yourself in that method. * @example <salaxy-payroll-list details-url="/myCustomRoute/"></salaxy-payroll-list> */ detailsUrl: "@", /** * URL for the list view. At the moment, if specified, the browser is redirected here after delete. * @example * <!-- Main worker list is in the front page in this case --> * <salaxy-employment-details list-url="/home"></salaxy-employment-details> */ listUrl: "@" }; let Po = Mx; const _x = class _x extends Po { constructor(t, e, a, n, i, r) { super(t, e, a, n), this.authorizedAccountService = t, this.sessionService = i, this.ajax = r; } /** * Returns the list of Integration partner sites available and the status of each