-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to revalidate User Condition when changing
- Loading branch information
Showing
13 changed files
with
392 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<template> | ||
<div> | ||
<h5><b-badge variant="secondary" class="m-2">{{ $t('uc_version_title') }}</b-badge></h5> | ||
|
||
<b-form-group | ||
:label="$t('uc_version')" | ||
label-for="conditionVersion" | ||
label-cols="3" | ||
label-align="right" | ||
label-class="w-25" | ||
label-size="sm" | ||
class="mb-1 mr-1" | ||
> | ||
<b-form-input | ||
v-model="versionRead.message" | ||
id="conditionVersion" | ||
type="text" size="sm" | ||
></b-form-input> | ||
<b-form-text style="font-size:0.5rem;">{{ $t('uc_version_desc') }}</b-form-text> | ||
</b-form-group> | ||
<b-form-group | ||
label-cols="3" | ||
label-align="right" | ||
label-class="w-25" | ||
label-size="sm" | ||
class="mb-1" | ||
> | ||
<b-button | ||
variant="primary" | ||
size="sm" | ||
@click="updateCondition()" | ||
> | ||
{{ $t('inv_upt_but') }} | ||
</b-button> | ||
<b-card-text class="small mb-2 text-danger" v-show="errorMessage!=''"> | ||
<b-icon icon="exclamation-circle-fill" variant="danger"></b-icon> | ||
{{ $t(errorMessage) }} | ||
</b-card-text> | ||
<b-card-text class="mb-2 text-success" v-show="successMessage!=''"> | ||
<b-icon icon="check-square" variant="success"></b-icon> | ||
{{ $t(successMessage) }} | ||
</b-card-text> | ||
</b-form-group> | ||
|
||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import { UserConditionVersionGetReqItf, UserConditionVersionUpdateReqItf } from 'vue/types/conditions'; | ||
interface data { | ||
isBusy : boolean, | ||
versionRead : UserConditionVersionGetReqItf, | ||
errorMessage : string, | ||
successMessage : string, | ||
} | ||
export default Vue.extend({ | ||
name: "ConditionSetup", | ||
components: { | ||
}, | ||
data() : data { | ||
return { | ||
isBusy : false, | ||
versionRead : {} as UserConditionVersionGetReqItf, | ||
errorMessage : '', | ||
successMessage : '', | ||
}; | ||
}, | ||
async fetch() { | ||
let config = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': 'Bearer '+this.$store.state.consoleBearer, | ||
} | ||
}; | ||
this.isBusy = true; | ||
this.$axios.get<UserConditionVersionGetReqItf>(this.$config.conditionGet,config) | ||
.then((response) =>{ | ||
if (response.status == 200 ) { | ||
this.versionRead = response.data; | ||
this.isBusy = false; | ||
} | ||
}).catch((err) =>{ | ||
this.errorMessage = 'uc_error_load_condition'; | ||
this.versionRead = {} as UserConditionVersionGetReqItf; | ||
}) | ||
}, | ||
methods : { | ||
updateCondition() { | ||
this.errorMessage=''; | ||
this.successMessage=''; | ||
let config = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': 'Bearer '+this.$store.state.consoleBearer, | ||
} | ||
}; | ||
let newCondition = { | ||
conditionVersion : this.versionRead.message | ||
} as UserConditionVersionUpdateReqItf; | ||
this.$axios.put(this.$config.conditionPut, newCondition, config) | ||
.then((response) =>{ | ||
if (response.status == 200 ) { | ||
this.successMessage = "uc_update_success"; | ||
} | ||
}).catch((err) =>{ | ||
if ( err.response.status == 403 ) { | ||
this.errorMessage = "uc_update_error"; | ||
} | ||
}) | ||
} | ||
}, | ||
mounted() { | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare module "vue/types/conditions" { | ||
interface UserConditionVersionGetReqItf { | ||
message : string, | ||
} | ||
interface UserConditionVersionUpdateReqItf { | ||
conditionVersion : string, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<template> | ||
<div style="height: 100vh; width: 100%; | ||
z-index: 1; overflow: hidden; position: relative; | ||
display: flex; | ||
background: url('/static/front/background.svg') center center / cover rgb(240, 242, 245); | ||
box-sizing: border-box; | ||
justify-content: center;"> | ||
<div style="max-width: 500px; position: absolute; | ||
top: 47%; left: 50%; transform: translate(-50%, -50%); | ||
height: auto;"> | ||
<b-card align="center" style="border-radius: 1.5rem;padding: 2rem;"> | ||
<b-card-img src="/static/front/logo.svg" | ||
alt="logo" | ||
style="width: 25%; margin: 20px 0px 20px 0px;" | ||
top></b-card-img> | ||
<b-card-text> | ||
<h1 class="mb-2">{{ $config.consoleName }}</h1> | ||
</b-card-text> | ||
<b-card-text class="small"> | ||
<span style="color: rgb(148, 24, 51);"> | ||
{{ $t('uc_condition_message') }} | ||
</span><br/> | ||
<b-link :href="$config.termAndUse">{{ $t('uc_condition_visit') }}</b-link> | ||
<br/> | ||
<b-form-group style="text-align:center;" class="mb-1 small mt-2"> | ||
<b-form-checkbox v-model="conditionAccepted" | ||
id="signup-conditions" | ||
value='true' | ||
unchecked-value='false' | ||
class="mb-1" | ||
style="text-align:center;" | ||
:state="conditionState" | ||
> | ||
{{ $t('uc_condition_valid') }} | ||
</b-form-checkbox> | ||
</b-form-group> | ||
<b-button block @click="conditionValidated" | ||
:disabled="acceptSubmit" | ||
variant="primary" | ||
class="mb-2"> | ||
{{ $t('uc_condition_submit') }}</b-button> | ||
</b-form> | ||
|
||
</b-card-text> | ||
</b-card> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
export default Vue.extend({ | ||
name: "UserConditionPage", | ||
auth: false, | ||
data() { | ||
return { | ||
polling : null, | ||
conditionAccepted : 'false', | ||
conditionState : true, | ||
errorMessage : '', | ||
} | ||
}, | ||
computed: { | ||
acceptSubmit() { | ||
return ! (this.$data.conditionAccepted == 'true'); | ||
} | ||
}, | ||
methods: { | ||
async conditionValidated() { | ||
this.errorMessage=''; | ||
let config = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': 'Bearer '+this.$store.state.consoleBearer, | ||
} | ||
}; | ||
this.$axios.put(this.$config.userConditionPut, {}, config) | ||
.then((response) =>{ | ||
if (response.status == 200 ) { | ||
this.$router.push('/front/'); | ||
} | ||
}).catch((err) =>{ | ||
}) | ||
} | ||
}, | ||
mounted() { | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.