Files
site/resources/js/Pages/Complaint/IndexComment.vue

101 lines
3.4 KiB
Vue
Executable File

<template>
<meta-head title="Пожаловаться на комментарий"></meta-head>
<div class="mt-16 md:container !max-w-5xl mx-auto px-2 md:px-6 2xl:px-28 buttons-filter-line">
<form class=" bg-indigo-200 shadow-classic rounded-md p-5" @submit.prevent="submit">
<div class="mb-4 flex items-center text-gray-light text-sm md:text-lg font-medium">
<link-back class="default block hover:underline">
Вернуться
</link-back>
<span class="px-3">/</span>
<h1 class="text-gray">
Пожаловаться на комментарий
</h1>
</div>
<div class="mt-8 md:grid grid-cols-2">
<div class="space-y-4">
<div v-for="reason in reasons" :key="reason.id"
class="flex"
>
<input :id="`reason_${reason.id}`" v-model="form.reason"
:value="reason.id" name="reason"
type="radio" class="h-5 w-5 text-orange border-gray-light focus:ring-transparent focus:ring-offset-transparent"
>
<label :for="`reason_${reason.id}`" class="select-none ml-3 text-gray leading-none">{{ reason.name }}</label>
</div>
</div>
<div class="mt-5 md:mt-0">
<inertia-link :href="route('profile.user', user.username)" class=" flex items-center mr-3">
<user-avatar
:user="user"
size="small"
class="text-xs w-12 h-12"
/>
<span class="text-gray-light ml-3">{{ user.name }}</span>
</inertia-link>
<h3 class="mt-3 font-medium text-gray-light">
Текст комментария:
</h3>
<div class="mt-3 text-lg text-white">
{{ comment.body }}
</div>
</div>
</div>
<div class="mt-12 flex flex-wrap -my-1 -mx-3">
<loading-button :loading="form.processing" class="mx-3 my-1 transition shadow-none hover:shadow-classic2 inline-flex items-center px-8 py-3 justify-center text-base rounded-md text-white bg-orange focus:outline-none"
type="submit"
>
Отправить
</loading-button>
<link-back class="mx-3 my-1 transition shadow-none hover:shadow-classic inline-flex items-center px-8 py-3 justify-center text-base rounded-md text-white bg-indigo-300 focus:outline-none">
Отменить
</link-back>
</div>
</form>
</div>
</template>
<script>
import { useForm, usePage } from '@inertiajs/inertia-vue3'
import { toRefs } from 'vue'
import Layout from '@/Shared/Layout.vue'
import MetaHead from '@/Shared/MetaHead.vue'
import LinkBack from '@/Shared/Misc/LinkBack.vue'
import LoadingButton from '@/Shared/Form/LoadingButton.vue'
import UserAvatar from '@/Shared/Misc/UserAvatar.vue'
export default {
components: {
MetaHead,
LoadingButton,
LinkBack,
UserAvatar
},
layout: Layout,
props: {
comment: Object,
user: Object,
reasons: Array,
},
setup(props) {
const { comment } = toRefs(props)
const form = useForm({
reason: null,
comment: comment.value.id,
})
const submit = () => {
form.post(route('complaint.store.comment'))
form.reason = null
}
return {
form,
submit,
}
},
}
</script>