PGT-1371 -- Добавить на dev возможность перевести клиента из Нового в Постоянного

master
Suhorukov 2 years ago
parent 2153296023
commit 79cb7feec9
  1. 10
      popup/src/api/Main/HttpClient.ts
  2. 9
      popup/src/api/Main/Schemas/ToggleNewClientTypeSchema.ts
  3. 9
      popup/src/api/Main/Schemas/ToggleRegularClientTypeSchema.ts
  4. 4
      popup/src/components/script.ts
  5. 10
      popup/src/components/template.html
  6. 4
      popup/src/components/user-tab/main.vue
  7. 37
      popup/src/components/user-tab/script.ts
  8. 65
      popup/src/components/user-tab/style.scss
  9. 21
      popup/src/components/user-tab/template.html

@ -4,6 +4,8 @@ import { SchemaInterface } from '@/api/SchemaInterface'
import { TokenRequestHandler } from '@/api/Handlers/TokenRequestHandler' import { TokenRequestHandler } from '@/api/Handlers/TokenRequestHandler'
import AddMockSchema, { AddMockConfigurationsRequest } from '@/api/Main/Schemas/AddMockSchema' import AddMockSchema, { AddMockConfigurationsRequest } from '@/api/Main/Schemas/AddMockSchema'
import ChangeMockValueSchema, { ChangeMockConfigurationValueRequest } from '@/api/Main/Schemas/ChangeMockValueSchema' import ChangeMockValueSchema, { ChangeMockConfigurationValueRequest } from '@/api/Main/Schemas/ChangeMockValueSchema'
import ToggleNewClientTypeSchema, { ToggleNewClientTypeRequest } from '@/api/Main/Schemas/ToggleNewClientTypeSchema'
import ToggleRegularClientTypeSchema, { ToggleRegularClientTypeRequest } from '@/api/Main/Schemas/ToggleRegularClientTypeSchema'
export class HttpClient extends BaseClient { export class HttpClient extends BaseClient {
mockConfigurations (data: MockConfigurationsRequest): any { mockConfigurations (data: MockConfigurationsRequest): any {
@ -17,6 +19,14 @@ export class HttpClient extends BaseClient {
changeMockValueConfiguration (data: ChangeMockConfigurationValueRequest): any { changeMockValueConfiguration (data: ChangeMockConfigurationValueRequest): any {
return this.send(ChangeMockValueSchema as SchemaInterface, data) 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)
}
} }
export default new HttpClient('http://placetgroup.sipachev.sv') export default new HttpClient('http://placetgroup.sipachev.sv')

@ -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'
}

@ -4,6 +4,7 @@ import Mocks from '@/components/mocks/main.vue'
import PersonTab from '@/components/person-tab/main.vue' import PersonTab from '@/components/person-tab/main.vue'
import MocksTab from '@/components/mocks-tab/main.vue' import MocksTab from '@/components/mocks-tab/main.vue'
import EmberTab from '@/components/ember-tab/main.vue' import EmberTab from '@/components/ember-tab/main.vue'
import UserTab from '@/components/user-tab/main.vue'
Vue.use(VueClipboard) Vue.use(VueClipboard)
@ -12,7 +13,8 @@ Vue.use(VueClipboard)
Mocks, Mocks,
PersonTab, PersonTab,
MocksTab, MocksTab,
EmberTab EmberTab,
UserTab
} }
}) })
export default class HelloWorld extends Vue { export default class HelloWorld extends Vue {

@ -2,7 +2,8 @@
<div class="wrapper"> <div class="wrapper">
<div class="tab-panel"> <div class="tab-panel">
<div @click="tab = 'person'" class="tab-panel__item" <div @click="tab = 'person'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'person'}">Person :class="{'tab-panel__item_active': tab === 'person'}">
Person
</div> </div>
<div @click="personalId=''; tab = 'mocks'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'mocks'}"> <div @click="personalId=''; tab = 'mocks'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'mocks'}">
Mocks Mocks
@ -10,6 +11,10 @@
<div v-if="isPlugin()" @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}"> <div v-if="isPlugin()" @click="tab = 'ember'" class="tab-panel__item" :class="{'tab-panel__item_active': tab === 'ember'}">
Ember Ember
</div> </div>
<div @click="tab = 'user'" class="tab-panel__item"
:class="{'tab-panel__item_active': tab === 'user'}">
User
</div>
</div> </div>
<div class="tab-page"> <div class="tab-page">
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'person'}"> <div class="tab-page__item" :class="{'tab-page__item_show': tab === 'person'}">
@ -21,6 +26,9 @@
<div v-if="isPlugin()" class="tab-page__item" :class="{'tab-page__item_show': tab === 'ember'}"> <div v-if="isPlugin()" class="tab-page__item" :class="{'tab-page__item_show': tab === 'ember'}">
<EmberTab/> <EmberTab/>
</div> </div>
<div class="tab-page__item" :class="{'tab-page__item_show': tab === 'user'}">
<userTab/>
</div>
</div> </div>
</div> </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,37 @@
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'
Vue.use(VueClipboard)
@Component
export default class UserTab extends Vue {
@Prop()
clientTypeUpdate!: string
personalCode!: string
clientType = 'New';
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)
}
}
setClientType (event: FocusEvent) {
this.clientType = event.target.value
}
setPersonalCode (event: FocusEvent) {
this.personalCode = 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,21 @@
<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>
Loading…
Cancel
Save