Compare commits
No commits in common. "8ea8574f3fa3a9dd8976c1d5d374b48b96f650b6" and "efd337b6ce30a6f3c806c420bde930edd8b1cd86" have entirely different histories.
8ea8574f3f
...
efd337b6ce
4 changed files with 5 additions and 73 deletions
|
|
@ -36,7 +36,7 @@ func listPlans(c *gin.Context) {
|
||||||
if u == nil {
|
if u == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
plans, err := u.ListPlans(db)
|
plans, err := u.GetPlans(db)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
c.JSON(http.StatusOK, plans)
|
c.JSON(http.StatusOK, plans)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (u *User) ListPlans(orm *gorm.DB) ([]Plan, error) {
|
func (u *User) GetPlans(orm *gorm.DB) ([]Plan, error) {
|
||||||
var plans []Plan
|
var plans []Plan
|
||||||
err := orm.Debug().Table("plans p").
|
err := orm.Debug().Table("plans p").
|
||||||
Select("p.*").
|
Select("p.*").
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,7 @@ import router from './router';
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core';
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||||
import {
|
import { faGear, faPenToSquare, faCheck, faPlus, faFloppyDisk, faTrash, faEye } from '@fortawesome/free-solid-svg-icons';
|
||||||
faGear,
|
|
||||||
faPenToSquare,
|
|
||||||
faCheck,
|
|
||||||
faPlus,
|
|
||||||
faFloppyDisk,
|
|
||||||
faTrash,
|
|
||||||
faEye,
|
|
||||||
faXmark
|
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
|
||||||
|
|
||||||
library.add(faGear);
|
library.add(faGear);
|
||||||
library.add(faPenToSquare);
|
library.add(faPenToSquare);
|
||||||
|
|
@ -26,7 +17,6 @@ library.add(faPlus);
|
||||||
library.add(faFloppyDisk);
|
library.add(faFloppyDisk);
|
||||||
library.add(faTrash);
|
library.add(faTrash);
|
||||||
library.add(faEye);
|
library.add(faEye);
|
||||||
library.add(faXmark);
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,7 @@ const plan_name = ref('');
|
||||||
const organizer = ref('');
|
const organizer = ref('');
|
||||||
const description = ref('');
|
const description = ref('');
|
||||||
|
|
||||||
const members = ref([]);
|
|
||||||
const polls = ref([]);
|
const polls = ref([]);
|
||||||
const newPoll = ref(false);
|
|
||||||
const membersShown = ref(false);
|
|
||||||
|
|
||||||
fetch('/api/plans/' + plan_id, {
|
fetch('/api/plans/' + plan_id, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -30,13 +27,6 @@ fetch('/api/plans/' + plan_id, {
|
||||||
description.value = x.description;
|
description.value = x.description;
|
||||||
})
|
})
|
||||||
|
|
||||||
fetch('/api/plans/' + plan_id + '/members', {
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Basic ' + btoa(account.account + ':')
|
|
||||||
}
|
|
||||||
}).then(x => x.json())
|
|
||||||
.then(x => members.value = x);
|
|
||||||
|
|
||||||
fetch('/api/plans/' + plan_id + '/polls', {
|
fetch('/api/plans/' + plan_id + '/polls', {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Basic ' + btoa(account.account + ':')
|
'Authorization': 'Basic ' + btoa(account.account + ':')
|
||||||
|
|
@ -45,22 +35,6 @@ fetch('/api/plans/' + plan_id + '/polls', {
|
||||||
.then(x => {
|
.then(x => {
|
||||||
polls.value = x;
|
polls.value = x;
|
||||||
});
|
});
|
||||||
|
|
||||||
function openDialog() {
|
|
||||||
newPoll.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeDialog() {
|
|
||||||
newPoll.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showMembers() {
|
|
||||||
membersShown.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideMembers() {
|
|
||||||
membersShown.value = false;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -70,43 +44,11 @@ function hideMembers() {
|
||||||
<h1 class="text-xl my-4">Plan {{ plan_name }}</h1>
|
<h1 class="text-xl my-4">Plan {{ plan_name }}</h1>
|
||||||
<h2>Organizado por {{ organizer }}</h2>
|
<h2>Organizado por {{ organizer }}</h2>
|
||||||
<p>{{ description }}</p>
|
<p>{{ description }}</p>
|
||||||
<p class="cursor-pointer" @click="showMembers()">{{ members.length }} participantes</p>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div class="flex flex-col my-4" v-if="membersShown">
|
<div class="flex flex-col my-4 p-4">
|
||||||
<h1 class="p-4 bg-gray-700 rounded-t-xl text-lg grow flex flex-row items-center">
|
<h1 class="p-4 bg-gray-700 rounded-t-xl text-lg">Polls</h1>
|
||||||
<span class="grow">Members</span>
|
|
||||||
<button @click="hideMembers()"><font-awesome-icon :icon="['fas', 'xmark']" /></button>
|
|
||||||
</h1>
|
|
||||||
<div class="p-4 bg-gray-800 rounded-b-xl">
|
<div class="p-4 bg-gray-800 rounded-b-xl">
|
||||||
<div class="flex items-center my-1" v-for="member in members">
|
|
||||||
<img class="w-6 h-6 border">
|
|
||||||
<span class="px-2 grow">{{ member.name || member.username }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col my-4">
|
|
||||||
<h1 class="p-4 bg-gray-700 rounded-t-xl text-lg grow">Schedule</h1>
|
|
||||||
<div class="p-4 bg-gray-800 rounded-b-xl"></div>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col my-4">
|
|
||||||
<h1 class="p-4 bg-gray-700 rounded-t-xl text-lg grow">Expenses</h1>
|
|
||||||
<div class="p-4 bg-gray-800 rounded-b-xl"></div>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col my-4">
|
|
||||||
<h1 class="p-4 bg-gray-700 rounded-t-xl text-lg grow flex">
|
|
||||||
<span class="grow">Polls</span>
|
|
||||||
<button @click="openDialog()">
|
|
||||||
<font-awesome-icon :icon="['fas', 'plus']" />
|
|
||||||
</button>
|
|
||||||
</h1>
|
|
||||||
<div class="p-4 bg-gray-800 rounded-b-xl">
|
|
||||||
<div class="b" v-if="newPoll">
|
|
||||||
Hello
|
|
||||||
<button @click="closeDialog()">
|
|
||||||
<font-awesome-icon :icon="['fas', 'plus']" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<PollList :polls="polls" />
|
<PollList :polls="polls" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue