Skip to content

Commit

Permalink
Merge branch 'jazz' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
piguycs committed Apr 7, 2024
2 parents 3f59eae + 85598ea commit d3bf8b7
Show file tree
Hide file tree
Showing 30 changed files with 383 additions and 354 deletions.
7 changes: 7 additions & 0 deletions app/controller/artistDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@
$artist = $jazzService->getArtistById($artistId);
$performances = $jazzService->getPerformancesByArtist($artist);

$words = explode(' ', $artist->Bio);
$wordsPerPart = ceil(count($words) / 2);
$bioPart1 = implode(' ', array_slice($words, 0, $wordsPerPart));
$bioPart2 = implode(' ', array_slice($words, $wordsPerPart));

Route::render('jazz.artist.main', [
'artist' => $artist,
'performances' => $performances,
'bioPart1' => $bioPart1,
'bioPart2' => $bioPart2,
]);
});
16 changes: 10 additions & 6 deletions app/controller/artists/createArtist.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
$bio = $props['bio'];

$inputService->checkRequiredFields([$name, $bio]);
$inputService->validateArtistBio($bio);

$songs = [$_POST['song1'] ?? null, $_POST['song2'] ?? null, $_POST['song3'] ?? null];
$albums = [$_POST['album1'] ?? null, $_POST['album2'] ?? null, $_POST['album3'] ?? null];
$songs = [$props['song1'], $props['song2'], $props['song3']];
$albums = [$props['album1'], $props['album2'], $props['album3']];

$headerImgPath = $inputService->checkAndUploadImage('header_img', 'jazz/artists');
$artistImg1Path = $inputService->checkAndUploadImage('artist_img1', 'jazz/artists');
$artistImg2Path = $inputService->checkAndUploadImage('artist_img2', 'jazz/artists');
$performanceImgPath = $inputService->checkAndUploadImage('performance_img', 'jazz/performances');
$inputService->validateAlbums($albums);
$inputService->validateSongs($songs);

$headerImgPath = $inputService->validateAndUploadImage('header_img', 'jazz/artists');
$artistImg1Path = $inputService->validateAndUploadImage('artist_img1', 'jazz/artists');
$artistImg2Path = $inputService->validateAndUploadImage('artist_img2', 'jazz/artists');
$performanceImgPath = $inputService->validateAndUploadImage('performance_img', 'jazz/performances');

$jazzService->createArtist($name, $bio, $headerImgPath, $artistImg1Path, $artistImg2Path, $performanceImgPath, $songs, $albums);

Expand Down
18 changes: 11 additions & 7 deletions app/controller/artists/editArtist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require_once __DIR__ . '/../../service/ValidateInputService.php';

$jazzService = new JazzService();

