add joint account
This commit is contained in:
@@ -108,9 +108,9 @@
|
||||
|
||||
<script>
|
||||
import {BCard, BTabs, BTable, BButton, BTab, BCardText, BCardTitle, BIconPlusCircleFill, BModal, BFormGroup, BFormInput} from "bootstrap-vue";
|
||||
import {createJointAccount, getJointAccounts, deleteAnJointAccount} from "@/service/noscomptes";
|
||||
import {createJointAccount, getJointAccounts, deleteAJointAccount} from "@/service/jointAccount";
|
||||
export default {
|
||||
name: 'notre_compte',
|
||||
name: 'joint_account',
|
||||
data: function () {
|
||||
return {
|
||||
loggedUser: this.$store.state.loggedUser,
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
methods: {
|
||||
deleteJointAccount(){
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
deleteAnJointAccount(loggedUser.oauth_token, loggedUser.nosComptesId, this.jointAccountIdToDelete).then(() => {
|
||||
deleteAJointAccount(loggedUser.oauth_token, loggedUser.nosComptesId, this.jointAccountIdToDelete).then(() => {
|
||||
this.loadJointAccounts()
|
||||
this.$refs['delete-jointAccount'].hide()
|
||||
})
|
||||
@@ -164,6 +164,7 @@ export default {
|
||||
this.user= ""
|
||||
},
|
||||
validateForm() {
|
||||
console.log("toto")
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
this.nameState= undefined
|
||||
createJointAccount(loggedUser.oauth_token, loggedUser.nosComptesId, {"name": this.name})
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
<template>
|
||||
<div class="accounts-tab">
|
||||
<b-card no-body>
|
||||
<b-tabs card>
|
||||
<b-tab title="Notre compte" active>
|
||||
<b-card style="display: inline-block;"
|
||||
class="mb-2 account-card account-add"
|
||||
>
|
||||
<b-card-title>
|
||||
<br>
|
||||
</b-card-title>
|
||||
<b-card-text>
|
||||
<br>
|
||||
</b-card-text>
|
||||
<b-button href="#" variant="success" v-on:click="show()" >Ajouter un compte commun<b-icon-plus-circle-fill style="color:green"></b-icon-plus-circle-fill></b-button>
|
||||
|
||||
</b-card>
|
||||
<b-card style="display: inline-block;" v-for="account in accounts" :key="account.id"
|
||||
:title=account.name
|
||||
class="mb-2 account-card"
|
||||
>
|
||||
<b-card-text>
|
||||
{{account.name}}
|
||||
</b-card-text>
|
||||
<b-button :href="'/account/'+account.id" variant="primary" class="see-account" >Voir</b-button>
|
||||
<b-button href="#" variant="danger" v-on:click="validateDeleteAccount(account.id)">Supprimer</b-button>
|
||||
|
||||
</b-card>
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
<b-modal ref="delete-account" size="lg" centered title="">
|
||||
<template #modal-header="{ }">
|
||||
</template>
|
||||
<template #default="{ }">
|
||||
<p>Etes vous sûr ?</p>
|
||||
</template>
|
||||
|
||||
<template #modal-footer="{ ok, cancel }">
|
||||
<b-button size="sm" variant="danger" @click="deleteAccount()">
|
||||
Supprimer
|
||||
</b-button>
|
||||
<!-- Button with custom close trigger value -->
|
||||
<b-button size="sm" variant="outline-secondary" @click="show=cancel()">
|
||||
Annuler
|
||||
</b-button>
|
||||
</template>
|
||||
</b-modal>
|
||||
<b-modal ref="create-account" size="lg" centered title="">
|
||||
<template #modal-header="{ }">
|
||||
<h5>Ajout d'un compte</h5>
|
||||
</template>
|
||||
<template #modal-footer="{ ok, cancel }">
|
||||
<b-button size="sm" variant="success" @click="validateForm()">
|
||||
Créer
|
||||
</b-button>
|
||||
<b-button size="sm" variant="danger" @click="cancel()">
|
||||
Fermer
|
||||
</b-button>
|
||||
</template>
|
||||
<form ref="form" @submit.stop.prevent="handleSubmit">
|
||||
<b-form-group
|
||||
label="Name"
|
||||
label-for="name-input"
|
||||
invalid-feedback="Le nom du compte est requis"
|
||||
:state="nameState"
|
||||
>
|
||||
<b-form-input
|
||||
id="name-input"
|
||||
v-model="name"
|
||||
:state="nameState"
|
||||
required
|
||||
></b-form-input>
|
||||
</b-form-group>
|
||||
<b-form-group
|
||||
label="Banque"
|
||||
label-for="provider-input"
|
||||
invalid-feedback="La banque est requise"
|
||||
:state="nameState">
|
||||
<b-form-select v-model="provider" :options="options"></b-form-select>
|
||||
</b-form-group>
|
||||
</form>
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {BCard, BTabs, BButton, BTab, BCardText, BCardTitle, BIconPlusCircleFill, BModal, BFormGroup, BFormSelect, BFormInput} from "bootstrap-vue";
|
||||
import {createAccount, getAccounts, deleteAnAccount} from "@/service/noscomptes";
|
||||
export default {
|
||||
name: 'notre_compte',
|
||||
data: function () {
|
||||
return {
|
||||
accounts: [],
|
||||
nameState: undefined,
|
||||
name: "",
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
getAccounts(loggedUser.oauth_token, loggedUser.nosComptesId).then(data => {
|
||||
// this.$store.commit('userAccounts', data)
|
||||
this.accounts = data
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
methods: {
|
||||
deleteAccount(){
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
deleteAnAccount(loggedUser.oauth_token, loggedUser.nosComptesId, this.accountIdToDelete).then(() => {
|
||||
this.loadAccounts()
|
||||
this.$refs['delete-account'].hide()
|
||||
})
|
||||
},
|
||||
loadAccounts() {
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
getAccounts(loggedUser.oauth_token, loggedUser.nosComptesId).then(data => {
|
||||
// this.$store.commit('userAccounts', data)
|
||||
this.accounts = data
|
||||
})
|
||||
},
|
||||
validateForm() {
|
||||
let loggedUser = this.$store.state.loggedUser
|
||||
this.nameState= undefined
|
||||
createAccount(loggedUser.oauth_token, loggedUser.nosComptesId, {"name": this.name, "provider": this.provider})
|
||||
.then(() => {
|
||||
this.$refs['create-account'].hide();
|
||||
this.nameState= undefined
|
||||
this.loadAccounts()
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.response.status != 409) {
|
||||
this.$refs['create-account'].hide()
|
||||
} else {
|
||||
this.nameState= false
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
validateDeleteAccount(accountId) {
|
||||
this.accountIdToDelete = accountId
|
||||
this.$refs['delete-account'].show()
|
||||
},
|
||||
show() {
|
||||
this.$refs['create-account'].show()
|
||||
}
|
||||
},
|
||||
components: {
|
||||
BCard,
|
||||
BButton,
|
||||
BTabs,
|
||||
BTab,
|
||||
BCardText,
|
||||
BCardTitle,
|
||||
BIconPlusCircleFill,
|
||||
BModal,
|
||||
BFormGroup,
|
||||
BFormSelect,
|
||||
BFormInput
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.accounts-tab {
|
||||
margin: 2% 1% 0 1%;
|
||||
box-shadow: 0px 0px 7px 2px rgba(119, 119, 119, 0.7);
|
||||
-moz-box-shadow: 0px 0px 7px 2px rgba(119, 119, 119, 0.7);
|
||||
-webkit-box-shadow: 0px 0px 7px 2px rgba(119, 119, 119, 0.7);
|
||||
}
|
||||
.accounts-tab .account-card{
|
||||
margin: 1% 0% 1% 1%;
|
||||
width: 20rem;
|
||||
height: 20rem;
|
||||
box-shadow: 0px 0px 3px 0px rgba(119, 119, 119, 0.4);
|
||||
-moz-box-shadow: 0px 0px 3px 0px rgba(119, 119, 119, 0.4);
|
||||
-webkit-box-shadow: 0px 0px 3px 0px rgba(119, 119, 119, 0.4);
|
||||
}
|
||||
.accounts-tab .account-card a.btn svg{
|
||||
margin: 0 0 0 10px;
|
||||
}
|
||||
.accounts-tab .account-card.account-add a.btn {
|
||||
background-color: white;
|
||||
color: black;
|
||||
border-color: black;
|
||||
}
|
||||
.accounts-tab .account-card.account-add:hover {
|
||||
background-color: green;
|
||||
}
|
||||
.accounts-tab .account-card.account-add:hover .card-title, .accounts-tab .account-card.account-add:hover .card-title .bi {
|
||||
color:white!important;
|
||||
}
|
||||
.account-card .card-body {
|
||||
text-align: center;
|
||||
align-self: center;
|
||||
}
|
||||
.tab-pane.card-body {
|
||||
margin: 0 1%
|
||||
}
|
||||
.see-account {
|
||||
margin: 0 100px 0 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<script>
|
||||
import router from '@/router/router'
|
||||
import {logWithGoogle, getAccounts, getSharedAccounts} from '@/service/noscomptes'
|
||||
import {logWithGoogle, getAccounts} from '@/service/noscomptes'
|
||||
export default {
|
||||
name: 'login_signup_social',
|
||||
mounted () {
|
||||
@@ -36,10 +36,7 @@ export default {
|
||||
getAccounts(userInfo.oauth_token, userInfo.nosComptesId).then(data => {
|
||||
this.$store.commit('userAccounts', data)
|
||||
})
|
||||
getSharedAccounts(userInfo.oauth_token, userInfo.nosComptesId).then(data => {
|
||||
this.$store.commit('userSharedAccounts', data)
|
||||
})
|
||||
router.push('/')
|
||||
router.push('/')
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('error', error)
|
||||
|
||||
Reference in New Issue
Block a user