first fixes
This commit is contained in:
@@ -9,7 +9,7 @@ export default class ComponentsController {
|
|||||||
async index({ inertia, auth }: HttpContext) {
|
async index({ inertia, auth }: HttpContext) {
|
||||||
const user = await auth.authenticate()
|
const user = await auth.authenticate()
|
||||||
const components = await Component.query().preload('type').where('userId', user.id)
|
const components = await Component.query().preload('type').where('userId', user.id)
|
||||||
return inertia.render('components/index', { components: components.map((c) => c.serialize()) })
|
return inertia.render('components/index', { components: components.map((c) => c.serialize({ relations: true })) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async create({ inertia }: HttpContext) {
|
async create({ inertia }: HttpContext) {
|
||||||
@@ -40,7 +40,7 @@ export default class ComponentsController {
|
|||||||
.where('userId', user.id)
|
.where('userId', user.id)
|
||||||
.andWhere('id', componentId)
|
.andWhere('id', componentId)
|
||||||
.firstOrFail()
|
.firstOrFail()
|
||||||
return inertia.render('components/show', { component: component.serialize() })
|
return inertia.render('components/show', { component: component.serialize({ relations: true }) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async edit({ params, auth, inertia }: HttpContext) {
|
async edit({ params, auth, inertia }: HttpContext) {
|
||||||
@@ -53,7 +53,7 @@ export default class ComponentsController {
|
|||||||
.andWhere('id', componentId)
|
.andWhere('id', componentId)
|
||||||
.firstOrFail()
|
.firstOrFail()
|
||||||
return inertia.render('components/edit', {
|
return inertia.render('components/edit', {
|
||||||
component: component.serialize(),
|
component: component.serialize({ relations: true }),
|
||||||
types: types.map((t) => t.serialize()),
|
types: types.map((t) => t.serialize()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default class ComputersController {
|
|||||||
picturesQuery.where('order', 1)
|
picturesQuery.where('order', 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
return inertia.render('computers/index', { computers: computers.map((c) => c.serialize()) })
|
return inertia.render('computers/index', { computers: computers.map((c) => c.serialize({ relations: true })) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async create({ auth, inertia }: HttpContext) {
|
async create({ auth, inertia }: HttpContext) {
|
||||||
@@ -29,7 +29,7 @@ export default class ComputersController {
|
|||||||
.where('userId', user.id)
|
.where('userId', user.id)
|
||||||
.whereNull('computerId')
|
.whereNull('computerId')
|
||||||
.preload('type')
|
.preload('type')
|
||||||
return inertia.render('computers/create', { components: components.map((c) => c.serialize()), states: states.map((s) => s.serialize()) })
|
return inertia.render('computers/create', { components: components.map((c) => c.serialize({ relations: true })), states: states.map((s) => s.serialize()) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async store({ auth, request, response }: HttpContext) {
|
async store({ auth, request, response }: HttpContext) {
|
||||||
@@ -60,7 +60,7 @@ export default class ComputersController {
|
|||||||
.where('user_id', user.id)
|
.where('user_id', user.id)
|
||||||
.andWhere('id', computerId)
|
.andWhere('id', computerId)
|
||||||
.firstOrFail()
|
.firstOrFail()
|
||||||
return inertia.render('computers/show', { computer: computer.serialize() })
|
return inertia.render('computers/show', { computer: computer.serialize({ relations: true }) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async edit({ params, inertia, auth }: HttpContext) {
|
async edit({ params, inertia, auth }: HttpContext) {
|
||||||
@@ -86,7 +86,7 @@ export default class ComputersController {
|
|||||||
'id',
|
'id',
|
||||||
computer.components.map((c) => c.id)
|
computer.components.map((c) => c.id)
|
||||||
)
|
)
|
||||||
return inertia.render('computers/edit', { computer: computer.serialize(), availableComponents: availableComponents.map((c) => c.serialize()), states: states.map((s) => s.serialize()) })
|
return inertia.render('computers/edit', { computer: computer.serialize({ relations: true }), availableComponents: availableComponents.map((c) => c.serialize({ relations: true })), states: states.map((s) => s.serialize()) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async update({ params, request, response }: HttpContext) {
|
async update({ params, request, response }: HttpContext) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Link, useForm } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { useForm } from '@inertiajs/vue3'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import EmptyLayout from '~/pages/layout/emptyLayout.vue'
|
import EmptyLayout from '~/pages/layout/emptyLayout.vue'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { Link, useForm } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { useForm } from '@inertiajs/vue3'
|
||||||
import CustomSelect from '~/pages/widgets/CustomSelect.vue'
|
import CustomSelect from '~/pages/widgets/CustomSelect.vue'
|
||||||
|
|
||||||
const props = defineProps<{ types: any[]; errors?: Record<string, string> }>()
|
const props = defineProps<{ types: any[]; errors?: Record<string, string> }>()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { Link, usePage } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { usePage } from '@inertiajs/vue3'
|
||||||
import CustomSelect from '~/pages/widgets/CustomSelect.vue'
|
import CustomSelect from '~/pages/widgets/CustomSelect.vue'
|
||||||
|
|
||||||
const { props } = usePage<{
|
const { props } = usePage<{
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Link } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import ComponentsViewer from '~/pages/widgets/ComponentsViewer.vue'
|
||||||
defineProps<{ components: any[] }>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center mb-6">
|
||||||
<h3 class="text-3xl font-semibold text-gray-700">Components</h3>
|
<h3 class="text-3xl font-semibold text-gray-700">Components</h3>
|
||||||
<Link
|
<Link
|
||||||
href="/components/create"
|
href="/components/create"
|
||||||
@@ -17,27 +16,6 @@ defineProps<{ components: any[] }>()
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
<ComponentsViewer />
|
||||||
<template v-if="components.length > 0">
|
|
||||||
<div
|
|
||||||
v-for="component in components"
|
|
||||||
:key="component.id"
|
|
||||||
class="p-4 border rounded-lg shadow hover:shadow-lg transition"
|
|
||||||
>
|
|
||||||
<h4 class="font-semibold text-lg text-gray-800">{{ component.name }}</h4>
|
|
||||||
<p class="text-gray-600">Type: {{ component.type?.name }}</p>
|
|
||||||
<p class="text-indigo-600 font-semibold">Price: ${{ component.price }}</p>
|
|
||||||
<Link
|
|
||||||
:href="`/components/${component.id}`"
|
|
||||||
class="mt-2 inline-block text-indigo-600 hover:text-indigo-700"
|
|
||||||
>
|
|
||||||
View Details
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<p class="text-gray-500">No components yet. Create one to get started!</p>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Link } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
|
||||||
const props = defineProps<{ component: any }>()
|
const props = defineProps<{ component: any }>()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { Link, usePage } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { usePage } from '@inertiajs/vue3'
|
||||||
|
|
||||||
const { props } = usePage<{
|
const { props } = usePage<{
|
||||||
components: any[]
|
components: any[]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { Link, router, usePage } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { router, usePage } from '@inertiajs/vue3'
|
||||||
|
|
||||||
const { props } = usePage<{
|
const { props } = usePage<{
|
||||||
computer: any
|
computer: any
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Link } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
|
||||||
defineProps<{ computers: any[] }>()
|
defineProps<{ computers: any[] }>()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Link } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
|
||||||
const { props } = defineProps<{ computer: any }>()
|
const { props } = defineProps<{ computer: any }>()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { Link, usePage } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { usePage } from '@inertiajs/vue3'
|
||||||
|
|
||||||
const page = usePage()
|
const page = usePage()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useSidebar } from '~/composables/useSidebar'
|
import { useSidebar } from '~/composables/useSidebar'
|
||||||
import { Link, usePage } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
import { usePage } from '@inertiajs/vue3'
|
||||||
import { userProfileIcon } from '~/assets/icons'
|
import { userProfileIcon } from '~/assets/icons'
|
||||||
|
|
||||||
const dropdownOpen = ref(false)
|
const dropdownOpen = ref(false)
|
||||||
@@ -31,16 +32,23 @@ const user = computed(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-6">
|
<div class="flex items-center gap-6">
|
||||||
<button class="text-on-surface-variant hover:bg-surface-container-low p-2 rounded-full transition-all">
|
<button
|
||||||
|
class="text-on-surface-variant hover:bg-surface-container-low p-2 rounded-full transition-all"
|
||||||
|
>
|
||||||
<span class="material-symbols-outlined">notifications</span>
|
<span class="material-symbols-outlined">notifications</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="text-on-surface-variant hover:bg-surface-container-low p-2 rounded-full transition-all">
|
<button
|
||||||
|
class="text-on-surface-variant hover:bg-surface-container-low p-2 rounded-full transition-all"
|
||||||
|
>
|
||||||
<span class="material-symbols-outlined">settings</span>
|
<span class="material-symbols-outlined">settings</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="h-8 w-px bg-outline-variant mx-2"></div>
|
<div class="h-8 w-px bg-outline-variant mx-2"></div>
|
||||||
|
|
||||||
<div class="relative flex items-center gap-3 cursor-pointer group" @click="dropdownOpen = !dropdownOpen">
|
<div
|
||||||
|
class="relative flex items-center gap-3 cursor-pointer group"
|
||||||
|
@click="dropdownOpen = !dropdownOpen"
|
||||||
|
>
|
||||||
<div class="text-right hidden sm:block">
|
<div class="text-right hidden sm:block">
|
||||||
<p class="font-label-md text-label-md text-on-surface">{{ user.name }}</p>
|
<p class="font-label-md text-label-md text-on-surface">{{ user.name }}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -65,7 +73,9 @@ const user = computed(() => {
|
|||||||
>
|
>
|
||||||
<div class="px-4 py-3 border-b border-outline-variant">
|
<div class="px-4 py-3 border-b border-outline-variant">
|
||||||
<p class="font-label-md text-label-md text-on-surface truncate">{{ user.name }}</p>
|
<p class="font-label-md text-label-md text-on-surface truncate">{{ user.name }}</p>
|
||||||
<p class="font-label-sm text-label-sm text-on-surface-variant truncate">{{ user.email }}</p>
|
<p class="font-label-sm text-label-sm text-on-surface-variant truncate">
|
||||||
|
{{ user.email }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, useAttrs } from 'vue'
|
import { ref, useAttrs } from 'vue'
|
||||||
import { useSidebar } from '~/composables/useSidebar'
|
import { useSidebar } from '~/composables/useSidebar'
|
||||||
import { Link } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
import { siteIcon } from '~/assets/icons'
|
import { siteIcon } from '~/assets/icons'
|
||||||
|
|
||||||
const { isOpen } = useSidebar()
|
const { isOpen } = useSidebar()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, watch } from 'vue'
|
import { computed, onMounted, ref, watch } from 'vue'
|
||||||
import { Component } from '~/pages/types/UITypes'
|
import type { Component } from '~/pages/types/UITypes'
|
||||||
|
|
||||||
interface ComponentsByType {
|
interface ComponentsByType {
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
import TableComponent from '~/pages/widgets/TableComponent.vue'
|
import TableComponent from '~/pages/widgets/TableComponent.vue'
|
||||||
import Component from '#models/component'
|
import type Component from '#models/component'
|
||||||
import ComponentType from '#models/component_type'
|
import type ComponentType from '#models/component_type'
|
||||||
import { usePage } from '@inertiajs/vue3'
|
import { usePage } from '@inertiajs/vue3'
|
||||||
|
|
||||||
const { props } = usePage<{ components: Component[] }>()
|
const { props } = usePage<{ components: Component[] }>()
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import {
|
|||||||
ssd,
|
ssd,
|
||||||
wiFiCard,
|
wiFiCard,
|
||||||
} from '~/assets/icons'
|
} from '~/assets/icons'
|
||||||
import Component from '#models/component'
|
import type Component from '#models/component'
|
||||||
import { Link } from '@inertiajs/vue3'
|
import { Link } from '@adonisjs/inertia/vue'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
components: Component[]
|
components: Component[]
|
||||||
|
|||||||
@@ -84,8 +84,8 @@
|
|||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { crossIcon } from '~/assets/icons'
|
import { crossIcon } from '~/assets/icons'
|
||||||
import { Navigation, Pagination } from 'vue3-carousel'
|
import { Navigation, Pagination } from 'vue3-carousel'
|
||||||
import { NewImage, ServerImage } from '../../../app/types/UItypes'
|
import type { NewImage, ServerImage } from '../../../app/types/UItypes'
|
||||||
import { Image } from '~/pages/types/UITypes'
|
import type { Image } from '~/pages/types/UITypes'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
galleryId: string
|
galleryId: string
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
} from '~/assets/icons'
|
} from '~/assets/icons'
|
||||||
import { router } from '@inertiajs/vue3'
|
import { router } from '@inertiajs/vue3'
|
||||||
import { useAdminMode } from '~/composables/isAdminMode'
|
import { useAdminMode } from '~/composables/isAdminMode'
|
||||||
import Component from '#models/component'
|
import type Component from '#models/component'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
components: Component[]
|
components: Component[]
|
||||||
|
|||||||
Reference in New Issue
Block a user