Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source downgrade #25

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/Http/Controllers/Admin/GalleryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,17 @@ public function gallery($id)
$gallery->save();

// Get the next gallery ID
$nextGallery = Gallery::where('id', '>', $id)->orderBy('id', 'asc')->first();
$nextGallery = Gallery::where('user_id', $gallery->user->id)
->where('id', '>', $id)
->orderBy('id', 'asc')
->first();
$nextGalleryId = $nextGallery ? $nextGallery->id : null;

// Get the previous gallery ID
$prevGallery = Gallery::where('id', '<', $id)->orderBy('id', 'desc')->first();
$prevGallery = Gallery::where('user_id', $gallery->user->id)
->where('id', '<', $id)
->orderBy('id', 'desc')
->first();
$prevGalleryId = $prevGallery ? $prevGallery->id : null;

$query = ArtWork::query()->where('gallery_id', $id)->orderBy('updated_at', 'desc');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function register(Request $request)

$address = $request['email'];
auth()->login($user);
// Toastr::success(__('Your account has been successfully created.'));

event(new Registered($user));
return redirect()->route('verification.notice');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Site/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public function uploadItems(Request $request)
// Validate the request

$request->validate([
'thumbnail' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
'thumbnail' => 'required|mimetypes:image/jpeg,image/png,image/jpg,image/gif,image/bmp,image/svg+xml,image/webp,image/avif|max:2048',
]);

// Handle the file upload
Expand Down
10 changes: 8 additions & 2 deletions app/Http/Controllers/Site/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ public function artwork($id)
);

// Get the next gallery ID
$nextArtwork = ArtWork::where('id', '>', $id)->orderBy('id', 'asc')->first();
$nextArtwork = ArtWork::where('gallery_id', $artwork->gallery->id)
->where('id', '>', $id)
->orderBy('id', 'asc')
->first();
$nextArtworkId = $nextArtwork ? $nextArtwork->id : null;

// Get the previous gallery ID
$prevArtwork = ArtWork::where('id', '<', $id)->orderBy('id', 'desc')->first();
$prevArtwork = ArtWork::where('gallery_id', $artwork->gallery->id)
->where('id', '<', $id)
->orderBy('id', 'desc')
->first();
$prevArtworkId = $prevArtwork ? $prevArtwork->id : null;

return view('frontend.artwork', compact('condition', 'visibility', 'info', 'section', 'artwork', 'stype', 'background', 'nextArtworkId', 'prevArtworkId', 'sources'));
Expand Down
8 changes: 6 additions & 2 deletions public/frontend/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ button.row_but {
.page-latest .primary .view-buttons a,.page-latest .primary .social-buttons a,
.page-member .primary .view-buttons a,.page-member .primary .social-buttons a {
color: white;
font-size: 30px;
font-size: 23px;
text-decoration: none;
margin-left: 15px;
}
Expand Down Expand Up @@ -1416,7 +1416,7 @@ button.row_but {
}

.tag-page-gallery .active {
font-weight: 600;
font-weight: 500;
color: white!important;
}

Expand Down Expand Up @@ -1587,4 +1587,8 @@ button.row_but {

.border-bottom-divider {
border-bottom: 1px solid #fff;
}

.text-bold {
font-weight: bold;
}
Binary file added public/images/img/no_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/uploads/251-1739723570.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/uploads/251-1739724279.webp
Binary file not shown.
Binary file added public/uploads/251-1739724318.webp
Binary file not shown.
Binary file added public/uploads/251-1739724838.webp
Binary file not shown.
Binary file added public/uploads/251-1739742436.webp
Binary file not shown.
Binary file added public/uploads/251-1739742515.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/views/frontend/about.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<main id="main" class="main-content">
<div id="content" class="page-about">
<div class="content_box">
<div class="container-fluit pt-4">
<div class="container-fluit pt-4 p-5">
<div class="row">
<div class="col-md-12 center primary p-4">
<h1 class="mb-4">ABOUT US</h1>
Expand Down
3 changes: 0 additions & 3 deletions resources/views/frontend/account.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@
flex: 1;
}

.row>* {
overflow: hidden;
}
.w-flexible {
width: calc(100% - 260px) !important;
}
Expand Down
29 changes: 18 additions & 11 deletions resources/views/frontend/account/editartwork.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,21 @@
</div>
<div class="row mt-3">
<div class="col-md-6 row">
<label class="form-check-label col-sm-8" for="key">Key Arwork:</label>
<label class="form-check-label col-sm-8" for="key">Key Artwork:</label>
<div class="col-sm-4">
<input class="form-check-input" type="checkbox" id="key" name="keyart" value="{{$artwork->keyart}}" {{$artwork->keyart == "on" ? "checked" : ""}}>
</div>
</div>
<div class="col-md-6 row">
<label class="form-check-label col-sm-8" for="book">Book Arwork:</label>
<label class="form-check-label col-sm-8" for="book">Book Artwork:</label>
<div class="col-sm-4">
<input class="form-check-input" type="checkbox" id="book" name="bookart" value="{{$artwork->bookart}}" {{$artwork->bookart == "on" ? "checked" : ""}}>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-md-6 row">
<label class="form-check-label col-sm-8" for="end">End Arwork:</label>
<label class="form-check-label col-sm-8" for="end">End Artwork:</label>
<div class="col-sm-4">
<input class="form-check-input" type="checkbox" id="end" name="endart" value="{{$artwork->endart}}" {{$artwork->endart == "on" ? "checked" : ""}}>
</div>
Expand Down Expand Up @@ -422,10 +422,6 @@
/* float: left; */
}

