feat: locations tree viewer (#248)

* location tree API

* test fixes

* initial tree location elements

* locations tree page

* update meta-data

* code-gen

* store item display preferences

* introduce basic table/card view elements

* codegen

* set parent location during location creation

* add item support for tree query

* refactor tree view

* wip: location selector improvements

* type gen

* rename items -> search

* remove various log statements

* fix markdown rendering for description

* update location selectors

* fix tests

* fix currency tests

* formatting
This commit is contained in:
Hayden 2023-01-28 11:53:00 -09:00 committed by GitHub
parent 4d220cdd9c
commit 3d295b5132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 1119 additions and 79 deletions

View file

@ -10,6 +10,7 @@
label="Location Name"
/>
<FormTextArea v-model="form.description" label="Location Description" />
<LocationSelector v-model="form.parent" />
<div class="modal-action">
<BaseButton type="submit" :loading="loading"> Create </BaseButton>
</div>
@ -18,6 +19,7 @@
</template>
<script setup lang="ts">
import { LocationSummary } from "~~/lib/api/types/data-contracts";
const props = defineProps({
modelValue: {
type: Boolean,
@ -31,6 +33,7 @@
const form = reactive({
name: "",
description: "",
parent: null as LocationSummary | null,
});
whenever(
@ -43,6 +46,7 @@
function reset() {
form.name = "";
form.description = "";
form.parent = null;
focused.value = false;
modal.value = false;
loading.value = false;
@ -54,7 +58,11 @@
async function create() {
loading.value = true;
const { data, error } = await api.locations.create(form);
const { data, error } = await api.locations.create({
name: form.name,
description: form.description,
parentId: form.parent ? form.parent.id : null,
});
if (error) {
toast.error("Couldn't create location");