@bagelink/vue 0.0.218 → 0.0.226-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AccordionItem.vue.d.ts +23 -0
- package/dist/components/AccordionItem.vue.d.ts.map +1 -0
- package/dist/components/Avatar.vue.d.ts +20 -0
- package/dist/components/Avatar.vue.d.ts.map +1 -0
- package/dist/components/Card.vue.d.ts +27 -0
- package/dist/components/Card.vue.d.ts.map +1 -0
- package/dist/components/DataPreview.vue.d.ts +18 -18
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalBglForm.vue.d.ts +50 -31
- package/dist/components/ModalBglForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts +17 -12
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts +5 -4
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Title.vue.d.ts +31 -0
- package/dist/components/Title.vue.d.ts.map +1 -0
- package/dist/components/form/BglField.vue.d.ts +19 -5
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +38 -27
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/index.d.ts +0 -3
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +36 -38
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts +25 -15
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +37 -0
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts +46 -0
- package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/index.d.ts +2 -3
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/formkit/index.d.ts +1 -2
- package/dist/components/formkit/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +5 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +14523 -13691
- package/dist/index.mjs +14524 -13692
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +1 -3
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +744 -404
- package/dist/types/BagelForm.d.ts +8 -0
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/components/AccordionItem.vue +100 -0
- package/src/components/Avatar.vue +47 -0
- package/src/components/Card.vue +13 -0
- package/src/components/Comments.vue +75 -75
- package/src/components/ContactArray.vue +10 -39
- package/src/components/DataPreview.vue +22 -49
- package/src/components/{DropDown.vue → Drop.vue} +55 -29
- package/src/components/FormKitTable.vue +121 -125
- package/src/components/Modal.vue +6 -23
- package/src/components/ModalBglForm.vue +10 -24
- package/src/components/NavBar.vue +33 -17
- package/src/components/RTXEditor.vue +69 -69
- package/src/components/TableSchema.vue +26 -72
- package/src/components/Title.vue +19 -0
- package/src/components/form/BglField.vue +29 -26
- package/src/components/form/BglForm.vue +19 -14
- package/src/components/form/index.ts +0 -3
- package/src/components/form/inputs/CheckInput.vue +20 -18
- package/src/components/form/inputs/DateInput.vue +16 -34
- package/src/components/form/inputs/FileUpload.vue +139 -19
- package/src/components/form/inputs/SelectField.vue +80 -138
- package/src/components/form/inputs/SelectInput.vue +517 -0
- package/src/components/form/inputs/TableField.vue +1 -5
- package/src/components/form/inputs/index.ts +2 -3
- package/src/components/formkit/index.ts +0 -3
- package/src/components/index.ts +5 -4
- package/src/plugins/bagel.ts +2 -2
- package/src/plugins/modal.ts +7 -13
- package/src/styles/inputs.css +2 -2
- package/src/styles/layout.css +1 -1
- package/src/styles/modal.css +3 -2
- package/src/styles/theme.css +7 -6
- package/src/types/BagelForm.ts +5 -0
- package/src/types/index.ts +1 -1
- package/src/utils/index.ts +26 -6
- package/src/components/ContactSubmissions.vue +0 -45
- package/src/components/PersonPreview.vue +0 -199
- package/src/components/PersonPreviewFormkit.vue +0 -178
- package/src/components/form/ItemRef.vue +0 -44
- package/src/components/form/MaterialIcon.vue +0 -19
- package/src/components/form/PlainInputField.vue +0 -79
- package/src/components/form/inputs/DynamicLinkField.vue +0 -137
- package/src/components/form/inputs/EmailInput.vue +0 -58
- package/src/types/Person.ts +0 -51
package/src/styles/layout.css
CHANGED
package/src/styles/modal.css
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
pointer-events: none;
|
|
13
13
|
opacity: 0;
|
|
14
14
|
transition: all ease-in-out 0.3s;
|
|
15
|
+
overflow: auto;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.modal {
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
transform: scale(0.5);
|
|
21
22
|
opacity: 0;
|
|
22
23
|
transition: all ease-in-out 0.15s;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
margin-top: 6rem;
|
|
25
|
+
margin-bottom: 4rem;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.small-modal .modal {
|
package/src/styles/theme.css
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
--bgl-yellow: #ffbb00;
|
|
25
25
|
--bgl-yellow-light: #fff6d5;
|
|
26
26
|
--bgl-green: #75c98f;
|
|
27
|
-
--border-color: #
|
|
27
|
+
--border-color: #00000020;
|
|
28
28
|
--bgl-bg: #f4f6fa;
|
|
29
29
|
--bgl-shadow: #4c577d26;
|
|
30
30
|
--whatsapp-gray: #89959f;
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
--whatsapp-blue: #71bce6;
|
|
33
33
|
--input-border-radius: 7px;
|
|
34
34
|
--card-border-radius: 15px;
|
|
35
|
-
--
|
|
36
|
-
--btn-padding: 30px;
|
|
37
|
-
--input-bg: #f5f8fa;
|
|
35
|
+
--placeholder-color: #00000040;
|
|
38
36
|
--label-color: #00000080;
|
|
37
|
+
--label-font-size: 12px;
|
|
38
|
+
--input-bg: #f5f8fa;
|
|
39
39
|
--input-color: #000000;
|
|
40
|
-
--placeholder-color: #00000040;
|
|
41
40
|
--input-height: 40px;
|
|
41
|
+
--input-font-size: 14px;
|
|
42
|
+
--btn-border-radius: 10px;
|
|
43
|
+
--btn-padding: 30px;
|
|
42
44
|
--btn-height: 40px;
|
|
43
|
-
--input-font-size: 12px;
|
|
44
45
|
--bgl-transition: all 200ms ease;
|
|
45
46
|
--bgl-hover-filter: brightness(90%);
|
|
46
47
|
--bgl-active-filter: brightness(70%);
|
package/src/types/BagelForm.ts
CHANGED
|
@@ -12,9 +12,14 @@ export type Field<T = Record<string, any>> = {
|
|
|
12
12
|
label?: string;
|
|
13
13
|
placeholder?: string;
|
|
14
14
|
children?: Field<T>[];
|
|
15
|
+
class?: AttributeValue | AttributeFn<T>,
|
|
16
|
+
options?: string | ({ label: string; value: string | number }|string|number)[],
|
|
15
17
|
attrs?: Attributes<T>;
|
|
16
18
|
required?: boolean;
|
|
17
19
|
hint?: string;
|
|
20
|
+
defaultValue?: any;
|
|
21
|
+
transform?: (val?: any, rowData?:Record<string, any>) => any;
|
|
22
|
+
onUpdate?: (val: any, fieldData?:any, rowData?:Record<string, any>) => void;
|
|
18
23
|
'v-if'?: string | boolean | ((val: any, row: T) => boolean);
|
|
19
24
|
}
|
|
20
25
|
|
package/src/types/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { MaterialIcons } from './materialIcons';
|
|
2
|
-
export type { BankDetailsInterface, NewPerson, Person } from './Person';
|
|
3
2
|
export type { Tables, TableToTypeMapping } from '@bagelink/sdk';
|
|
4
3
|
export type { StorageFile } from './file';
|
|
4
|
+
export type { NavLink } from '../components/NavBar.vue';
|
|
5
5
|
|
|
6
6
|
export * from './BtnOptions';
|
|
7
7
|
export * from './BagelForm';
|
package/src/utils/index.ts
CHANGED
|
@@ -7,10 +7,9 @@ export const debounce = (fn: () => void, delay = 500) => {
|
|
|
7
7
|
timeout = setTimeout(fn, delay);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const keyToLabel = (key
|
|
11
|
-
.split('_')
|
|
10
|
+
export const keyToLabel = (key?: string): string | undefined => key?.split('_')
|
|
12
11
|
.map((k) => k.charAt(0).toUpperCase() + k.slice(1))
|
|
13
|
-
.join(' ');
|
|
12
|
+
.join(' ') || key;
|
|
14
13
|
|
|
15
14
|
export const copyText = async (
|
|
16
15
|
text: string,
|
|
@@ -26,7 +25,10 @@ export const useFormkit = () => {
|
|
|
26
25
|
return formkit;
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
export const initials = (...strArr: string[]) =>
|
|
28
|
+
export const initials = (...strArr: string[]) => {
|
|
29
|
+
strArr = strArr.map((str) => str.split(/\s/)).flat();
|
|
30
|
+
return strArr.map((str) => str?.charAt(0)).join('');
|
|
31
|
+
};
|
|
30
32
|
|
|
31
33
|
export function useEscape(event: KeyboardEvent, closeModel: () => void) {
|
|
32
34
|
if (event.key === 'Escape') {
|
|
@@ -34,8 +36,17 @@ export function useEscape(event: KeyboardEvent, closeModel: () => void) {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
export function
|
|
38
|
-
|
|
39
|
+
export function classify(fieldVal?: any, row?: any, ...classes: any[]) {
|
|
40
|
+
return classes.map((cls) => {
|
|
41
|
+
if (typeof cls === 'function') return cls(fieldVal, row);
|
|
42
|
+
return cls;
|
|
43
|
+
}).join(' ');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function bindAttrs<T = Record<string, any>>(attrs?: Attributes, fieldVal?: any, row?: T) {
|
|
47
|
+
if (!attrs) return {};
|
|
48
|
+
const exclude = ['class', 'style'];
|
|
49
|
+
const arr = Object.entries(attrs).filter(([key]) => !exclude.includes(key)).map(([key, value]) => [
|
|
39
50
|
key,
|
|
40
51
|
typeof value === 'function' ? value(fieldVal, row) : value,
|
|
41
52
|
]);
|
|
@@ -43,4 +54,13 @@ export function bindAttrs<T = Record<string, any>>(attrs: Attributes, fieldVal:
|
|
|
43
54
|
return resolvedAttrs;
|
|
44
55
|
}
|
|
45
56
|
|
|
57
|
+
export const iffer = (field: any, itemData: any) => {
|
|
58
|
+
if (field['v-if'] && typeof field['v-if'] === 'function') {
|
|
59
|
+
return field['v-if'](field.id ? itemData[field.id] : '', itemData);
|
|
60
|
+
}
|
|
61
|
+
return field['v-if'] || true;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const denullify = (itemData?: Record<string, any>, fieldID?: string) => (fieldID && itemData ? itemData[fieldID] : null);
|
|
65
|
+
|
|
46
66
|
export { formatString } from './strings';
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="card h-100 thin">
|
|
3
|
-
<TableSchema
|
|
4
|
-
:schema="schema"
|
|
5
|
-
:data="data"
|
|
6
|
-
/>
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { onMounted } from 'vue';
|
|
12
|
-
import { TableSchema } from '@bagelink/vue';
|
|
13
|
-
import { useBagel } from '..';
|
|
14
|
-
|
|
15
|
-
const bagel = useBagel();
|
|
16
|
-
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
person_id: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const schema = () => [
|
|
25
|
-
{
|
|
26
|
-
id: 'created_at',
|
|
27
|
-
label: 'Date',
|
|
28
|
-
transform: (value: string) => new Date(value).toLocaleDateString(),
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 'message',
|
|
32
|
-
label: 'Message',
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
let data = $ref<any[]>([]);
|
|
38
|
-
|
|
39
|
-
onMounted(() => {
|
|
40
|
-
const getData = async () => {
|
|
41
|
-
data = await bagel.get(`cms/form-submissions/${props.person_id}`);
|
|
42
|
-
};
|
|
43
|
-
void getData();
|
|
44
|
-
});
|
|
45
|
-
</script>
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
@click="onClick"
|
|
4
|
-
class="person-card"
|
|
5
|
-
v-if="person"
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
class="person-card-edit flex gap-2"
|
|
9
|
-
v-if="!onClick"
|
|
10
|
-
>
|
|
11
|
-
<Btn
|
|
12
|
-
round
|
|
13
|
-
thin
|
|
14
|
-
icon.end="arrow_outward"
|
|
15
|
-
value="Profile"
|
|
16
|
-
v-if="!$route.path.match('/search')"
|
|
17
|
-
is="router-link"
|
|
18
|
-
:to="`/search/${person.id}`"
|
|
19
|
-
/>
|
|
20
|
-
<Btn
|
|
21
|
-
thin
|
|
22
|
-
flat
|
|
23
|
-
@click="showEditForm"
|
|
24
|
-
icon="edit"
|
|
25
|
-
/>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="person-card-icon-wrap">
|
|
28
|
-
<p class="person-card-icon">
|
|
29
|
-
{{ initials(person.first_name, person.last_name) }}
|
|
30
|
-
</p>
|
|
31
|
-
<p class="person-card-name txt20">
|
|
32
|
-
{{ person.first_name }} {{ person.last_name }}
|
|
33
|
-
</p>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="person-card-details-wrap">
|
|
37
|
-
<div
|
|
38
|
-
class="person-card-details"
|
|
39
|
-
v-if="person.phone?.length"
|
|
40
|
-
>
|
|
41
|
-
<MaterialIcon icon="phone" />
|
|
42
|
-
<p
|
|
43
|
-
v-for="phone in person.phone"
|
|
44
|
-
:key="phone.id"
|
|
45
|
-
>
|
|
46
|
-
{{ phone.phone }}
|
|
47
|
-
</p>
|
|
48
|
-
</div>
|
|
49
|
-
<div
|
|
50
|
-
class="person-card-details"
|
|
51
|
-
v-if="person.email?.length"
|
|
52
|
-
>
|
|
53
|
-
<MaterialIcon icon="email" />
|
|
54
|
-
<p
|
|
55
|
-
v-for="email in person.email"
|
|
56
|
-
:key="email.id"
|
|
57
|
-
>
|
|
58
|
-
{{ email.email }}
|
|
59
|
-
</p>
|
|
60
|
-
</div>
|
|
61
|
-
<div
|
|
62
|
-
class="person-card-details badge"
|
|
63
|
-
v-if="person.date_of_birth || person.gender"
|
|
64
|
-
>
|
|
65
|
-
<MaterialIcon icon="badge" />
|
|
66
|
-
<p v-if="person.date_of_birth">
|
|
67
|
-
{{ person.date_of_birth }}
|
|
68
|
-
</p>
|
|
69
|
-
<p v-if="person.gender">
|
|
70
|
-
{{ person.gender }}
|
|
71
|
-
</p>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</template>
|
|
76
|
-
|
|
77
|
-
<script lang="ts" setup>
|
|
78
|
-
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
79
|
-
import type { Person } from '@bagelink/vue';
|
|
80
|
-
import { initials, Btn, MaterialIcon } from '@bagelink/vue';
|
|
81
|
-
import { useBagel, useModal } from '..';
|
|
82
|
-
|
|
83
|
-
// const toast = useToast(); // TODO: use toast
|
|
84
|
-
const bagel = useBagel();
|
|
85
|
-
const { modalForm } = useModal();
|
|
86
|
-
|
|
87
|
-
const props = defineProps<{
|
|
88
|
-
person: Person;
|
|
89
|
-
// eslint-disable-next-line no-unused-vars
|
|
90
|
-
onClick?: (event: MouseEvent) => void;
|
|
91
|
-
personSchema: () => FormKitSchemaDefinition;
|
|
92
|
-
}>();
|
|
93
|
-
|
|
94
|
-
const showEditForm = () => {
|
|
95
|
-
const { first_name, last_name } = props.person;
|
|
96
|
-
modalForm({
|
|
97
|
-
side: true,
|
|
98
|
-
title: `${first_name} ${last_name}`,
|
|
99
|
-
schema: props.personSchema(),
|
|
100
|
-
modelValue: props.person,
|
|
101
|
-
onSubmit: (newPerson) => bagel.put('/person', newPerson),
|
|
102
|
-
// .then(() => toast.success(i18nT('updatedSuccessfully'))),
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
</script>
|
|
106
|
-
<style>
|
|
107
|
-
.person-card {
|
|
108
|
-
border: 1.1px solid var(--border-color);
|
|
109
|
-
/* background: var(--input-bg); */
|
|
110
|
-
border-radius: var(--card-border-radius);
|
|
111
|
-
padding: 1rem;
|
|
112
|
-
margin-bottom: 0.5rem;
|
|
113
|
-
font-size: 1rem;
|
|
114
|
-
position: relative;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.person-card p {
|
|
118
|
-
margin: 0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.person-card-details {
|
|
122
|
-
font-size: 14px;
|
|
123
|
-
margin-bottom: 2px;
|
|
124
|
-
line-height: 1.3;
|
|
125
|
-
display: flex;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.person-card-details p {
|
|
129
|
-
color: var(--input-color);
|
|
130
|
-
opacity: 0.6;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.person-card-details.badge p {
|
|
134
|
-
opacity: 1;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.person-card-details p:nth-child(2) {
|
|
138
|
-
opacity: 1;
|
|
139
|
-
padding-inline-end: 0.5rem;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.person-card-details .icon-font {
|
|
143
|
-
color: var(--bgl-primary);
|
|
144
|
-
padding-inline-end: 0.25rem;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.person-card-edit {
|
|
148
|
-
position: absolute;
|
|
149
|
-
inset-inline-end: 1rem;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.person-card-details-wrap {
|
|
153
|
-
display: flex;
|
|
154
|
-
gap: 0.5rem;
|
|
155
|
-
flex-wrap: wrap;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.person-card-icon {
|
|
159
|
-
background: var(--bgl-gray);
|
|
160
|
-
height: 30px;
|
|
161
|
-
width: 30px;
|
|
162
|
-
border-radius: 100%;
|
|
163
|
-
text-transform: uppercase;
|
|
164
|
-
display: flex;
|
|
165
|
-
justify-content: center;
|
|
166
|
-
align-items: center;
|
|
167
|
-
color: white;
|
|
168
|
-
font-size: 12px;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.person-card-icon-wrap {
|
|
172
|
-
display: flex;
|
|
173
|
-
gap: 0.5rem;
|
|
174
|
-
align-items: center;
|
|
175
|
-
padding-bottom: 0.75rem;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
@media screen and (max-width: 910px) {
|
|
179
|
-
.person-card-icon-wrap {
|
|
180
|
-
padding-bottom: 0.5rem;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.person-card {
|
|
184
|
-
padding: 0.75rem;
|
|
185
|
-
position: relative;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.person-card-edit {
|
|
189
|
-
/* position: relative; */
|
|
190
|
-
inset-inline-end: 0.5rem;
|
|
191
|
-
margin-bottom: 1rem;
|
|
192
|
-
justify-content: flex-end;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.person-card-name {
|
|
196
|
-
max-width: calc(100% - 170px);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
</style>
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div @click="onClick" class="person-card" v-if="person">
|
|
3
|
-
<div class="person-card-edit flex gap-2" v-if="!onClick">
|
|
4
|
-
<Btn
|
|
5
|
-
@click="hideModal"
|
|
6
|
-
round
|
|
7
|
-
thin
|
|
8
|
-
icon.end="arrow_outward"
|
|
9
|
-
value="Profile"
|
|
10
|
-
v-if="!$route.path.match('/search')"
|
|
11
|
-
is="router-link"
|
|
12
|
-
:to="`/search/${person.id}`"
|
|
13
|
-
/>
|
|
14
|
-
<Btn thin flat @click="showEditForm" icon="edit" />
|
|
15
|
-
</div>
|
|
16
|
-
<div class="person-card-icon-wrap">
|
|
17
|
-
<p class="person-card-icon">
|
|
18
|
-
{{ initials(person.first_name, person.last_name) }}
|
|
19
|
-
</p>
|
|
20
|
-
<p class="person-card-name txt20">
|
|
21
|
-
{{ person.first_name }} {{ person.last_name }}
|
|
22
|
-
</p>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="person-card-details-wrap">
|
|
26
|
-
<div class="person-card-details" v-if="person.phone?.length">
|
|
27
|
-
<MaterialIcon icon="phone" />
|
|
28
|
-
<p v-for="phone in person.phone" :key="phone.id">
|
|
29
|
-
{{ phone.phone }}
|
|
30
|
-
</p>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="person-card-details" v-if="person.email?.length">
|
|
33
|
-
<MaterialIcon icon="email" />
|
|
34
|
-
<p v-for="email in person.email" :key="email.id">
|
|
35
|
-
{{ email.email }}
|
|
36
|
-
</p>
|
|
37
|
-
</div>
|
|
38
|
-
<div
|
|
39
|
-
class="person-card-details badge"
|
|
40
|
-
v-if="person.date_of_birth || person.gender"
|
|
41
|
-
>
|
|
42
|
-
<MaterialIcon icon="badge" />
|
|
43
|
-
<p v-if="person.date_of_birth">
|
|
44
|
-
{{ person.date_of_birth }}
|
|
45
|
-
</p>
|
|
46
|
-
<p v-if="person.gender">
|
|
47
|
-
{{ person.gender }}
|
|
48
|
-
</p>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script lang="ts" setup>
|
|
55
|
-
import type { FormKitSchemaDefinition } from "@formkit/core";
|
|
56
|
-
import type { Person } from "@bagelink/vue";
|
|
57
|
-
import { initials, Btn, MaterialIcon } from "@bagelink/vue";
|
|
58
|
-
import { useBagel, useModal } from "..";
|
|
59
|
-
|
|
60
|
-
// const toast = useToast(); // TODO: use toast
|
|
61
|
-
const bagel = useBagel();
|
|
62
|
-
const { modalForm, hideModal } = useModal();
|
|
63
|
-
|
|
64
|
-
const props = defineProps<{
|
|
65
|
-
context: Record<string, any>;
|
|
66
|
-
// eslint-disable-next-line no-unused-vars
|
|
67
|
-
onClick?: (event: MouseEvent) => void;
|
|
68
|
-
personSchema: () => FormKitSchemaDefinition;
|
|
69
|
-
}>();
|
|
70
|
-
|
|
71
|
-
const person = $computed<Person>(() => props.context.value);
|
|
72
|
-
|
|
73
|
-
const showEditForm = async () => {
|
|
74
|
-
const { first_name, last_name } = person;
|
|
75
|
-
modalForm({
|
|
76
|
-
side: true,
|
|
77
|
-
title: `${first_name} ${last_name}`,
|
|
78
|
-
schema: props.personSchema(),
|
|
79
|
-
modelValue: person,
|
|
80
|
-
onSubmit: (newPerson) => bagel.put("/person", newPerson),
|
|
81
|
-
// .then(() => toast.success(i18nT('updatedSuccessfully'))), // TODO: use toast
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
</script>
|
|
85
|
-
<style>
|
|
86
|
-
.person-card {
|
|
87
|
-
border: 1.1px solid var(--border-color);
|
|
88
|
-
/* background: var(--input-bg); */
|
|
89
|
-
border-radius: var(--card-border-radius);
|
|
90
|
-
padding: 1rem;
|
|
91
|
-
margin-bottom: 0.5rem;
|
|
92
|
-
font-size: 1rem;
|
|
93
|
-
position: relative;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.person-card p {
|
|
97
|
-
margin: 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.person-card-details {
|
|
101
|
-
font-size: 14px;
|
|
102
|
-
margin-bottom: 2px;
|
|
103
|
-
line-height: 1.3;
|
|
104
|
-
display: flex;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.person-card-details p {
|
|
108
|
-
color: var(--input-color);
|
|
109
|
-
opacity: 0.6;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.person-card-details.badge p {
|
|
113
|
-
opacity: 1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.person-card-details p:nth-child(2) {
|
|
117
|
-
opacity: 1;
|
|
118
|
-
padding-inline-end: 0.5rem;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.person-card-details .icon-font {
|
|
122
|
-
color: var(--bgl-primary);
|
|
123
|
-
padding-inline-end: 0.25rem;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.person-card-edit {
|
|
127
|
-
position: absolute;
|
|
128
|
-
inset-inline-end: 1rem;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.person-card-details-wrap {
|
|
132
|
-
display: flex;
|
|
133
|
-
gap: 0.5rem;
|
|
134
|
-
flex-wrap: wrap;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.person-card-icon {
|
|
138
|
-
background: var(--bgl-gray);
|
|
139
|
-
height: 30px;
|
|
140
|
-
width: 30px;
|
|
141
|
-
border-radius: 100%;
|
|
142
|
-
text-transform: uppercase;
|
|
143
|
-
display: flex;
|
|
144
|
-
justify-content: center;
|
|
145
|
-
align-items: center;
|
|
146
|
-
color: white;
|
|
147
|
-
font-size: 12px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.person-card-icon-wrap {
|
|
151
|
-
display: flex;
|
|
152
|
-
gap: 0.5rem;
|
|
153
|
-
align-items: center;
|
|
154
|
-
padding-bottom: 0.75rem;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
@media screen and (max-width: 910px) {
|
|
158
|
-
.person-card-icon-wrap {
|
|
159
|
-
padding-bottom: 0.5rem;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.person-card {
|
|
163
|
-
padding: 0.75rem;
|
|
164
|
-
position: relative;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.person-card-edit {
|
|
168
|
-
/* position: relative; */
|
|
169
|
-
inset-inline-end: 0.5rem;
|
|
170
|
-
margin-bottom: 1rem;
|
|
171
|
-
justify-content: flex-end;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.person-card-name {
|
|
175
|
-
max-width: calc(100% - 170px);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
</style>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
{{ field?.label || field.id }}
|
|
4
|
-
|
|
5
|
-
<Btn
|
|
6
|
-
color="gray"
|
|
7
|
-
@click="openModal()"
|
|
8
|
-
v-if="field.refCollection"
|
|
9
|
-
>
|
|
10
|
-
{{ content }}
|
|
11
|
-
<MaterialIcon icon="arrow_forward" />
|
|
12
|
-
</Btn>
|
|
13
|
-
<span
|
|
14
|
-
v-else
|
|
15
|
-
class="pill"
|
|
16
|
-
>
|
|
17
|
-
{{ content }}
|
|
18
|
-
</span>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script lang="ts" setup>
|
|
23
|
-
import { ref, computed } from 'vue';
|
|
24
|
-
|
|
25
|
-
import type { Router } from 'vue-router';
|
|
26
|
-
import { Btn, MaterialIcon, BagelField } from '@bagelink/vue';
|
|
27
|
-
|
|
28
|
-
const openRef = ref(false);
|
|
29
|
-
|
|
30
|
-
const props = defineProps<{
|
|
31
|
-
modelValue: Record<string, any>;
|
|
32
|
-
field: BagelField;
|
|
33
|
-
router: Router;
|
|
34
|
-
}>();
|
|
35
|
-
|
|
36
|
-
const content = computed(() => props.field.refFields?.map((k) => props.modelValue?.[k] || '').join(' '));
|
|
37
|
-
|
|
38
|
-
const openModal = () => {
|
|
39
|
-
console.log(`openning ${props.modelValue?.id}`);
|
|
40
|
-
openRef.value = true;
|
|
41
|
-
void props.router.push(`/${props.field.refCollection}/${props.modelValue?.id}`);
|
|
42
|
-
};
|
|
43
|
-
</script>
|
|
44
|
-
s
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="icon-font"
|
|
4
|
-
:style="{ fontSize: `${size}rem` }"
|
|
5
|
-
>
|
|
6
|
-
{{ icon }}
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import type { MaterialIcons } from '@bagelink/vue';
|
|
12
|
-
|
|
13
|
-
defineProps<{
|
|
14
|
-
icon: MaterialIcons
|
|
15
|
-
size?: number
|
|
16
|
-
}>();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<style scoped></style>
|