관리-도구
편집 파일: gallery.blade.php
@extends('layouts.app') @section('content') <!-- partial --> <div class="main-panel"> <div class="content-wrapper"> <style> .description-cell { max-width: 200px; /* Adjust the value as needed */ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } </style> <div class="row"> <div class="col-lg-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <div class="d-flex justify-content-between"> <h3 class="text-center"><b>Gallery</b></h3> <button class="btn btn-success" data-toggle="modal" data-target="#addService">Add new Gallery +</button> </div> <hr> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#</th> <th>Image</th> <th class="text-center">Action</th> </tr> </thead> <tbody> @if ($gallery->isEmpty()) <div class="col-12"> <h2 class="text-warning text-center mt-5">No data <i class="fa-solid fa-triangle-exclamation"></i></h2> </div> @endif @foreach ($gallery as $service) <tr> <td>{{$loop->iteration}}</td> <td><img src="{{ asset('storage/' . $service->image) }}" alt=""></td> <td class="text-center"> <button class="btn btn-primary my-2" data-toggle="modal" data-target="#updateService{{$service->id}}"><i class="fa fa-pen"></i></button> <form method="post" action="{{route('admin-gallery.destroy', $service->id)}}"> @csrf @method('DELETE') <button class="btn btn-danger my-2"><i class="fa fa-trash"></i></button> </form> </td> </tr> <!--update Service Modal --> <div class="modal fade" id="updateService{{$service->id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">Update Gallery</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="card"> <div class="card-body"> <form method="post" action="{{route('admin-gallery.update', $service->id)}}" enctype="multipart/form-data"> @csrf @method('PUT') <div class="form-group"> <label for="exampleInputUsername1">Image</label> <input type="file" name="image" value="{{$service->image}}" class="form-control" id="exampleInputUsername1" placeholder="Enter service name"> </div> @if($service->image) <div> <img src="{{ asset('storage/' . $service->image) }}" alt="Selected Image" style="max-width: 100px; max-height: 100px;"> </div> @endif <div class="text-center"><button type="submit" class="btn btn-primary w-50">Submit</button></div> </form> </div> </div> </div> </div> </div> </div> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- content-wrapper ends --> <!--Add Service Modal --> <div class="modal fade" id="addService" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">Add new Gallery</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="card"> <div class="card-body"> <form method="post" action="{{ route('admin-gallery.store') }}" enctype="multipart/form-data"> @csrf <div class="form-group"> <label for="serviceImage">Image</label> <input type="file" name="image" class="form-control" id="serviceImage" required> </div> <div class="text-center"> <button type="submit" class="btn btn-primary w-50">Submit</button> </div> </form> </div> </div> </div> </div> </div> </div> <script> $(document).ready(function() { $('#exampleInputDescription').summernote({ height: 200, // set editor height minHeight: 100, // set minimum height of editor maxHeight: 300, // set maximum height of editor focus: true // set focus to editable area after initializing summernote }); }); </script> @endsection