2021-03-03 14:22:44 +03:00
|
|
|
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'
|
2021-03-05 14:29:19 +03:00
|
|
|
import { Action } from '@/classes/Enum/Action'
|
2021-03-03 14:22:44 +03:00
|
|
|
|
|
|
|
Vue.use(VueClipboard)
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class HelloWorld extends Vue {
|
|
|
|
tab = 'person'
|
|
|
|
person = new Person()
|
|
|
|
copyText = ''
|
|
|
|
|
2021-03-09 08:52:49 +03:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-03-03 14:22:44 +03:00
|
|
|
copyPersonalId () {
|
2021-03-09 08:52:49 +03:00
|
|
|
const personalId = personalIdGenerator.generate(this.person)
|
2021-03-03 14:22:44 +03:00
|
|
|
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 () {
|
2021-03-09 08:54:43 +03:00
|
|
|
const personalId = personalIdGenerator.generate(this.person)
|
2021-03-03 14:22:44 +03:00
|
|
|
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({
|
2021-03-05 14:29:19 +03:00
|
|
|
action: Action.INSERT,
|
2021-03-03 14:22:44 +03:00
|
|
|
target: target,
|
|
|
|
value: value
|
|
|
|
})
|
|
|
|
}
|
2021-03-05 14:29:19 +03:00
|
|
|
|
|
|
|
cleanNotifications (): void {
|
|
|
|
sender.send({
|
|
|
|
action: Action.CLEAN_NOTIFICATION
|
|
|
|
})
|
|
|
|
}
|
2021-03-03 14:22:44 +03:00
|
|
|
}
|