Web FT UNTAN (Laravel 8) versi lama + dump database ftuntan_web_profil
Kode dari ftuntan_main dengan dependensi diperbarui untuk PHP 8.3 (perbaikan insiden 27 Okt 2026). Dump database di database/sql/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
@extends('admin/layout/main')
|
||||
|
||||
@section('title', 'Lomba & Kompetisi')
|
||||
|
||||
@section('container')
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">Lomba & Kompetisi</h1>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
|
||||
<!-- Alert Status -->
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('alert'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session('alert') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Edit Data Lomba & Kompetisi</h3>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<!-- form start -->
|
||||
<form class="from-prevent-multiple-submits" action="{{ route('lomba_kompetisi.update', $lombaKompetisi) }}" method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@method('patch')
|
||||
@csrf
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="judul">Judul</label>
|
||||
<input type="text" class="form-control" id="judul" name="judul"
|
||||
placeholder="Masukkan Judul" value="{{ $lombaKompetisi->judul }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama_foto">Thumbnail (Maksimal 2MB)</label>
|
||||
<div class="form-group">
|
||||
<img src="{{ url($lombaKompetisi->thumbnail) }}" alt="Image Missing"
|
||||
id="old_nama_foto" style="max-width: 200px;"
|
||||
class="mt-2" />
|
||||
</div>
|
||||
<input type="file" accept="image/*" class="form-control mt-0"
|
||||
name="thumbnail" id="input_foto_edit">
|
||||
<input type="hidden" name="old_thumbnail"
|
||||
value="{{ $lombaKompetisi->thumbnail }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="teks">Teks (Foto Maksimal 2MB)</label>
|
||||
<textarea id="teks" placeholder="Masukkan Deskripsi Video"
|
||||
name="teks">{{ $lombaKompetisi->teks }}</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="release_date">Tanggal Rilis</label>
|
||||
<input type="date" class="form-control" name="release_date"
|
||||
value="{{ $lombaKompetisi->release_date }}" required>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
|
||||
<div class="card-footer">
|
||||
<button id="submit" type="submit" class="btn btn-primary from-prevent-multiple-submits">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Define an adapter to upload the files
|
||||
class MyUploadAdapter {
|
||||
constructor(loader) {
|
||||
// The file loader instance to use during the upload. It sounds scary but do not
|
||||
// worry — the loader will be passed into the adapter later on in this guide.
|
||||
this.loader = loader;
|
||||
|
||||
// URL where to send files.
|
||||
this.url = '{{ route('ckeditor.upload') }}';
|
||||
|
||||
//
|
||||
}
|
||||
// Starts the upload process.
|
||||
upload() {
|
||||
return this.loader.file.then(
|
||||
(file) =>
|
||||
new Promise((resolve, reject) => {
|
||||
this._initRequest();
|
||||
this._initListeners(resolve, reject, file);
|
||||
this._sendRequest(file);
|
||||
})
|
||||
);
|
||||
}
|
||||
// Aborts the upload process.
|
||||
abort() {
|
||||
if (this.xhr) {
|
||||
this.xhr.abort();
|
||||
}
|
||||
}
|
||||
// Initializes the XMLHttpRequest object using the URL passed to the constructor.
|
||||
_initRequest() {
|
||||
const xhr = (this.xhr = new XMLHttpRequest());
|
||||
// Note that your request may look different. It is up to you and your editor
|
||||
// integration to choose the right communication channel. This example uses
|
||||
// a POST request with JSON as a data structure but your configuration
|
||||
// could be different.
|
||||
// xhr.open('POST', this.url, true);
|
||||
xhr.open("POST", this.url, true);
|
||||
xhr.setRequestHeader("x-csrf-token", "{{ csrf_token() }}");
|
||||
xhr.responseType = "json";
|
||||
}
|
||||
// Initializes XMLHttpRequest listeners.
|
||||
_initListeners(resolve, reject, file) {
|
||||
const xhr = this.xhr;
|
||||
const loader = this.loader;
|
||||
const genericErrorText = `Couldn't upload file: ${file.name}.`;
|
||||
xhr.addEventListener("error", () => reject(genericErrorText));
|
||||
xhr.addEventListener("abort", () => reject());
|
||||
xhr.addEventListener("load", () => {
|
||||
const response = xhr.response;
|
||||
// This example assumes the XHR server's "response" object will come with
|
||||
// an "error" which has its own "message" that can be passed to reject()
|
||||
// in the upload promise.
|
||||
//
|
||||
// Your integration may handle upload errors in a different way so make sure
|
||||
// it is done properly. The reject() function must be called when the upload fails.
|
||||
if (!response || response.error) {
|
||||
return reject(response && response.error ? response.error.message : genericErrorText);
|
||||
}
|
||||
// If the upload is successful, resolve the upload promise with an object containing
|
||||
// at least the "default" URL, pointing to the image on the server.
|
||||
// This URL will be used to display the image in the content. Learn more in the
|
||||
// UploadAdapter#upload documentation.
|
||||
resolve({
|
||||
default: response.url,
|
||||
});
|
||||
});
|
||||
// Upload progress when it is supported. The file loader has the #uploadTotal and #uploaded
|
||||
// properties which are used e.g. to display the upload progress bar in the editor
|
||||
// user interface.
|
||||
if (xhr.upload) {
|
||||
xhr.upload.addEventListener("progress", (evt) => {
|
||||
if (evt.lengthComputable) {
|
||||
loader.uploadTotal = evt.total;
|
||||
loader.uploaded = evt.loaded;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// Prepares the data and sends the request.
|
||||
_sendRequest(file) {
|
||||
// Prepare the form data.
|
||||
const data = new FormData();
|
||||
data.append("upload", file);
|
||||
// Important note: This is the right place to implement security mechanisms
|
||||
// like authentication and CSRF protection. For instance, you can use
|
||||
// XMLHttpRequest.setRequestHeader() to set the request headers containing
|
||||
// the CSRF token generated earlier by your application.
|
||||
// Send the request.
|
||||
this.xhr.send(data);
|
||||
}
|
||||
// ...
|
||||
}
|
||||
|
||||
function SimpleUploadAdapterPlugin(editor) {
|
||||
editor.plugins.get("FileRepository").createUploadAdapter = (loader) => {
|
||||
// Configure the URL to the upload script in your back-end here!
|
||||
return new MyUploadAdapter(loader);
|
||||
};
|
||||
}
|
||||
|
||||
//Initialize the ckeditor
|
||||
ClassicEditor.create(document.querySelector("#teks"), {
|
||||
extraPlugins: [SimpleUploadAdapterPlugin],
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
//Form edit image validation
|
||||
var uploadField = document.getElementById("input_foto_edit");
|
||||
uploadField.onchange = function() {
|
||||
if (this.files[0].size > 2000000) {
|
||||
alert("Batas maksimum 2MB!");
|
||||
this.value = "";
|
||||
} else {
|
||||
//Ubah Img Preview
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
var output = document.getElementById('old_nama_foto');
|
||||
output.src = reader.result;
|
||||
}
|
||||
reader.readAsDataURL(event.target.files[0]);
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
$('.from-prevent-multiple-submits').on('submit', function(){
|
||||
$('.from-prevent-multiple-submits').attr('disabled','true');
|
||||
})
|
||||
})();
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user