Route::serve('/artists/editArtist', function (array $props) use ($jazzService){
if(!isset($props['id'])) {
Route::redirect('/artists/manageArtists');
Expand All @@ -33,14 +33,18 @@
$bio = $props['bio'];

$validateInputService->checkRequiredFields([$name, $bio]);
$validateInputService->validateArtistBio($bio);

$songs = [$props['song1'], $props['song2'], $props['song3']];
$albums = [$props['album1'], $props['album2'], $props['album3']];

$songs = [$_POST['song1'] ?? null, $_POST['song2'] ?? null, $_POST['song3'] ?? null];
$albums = [$_POST['album1'] ?? null, $_POST['album2'] ?? null, $_POST['album3'] ?? null];
$validateInputService->validateAlbums($albums);
$validateInputService->validateSongs($songs);

$headerImgPath = $validateInputService->handleImageUpload('header_img', 'jazz/artists');
$artistImg1Path = $validateInputService->handleImageUpload('artist_img1', 'jazz/artists');
$artistImg2Path = $validateInputService->handleImageUpload('artist_img2', 'jazz/artists');
$performanceImgPath = $validateInputService->handleImageUpload('performance_img', 'jazz/performances');
$headerImgPath = $validateInputService->updateImage('header_img', 'jazz/artists');
$artistImg1Path = $validateInputService->updateImage('artist_img1', 'jazz/artists');
$artistImg2Path = $validateInputService->updateImage('artist_img2', 'jazz/artists');
$performanceImgPath = $validateInputService->updateImage('performance_img', 'jazz/performances');

$jazzService->updateArtist($id, $name, $bio, $songs, $albums, $headerImgPath, $artistImg1Path, $artistImg2Path, $performanceImgPath);

Expand Down
2 changes: 1 addition & 1 deletion app/controller/jazzdays/createDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$note = $props['note'];

$validateInputService->checkRequiredFields([$date, $venueId]);
$imgPath = $validateInputService->checkAndUploadImage('image', 'jazz');
$imgPath = $validateInputService->validateAndUploadImage('image', 'jazz');

$jazzService->createJazzDay($date, $venueId, $note, $imgPath);

Expand Down
2 changes: 1 addition & 1 deletion app/controller/jazzdays/editDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
$note = $props['note'];

$validateInputService->checkRequiredFields([$date, $venueId]);
$imgPath = $validateInputService->handleImageUpload('image', 'jazz');
$imgPath = $validateInputService->updateImage('image', 'jazz');

$jazzService->updateJazzDay($dayId, $date, $venueId, $note, $imgPath);

Expand Down
4 changes: 3 additions & 1 deletion app/pages/admin/jazz/manage/artists.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<link href="/css/jazzStyles.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex justify-center items-center h-screen font-montserrat">
<body class="bg-gray-100 font-montserrat">
@include('main.navbar')
<div class="flex justify-center items-center h-screen">
<div class="flex w-full justify-between">

@include('admin.panel')
Expand Down
6 changes: 5 additions & 1 deletion app/pages/admin/jazz/manage/days.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<link href="/css/jazzStyles.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex justify-center items-center h-screen font-montserrat">

<body class="bg-gray-100 font-montserrat">
@include('main.navbar')
<div class="flex justify-center items-center h-screen">

<div class="flex w-full justify-between">

@include('admin.panel')
Expand Down
6 changes: 5 additions & 1 deletion app/pages/admin/jazz/manage/passes.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<link href="/css/jazzStyles.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex justify-center items-center h-screen font-montserrat">

<body class="bg-gray-100 font-montserrat">
@include('main.navbar')
<div class="flex justify-center items-center h-screen">

<div class="flex w-full justify-between">

@include('admin.panel')
Expand Down
6 changes: 5 additions & 1 deletion app/pages/admin/jazz/manage/performances.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<link href="/css/jazzStyles.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex justify-center items-center h-screen font-montserrat">

<body class="bg-gray-100 font-montserrat">
@include('main.navbar')
<div class="flex justify-center items-center h-screen">

<div class="flex w-full justify-between">
<div class="flex flex-wrap">

Expand Down
6 changes: 5 additions & 1 deletion app/pages/admin/jazz/manage/venues.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<link href="/css/jazzStyles.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex justify-center items-center h-screen font-montserrat">

<body class="bg-gray-100 font-montserrat">
@include('main.navbar')
<div class="flex justify-center items-center h-screen">

<div class="flex w-full justify-between">

@include('admin.panel')
Expand Down
12 changes: 12 additions & 0 deletions app/pages/jazz/artist/albums.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="p-4">
<div class="text-center mb-4 md:mb-0">
<div class="p-8 text-center bg-pink-200 rounded-lg overflow-hidden cursor-pointer">
<iframe style="border-radius: 12px"
src="https://open.spotify.com/embed/album/{{ $album }}?utm_source=generator"
width="100%" height="352" allowfullscreen=""
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy">
</iframe>
</div>
</div>
</div>
7 changes: 7 additions & 0 deletions app/pages/jazz/artist/header.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="w-full relative bg-center min-h-[10vh] sm:min-h-[30vh] md:min-h-[70vh]" style="background-image: url('{{ $artist->HeaderImg }}'); background-size: cover;">
<div class="absolute inset-0 flex flex-col justify-center items-center p-4 sm:p-8 text-center text-white">
<h1 class="text-2xl sm:text-4xl md:text-7xl font-medium mb-2 font-noto-serif uppercase">
{{ $artist->Name }}
</h1>
</div>
</div>
177 changes: 52 additions & 125 deletions app/pages/jazz/artist/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,151 +13,78 @@

<body class="font-montserrat">

<!-- header-->
<div class="relative w-full">
@if ($artist->HeaderImg)
<img src="{{ $artist->HeaderImg }}" alt="{{ $artist->Name }}" class="w-full"/>
@else
<!-- remove?-->
<p class="text-gray-500">Header Image</p>
@endif
@include('main.navbar')

<div class="absolute inset-0 flex flex-col justify-center items-center p-8 text-center text-white">
<h1 class="text-7xl font-medium mb-2 font-noto-serif uppercase">
{{ $artist->Name }}
</h1>
</div>
@include('jazz.artist.header')

<div class="text-center pt-6">
<h2 class="text-xl sm:text-2xl md:text-4xl font-noto-serif">
Biography of {{ $artist->Name }}
</h2>
</div>

<!-- bio with img-->
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
<div class="flex flex-col bg-[#FCC040] p-8 m-10">
<div class="text-left mx-auto">
@php
$bioPart1 = 'Some bio';
$bioPart2 = 'Some bio';
if($artist->Bio){
$words = explode(' ', $artist->Bio);
$wordsPerPart = ceil(count($words) / 2);
$bioPart1 = implode(' ', array_slice($words, 0, $wordsPerPart));
$bioPart2 = implode(' ', array_slice($words, $wordsPerPart));
}
@endphp
<p class="mt-4 leading-relaxed">
<div class="grid grid-cols-1 md:grid-cols-2 gap-2 p-2">

<div class="flex flex-col items-center justify-center bg-[#FCC040] p-4 md:p-8 m-8 rounded-lg">
<div class="text-left mx-auto overflow-hidden">
<p class="leading-relaxed">
{{ $bioPart1 }}
</p>
</div>
</div>
<div class="p-6 m-4 overflow-hidden text-center">
@if($artist->ArtistImg1)
<img src="{{ $artist->ArtistImg1 }}" alt="{{ $artist->Name }}"
class="object-contain max-h-80 mx-auto"/>
@else
<p class="text-gray-500">Image</p>
@endif

<div class="p-4 mx-2 my-4 overflow-hidden text-center">
<div class="bg-pink-500 p-4 inline-block max-h-[70vh] overflow-hidden rounded-lg">
<img src="{{ $artist->ArtistImg2 }}" alt="{{ $artist->Name }}" class="max-h-[55vh] w-auto rounded-lg shadow-lg"/>
</div>
</div>
<div class="p-6 m-4 overflow-hidden text-center">
@if($artist->ArtistImg2)
<img src="{{ $artist->ArtistImg2 }}" alt="{{ $artist->Name }}"
class="object-contain max-h-80 mx-auto"/>
@else
<p class="text-gray-500">Image</p>
@endif

<div class="p-4 mx-2 my-4 overflow-hidden text-center">
<div class="bg-pink-500 p-4 inline-block max-h-[70vh] overflow-hidden rounded-lg">
<img src="{{ $artist->ArtistImg1 }}" alt="{{ $artist->Name }}" class="max-h-[55vh] w-auto rounded-lg shadow-lg "/>
</div>
</div>
<div class="flex flex-col p-8 m-10 bg-[#FCC040]">

<div class="flex flex-col items-center justify-center bg-[#FCC040] p-4 md:p-8 m-8 rounded-lg">
<div class="text-left mx-auto overflow-hidden">
<p class="mt-4 leading-relaxed">
<p class="leading-relaxed">
{{ $bioPart2 }}
</p>
</div>
</div>
</div>

<!-- albums-->
<div class="text-center py-6">
<h2 class="text-4xl font-noto-serif">
Discover albums of {{ $artist->Name }}!
</h2>
</div>
<div class="container mx-auto p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach ($artist->Albums as $album)
<div class="p-4">
<div class="p-4 text-center bg-pink-200 rounded-lg overflow-hidden cursor-pointer block">
<iframe style="border-radius: 12px"
src="https://open.spotify.com/embed/album/{{ $album }}?utm_source=generator"
width="100%" height="352" allowfullscreen=""
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy">
</iframe>
</div>
</div>
@endforeach
<!-- albums-->
<div class="text-center py-6">
<h2 class="text-3xl md:text-4xl font-noto-serif">
Discover albums of {{ $artist->Name }}
</h2>
</div>
</div>

<!-- songs-->
<div class="text-center py-6">
<h2 class="text-4xl font-noto-serif">
Discover most popular songs of {{ $artist->Name }}!
</h2>
</div>
<div class="container mx-auto p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach ($artist->Songs as $song)
<div class="p-4">
<div class="text-center mb-4 md:mb-0">
<div class="p-4 text-center overflow-hidden cursor-pointer block">
<iframe style="border-radius: 12px"
src="https://open.spotify.com/embed/track/{{ $song }}?utm_source=generator"
width="100%" height="352" allowfullscreen=""
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
loading="lazy">
</iframe>
</div>
</div>
</div>
@endforeach
<div class="container mx-auto p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach ($artist->Albums as $album)
@include('jazz.artist.albums')
@endforeach
</div>
</div>
</div>

<!-- performances and btn-->
@foreach ($performances as $performance)
<div class="text-center">
<div class="flex flex-col bg-pink-200 items-center p-8 m-6">
<p>
Come to {{ $performance->Day->Venue->Name }}
on {{ date('j F', strtotime($performance->StartDateTime)) }}
to enjoy {{ $artist->Name }}'s music!<br/>
{{ date('H:i', strtotime($performance->StartDateTime)) }}
- {{ date('H:i', strtotime($performance->EndDateTime)) }}
@if (trim($performance->Details) !== '')
| {{ $performance->Details }}
@endif
@if ($performance->Price != '0.00')
- € {{ number_format($performance->Price, 2) }}
@endif
</p>
@if ($performance->Price != '0.00')
<div class="mt-4 flex justify-center w-full">
@if ($performance->AvailableTickets > 0)
<a href="/agenda/purchase?name={{$artist->Name}}" class="p-3 rounded-md font-semibold uppercase cursor-pointer text-xs w-48 bg-yellow-400 text-black">
Buy Tickets!</a>
@else
<button class="p-3 rounded-md font-semibold uppercase cursor-pointer text-xs w-48 bg-red-500 text-white" disabled>
Sold Out
</button>
@endif
</div>
@else
<div class="mt-4 flex justify-center">
<span class="inline-block p-3 rounded-md font-semibold uppercase cursor-pointer text-xs text-black">
For free!
</span>
</div>
@endif
<!-- songs-->
<div class="text-center py-6">
<h2 class="text-3xl font-noto-serif">
Discover most popular songs of {{ $artist->Name }}!
</h2>
</div>
<div class="container mx-auto p-4">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach ($artist->Songs as $song)
@include('jazz.artist.songs')
@endforeach
</div>
</div>
@endforeach

@include('jazz.artist.performances')

@include('main.footer')

</body>
</html>
Loading

0 comments on commit d3bf8b7

Please sign in to comment.