관리-도구
편집 파일: testimonial.blade.php
@extends('layouts.apps') @section('content') <!--start main wrapper--> <main class="main-wrapper"> <div class="main-content"> <!--breadcrumb--> <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3"> <div class="breadcrumb-title pe-3">AK Furntiure</div> <div class="ps-3"> <nav aria-label="breadcrumb"> <ol class="breadcrumb mb-0 p-0"> <li class="breadcrumb-item"><a href="javascript:;"><i class="bx bx-home-alt"></i></a> </li> <li class="breadcrumb-item active" aria-current="page">Testimonials</li> </ol> </nav> </div> </div> <!--end breadcrumb--> @if(session('success')) <div class="alert alert-success alert-dismissible fade show" role="alert"> <strong>Success!</strong> {{ session('success') }} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> @endif @if(session('message')) <div class="alert alert-info alert-dismissible fade show" role="alert"> {{ session('message') }} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> @endif @if(session('error')) <div class="alert alert-danger alert-dismissible fade show" role="alert"> <strong>Error:</strong> {{ session('error') }} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> @endif @if($errors->any()) <div class="alert alert-danger alert-dismissible fade show" role="alert"> <ul class="mb-0"> @foreach($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> @endif <div class="row g-3"> <div class="col-auto flex-grow-1 overflow-auto"> <div class="btn-group position-static"> <!-- placeholder for filters if needed --> </div> </div> <div class="col-auto"> <div class="d-flex align-items-center gap-2 justify-content-lg-end"> <!-- Add New Button --> <button class="btn btn-primary px-4" data-bs-toggle="modal" data-bs-target="#addModal"> <i class="bi bi-plus-lg me-2"></i>Add New </button> </div> </div> </div><!--end row--> <div class="card mt-4"> <div class="card-body"> <div class="customer-table"> <div class="table-responsive white-space-nowrap"> <table class="table align-middle"> <thead class="table-light"> <tr> <th> <input class="form-check-input" type="checkbox"> </th> <th>#</th> <th>Name</th> <th>Designation</th> <th>Comment</th> <th>Image</th> <th>Action</th> </tr> </thead> <tbody> @foreach ($testimonials as $testimonial) <tr> <td> <input class="form-check-input" type="checkbox"> </td> <td>{{ $loop->iteration }}</td> <td>{{ $testimonial->name }}</td> <td>{{ $testimonial->designation }}</td> <td style="max-width:300px; white-space:normal;">{{ $testimonial->comment }}</td> <td> @if($testimonial->image) <img src="{{ asset('storage/'.$testimonial->image) }}" alt="testimonial image" width="100px"> @else <span class="text-muted">No image</span> @endif </td> <td> <div class="d-flex gap-3"> <!-- Edit Button --> <a href="javascript:;" title="Edit" data-bs-toggle="modal" data-bs-target="#editModal{{ $testimonial->id }}"> <i class="material-icons-outlined">edit</i> </a> <form method="POST" action="{{ route('admin-testimonial.destroy', $testimonial->id) }}" style="display:inline;"> @csrf @method('DELETE') <button type="submit" class="btn p-0 border-0 bg-transparent" onclick="return confirm('Are you sure you want to delete this testimonial?');"> <i class="material-icons-outlined text-danger">delete</i> </button> </form> </div> </td> </tr> <!-- Edit Modal --> <div class="modal fade" id="editModal{{ $testimonial->id }}" tabindex="-1" aria-labelledby="editModalLabel{{ $testimonial->id }}" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="editModalLabel{{ $testimonial->id }}">Edit Testimonial</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <form method="post" action="{{ route('admin-testimonial.update', $testimonial->id) }}" enctype="multipart/form-data"> @csrf @method('PUT') <div class="modal-body"> <div class="mb-3"> <label class="form-label">Name</label> <input type="text" name="name" class="form-control" value="{{ old('name', $testimonial->name) }}"> </div> <div class="mb-3"> <label class="form-label">Designation</label> <input type="text" name="designation" class="form-control" value="{{ old('designation', $testimonial->designation) }}"> </div> <div class="mb-3"> <label class="form-label">Comment</label> <textarea name="comment" class="form-control" rows="4">{{ old('comment', $testimonial->comment) }}</textarea> </div> <div class="mb-3"> <label class="form-label">Image</label> <input type="file" name="image" class="form-control"> @if($testimonial->image) <img src="{{ asset('storage/' . $testimonial->image) }}" alt="current image" width="100" class="mt-2"> @endif </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Update</button> </div> </form> </div> </div> </div> @endforeach <!-- Add New Modal --> <div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="addModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="addModalLabel">Add New Testimonial</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <form method="post" action="{{ route('admin-testimonial.store') }}" enctype="multipart/form-data"> @csrf <div class="modal-body"> <div class="mb-3"> <label class="form-label">Name</label> <input type="text" class="form-control" name="name" placeholder="Enter Name" value="{{ old('name') }}"> </div> <div class="mb-3"> <label class="form-label">Designation</label> <input type="text" class="form-control" name="designation" placeholder="Enter Designation" value="{{ old('designation') }}"> </div> <div class="mb-3"> <label class="form-label">Comment</label> <textarea class="form-control" rows="3" name="comment" placeholder="Enter Comment">{{ old('comment') }}</textarea> </div> <div class="mb-3"> <label class="form-label">Image</label> <input type="file" class="form-control" name="image"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Save</button> </div> </form> </div> </div> </div> </tbody> </table> </div> </div> </div> </div> </div> </main> <!--end main wrapper--> <!--start overlay--> <div class="overlay btn-toggle"></div> <!--end overlay--> <!--start footer--> @endsection