관리-도구
편집 파일: spare.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>Spare</b></h3> <button class="btn btn-success" data-toggle="modal" data-target="#addService">Add new Service +</button> </div> <hr> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#</th> <th>Title</th> <th>Description</th> <th class="text-center">Action</th> </tr> </thead> <tbody> @foreach ($gallery as $service) <tr> <td>{{$loop->iteration}}</td> <td class="title" style="white-space: pre-wrap; padding: 10px; ">{!! $service->title !!}</td> <td class="description" style="white-space: pre-wrap; padding: 10px; ">{!! $service->description !!}</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-spare.destroy', $service->id)}}"> @csrf @method('DELETE') <button class="btn btn-danger my-2"><i class="fa fa-trash"></i></button> </form> </tr> </td> <!--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 service</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-spare.update', $service->id)}}" enctype="multipart/form-data"> @csrf @method('PUT') <div class="form-group"> <label for="exampleInputTitle">Title</label> <input type="text" class="form-control" name="title" id="exampleInputTitle" placeholder="Enter title" value="{{$service->title}}"> </div> <div class="form-group"> <label for="exampleInputDescription">Description</label> <input type="text" class="form-control" name="description" id="exampleInputDescription" placeholder="Enter description" value="{{$service->description}}"> </div> <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 Service</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-spare.store') }}" enctype="multipart/form-data"> @csrf <div class="form-group"> <label for="exampleInputTitle">Title</label> <input type="text" class="form-control" name="title" id="exampleInputTitle" placeholder="Enter title"> </div> <div class="form-group"> <label for="exampleInputDescription">Description</label> <input type="text" class="form-control" name="description" id="exampleInputDescription" placeholder="Enter description"> </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