feat(accounts): add account tab and modal creation

This commit is contained in:
2021-11-05 00:53:09 +01:00
parent a169862311
commit a929561c63
4 changed files with 119 additions and 21 deletions

View File

@@ -0,0 +1,88 @@
<template>
<div class="accounts-tab">
<b-card no-body>
<b-tabs card>
<b-tab title="Mes comptes" active>
<b-card @click="show('modal-1')"
class="mb-2 account-card d-flex flex-row"
>
<b-card-title class="p-2">
Ajouter un compte
<b-icon-plus-circle-fill style="color:green"></b-icon-plus-circle-fill>
</b-card-title>
</b-card>
<b-card v-for="account in accounts" :key="account.name"
:title=account.name
class="mb-2 account-card"
>
<b-card-text>
{{account.name}}
</b-card-text>
<b-button href="#" variant="primary">Voir mon compte</b-button>
</b-card>
</b-tab>
</b-tabs>
</b-card>
<b-modal ref="my-modal" id="modal-1" title="BootstrapVue">
<p class="my-4">Hello from modal!</p>
</b-modal>
</div>
</template>
<script>
import {BCard, BTabs, BTab, BCardText, BCardTitle, BIconPlusCircleFill, BModal} from "bootstrap-vue";
import {getAccounts} from "@/config/noscomptes";
export default {
name: 'mes_comptes',
data: function () {
return {
accounts: 0
}
},
beforeCreate() {
let loggedUser = this.$store.state.loggedUser
getAccounts(loggedUser.oauth_token, loggedUser.nosComptesId).then(data => {
this.$store.commit('userAccounts', data)
})
},
mounted () {
},
methods: {
show() {
this.$refs['my-modal'].show()
}
},
components: {
BCard,
BTabs,
BTab,
BCardText,
BCardTitle,
BIconPlusCircleFill,
BModal
}
}
</script>
<style>
.accounts-tab {
margin: 2% 3% 0 3%;
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{
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);
}
.account-card .card-body {
text-align: center;
align-self: center;
}
</style>

View File

@@ -11,7 +11,7 @@ export const getAccounts = (oauthToken, userId) => {
const headers = { const headers = {
"Authorization": "Bearer "+oauthToken "Authorization": "Bearer "+oauthToken
}; };
return Vue.axios.get("http://localhost:8081/users/"+userId+"/accountsgc", {headers}).then(response => {console.log(response);return response.data}) return Vue.axios.get("http://localhost:8081/users/"+userId+"/accounts", {headers}).then(response => {console.log(response);return response.data})
} }
export const getSharedAccounts = (oauthToken, userId) => { export const getSharedAccounts = (oauthToken, userId) => {

View File

@@ -8,7 +8,7 @@ import VueAxios from 'vue-axios'
import '@/assets/css/style.css' import '@/assets/css/style.css'
import GoogleAuth from '@/config/google_oAuth.js' import GoogleAuth from '@/config/google_oAuth.js'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' import { BootstrapVue, IconsPlugin , BootstrapVueIcons, ModalPlugin} from 'bootstrap-vue'
// Import Bootstrap an BootstrapVue CSS files (order is important) // Import Bootstrap an BootstrapVue CSS files (order is important)
import 'bootstrap/dist/css/bootstrap.css' import 'bootstrap/dist/css/bootstrap.css'
@@ -33,3 +33,6 @@ new Vue({
Vue.use(BootstrapVue) Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon components plugin // Optionally install the BootstrapVue icon components plugin
Vue.use(IconsPlugin) Vue.use(IconsPlugin)
Vue.use(BootstrapVueIcons)
Vue.use(ModalPlugin)

View File

@@ -1,4 +1,5 @@
<template> <template>
<div>
<div> <div>
<b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed"> <b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed">
<!-- Right aligned nav items --> <!-- Right aligned nav items -->
@@ -18,10 +19,14 @@
</b-navbar-nav> </b-navbar-nav>
</b-navbar> </b-navbar>
</div> </div>
<div>
<MesComptes></MesComptes>
</div>
</div>
</template> </template>
<script> <script>
import MesComptes from '@/components/MesComptes'
import router from '@/router/router' import router from '@/router/router'
import {BDropdownItem, BNavbar, BNavbarNav, BNavItem, BNavItemDropdown} from "bootstrap-vue"; import {BDropdownItem, BNavbar, BNavbarNav, BNavItem, BNavItemDropdown} from "bootstrap-vue";
@@ -32,7 +37,8 @@ export default {
BNavbarNav, BNavbarNav,
BNavItem, BNavItem,
BNavItemDropdown, BNavItemDropdown,
BDropdownItem BDropdownItem,
MesComptes
}, },
methods: { methods: {
signOut() { signOut() {
@@ -53,6 +59,7 @@ export default {
margin-left: auto; margin-left: auto;
padding-right: 10px; padding-right: 10px;
} }
.right-element .dropdown-menu { .right-element .dropdown-menu {
right: 0px; right: 0px;
} }