Compare commits
59 Commits
c43f1caed8
...
master
Author | SHA1 | Date |
---|---|---|
Dmitriev Alexander | a9d9a93ed0 | 1 year ago |
Suhorukov | eda7177716 | 1 year ago |
Sipachev Igor | f8ddeedf9d | 2 years ago |
Valkov Dmitry | 886440a0c6 | 2 years ago |
Valkov Dmitry | 85901209dd | 2 years ago |
Suhorukov | eb7bd0067a | 2 years ago |
Suhorukov | 79cb7feec9 | 2 years ago |
Sipachev Igor | 2153296023 | 3 years ago |
Sipachev Igor | 36922eb4b7 | 3 years ago |
Sipachev Igor | bae8e6fbe6 | 3 years ago |
Sipachev Igor | 20d89cbb0e | 3 years ago |
Sipachev Igor | 6bb6835145 | 3 years ago |
Sipachev Igor | d4a7dbeb08 | 3 years ago |
Sipachev Igor | a6bdaac2ef | 3 years ago |
Sipachev Igor | a254fc7b7d | 3 years ago |
Sipachev Igor | d902bbc872 | 3 years ago |
Sipachev Igor | febf87c5fb | 3 years ago |
Sipachev Igor | 668a0bc20e | 3 years ago |
Sipachev Igor | 10da8bb075 | 3 years ago |
Sipachev Igor | 8b8c0d64f4 | 3 years ago |
Sipachev Igor | 576dfd3c5d | 3 years ago |
Sipachev Igor | 5672773345 | 3 years ago |
Sipachev Igor | f2fcce4646 | 3 years ago |
Sipachev Igor | 93e78e2b77 | 3 years ago |
Sipachev Igor | 0ebbee5e23 | 3 years ago |
Sipachev Igor | e7ada8774d | 3 years ago |
Sipachev Igor | efaca5ca2c | 3 years ago |
Sipachev Igor | 338258a753 | 3 years ago |
Sipachev Igor | bc356f6cfa | 3 years ago |
Sipachev Igor | 1146bf8f3b | 3 years ago |
Sipachev Igor | e5c055cdc2 | 3 years ago |
Sipachev Igor | 3658044216 | 3 years ago |
Sipachev Igor | 6e5b768904 | 3 years ago |
Sipachev Igor | 46172dace0 | 3 years ago |
Sipachev Igor | b2c297a7fd | 3 years ago |
Sipachev Igor | 3411794a08 | 3 years ago |
Sipachev Igor | 4e7a1adf56 | 3 years ago |
Sipachev Igor | 00e81a8f49 | 3 years ago |
Sipachev Igor | c9c12a3d02 | 3 years ago |
Sipachev Igor | bd7f1e436e | 3 years ago |
Sipachev Igor | 420eb3973b | 3 years ago |
Sipachev Igor | 97bb8653d1 | 3 years ago |
Sipachev Igor | 993caaea23 | 3 years ago |
Sipachev Igor | 4a3a8c430c | 3 years ago |
Sipachev Igor | 28555b58a3 | 3 years ago |
Sipachev Igor | b89b96ebbe | 3 years ago |
Sipachev Igor | 77408cdb73 | 3 years ago |
Sipachev Igor | ae75816951 | 3 years ago |
Sipachev Igor | 2c0d4ba69a | 3 years ago |
Sipachev Igor | 47c51fb5fa | 3 years ago |
Sipachev Igor | 5461b2241b | 3 years ago |
Sipachev Igor | b83319aa26 | 3 years ago |
Sipachev Igor | 43339e6a92 | 3 years ago |
Sipachev Igor | 5b0960da0c | 3 years ago |
Sipachev Igor | ea4fcae1b9 | 3 years ago |
Sipachev Igor | 6b45516d94 | 3 years ago |
Sipachev Igor | b6e5d9199c | 3 years ago |
Sipachev Igor | 1fec9d9408 | 3 years ago |
Sipachev Igor | e427e02098 | 3 years ago |
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@ |
||||
.container[data-v-5e51ebac]{max-width:400px;min-width:400px;border:2px solid grey}.container .wrapper[data-v-5e51ebac]{padding:10px}.container .wrapper .tab-panel[data-v-5e51ebac]{display:flex}.container .wrapper .tab-panel__item[data-v-5e51ebac]{flex-grow:1;padding:5px;cursor:pointer;border-bottom:2px solid #cae5fa}.container .wrapper .tab-panel__item[data-v-5e51ebac]:hover,.container .wrapper .tab-panel__item_active[data-v-5e51ebac]{border-bottom:2px solid #298df8}.container .wrapper .tab-page[data-v-5e51ebac]{padding-top:10px}.container .wrapper .tab-page__item[data-v-5e51ebac]{display:none}.container .wrapper .tab-page__item_show[data-v-5e51ebac]{display:block}.container .wrapper .tab-page__item .form-row[data-v-5e51ebac]{display:flex;margin-bottom:5px}.container .wrapper .tab-page__item .form-row__item[data-v-5e51ebac]{flex-grow:1;margin-right:10px}.container .wrapper .tab-page__item .form-row__item-input[data-v-5e51ebac]{width:100%}.container .wrapper .tab-page__item .form-row[data-v-5e51ebac]:last-child{margin-bottom:0}.container .wrapper .memory-panel[data-v-5e51ebac]{text-align:left;padding:5px;margin-top:10px}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}body{margin:0} |
@ -1 +1 @@ |
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.95f2e473.css" rel="preload" as="style"><link href="/popup/dist/js/app.9bdde6bd.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.49bbd58a.js" rel="preload" as="script"><link href="/popup/dist/css/app.95f2e473.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.49bbd58a.js"></script><script src="/popup/dist/js/app.9bdde6bd.js"></script></body></html> |
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.34e76007.css" rel="preload" as="style"><link href="/popup/dist/js/app.d8c86962.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.d437ab16.js" rel="preload" as="script"><link href="/popup/dist/css/app.34e76007.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.d437ab16.js"></script><script src="/popup/dist/js/app.d8c86962.js"></script></body></html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,26 +0,0 @@ |
||||
self.__precacheManifest = (self.__precacheManifest || []).concat([ |
||||
{ |
||||
"revision": "9f7cc03f956475eec94c", |
||||
"url": "/css/app.95f2e473.css" |
||||
}, |
||||
{ |
||||
"revision": "117c3b5969bea3eacecac9b36d7196ef", |
||||
"url": "/index.html" |
||||
}, |
||||
{ |
||||
"revision": "9f7cc03f956475eec94c", |
||||
"url": "/js/app.9bdde6bd.js" |
||||
}, |
||||
{ |
||||
"revision": "55fa3e18a2c5425a215c", |
||||
"url": "/js/chunk-vendors.49bbd58a.js" |
||||
}, |
||||
{ |
||||
"revision": "b7d7baa709e9512123d49c9e80d3b21f", |
||||
"url": "/manifest.json" |
||||
}, |
||||
{ |
||||
"revision": "b6216d61c03e6ce0c9aea6ca7808f7ca", |
||||
"url": "/robots.txt" |
||||
} |
||||
]); |
@ -0,0 +1,40 @@ |
||||
import { Country } from '@/classes/Enum/Country' |
||||
|
||||
export class CountryResolver { |
||||
resolve (): Promise<Country> { |
||||
const promise = new Promise((resolve) => { |
||||
if (typeof chrome.tabs === 'undefined') { |
||||
const country = this.grabCountry(location.href || '') |
||||
resolve(country) |
||||
return |
||||
} |
||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { |
||||
for (const tab of tabs) { |
||||
const country = this.grabCountry(tab.url || '') |
||||
resolve(country) |
||||
return |
||||
} |
||||
}) |
||||
}) |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
return promise.then((country) => { |
||||
console.log('country', country) |
||||
return country |
||||
}) |
||||
} |
||||
|
||||
grabCountry (url: string): Country { |
||||
const isNordecum = url.indexOf('smspinigai') > -1 || |
||||
url.indexOf('paskolos') > -1 || |
||||
url.indexOf('nordecum') > -1 |
||||
|
||||
if (isNordecum) { |
||||
return Country.LITHUANIA |
||||
} |
||||
|
||||
return Country.ESTONIA |
||||
} |
||||
} |
||||
|
||||
export default new CountryResolver() |
@ -0,0 +1,54 @@ |
||||
export class DomainResolver { |
||||
resolve (): Promise<string> { |
||||
const promise = new Promise((resolve) => { |
||||
if (typeof chrome.tabs === 'undefined') { |
||||
const url = this.grabTargetUrl(location.href || '') |
||||
resolve(url) |
||||
return |
||||
} |
||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { |
||||
for (const tab of tabs) { |
||||
const url = this.grabTargetUrl(tab.url || '') |
||||
resolve(url) |
||||
return |
||||
} |
||||
}) |
||||
}) |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
return promise.then((url) => { |
||||
console.log('url', url) |
||||
return url |
||||
}) |
||||
} |
||||
|
||||
grabTargetUrl (url: string): string | null { |
||||
if (url.indexOf('localhost') > -1) { |
||||
return null |
||||
} |
||||
|
||||
const parts = url.match(/http:\/\/.*?\.(.*?)\..*?/) || [] |
||||
const nickname = parts[1] || null |
||||
|
||||
const isNordecum = url.indexOf('smspinigai') > -1 || |
||||
url.indexOf('paskolos') > -1 || |
||||
url.indexOf('nordecum') > -1 |
||||
|
||||
const project = isNordecum ? 'nordecum' : 'placetgroup' |
||||
const tld = isNordecum ? 'lt' : 'com' |
||||
const isLocal = url.indexOf('.sv') !== -1 |
||||
|
||||
if (isLocal && !nickname) { |
||||
return null |
||||
} |
||||
|
||||
url = isLocal |
||||
? 'http://' + project + '.' + nickname + '.sv' |
||||
: 'https://dev.' + project + '.' + tld |
||||
|
||||
console.log('domain_resolver', parts, nickname, isNordecum, project, tld, url) |
||||
return url |
||||
} |
||||
} |
||||
|
||||
export default new DomainResolver() |
@ -0,0 +1,11 @@ |
||||
import { RequestHandler, RequestInterface } from '@/api/HttpClient' |
||||
|
||||
export class TokenRequestHandler extends RequestHandler { |
||||
handle = (request: RequestInterface): void => { |
||||
request.headers = request.headers || {} |
||||
request.headers['x-plugin-token'] = 'GxwGRM' |
||||
console.log(request, 'DeviceIdHandler') |
||||
} |
||||
} |
||||
|
||||
export default new TokenRequestHandler() |
@ -0,0 +1,123 @@ |
||||
/* eslint-disable @typescript-eslint/no-empty-interface */ |
||||
import { SchemaInterface } from './SchemaInterface' |
||||
import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios' |
||||
import stubResolver from '@/stubs/StubResolver' |
||||
import domainResolver from '@/api/DomainResolver' |
||||
|
||||
export abstract class Handler { |
||||
abstract handle: any |
||||
} |
||||
|
||||
export interface RequestInterface { |
||||
method: Method; |
||||
url: string; |
||||
data: Record<string, any> | null; |
||||
headers: Record<string, any> | null; |
||||
} |
||||
|
||||
interface RequestHandleFunction { |
||||
(request: RequestInterface): void; |
||||
} |
||||
|
||||
export abstract class RequestHandler extends Handler { |
||||
abstract handle: RequestHandleFunction |
||||
} |
||||
|
||||
export interface ResponseInterface extends AxiosResponse { |
||||
|
||||
} |
||||
|
||||
interface ResponseHandleFunction { |
||||
(response: ResponseInterface): void; |
||||
} |
||||
|
||||
export abstract class ResponseHandler extends Handler { |
||||
abstract handle: ResponseHandleFunction |
||||
} |
||||
|
||||
export class HttpClient { |
||||
private baseUrl: string |
||||
private handlers: Handler[] = [] |
||||
|
||||
constructor (baseUrl: string) { |
||||
this.baseUrl = baseUrl |
||||
this.syncBaseUrlWithStand() |
||||
} |
||||
|
||||
async syncBaseUrlWithStand () { |
||||
await domainResolver |
||||
.resolve() |
||||
.then((url) => { |
||||
this.baseUrl = url || this.baseUrl |
||||
}) |
||||
} |
||||
|
||||
send (schema: SchemaInterface, data: any | null = null): Promise<AxiosResponse> { |
||||
let url = schema.url |
||||
const preparedData = data |
||||
for (const key in data) { |
||||
if (url.indexOf('{' + key + '}') > -1) { |
||||
url = url.replace('{' + key + '}', preparedData[key]) |
||||
delete preparedData[key] |
||||
} |
||||
} |
||||
console.log(data, 'data') |
||||
const requestData = { |
||||
method: schema.method as Method, |
||||
url: this.baseUrl + url, |
||||
data: preparedData, |
||||
headers: { |
||||
'Content-Type': 'application/json;charset=utf-8' |
||||
} |
||||
} as RequestInterface |
||||
|
||||
/** |
||||
* todo перевести на промисы + |
||||
*/ |
||||
this.handlers |
||||
.filter((handler: Handler) => { |
||||
return handler instanceof RequestHandler |
||||
}) |
||||
.map((handler: Handler) => { |
||||
handler.handle(requestData) |
||||
return handler |
||||
}) |
||||
|
||||
const stub = stubResolver.handle(schema.code) |
||||
const axiosData = requestData as AxiosRequestConfig |
||||
|
||||
if (schema.prefix) { |
||||
const temp: any = {} |
||||
temp[schema.prefix] = axiosData.data |
||||
axiosData.data = temp |
||||
} |
||||
|
||||
if (axiosData.method === 'GET') { |
||||
axiosData.params = axiosData.data |
||||
delete axiosData.data |
||||
} |
||||
const response = stub || axios(axiosData) |
||||
|
||||
return response |
||||
.then((response: any) => { |
||||
/** |
||||
* todo перевести на промисы + |
||||
*/ |
||||
this.handlers |
||||
.filter((handler: Handler) => { |
||||
return handler instanceof ResponseHandler |
||||
}) |
||||
.map((handler: Handler) => { |
||||
handler.handle(response) |
||||
return handler |
||||
}) |
||||
|
||||
return response |
||||
}) |
||||
} |
||||
|
||||
addHandler (handler: Handler) { |
||||
this.handlers.push(handler) |
||||
return this |
||||
} |
||||
} |
@ -0,0 +1,38 @@ |
||||
import { HttpClient as BaseClient } from '../../api/HttpClient' |
||||
import MocksSchema, { MockConfigurationsRequest } from '../../api/Main/Schemas/MocksSchema' |
||||
import { SchemaInterface } from '@/api/SchemaInterface' |
||||
import { TokenRequestHandler } from '@/api/Handlers/TokenRequestHandler' |
||||
import AddMockSchema, { AddMockConfigurationsRequest } from '@/api/Main/Schemas/AddMockSchema' |
||||
import ChangeMockValueSchema, { ChangeMockConfigurationValueRequest } from '@/api/Main/Schemas/ChangeMockValueSchema' |
||||
import ToggleNewClientTypeSchema, { ToggleNewClientTypeRequest } from '@/api/Main/Schemas/ToggleNewClientTypeSchema' |
||||
import ToggleRegularClientTypeSchema, { ToggleRegularClientTypeRequest } from '@/api/Main/Schemas/ToggleRegularClientTypeSchema' |
||||
import UserIdentificationByIdenfySchema, { UserIdentificationByIdenfyRequest } from '@/api/Main/Schemas/UserIdentificationByIdenfySchema' |
||||
|
||||
export class HttpClient extends BaseClient { |
||||
mockConfigurations (data: MockConfigurationsRequest): any { |
||||
return this.send(MocksSchema as SchemaInterface, data) |
||||
} |
||||
|
||||
addMockConfigurations (data: AddMockConfigurationsRequest): any { |
||||
return this.send(AddMockSchema as SchemaInterface, data) |
||||
} |
||||
|
||||
changeMockValueConfiguration (data: ChangeMockConfigurationValueRequest): any { |
||||
return this.send(ChangeMockValueSchema as SchemaInterface, data) |
||||
} |
||||
|
||||
toggleNewClientType (data: ToggleNewClientTypeRequest): any { |
||||
return this.send(ToggleNewClientTypeSchema as SchemaInterface, data) |
||||
} |
||||
|
||||
toggleRegularClientType (data: ToggleRegularClientTypeRequest): any { |
||||
return this.send(ToggleRegularClientTypeSchema as SchemaInterface, data) |
||||
} |
||||
|
||||
userIdentificationByIdenfyType (data: UserIdentificationByIdenfyRequest): any { |
||||
return this.send(UserIdentificationByIdenfySchema as SchemaInterface, data) |
||||
} |
||||
} |
||||
|
||||
export default new HttpClient('http://placetgroup.sipachev.sv') |
||||
.addHandler(new TokenRequestHandler()) |
@ -0,0 +1,17 @@ |
||||
export class MockConfiguration { |
||||
personalCode!: string |
||||
code!: string |
||||
value!: number |
||||
active!: string |
||||
} |
||||
|
||||
export class AddMockConfigurationsRequest { |
||||
items!: MockConfiguration[] |
||||
} |
||||
|
||||
export default { |
||||
code: 'api_plugin_add_configurations', |
||||
method: 'POST', |
||||
url: '/plugin/mock-configurations', |
||||
prefix: 'mockConfigurations' |
||||
} |
@ -0,0 +1,11 @@ |
||||
export class ChangeMockConfigurationValueRequest { |
||||
id!: string |
||||
value!: string |
||||
} |
||||
|
||||
export default { |
||||
code: 'api_plugin_change_configuration_value', |
||||
method: 'PATCH', |
||||
url: '/plugin/mock-configurations/{id}/value', |
||||
prefix: 'mockConfigurations' |
||||
} |
@ -0,0 +1,9 @@ |
||||
export class MockConfigurationsRequest { |
||||
personalCode!: string |
||||
} |
||||
|
||||
export default { |
||||
code: 'api_plugin_get_configurations', |
||||
method: 'GET', |
||||
url: '/plugin/mock-configurations' |
||||
} |
@ -0,0 +1,9 @@ |
||||
export class ToggleNewClientTypeRequest { |
||||
personalCode!: string |
||||
} |
||||
|
||||
export default { |
||||
code: 'api_plugin_toggle_new_client_type', |
||||
method: 'POST', |
||||
url: '/plugin/user/{personalCode}/toggleNewClientType' |
||||
} |
@ -0,0 +1,9 @@ |
||||
export class ToggleRegularClientTypeRequest { |
||||
personalCode!: string |
||||
} |
||||
|
||||
export default { |
||||
code: 'api_plugin_toggle_regular_client_type', |
||||
method: 'POST', |
||||
url: '/plugin/user/{personalCode}/toggleRegularClientType' |
||||
} |
@ -0,0 +1,9 @@ |
||||
export class UserIdentificationByIdenfyRequest { |
||||
user!: string |
||||
} |
||||
|
||||
export default { |
||||
code: 'api_post_user_identification_by_indefy', |
||||
method: 'POST', |
||||
url: '/plugin/users/{user}/identificationByIdenfy' |
||||
} |
@ -0,0 +1,7 @@ |
||||
export interface SchemaInterface { |
||||
code: string; |
||||
method: string; |
||||
url: string; |
||||
stub: any; |
||||
prefix?: string; |
||||
} |
@ -0,0 +1,18 @@ |
||||
export class Registers { |
||||
xtee_mta = '' |
||||
ria = '' |
||||
scoring = '' |
||||
scoring_d = '' |
||||
xtee_pension = '' |
||||
|
||||
reset () { |
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
this.xtee_mta = '' |
||||
this.ria = '' |
||||
this.scoring = '' |
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
this.scoring_d = '' |
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
this.xtee_pension = '' |
||||
} |
||||
} |
@ -0,0 +1,4 @@ |
||||
<template src="./template.html"></template> |
||||
<script lang="ts" src="./script.ts"></script> |
||||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
||||
<style scoped lang="scss" src="./style.scss"></style> |
@ -0,0 +1,37 @@ |
||||
import { Component, Vue } from 'vue-property-decorator' |
||||
import { Person } from '@/classes/DTO/Person' |
||||
import VueClipboard from 'vue-clipboard2' |
||||
import sender from '@/classes/Service/Browser/Chrome/Sender' |
||||
import { Action } from '@/classes/Enum/Action' |
||||
import notificationCleaner from '@/classes/Service/NotificationCleaner' |
||||
|
||||
Vue.use(VueClipboard) |
||||
|
||||
@Component |
||||
export default class HelloWorld extends Vue { |
||||
person = new Person() |
||||
isAutoCleaner = false |
||||
|
||||
mounted () { |
||||
/** todo заполнить первоначальное значение */ |
||||
notificationCleaner.state().then((isAutoCleaner) => { |
||||
this.isAutoCleaner = isAutoCleaner |
||||
console.log('this.isAutoCleaner = ' + isAutoCleaner) |
||||
}) |
||||
} |
||||
|
||||
cleanNotifications (): void { |
||||
sender.send({ |
||||
action: Action.CLEAN_NOTIFICATION |
||||
}) |
||||
} |
||||
|
||||
onChangeAutoCleaner () { |
||||
console.log(this.isAutoCleaner) |
||||
if (this.isAutoCleaner) { |
||||
notificationCleaner.enable() |
||||
} else { |
||||
notificationCleaner.disable() |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
.container { |
||||
max-width: 400px; |
||||
min-width: 400px; |
||||
border: solid 2px gray; |
||||
|
||||
.wrapper { |
||||
padding: 10px; |
||||
|
||||
.tab-panel { |
||||
display: flex; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
padding: 5px; |
||||
cursor: pointer; |
||||
border-bottom: solid 2px #cae5fa; |
||||
|
||||
&_active { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
|
||||
&:hover { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-page { |
||||
padding-top: 10px; |
||||
|
||||
&__item { |
||||
display: none; |
||||
|
||||
|
||||
&_show { |
||||
display: block; |
||||
} |
||||
|
||||
.form-row { |
||||
display: flex; |
||||
margin-bottom: 5px; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
margin-right: 10px; |
||||
|
||||
&-input { |
||||
width: 100%; |
||||
} |
||||
} |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.memory-panel { |
||||
text-align: left; |
||||
padding: 5px; |
||||
margin-top: 10px; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
<div> |
||||
<div class="form-row"> |
||||
<div class="form-row__item"> |
||||
<label> |
||||
Use notification cleaner |
||||
<input @change="onChangeAutoCleaner" type="checkbox" v-model="isAutoCleaner"> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
<div class="form-row"> |
||||
<div class="form-row__item"> |
||||
<button |
||||
@click="cleanNotifications" |
||||
>Clean</button> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,4 @@ |
||||
<template src="./template.html"></template> |
||||
<script lang="ts" src="./script.ts"></script> |
||||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
||||
<style scoped lang="scss" src="./style.scss"></style> |
@ -0,0 +1,14 @@ |
||||
import { Component, Vue } from 'vue-property-decorator' |
||||
import VueClipboard from 'vue-clipboard2' |
||||
import Mocks from '@/components/mocks/main.vue' |
||||
|
||||
Vue.use(VueClipboard) |
||||
|
||||
@Component({ |
||||
components: { |
||||
Mocks |
||||
} |
||||
}) |
||||
export default class MocksTab extends Vue { |
||||
personalCode = '' |
||||
} |
@ -0,0 +1,65 @@ |
||||
.container { |
||||
max-width: 400px; |
||||
min-width: 400px; |
||||
border: solid 2px gray; |
||||
|
||||
.wrapper { |
||||
padding: 10px; |
||||
|
||||
.tab-panel { |
||||
display: flex; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
padding: 5px; |
||||
cursor: pointer; |
||||
border-bottom: solid 2px #cae5fa; |
||||
|
||||
&_active { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
|
||||
&:hover { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-page { |
||||
padding-top: 10px; |
||||
|
||||
&__item { |
||||
display: none; |
||||
|
||||
|
||||
&_show { |
||||
display: block; |
||||
} |
||||
|
||||
.form-row { |
||||
display: flex; |
||||
margin-bottom: 5px; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
margin-right: 10px; |
||||
|
||||
&-input { |
||||
width: 100%; |
||||
} |
||||
} |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.memory-panel { |
||||
text-align: left; |
||||
padding: 5px; |
||||
margin-top: 10px; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
<div> |
||||
<label> |
||||
Personal id |
||||
<input type="text" v-model="personalCode"/> |
||||
</label> |
||||
<div v-if="personalCode"> |
||||
<hr /> |
||||
<Mocks :mode="'update'" :personalCode="personalCode"></Mocks> |
||||
</div> |
||||
</div> |
@ -0,0 +1,4 @@ |
||||
<template src="./template.html"></template> |
||||
<script lang="ts" src="./script.ts"></script> |
||||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
||||
<style scoped lang="scss" src="./style.scss"></style> |
@ -0,0 +1,142 @@ |
||||
import { Component, Prop, Vue, Watch } from 'vue-property-decorator' |
||||
import VueClipboard from 'vue-clipboard2' |
||||
import { Registers } from '@/classes/DTO/Registers' |
||||
import httpClient from '@/api/Main/HttpClient' |
||||
import { MockConfiguration } from '@/api/Main/Schemas/AddMockSchema' |
||||
|
||||
Vue.use(VueClipboard) |
||||
|
||||
export enum Mode { |
||||
ADD = 'add', |
||||
UPDATE = 'update', |
||||
} |
||||
|
||||
@Component |
||||
export default class Mocks extends Vue { |
||||
@Prop() |
||||
personalCode!: string |
||||
|
||||
@Prop() |
||||
mode!: Mode |
||||
|
||||
showLoader = false |
||||
isHidden = false |
||||
registers = new Registers() |
||||
register2Id: Record<string, string> = {} |
||||
|
||||
mounted () { |
||||
console.log('mounted', this.personalCode) |
||||
} |
||||
|
||||
@Watch('personalCode', { immediate: true }) |
||||
onPersonalCodeChanged () { |
||||
this.registers.reset() |
||||
this.showLoader = false |
||||
this.isHidden = false |
||||
this.refreshMocks() |
||||
} |
||||
|
||||
refreshMocks () { |
||||
if (this.mode !== Mode.UPDATE) { |
||||
return |
||||
} |
||||
this.showLoader = true |
||||
httpClient.mockConfigurations({ personalCode: this.personalCode }) |
||||
.then((data: any) => { |
||||
const existServiceKeys = [] |
||||
for (const mockConfiguration of data.data) { |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
this.registers[mockConfiguration.code] = mockConfiguration.value |
||||
this.register2Id[mockConfiguration.code] = mockConfiguration.id |
||||
existServiceKeys.push(mockConfiguration.code) |
||||
} |
||||
for (const serviceCode in this.registers) { |
||||
if (existServiceKeys.indexOf(serviceCode) > -1) { |
||||
continue |
||||
} |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
this.registers[serviceCode] = '' |
||||
delete this.register2Id[serviceCode] |
||||
} |
||||
}) |
||||
.then(() => { |
||||
this.showLoader = false |
||||
}) |
||||
} |
||||
|
||||
async onServiceChanged (serviceKey: string) { |
||||
if (this.mode !== Mode.UPDATE) { |
||||
return |
||||
} |
||||
if (typeof this.register2Id[serviceKey] === 'undefined') { |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
await this.saveMock(this.personalCode, serviceKey, Number(this.registers[serviceKey])) |
||||
await this.refreshMocks() |
||||
return |
||||
} |
||||
|
||||
this.showLoader = true |
||||
httpClient.changeMockValueConfiguration({ |
||||
id: this.register2Id[serviceKey], |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
value: this.registers[serviceKey] |
||||
}) |
||||
.then((data: any) => { |
||||
console.log('updateMock') |
||||
console.log(data) |
||||
}) |
||||
.then(() => { |
||||
this.showLoader = false |
||||
}) |
||||
} |
||||
|
||||
saveMocks () { |
||||
const mockConfigurations: MockConfiguration[] = [] |
||||
for (const serviceCode in this.registers) { |
||||
const mockConfiguration = new MockConfiguration() |
||||
mockConfiguration.personalCode = this.personalCode |
||||
mockConfiguration.code = serviceCode |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
mockConfiguration.value = this.registers[serviceCode] |
||||
if (!mockConfiguration.value) { |
||||
continue |
||||
} |
||||
mockConfiguration.active = 'true' |
||||
mockConfigurations.push(mockConfiguration) |
||||
} |
||||
this.showLoader = true |
||||
httpClient.addMockConfigurations({ items: mockConfigurations }) |
||||
.then((data: any) => { |
||||
console.log('saveMocks') |
||||
console.log(data) |
||||
}) |
||||
.then(() => { |
||||
this.showLoader = false |
||||
this.isHidden = true |
||||
}) |
||||
} |
||||
|
||||
saveMock (personalCode: string, serviceCode: string, value: number): Promise<any> { |
||||
const mockConfigurations: MockConfiguration[] = [] |
||||
const mockConfiguration = new MockConfiguration() |
||||
mockConfiguration.personalCode = personalCode |
||||
mockConfiguration.code = serviceCode |
||||
mockConfiguration.value = value |
||||
mockConfiguration.active = 'true' |
||||
mockConfigurations.push(mockConfiguration) |
||||
this.showLoader = true |
||||
return httpClient.addMockConfigurations({ items: mockConfigurations }) |
||||
.then((data: any) => { |
||||
console.log('saveMocks') |
||||
console.log(data) |
||||
}) |
||||
.then(() => { |
||||
this.showLoader = false |
||||
}) |
||||
} |
||||
} |
@ -0,0 +1,75 @@ |
||||
.option-select { |
||||
width: 350px; |
||||
} |
||||
|
||||
.mock-service__select { |
||||
margin-bottom: 5px; |
||||
} |
||||
|
||||
.lds-grid { |
||||
display: inline-block; |
||||
position: relative; |
||||
width: 80px; |
||||
height: 80px; |
||||
} |
||||
.lds-grid div { |
||||
position: absolute; |
||||
width: 16px; |
||||
height: 16px; |
||||
border-radius: 50%; |
||||
background: #298df8; |
||||
animation: lds-grid 1.2s linear infinite; |
||||
} |
||||
.lds-grid div:nth-child(1) { |
||||
top: 8px; |
||||
left: 8px; |
||||
animation-delay: 0s; |
||||
} |
||||
.lds-grid div:nth-child(2) { |
||||
top: 8px; |
||||
left: 32px; |
||||
animation-delay: -0.4s; |
||||
} |
||||
.lds-grid div:nth-child(3) { |
||||
top: 8px; |
||||
left: 56px; |
||||
animation-delay: -0.8s; |
||||
} |
||||
.lds-grid div:nth-child(4) { |
||||
top: 32px; |
||||
left: 8px; |
||||
animation-delay: -0.4s; |
||||
} |
||||
.lds-grid div:nth-child(5) { |
||||
top: 32px; |
||||
left: 32px; |
||||
animation-delay: -0.8s; |
||||
} |
||||
.lds-grid div:nth-child(6) { |
||||
top: 32px; |
||||
left: 56px; |
||||
animation-delay: -1.2s; |
||||
} |
||||
.lds-grid div:nth-child(7) { |
||||
top: 56px; |
||||
left: 8px; |
||||
animation-delay: -0.8s; |
||||
} |
||||
.lds-grid div:nth-child(8) { |
||||
top: 56px; |
||||
left: 32px; |
||||
animation-delay: -1.2s; |
||||
} |
||||
.lds-grid div:nth-child(9) { |
||||
top: 56px; |
||||
left: 56px; |
||||
animation-delay: -1.6s; |
||||
} |
||||
@keyframes lds-grid { |
||||
0%, 100% { |
||||
opacity: 1; |
||||
} |
||||
50% { |
||||
opacity: 0.5; |
||||
} |
||||
} |
@ -0,0 +1,69 @@ |
||||
<div v-if="!isHidden"> |
||||
<div v-if="showLoader" class="lds-grid"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div> |
||||
<div v-if="!showLoader"> |
||||
<div class="mock-service__select"> |
||||
<div>MTA</div> |
||||
<div> |
||||
<select class="option-select" v-model="registers.xtee_mta" @change="onServiceChanged('xtee_mta')"> |
||||
<option value="-1">-</option> |
||||
<option value="0">Не замокано (делать запрос)</option> |
||||
<option value="1">Выписка на хороший доход</option> |
||||
<option value="2">Выписка на маленький доход</option> |
||||
<option value="3">Ошибка загрузки выписки (перезапрос)</option> |
||||
<option value="4">Ошибка загрузки выписки (нет данных)</option> |
||||
<option value="5">По персональному коду (3 - выписка с хорошим доходом, остальные - ошибка загрузки выписки)</option> |
||||
<option value="6">Выписка на хороший доход, последние два месяца доход 0</option> |
||||
<option value="7">Выписка на хороший доход, последний месяц доход 0</option> |
||||
<option value="8">Выписка на хороший доход, но у пользователя нет активного работодателя. Не можем выдать</option> |
||||
<option value="9">Выписка на хороший доход, в выписке есть выплаты, которые не учитываются в подсчёте среднего дохода</option> |
||||
<option value="10">Выписка на хороший доход, в выписке нет дохода "зарплата" и его производных.</option> |
||||
<option value="11">Выписка на хороший доход, у пользователя нет активного работодателя, пользователь самозанятый</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
<div class="mock-service__select"> |
||||
<div>Ria</div> |
||||
<div> |
||||
<select class="option-select" v-model="registers.ria" @change="onServiceChanged('ria')"> |
||||
<option value="-1">-</option> |
||||
<option value="0">Не замокано (делать запрос)</option> |
||||
<option value="1">Успешный запрос</option> |
||||
<option value="2">Все запросы отклонены</option> |
||||
<option value="3">По персональному коду (3 - успешно, остальные - ошибка)</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
<div class="mock-service__select"> |
||||
<div>Scoring</div> |
||||
<div> |
||||
<select class="option-select" v-model="registers.scoring" @change="onServiceChanged('scoring')"> |
||||
<option value="-1">-</option> |
||||
<option value="0">Не замокано</option> |
||||
<option value="1">A</option> |
||||
<option value="2">B</option> |
||||
<option value="3">C</option> |
||||
<option value="4">D</option> |
||||
<option value="5">E</option> |
||||
<option value="6">F</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
<div class="mock-service__select"> |
||||
<div>Scoring D</div> |
||||
<div> |
||||
<select class="option-select" v-model="registers.scoring_d" @change="onServiceChanged('scoring_d')"> |
||||
<option value="-1">-</option> |
||||
<option value="0">Не замокано</option> |
||||
<option value="1">A</option> |
||||
<option value="2">B</option> |
||||
<option value="3">C</option> |
||||
<option value="4">D</option> |
||||
<option value="5">E</option> |
||||
<option value="6">F</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
<br /> |
||||
<button v-if="'add' === mode" @click="saveMocks">Сохранить моки</button> |
||||
</div> |
||||
</div> |
@ -0,0 +1,4 @@ |
||||
<template src="./template.html"></template> |
||||
<script lang="ts" src="./script.ts"></script> |
||||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
||||
<style scoped lang="scss" src="./style.scss"></style> |
@ -0,0 +1,93 @@ |
||||
import { Component, Vue } from 'vue-property-decorator' |
||||
import personalIdGenerator from '@/classes/Service/Generators/PersonalIdGenerator' |
||||
import ibanGenerator from '@/classes/Service/Generators/IbanGenerator' |
||||
import phoneGenerator from '@/classes/Service/Generators/PhoneGenerator' |
||||
import firstNameGenerator from '@/classes/Service/Generators/FirstNameGenerator' |
||||
import lastNameGenerator from '@/classes/Service/Generators/LastNameGenerator' |
||||
import { Person } from '@/classes/DTO/Person' |
||||
import VueClipboard from 'vue-clipboard2' |
||||
import { Target } from '@/classes/Enum/Target' |
||||
import sender from '@/classes/Service/Browser/Chrome/Sender' |
||||
import { Action } from '@/classes/Enum/Action' |
||||
import Mocks from '@/components/mocks/main.vue' |
||||
import countryResolver from '@/api/CountryResolver' |
||||
|
||||
Vue.use(VueClipboard) |
||||
|
||||
@Component({ |
||||
components: { |
||||
Mocks |
||||
} |
||||
}) |
||||
export default class PersonTab extends Vue { |
||||
personalCode = '' |
||||
person = new Person() |
||||
copyText = '' |
||||
|
||||
async mounted () { |
||||
this.person.country = await countryResolver.resolve() |
||||
} |
||||
|
||||
get allowedMonths () { |
||||
const result = [] |
||||
for (let i = 1; i <= 12; i++) { |
||||
result.push(i) |
||||
} |
||||
return result |
||||
} |
||||
|
||||
get allowedYears () { |
||||
const result = [] |
||||
const currentYear = (new Date()).getFullYear() |
||||
for (let i = 1930; i <= currentYear; i++) { |
||||
result.push(i) |
||||
} |
||||
return result |
||||
} |
||||
|
||||
copyPersonalCode () { |
||||
const personalCode = personalIdGenerator.generate(this.person) |
||||
this.personalCode = personalCode |
||||
this.copy(personalCode) |
||||
} |
||||
|
||||
copyIban () { |
||||
const iban = ibanGenerator.generate(this.person.country) |
||||
this.personalCode = '' |
||||
this.copy(iban) |
||||
} |
||||
|
||||
copyPhone () { |
||||
const phone = phoneGenerator.generate(this.person.country) |
||||
this.personalCode = '' |
||||
this.copy(phone) |
||||
} |
||||
|
||||
copy (text: string) { |
||||
this.copyText = text |
||||
this.$copyText(text) |
||||
} |
||||
|
||||
autocomplete () { |
||||
const personalCode = personalIdGenerator.generate(this.person) |
||||
this.personalCode = personalCode |
||||
this.copy(personalCode) |
||||
this.insertValueToNode(Target.PERSONAL_ID, personalCode) |
||||
const iban = ibanGenerator.generate(this.person.country) |
||||
this.insertValueToNode(Target.IBAN, iban) |
||||
const phone = phoneGenerator.generate(this.person.country) |
||||
this.insertValueToNode(Target.PHONE, phone) |
||||
const firstName = firstNameGenerator.generate(this.person.country, this.person.gender) |
||||
this.insertValueToNode(Target.FIRST_NAME, firstName) |
||||
const lastName = lastNameGenerator.generate(this.person.country) |
||||
this.insertValueToNode(Target.LAST_NAME, lastName) |
||||
} |
||||
|
||||
insertValueToNode (target: Target, value: string): void { |
||||
sender.send({ |
||||
action: Action.INSERT, |
||||
target: target, |
||||
value: value |
||||
}) |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
.container { |
||||
max-width: 400px; |
||||
min-width: 400px; |
||||
border: solid 2px gray; |
||||
|
||||
.wrapper { |
||||
padding: 10px; |
||||
|
||||
.tab-panel { |
||||
display: flex; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
padding: 5px; |
||||
cursor: pointer; |
||||
border-bottom: solid 2px #cae5fa; |
||||
|
||||
&_active { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
|
||||
&:hover { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-page { |
||||
padding-top: 10px; |
||||
|
||||
&__item { |
||||
display: none; |
||||
|
||||
|
||||
&_show { |
||||
display: block; |
||||
} |
||||
|
||||
.form-row { |
||||
display: flex; |
||||
margin-bottom: 5px; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
margin-right: 10px; |
||||
|
||||
&-input { |
||||
width: 100%; |
||||
} |
||||
} |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.memory-panel { |
||||
text-align: left; |
||||
padding: 5px; |
||||
margin-top: 10px; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
<div> |
||||
<div class="form-row"> |
||||
<div class="form-row__item"> |
||||
<input title="Day" class="form-row__item-input" type="text" v-model="person.birthday.day" placeholder="Day"> |
||||
</div> |
||||
<div class="form-row__item"> |
||||
<select title="Month" v-model="person.birthday.month"> |
||||
<option v-for="allowedMonth in allowedMonths" :value="allowedMonth">{{ allowedMonth }}</option> |
||||
</select> |
||||
</div> |
||||
<div class="form-row__item"> |
||||
<select title="Year" v-model="person.birthday.year"> |
||||
<option v-for="allowedYear in allowedYears" :value="allowedYear">{{ allowedYear }}</option> |
||||
</select> |
||||
</div> |
||||
</div> |
||||
<div class="form-row"> |
||||
<div class="form-row__item"> |
||||
<label> |
||||
Country: |
||||
<select v-model="person.country"> |
||||
<option value="ee">Estonia</option> |
||||
<option value="lt">Lithuania</option> |
||||
</select> |
||||
</label> |
||||
</div> |
||||
<div class="form-row__item"> |
||||
<label> |
||||
Gender |
||||
<select v-model="person.gender"> |
||||
<option value="male">Male</option> |
||||
<option value="female">Female</option> |
||||
<option value="random">Random</option> |
||||
</select> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
<div class="form-row"> |
||||
<div |
||||
@click="autocomplete" |
||||
class="form-row__item copy-button" data-clipboard-text="text1"> |
||||
<button>Autocomplete</button> |
||||
</div> |
||||
<div |
||||
@click="copyPersonalCode" |
||||
class="form-row__item copy-button" data-clipboard-text="text2"> |
||||
<button>personalCode</button> |
||||
</div> |
||||
<div |
||||
@click="copyIban" |
||||
class="form-row__item copy-button" data-clipboard-text="text3"> |
||||
<button>Iban</button> |
||||
</div> |
||||
<div |
||||
@click="copyPhone" |
||||
class="form-row__item copy-button" data-clipboard-text="text3"> |
||||
<button>Phone</button> |
||||
</div> |
||||
</div> |
||||
<div class="memory-panel">Memory: {{copyText}}</div> |
||||
<div v-if="personalCode"> |
||||
<hr /> |
||||
<Mocks :mode="'add'" :personalCode="personalCode"></Mocks> |
||||
</div> |
||||
</div> |
@ -1,103 +1,27 @@ |
||||
import { Component, Vue } from 'vue-property-decorator' |
||||
import personalIdGenerator from '@/classes/Service/Generators/PersonalIdGenerator' |
||||
import ibanGenerator from '@/classes/Service/Generators/IbanGenerator' |
||||
import phoneGenerator from '@/classes/Service/Generators/PhoneGenerator' |
||||
import firstNameGenerator from '@/classes/Service/Generators/FirstNameGenerator' |
||||
import lastNameGenerator from '@/classes/Service/Generators/LastNameGenerator' |
||||
import { Person } from '@/classes/DTO/Person' |
||||
import VueClipboard from 'vue-clipboard2' |
||||
import { Target } from '@/classes/Enum/Target' |
||||
import sender from '@/classes/Service/Browser/Chrome/Sender' |
||||
import { Action } from '@/classes/Enum/Action' |
||||
import notificationCleaner from '@/classes/Service/NotificationCleaner' |
||||
import Mocks from '@/components/mocks/main.vue' |
||||
import PersonTab from '@/components/person-tab/main.vue' |
||||
import MocksTab from '@/components/mocks-tab/main.vue' |
||||
import EmberTab from '@/components/ember-tab/main.vue' |
||||
import UserTab from '@/components/user-tab/main.vue' |
||||
|
||||
Vue.use(VueClipboard) |
||||
|
||||
@Component |
||||
@Component({ |
||||
components: { |
||||
Mocks, |
||||
PersonTab, |
||||
MocksTab, |
||||
EmberTab, |
||||
UserTab |
||||
} |
||||
}) |
||||
export default class HelloWorld extends Vue { |
||||
tab = 'person' |
||||
person = new Person() |
||||
isAutoCleaner = false |
||||
copyText = '' |
||||
|
||||
get allowedMonths () { |
||||
const result = [] |
||||
for (let i = 1; i <= 12; i++) { |
||||
result.push(i) |
||||
} |
||||
return result |
||||
} |
||||
|
||||
get allowedYears () { |
||||
const result = [] |
||||
const currentYear = (new Date()).getFullYear() |
||||
for (let i = 1960; i <= currentYear; i++) { |
||||
result.push(i) |
||||
} |
||||
return result |
||||
} |
||||
|
||||
mounted () { |
||||
/** todo заполнить первоначальное значение */ |
||||
notificationCleaner.state().then((isAutoCleaner) => { |
||||
this.isAutoCleaner = isAutoCleaner |
||||
console.log('this.isAutoCleaner = ' + isAutoCleaner) |
||||
}) |
||||
} |
||||
|
||||
copyPersonalId () { |
||||
const personalId = personalIdGenerator.generate(this.person) |
||||
this.copy(personalId) |
||||
} |
||||
|
||||
copyIban () { |
||||
const iban = ibanGenerator.generate(this.person.country) |
||||
this.copy(iban) |
||||
} |
||||
|
||||
copyPhone () { |
||||
const phone = phoneGenerator.generate(this.person.country) |
||||
this.copy(phone) |
||||
} |
||||
|
||||
copy (text: string) { |
||||
this.copyText = text |
||||
this.$copyText(text) |
||||
} |
||||
|
||||
autocomplete () { |
||||
const personalId = personalIdGenerator.generate(this.person) |
||||
this.insertValueToNode(Target.PERSONAL_ID, personalId) |
||||
const iban = ibanGenerator.generate(this.person.country) |
||||
this.insertValueToNode(Target.IBAN, iban) |
||||
const phone = phoneGenerator.generate(this.person.country) |
||||
this.insertValueToNode(Target.PHONE, phone) |
||||
const firstName = firstNameGenerator.generate(this.person.country, this.person.gender) |
||||
this.insertValueToNode(Target.FIRST_NAME, firstName) |
||||
const lastName = lastNameGenerator.generate(this.person.country) |
||||
this.insertValueToNode(Target.LAST_NAME, lastName) |
||||
} |
||||
|
||||
insertValueToNode (target: Target, value: string): void { |
||||
sender.send({ |
||||
action: Action.INSERT, |
||||
target: target, |
||||
value: value |
||||
}) |
||||
} |
||||
|
||||
cleanNotifications (): void { |
||||
sender.send({ |
||||
action: Action.CLEAN_NOTIFICATION |
||||
}) |
||||
} |
||||
|
||||
onChangeAutoCleaner () { |
||||
console.log(this.isAutoCleaner) |
||||
if (this.isAutoCleaner) { |
||||
notificationCleaner.enable() |
||||
} else { |
||||
notificationCleaner.disable() |
||||
} |
||||
isPlugin (): boolean { |
||||
console.log(chrome) |
||||
return !!chrome.tabs |
||||
} |
||||
} |
||||
|
@ -0,0 +1,4 @@ |
||||
<template src="./template.html"></template> |
||||
<script lang="ts" src="./script.ts"></script> |
||||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
||||
<style scoped lang="scss" src="./style.scss"></style> |
@ -0,0 +1,59 @@ |
||||
import { Component, Prop, Vue } from 'vue-property-decorator' |
||||
import VueClipboard from 'vue-clipboard2' |
||||
import httpClient from '@/api/Main/HttpClient' |
||||
import { ToggleNewClientTypeRequest } from '@/api/Main/Schemas/ToggleNewClientTypeSchema' |
||||
import { UserIdentificationByIdenfyRequest } from '@/api/Main/Schemas/UserIdentificationByIdenfySchema' |
||||
|
||||
Vue.use(VueClipboard) |
||||
|
||||
@Component |
||||
export default class UserTab extends Vue { |
||||
@Prop() |
||||
clientTypeUpdate!: string |
||||
|
||||
personalCode!: string |
||||
user!: string |
||||
clientType = 'New'; |
||||
copyText = ''; |
||||
|
||||
update () { |
||||
if (this.clientType === 'New') { |
||||
const newToggle = new ToggleNewClientTypeRequest() |
||||
newToggle.personalCode = this.personalCode |
||||
|
||||
httpClient.toggleNewClientType(newToggle) |
||||
} else { |
||||
const regularToggle = new ToggleNewClientTypeRequest() |
||||
regularToggle.personalCode = this.personalCode |
||||
|
||||
httpClient.toggleRegularClientType(regularToggle) |
||||
} |
||||
} |
||||
|
||||
identificationByIdenfy () { |
||||
const userIdentificationByIdenfy = new UserIdentificationByIdenfyRequest() |
||||
userIdentificationByIdenfy.user = this.user |
||||
|
||||
httpClient.userIdentificationByIdenfyType(userIdentificationByIdenfy).then((data: any) => { |
||||
this.copyText = data.data.url |
||||
}) |
||||
} |
||||
|
||||
setClientType (event: FocusEvent) { |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
this.clientType = event.target.value |
||||
} |
||||
|
||||
setPersonalCode (event: FocusEvent) { |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
this.personalCode = event.target.value |
||||
} |
||||
|
||||
setUserId (event: FocusEvent) { |
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
this.user = event.target.value |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
.container { |
||||
max-width: 400px; |
||||
min-width: 400px; |
||||
border: solid 2px gray; |
||||
|
||||
.wrapper { |
||||
padding: 10px; |
||||
|
||||
.tab-panel { |
||||
display: flex; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
padding: 5px; |
||||
cursor: pointer; |
||||
border-bottom: solid 2px #cae5fa; |
||||
|
||||
&_active { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
|
||||
&:hover { |
||||
border-bottom: solid 2px #298df8; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.tab-page { |
||||
padding-top: 10px; |
||||
|
||||
&__item { |
||||
display: none; |
||||
|
||||
|
||||
&_show { |
||||
display: block; |
||||
} |
||||
|
||||
.form-row { |
||||
display: flex; |
||||
margin-bottom: 5px; |
||||
|
||||
&__item { |
||||
flex-grow: 1; |
||||
margin-right: 10px; |
||||
|
||||
&-input { |
||||
width: 100%; |
||||
} |
||||
} |
||||
|
||||
&:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.memory-panel { |
||||
text-align: left; |
||||
padding: 5px; |
||||
margin-top: 10px; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,37 @@ |
||||
<div> |
||||
<div class="form-row"> |
||||
<div class="form-row__item"> |
||||
<input title="Personal code" class="form-row__item-input" type="text" placeholder="Personal code" v-on:change="setPersonalCode"> |
||||
|
||||
<input type="radio" id="client_type_new" |
||||
name="client_type" value="New" checked v-on:focus="setClientType"> |
||||
<label for="client_type_new">New</label> |
||||
|
||||
<input type="radio" id="client_type_regular" |
||||
name="client_type" value="Regular" v-on:focus="setClientType"> |
||||
<label for="client_type_regular">Regular</label> |
||||
</div> |
||||
</div> |
||||
<div class="form-row"> |
||||
<label> |
||||
<input type="button" v-on:click="update" value="Update"/> |
||||
</label> |
||||
</div> |
||||
|
||||
<div class="form-row"></div> |
||||
|
||||
<div class="form-row"> |
||||
<div class="form-row__item"> |
||||
<input title="User id" class="form-row__item-input" type="text" placeholder="User id" v-on:change="setUserId"> |
||||
</div> |
||||
<div class="form-row__item"> |
||||
<label> |
||||
<input type="button" v-on:click="identificationByIdenfy" value="Identification by Idenfy"/> |
||||
</label> |
||||
</div> |
||||
</div> |
||||
<div class="form-row__item"> |
||||
<div class="memory-panel">Url: {{copyText}}</div> |
||||
</div> |
||||
|
||||
</div> |
@ -0,0 +1,3 @@ |
||||
export enum FlowEnum { |
||||
base |
||||
} |
@ -0,0 +1,11 @@ |
||||
import { FlowEnum } from '@/stubs/FlowEnum' |
||||
import MocksSchema from '@/api/Main/Schemas/MocksSchema' |
||||
import MocksSchemaSuccess from '@/stubs/stubs/Main/MocksSchema/MocksSchemaSuccess' |
||||
|
||||
const map: Record<string, any> = {} |
||||
|
||||
// Регистрируем базовые успешные заглуши
|
||||
map[FlowEnum.base] = {} |
||||
map[FlowEnum.base][MocksSchema.code] = MocksSchemaSuccess |
||||
|
||||
export default map |
@ -0,0 +1,24 @@ |
||||
import { flow, useStub } from '@/stubs/config' |
||||
import map from '@/stubs/Stub2Flow' |
||||
|
||||
export class StubResolver { |
||||
handle (routeCode: string): Promise<any> | null { |
||||
if (!useStub) { |
||||
return null |
||||
} |
||||
const hasFlow = flow in map || false |
||||
if (!hasFlow) { |
||||
throw new Error('Flow not found!!! Change flow in @/stubs/config.ts') |
||||
} |
||||
const availableStubs = map[flow] |
||||
const hasRoute = routeCode in availableStubs || false |
||||
if (!hasRoute) { |
||||
throw new Error('Route`s stub not found!!! Add stub or change flow to check application') |
||||
} |
||||
|
||||
return availableStubs[routeCode] |
||||
// return new Promise(() => {})
|
||||
} |
||||
} |
||||
|
||||
export default new StubResolver() |
@ -0,0 +1,4 @@ |
||||
import { FlowEnum } from '@/stubs/FlowEnum' |
||||
|
||||
export const useStub = false |
||||
export const flow = FlowEnum.base |
@ -0,0 +1,20 @@ |
||||
import { AxiosResponse } from 'axios' |
||||
|
||||
export default new Promise((resolve) => { |
||||
const response = { |
||||
data: [ |
||||
{ |
||||
id: 'casdasdc34c342cr341c34r123d', |
||||
personalId: '48907031677', |
||||
code: 'xtee_mta', |
||||
value: '2', |
||||
active: true |
||||
} |
||||
], |
||||
status: 200, |
||||
statusText: 'OK', |
||||
headers: {}, |
||||
config: {} |
||||
} as AxiosResponse |
||||
resolve(response) |
||||
}) |
Loading…
Reference in new issue