@extends('admin.layouts.layout')
@section('title', $pagePayload->title)

@section('content')
	<div class="row wrapper border-bottom white-bg page-heading">
		<div class="col-lg-10">
			<h2>{{ $pagePayload->title }}</h2>
			<ol class="breadcrumb">
				<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">Dashboard</a></li>
				<li class="breadcrumb-item"><a href="{{ route('admin.blogComment.index') }}">Lista</a></li>
				<li class="breadcrumb-item active"><strong>Formulário</strong></li>
			</ol>
		</div>
		<div class="col-lg-2 col-md-2 col-sm-2" style="padding-top: 30px; text-align: right"></div>
	</div>

	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="col-lg-12">
			<div class="ibox">
				<div class="ibox-content">
					<form name="form" method="POST" action="{{ route($pagePayload->route->name, $pagePayload->route->params ?? []) }}" enctype="multipart/form-data" class="form-horizontal">
						@method($pagePayload->route->method)
						@csrf
						<input type="hidden" name="id" value="{{ $pagePayload->data->id ?? null }}"/>

						<div class="row">
							<div class="form-group col-6">
								<label class="control-label">Nome</label>
								<input type="text" name="name" maxlength="127" class="form-control" disabled value="{{ old('data.name') ?? $pagePayload->data->name ?? null }}">
							</div>

							<div class="form-group col-6">
								<label class="control-label">E-mail</label>
								<input type="text" name="email" maxlength="127" class="form-control" disabled value="{{ old('data.email') ?? $pagePayload->data->email ?? null }}">
							</div>

							<div class="form-group col-12">
								<label class="control-label">Comentário</label>
								<textarea name="comment" class="form-control" disabled maxlength="16777215">{{ old('data.comment') ?? $pagePayload->data->comment ?? null }}</textarea>
							</div>
						</div>


						@if ($pagePayload->data->reply_id)
							<div class="ibox">
								<div class="ibox-title">
									<h5>Resposta a: <span>{{ $pagePayload->data->reply->name }} - {{ $pagePayload->data->reply->email }}</span></h5>
									<div class="ibox-tools">
											<a class="collapse-link">
													<i class="fa fa-chevron-up"></i>
											</a>
									</div>
								</div>
								<div class="ibox-content">{{ $pagePayload->data->reply->comment }}</div>
							</div>
						@endif

						<div class="hr-line-dashed"></div>
						<div class="form-group">
							<div class="col-sm-12 text-right">
								<button class="btn btn-primary" type="submit">Salvar</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
@endsection
