1
1
<script lang="ts" setup>
2
- import {computed , ref } from " vue" ;
3
- import {useQuery } from " @tanstack/vue-query" ;
4
- import {getTaskStatuses } from " @/api" ;
5
- import {capitalizeFirstLetter } from " ../helpers" ;
2
+ import {computed , ref } from ' vue'
3
+ import {useQuery } from ' @tanstack/vue-query'
4
+ import {getTaskStatuses } from ' @/api'
5
+ import {capitalizeFirstLetter } from ' ../helpers'
6
6
7
7
const invoiceNinjaURL = ref (localStorage .getItem (' invoiceNinjaURL' ) || ' https://invoicing.co/api/v1' )
8
8
const invoiceNinjaAPIToken = ref (localStorage .getItem (' invoiceNinjaAPIToken' ) || ' ' )
@@ -23,7 +23,11 @@ const saveStatuses = () => {
23
23
const {statuses, isComplete} = useSettings ()
24
24
25
25
const enabled = computed (() => !! (localStorage .getItem (' invoiceNinjaAPIToken' ) && localStorage .getItem (' invoiceNinjaURL' )))
26
- const {data : options, isPending, isError} = useQuery ({
26
+ const {
27
+ data : options,
28
+ isPending,
29
+ isError
30
+ } = useQuery ({
27
31
enabled ,
28
32
queryKey: [' task-statuses' ],
29
33
queryFn: getTaskStatuses
@@ -38,24 +42,27 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
38
42
<div class =" container" >
39
43
<h2 >{{ isComplete ? 'Settings' : 'Setup' }}</h2 >
40
44
<form class =" connect-invoice-ninja" @submit.prevent =" saveAPI" >
41
- <h3 for =" token" >1. Connect to Invoice Ninja</h3 >
42
- <label for =" token" >API Token (get from <a
43
- href =" https://app.invoicing.co/#/settings/task_settings" >settings</a > invoice ninja)</label >
45
+ <h3 for =" token" >
46
+ 1. Get token from
47
+ <a href =" https://app.invoicing.co/?#/settings/integrations/api_tokens/create" >Invoice Ninja</a >
48
+ </h3 >
44
49
45
- <input v-model =" invoiceNinjaAPIToken" placeholder =" Example: bXlfbXlfbXlfbXlfbXlfbXlfbXlfbXlf" required
46
- type =" text" />
50
+ <input v-model =" invoiceNinjaAPIToken" placeholder =" xxxxxxxxxxxxxx" required type =" text" />
47
51
<details class =" extends-settings" >
48
- <summary >Extend settings</summary >
52
+ <summary class = " extends-settings-button " >Extend settings</summary >
49
53
<label for =" url" >Invoice Ninja API URL (optional)</label >
50
- <input v-model =" invoiceNinjaURL" placeholder =" Example: https://invoicing.co/api/v1" type =" text" />
54
+ <input v-model =" invoiceNinjaURL" placeholder =" Example: https://invoicing.co/api/v1" type =" text" />
51
55
</details >
52
56
<button type =" submit" >Save</button >
53
57
</form >
54
58
<Transition mode =" out-in" >
55
59
<form v-if =" enabled" class =" select-statuses" @submit.prevent =" saveStatuses" >
56
- <h3 >2. Select statuses for task</h3 >
57
- <template v-for =" (value , key ) in statuses "
58
- style =" width : 100% ; display : flex ; align-items : start ; flex-direction : column ; gap : 0.5em " >
60
+ <h3 >
61
+ 2. Select
62
+ <a href =" https://app.invoicing.co/?#/settings/task_settings" >statuses</a >
63
+ for task
64
+ </h3 >
65
+ <template v-for =" (value , key ) in statuses " style =" width : 100% ; display : flex ; align-items : start ; flex-direction : column ; gap : 0.5em " >
59
66
<label :for =" value || key" >{{ capitalizeFirstLetter(key) }} status</label >
60
67
<template v-if =" isError " >
61
68
<select :id =" value || key" disabled required >
@@ -69,10 +76,11 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
69
76
</template >
70
77
71
78
<template v-else >
72
- <select :id =" value || key" :value =" value" required
73
- @change =" updateStatus($event.target.value, key)" >
79
+ <select :id =" value || key" :value =" value" required @change =" updateStatus($event.target.value, key)" >
74
80
<option disabled selected value =" " >Please select one</option >
75
- <option v-for =" {id, name} in options.data" :value =" id" >{{ name }}</option >
81
+ <option v-for =" {id, name} in options.data" :value =" id" >
82
+ {{ name }}
83
+ </option >
76
84
</select >
77
85
</template >
78
86
</template >
@@ -97,7 +105,7 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
97
105
flex-direction : column ;
98
106
gap : 0.5em ;
99
107
width : 20em ;
100
- margin-bottom : 3em
108
+ margin-bottom : 3em ;
101
109
}
102
110
103
111
.select-statuses {
@@ -108,12 +116,22 @@ const updateStatus = (value: string | null, key: 'beginning' | 'running' | 'fini
108
116
}
109
117
110
118
button {
111
- margin-top : 1em
119
+ margin-top : 1em ;
112
120
}
113
121
114
122
.extends-settings {
115
123
width : 100% ;
116
124
text-align : start ;
117
125
margin : 1em 0 ;
118
126
}
127
+
128
+ .extends-settings-button {
129
+ filter : brightness (0.5 );
130
+ color : ghostwhite ;
131
+ margin-bottom : 1em ;
132
+ }
133
+
134
+ .extends-settings-button ::marker {
135
+ content : ' ' ;
136
+ }
119
137
</style >
0 commit comments