.submit-artwork {
background-color: #999999;
}

.page-account-upload .create {
float: right;
}
Expand Down Expand Up @@ -614,10 +610,21 @@

xhr.onload = function() {
if (xhr.status === 200) {
var responseData = JSON.parse(xhr.responseText);
$(selector).parent().find('img').attr("src", '{{ static_asset('uploads') }}' + '/' + responseData.path);
$(selector).parent().find('input').val(responseData.path);
console.log('File uploaded successfully');
try {
var responseData = JSON.parse(xhr.responseText);
$(selector).parent().find('img').attr("src", '{{ static_asset('uploads') }}' + '/' + responseData.path);
$(selector).parent().find('input').val(responseData.path);
console.log('File uploaded successfully');
} catch (error) {
$(selector).parent().find('.progress').css('display', 'none');
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to upload file.',
cancelButtonColor: 'grey',
confirmButtonColor: 'grey',
});
}
} else {
console.error('File upload failed');
}
Expand Down
19 changes: 15 additions & 4 deletions resources/views/frontend/account/gallery.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
$("#thumbnail").on('click', function() {
var input = document.createElement('input');
input.type = 'file';
input.accept = 'image/png, image/gif, image/jpeg, image/bmp';
input.accept = 'image/png, image/gif, image/jpeg, image/bmp, image/webp, image/avif';
input.onchange = function(event) {
var file = event.target.files[0];
var formData = new FormData();
Expand All @@ -299,9 +299,20 @@

xhr.onload = function() {
if (xhr.status === 200) {
var responseData = JSON.parse(xhr.responseText);
$(".gallery-url").val(responseData.path);
console.log('File uploaded successfully');

try {
var responseData = JSON.parse(xhr.responseText);
$(".gallery-url").val(responseData.path);
} catch (error) {
document.querySelector('.progress').style.display = 'none';
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to upload file.',
cancelButtonColor: 'grey',
confirmButtonColor: 'grey',
});
}
} else {
console.error('File upload failed');
}
Expand Down
13 changes: 12 additions & 1 deletion resources/views/frontend/account/link.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,18 @@
@else
@foreach($links as $link)
<tr data-id="{{ $link->id }}">
<td><a style="color:red; text-decoration: none; font-size: unset;" href="{{ $link->url }}" target="_blank">{{ $link->name }}</a></td>
<td>
@php
// Function to ensure URLs are properly formatted with a scheme
$ensureHttp = function($url) {
return preg_match('~^(?:f|ht)tps?://~i', $url) ? $url : 'http://' . $url;
};

// Format the URL using the helper function
$formattedUrl = $ensureHttp($link->url);
@endphp
<a style="color:red; text-decoration: none; font-size: unset;" href="{{ $formattedUrl }}" target="_blank">{{ $link->name }}</a>
</td>
<td>{{ $link->desc }}</td>
<td>
<a href="{{ route('link.edit', $link->id) }}">
Expand Down
57 changes: 41 additions & 16 deletions resources/views/frontend/account/upload.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
<div class="row">
<div class="col-md-6 row">
<label class="col-sm-4 col-form-label" >MainImage:</label>
<div class="col-sm-8">
<button type="button" id="main-file">Upload File</button>
<div class="col-sm-8" style="position: relative;">
<button type="button" id="main-file" style="position: relative; z-index: 99;">Upload File</button>
<div class="progress mt-2" style="display: none;">
<div class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<input type="text" class="form-control main-file" name="mainfile" placeholder="" hidden>
<p class="main-image-select-badge" style="margin: 0; color: red; display: none;">* Please select main image.</p>
<input type="text" class="form-control main-file" name="mainfile" required>
</div>
</div>
<div class="col-md-6 row">
Expand Down Expand Up @@ -274,21 +275,21 @@
</div>
<div class="row mt-3">
<div class="col-md-6 row">
<label class="form-check-label col-sm-8" for="key">Key Arwork:</label>
<label class="form-check-label col-sm-8" for="key">Key Artwork:</label>
<div class="col-sm-4">
<input class="form-check-input" type="checkbox" id="key" name="keyart">
</div>
</div>
<div class="col-md-6 row">
<label class="form-check-label col-sm-8" for="book">Book Arwork:</label>
<label class="form-check-label col-sm-8" for="book">Book Artwork:</label>
<div class="col-sm-4">
<input class="form-check-input" type="checkbox" id="book" name="bookart">
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-md-6 row">
<label class="form-check-label col-sm-8" for="end">End Arwork:</label>
<label class="form-check-label col-sm-8" for="end">End Artwork:</label>
<div class="col-sm-4">
<input class="form-check-input" type="checkbox" id="end" name="endart">
</div>
Expand Down Expand Up @@ -394,6 +395,16 @@
@endsection

<style>
.main-file {
width: 1px !important;
padding: 0 !important;
height: 1px;
position: absolute;
top: 50%;
left: 50%;
z-index: 1;
opacity: 0;
}
.page-account-upload h2 {
width: 100%;
border-bottom: 1px solid white;
Expand Down Expand Up @@ -431,11 +442,7 @@
color: white;
/* float: left; */
}

.submit-artwork {
background-color: #999999;
}


.page-account-upload .create {
float: right;
}
Expand Down Expand Up @@ -511,13 +518,18 @@
}
</style>


<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

<script>
$(document).ready(function() {

$('.main-file').on('focus', function(e) {
e.preventDefault();
$('.main-image-select-badge').css('display', 'block');
$("#main-file").blur();
});

$('.delete-button').on('click', function(e) {
e.preventDefault();
var itemId = $(this).data('id');
Expand Down Expand Up @@ -588,6 +600,8 @@
// Handle progress events
xhr.upload.onprogress = function(event) {
if (event.lengthComputable) {
$('.main-image-select-badge').css('display', 'none');

var percentComplete = (event.loaded / event.total) * 100;

$(selector).parent().find('.progress').css('display', 'block');
Expand All @@ -599,10 +613,21 @@

xhr.onload = function() {
if (xhr.status === 200) {
var responseData = JSON.parse(xhr.responseText);
console.log($(selector).parent().find('input'));
$(selector).parent().find('input').val(responseData.path);
console.log('File uploaded successfully');
try {
var responseData = JSON.parse(xhr.responseText);
$(selector).parent().find('input').val(responseData.path);
console.log('File uploaded successfully');
} catch (error) {
$(selector).parent().find('.progress').css('display', 'none');
console.log(error);
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Failed to upload file.',
cancelButtonColor: 'grey',
confirmButtonColor: 'grey',
});
}
} else {
console.error('File upload failed');
}
Expand Down
Loading