From 47fa3cb3f38d3b874c07ebcb0786dd88667028fe Mon Sep 17 00:00:00 2001 From: Axel Date: Wed, 17 May 2023 13:54:58 +0200 Subject: [PATCH] Splitting Draft et Active bundles --- lang/en/app.php | 5 ++--- lang/fr/app.php | 5 ++--- resources/views/homepage.blade.php | 30 ++++++++++++++++++++++-------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/lang/en/app.php b/lang/en/app.php index 24b4ea2..92bf9e4 100644 --- a/lang/en/app.php +++ b/lang/en/app.php @@ -79,7 +79,6 @@ return [ 'authentication' => 'Authentication', 'login' => 'Username', 'password' => 'Password', - 'do-login' => 'Login now' - - + 'do-login' => 'Login now', + 'pending' => 'Drafts', ]; diff --git a/lang/fr/app.php b/lang/fr/app.php index ef0434f..788af86 100644 --- a/lang/fr/app.php +++ b/lang/fr/app.php @@ -79,7 +79,6 @@ return [ 'authentication' => 'Authentification', 'login' => 'Identifiant', 'password' => 'Mot de passe', - 'do-login' => 'S\'authentifier' - - + 'do-login' => 'S\'authentifier', + 'pending' => 'Brouillons', ]; diff --git a/resources/views/homepage.blade.php b/resources/views/homepage.blade.php index 926cf23..853bd6a 100644 --- a/resources/views/homepage.blade.php +++ b/resources/views/homepage.blade.php @@ -6,8 +6,9 @@ document.addEventListener('alpine:init', () => { Alpine.data('bundle', () => ({ bundles: null, - active: null, - expired: null, + pending: [], + active: [], + expired: [], currentBundle: null, init: function() { @@ -17,20 +18,25 @@ this.bundles = JSON.parse(bundles) if (this.bundles != null && Object.keys(this.bundles).length > 0) { - this.active = [] - this.expired = [] this.bundles.forEach( (bundle) => { if (bundle.title == null || bundle.title == '') { - bundle.title = 'untitled' + bundle.label = 'untitled' + } + else { + bundle.label = bundle.title } if (bundle.expires_at != null && moment.unix(bundle.expires_at).isBefore(moment())) { this.expired.push(bundle) } - else { + else if (bundle.completed == true) { this.active.push(bundle) } + else { + this.pending.push(bundle) + } + bundle.label += ' - {{ __('app.created-at') }} '+moment.unix(bundle.created_at).fromNow() }) } @@ -124,10 +130,18 @@ > + + @@ -135,7 +149,7 @@