v1.5.3 - Added Swal on all index pages

This commit is contained in:
Anders 2020-12-01 12:05:18 +01:00
parent f42d401ac7
commit dc9c1bf113
20 changed files with 1813 additions and 1429 deletions

View File

@ -135,6 +135,10 @@
<path value="$PROJECT_DIR$/skolehjem/vendor/web-token/jwt-core" /> <path value="$PROJECT_DIR$/skolehjem/vendor/web-token/jwt-core" />
<path value="$PROJECT_DIR$/skolehjem/vendor/web-token/jwt-signature" /> <path value="$PROJECT_DIR$/skolehjem/vendor/web-token/jwt-signature" />
<path value="$PROJECT_DIR$/skolehjem/vendor/fgrosse/phpasn1" /> <path value="$PROJECT_DIR$/skolehjem/vendor/fgrosse/phpasn1" />
<path value="$PROJECT_DIR$/skolehjem/vendor/laminas/laminas-diactoros" />
<path value="$PROJECT_DIR$/skolehjem/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/skolehjem/vendor/lcobucci/jwt" />
<path value="$PROJECT_DIR$/skolehjem/vendor/php-http/message-factory" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" /> <component name="PhpProjectSharedConfiguration" php_language_level="7.2" />

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
"axios": "^0.19", "axios": "^0.19",
"cross-env": "^7.0", "cross-env": "^7.0",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"laravel-mix": "^5.0.1", "laravel-mix": "^5.0.9",
"lodash": "^4.17.19", "lodash": "^4.17.19",
"resolve-url-loader": "^2.3.1", "resolve-url-loader": "^2.3.1",
"sass": "^1.20.1", "sass": "^1.20.1",
@ -28,6 +28,7 @@
"@ckeditor/ckeditor5-table": "^21.0.0", "@ckeditor/ckeditor5-table": "^21.0.0",
"ckeditor": "github:unisharp/laravel-ckeditor", "ckeditor": "github:unisharp/laravel-ckeditor",
"moment": "^2.27.0", "moment": "^2.27.0",
"quill": "^1.3.7" "quill": "^1.3.7",
"sweetalert2": "^10.10.4"
} }
} }

View File

