feat(accounts): add account tab and modal creation
This commit is contained in:
88
src/components/MesComptes.vue
Normal file
88
src/components/MesComptes.vue
Normal 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>
|
||||
@@ -11,7 +11,7 @@ export const getAccounts = (oauthToken, userId) => {
|
||||
const headers = {
|
||||
"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) => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import VueAxios from 'vue-axios'
|
||||
import '@/assets/css/style.css'
|
||||
|
||||
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/dist/css/bootstrap.css'
|
||||
@@ -33,3 +33,6 @@ new Vue({
|
||||
Vue.use(BootstrapVue)
|
||||
// Optionally install the BootstrapVue icon components plugin
|
||||
Vue.use(IconsPlugin)
|
||||
|
||||
Vue.use(BootstrapVueIcons)
|
||||
Vue.use(ModalPlugin)
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed">
|
||||
<div>
|
||||
<b-navbar toggleable="lg" type="dark" variant="info" fixed="fixed">
|
||||
<!-- Right aligned nav items -->
|
||||
<b-navbar-nav >
|
||||
<b-nav-item href="#">Mes comptes</b-nav-item>
|
||||
<b-nav-item href="#">Nos comptes</b-nav-item>
|
||||
</b-navbar-nav>
|
||||
<b-navbar-nav align="end" class="right-element">
|
||||
<b-nav-item-dropdown left dropleft>
|
||||
<!-- Using 'button-content' slot -->
|
||||
<template #button-content>
|
||||
<em>{{ $store.state.loggedUser.firstName}}</em>
|
||||
</template>
|
||||
<b-dropdown-item href="#">Profile</b-dropdown-item>
|
||||
<b-dropdown-item @click="signOut" href="/">Sign Out</b-dropdown-item>
|
||||
</b-nav-item-dropdown>
|
||||
</b-navbar-nav>
|
||||
</b-navbar>
|
||||
<b-navbar-nav>
|
||||
<b-nav-item href="#">Mes comptes</b-nav-item>
|
||||
<b-nav-item href="#">Nos comptes</b-nav-item>
|
||||
</b-navbar-nav>
|
||||
<b-navbar-nav align="end" class="right-element">
|
||||
<b-nav-item-dropdown left dropleft>
|
||||
<!-- Using 'button-content' slot -->
|
||||
<template #button-content>
|
||||
<em>{{ $store.state.loggedUser.firstName }}</em>
|
||||
</template>
|
||||
<b-dropdown-item href="#">Profile</b-dropdown-item>
|
||||
<b-dropdown-item @click="signOut" href="/">Sign Out</b-dropdown-item>
|
||||
</b-nav-item-dropdown>
|
||||
</b-navbar-nav>
|
||||
</b-navbar>
|
||||
</div>
|
||||
<div>
|
||||
<MesComptes></MesComptes>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import MesComptes from '@/components/MesComptes'
|
||||
import router from '@/router/router'
|
||||
import {BDropdownItem, BNavbar, BNavbarNav, BNavItem, BNavItemDropdown} from "bootstrap-vue";
|
||||
|
||||
@@ -32,13 +37,14 @@ export default {
|
||||
BNavbarNav,
|
||||
BNavItem,
|
||||
BNavItemDropdown,
|
||||
BDropdownItem
|
||||
BDropdownItem,
|
||||
MesComptes
|
||||
},
|
||||
methods: {
|
||||
signOut() {
|
||||
this.$gAuth
|
||||
.signOut()
|
||||
.then( () => {
|
||||
.then(() => {
|
||||
this.$store.commit("deleteLoginUser")
|
||||
router.push("/login")
|
||||
})
|
||||
@@ -53,6 +59,7 @@ export default {
|
||||
margin-left: auto;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.right-element .dropdown-menu {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user