-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
164 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<template> | ||
<div :class="$style.component"> | ||
<div> | ||
{{ item.equipment.name}} | ||
</div> | ||
|
||
<div :class="$style.weight"> | ||
{{ item.equipment.weight }} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { ChecklistItemModel } from '~/models/checklist'; | ||
interface Props { | ||
readonly item: ChecklistItemModel; | ||
} | ||
defineProps<Props>(); | ||
</script> | ||
|
||
<style module> | ||
.component { | ||
display: grid; | ||
grid-template-columns: 1fr auto; | ||
padding: var(--border-radius-8) var(--spacing-12); | ||
background-color: var(--color-blue-100); | ||
border: 1px solid var(--color-blue-300); | ||
border-radius: var(--border-radius-12); | ||
font-size: var(--font-size-16); | ||
color: var(--color-blue-800); | ||
} | ||
.weight { | ||
color: var(--color-blue-700); | ||
font-size: var(--font-size-14); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<div :class="$style.component"> | ||
<ChecklistItem | ||
v-for="item in items" | ||
:key="item.id" | ||
:item="item" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { ChecklistItemModel } from '~/models/checklist'; | ||
import ChecklistItem from './ChecklistItem.vue'; | ||
interface Props { | ||
readonly items: ChecklistItemModel[]; | ||
} | ||
defineProps<Props>(); | ||
</script> | ||
|
||
<style module> | ||
.component { | ||
width: 100%; | ||
display: grid; | ||
row-gap: var(--spacing-4); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,12 @@ | ||
interface EquipmentItem { | ||
readonly id: string; | ||
readonly name: string; | ||
readonly weight: number; | ||
} | ||
|
||
interface ChecklistItem { | ||
readonly id: string; | ||
readonly equipment: EquipmentItem; | ||
} | ||
import type { ChecklistItemModel } from "~/models/checklist" | ||
|
||
export async function useChecklistItemsData(checklistId: string) { | ||
const items = ref<ChecklistItem[]>([]) | ||
const items = ref<ChecklistItemModel[]>([]) | ||
const { data } = await useFetch(`/api/checklists/${checklistId}/items`) | ||
|
||
if (data.value !== undefined) { | ||
items.value = data.value | ||
} | ||
|
||
async function updateItems() { | ||
try { | ||
const response = await $fetch(`/api/checklists/${checklistId}/items`) | ||
|
||
items.value = response | ||
} catch { | ||
console.error('Failed to update equipment') | ||
} | ||
} | ||
|
||
return { | ||
items, | ||
updateItems | ||
} | ||
return items | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
interface ChecklistEquipment { | ||
readonly id: string; | ||
readonly name: string; | ||
readonly weight: number; | ||
} | ||
|
||
export interface ChecklistItemModel { | ||
readonly id: string; | ||
readonly equipment: ChecklistEquipment; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters