@hostlink/nuxt-light 0.0.118 → 1.0.1

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/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.118"
4
+ "version": "1.0.1"
5
5
  }
@@ -1,24 +1,34 @@
1
1
  <script setup>
2
- import { reactive } from 'vue'
3
2
  import { m } from '../../'
4
- const obj = reactive({})
3
+ import { Notify } from "quasar"
5
4
 
6
- const onSave = async () => {
7
- if (await m("mailTest", obj)) {
8
- que.notify({
9
- message: "Mail sent",
5
+ const onSubmit = async (data) => {
6
+ try {
7
+ await m("mailTest", data)
8
+
9
+
10
+ Notify.create({
11
+ message: "Email sent",
10
12
  color: "positive",
11
- icon: "email"
13
+ icon: "check"
12
14
  });
15
+
16
+ } catch (e) {
17
+ Notify.create({
18
+ message: e.message,
19
+ color: "negative",
20
+ icon: "warning"
21
+ })
13
22
  }
14
23
  }
15
24
  </script>
16
25
  <template>
17
26
  <l-page>
18
- <l-form @save="onSave">
19
- <l-input label="Email" v-model="obj.email" required></l-input>
20
- <l-input label="Subject" v-model="obj.subject" required></l-input>
21
- <l-input type="textarea" label="Content" v-model="obj.content" required></l-input>
22
- </l-form>
27
+ <FormKit type="l-form" @submit="onSubmit">
28
+ <FormKit type="l-input" label="Email" name="email" validation="required|email"></FormKit>
29
+ <FormKit type="l-input" label="Subject" name="subject" validation="required"></FormKit>
30
+ <FormKit type="l-input" input-type="textarea" label="Content" name="content" validation="required">
31
+ </FormKit>
32
+ </FormKit>
23
33
  </l-page>
24
34
  </template>
@@ -1,22 +1,17 @@
1
1
  <script setup>
2
- import { useQuasar } from 'quasar'
2
+ import { Notify } from 'quasar'
3
3
  import { useRouter } from 'vue-router'
4
- import { reactive } from "vue"
5
4
  import { q, m } from '../../'
6
5
 
7
6
  const router = useRouter()
8
- const que = useQuasar()
9
-
10
7
  const { app } = await q({ app: { config: ["name", "value"] } })
11
-
12
- //const system = await q("system", ["passwordPolicy"])
13
-
14
- const obj = reactive(app.config.reduce((acc, cur) => {
8
+ const obj = app.config.reduce((acc, cur) => {
15
9
  acc[cur.name] = cur.value
16
10
  return acc
17
- }, {}));
11
+ }, {});
18
12
 
19
- const fields = ["company", "company_logo", "password_upper_case", "password_lower_case", "password_number", "password_special_character",
13
+ const fields = ["company", "company_logo",
14
+ "password_upper_case", "password_lower_case", "password_number", "password_special_character",
20
15
  "file_manager", "two_factor_authentication"];
21
16
 
22
17
  //filter out fields that are not in the app.config table
@@ -26,53 +21,53 @@ Object.keys(obj).forEach((key) => {
26
21
  }
27
22
  })
28
23
 
29
- const onSave = async () => {
30
- const data = [];
31
- Object.keys(obj).forEach((key) => {
24
+ const onSubmit = async (d, form) => {
25
+ let data = [];
26
+ Object.keys(d).forEach((key) => {
32
27
  data.push({
33
28
  name: key,
34
- value: obj[key]
29
+ value: d[key]
35
30
  })
36
31
  })
32
+
37
33
  await m("updateAppConfigs", { data })
38
34
  //show success
39
- que.notify({
40
- message: "Saved",
41
- type: "positive",
42
- position: "top",
43
- });
44
-
35
+ Notify.create({
36
+ message: "Settings updated",
37
+ color: "positive",
38
+ icon: "check"
39
+ })
45
40
 
46
- }
41
+ router.go(-1);
47
42
 
48
43
 
44
+ }
49
45
  </script>
50
46
  <template>
51
47
  <l-page>
52
- <l-form @save="onSave">
53
- <l-input label="Company" v-model="obj.company"></l-input>
54
- <l-input label="Company logo" v-model="obj.company_logo"></l-input>
48
+
49
+ <FormKit type="l-form" :value="obj" #default="{ value }" @submit="onSubmit">
50
+ <FormKit type="l-input" label="Company" name="company"></FormKit>
51
+ <FormKit type="l-input" label="Company logo" name="company_logo"></FormKit>
55
52
 
56
53
  <q-field label="Password policy" stack-label>
57
- <q-checkbox label="Upper case" v-model="obj.password_upper_case" true-value="1"
58
- false-value="0"></q-checkbox>
59
- <q-checkbox label="Lower case" v-model="obj.password_lower_case" true-value="1"
60
- false-value="0"></q-checkbox>
61
- <q-checkbox label="Number" v-model="obj.password_number" true-value="1" false-value="0"></q-checkbox>
62
- <q-checkbox label="Special character" v-model="obj.password_special_character" true-value="1"
63
- false-value="0"></q-checkbox>
54
+ <FormKit type="q-checkbox" label="Upper Case" name="password_upper_case" true-value="1" false-value="0" />
55
+ <FormKit type="q-checkbox" label="Lower Case" name="password_lower_case" true-value="1" false-value="0" />
56
+ <FormKit type="q-checkbox" label="Number" name="password_number" true-value="1" false-value="0" />
57
+ <FormKit type="q-checkbox" label="Special Character" name="password_special_character" true-value="1"
58
+ false-value="0" />
64
59
  </q-field>
65
60
 
66
61
 
67
62
  <q-field label="File manager" stack-label>
68
- <q-checkbox label="Show" v-model="obj.file_manager" true-value="1" false-value="0"></q-checkbox>
63
+ <FormKit type="q-checkbox" label="Show" name="file_manager" true-value="1" false-value="0" />
69
64
  </q-field>
70
65
 
71
66
  <q-field label="Two factor authentication" stack-label>
72
- <q-checkbox label="Enable" v-model="obj.two_factor_authentication" true-value="1"
73
- false-value="0"></q-checkbox>
67
+ <FormKit type="q-checkbox" label="Enable" name="two_factor_authentication" true-value="1" false-value="0" />
74
68
  </q-field>
75
69
 
76
- </l-form>
70
+
71
+ </FormKit>
77
72
  </l-page>
78
73
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.118",
3
+ "version": "1.0.1",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",