From 46e1e49c4b9af0b6f4c586feb5c572dc7675bf75 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 31 May 2023 22:13:40 +0200 Subject: [PATCH] Add Data-Formations to View --- resources/views/games/create.blade.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/views/games/create.blade.php b/resources/views/games/create.blade.php index 1fd824b..3a2a506 100644 --- a/resources/views/games/create.blade.php +++ b/resources/views/games/create.blade.php @@ -18,13 +18,19 @@ document.getElementById("summary").value = game.summary; //document.getElementById("summary").value = "php translate(':summary', 'de') ".replace(':summary', game.summary); - document.getElementById("release_dates").value = game.release_dates; + var first_release_date = new Date(game['first_release_date']*1000); + document.getElementById("release_date").value = first_release_date.getDate()+"."+(first_release_date.getMonth() + 1)+"."+first_release_date.getFullYear(); document.getElementById("platforms").value = formatCollectPlatformAbbreviations(game.platforms); - document.getElementById("genres").value = game.genres; + var genres = game.genres; + var genre_names = []; + genre_names = genres.map(genre => genre.name); + document.getElementById("genres").value = genre_names; //document.querySelector('[alt="Game Cover "]').src = game.cover_image_path; } + + function formatCategoryToHumanReadable(category) { let formatedCategory = ""; switch (category) { @@ -132,8 +138,8 @@
- - + +