관리-도구
편집 파일: project.blade.php
@extends('layouts.app') @section('content') <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script> <link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.js"></script> <div class="main-panel"> <div class="content-wrapper"> <style> .description-cell { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } img.table-img { width: 120px; height: 100px; object-fit: cover; border-radius: 5px; } </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 mb-3"> <h3><b>Projects Flying Eye</b></h3> <button class="btn btn-success" data-toggle="modal" data-target="#addProject">Add New Project +</button> </div> <hr> <!-- ADD PROJECT MODAL --> <div class="modal fade" id="addProject" tabindex="-1"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Add New Project</h5> <button type="button" class="close" data-dismiss="modal"> <span>×</span> </button> </div> <div class="modal-body"> <form method="post" action="{{ route('admin-project.store') }}" enctype="multipart/form-data"> @csrf <div class="form-group"> <label>Project Title</label> <input type="text" name="title" class="form-control" required> </div> <div class="form-group"> <label>Project Image</label> <input type="file" name="image" class="form-control" required> </div> <div class="text-center mt-3"> <button type="submit" class="btn btn-primary w-50">Submit</button> </div> </form> </div> </div> </div> </div> <!-- PROJECT TABLE --> <div class="table-responsive mt-4"> <table class="table table-hover"> <thead> <tr> <th>#</th> <th>Title</th> <th>Image</th> <th class="text-center">Action</th> </tr> </thead> <tbody> @foreach ($projects as $project) <tr> <td>{{ $loop->iteration }}</td> <td>{{ $project->title }}</td> <td> <img src="{{ asset('storage/' . $project->image) }}" class="table-img"> </td> <td class="text-center"> <button class="btn btn-primary my-2" data-toggle="modal" data-target="#updateProject{{ $project->id }}"> <i class="fa fa-pen"></i> </button> <form method="post" action="{{ route('admin-project.destroy', $project->id) }}"> @csrf @method('DELETE') <button class="btn btn-danger my-2"> <i class="fa fa-trash"></i> </button> </form> </td> </tr> <!-- UPDATE MODAL --> <div class="modal fade" id="updateProject{{ $project->id }}"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Update Project</h5> <button type="button" class="close" data-dismiss="modal"> <span>×</span> </button> </div> <div class="modal-body"> <form method="post" action="{{ route('admin-project.update', $project->id) }}" enctype="multipart/form-data"> @csrf @method('PUT') <div class="form-group"> <label>Project Title</label> <input type="text" name="title" class="form-control" value="{{ $project->title }}" required> </div> <div class="form-group"> <label>Update Image (Optional)</label> <input type="file" name="image" class="form-control"> </div> <div class="mb-2"> <img src="{{ asset('storage/' . $project->image) }}" style="width: 120px; height:100px;"> </div> <div class="text-center mt-3"> <button type="submit" class="btn btn-primary w-50">Update</button> </div> </form> </div> </div> </div> </div> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> @endsection