102 lines
6.4 KiB
PHP
102 lines
6.4 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Kelola Template Pesan - INUFA')
|
|
@section('header', 'Kelola Template Pesan')
|
|
|
|
@section('content')
|
|
<div class="container mx-auto px-4 py-6">
|
|
<div class="bg-white rounded-lg shadow-lg p-6">
|
|
<!-- Form Tambah Template -->
|
|
<div class="mb-8">
|
|
<h2 class="text-lg font-semibold mb-4">Tambah Template Baru</h2>
|
|
<form action="{{ route('message-templates.store') }}" method="POST" class="space-y-4">
|
|
@csrf
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Nama Template</label>
|
|
<input type="text" name="name" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Tipe</label>
|
|
<select name="type" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="admin">Admin</option>
|
|
<option value="user">Pengguna</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Isi Pesan</label>
|
|
<textarea name="content" required rows="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"></textarea>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Warna Tombol</label>
|
|
<select name="button_class" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="bg-blue-100 text-blue-700">Biru</option>
|
|
<option value="bg-green-100 text-green-700">Hijau</option>
|
|
<option value="bg-red-100 text-red-700">Merah</option>
|
|
<option value="bg-purple-100 text-purple-700">Ungu</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700">
|
|
Tambah Template
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Daftar Template -->
|
|
<div>
|
|
<h2 class="text-lg font-semibold mb-4">Daftar Template</h2>
|
|
<div class="space-y-4">
|
|
@foreach($templates as $template)
|
|
<div class="border rounded-lg p-4">
|
|
<form action="{{ route('message-templates.update', $template) }}" method="POST" class="space-y-4">
|
|
@csrf
|
|
@method('PUT')
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Nama Template</label>
|
|
<input type="text" name="name" value="{{ $template->name }}" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Tipe</label>
|
|
<select name="type" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="admin" {{ $template->type === 'admin' ? 'selected' : '' }}>Admin</option>
|
|
<option value="user" {{ $template->type === 'user' ? 'selected' : '' }}>Pengguna</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Isi Pesan</label>
|
|
<textarea name="content" required rows="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">{{ $template->content }}</textarea>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Warna Tombol</label>
|
|
<select name="button_class" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="bg-blue-100 text-blue-700" {{ $template->button_class === 'bg-blue-100 text-blue-700' ? 'selected' : '' }}>Biru</option>
|
|
<option value="bg-green-100 text-green-700" {{ $template->button_class === 'bg-green-100 text-green-700' ? 'selected' : '' }}>Hijau</option>
|
|
<option value="bg-red-100 text-red-700" {{ $template->button_class === 'bg-red-100 text-red-700' ? 'selected' : '' }}>Merah</option>
|
|
<option value="bg-purple-100 text-purple-700" {{ $template->button_class === 'bg-purple-100 text-purple-700' ? 'selected' : '' }}>Ungu</option>
|
|
</select>
|
|
</div>
|
|
<div class="flex space-x-2">
|
|
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700">
|
|
Simpan Perubahan
|
|
</button>
|
|
<form action="{{ route('message-templates.destroy', $template) }}" method="POST" class="inline">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="bg-red-600 text-white px-4 py-2 rounded-md hover:bg-red-700" onclick="return confirm('Yakin ingin menghapus template ini?')">
|
|
Hapus
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|