@ -100,11 +100,6 @@ input.appinput {
color: white; color: white;
} }
.appinput::-ms-input-placeholder {
opacity: 1;
color: white;
}
.appinput::placeholder { .appinput::placeholder {
opacity: 1; opacity: 1;
color: white; color: white;
@ -453,10 +448,6 @@ body {
opacity: 1; opacity: 1;
} }
::-ms-input-placeholder {
opacity: 1;
}
::placeholder { ::placeholder {
opacity: 1; opacity: 1;
} }
@ -915,8 +906,7 @@ a {
:root .fa-flip-horizontal, :root .fa-flip-horizontal,
:root .fa-flip-vertical, :root .fa-flip-vertical,
:root .fa-flip-both { :root .fa-flip-both {
-webkit-filter: none; filter: none;
filter: none;
} }
.fa-stack { .fa-stack {

View File

@ -100,11 +100,6 @@ input.appinput {
color: white; color: white;
} }
.appinput::-ms-input-placeholder {
opacity: 1;
color: white;
}
.appinput::placeholder { .appinput::placeholder {
opacity: 1; opacity: 1;
color: white; color: white;
@ -453,10 +448,6 @@ body {
opacity: 1; opacity: 1;
} }
::-ms-input-placeholder {
opacity: 1;
}
::placeholder { ::placeholder {
opacity: 1; opacity: 1;
} }
@ -915,8 +906,7 @@ a {
:root .fa-flip-horizontal, :root .fa-flip-horizontal,
:root .fa-flip-vertical, :root .fa-flip-vertical,
:root .fa-flip-both { :root .fa-flip-both {
-webkit-filter: none; filter: none;
filter: none;
} }
.fa-stack { .fa-stack {

View File

@ -100,11 +100,6 @@ input.appinput {
color: white; color: white;
} }
.appinput::-ms-input-placeholder {
opacity: 1;
color: white;
}
.appinput::placeholder { .appinput::placeholder {
opacity: 1; opacity: 1;
color: white; color: white;
@ -453,10 +448,6 @@ body {
opacity: 1; opacity: 1;
} }
::-ms-input-placeholder {
opacity: 1;
}
::placeholder { ::placeholder {
opacity: 1; opacity: 1;
} }
@ -915,8 +906,7 @@ a {
:root .fa-flip-horizontal, :root .fa-flip-horizontal,
:root .fa-flip-vertical, :root .fa-flip-vertical,
:root .fa-flip-both { :root .fa-flip-both {
-webkit-filter: none; filter: none;
filter: none;
} }
.fa-stack { .fa-stack {
@ -7302,10 +7292,6 @@ input:-ms-input-placeholder {
color: white; color: white;
} }
input::-ms-input-placeholder {
color: white;
}
input::placeholder { input::placeholder {
color: white; color: white;
} }

View File

@ -6,6 +6,8 @@ const moment = require("moment");
require('./date'); require('./date');
window.Swal = require('sweetalert2');
//Sites //Sites
require('./sites/menuplan'); require('./sites/menuplan');
@ -15,4 +17,4 @@ import { toggleMenu } from './navmenu/menu';
if(document.getElementById("toggle")) if(document.getElementById("toggle"))
document.getElementById("toggle").onclick = function () { document.getElementById("toggle").onclick = function () {
toggleMenu('menu'); toggleMenu('menu');
}; };

View File

@ -35,7 +35,7 @@
</thead> </thead>
<tbody> <tbody>
@foreach($contacts as $contact) @foreach($contacts as $contact)
<tr> <tr id="row_{{ $contact->id }}">
<td>{{ $contact->contactname }}</td> <td>{{ $contact->contactname }}</td>
<td>{{ $contact->title }}</td> <td>{{ $contact->title }}</td>
<td>{{ $contact->email }}</td> <td>{{ $contact->email }}</td>
@ -44,12 +44,9 @@
<td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('contact.delete')) @if(auth()->user()->can('contact.delete'))
<td><form method="post" action="{{ route("contacts.destroy", [ "contact" => $contact ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <button class="w-100 nostyle" onclick="delete_contact({{ $contact->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -66,5 +63,40 @@
] ]
}); });
}); });
function delete_contact(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Kontakten',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "contacts/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Kontakten er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -18,12 +18,12 @@
letter-spacing: 1.2px; letter-spacing: 1.2px;
} }
</style> </style>
<div class="row align-items-center"> <div class="row align-items-center">
@if(auth()->user()->can('event.show')) @if(auth()->user()->can('event.show'))
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('events.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Aktivitet</a> <a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('events.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Aktivitet</a>
@endif @endif
</div> </div>
<table class="tbl mt-2 letterSpaceTable fixOverflow" id="table_id"> <table class="tbl mt-2 letterSpaceTable fixOverflow" id="table_id">
<thead> <thead>
<th>Aktivitet Navn</th> <th>Aktivitet Navn</th>
@ -40,7 +40,7 @@
<tbody> <tbody>
@foreach($events as $event) @foreach($events as $event)
@if (date('Y-m-d H:i', strtotime('-1 day')) < date('Y-m-d H:i', strtotime($event->date))) @if (date('Y-m-d H:i', strtotime('-1 day')) < date('Y-m-d H:i', strtotime($event->date)))
<tr> <tr id="row_{{ $event->id }}">
<td>{{ $event->name }}</td> <td>{{ $event->name }}</td>
<td>{{ $event->accountable }}</td> <td>{{ $event->accountable }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</td> <td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</td>
@ -49,12 +49,9 @@
<td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('event.delete')) @if(auth()->user()->can('event.delete'))
<td><form method="post" action="{{ route("events.destroy", [ "event" => $event ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_event({{ $event->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -72,5 +69,40 @@
] ]
}); });
}); });
function delete_event(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Aktiviteten',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "events/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Aktiviteten er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -27,17 +27,14 @@
</thead> </thead>
<tbody> <tbody>
@foreach($feedback as $fb) @foreach($feedback as $fb)
<tr> <tr id="row_{{ $fb->id }}">
<td>{{ date('d-m-Y', strtotime($fb->created_at)) }}</td> <td>{{ date('d-m-Y', strtotime($fb->created_at)) }}</td>
<td>{{ $fb->message }}</td> <td>{{ $fb->message }}</td>
<td>{{ $fb->suggestion_form }}</td> <td>{{ $fb->suggestion_form }}</td>
@if(auth()->user()->can('feedback.delete')) @if(auth()->user()->can('feedback.delete'))
<td><form method="post" action="{{ route("feedbacks.destroy", [ "feedback" => $fb ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_feedback({{ $fb->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -54,5 +51,40 @@
] ]
}); });
}); });
function delete_feedback(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Feedback',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "feedbacks/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Feedbacken er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -23,7 +23,8 @@
@endif @endif
<div id="guides" class="letterSpaceTable"> <div id="guides" class="letterSpaceTable">
<label>Vejledninger</label> <label>Vejledninger</label>
<table class="tbl fixOverflow"> </div>
<table class="tbl letterSpaceTable fixOverflow">
<tr> <tr>
<th>Navn</th> <th>Navn</th>
<th>Kategori</th> <th>Kategori</th>
@ -35,7 +36,7 @@
@endif @endif
</tr> </tr>
@foreach($guides as $guide) @foreach($guides as $guide)
<tr> <tr id="guide_row_{{ $guide->id }}" data-id="guide_category_row{{ \App\GuidesCategory::query()->where('id', '=', $guide->guide_category_id)->first()->id }}">
<td>{{$guide->name}}</td> <td>{{$guide->name}}</td>
<td>{{ \App\GuidesCategory::query()->where('id', '=', $guide->guide_category_id)->first()->guidesCategoryName }}</td> <td>{{ \App\GuidesCategory::query()->where('id', '=', $guide->guide_category_id)->first()->guidesCategoryName }}</td>
@if(auth()->user()->can('guides.edit')) @if(auth()->user()->can('guides.edit'))
@ -43,12 +44,10 @@
<td><a href="{{ route("guides.edit", [ "guide" => $guide ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("guides.edit", [ "guide" => $guide ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('guides.delete')) @if(auth()->user()->can('guides.delete'))
<td><form method="post" action="{{ route("guides.destroy", [ "guide" => $guide ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_guide({{ $guide->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Er DU sikker på at du vil slette vejledningen? Der er igen vej tilbage hvis du sletter den!');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -59,7 +58,6 @@
</tr> </tr>
@endif @endif
</table> </table>
</div>
<div id="guidesCategory" class="mt-2 letterSpaceTable"> <div id="guidesCategory" class="mt-2 letterSpaceTable">
<label>Kategorier til de forskellige vejledninger</label> <label>Kategorier til de forskellige vejledninger</label>
<table class="tbl"> <table class="tbl">
@ -73,18 +71,15 @@
@endif @endif
</tr> </tr>
@foreach(\App\GuidesCategory::query()->get() as $guideCategory) @foreach(\App\GuidesCategory::query()->get() as $guideCategory)
<tr> <tr id="category_row_{{ $guideCategory->id }}">
<td>{{$guideCategory->guidesCategoryName}}</td> <td>{{$guideCategory->guidesCategoryName}}</td>
@if(auth()->user()->can('guides.edit')) @if(auth()->user()->can('guides.edit'))
<td><a href="{{ route("guides-category.edit", $guideCategory) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update2"></a></td> <td><a href="{{ route("guides-category.edit", $guideCategory) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update2"></a></td>
@endif @endif
@if(auth()->user()->can('guides.delete')) @if(auth()->user()->can('guides.delete'))
<td><form method="post" action="{{ route("guides-category.destroy", $guideCategory) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_category({{ $guideCategory->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Er du sikker på at du vil slette denne kategori?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -101,3 +96,72 @@
} }
</script> </script>
@endsection @endsection
@section('scripts')
<script>
function delete_guide(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Vejledningen',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "guides/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#guide_row_'+id).remove();
Swal.fire(
'Vejledningen er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
function delete_category(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Kategorien',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "guides-category/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#category_row_'+id).remove();
location.reload();
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script>
@endsection

View File

@ -212,5 +212,10 @@
<link rel="stylesheet" type="text/css" href="{{ asset("/DataTables/datatables.css") }}"> <link rel="stylesheet" type="text/css" href="{{ asset("/DataTables/datatables.css") }}">
<script type="text/javascript" charset="utf8" src="{{asset("/DataTables/datatables.js")}}"></script> <script type="text/javascript" charset="utf8" src="{{asset("/DataTables/datatables.js")}}"></script>
@yield("scripts") @yield("scripts")
<style>
body.swal2-height-auto {
height: 100% !important;
}
</style>
</body> </body>
</html> </html>

View File

@ -35,19 +35,16 @@
</thead> </thead>
<tbody> <tbody>
@foreach($menuPlans as $menuplan) @foreach($menuPlans as $menuplan)
<tr> <tr id="row_{{ $menuplan->id }}">
<td>{{$menuplan->week}}</td> <td>{{$menuplan->week}}</td>
<td><a href="{{ route("pdf.genPDF", [ "menuPlan" => $menuplan ]) }}" target="_blank"><img class="w-100" src="{{ asset('/images/icons/print.svg') }}" alt="Print"></a></td> <td><a href="{{ route("pdf.genPDF", [ "menuPlan" => $menuplan ]) }}" target="_blank"><img class="w-100" src="{{ asset('/images/icons/print.svg') }}" alt="Print"></a></td>
@if(auth()->user()->can('menuplan.edit')) @if(auth()->user()->can('menuplan.edit'))
<td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('menuplan.delete')) @if(auth()->user()->can('menuplan.delete'))
<td><form method="post" action="{{ route("menu-plans.destroy", [ "menu_plan" => $menuplan ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_menu({{ $menuplan->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -64,5 +61,40 @@
] ]
}); });
}); });
function delete_menu(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Menuplanen',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "menu-plans/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Menuplanen er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -33,7 +33,7 @@
</thead> </thead>
<tbody> <tbody>
@foreach($news as $new) @foreach($news as $new)
<tr> <tr id="row_{{ $new->id }}">
<td>{{$new->subname}}</td> <td>{{$new->subname}}</td>
@if($new->news_expiration_date !== null) @if($new->news_expiration_date !== null)
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($new->news_expiration_date))->format('d/m/Y \k\l\. H:i') }}</td> <td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($new->news_expiration_date))->format('d/m/Y \k\l\. H:i') }}</td>
@ -44,12 +44,9 @@
<td><a href="{{ route("news.edit", [ "news" => $new ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("news.edit", [ "news" => $new ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('news.delete')) @if(auth()->user()->can('news.delete'))
<td><form method="post" action="{{ route("news.destroy", [ "news" => $new ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_news({{ $new->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -66,5 +63,40 @@
] ]
}); });
}); });
function delete_news(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Nyheden',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "news/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Nyheden er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -33,19 +33,16 @@
</thead> </thead>
<tbody> <tbody>
@foreach($roles as $role) @foreach($roles as $role)
<tr> <tr id="row_{{ $role->id }}">
<td>{{ $role->name }}</td> <td>{{ $role->name }}</td>
<td>{{ $role->description }}</td> <td>{{ $role->description }}</td>
@if(auth()->user()->can('roles.edit')) @if(auth()->user()->can('roles.edit'))
<td><a href="{{ route("roles.edit", [ "role" => $role->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("roles.edit", [ "role" => $role->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('roles.delete')) @if(auth()->user()->can('roles.delete'))
<td><form method="post" action="{{ route("roles.destroy", [ "role" => $role ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_role({{ $role->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -62,5 +59,54 @@
] ]
}); });
}); });
function delete_role(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Rollen',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "roles/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
if (id == 1) {
Swal.fire(
'Administrator rollen kan ikke slettes',
'',
'warning'
)
} else if (id == 2) {
Swal.fire(
'Bruger rollen kan ikke slette',
'',
'warning'
)
} else {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Rollen er slettet!',
'',
'success'
)
}
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -72,13 +72,12 @@
</thead> </thead>
<tbody> <tbody>
@foreach($users as $user) @foreach($users as $user)
<tr> <tr id="row_{{ $user->id }}">
<td>{{ $user->name_first }}</td> <td>{{ $user->name_first }}</td>
<td>{{ $user->name_last }}</td> <td>{{ $user->name_last }}</td>
<td>{{ $user->email }}</td> <td>{{ $user->email }}</td>
<td>{{ $user->phone }}</td> <td>{{ $user->phone }}</td>
<td> <td>
@for($i = 0; $i < count($user->roles); $i++) @for($i = 0; $i < count($user->roles); $i++)
@if(count($user->roles)-1 != $i) @if(count($user->roles)-1 != $i)
{{$user->roles[$i]->name}}, {{$user->roles[$i]->name}},
@ -96,12 +95,9 @@
<td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('user.delete')) @if(auth()->user()->can('user.delete'))
<td><form method="post" action="{{ route("users.destroy", [ "user" => $user ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_user({{ $user->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -119,5 +115,48 @@
] ]
}); });
}); });
function delete_user(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Bruger',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "users/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
if (id == 1) {
Swal.fire(
'Administrator brugeren kan ikke slettes',
'',
'warning'
)
} else {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Brugeren er slettet!',
'',
'success'
)
}
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -45,19 +45,16 @@
@endif @endif
</thead> </thead>
@foreach($machines as $machine) @foreach($machines as $machine)
<tr> <tr id="machine_row_{{ $machine->id }}">
<td>{{$machine->name}}</td> <td>{{$machine->name}}</td>
<td>{{\App\Location::query()->where("id", "=", $machine->location_id)->first()->name}}</td> <td>{{\App\Location::query()->where("id", "=", $machine->location_id)->first()->name}}</td>
@if(auth()->user()->can('washing.machine.edit')) @if(auth()->user()->can('washing.machine.edit'))
<td><a href="{{ route('washing-machines.edit', [ 'washing_machine' => $machine ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route('washing-machines.edit', [ 'washing_machine' => $machine ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('washing.machine.delete')) @if(auth()->user()->can('washing.machine.delete'))
<td><form method="post" action="{{ route('washing-machines.destroy', [ 'washing_machine' => $machine ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_machine({{ $machine->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -79,19 +76,16 @@
@endif @endif
</thead> </thead>
@foreach(\App\Location::query()->get() as $location) @foreach(\App\Location::query()->get() as $location)
<tr> <tr id="location_row_{{ $location->id }}">
<td>{{$location->name}}</td> <td>{{$location->name}}</td>
<td><a href="{{ route("locations.show", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td> <td><a href="{{ route("locations.show", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td>
@if(auth()->user()->can('locations.edit')) @if(auth()->user()->can('locations.edit'))
<td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif @endif
@if(auth()->user()->can('locations.delete')) @if(auth()->user()->can('locations.delete'))
<td><form method="post" action="{{ route("locations.destroy", [ "location" => $location ]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_location({{ $location->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -118,3 +112,72 @@
}) })
</script> </script>
@endsection @endsection
@section('scripts')
<script>
function delete_machine(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Vaskemaskine',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "washing-machines/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#machine_row_'+id).remove();
Swal.fire(
'Vaskemaskinen er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
function delete_location(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Lokation',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "locations/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#location_row_'+id).remove();
location.reload();
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script>
@endsection

View File

@ -31,18 +31,15 @@
<tbody> <tbody>
@foreach($reservations as $reservation) @foreach($reservations as $reservation)
@if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time) @if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
<tr> <tr id="row_{{ $reservation->id }}">
<td>{{ \App\Location::query()->find(\App\WashingMachine::query()->find($reservation->machine_id)->location_id)->name }}</td> <td>{{ \App\Location::query()->find(\App\WashingMachine::query()->find($reservation->machine_id)->location_id)->name }}</td>
<td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td> <td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td> <td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td>
<td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td> <td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td>
@if(auth()->user()->can('washing.machine.reservation.delete')) @if(auth()->user()->can('washing.machine.reservation.delete'))
<td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle"> <td>
@csrf @csrf
@method("delete") <a class="w-100 nostyle" onclick="delete_reservation({{ $reservation->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td> </td>
@endif @endif
</tr> </tr>
@ -60,5 +57,40 @@
] ]
}); });
}); });
function delete_reservation(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Reservationen',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "/washing-reservations/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
Swal.fire(
'Reservationen er slettet!',
'',
'success'
)
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script> </script>
@endsection @endsection

View File

@ -184,5 +184,10 @@
document.getElementsByTagName("main")[0].style.paddingTop = (10+document.getElementById("header").clientHeight) + "px"; document.getElementsByTagName("main")[0].style.paddingTop = (10+document.getElementById("header").clientHeight) + "px";
</script> </script>
<style>
body.swal2-height-auto {
height: 100% !important;
}
</style>
</body> </body>
</html> </html>

View File

@ -12,17 +12,14 @@
<h2 class="text-center sde-blue mb-0">{{__('msg.dinereservationer')}}</h2> <h2 class="text-center sde-blue mb-0">{{__('msg.dinereservationer')}}</h2>
@foreach($reservations as $reservation) @foreach($reservations as $reservation)
@if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time) @if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
<div class="reservation" style="margin: 0 32px 1.75rem 32px;"> <div id="row_{{ $reservation->id }}" class="reservation" style="margin: 0 32px 1.75rem 32px;">
<h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3> <h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3>
<div class="row align-items-center"> <div class="row align-items-center">
<span style="font-size: 4vw; white-space: pre-line;"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }} <span style="font-size: 4vw; white-space: pre-line;"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}
- {{ \App\Location::query()->where('id', '=', \App\WashingMachine::query()->find($reservation->machine_id)->location_id)->first()->name }}</span> - {{ \App\Location::query()->where('id', '=', \App\WashingMachine::query()->find($reservation->machine_id)->location_id)->first()->name }}</span>
<form class="ml-auto" method="post" action="{{ route("washing-reservations.destroy", [ "washing_reservation" => $reservation ]) }}">
@csrf @csrf
@method("delete") <a class="btn btn-sde-blue ml-auto mb-0" onclick="delete_reservation({{ $reservation->id }})">{{__('msg.fjern')}}</a>
<input type="hidden" name="id" value="{{ $reservation->id }}">
<button class="btn btn-sde-blue mb-0" type="submit" onclick="return confirm('Are you sure you want to remove this reservation?');">{{__('msg.fjern')}}</button>
</form>
</div> </div>
</div> </div>
<?php <?php
@ -39,4 +36,36 @@
@endsection @endsection
@section("scripts") @section("scripts")
<script src="{{ asset("/js/jquery-3.2.1.min.js") }}"></script>
<script>
function delete_reservation(id) {
var token = $("input[name='_token']").val();
Swal.fire({
title: 'Er du sikker?',
text: "Dette kan ikke blive ændret tilbage!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Slet Reservationen',
cancelButtonText: 'Annuller'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: "POST",
url: "/washing-reservations/"+id,
data:{'_token':token, _method: 'DELETE'},
success: function () {
$('#row_'+id).remove()
},
error:function (data) {
console.log(data);
}
});
}
})
}
</script>
@endsection @endsection