Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit 6ff2d64

Browse files
authored
feat: init tools page (#271)
1 parent ab22ea6 commit 6ff2d64

File tree

7 files changed

+194
-129
lines changed

7 files changed

+194
-129
lines changed

frontend/components/App/ImportDialog.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@
5353
);
5454
5555
function setFile(e: Event) {
56-
importCsv.value = e.target.files[0];
56+
const result = e.target as HTMLInputElement;
57+
if (!result.files || result.files.length === 0) {
58+
return;
59+
}
60+
61+
importCsv.value = result.files[0];
5762
}
5863
5964
function uploadCsv() {
60-
importRef.value.click();
65+
importRef.value?.click();
6166
}
6267
6368
const eventBus = useEventBus();
@@ -86,5 +91,7 @@
8691
}
8792
8893
eventBus.emit(EventTypes.InvalidStores);
94+
95+
toast.success("Import successful!");
8996
}
9097
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<div class="grid grid-cols-1 md:grid-cols-4 gap-10 py-6">
3+
<div class="col-span-3">
4+
<h4 class="mb-1 text-lg font-semibold">
5+
<slot name="title"></slot>
6+
</h4>
7+
<p class="text-sm">
8+
<slot></slot>
9+
</p>
10+
</div>
11+
<BaseButton class="btn-primary mt-auto" @click="$emit('action')">
12+
<slot name="button">
13+
<slot name="title"></slot>
14+
</slot>
15+
</BaseButton>
16+
</div>
17+
</template>

frontend/layouts/default.vue

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
up the tree
77
-->
88
<ModalConfirm />
9-
<AppImportDialog v-model="modals.import" />
109
<ItemCreateModal v-model="modals.item" />
1110
<LabelCreateModal v-model="modals.label" />
1211
<LocationCreateModal v-model="modals.location" />
@@ -78,10 +77,6 @@
7877
<Icon :name="n.icon" class="h-6 w-6 mr-4" />
7978
{{ n.name }}
8079
</NuxtLink>
81-
<button v-else class="rounded-btn" @click="n.action">
82-
<Icon :name="n.icon" class="h-6 w-6 mr-4" />
83-
{{ n.name }}
84-
</button>
8580
</li>
8681
</ul>
8782
</div>
@@ -172,12 +167,11 @@
172167
to: "/locations",
173168
},
174169
{
175-
icon: "mdi-database",
176-
id: 2,
177-
name: "Import",
178-
action: () => {
179-
modals.import = true;
180-
},
170+
icon: "mdi-cog",
171+
id: 6,
172+
active: computed(() => route.path === "/tools"),
173+
name: "Tools",
174+
to: "/tools",
181175
},
182176
];
183177

frontend/lib/api/types/data-contracts.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export interface DocumentOut {
1717
}
1818

1919
export interface Group {
20-
createdAt: string;
20+
createdAt: Date | string;
2121
currency: string;
2222
id: string;
2323
name: string;
24-
updatedAt: string;
24+
updatedAt: Date | string;
2525
}
2626

2727
export interface GroupStatistics {
@@ -39,11 +39,11 @@ export interface GroupUpdate {
3939
}
4040

4141
export interface ItemAttachment {
42-
createdAt: string;
42+
createdAt: Date | string;
4343
document: DocumentOut;
4444
id: string;
4545
type: string;
46-
updatedAt: string;
46+
updatedAt: Date | string;
4747
}
4848

4949
export interface ItemAttachmentUpdate {
@@ -76,7 +76,7 @@ export interface ItemOut {
7676
assetId: string;
7777
attachments: ItemAttachment[];
7878
children: ItemSummary[];
79-
createdAt: string;
79+
createdAt: Date | string;
8080
description: string;
8181
fields: ItemField[];
8282
id: string;
@@ -96,23 +96,23 @@ export interface ItemOut {
9696
/** @example "0" */
9797
purchasePrice: string;
9898
/** Purchase */
99-
purchaseTime: string;
99+
purchaseTime: Date | string;
100100
quantity: number;
101101
serialNumber: string;
102102
soldNotes: string;
103103
/** @example "0" */
104104
soldPrice: string;
105105
/** Sold */
106-
soldTime: string;
106+
soldTime: Date | string;
107107
soldTo: string;
108-
updatedAt: string;
108+
updatedAt: Date | string;
109109
warrantyDetails: string;
110-
warrantyExpires: string;
110+
warrantyExpires: Date | string;
111111
}
112112

113113
export interface ItemSummary {
114114
archived: boolean;
115-
createdAt: string;
115+
createdAt: Date | string;
116116
description: string;
117117
id: string;
118118
insured: boolean;
@@ -123,7 +123,7 @@ export interface ItemSummary {
123123
/** @example "0" */
124124
purchasePrice: string;
125125
quantity: number;
126-
updatedAt: string;
126+
updatedAt: Date | string;
127127
}
128128

129129
export interface ItemUpdate {
@@ -148,18 +148,18 @@ export interface ItemUpdate {
148148
/** @example "0" */
149149
purchasePrice: string;
150150
/** Purchase */
151-
purchaseTime: string;
151+
purchaseTime: Date | string;
152152
quantity: number;
153153
/** Identifications */
154154
serialNumber: string;
155155
soldNotes: string;
156156
/** @example "0" */
157157
soldPrice: string;
158158
/** Sold */
159-
soldTime: string;
159+
soldTime: Date | string;
160160
soldTo: string;
161161
warrantyDetails: string;
162-
warrantyExpires: string;
162+
warrantyExpires: Date | string;
163163
}
164164

165165
export interface LabelCreate {
@@ -169,20 +169,20 @@ export interface LabelCreate {
169169
}
170170

171171
export interface LabelOut {
172-
createdAt: string;
172+
createdAt: Date | string;
173173
description: string;
174174
id: string;
175175
items: ItemSummary[];
176176
name: string;
177-
updatedAt: string;
177+
updatedAt: Date | string;
178178
}
179179

180180
export interface LabelSummary {
181-
createdAt: string;
181+
createdAt: Date | string;
182182
description: string;
183183
id: string;
184184
name: string;
185-
updatedAt: string;
185+
updatedAt: Date | string;
186186
}
187187

188188
export interface LocationCreate {
@@ -193,30 +193,30 @@ export interface LocationCreate {
193193

194194
export interface LocationOut {
195195
children: LocationSummary[];
196-
createdAt: string;
196+
createdAt: Date | string;
197197
description: string;
198198
id: string;
199199
items: ItemSummary[];
200200
name: string;
201201
parent: LocationSummary;
202-
updatedAt: string;
202+
updatedAt: Date | string;
203203
}
204204

205205
export interface LocationOutCount {
206-
createdAt: string;
206+
createdAt: Date | string;
207207
description: string;
208208
id: string;
209209
itemCount: number;
210210
name: string;
211-
updatedAt: string;
211+
updatedAt: Date | string;
212212
}
213213

214214
export interface LocationSummary {
215-
createdAt: string;
215+
createdAt: Date | string;
216216
description: string;
217217
id: string;
218218
name: string;
219-
updatedAt: string;
219+
updatedAt: Date | string;
220220
}
221221

222222
export interface LocationUpdate {
@@ -229,7 +229,7 @@ export interface LocationUpdate {
229229
export interface MaintenanceEntry {
230230
/** @example "0" */
231231
cost: string;
232-
date: Date;
232+
date: Date | string;
233233
description: string;
234234
id: string;
235235
name: string;
@@ -238,15 +238,15 @@ export interface MaintenanceEntry {
238238
export interface MaintenanceEntryCreate {
239239
/** @example "0" */
240240
cost: string;
241-
date: Date;
241+
date: Date | string;
242242
description: string;
243243
name: string;
244244
}
245245

246246
export interface MaintenanceEntryUpdate {
247247
/** @example "0" */
248248
cost: string;
249-
date: Date;
249+
date: Date | string;
250250
description: string;
251251
name: string;
252252
}
@@ -258,7 +258,7 @@ export interface MaintenanceLog {
258258
itemId: string;
259259
}
260260

261-
export interface PaginationResultRepoItemSummary {
261+
export interface PaginationResultItemSummary {
262262
items: ItemSummary[];
263263
page: number;
264264
pageSize: number;
@@ -302,7 +302,7 @@ export interface ValueOverTime {
302302
}
303303

304304
export interface ValueOverTimeEntry {
305-
date: Date;
305+
date: Date | string;
306306
name: string;
307307
value: number;
308308
}
@@ -355,13 +355,13 @@ export interface ChangePassword {
355355
}
356356

357357
export interface GroupInvitation {
358-
expiresAt: string;
358+
expiresAt: Date | string;
359359
token: string;
360360
uses: number;
361361
}
362362

363363
export interface GroupInvitationCreate {
364-
expiresAt: string;
364+
expiresAt: Date | string;
365365
uses: number;
366366
}
367367

@@ -371,6 +371,6 @@ export interface ItemAttachmentToken {
371371

372372
export interface TokenResponse {
373373
attachmentToken: string;
374-
expiresAt: string;
374+
expiresAt: Date | string;
375375
token: string;
376376
}

0 commit comments

Comments
 (0)