diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php
index c5c46ebf..e01920d3 100644
--- a/app/Http/Controllers/DashboardController.php
+++ b/app/Http/Controllers/DashboardController.php
@@ -298,17 +298,41 @@ class DashboardController extends ExtendedController
->get();
$statistics = array();
+ $totals = (object)[];
+ $totals->totalOverall = 0;
+ $totals->totalLastHour = 0;
+ $totals->totalToday = 0;
+ $totals->totalToday = 0;
+ $totals->totalSevenDays = 0;
// Zähle alle Datenbankeinträge nach Orten
foreach($cities as $city)
{
$obj = (object)[];
$obj->city = $city->city;
$obj->subscriptions = SubscribeChild::where('city', $city->city)->count();
+ $totals->totalOverall += $obj->subscriptions;
+
+ $obj->lastHour = SubscribeChild::where('city', $city->city)
+ ->where('created_at', '>', Carbon::now()->subHours(1)->toDateTimeString())
+ ->count();
+ $totals->totalLastHour += $obj->lastHour;
+
+ $obj->today = SubscribeChild::where('city', $city->city)
+ ->where('created_at', '>', Carbon::today()->toDateTimeString())
+ ->count();
+ $totals->totalToday += $obj->today;
+
+ $obj->sevenDays = SubscribeChild::where('city', $city->city)
+ ->where('created_at', '>', Carbon::today()->subDays(7)->toDateTimeString())
+ ->count();
+ $totals->totalSevenDays += $obj->sevenDays;
+
$obj->duplicates = SubscribeChild::where('city', $city->city)
->groupBy('lastnameParent', 'firstnameParent', 'firstnameChild', 'city')
->orderBy('lastnameParent', 'firstnameParent', 'firstnameChild')
->havingRaw('COUNT(*) > 1')
->get();
+
$statistics[] = $obj;
}
@@ -321,7 +345,7 @@ class DashboardController extends ExtendedController
$view->with('title', __('admin.subscriptions'));
$view->with('type', 'subscriptions');
$view->with('statistics', $statistics);
- $view->with('total', $count);
+ $view->with('totals', $totals);
return $view->render();
}
diff --git a/app/Http/Controllers/ExtendedController.php b/app/Http/Controllers/ExtendedController.php
index 7772d18d..b71e8dcd 100755
--- a/app/Http/Controllers/ExtendedController.php
+++ b/app/Http/Controllers/ExtendedController.php
@@ -430,7 +430,14 @@ class ExtendedController extends Controller
public function create()
{
- $model = $this->newModel()->create();
+ if($this->modelClass == Post::class)
+ {
+ $model = $this->newModel()->create();
+ }
+ else
+ {
+ $model = $this->newModel();
+ }
$model->save();
$model = $this->prepareModel($model);
$this->hook_after_action_create($model);
@@ -949,7 +956,14 @@ class ExtendedController extends Controller
}
}
- $model->fill($request->all());
+ foreach($request->all() as $key => $value)
+ {
+ if(Schema::hasColumn($model->getTable(), $key))
+ {
+ $model->$key = $value;
+ }
+ }
+// $model->fill($request->all());
// $model->fill($request->only($fields));
if($this->modelClass == Post::class || $this->modelClass == Tag::class)
{
diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php
index e7c181f2..f6a4a49b 100644
--- a/app/Http/Controllers/PostController.php
+++ b/app/Http/Controllers/PostController.php
@@ -292,35 +292,38 @@ class PostController extends ExtendedController
// Vorberechnungen zum Veröffentlichungsdatum
$daysToPublishBefore = -999999;
$publishDate = Carbon::now()->startOfDay();
- if(key_exists('date', $this->publishOptions))
+ if(is_array($this->publishOptions))
{
- $publishDateString = strtolower($this->publishOptions['date']);
- if($publishDateString == 'now')
+ if(key_exists('date', $this->publishOptions))
{
- if($import)
+ $publishDateString = strtolower($this->publishOptions['date']);
+ if($publishDateString == 'now')
{
- $daysToPublishBefore = 0;
+ if($import)
+ {
+ $daysToPublishBefore = 0;
+ }
+ else
+ {
+ $daysToPublishBefore = Carbon::now()->diffInDays(Carbon::parse($model->datetime));
+ }
}
else
{
- $daysToPublishBefore = Carbon::now()->diffInDays(Carbon::parse($model->datetime));
+ $daysToPublishBefore = preg_replace('/[^0-9]/', '', $publishDateString);
+ if(substr($publishDateString, -1) == "w")
+ {
+ // Umrechnung von Wochen in Tage
+ $daysToPublishBefore *= 7;
+ }
+ if(substr($publishDateString, 0, 1) == "-")
+ {
+ $daysToPublishBefore *= -1;
+ }
}
+ // Berechne das Datum, an dem der Post veröffentlicht werden soll
+ $publishDate = Carbon::parse($model->datetime)->addDays($daysToPublishBefore)->startOfDay();
}
- else
- {
- $daysToPublishBefore = preg_replace('/[^0-9]/', '', $publishDateString);
- if(substr($publishDateString, -1) == "w")
- {
- // Umrechnung von Wochen in Tage
- $daysToPublishBefore *= 7;
- }
- if(substr($publishDateString, 0, 1) == "-")
- {
- $daysToPublishBefore *= -1;
- }
- }
- // Berechne das Datum, an dem der Post veröffentlicht werden soll
- $publishDate = Carbon::parse($model->datetime)->addDays($daysToPublishBefore)->startOfDay();
}
return $publishDate;
diff --git a/public/js/admin-script.js b/public/js/admin-script.js
index be483f3a..cb325d3c 100644
--- a/public/js/admin-script.js
+++ b/public/js/admin-script.js
@@ -355,9 +355,16 @@ $(document).ready(function () {
$('.nav-tabs a[href="#files-details"]').tab('show'); // Nur benötigte Schaltflächen anzeigen
$('.btn.wizard_step_back').show();
- $('.btn.wizard_step_forward').show();
- $('.btn.save').hide();
- wizardState = wizardStates.STEP_FILES;
+
+ if ($(".nav-item a[href='#files-details']").length) {
+ $('.btn.wizard_step_forward').show();
+ $('.btn.save').hide();
+ wizardState = wizardStates.STEP_FILES;
+ } else {
+ wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
+ updateWizardForm(null);
+ }
+
break;
case wizardStates.BACK_TO_STEP_FORM:
@@ -382,6 +389,11 @@ $(document).ready(function () {
wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
updateWizardForm(null);
break;
+
+ case wizardButtonStates.BUTTON_SAVE:
+ wizardState = wizardStates.SAVE;
+ updateWizardForm(null);
+ break;
}
break;
diff --git a/resources/assets/js/admin-script.js b/resources/assets/js/admin-script.js
index 56809756..9b964cee 100644
--- a/resources/assets/js/admin-script.js
+++ b/resources/assets/js/admin-script.js
@@ -271,9 +271,17 @@ $(document).ready(function (){
// Nur benötigte Schaltflächen anzeigen
$('.btn.wizard_step_back').show();
- $('.btn.wizard_step_forward').show();
- $('.btn.save').hide();
- wizardState = wizardStates.STEP_FILES;
+ if($(".nav-item a[href='#files-details']").length)
+ {
+ $('.btn.wizard_step_forward').show();
+ $('.btn.save').hide();
+ wizardState = wizardStates.STEP_FILES;
+ }
+ else
+ {
+ wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
+ updateWizardForm(null);
+ }
break;
case wizardStates.BACK_TO_STEP_FORM:
@@ -300,6 +308,11 @@ $(document).ready(function (){
wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
updateWizardForm(null);
break;
+
+ case wizardButtonStates.BUTTON_SAVE:
+ wizardState = wizardStates.SAVE;
+ updateWizardForm(null);
+ break;
}
break; break;
diff --git a/resources/views/inc/admin/crudModal.blade.php b/resources/views/inc/admin/crudModal.blade.php
index 3bf3c860..cd3b2f44 100755
--- a/resources/views/inc/admin/crudModal.blade.php
+++ b/resources/views/inc/admin/crudModal.blade.php
@@ -108,13 +108,15 @@
{{ Form::open(array('id' => 'formPublish')) }}
{{ Form::checkbox('publish_website', 'true', ($model->published == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_website')) }}
{{ Form::label('publish_website', 'Internetseite') }}
- @if($model->hasPublications)
- {{ Form::checkbox('publish_facebook', 'true', ($model->publication('facebook')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_facebook', ($model->publication('facebook')->isPublished() ? 'disabled' : ''))) }}
- {{ Form::label('publish_facebook', 'Facebook '.($model->publication('facebook')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('facebook')->date_to_publish).')')) }}
- {{ Form::checkbox('publish_twitter', 'true', ($model->publication('twitter')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_twitter', ($model->publication('twitter')->isPublished() ? 'disabled' : ''))) }}
- {{ Form::label('publish_twitter', 'Twitter '.($model->publication('twitter')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('twitter')->date_to_publish).')')) }}
- {{ Form::checkbox('publish_stadtanzeiger', 'true', ($model->publication('stadtanzeiger')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_stadtanzeiger', ($model->publication('stadtanzeiger')->isPublished() ? 'disabled' : ''))) }}
- {{ Form::label('publish_stadtanzeiger', 'Stadtanzeiger '.($model->publication('stadtanzeiger')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('stadtanzeiger')->date_to_publish).')')) }}
+ @if($model->hasGetMutator('HasPublications'))
+ @if($model->hasPublications)
+ {{ Form::checkbox('publish_facebook', 'true', ($model->publication('facebook')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_facebook', ($model->publication('facebook')->isPublished() ? 'disabled' : ''))) }}
+ {{ Form::label('publish_facebook', 'Facebook '.($model->publication('facebook')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('facebook')->date_to_publish).')')) }}
+ {{ Form::checkbox('publish_twitter', 'true', ($model->publication('twitter')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_twitter', ($model->publication('twitter')->isPublished() ? 'disabled' : ''))) }}
+ {{ Form::label('publish_twitter', 'Twitter '.($model->publication('twitter')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('twitter')->date_to_publish).')')) }}
+ {{ Form::checkbox('publish_stadtanzeiger', 'true', ($model->publication('stadtanzeiger')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_stadtanzeiger', ($model->publication('stadtanzeiger')->isPublished() ? 'disabled' : ''))) }}
+ {{ Form::label('publish_stadtanzeiger', 'Stadtanzeiger '.($model->publication('stadtanzeiger')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('stadtanzeiger')->date_to_publish).')')) }}
+ @endif
@endif
{{ Form::close() }}
diff --git a/resources/views/inc/admin/subscriptions.blade.php b/resources/views/inc/admin/subscriptions.blade.php
index 623b7522..9483aaff 100644
--- a/resources/views/inc/admin/subscriptions.blade.php
+++ b/resources/views/inc/admin/subscriptions.blade.php
@@ -9,27 +9,36 @@
Ort
- Anmeldungen
+ Gesamt
+ Letzte Stunde
+ Heute
+ Letzte 7 Tage
Doppelte Anmeldungen