Files
Fitnessblog/resources/views/back/pages/general_settings.blade.php
2026-01-07 15:46:00 +01:00

180 lines
6.1 KiB
PHP

@extends('back.layout.pages-layout')
@section('pageTitle', isset($pageTitle) ? $pageTitle : 'Page Title here')
@section('content')
<div class="page-header">
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="title">
<h4>Einstellungen</h4>
</div>
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{{ route('admin.dashboard') }}">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
Allgemeine Einstellungen
</li>
</ol>
</nav>
</div>
</div>
</div>
<div class="pd-20 card-box mb-4">
@livewire('admin.settings')
</div>
@endsection
@push('scripts')
<script>
document.getElementById("profileLogoFile").addEventListener("change", function(e) {
const file = e.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function(event) {
document.getElementById("preview_site_logo").src = event.target.result;
};
reader.readAsDataURL(file);
});
$("#updateLogoForm").submit(function(e) {
e.preventDefault();
var form = this;
var inputVal = $(form).find('input[type="file"]').val();
var errorElement = $(form).find('span.text-danger');
errorElement.text('');
if (inputVal.length > 0) {
$.ajax({
url: $(form).attr('action'),
method: $(form).attr('method'),
data: new FormData(form),
processData: false,
dataType: 'json',
contentType: false,
success: function(data) {
toastr.options = {
closeButton: true,
newestOnTop: false,
progressBar: true,
positionClass: "toast-bottom-right",
preventDuplicates: false,
onclick: null,
showDuration: "300",
hideDuration: "1000",
timeOut: "5000",
extendedTimeOut: "1000",
showEasing: "swing",
hideEasing: "linear",
showMethod: "fadeIn",
hideMethod: "fadeOut"
};
if (data.status == 1) {
// Erfolgsnachricht aus RESPONSE
toastr.success(data.message);
$(form)[0].reset();
// Alle Logos aktualisieren
$('img.site_logo').each(function() {
$(this).attr('src', '/' + data.image_path);
});
} else {
toastr.error(data.message || "Es ist ein Fehler aufgetreten.");
}
}
});
} else {
errorElement.text('Bitte, wähle ein Foto');
}
});
</script>
<script>
document.getElementById("profileFaviconFile").addEventListener("change", function(e) {
const file = e.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function(event) {
document.getElementById("preview_site_favicon").src = event.target.result;
};
reader.readAsDataURL(file);
});
$("#updateFaviconForm").submit(function(e) {
e.preventDefault();
var form = this;
var inputVal = $(form).find('input[type="file"]').val();
var errorElement = $(form).find('span.text-danger');
errorElement.text('');
if (inputVal.length > 0) {
$.ajax({
url: $(form).attr('action'),
method: $(form).attr('method'),
data: new FormData(form),
processData: false,
dataType: 'json',
contentType: false,
success: function(data) {
toastr.options = {
closeButton: true,
newestOnTop: false,
progressBar: true,
positionClass: "toast-bottom-right",
preventDuplicates: false,
onclick: null,
showDuration: "300",
hideDuration: "1000",
timeOut: "5000",
extendedTimeOut: "1000",
showEasing: "swing",
hideEasing: "linear",
showMethod: "fadeIn",
hideMethod: "fadeOut"
};
if (data.status == 1) {
// Erfolgsnachricht aus RESPONSE
toastr.success(data.message);
$(form)[0].reset();
// Alle Logos aktualisieren
$('img.site_favicon').each(function() {
$(this).attr('src', '/' + data.image_path);
});
} else {
toastr.error(data.message || "Es ist ein Fehler aufgetreten.");
}
}
});
} else {
errorElement.text('Bitte, wähle ein Foto');
}
});
</script>
@endpush
@push('stylesheets')