|
|
|
@ -2,12 +2,11 @@
|
|
|
|
import CategoryChooser from './category_chooser.vue'
|
|
|
|
import CategoryChooser from './category_chooser.vue'
|
|
|
|
import { onMounted, ref, watch, defineProps, toRefs} from 'vue'
|
|
|
|
import { onMounted, ref, watch, defineProps, toRefs} from 'vue'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps(['categories', 'instruments', 'currentWorkingCategoryID'])
|
|
|
|
const props = defineProps(['categories', 'instruments', 'currentWorkingCategory'])
|
|
|
|
|
|
|
|
|
|
|
|
const categorySessions = ref([])
|
|
|
|
const categorySessions = ref([])
|
|
|
|
const practiceCategoryId = ref(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { currentWorkingCategoryID } = toRefs(props);
|
|
|
|
/*const { currentWorkingCategory } = toRefs(props);*/
|
|
|
|
|
|
|
|
|
|
|
|
const change = async (event) => {
|
|
|
|
const change = async (event) => {
|
|
|
|
const response = await fetch(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'show-category/'+event.target.value)
|
|
|
|
const response = await fetch(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'show-category/'+event.target.value)
|
|
|
|
@ -18,18 +17,16 @@
|
|
|
|
navigator.clipboard.writeText(event.target.innerText)
|
|
|
|
navigator.clipboard.writeText(event.target.innerText)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const loadCategory = async (newValue) => {
|
|
|
|
const loadCategory = async (chosenCategoryID) => {
|
|
|
|
const response = await fetch(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'show-category/'+newValue)
|
|
|
|
const response = await fetch(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'show-category/'+chosenCategoryID)
|
|
|
|
categorySessions.value = await response.json()
|
|
|
|
categorySessions.value = await response.json()
|
|
|
|
practiceCategoryId.value = newValue
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
onMounted(async () => {
|
|
|
|
practiceCategoryId.value = currentWorkingCategoryID
|
|
|
|
loadCategory(props.currentWorkingCategory.id)
|
|
|
|
loadCategory(currentWorkingCategoryID.value)
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
watch(currentWorkingCategoryID, loadCategory)
|
|
|
|
/*watch(currentWorkingCategory, loadCategory)*/
|
|
|
|
defineExpose({loadCategory})
|
|
|
|
defineExpose({loadCategory})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
@ -37,10 +34,9 @@
|
|
|
|
<h2>Show Category</h2>
|
|
|
|
<h2>Show Category</h2>
|
|
|
|
<CategoryChooser
|
|
|
|
<CategoryChooser
|
|
|
|
@update="loadCategory"
|
|
|
|
@update="loadCategory"
|
|
|
|
v-if="categories.length > 0"
|
|
|
|
:currentWorkingCategory="props.currentWorkingCategory"
|
|
|
|
:currentWorkingCategoryID="props.currentWorkingCategoryID"
|
|
|
|
|
|
|
|
:instruments="props.instruments"
|
|
|
|
:instruments="props.instruments"
|
|
|
|
:categories="categories" />
|
|
|
|
:categories="props.categories" />
|
|
|
|
<table>
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<tr>
|
|
|
|
|