v1.5.12 Added the last things to the preview function, its all working now
This commit is contained in:
parent
493a8aeb34
commit
19fdb63ad2
skolehjem
app/Http/Controllers
database/migrations
2021_01_22_002613_remove_event.php2021_01_22_002613_remove_news.php2021_01_22_002613_remove_reservation.php
resources/views/admin
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Event;
|
||||
use App\News;
|
||||
use App\Notification;
|
||||
use App\Resource;
|
||||
use App\UserEvent;
|
||||
use App\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -288,7 +289,11 @@ class EventController extends Controller
|
|||
}
|
||||
|
||||
public function previewPages(Request $request){
|
||||
if(!Resource::find($request->preview)){
|
||||
$event = Event::find($request->preview);
|
||||
}else{
|
||||
$event = Event::where('events.id', '=', $request->preview)->join('resources', 'resources.id', '=', 'events.resource_id')->first();
|
||||
}
|
||||
$convertToJsonArray = json_encode($event);
|
||||
return $convertToJsonArray;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Guide;
|
||||
use App\News;
|
||||
use App\Resource;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\Request;
|
||||
use tidy;
|
||||
|
@ -277,7 +278,11 @@ class GuideController extends Controller
|
|||
}
|
||||
|
||||
public function previewPages(Request $request){
|
||||
if(!Resource::find($request->preview)){
|
||||
$event = Guide::find($request->preview);
|
||||
}else{
|
||||
$event = Guide::where('guides.id', '=', $request->preview)->join('resources', 'resources.id', '=', 'events.resource_id')->first();
|
||||
}
|
||||
$convertToJsonArray = json_encode($event);
|
||||
return $convertToJsonArray;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ class RootController extends Controller
|
|||
}
|
||||
|
||||
public function index() {
|
||||
$perPage = 5;
|
||||
|
||||
if (File::exists(public_path('uploads'))) {
|
||||
foreach (File::allFiles(public_path('uploads')) as $file) {
|
||||
$resource = Resource::query()->where('filename', '=', '/uploads/' . $file->getFilename())->get();
|
||||
|
||||
|
@ -41,6 +40,8 @@ class RootController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
File::makeDirectory(public_path('uploads'), 0777, true, true);
|
||||
|
||||
//All news
|
||||
$newsCollection = News::query()->orderBy('id', 'desc')->get();
|
||||
|
|
|
@ -11,11 +11,13 @@ class RemoveEvent extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_event` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
|
||||
DELETE FROM events WHERE HOUR(TIMEDIFF(NOW(), events.date)) >= 24 AND date(events.date) < CURDATE()");
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
|
|
|
@ -11,11 +11,13 @@ class RemoveNews extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_news` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
|
||||
DELETE FROM news WHERE news_expiration_date < NOW();");
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
|
|
|
@ -11,11 +11,13 @@ class RemoveReservation extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_reservation` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
|
||||
DELETE FROM washing_reservations WHERE time <= DATE_SUB(NOW(), INTERVAL 1 HOUR)");
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<strong><label for="accountable">Aktivitets ansvarlig</label></strong>
|
||||
<p id="accountable"></p>
|
||||
<hr>
|
||||
<img src="{{ asset(\App\Resource::query()->where("id", "=", $events->resource_id)->first()->filename) }}">
|
||||
<img id="eventimg">
|
||||
<p id="description"></p>
|
||||
</center>
|
||||
</div>
|
||||
|
@ -96,6 +96,11 @@
|
|||
$("#date").html(l.date);
|
||||
$("#accountable").html(l.accountable);
|
||||
$("#description").html(l.description);
|
||||
|
||||
if (l.filename)
|
||||
$("#eventimg").attr('src', l.filename);
|
||||
|
||||
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
|
@ -105,11 +110,23 @@
|
|||
|
||||
function closeModal() {
|
||||
modalNews.style.display = "none";
|
||||
|
||||
$("#name").html('');
|
||||
$("#date").html('');
|
||||
$("#accountable").html('');
|
||||
$("#description").html('');
|
||||
$("#eventimg").attr('src', '');
|
||||
}
|
||||
|
||||
window.onmousedown = function(event) {
|
||||
if (event.target == modalNews) {
|
||||
modalNews.style.display = "none";
|
||||
|
||||
$("#name").html('');
|
||||
$("#date").html('');
|
||||
$("#accountable").html('');
|
||||
$("#description").html('');
|
||||
$("#eventimg").attr('src', '');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
<center>
|
||||
<h1 id="name"></h1>
|
||||
<hr>
|
||||
<img id="eventimg">
|
||||
<strong><label for="guide_articles">Vejledning</label></strong>
|
||||
<p id="guide_articles"></p>
|
||||
</center>
|
||||
|
@ -116,7 +117,9 @@
|
|||
console.log(l);
|
||||
$("#name").html(l.name);
|
||||
$("#guide_articles").html(l.guide_articles);
|
||||
//We need to add guide_category_id and resource_id
|
||||
if (l.filename)
|
||||
$("#eventimg").attr('src', l.filename);
|
||||
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
|
@ -126,11 +129,17 @@
|
|||
|
||||
function closeModal() {
|
||||
modalNews.style.display = "none";
|
||||
$("#name").html('');
|
||||
$("#guide_articles").html('');
|
||||
$("#eventimg").attr('src', '');
|
||||
}
|
||||
|
||||
window.onmousedown = function(event) {
|
||||
if (event.target == modalNews) {
|
||||
modalNews.style.display = "none";
|
||||
$("#name").html('');
|
||||
$("#guide_articles").html('');
|
||||
$("#eventimg").attr('src', '');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -98,6 +98,11 @@
|
|||
|
||||
function closeModal() {
|
||||
modalNews.style.display = "none";
|
||||
$("#week").html('');
|
||||
$("#monday").html('');
|
||||
$("#tuesday").html('');
|
||||
$("#wednesday").html('');
|
||||
$("#thursday").html('');
|
||||
}
|
||||
|
||||
window.onmousedown = function(event) {
|
||||
|
|
|
@ -93,11 +93,17 @@
|
|||
|
||||
function closeModal() {
|
||||
modalNews.style.display = "none";
|
||||
$("#titleEvent").html('');
|
||||
$("#dateEvent").html('');
|
||||
$("#descriptionEvent").html('');
|
||||
}
|
||||
|
||||
window.onmousedown = function(event) {
|
||||
if (event.target == modalNews) {
|
||||
modalNews.style.display = "none";
|
||||
$("#titleEvent").html('');
|
||||
$("#dateEvent").html('');
|
||||
$("#descriptionEvent").html('');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue