add information
This commit is contained in:
parent
ef35d83647
commit
8fca750c25
|
|
@ -1,90 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\Berita;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
|
|
||||||
class BeritaController extends Controller
|
|
||||||
{
|
|
||||||
// Menampilkan semua berita
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
$berita = Berita::orderBy('tanggal_berita', 'desc')->get();
|
|
||||||
return view('admin.berita.index', compact('berita'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Form tambah berita
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
return view('admin.berita.create');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simpan berita baru
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'judul_berita' => 'required|string|max:255',
|
|
||||||
'isi_berita' => 'required|string',
|
|
||||||
'tanggal_berita' => 'required|date',
|
|
||||||
'gambar_berita' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) return redirect()->back()->withErrors($validator)->withInput();
|
|
||||||
|
|
||||||
$data = $request->only('judul_berita','isi_berita','tanggal_berita');
|
|
||||||
|
|
||||||
if ($request->hasFile('gambar_berita')) {
|
|
||||||
$data['gambar_berita'] = $request->file('gambar_berita')->store('berita', 'public');
|
|
||||||
}
|
|
||||||
|
|
||||||
Berita::create($data);
|
|
||||||
|
|
||||||
return redirect()->route('admin.berita.index')->with('success','Berita berhasil ditambahkan.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Form edit berita
|
|
||||||
public function edit($id_berita)
|
|
||||||
{
|
|
||||||
$berita = Berita::findOrFail($id_berita);
|
|
||||||
return view('admin.berita.edit', compact('berita'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update berita
|
|
||||||
public function update(Request $request, $id_berita)
|
|
||||||
{
|
|
||||||
$berita = Berita::findOrFail($id_berita);
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'judul_berita' => 'required|string|max:255',
|
|
||||||
'isi_berita' => 'required|string',
|
|
||||||
'tanggal_berita' => 'required|date',
|
|
||||||
'gambar_berita' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) return redirect()->back()->withErrors($validator)->withInput();
|
|
||||||
|
|
||||||
$data = $request->only('judul_berita','isi_berita','tanggal_berita');
|
|
||||||
|
|
||||||
if ($request->hasFile('gambar_berita')) {
|
|
||||||
if ($berita->gambar_berita) Storage::disk('public')->delete($berita->gambar_berita);
|
|
||||||
$data['gambar_berita'] = $request->file('gambar_berita')->store('berita','public');
|
|
||||||
}
|
|
||||||
|
|
||||||
$berita->update($data);
|
|
||||||
|
|
||||||
return redirect()->route('admin.berita.index')->with('success','Berita berhasil diperbarui.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hapus berita
|
|
||||||
public function destroy($id_berita)
|
|
||||||
{
|
|
||||||
$berita = Berita::findOrFail($id_berita);
|
|
||||||
if ($berita->gambar_berita) Storage::disk('public')->delete($berita->gambar_berita);
|
|
||||||
$berita->delete();
|
|
||||||
return redirect()->route('admin.berita.index')->with('success','Berita berhasil dihapus.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Informasi;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class InformasiController extends Controller
|
||||||
|
{
|
||||||
|
// Menampilkan semua informasi
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$informasi = Informasi::orderBy('tanggal_informasi', 'desc')->get();
|
||||||
|
return view('admin.informasi.index', compact('informasi'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form tambah informasi
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.informasi.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simpan informasi baru
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kategori_informasi' => 'required|in:berita,pengumuman',
|
||||||
|
'judul_informasi' => 'required|string|max:255',
|
||||||
|
'isi_informasi' => 'required|string',
|
||||||
|
'tanggal_informasi' => 'required|date',
|
||||||
|
'gambar_informasi' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $request->only(
|
||||||
|
'kategori_informasi',
|
||||||
|
'judul_informasi',
|
||||||
|
'isi_informasi',
|
||||||
|
'tanggal_informasi'
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($request->hasFile('gambar_informasi')) {
|
||||||
|
$data['gambar_informasi'] = $request->file('gambar_informasi')
|
||||||
|
->store('informasi', 'public');
|
||||||
|
}
|
||||||
|
|
||||||
|
Informasi::create($data);
|
||||||
|
|
||||||
|
return redirect()->route('admin.informasi.index')
|
||||||
|
->with('success','Informasi berhasil ditambahkan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form edit informasi
|
||||||
|
public function edit($id_informasi)
|
||||||
|
{
|
||||||
|
$informasi = Informasi::findOrFail($id_informasi);
|
||||||
|
return view('admin.informasi.edit', compact('informasi'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update informasi
|
||||||
|
public function update(Request $request, $id_informasi)
|
||||||
|
{
|
||||||
|
$informasi = Informasi::findOrFail($id_informasi);
|
||||||
|
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kategori_informasi' => 'required|in:berita,pengumuman',
|
||||||
|
'judul_informasi' => 'required|string|max:255',
|
||||||
|
'isi_informasi' => 'required|string',
|
||||||
|
'tanggal_informasi' => 'required|date',
|
||||||
|
'gambar_informasi' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $request->only(
|
||||||
|
'kategori_informasi',
|
||||||
|
'judul_informasi',
|
||||||
|
'isi_informasi',
|
||||||
|
'tanggal_informasi'
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($request->hasFile('gambar_informasi')) {
|
||||||
|
|
||||||
|
if ($informasi->gambar_informasi) {
|
||||||
|
Storage::disk('public')->delete($informasi->gambar_informasi);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['gambar_informasi'] = $request->file('gambar_informasi')
|
||||||
|
->store('informasi','public');
|
||||||
|
}
|
||||||
|
|
||||||
|
$informasi->update($data);
|
||||||
|
|
||||||
|
return redirect()->route('admin.informasi.index')
|
||||||
|
->with('success','Informasi berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hapus informasi
|
||||||
|
public function destroy($id_informasi)
|
||||||
|
{
|
||||||
|
$informasi = Informasi::findOrFail($id_informasi);
|
||||||
|
|
||||||
|
if ($informasi->gambar_informasi) {
|
||||||
|
Storage::disk('public')->delete($informasi->gambar_informasi);
|
||||||
|
}
|
||||||
|
|
||||||
|
$informasi->delete();
|
||||||
|
|
||||||
|
return redirect()->route('admin.informasi.index')
|
||||||
|
->with('success','Informasi berhasil dihapus.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\Pengumuman;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
|
|
||||||
class PengumumanController extends Controller
|
|
||||||
{
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
$pengumuman = Pengumuman::orderBy('tanggal_pengumuman', 'desc')->get();
|
|
||||||
return view('admin.pengumuman.index', compact('pengumuman'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
return view('admin.pengumuman.create');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'judul_pengumuman' => 'required|string|max:255',
|
|
||||||
'isi_pengumuman' => 'required|string',
|
|
||||||
'tanggal_pengumuman' => 'required|date',
|
|
||||||
'gambar_pengumuman' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) return redirect()->back()->withErrors($validator)->withInput();
|
|
||||||
|
|
||||||
$data = $request->only('judul_pengumuman','isi_pengumuman','tanggal_pengumuman');
|
|
||||||
|
|
||||||
if ($request->hasFile('gambar_pengumuman')) {
|
|
||||||
$data['gambar_pengumuman'] = $request->file('gambar_pengumuman')->store('pengumuman', 'public');
|
|
||||||
}
|
|
||||||
|
|
||||||
Pengumuman::create($data);
|
|
||||||
return redirect()->route('admin.pengumuman.index')->with('success','Pengumuman berhasil ditambahkan.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function edit($id_pengumuman)
|
|
||||||
{
|
|
||||||
$pengumuman = Pengumuman::findOrFail($id_pengumuman);
|
|
||||||
return view('admin.pengumuman.edit', compact('pengumuman'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update(Request $request, $id_pengumuman)
|
|
||||||
{
|
|
||||||
$pengumuman = Pengumuman::findOrFail($id_pengumuman);
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'judul_pengumuman' => 'required|string|max:255',
|
|
||||||
'isi_pengumuman' => 'required|string',
|
|
||||||
'tanggal_pengumuman' => 'required|date',
|
|
||||||
'gambar_pengumuman' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) return redirect()->back()->withErrors($validator)->withInput();
|
|
||||||
|
|
||||||
$data = $request->only('judul_pengumuman','isi_pengumuman','tanggal_pengumuman');
|
|
||||||
|
|
||||||
if ($request->hasFile('gambar_pengumuman')) {
|
|
||||||
if ($pengumuman->gambar_pengumuman) Storage::disk('public')->delete($pengumuman->gambar_pengumuman);
|
|
||||||
$data['gambar_pengumuman'] = $request->file('gambar_pengumuman')->store('pengumuman','public');
|
|
||||||
}
|
|
||||||
|
|
||||||
$pengumuman->update($data);
|
|
||||||
return redirect()->route('admin.pengumuman.index')->with('success','Pengumuman berhasil diperbarui.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($id_pengumuman)
|
|
||||||
{
|
|
||||||
$pengumuman = Pengumuman::findOrFail($id_pengumuman);
|
|
||||||
if ($pengumuman->gambar_pengumuman) Storage::disk('public')->delete($pengumuman->gambar_pengumuman);
|
|
||||||
$pengumuman->delete();
|
|
||||||
return redirect()->route('admin.pengumuman.index')->with('success','Pengumuman berhasil dihapus.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,46 +4,55 @@
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Berita;
|
use App\Models\Informasi;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class BeritaController extends Controller
|
class BeritaController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tampilkan semua berita.
|
* Tampilkan semua berita
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
// Ambil semua berita terbaru, urut dari tanggal terbaru
|
$berita = Informasi::where('kategori_informasi', 'berita')
|
||||||
$berita = Berita::orderBy('tanggal_berita', 'desc')->paginate(6); // Pagination 6 per halaman
|
->orderBy('tanggal_informasi', 'desc')
|
||||||
|
->paginate(6);
|
||||||
|
|
||||||
return view('user.berita', compact('berita'));
|
return view('user.berita', compact('berita'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tampilkan detail berita.
|
* Detail berita
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
// Ambil berita berdasarkan ID
|
$berita = Informasi::where('kategori_informasi', 'berita')
|
||||||
$berita = Berita::findOrFail($id);
|
->where('id_informasi', $id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
// Ambil 5 berita terbaru selain yang sedang dibuka
|
$recentBerita = Informasi::where('kategori_informasi', 'berita')
|
||||||
$recentBerita = Berita::where('id_berita', '!=', $id)
|
->where('id_informasi', '!=', $id)
|
||||||
->orderBy('tanggal_berita', 'desc')
|
->orderBy('tanggal_informasi', 'desc')
|
||||||
->limit(5)
|
->limit(5)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('user.detail-berita', compact('berita', 'recentBerita'));
|
return view('user.detail-berita', compact('berita', 'recentBerita'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ambil 3 berita terbaru untuk slider di hero section
|
* Berita untuk hero slider
|
||||||
*/
|
*/
|
||||||
public function hero()
|
public function hero()
|
||||||
{
|
{
|
||||||
$beritaHero = Berita::orderBy('tanggal_berita', 'desc')->take(3)->get();
|
$beritaHero = Informasi::where('kategori_informasi', 'berita')
|
||||||
|
->orderBy('tanggal_informasi', 'desc')
|
||||||
|
->take(3)
|
||||||
|
->get();
|
||||||
|
|
||||||
return view('user.index', compact('beritaHero'));
|
return view('user.index', compact('beritaHero'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,22 @@ class IndexController extends Controller
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$sampah = Sampah::orderBy('tahun', 'desc')->first();
|
$sampah = Sampah::orderBy('tahun', 'desc')->first();
|
||||||
$kategoriTps = KategoriTps::orderBy('id_kategori_tps')->get();
|
|
||||||
$lokasiTps = LokasiTps::all();
|
|
||||||
$jumlahTps = LokasiTps::where('kategori_tps_id', '1')->count();
|
|
||||||
$jumlahTps3r = LokasiTps::where('kategori_tps_id', '2')->count();
|
|
||||||
$jumlahTpa = LokasiTps::where('kategori_tps_id', '3')->count();
|
|
||||||
|
|
||||||
return view('user.index', compact('sampah', 'kategoriTps', 'lokasiTps', 'jumlahTps', 'jumlahTps3r', 'jumlahTpa'));
|
$kategoriTps = KategoriTps::orderBy('id_kategori_tps')->get();
|
||||||
|
|
||||||
|
$tps = LokasiTps::all(); // disamakan dengan yang dipakai di view
|
||||||
|
|
||||||
|
$jumlahTps = LokasiTps::where('kategori_tps_id', 1)->count();
|
||||||
|
$jumlahTps3r = LokasiTps::where('kategori_tps_id', 2)->count();
|
||||||
|
$jumlahTpa = LokasiTps::where('kategori_tps_id', 3)->count();
|
||||||
|
|
||||||
|
return view('user.index', compact(
|
||||||
|
'sampah',
|
||||||
|
'kategoriTps',
|
||||||
|
'tps',
|
||||||
|
'jumlahTps',
|
||||||
|
'jumlahTps3r',
|
||||||
|
'jumlahTpa'
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Pengumuman;
|
use App\Models\Informasi;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class PengumumanController extends Controller
|
class PengumumanController extends Controller
|
||||||
|
|
@ -12,28 +12,39 @@ class PengumumanController extends Controller
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$pengumuman = Pengumuman::orderBy('tanggal_pengumuman', 'desc')->paginate(6); // Pagination 6 per halaman
|
$pengumuman = Informasi::where('kategori_informasi','pengumuman')
|
||||||
|
->orderBy('tanggal_informasi','desc')
|
||||||
|
->paginate(6);
|
||||||
|
|
||||||
return view('user.pengumuman', compact('pengumuman'));
|
return view('user.pengumuman', compact('pengumuman'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
$pengumuman = Informasi::where('kategori_informasi','pengumuman')
|
||||||
|
->where('id_informasi',$id)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
$pengumuman = Pengumuman::findOrFail($id);
|
|
||||||
|
|
||||||
$recentPengumuman = Pengumuman::where('id_pengumuman', '!=', $id)
|
$recentPengumuman = Informasi::where('kategori_informasi','pengumuman')
|
||||||
->orderBy('tanggal_pengumuman', 'desc')
|
->where('id_informasi','!=',$id)
|
||||||
->limit(5)
|
->orderBy('tanggal_informasi','desc')
|
||||||
->get();
|
->limit(5)
|
||||||
|
->get();
|
||||||
|
|
||||||
return view('user.detail-pengumuman', compact('pengumuman', 'recentPengumuman'));
|
return view('user.detail-pengumuman', compact('pengumuman','recentPengumuman'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function hero()
|
public function hero()
|
||||||
{
|
{
|
||||||
$pengumumanHero = Pengumuman::orderBy('tanggal_pengumuman', 'desc')->take(3)->get();
|
$pengumumanHero = Informasi::where('kategori_informasi','pengumuman')
|
||||||
|
->orderBy('tanggal_informasi','desc')
|
||||||
|
->take(3)
|
||||||
|
->get();
|
||||||
|
|
||||||
return view('user.index', compact('pengumumanHero'));
|
return view('user.index', compact('pengumumanHero'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Berita extends Model
|
|
||||||
{
|
|
||||||
// Nama tabel
|
|
||||||
protected $table = 'berita';
|
|
||||||
|
|
||||||
// Nama primary key custom
|
|
||||||
protected $primaryKey = 'id_berita';
|
|
||||||
|
|
||||||
// Mass assignable fields
|
|
||||||
protected $fillable = [
|
|
||||||
'judul_berita',
|
|
||||||
'isi_berita',
|
|
||||||
'tanggal_berita',
|
|
||||||
'gambar_berita',
|
|
||||||
];
|
|
||||||
|
|
||||||
// Primary key auto increment
|
|
||||||
public $incrementing = true;
|
|
||||||
|
|
||||||
// Tipe primary key
|
|
||||||
protected $keyType = 'int';
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Informasi extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'informasi';
|
||||||
|
|
||||||
|
protected $primaryKey = 'id_informasi';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'judul_informasi',
|
||||||
|
'kategori_informasi',
|
||||||
|
'isi_informasi',
|
||||||
|
'tanggal_informasi',
|
||||||
|
'gambar_informasi'
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = true;
|
||||||
|
}
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('kategori_tps', function (Blueprint $table) {
|
|
||||||
$table->string('kepanjangan_kategori')->after('nama_kategori');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::table('kategori_tps', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('kepanjangan_kategori');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
// rename tabel berita -> informasi
|
||||||
|
Schema::rename('berita', 'informasi');
|
||||||
|
|
||||||
|
Schema::table('informasi', function (Blueprint $table) {
|
||||||
|
|
||||||
|
// ubah nama primary key
|
||||||
|
$table->renameColumn('id_berita', 'id_informasi');
|
||||||
|
|
||||||
|
// ubah nama kolom
|
||||||
|
$table->renameColumn('judul_berita', 'judul');
|
||||||
|
$table->renameColumn('isi_berita', 'isi');
|
||||||
|
$table->renameColumn('tanggal_berita', 'tanggal');
|
||||||
|
$table->renameColumn('gambar_berita', 'gambar');
|
||||||
|
|
||||||
|
// tambah kategori
|
||||||
|
$table->enum('kategori', ['berita', 'pengumuman'])->after('judul');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::rename('informasi', 'berita');
|
||||||
|
|
||||||
|
Schema::table('berita', function (Blueprint $table) {
|
||||||
|
|
||||||
|
$table->renameColumn('id_informasi', 'id_berita');
|
||||||
|
|
||||||
|
$table->renameColumn('judul', 'judul_berita');
|
||||||
|
$table->renameColumn('isi', 'isi_berita');
|
||||||
|
$table->renameColumn('tanggal', 'tanggal_berita');
|
||||||
|
$table->renameColumn('gambar', 'gambar_berita');
|
||||||
|
|
||||||
|
$table->dropColumn('kategori');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('pengumuman');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('informasi', function (Blueprint $table) {
|
||||||
|
|
||||||
|
$table->renameColumn('kategori', 'kategori_informasi');
|
||||||
|
$table->renameColumn('judul', 'judul_informasi');
|
||||||
|
$table->renameColumn('isi', 'isi_informasi');
|
||||||
|
$table->renameColumn('tanggal', 'tanggal_informasi');
|
||||||
|
$table->renameColumn('gambar', 'gambar_informasi');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('informasi', function (Blueprint $table) {
|
||||||
|
|
||||||
|
$table->renameColumn('kategori_informasi', 'kategori');
|
||||||
|
$table->renameColumn('judul_informasi', 'judul');
|
||||||
|
$table->renameColumn('isi_informasi', 'isi');
|
||||||
|
$table->renameColumn('tanggal_informasi', 'tanggal');
|
||||||
|
$table->renameColumn('gambar_informasi', 'gambar');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
@extends('admin.template')
|
|
||||||
|
|
||||||
@section('title', 'Tambah Berita')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 grid-margin stretch-card">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
|
|
||||||
<h4 class="card-title">Tambah Berita</h4>
|
|
||||||
<p class="card-description">Form tambah data berita</p>
|
|
||||||
|
|
||||||
<form action="{{ route('admin.berita.store') }}" method="POST" enctype="multipart/form-data">
|
|
||||||
@csrf
|
|
||||||
|
|
||||||
{{-- JUDUL BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Judul Berita</label>
|
|
||||||
<input type="text"
|
|
||||||
name="judul_berita"
|
|
||||||
class="form-control @error('judul_berita') is-invalid @enderror"
|
|
||||||
placeholder="Judul Berita"
|
|
||||||
value="{{ old('judul_berita') }}">
|
|
||||||
@error('judul_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- TANGGAL BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tanggal Berita</label>
|
|
||||||
<input type="date"
|
|
||||||
name="tanggal_berita"
|
|
||||||
class="form-control @error('tanggal_berita') is-invalid @enderror"
|
|
||||||
value="{{ old('tanggal_berita') }}">
|
|
||||||
@error('tanggal_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- ISI BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Isi Berita</label>
|
|
||||||
<textarea name="isi_berita"
|
|
||||||
class="form-control @error('isi_berita') is-invalid @enderror"
|
|
||||||
rows="6"
|
|
||||||
placeholder="Isi Berita">{{ old('isi_berita') }}</textarea>
|
|
||||||
@error('isi_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- GAMBAR BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Gambar Berita</label>
|
|
||||||
<input type="file"
|
|
||||||
name="gambar_berita"
|
|
||||||
id="gambar_berita"
|
|
||||||
class="file-upload-default @error('gambar_berita') is-invalid @enderror">
|
|
||||||
|
|
||||||
<div class="input-group col-xs-12">
|
|
||||||
<input type="text"
|
|
||||||
class="form-control file-upload-info"
|
|
||||||
disabled
|
|
||||||
placeholder="Upload Gambar">
|
|
||||||
<span class="input-group-append">
|
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">
|
|
||||||
Upload
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@error('gambar_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
|
||||||
<a href="{{ route('admin.berita.index') }}" class="btn btn-light">Batal</a>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
@extends('admin.template')
|
|
||||||
|
|
||||||
@section('title', 'Edit Berita')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 grid-margin stretch-card">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
|
|
||||||
<h4 class="card-title">Edit Berita</h4>
|
|
||||||
<p class="card-description">Form edit data berita</p>
|
|
||||||
|
|
||||||
<form action="{{ route('admin.berita.update', $berita->id_berita) }}"
|
|
||||||
method="POST"
|
|
||||||
enctype="multipart/form-data">
|
|
||||||
@csrf
|
|
||||||
@method('PUT')
|
|
||||||
|
|
||||||
{{-- JUDUL BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Judul Berita</label>
|
|
||||||
<input type="text"
|
|
||||||
name="judul_berita"
|
|
||||||
class="form-control @error('judul_berita') is-invalid @enderror"
|
|
||||||
value="{{ old('judul_berita', $berita->judul_berita) }}"
|
|
||||||
required>
|
|
||||||
@error('judul_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- TANGGAL BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tanggal Berita</label>
|
|
||||||
<input type="date"
|
|
||||||
name="tanggal_berita"
|
|
||||||
class="form-control @error('tanggal_berita') is-invalid @enderror"
|
|
||||||
value="{{ old('tanggal_berita', $berita->tanggal_berita) }}"
|
|
||||||
required>
|
|
||||||
@error('tanggal_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- ISI BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Isi Berita</label>
|
|
||||||
<textarea name="isi_berita"
|
|
||||||
rows="6"
|
|
||||||
class="form-control @error('isi_berita') is-invalid @enderror"
|
|
||||||
placeholder="Isi Berita">{{ old('isi_berita', $berita->isi_berita) }}</textarea>
|
|
||||||
@error('isi_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- GAMBAR BERITA --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Gambar Berita</label>
|
|
||||||
<input type="file"
|
|
||||||
name="gambar_berita"
|
|
||||||
id="gambar_berita"
|
|
||||||
class="file-upload-default @error('gambar_berita') is-invalid @enderror"
|
|
||||||
accept="image/*">
|
|
||||||
|
|
||||||
<div class="input-group col-xs-12">
|
|
||||||
<input type="text"
|
|
||||||
class="form-control file-upload-info"
|
|
||||||
disabled
|
|
||||||
placeholder="Upload Gambar">
|
|
||||||
<span class="input-group-append">
|
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">
|
|
||||||
Upload
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@error('gambar_berita')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
|
|
||||||
{{-- PREVIEW GAMBAR LAMA --}}
|
|
||||||
@if ($berita->gambar_berita)
|
|
||||||
<div class="mt-2">
|
|
||||||
<img src="{{ asset('storage/' . $berita->gambar_berita) }}"
|
|
||||||
width="250"
|
|
||||||
class="img-thumbnail">
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
|
||||||
<a href="{{ route('admin.berita.index') }}" class="btn btn-light">Batal</a>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
@extends('admin.template')
|
|
||||||
|
|
||||||
@section('title', 'Data Berita')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<style>
|
|
||||||
.deskripsi-truncate-div {
|
|
||||||
max-width: 300px;
|
|
||||||
white-space: normal !important;
|
|
||||||
word-wrap: break-word !important;
|
|
||||||
overflow-wrap: break-word !important;
|
|
||||||
}
|
|
||||||
.table td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 grid-margin stretch-card">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="mb-3 d-flex justify-content-between">
|
|
||||||
<div>
|
|
||||||
<h4 class="mb-0 card-title">Data Berita</h4>
|
|
||||||
<p class="mb-0 card-description">
|
|
||||||
Daftar semua berita yang tersedia
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<a href="{{ route('admin.berita.create') }}" class="btn btn-primary">
|
|
||||||
<i class="bi bi-plus-lg"></i> Tambah
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Judul</th>
|
|
||||||
<th>Gambar</th>
|
|
||||||
<th>Isi</th>
|
|
||||||
<th>Tanggal</th>
|
|
||||||
<th>Aksi</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach ($berita as $item)
|
|
||||||
<tr>
|
|
||||||
<td>{{ $item->judul_berita }}</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->gambar_berita)
|
|
||||||
<img src="{{ asset('storage/' . $item->gambar_berita) }}"
|
|
||||||
alt="Gambar Berita"
|
|
||||||
style="width:200px; height:auto; border-radius:2px;">
|
|
||||||
@else
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="text-justify deskripsi-truncate-div">
|
|
||||||
{{ Str::limit($item->isi_berita, 150, '...') }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>{{ \Carbon\Carbon::parse($item->tanggal_berita)->format('d M Y') }}</td>
|
|
||||||
<td class="text-center">
|
|
||||||
<a href="{{ route('admin.berita.edit', $item->id_berita) }}"
|
|
||||||
class="btn btn-warning btn-sm me-1" title="Edit">
|
|
||||||
<i class="bi bi-pencil-square"></i>
|
|
||||||
</a>
|
|
||||||
<form action="{{ route('admin.berita.destroy', $item->id_berita) }}"
|
|
||||||
method="POST" class="form-hapus" style="display:inline;">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.querySelectorAll('.form-hapus').forEach(form => {
|
|
||||||
form.addEventListener('submit', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Hapus Data Berita?',
|
|
||||||
text: 'Data yang sudah dihapus tidak dapat dikembalikan!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: '#d33',
|
|
||||||
cancelButtonColor: '#6c757d',
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
didOpen: () => {
|
|
||||||
document.querySelector('.swal2-popup').style.fontFamily = 'Nunito, sans-serif';
|
|
||||||
}
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@if (session('success'))
|
|
||||||
<script>
|
|
||||||
Swal.fire({
|
|
||||||
icon: 'success',
|
|
||||||
title: 'Berhasil',
|
|
||||||
text: '{{ session('success') }}',
|
|
||||||
timer: 2000,
|
|
||||||
showConfirmButton: false
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endif
|
|
||||||
@endsection
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
@extends('admin.template')
|
||||||
|
|
||||||
|
@section('title', 'Tambah Informasi')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 grid-margin stretch-card">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="card-title">Tambah Informasi</h4>
|
||||||
|
<p class="card-description">Form tambah data informasi</p>
|
||||||
|
|
||||||
|
<form action="{{ route('admin.informasi.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
{{-- KATEGORI INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Kategori Informasi</label>
|
||||||
|
<select name="kategori_informasi"
|
||||||
|
class="form-control @error('kategori_informasi') is-invalid @enderror">
|
||||||
|
<option value="">-- Pilih Kategori --</option>
|
||||||
|
<option value="berita" {{ old('kategori_informasi') == 'berita' ? 'selected' : '' }}>Berita
|
||||||
|
</option>
|
||||||
|
<option value="pengumuman" {{ old('kategori_informasi') == 'pengumuman' ? 'selected' : '' }}>
|
||||||
|
Pengumuman</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
@error('kategori_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- JUDUL INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Judul Informasi</label>
|
||||||
|
<input type="text" name="judul_informasi"
|
||||||
|
class="form-control @error('judul_informasi') is-invalid @enderror"
|
||||||
|
placeholder="Judul Informasi" value="{{ old('judul_informasi') }}">
|
||||||
|
|
||||||
|
@error('judul_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- TANGGAL INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tanggal Informasi</label>
|
||||||
|
<input type="date" name="tanggal_informasi"
|
||||||
|
class="form-control @error('tanggal_informasi') is-invalid @enderror"
|
||||||
|
value="{{ old('tanggal_informasi') }}">
|
||||||
|
|
||||||
|
@error('tanggal_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ISI INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Isi Informasi</label>
|
||||||
|
<textarea name="isi_informasi" class="form-control @error('isi_informasi') is-invalid @enderror" rows="6"
|
||||||
|
placeholder="Isi Informasi">{{ old('isi_informasi') }}</textarea>
|
||||||
|
|
||||||
|
@error('isi_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- GAMBAR INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Gambar Informasi</label>
|
||||||
|
<input type="file" name="gambar_informasi" id="gambar_informasi"
|
||||||
|
class="file-upload-default @error('gambar_informasi') is-invalid @enderror">
|
||||||
|
|
||||||
|
<div class="input-group col-xs-12">
|
||||||
|
<input type="text" class="form-control file-upload-info" disabled
|
||||||
|
placeholder="Upload Gambar">
|
||||||
|
<span class="input-group-append">
|
||||||
|
<button class="file-upload-browse btn btn-primary" type="button">
|
||||||
|
Upload
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@error('gambar_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||||
|
<a href="{{ route('admin.informasi.index') }}" class="btn btn-light">Batal</a>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
@extends('admin.template')
|
||||||
|
|
||||||
|
@section('title', 'Edit Informasi')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 grid-margin stretch-card">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="card-title">Edit Informasi</h4>
|
||||||
|
<p class="card-description">Form edit data informasi</p>
|
||||||
|
|
||||||
|
<form action="{{ route('admin.informasi.update', $informasi->id_informasi) }}"
|
||||||
|
method="POST"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
|
{{-- KATEGORI INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Kategori Informasi</label>
|
||||||
|
<select name="kategori_informasi"
|
||||||
|
class="form-control @error('kategori_informasi') is-invalid @enderror">
|
||||||
|
|
||||||
|
<option value="berita"
|
||||||
|
{{ old('kategori_informasi', $informasi->kategori_informasi) == 'berita' ? 'selected' : '' }}>
|
||||||
|
Berita
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<option value="pengumuman"
|
||||||
|
{{ old('kategori_informasi', $informasi->kategori_informasi) == 'pengumuman' ? 'selected' : '' }}>
|
||||||
|
Pengumuman
|
||||||
|
</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
@error('kategori_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- JUDUL INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Judul Informasi</label>
|
||||||
|
<input type="text"
|
||||||
|
name="judul_informasi"
|
||||||
|
class="form-control @error('judul_informasi') is-invalid @enderror"
|
||||||
|
value="{{ old('judul_informasi', $informasi->judul_informasi) }}"
|
||||||
|
required>
|
||||||
|
|
||||||
|
@error('judul_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- TANGGAL INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Tanggal Informasi</label>
|
||||||
|
<input type="date"
|
||||||
|
name="tanggal_informasi"
|
||||||
|
class="form-control @error('tanggal_informasi') is-invalid @enderror"
|
||||||
|
value="{{ old('tanggal_informasi', $informasi->tanggal_informasi) }}"
|
||||||
|
required>
|
||||||
|
|
||||||
|
@error('tanggal_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ISI INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Isi Informasi</label>
|
||||||
|
<textarea name="isi_informasi"
|
||||||
|
rows="6"
|
||||||
|
class="form-control @error('isi_informasi') is-invalid @enderror"
|
||||||
|
placeholder="Isi Informasi">{{ old('isi_informasi', $informasi->isi_informasi) }}</textarea>
|
||||||
|
|
||||||
|
@error('isi_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- GAMBAR INFORMASI --}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Gambar Informasi</label>
|
||||||
|
<input type="file"
|
||||||
|
name="gambar_informasi"
|
||||||
|
id="gambar_informasi"
|
||||||
|
class="file-upload-default @error('gambar_informasi') is-invalid @enderror"
|
||||||
|
accept="image/*">
|
||||||
|
|
||||||
|
<div class="input-group col-xs-12">
|
||||||
|
<input type="text"
|
||||||
|
class="form-control file-upload-info"
|
||||||
|
disabled
|
||||||
|
placeholder="Upload Gambar">
|
||||||
|
<span class="input-group-append">
|
||||||
|
<button class="file-upload-browse btn btn-primary" type="button">
|
||||||
|
Upload
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@error('gambar_informasi')
|
||||||
|
<small class="text-danger">{{ $message }}</small>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
{{-- PREVIEW GAMBAR LAMA --}}
|
||||||
|
@if ($informasi->gambar_informasi)
|
||||||
|
<div class="mt-2">
|
||||||
|
<img src="{{ asset('storage/' . $informasi->gambar_informasi) }}"
|
||||||
|
width="250"
|
||||||
|
class="img-thumbnail">
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||||
|
<a href="{{ route('admin.informasi.index') }}" class="btn btn-light">Batal</a>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
@extends('admin.template')
|
||||||
|
|
||||||
|
@section('title', 'Data Informasi')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.isi-truncate-div {
|
||||||
|
max-width: 350px;
|
||||||
|
white-space: normal !important;
|
||||||
|
word-wrap: break-word !important;
|
||||||
|
overflow-wrap: break-word !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 grid-margin stretch-card">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="mb-3 d-flex justify-content-between">
|
||||||
|
<div>
|
||||||
|
<h4 class="mb-0 card-title">Data Informasi</h4>
|
||||||
|
<p class="mb-0 card-description">
|
||||||
|
Daftar semua berita dan pengumuman
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="{{ route('admin.informasi.create') }}" class="btn btn-primary">
|
||||||
|
<i class="bi bi-plus-lg"></i> Tambah
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Kategori</th>
|
||||||
|
<th>Judul</th>
|
||||||
|
<th>Gambar</th>
|
||||||
|
<th>Tanggal</th>
|
||||||
|
<th>Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($informasi as $item)
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
@if ($item->kategori_informasi == 'berita')
|
||||||
|
<label class="badge badge-success">Berita</label>
|
||||||
|
@elseif ($item->kategori_informasi == 'pengumuman')
|
||||||
|
<label class="badge badge-warning">Pengumuman</label>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>{{ $item->judul_informasi }}</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
@if ($item->gambar_informasi)
|
||||||
|
<img src="{{ asset('storage/' . $item->gambar_informasi) }}"
|
||||||
|
alt="Gambar Informasi"
|
||||||
|
style="width:200px; height:auto; border-radius:2px;">
|
||||||
|
@else
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ \Carbon\Carbon::parse($item->tanggal_informasi)->format('d-m-Y') }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-center">
|
||||||
|
|
||||||
|
<a href="{{ route('admin.informasi.edit', $item->id_informasi) }}"
|
||||||
|
class="btn btn-warning btn-sm me-1" title="Edit">
|
||||||
|
<i class="bi bi-pencil-square"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<form action="{{ route('admin.informasi.destroy', $item->id_informasi) }}"
|
||||||
|
method="POST" class="form-hapus" style="display:inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
<i class="bi bi-trash"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.querySelectorAll('.form-hapus').forEach(form => {
|
||||||
|
form.addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Hapus Data Informasi?',
|
||||||
|
text: 'Data yang sudah dihapus tidak dapat dikembalikan!',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#d33',
|
||||||
|
cancelButtonColor: '#6c757d',
|
||||||
|
confirmButtonText: 'Ya, Hapus',
|
||||||
|
cancelButtonText: 'Batal',
|
||||||
|
didOpen: () => {
|
||||||
|
document.querySelector('.swal2-popup').style.fontFamily =
|
||||||
|
'Nunito, sans-serif';
|
||||||
|
}
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@if (session('success'))
|
||||||
|
<script>
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: 'Berhasil',
|
||||||
|
text: '{{ session('success') }}',
|
||||||
|
timer: 2000,
|
||||||
|
showConfirmButton: false
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
@extends('admin.template')
|
|
||||||
|
|
||||||
@section('title', 'Tambah Pengumuman')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 grid-margin stretch-card">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
|
|
||||||
<h4 class="card-title">Tambah Pengumuman</h4>
|
|
||||||
<p class="card-description">Form tambah data pengumuman</p>
|
|
||||||
|
|
||||||
<form action="{{ route('admin.pengumuman.store') }}" method="POST" enctype="multipart/form-data">
|
|
||||||
@csrf
|
|
||||||
|
|
||||||
{{-- JUDUL PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Judul Pengumuman</label>
|
|
||||||
<input type="text"
|
|
||||||
name="judul_pengumuman"
|
|
||||||
class="form-control @error('judul_pengumuman') is-invalid @enderror"
|
|
||||||
placeholder="Judul Pengumuman"
|
|
||||||
value="{{ old('judul_pengumuman') }}">
|
|
||||||
@error('judul_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- TANGGAL PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tanggal Pengumuman</label>
|
|
||||||
<input type="date"
|
|
||||||
name="tanggal_pengumuman"
|
|
||||||
class="form-control @error('tanggal_pengumuman') is-invalid @enderror"
|
|
||||||
value="{{ old('tanggal_pengumuman') }}">
|
|
||||||
@error('tanggal_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- ISI PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Isi Pengumuman</label>
|
|
||||||
<textarea name="isi_pengumuman"
|
|
||||||
class="form-control @error('isi_pengumuman') is-invalid @enderror"
|
|
||||||
rows="6"
|
|
||||||
placeholder="Isi Pengumuman">{{ old('isi_pengumuman') }}</textarea>
|
|
||||||
@error('isi_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- GAMBAR PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Gambar Pengumuman</label>
|
|
||||||
<input type="file"
|
|
||||||
name="gambar_pengumuman"
|
|
||||||
id="gambar_pengumuman"
|
|
||||||
class="file-upload-default @error('gambar_pengumuman') is-invalid @enderror">
|
|
||||||
|
|
||||||
<div class="input-group col-xs-12">
|
|
||||||
<input type="text"
|
|
||||||
class="form-control file-upload-info"
|
|
||||||
disabled
|
|
||||||
placeholder="Upload Gambar">
|
|
||||||
<span class="input-group-append">
|
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">
|
|
||||||
Upload
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@error('gambar_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
|
||||||
<a href="{{ route('admin.pengumuman.index') }}" class="btn btn-light">Batal</a>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
@extends('admin.template')
|
|
||||||
|
|
||||||
@section('title', 'Edit Pengumuman')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 grid-margin stretch-card">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
|
|
||||||
<h4 class="card-title">Edit Pengumuman</h4>
|
|
||||||
<p class="card-description">Form edit data pengumuman</p>
|
|
||||||
|
|
||||||
<form action="{{ route('admin.pengumuman.update', $pengumuman->id_pengumuman) }}"
|
|
||||||
method="POST"
|
|
||||||
enctype="multipart/form-data">
|
|
||||||
@csrf
|
|
||||||
@method('PUT')
|
|
||||||
|
|
||||||
{{-- JUDUL PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Judul Pengumuman</label>
|
|
||||||
<input type="text"
|
|
||||||
name="judul_pengumuman"
|
|
||||||
class="form-control @error('judul_pengumuman') is-invalid @enderror"
|
|
||||||
value="{{ old('judul_pengumuman', $pengumuman->judul_pengumuman) }}"
|
|
||||||
required>
|
|
||||||
@error('judul_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- TANGGAL PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tanggal Pengumuman</label>
|
|
||||||
<input type="date"
|
|
||||||
name="tanggal_pengumuman"
|
|
||||||
class="form-control @error('tanggal_pengumuman') is-invalid @enderror"
|
|
||||||
value="{{ old('tanggal_pengumuman', $pengumuman->tanggal_pengumuman) }}"
|
|
||||||
required>
|
|
||||||
@error('tanggal_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- ISI PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Isi Pengumuman</label>
|
|
||||||
<textarea name="isi_pengumuman"
|
|
||||||
rows="6"
|
|
||||||
class="form-control @error('isi_pengumuman') is-invalid @enderror"
|
|
||||||
placeholder="Isi Pengumuman">{{ old('isi_pengumuman', $pengumuman->isi_pengumuman) }}</textarea>
|
|
||||||
@error('isi_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- GAMBAR PENGUMUMAN --}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Gambar Pengumuman</label>
|
|
||||||
<input type="file"
|
|
||||||
name="gambar_pengumuman"
|
|
||||||
id="gambar_pengumuman"
|
|
||||||
class="file-upload-default @error('gambar_pengumuman') is-invalid @enderror"
|
|
||||||
accept="image/*">
|
|
||||||
|
|
||||||
<div class="input-group col-xs-12">
|
|
||||||
<input type="text"
|
|
||||||
class="form-control file-upload-info"
|
|
||||||
disabled
|
|
||||||
placeholder="Upload Gambar">
|
|
||||||
<span class="input-group-append">
|
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">
|
|
||||||
Upload
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@error('gambar_pengumuman')
|
|
||||||
<small class="text-danger">{{ $message }}</small>
|
|
||||||
@enderror
|
|
||||||
|
|
||||||
{{-- PREVIEW GAMBAR LAMA --}}
|
|
||||||
@if ($pengumuman->gambar_pengumuman)
|
|
||||||
<div class="mt-2">
|
|
||||||
<img src="{{ asset('storage/' . $pengumuman->gambar_pengumuman) }}"
|
|
||||||
width="250"
|
|
||||||
class="img-thumbnail">
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
|
||||||
<a href="{{ route('admin.pengumuman.index') }}" class="btn btn-light">Batal</a>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
@extends('admin.template')
|
|
||||||
|
|
||||||
@section('title', 'Data Pengumuman')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<style>
|
|
||||||
.deskripsi-truncate-div {
|
|
||||||
max-width: 300px;
|
|
||||||
white-space: normal !important;
|
|
||||||
word-wrap: break-word !important;
|
|
||||||
overflow-wrap: break-word !important;
|
|
||||||
}
|
|
||||||
.table td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 grid-margin stretch-card">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="mb-3 d-flex justify-content-between">
|
|
||||||
<div>
|
|
||||||
<h4 class="mb-0 card-title">Data Pengumuman</h4>
|
|
||||||
<p class="mb-0 card-description">
|
|
||||||
Daftar semua pengumuman yang tersedia
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<a href="{{ route('admin.pengumuman.create') }}" class="btn btn-primary">
|
|
||||||
<i class="bi bi-plus-lg"></i> Tambah
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Judul</th>
|
|
||||||
<th>Gambar</th>
|
|
||||||
<th>Isi</th>
|
|
||||||
<th>Tanggal</th>
|
|
||||||
<th>Aksi</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach ($pengumuman as $item)
|
|
||||||
<tr>
|
|
||||||
<td>{{ $item->judul_pengumuman }}</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->gambar_pengumuman)
|
|
||||||
<img src="{{ asset('storage/' . $item->gambar_pengumuman) }}"
|
|
||||||
alt="Gambar Pengumuman"
|
|
||||||
style="width:200px; height:auto; border-radius:2px;">
|
|
||||||
@else
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="text-justify deskripsi-truncate-div">
|
|
||||||
{{ Str::limit($item->isi_pengumuman, 150, '...') }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>{{ \Carbon\Carbon::parse($item->tanggal_pengumuman)->format('d M Y') }}</td>
|
|
||||||
<td class="text-center">
|
|
||||||
<a href="{{ route('admin.pengumuman.edit', $item->id_pengumuman) }}"
|
|
||||||
class="btn btn-warning btn-sm me-1" title="Edit">
|
|
||||||
<i class="bi bi-pencil-square"></i>
|
|
||||||
</a>
|
|
||||||
<form action="{{ route('admin.pengumuman.destroy', $item->id_pengumuman) }}"
|
|
||||||
method="POST" class="form-hapus" style="display:inline;">
|
|
||||||
@csrf
|
|
||||||
@method('DELETE')
|
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.querySelectorAll('.form-hapus').forEach(form => {
|
|
||||||
form.addEventListener('submit', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
Swal.fire({
|
|
||||||
title: 'Hapus Data Pengumuman?',
|
|
||||||
text: 'Data yang sudah dihapus tidak dapat dikembalikan!',
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: '#d33',
|
|
||||||
cancelButtonColor: '#6c757d',
|
|
||||||
confirmButtonText: 'Ya, Hapus',
|
|
||||||
cancelButtonText: 'Batal',
|
|
||||||
didOpen: () => {
|
|
||||||
document.querySelector('.swal2-popup').style.fontFamily = 'Nunito, sans-serif';
|
|
||||||
}
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.isConfirmed) {
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@if (session('success'))
|
|
||||||
<script>
|
|
||||||
Swal.fire({
|
|
||||||
icon: 'success',
|
|
||||||
title: 'Berhasil',
|
|
||||||
text: '{{ session('success') }}',
|
|
||||||
timer: 2000,
|
|
||||||
showConfirmButton: false
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endif
|
|
||||||
@endsection
|
|
||||||
|
|
@ -119,18 +119,18 @@
|
||||||
<span class="menu-title">Kelola Aduan</span>
|
<span class="menu-title">Kelola Aduan</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item {{ request()->routeIs('admin.berita.index') ? 'active' : '' }}">
|
<li class="nav-item {{ request()->routeIs('admin.informasi.index') ? 'active' : '' }}">
|
||||||
<a class="nav-link" href="{{ route('admin.berita.index') }}">
|
<a class="nav-link" href="{{ route('admin.informasi.index') }}">
|
||||||
<i class="icon-mail menu-icon"></i>
|
<i class="icon-mail menu-icon"></i>
|
||||||
<span class="menu-title">Kelola Berita</span>
|
<span class="menu-title">Kelola Informasi</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item {{ request()->routeIs('admin.pengumuman.index') ? 'active' : '' }}">
|
{{-- <li class="nav-item {{ request()->routeIs('admin.pengumuman.index') ? 'active' : '' }}">
|
||||||
<a class="nav-link" href="{{ route('admin.pengumuman.index') }}">
|
<a class="nav-link" href="{{ route('admin.pengumuman.index') }}">
|
||||||
<i class="icon-mail menu-icon"></i>
|
<i class="icon-mail menu-icon"></i>
|
||||||
<span class="menu-title">Kelola Pengumuman</span>
|
<span class="menu-title">Kelola Pengumuman</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li> --}}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,68 +22,69 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nama TPS</th>
|
<th>Nama TPS</th>
|
||||||
<th>Kategori</th>
|
<th>Kategori</th>
|
||||||
<th>Foto</th>
|
<th>Foto</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Aksi</th>
|
<th>Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@forelse ($tps as $item)
|
@forelse ($tps as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $item->nama_tps }}</td>
|
<td>{{ $item->nama_tps }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ $item->kategori->nama_kategori ?? '-' }}
|
{{ $item->kategori->nama_kategori ?? '-' }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($item->foto_tps)
|
@if ($item->foto_tps)
|
||||||
<img src="{{ asset('assets/admin/images/tps/' . $item->foto_tps) }}" alt="Foto TPS"
|
<img src="{{ asset('assets/admin/images/tps/' . $item->foto_tps) }}"
|
||||||
style="
|
alt="Foto TPS"
|
||||||
|
style="
|
||||||
width:200px;
|
width:200px;
|
||||||
height:auto;
|
height:auto;
|
||||||
border-radius:2px;
|
border-radius:2px;
|
||||||
">
|
">
|
||||||
@else
|
@else
|
||||||
<span class="text-muted">-</span>
|
<span class="text-muted">-</span>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($item->status_tps == 'Aktif')
|
@if ($item->status_tps == 'Aktif')
|
||||||
<label class="badge badge-success">Aktif</label>
|
<label class="badge badge-success">Aktif</label>
|
||||||
@elseif ($item->status_tps == 'Tidak Aktif')
|
@elseif ($item->status_tps == 'Tidak Aktif')
|
||||||
<label class="badge badge-secondary">Tidak Aktif</label>
|
<label class="badge badge-secondary">Tidak Aktif</label>
|
||||||
@else
|
@else
|
||||||
<label class="badge badge-warning">Pembangunan</label>
|
<label class="badge badge-warning">Pembangunan</label>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="{{ route('admin.tps.edit', $item->id_tps) }}"
|
<a href="{{ route('admin.tps.edit', $item->id_tps) }}"
|
||||||
class="btn btn-warning btn-sm me-1">
|
class="btn btn-warning btn-sm me-1">
|
||||||
<i class="bi bi-pencil-square"></i>
|
<i class="bi bi-pencil-square"></i>
|
||||||
</a>
|
</a>
|
||||||
<form action="{{ route('admin.tps.destroy', $item->id_tps) }}" method="POST"
|
<form action="{{ route('admin.tps.destroy', $item->id_tps) }}"
|
||||||
class="form-hapus" style="display:inline;">
|
method="POST" class="form-hapus" style="display:inline;">
|
||||||
@csrf
|
@csrf
|
||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5" class="text-center">
|
<td colspan="5" class="text-center">
|
||||||
Data TPS belum tersedia
|
Data TPS belum tersedia
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforelse
|
@endforelse
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<div class="container d-lg-flex justify-content-between align-items-center">
|
<div class="container d-lg-flex justify-content-between align-items-center">
|
||||||
<h1 class="mb-2 mb-lg-0">Berita</h1>
|
<h1 class="mb-2 mb-lg-0">Berita</h1>
|
||||||
|
|
||||||
<nav class="breadcrumbs">
|
<nav class="breadcrumbs">
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="{{ route('user.index') }}">Beranda</a></li>
|
<li><a href="{{ route('user.index') }}">Beranda</a></li>
|
||||||
|
|
@ -14,9 +15,9 @@
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- End Page Title -->
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Blog Posts Section -->
|
|
||||||
<section id="blog-posts" class="blog-posts section">
|
<section id="blog-posts" class="blog-posts section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row gy-4">
|
<div class="row gy-4">
|
||||||
|
|
@ -26,43 +27,60 @@
|
||||||
<article>
|
<article>
|
||||||
|
|
||||||
<div class="post-img">
|
<div class="post-img">
|
||||||
@if ($item->gambar_berita)
|
|
||||||
<img src="{{ asset('storage/' . $item->gambar_berita) }}"
|
@if ($item->gambar_informasi)
|
||||||
alt="{{ $item->judul_berita }}" class="img-fluid">
|
<img src="{{ asset('storage/' . $item->gambar_informasi) }}"
|
||||||
|
alt="{{ $item->judul_informasi }}" class="img-fluid">
|
||||||
@else
|
@else
|
||||||
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
<img src="{{ asset('assets/img/blog/default.jpg') }}" alt="default" class="img-fluid">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p class="post-category">
|
<p class="post-category">
|
||||||
<time datetime="{{ $item->tanggal_berita }}">
|
<time datetime="{{ $item->tanggal_informasi }}">
|
||||||
{{ $item->tanggal_berita ? \Carbon\Carbon::parse($item->tanggal_berita)->translatedFormat('d F Y') : '-' }}
|
{{ \Carbon\Carbon::parse($item->tanggal_informasi)->translatedFormat('d F Y') }}
|
||||||
</time>
|
</time>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<h2 class="title">
|
<h2 class="title">
|
||||||
<a href="{{ route('user.detail-berita', $item->id_berita) }}">
|
<a href="{{ route('user.detail-berita', $item->id_informasi) }}">
|
||||||
{{ Str::limit($item->judul_berita, 30) }}
|
{{ Str::limit($item->judul_informasi, 40) }}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<div class="d-flex align-items-start">
|
<div class="d-flex align-items-start">
|
||||||
<div class="post-meta ms-2">
|
<div class="post-meta ms-2">
|
||||||
|
|
||||||
<p class="post-excerpt">
|
<p class="post-excerpt">
|
||||||
{{ Str::limit(strip_tags($item->isi_berita), 120, '...') }}
|
{{ Str::limit(strip_tags($item->isi_informasi), 120, '...') }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
</div><!-- End post list item -->
|
</div>
|
||||||
|
|
||||||
@empty
|
@empty
|
||||||
<p class="text-center">Belum ada berita tersedia.</p>
|
|
||||||
|
<div class="text-center col-12">
|
||||||
|
<p>Belum ada berita tersedia.</p>
|
||||||
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mt-4 d-flex justify-content-center">
|
||||||
|
{{ $berita->links() }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section><!-- /Blog Posts Section -->
|
</section>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
@extends('user.template')
|
@extends('user.template')
|
||||||
|
|
||||||
@section('title', $berita->judul_berita)
|
@section('title', $berita->judul_informasi)
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<div class="container d-lg-flex justify-content-between align-items-center">
|
<div class="container d-lg-flex justify-content-between align-items-center">
|
||||||
<h1 class="mb-2 mb-lg-0">Detail Berita</h1>
|
<h1 class="mb-2 mb-lg-0">Detail Berita</h1>
|
||||||
|
|
||||||
<nav class="breadcrumbs">
|
<nav class="breadcrumbs">
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="{{ route('user.index') }}">Beranda</a></li>
|
<li><a href="{{ route('user.index') }}">Beranda</a></li>
|
||||||
|
|
@ -15,93 +16,113 @@
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- End Page Title -->
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
|
|
||||||
<!-- Blog Details Section -->
|
|
||||||
<section id="blog-details" class="blog-details section">
|
<section id="blog-details" class="blog-details section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<article class="article">
|
<article class="article">
|
||||||
|
|
||||||
<div class="post-img">
|
<div class="post-img">
|
||||||
@if ($berita->gambar_berita)
|
|
||||||
<img src="{{ asset('storage/' . $berita->gambar_berita) }}"
|
@if ($berita->gambar_informasi)
|
||||||
alt="{{ $berita->judul_berita }}" class="img-fluid">
|
<img src="{{ asset('storage/' . $berita->gambar_informasi) }}"
|
||||||
|
alt="{{ $berita->judul_informasi }}" class="img-fluid">
|
||||||
@else
|
@else
|
||||||
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
<img src="{{ asset('assets/img/blog/default.jpg') }}" alt="default" class="img-fluid">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="title">{{ $berita->judul_berita }}</h2>
|
|
||||||
|
<h2 class="title">
|
||||||
|
{{ $berita->judul_informasi }}
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<div class="meta-top">
|
<div class="meta-top">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li class="d-flex align-items-center">
|
<li class="d-flex align-items-center">
|
||||||
<i class="bi bi-person"></i>
|
<i class="bi bi-person"></i>
|
||||||
{{ $berita->author ?? 'Admin' }}
|
{{ $berita->author ?? 'Admin' }}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="d-flex align-items-center">
|
<li class="d-flex align-items-center">
|
||||||
<i class="bi bi-clock"></i>
|
<i class="bi bi-clock"></i>
|
||||||
<time datetime="{{ $berita->tanggal_berita }}">
|
|
||||||
{{ \Carbon\Carbon::parse($berita->tanggal_berita)->translatedFormat('d F Y') }}
|
<time datetime="{{ $berita->tanggal_informasi }}">
|
||||||
|
{{ \Carbon\Carbon::parse($berita->tanggal_informasi)->translatedFormat('d F Y') }}
|
||||||
</time>
|
</time>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- End meta top -->
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{!! $berita->isi_berita !!}
|
{!! $berita->isi_informasi !!}
|
||||||
</div><!-- End post content -->
|
</div>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section><!-- /Blog Details Section -->
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-lg-4 sidebar">
|
<div class="col-lg-4 sidebar">
|
||||||
|
|
||||||
<div class="widgets-container">
|
<div class="widgets-container">
|
||||||
|
|
||||||
<!-- Recent Posts Widget -->
|
|
||||||
<!-- Recent Posts Widget -->
|
|
||||||
<div class="recent-posts-widget widget-item">
|
<div class="recent-posts-widget widget-item">
|
||||||
|
|
||||||
<h3 class="widget-title">Berita Lainnya</h3>
|
<h3 class="widget-title">Berita Lainnya</h3>
|
||||||
|
|
||||||
@foreach ($recentBerita as $recent)
|
@foreach ($recentBerita as $recent)
|
||||||
<div class="post-item">
|
<div class="post-item">
|
||||||
@if ($recent->gambar_berita)
|
|
||||||
<img src="{{ asset('storage/' . $recent->gambar_berita) }}"
|
@if ($recent->gambar_informasi)
|
||||||
alt="{{ $recent->judul_berita }}" class="flex-shrink-0">
|
<img src="{{ asset('storage/' . $recent->gambar_informasi) }}"
|
||||||
|
alt="{{ $recent->judul_informasi }}" class="flex-shrink-0">
|
||||||
@else
|
@else
|
||||||
<img src="assets/img/blog/default.jpg" alt="default" class="flex-shrink-0">
|
<img src="{{ asset('assets/img/blog/default.jpg') }}" class="flex-shrink-0">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<h4>
|
<h4>
|
||||||
<a href="{{ route('user.detail-berita', $recent->id_berita) }}">
|
<a href="{{ route('user.detail-berita', $recent->id_informasi) }}">
|
||||||
{{ Str::limit($recent->judul_berita, 50) }}
|
{{ Str::limit($recent->judul_informasi, 50) }}
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<time datetime="{{ $recent->tanggal_berita }}">
|
|
||||||
{{ \Carbon\Carbon::parse($recent->tanggal_berita)->translatedFormat('d F Y') }}
|
<time datetime="{{ $recent->tanggal_informasi }}">
|
||||||
|
{{ \Carbon\Carbon::parse($recent->tanggal_informasi)->translatedFormat('d F Y') }}
|
||||||
</time>
|
</time>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
</div><!--/Recent Posts Widget -->
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
@extends('user.template')
|
@extends('user.template')
|
||||||
|
|
||||||
@section('title', $pengumuman->judul_pengumuman)
|
@section('title', $pengumuman->judul_informasi)
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
|
@ -29,15 +29,15 @@
|
||||||
<article class="article">
|
<article class="article">
|
||||||
|
|
||||||
<div class="post-img">
|
<div class="post-img">
|
||||||
@if ($pengumuman->gambar_pengumuman)
|
@if ($pengumuman->gambar_informasi)
|
||||||
<img src="{{ asset('storage/' . $pengumuman->gambar_pengumuman) }}"
|
<img src="{{ asset('storage/' . $pengumuman->gambar_informasi) }}"
|
||||||
alt="{{ $pengumuman->judul_pengumuman }}" class="img-fluid">
|
alt="{{ $pengumuman->judul_informasi }}" class="img-fluid">
|
||||||
@else
|
@else
|
||||||
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="title">{{ $pengumuman->judul_pengumuman }}</h2>
|
<h2 class="title">{{ $pengumuman->judul_informasi }}</h2>
|
||||||
|
|
||||||
<div class="meta-top">
|
<div class="meta-top">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -47,8 +47,8 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="d-flex align-items-center">
|
<li class="d-flex align-items-center">
|
||||||
<i class="bi bi-clock"></i>
|
<i class="bi bi-clock"></i>
|
||||||
<time datetime="{{ $pengumuman->tanggal_pengumuman }}">
|
<time datetime="{{ $pengumuman->tanggal_informasi }}">
|
||||||
{{ \Carbon\Carbon::parse($pengumuman->tanggal_pengumuman)->translatedFormat('d F Y') }}
|
{{ \Carbon\Carbon::parse($pengumuman->tanggal_informasi)->translatedFormat('d F Y') }}
|
||||||
</time>
|
</time>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
</div><!-- End meta top -->
|
</div><!-- End meta top -->
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{!! $pengumuman->isi_pengumuman !!}
|
{!! $pengumuman->isi_informasi !!}
|
||||||
</div><!-- End post content -->
|
</div><!-- End post content -->
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
@ -77,20 +77,20 @@
|
||||||
|
|
||||||
@foreach ($recentPengumuman as $recent)
|
@foreach ($recentPengumuman as $recent)
|
||||||
<div class="post-item">
|
<div class="post-item">
|
||||||
@if ($recent->gambar_pengumuman)
|
@if ($recent->gambar_informasi)
|
||||||
<img src="{{ asset('storage/' . $recent->gambar_pengumuman) }}"
|
<img src="{{ asset('storage/' . $recent->gambar_informasi) }}"
|
||||||
alt="{{ $recent->judul_pengumuman }}" class="flex-shrink-0">
|
alt="{{ $recent->judul_informasi }}" class="flex-shrink-0">
|
||||||
@else
|
@else
|
||||||
<img src="assets/img/blog/default.jpg" alt="default" class="flex-shrink-0">
|
<img src="assets/img/blog/default.jpg" alt="default" class="flex-shrink-0">
|
||||||
@endif
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<h4>
|
<h4>
|
||||||
<a href="{{ route('user.detail-pengumuman', $recent->id_pengumuman) }}">
|
<a href="{{ route('user.detail-pengumuman', $recent->id_informasi) }}">
|
||||||
{{ Str::limit($recent->judul_pengumuman, 50) }}
|
{{ Str::limit($recent->judul_informasi, 50) }}
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<time datetime="{{ $recent->tanggal_pengumuman }}">
|
<time datetime="{{ $recent->tanggal_informasi }}">
|
||||||
{{ \Carbon\Carbon::parse($recent->tanggal_pengumuman)->translatedFormat('d F Y') }}
|
{{ \Carbon\Carbon::parse($recent->tanggal_informasi)->translatedFormat('d F Y') }}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
@php
|
@php
|
||||||
function toDMS($decimal, $type = 'lat') {
|
function toDMS($decimal, $type = 'lat') {
|
||||||
$direction = $decimal < 0
|
$direction = $decimal < 0
|
||||||
? ($type === 'lat' ? 'LS' : 'BB')
|
? ($type === 'lat' ? 'LS' : 'BB')
|
||||||
: ($type === 'lat' ? 'LU' : 'BT');
|
: ($type === 'lat' ? 'LU' : 'BT');
|
||||||
|
|
||||||
|
|
@ -21,9 +21,9 @@ function toDMS($decimal, $type = 'lat') {
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<div class="container d-lg-flex justify-content-between align-items-center">
|
<div class="container d-lg-flex justify-content-between align-items-center">
|
||||||
<h1>Detail TPS</h1>
|
<h1>Detail TPS</h1>
|
||||||
<nav class="breadcrumbs">
|
<nav class="breadcrumbs">
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="/">Beranda</a></li>
|
<li><a href="/">Beranda</a></li>
|
||||||
<li>Sebaran TPS</li>
|
<li>Sebaran TPS</li>
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,8 @@ class="img-fluid" alt="{{ $item->nama_kategori }}">
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a href="{{ route('user.about.kategori', ['id' => $item->id_kategori_tps]) }}" class="stretched-link">
|
<a href="{{ route('user.about.kategori', ['id' => $item->id_kategori_tps]) }}"
|
||||||
|
class="stretched-link">
|
||||||
<h3>{{ $item->kepanjangan_kategori }}</h3>
|
<h3>{{ $item->kepanjangan_kategori }}</h3>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
@ -187,6 +188,208 @@ class="img-fluid" alt="{{ $item->nama_kategori }}">
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
header,
|
||||||
|
.navbar,
|
||||||
|
#header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 2000 !important;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-top,
|
||||||
|
.leaflet-bottom,
|
||||||
|
.leaflet-control {
|
||||||
|
z-index: 400 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mapTPS {
|
||||||
|
width: 100%;
|
||||||
|
height: 450px;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend {
|
||||||
|
background: #fff;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend i {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
float: left;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-location {
|
||||||
|
filter: drop-shadow(0 0 8px rgba(13, 110, 253, 0.8)) drop-shadow(0 0 16px rgba(13, 110, 253, 0.6));
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="map-wrapper">
|
||||||
|
<div class="map-action">
|
||||||
|
<div class="map-action-text">
|
||||||
|
Temukan <b>TPS terdekat</b> dari lokasi Anda saat ini
|
||||||
|
</div>
|
||||||
|
<button type="button" id="btnLokasi" class="btn-lokasi">
|
||||||
|
Cari TPS Terdekat
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="mapTPS"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var map = L.map('mapTPS').setView([-7.6078, 111.903], 12);
|
||||||
|
|
||||||
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© OpenStreetMap'
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
function icon(color) {
|
||||||
|
return new L.Icon({
|
||||||
|
iconUrl: `https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-${color}.png`,
|
||||||
|
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
||||||
|
iconSize: [25, 41],
|
||||||
|
iconAnchor: [12, 41],
|
||||||
|
popupAnchor: [1, -34]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var iconTPS = icon('green');
|
||||||
|
var iconTPS3R = icon('blue');
|
||||||
|
var iconTPA = icon('red');
|
||||||
|
|
||||||
|
var iconNear = new L.Icon({
|
||||||
|
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-gold.png',
|
||||||
|
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
||||||
|
iconSize: [25, 41],
|
||||||
|
iconAnchor: [12, 41],
|
||||||
|
popupAnchor: [1, -34]
|
||||||
|
});
|
||||||
|
|
||||||
|
var tpsData = @json($tps);
|
||||||
|
var markers = [];
|
||||||
|
|
||||||
|
tpsData.forEach(tps => {
|
||||||
|
if (!tps.latitude || !tps.longitude) return;
|
||||||
|
|
||||||
|
let iconUse = iconTPS;
|
||||||
|
if (tps.kategori_tps_id == 2) iconUse = iconTPS3R;
|
||||||
|
if (tps.kategori_tps_id == 3) iconUse = iconTPA;
|
||||||
|
|
||||||
|
let marker = L.marker([tps.latitude, tps.longitude], {
|
||||||
|
icon: iconUse
|
||||||
|
})
|
||||||
|
.bindPopup(`
|
||||||
|
<strong>${tps.nama_tps}</strong><br>
|
||||||
|
<small>${tps.alamat_tps ?? '-'}</small><br>
|
||||||
|
<span class="badge bg-success">${tps.status_tps ?? '-'}</span>
|
||||||
|
<hr style="margin:6px 0">
|
||||||
|
<a href="/tps/${tps.id_tps}" style="font-size:13px">Detail TPS</a>
|
||||||
|
`)
|
||||||
|
.addTo(map);
|
||||||
|
|
||||||
|
marker.tpsData = tps;
|
||||||
|
markers.push(marker);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ===== LEGEND KATEGORI (BALIK 😤) ===== */
|
||||||
|
var legend = L.control({
|
||||||
|
position: 'bottomleft'
|
||||||
|
});
|
||||||
|
legend.onAdd = function() {
|
||||||
|
var div = L.DomUtil.create('div', 'legend');
|
||||||
|
div.innerHTML = `
|
||||||
|
<strong>Kategori TPS</strong><br>
|
||||||
|
<i style="background:#198754"></i> TPS<br>
|
||||||
|
<i style="background:#0d6efd"></i> TPS 3R<br>
|
||||||
|
<i style="background:#dc3545"></i> TPA
|
||||||
|
`;
|
||||||
|
return div;
|
||||||
|
};
|
||||||
|
legend.addTo(map);
|
||||||
|
|
||||||
|
function getDistance(lat1, lon1, lat2, lon2) {
|
||||||
|
const R = 6371;
|
||||||
|
const dLat = (lat2 - lat1) * Math.PI / 180;
|
||||||
|
const dLon = (lon2 - lon1) * Math.PI / 180;
|
||||||
|
const a =
|
||||||
|
Math.sin(dLat / 2) ** 2 +
|
||||||
|
Math.cos(lat1 * Math.PI / 180) *
|
||||||
|
Math.cos(lat2 * Math.PI / 180) *
|
||||||
|
Math.sin(dLon / 2) ** 2;
|
||||||
|
return R * (2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)));
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('btnLokasi').addEventListener('click', function() {
|
||||||
|
|
||||||
|
if (!navigator.geolocation) {
|
||||||
|
alert('Browser tidak mendukung GPS');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
navigator.geolocation.getCurrentPosition(pos => {
|
||||||
|
let userLat = pos.coords.latitude;
|
||||||
|
let userLng = pos.coords.longitude;
|
||||||
|
|
||||||
|
L.circleMarker([userLat, userLng], {
|
||||||
|
radius: 6,
|
||||||
|
color: '#0d6efd',
|
||||||
|
fillColor: '#0d6efd',
|
||||||
|
fillOpacity: 1,
|
||||||
|
className: 'user-location'
|
||||||
|
}).addTo(map)
|
||||||
|
.bindPopup('Lokasi Anda')
|
||||||
|
.openPopup();
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
let pulse = L.circle([userLat, userLng], {
|
||||||
|
radius: 40,
|
||||||
|
color: '#0d6efd',
|
||||||
|
fillColor: '#0d6efd',
|
||||||
|
fillOpacity: 0.35,
|
||||||
|
weight: 0
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
setTimeout(() => map.removeLayer(pulse), 1000);
|
||||||
|
}, 1200);
|
||||||
|
|
||||||
|
let nearest = null;
|
||||||
|
let minDist = Infinity;
|
||||||
|
|
||||||
|
markers.forEach(m => {
|
||||||
|
let tps = m.tpsData;
|
||||||
|
let dist = getDistance(userLat, userLng, tps.latitude, tps.longitude);
|
||||||
|
if (dist < minDist) {
|
||||||
|
minDist = dist;
|
||||||
|
nearest = m;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (nearest) {
|
||||||
|
nearest.setIcon(iconNear);
|
||||||
|
nearest.openPopup();
|
||||||
|
map.setView(nearest.getLatLng(), 15);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<section class="geo-stat-section">
|
<section class="geo-stat-section">
|
||||||
<div class="geo-bg"></div>
|
<div class="geo-bg"></div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,30 +26,30 @@
|
||||||
<article>
|
<article>
|
||||||
|
|
||||||
<div class="post-img">
|
<div class="post-img">
|
||||||
@if ($item->gambar_pengumuman)
|
@if ($item->gambar_informasi)
|
||||||
<img src="{{ asset('storage/' . $item->gambar_pengumuman) }}"
|
<img src="{{ asset('storage/' . $item->gambar_informasi) }}"
|
||||||
alt="{{ $item->judul_pengumuman }}" class="img-fluid">
|
alt="{{ $item->judul_informasi }}" class="img-fluid">
|
||||||
@else
|
@else
|
||||||
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
<img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="post-category">
|
<p class="post-category">
|
||||||
<time datetime="{{ $item->tanggal_pengumuman }}">
|
<time datetime="{{ $item->tanggal_informasi }}">
|
||||||
{{ $item->tanggal_pengumuman ? \Carbon\Carbon::parse($item->tanggal_pengumuman)->translatedFormat('d F Y') : '-' }}
|
{{ $item->tanggal_informasi ? \Carbon\Carbon::parse($item->tanggal_informasi)->translatedFormat('d F Y') : '-' }}
|
||||||
</time>
|
</time>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 class="title">
|
<h2 class="title">
|
||||||
<a href="{{ route('user.detail-pengumuman', $item->id_pengumuman) }}">
|
<a href="{{ route('user.detail-pengumuman', $item->id_informasi) }}">
|
||||||
{{ Str::limit($item->judul_pengumuman, 30) }}
|
{{ Str::limit($item->judul_informasi, 30) }}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="d-flex align-items-start">
|
<div class="d-flex align-items-start">
|
||||||
<div class="post-meta ms-2">
|
<div class="post-meta ms-2">
|
||||||
<p class="post-excerpt">
|
<p class="post-excerpt">
|
||||||
{{ Str::limit(strip_tags($item->isi_pengumuman), 120, '...') }}
|
{{ Str::limit(strip_tags($item->isi_informasi), 120, '...') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@
|
||||||
use App\Http\Controllers\Admin\KategoriTpsController;
|
use App\Http\Controllers\Admin\KategoriTpsController;
|
||||||
use App\Http\Controllers\Admin\SampahController;
|
use App\Http\Controllers\Admin\SampahController;
|
||||||
use App\Http\Controllers\Admin\AduanController as AdminAduanController;
|
use App\Http\Controllers\Admin\AduanController as AdminAduanController;
|
||||||
use App\Http\Controllers\Admin\BeritaController as AdminBeritaController;
|
use App\Http\Controllers\Admin\InformasiController;
|
||||||
use App\Http\Controllers\Admin\PengumumanController as AdminPengumumanController;
|
|
||||||
use App\Http\Controllers\Admin\ProfilController;
|
use App\Http\Controllers\Admin\ProfilController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -79,8 +78,7 @@
|
||||||
Route::post('/aduan/{id}/tanggapi', [AdminAduanController::class, 'tanggapi'])->name('aduan.tanggapi');
|
Route::post('/aduan/{id}/tanggapi', [AdminAduanController::class, 'tanggapi'])->name('aduan.tanggapi');
|
||||||
Route::delete('/aduan/{id}', [AdminAduanController::class, 'destroy'])->name('aduan.destroy');
|
Route::delete('/aduan/{id}', [AdminAduanController::class, 'destroy'])->name('aduan.destroy');
|
||||||
|
|
||||||
Route::resource('berita', AdminBeritaController::class)->except(['show']);
|
Route::resource('informasi', InformasiController::class)->except(['show']);
|
||||||
Route::resource('pengumuman', AdminPengumumanController::class)->except(['show']);
|
|
||||||
|
|
||||||
// PROFIL
|
// PROFIL
|
||||||
Route::get('/profil', [ProfilController::class, 'index'])->name('profil');
|
Route::get('/profil', [ProfilController::class, 'index'])->name('profil');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue