First Commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('header', 'Novo Template')
|
||||
|
||||
@section('breadcrumbs')
|
||||
@php
|
||||
$breadcrumbs = [
|
||||
'Templates' => route('prompt-templates.index'),
|
||||
'Novo' => null
|
||||
];
|
||||
@endphp
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 fw-bold text-primary">Cadastrar Template</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('prompt-templates.store') }}">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nome</label>
|
||||
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }}" required>
|
||||
@error('name') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="description" class="form-label">Descrição</label>
|
||||
<textarea class="form-control" id="description" name="description" rows="2">{{ old('description') }}</textarea>
|
||||
@error('description') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="category" class="form-label">Categoria</label>
|
||||
<input type="text" class="form-control" id="category" name="category" value="{{ old('category') }}">
|
||||
@error('category') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="template_data" class="form-label">Dados do Template (JSON)</label>
|
||||
<textarea class="form-control font-monospace" id="template_data" name="template_data" rows="20" required>{{ old('template_data') }}</textarea>
|
||||
@error('template_data') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="is_public" name="is_public" value="1" {{ old('is_public', true) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_public">Público</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><i class="bi bi-save"></i> Salvar</button>
|
||||
<a href="{{ route('prompt-templates.index') }}" class="btn btn-secondary">Cancelar</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,52 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('header', 'Editar Template')
|
||||
|
||||
@section('breadcrumbs')
|
||||
@php
|
||||
$breadcrumbs = [
|
||||
'Templates' => route('prompt-templates.index'),
|
||||
'Editar' => null
|
||||
];
|
||||
@endphp
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 fw-bold text-primary">Editar Template</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('prompt-templates.update', $promptTemplate) }}">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nome</label>
|
||||
<input type="text" class="form-control" id="name" name="name" value="{{ old('name', $promptTemplate->name) }}" required>
|
||||
@error('name') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="description" class="form-label">Descrição</label>
|
||||
<textarea class="form-control" id="description" name="description" rows="2">{{ old('description', $promptTemplate->description) }}</textarea>
|
||||
@error('description') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="category" class="form-label">Categoria</label>
|
||||
<input type="text" class="form-control" id="category" name="category" value="{{ old('category', $promptTemplate->category) }}">
|
||||
@error('category') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="template_data" class="form-label">Dados do Template (JSON)</label>
|
||||
<textarea class="form-control font-monospace" id="template_data" name="template_data" rows="20" required>{{ old('template_data', json_encode($promptTemplate->template_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) }}</textarea>
|
||||
@error('template_data') <div class="text-danger small">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="is_public" name="is_public" value="1" {{ old('is_public', $promptTemplate->is_public) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_public">Público</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><i class="bi bi-save"></i> Salvar</button>
|
||||
<a href="{{ route('prompt-templates.index') }}" class="btn btn-secondary">Cancelar</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,67 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('header', 'Templates')
|
||||
|
||||
@section('breadcrumbs')
|
||||
@php
|
||||
$breadcrumbs = [
|
||||
'Templates' => null
|
||||
];
|
||||
@endphp
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3 d-flex justify-content-between align-items-center">
|
||||
<h6 class="m-0 fw-bold text-primary">Lista de Templates</h6>
|
||||
<a href="{{ route('prompt-templates.create') }}" class="btn btn-primary btn-sm">
|
||||
<i class="bi bi-plus-circle"></i> Novo Template
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if(isset($templates) && count($templates) > 0)
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>Categoria</th>
|
||||
<th>Status</th>
|
||||
<th>Ações</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($templates as $template)
|
||||
<tr>
|
||||
<td>{{ $template->name }}</td>
|
||||
<td>{{ $template->category ?? 'N/A' }}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ $template->is_public ? 'success' : 'secondary' }}">
|
||||
{{ $template->is_public ? 'Público' : 'Privado' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('prompt-templates.edit', $template) }}" class="btn btn-warning btn-sm">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<form action="{{ route('prompt-templates.destroy', $template) }}" method="POST" class="d-inline" onsubmit="return confirm('Tem certeza?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="btn btn-danger btn-sm"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@if(is_object($templates) && method_exists($templates, 'links'))
|
||||
<div class="mt-3">
|
||||
{{ $templates->links() }}
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<p class="text-muted">Nenhum template encontrado.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user