Skip to content

Commit dcc4b7b

Browse files
authored
feat: payments extension (#42)
* feat: safe error page * feat: better error messages * feat: add payments extension * clean * fix: addpayments extension * fix: install payments * feat: add relation options to M2M creator * feat: payments schema * feat: membership payments fields * feat: add payment fields to directus_user * feat: add example data * feat: add permissions * feat!: improve dependency logic * feat: add profile fields * fix: logout also directus * fix: editor persmissions * fix: registration form * release: v0.1.1
1 parent 6b261c0 commit dcc4b7b

48 files changed

Lines changed: 13745 additions & 96 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ KEYCLOAK_ADMIN_PASSWORD = 'admin'
1717
KEYCLOAK_DB_PASSWORD = 'changeme'
1818

1919
NUXT_API_TOKEN = "badToken"
20+
NUXT_PUBLIC_DEBUG = "false"
2021
NUXT_PUBLIC_COLLECTIVO_URL = "http://localhost:3000"
2122

2223
NUXT_KEYCLOAK_ADMIN_CLIENT = "admin-cli"

collectivo/app/nuxt.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
export default defineNuxtConfig({
33
devtools: { enabled: true },
44
ssr: false,
5-
extends: ["@collectivo/collectivo", "@collectivo/memberships"],
5+
extends: [
6+
"@collectivo/collectivo",
7+
"@collectivo/payments",
8+
"@collectivo/memberships",
9+
],
610
i18n: {
711
lazy: true,
812
langDir: "./lang",

collectivo/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"dependencies": {
1616
"@collectivo/collectivo": "workspace:*",
17-
"@collectivo/memberships": "workspace:*"
17+
"@collectivo/memberships": "workspace:*",
18+
"@collectivo/payments": "workspace:*"
1819
},
1920
"devDependencies": {
2021
"@nuxt/devtools": "^1.0.6",

collectivo/collectivo/components/collectivo/form/Builder.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { FormErrorEvent, FormSubmitEvent } from "#ui/types";
1313
1414
const toast = useToast();
1515
const { t } = useI18n();
16-
const debug = true;
16+
const debug = useRuntimeConfig().public.debug;
1717
1818
const props = defineProps({
1919
fields: Object as PropType<CollectivoFormField[]>,
@@ -22,6 +22,7 @@ const props = defineProps({
2222
submitLabel: String,
2323
});
2424
25+
console.log("data", props.data);
2526
const form = { fields: props.fields ?? [] };
2627
const loading = ref(false);
2728
@@ -178,6 +179,7 @@ for (const input of form.fields) {
178179
addInputToSchema(input.key, input, boolean());
179180
}
180181
182+
// Add passed data or default value to field
181183
if (props.data?.[input.key]) {
182184
state[input.key] = props.data[input.key];
183185
} else if ("default" in input && input.default) {
@@ -423,15 +425,16 @@ async function fillOutAll() {
423425
class="mx-2 my-10 p-6 rounded-lg bg-slate-100 flex flex-col gap-2"
424426
>
425427
<div>
426-
DEBUG Tools. <br />
427-
You are seeing this because NUXT_DEBUG=True
428+
<h3>Debug Tools</h3>
429+
<p>You are seeing this because NUXT_PUBLIC_DEBUG=True</p>
428430
</div>
429431
<div>
430432
<UButton class="btn" @click="fillOutAll">
431433
{{ t("Fill out all") }}
432434
</UButton>
433435
</div>
434-
<div class="text-sm">Form state: {{ state }}</div>
436+
<h4>Form state</h4>
437+
<div class="text-sm">{{ state }}</div>
435438
</div>
436439
</template>
437440

@@ -448,6 +451,10 @@ async function fillOutAll() {
448451
@apply form-field basis-full;
449452
}
450453
454+
.form-field-half {
455+
@apply form-field basis-full md:basis-1/2;
456+
}
457+
451458
.form-field-xl {
452459
@apply form-field basis-full xl:basis-1/2;
453460
}

collectivo/collectivo/components/collectivo/form/Page.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { FetchError } from "ofetch";
33
44
const toast = useToast();
55
const { t } = useI18n();
6-
const debug = true;
6+
const debug = useRuntimeConfig().public.debug;
77
const submitted = ref(false);
88
99
const props = defineProps({

collectivo/collectivo/composables/user.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CollectivoUserStore {
3333

3434
this.data = (await $directus?.request(
3535
readMe({
36-
fields: ["id", "first_name", "last_name", "email"],
36+
// fields: ["id", "first_name", "last_name", "email"],
3737
}),
3838
)) as CollectivoUser;
3939

@@ -76,6 +76,8 @@ class CollectivoUserStore {
7676

7777
async logout() {
7878
const runtimeConfig = useRuntimeConfig();
79+
const directus = useDirectus();
80+
await directus.logout();
7981

8082
if (runtimeConfig.public.authService === "keycloak") {
8183
const logoutPath = `${runtimeConfig.public.keycloakUrl}/realms/collectivo/protocol/openid-connect/logout`;

collectivo/collectivo/nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineNuxtConfig({
1616
keycloakAdminClient: "admin-cli",
1717
keycloakAdminSecret: "**********",
1818
public: {
19+
debug: false,
1920
collectivoUrl: "http://localhost:3000",
2021
authService: "keycloak",
2122
keycloakUrl: "http://keycloak:8080",

collectivo/collectivo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@collectivo/collectivo",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Collectivo is a module system for community plattforms.",
55
"type": "module",
66
"license": "AGPL-3.0",

collectivo/collectivo/pages/profile.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async function saveProfile(data: CollectivoUser) {
4848
:data="user.data"
4949
:fields="user.fields"
5050
:submit="saveProfile"
51+
submit-label="Save"
5152
/>
5253
</CollectivoContainer>
5354
<CollectivoContainer>

collectivo/collectivo/plugins/setup.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,30 @@ export default defineNuxtPlugin(() => {
4545
menu.value.public.push(...publicItems);
4646

4747
const profileInputs: CollectivoFormField[] = [
48+
{
49+
type: "section",
50+
order: 100,
51+
title: "Account details",
52+
},
4853
{
4954
label: "First name",
5055
key: "first_name",
5156
type: "text",
52-
order: 1,
57+
order: 101,
5358
disabled: true,
5459
},
5560
{
5661
label: "Last name",
5762
key: "last_name",
5863
type: "text",
59-
order: 2,
64+
order: 102,
6065
disabled: true,
6166
},
6267
{
6368
label: "Email",
6469
key: "email",
6570
type: "text",
66-
order: 3,
71+
order: 103,
6772
disabled: true,
6873
},
6974
];

0 commit comments

Comments
 (0)