kurbad-theme/content/news.blade.php

1489 lines
68 KiB
PHP
Raw Permalink Normal View History

2020-09-24 08:31:09 +00:00
@extends('template.'.\Setting::get('template', 'default').'.content.master')
@section('content')
<style>
.jumbotron-ln {
background: #ccc;
background-position: left top;
background-repeat: no-repeat;
background-size: cover;
height: 250px;
background-color: #6c23d7;
}
.jumbotron-ln h1{
color: white;
}
body {
overflow-x: hidden;
}
.brand , .brand a{
font-size: 37px;
color: white;
font-weight: 300;
}
.brand a:hover {
color: white;
text-decoration: none;
}
.intro{
font-size: 20px;
margin-bottom: 70px;
}
.top-border-radius{
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
}
article .card-body{
padding-right: 0.5rem;
padding-left: 0.5rem ;
}
#article-section .container {
padding-left: 7px;
padding-right: 7px;
}
#article-section .container .col-lg-12{
padding-left: 0px;
padding-right: 0px;
}
@media only screen and (min-width: 575px) {
article .card-body{
padding-right: 1.5rem;
padding-left: 1.5rem ;
}
#article-section .container{
padding-left: 15px;
padding-right: 15px;
}
#article-section .container .col-lg-12{
padding-left: 15px;
padding-right: 15px;
}
}
</style>
@if (\Setting::get('image') and !isset($categoryModel) or (isset($categoryModel) and !$categoryModel->image))
<style>
.jumbotron-ln {
background-image: url({{ asset('uploads/' . \Setting::get('image')) }});
}
</style>
@endif
@if (isset($categoryModel) and $categoryModel->image)
<style>
.jumbotron-ln {
background-image: url({{ asset('uploads/categories/' . $categoryModel->image) }});
}
</style>
@endif
<div class="jumbotron-ln">
<div class="container brand">
<br>
<a href="{{url('/')}}" >{{ \Setting::get('name')}}</a>
<br>
<span style="font-size: 50%;">{{ \Setting::get('tagline')}}</span>
</div>
</div>
@if(\Session::get('premium_code'))
<div class="bg-ci text-center bg-premium-code" style="font-size: 12px;display:none; cursor: pointer;" title="View your Code and expiration"><i class="fal fa-gem"></i> {{ __('public.premium-active') }}</div>
@include('template.'.\Setting::get('template', 'default').'.content.includes.premium-banner')
@endif
@if (!\Session::get('premium_code'))
@if (env('PAYMENT', false))
<div class="text-center" id="enter-code" data-toggle="modal" data-target="#exampleModalCode" title="Here you can buy a premium pass or use an existing one to log-in"><i class="fal fa-gem"></i> {{ __('public.buy-login') }}</div>
@endif
<div class="modal fade" id="exampleModalCode" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document" style="max-width: 800px;">
<form method="post" action="" class="enter-premium-code">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{ __('public.buy-login') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="padding-left: 0px; padding-right: 0px;">
@include('template.'.\Setting::get('template', 'default').'.content.includes.premium-pass')
<style>
.modal section{
padding-bottom: 0px;
}
</style>
<div class="container">
<div class="row">
<div class="col-8 offset-2 col-md-6 offset-md-3">
<h5 style="text-align: center">{{ __('public.login-existing') }}</h5>
<br>
<div class="form-group">
<label for="premium_code">{{ __('public.enter-active-code') }}</label>
<input type="text" minlength="6" maxlength="6" class="form-control" id="premium_code" required="required" aria-describedby="emailHelp" placeholder="XXXXXX">
</div>
<div id="content_premium"></div>
<button type="submit" class="btn btn-primary btn-enter-premium float-right" style="margin-bottom: 20px;"><i class="fal fa-sign-in"></i> {{ __('public.login-plan') }} </button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
@endif
@if (env('APP_ACCESS', 'public') == 'code')
<div class="container">
<br>
<a href="{{ route('logout') }}" class="float-right" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"><i class="fal fa-sign-out"></i> {{ __('public.logout') }} Logout</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
<br>
<br>
</div>
@endif
@if (\Route::currentRouteName() != 'author.get')
<div class="row" style="margin-top:50px;">
<div class="mx-auto" style="overflow: scroll">
<div class="btn-group btn-group-toggle mx-auto" data-toggle="buttons">
<label class="btn btn-lg {{ (!isset($categoryModel) and \Request::route()->getName() != 'nachrichten.get' and \Request::route()->getName() != 'author.get') ? 'active btn-primary' : 'btn-outline-primary' }}" onclick="location.href = '{{ url('/') }}';">
<input type="radio" name="options" id="option1" autocomplete="off" checked=""> <i class="fal fa-bookmark" aria-hidden="true"></i> Home
</label>
@foreach ($categories as $category)
<label class="btn btn-lg {{ (isset($categoryModel) and $category->id == $categoryModel->id) ? 'active btn-primary' : 'btn-outline-primary' }}" onclick="location.href = '{{ url('/' . $category->slug) }}';">
<input type="radio" name="options" id="option3" autocomplete="off">
@if($category->icon == 'bitcoin')
<i class="fab fa-{{$category->icon}}"></i>
@else
<i class="fal fa-{{$category->icon}}"></i>
@endif
{{ $category->name }}
</label>
@endforeach
</div>
</div>
</div>
<div class="container">
<div class="col-12">
@if (isset($categoryModel))
<br><br>
<h1>
@if($categoryModel->icon == 'bitcoin')
<i class="fab fa-{{$categoryModel->icon}}"></i>
@else
<i class="fal fa-{{$categoryModel->icon}}"></i>
@endif
{{ $categoryModel->name }}</h1>
@else
<br><br>
<h1>{{ \Setting::get('name')}}</h1>
@endif
<p class="intro">
@if (isset($categoryModel))
{{ $categoryModel->description }}
@else
{{ \Setting::get('description')}}
@endif
<br>
</p>
</div>
</div>
@endif
<div class="container">
<div class="row">
@if (\Route::currentRouteName() == 'author.get')
<div class="col-sm-12 col-md-2 text-center">
<br>
<br>
<img src="{{ $author->gravatar() }}?s=120&d=identicon&r=PG" width="120" class="rounded-circle img-fluid border" title="{{ $author->name }}">
</div>
<div class="col-sm-12 col-md-10">
<br><br>
<h1>{{ $author->name }}</h1>
<p class="intro">
{{ $author->description }}
</p>
<div class="row">
<div class="col-md-7 col-sm-12">
@if (isset($author->social_networks['email']))
<a href="mailto:{{ $author->social_networks['email'] }}"><i class="fal fa-envelope"></i></a>
|
@endif
@if (isset($author->social_networks['site']))
<a href="{{ $author->social_networks['site'] }}">{{ $author->social_networks['site'] }}</a>
@endif
<br>
<br>
</div>
<div class="col-md-5 col-sm-12 text-center">
<?php
$social = [
'telegram',
'behance',
'snapchat',
'stack-overflow',
'vimeo',
'github',
'reddit',
'instagram',
'linkedin',
'pinterest',
'twitter',
'facebook',
'youtube'
];
?>
@foreach ($social as $value)
@if (isset($author->social_networks[$value]))
<a href="{{ $author->social_networks[$value] }}"><i class="fab fa-{{ $value }}"></i></a>
@endif
@endforeach
<br>
<br>
</div>
</div>
</div>
@endif
@if (\Route::currentRouteName() == 'welcome')
<div class="col-12">
<br>
<br>
<h2 class="h4" class="text-center">{{ __('public.popular-authors') }}</h2>
</div>
@foreach ($authors as $author)
<div class="col-4 col-md-2 text-center">
<br>
<a href="{{ route('author.get', [$author->slug]) }}" title="{{ $author->name }}">
<img src="{{ $author->gravatar() }}?s=120&d=identicon&r=PG" width="120" class="rounded-circle img-fluid border">
</a>
</div>
@endforeach
<!--<div class="col-lg-12" style="text-align: center">
<br>
<br>
<a href=""> See all authors <i class="fal fa-arrow-right"></i></a>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>-->
<div class="col-lg-12">
<br>
<br>
<br>
</div>
@endif
</div>
</div>
<section id="article-section">
<div class="container">
@if (env('APP_WRITE', false))
<br>
<br>
<br>
<a href="" class="float-right" data-toggle="modal" data-target="#exampleModal"><i class="fal fa-plus"></i> {{ __('public.propose-content') }} Neuen Inhalt einreichen</a>
<br>
<br>
@endif
@include('template.'.\Setting::get('template', 'default').'.content.includes.create-content')
<br>
@if (session()->has('success'))
<div class="row justify-content-center">
<div class="col-lg-8">
@if(is_array(session()->get('success')))
<div class="alert alert-success alert-dismissible fade show" role="alert">
<h4 class="alert-heading">Nachricht wurde erfolgreich eingereicht!</h4>
Ihre Nachricht wurde erfolgreich an uns übermittelt und wir nach Prüfung hier veröffentlicht.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
@else
{{ session()->get('success') }}
@endif
</div>
</div>
@endif
@if (session()->has('error'))
<div class="row justify-content-center">
<div class="col-lg-8">
@if(is_array(session()->get('error')))
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<h4 class="alert-heading">Es ist ein Fehler aufgetreten!</h4>
Beim übermitteln Ihrer Nachricht ist ein Fehler aufgetreten. Der Admin wurde informiert.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
@else
{{ session()->get('error') }}
@endif
</div>
</div>
@endif
<div class="article-feed">
<article class="newsentry" style="width: 100%;" data-slug="{{ $nach->category->slug }}/{{ $nach->slug }}">
@if ($nach->paid != 0 and (empty($nach->premium_until) or $nach->premium_until > date('Y-m-d')) and !\Session::get('premium_code'))
<div class="col-lg-12">
<div class="card shadow-lg" id="news-{{$nach->id}}">
<div class="card-body" style="padding-bottom: 0;">
@if($nach->created_at->diffInHours(date('Y-m-d H:i:s')) < 1)
<div class="progress" style="height: 30px;">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
<span style="color: black; font-size: 16px;">{{ $nach->created_at->diffForHumans() }} veröffentlicht</span>
</div>
</div>
<br>
@endif
<a href="{{ route('nachrichten.get', [$nach->category->slug, $nach->slug]) }}">
<h2 class="card-title">{{$nach->title}}</h2>
</a>
<h6 class="card-subtitle mb-2">
@if ($nach->user and $nach->user->public_author == 1)
<a class="text-dark" href="{{ route('author.get', [$nach->user->slug]) }}"">
<img src="{{ $nach->user->gravatar() }}?s=32&d=identicon&r=PG" width="32" class="rounded-circle">
{{ $nach->user->name }}
</a> - <span style="font-weight: normal " class="text-dark"">{{date('d.m.Y H:i', strtotime($nach->created_at))}}</span>
@else
<span style="font-weight: normal " class="text-dark"">{{date('d.m.Y H:i', strtotime($nach->created_at))}}</span>
@endif
</h6>
@if ($nach->category)
<a href="{{ route('category.get', [$nach->category->slug]) }}">
<div class="badge badge-primary">
<p style="margin:3px;font-size:15px;">{{ $nach->category->name}}</p>
</div>
</a>
@endif
@if ($nach->image)
<img src="{{ asset('uploads/' . $nach->image) }}" class="img-responsive" style="max-width: 100%;margin-bottom: 20px; margin-top:20px; display: block;">
@endif
</div>
<div class="card-body card-preview-{{ $nach->id }} pay-preview">
<div>
<div class="card-text" id="text_news_{{$nach->id}}">
<!-- Here comes the payment preview, tha is the first 200 words of the news content -->
{!! \Str::limit($nach->nachrichten, 285, ' ...') !!}
</div>
</div>
@if ($nach->type_id == 2)
<p class="card-text">
<p style="font-weight:600;">{{ __('public.work-location') }}</p>
<div id="text_news_workplace_{{$nach->id}}">{{ isset($nach->additional_fields['workplace']) ? \Str::limit($nach->additional_fields['workplace'], 30, ' ...') : '-'}}
</div>
</p>
<p class="card-text">
<p style="font-weight:600;">{{ __('public.contact-data') }}</p>
<div id="text_news_contact_info_{{$nach->id}}">{!! isset($nach->additional_fields['contact_info']) ? \Str::limit($nach->additional_fields['contact_info'], 30, ' ...') : '-' !!}
</div>
</p>
@endif
<div id="box_action_{{ $nach->id }}"></div>
</div>
<div class="card-body payment-request" id="payment-request-{{ $nach->id }}">
<h2 class="text-center"><i class="far fa-gem fa-2x" style="font-size: 20px;"></i> {{ __('public.premium-content') }}</h2>
@if (!empty($nach->premium_until) and $nach->premium_until > date('Y-m-d'))
<small class="text-center d-block">{{ __('public.article-requires-payment') }}mjn <div id="counter_{{ $nach->id }}" data-id="{{ $nach->id }}" data-date="{{ $nach->premium_until }}" class="counter-class">-</div></small>
@endif
<p class="text-center">To read the article
@if (!empty($nach->premium_until) and $nach->premium_until > date('Y-m-d'))
{{ __('public.now') }}now
@endif
{{ __('public.please-pay') }} {{ $nach->paid }} sats</p>
<br>
<p class="text-center">
<a href="#ln-invoice-{{ $nach->id }}" data-id="{{ $nach->id }}" class="btn btn-warning get-collapse-invoice"><i class="fas fa-bolt"></i> Pay {{ $nach->paid }} sats</a>
<br>
<a href="" class="howtopay" data-toggle="modal" data-target="#exampleModalCode">{{ __('public.use') }} <i class="fal fa-gem"></i> {{ __('public.premium-pass') }}</a>
@include('template.'.\Setting::get('template', 'default').'.content.includes.explain-lightning')
<br>
</p>
<div class="row collapse" id="ln-invoice-{{ $nach->id }}">
<div class="col-sm-6 offset-sm-3">
<a class="pay-news pay-news-{{ $nach->id }}" data-id="{{$nach->id}}" style="cursor:pointer !important;"></a>
<br>
<div id="pay-news-title-{{ $nach->id }}"> </div>
</div>
</div>
</div>
@if (env('APP_COMMENTS', false))
<div class="card-footer" id="comment_button_{{$nach->id}}">
@if(sizeof($nach->comments) > 0)
<a href="#" onclick="showComments(event, {{$nach->id}})"> <span class="badge badge-primary">{{sizeof($nach->comments)}}</span> {{ __('public.display-comments') }}{{ __('public.see-comments') }}</a>
@else
<i>{{ __('public.no-comments-yet') }}</i>
@endif
<button class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#exampleModal2" onclick="setCommentId({{$nach->id}}),ga('send', 'event', 'Read Comments', 'Website', '{{$nach->title}}');">
<i class="fas fa-comment"></i> {{ __('public.comment') }}
</button>
</div>
@endif
<div style="display:none" id="comments_{{$nach->id}}">
<div class="card-footer bg-primary">
<a class="text-white"> <span class="badge badge-light">{{sizeof($nach->comments)}}</span> {{ __('public.no-comments-yet') }}</a>
<button class="btn btn-dark btn-sm float-right" data-toggle="modal" data-target="#exampleModal2" onclick="setCommentId({{$nach->id}}),ga('send', 'event', 'Create Comment', 'Modal for Comment Creation', '{{$nach->title}}');">
<i class="fas fa-comment"></i> {{ __('public.comment') }}
</button>
</div>
<table>
@foreach($nach->comments as $comment)
<row>
<div class="card-footer">
<i class="fas fa-user" style="color: #007BFF"></i> {{$comment->name}}:
<!-- For now taking that out, time is wrong... -->
<span class="float-right" title="{{date('d.m.Y | H:i', strtotime($comment->created_at))}} Uhr">{{date('d.m.Y H:i', strtotime($comment->created_at))}} Uhr</span>
</div>
<div class="card-body comment-text">
<p class="card-text">
{{$comment->comment}}
</p>
</div>
</row>
@endforeach
</table>
</div>
</div>
</div>
@else
<div class="col-lg-12">
<div class="card shadow-lg" id="news-{{$nach->id}}">
@if(\Session::get('premium_code') and $nach->paid != 0 and (empty($nach->premium_until) or $nach->premium_until > date('Y-m-d')))
<div class="bg-ci text-center top-border-radius" style="font-size: 12px;"><i class="fal fa-gem"></i> Premium content</div>
@endif
<div class="card-body">
@if($nach->created_at->diffInHours(date('Y-m-d H:i:s')) < 1)
<div class="progress" style="height: 30px;">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
<span style="color: black; font-size: 16px;">{{ $nach->created_at->diffForHumans() }} veröffentlicht</span>
</div>
</div>
<br>
@endif
<a href="{{ route('nachrichten.get', [$nach->category->slug, $nach->slug]) }}">
<h2 class="card-title">{{$nach->title}}</h2>
</a>
<h6 class="card-subtitle mb-2">
@if ($nach->user and $nach->user->public_author == 1)
<a class="text-dark" href="{{ route('author.get', [$nach->user->slug]) }}">
<img src="{{ $nach->user->gravatar() }}" width="32" class="rounded-circle">
{{ $nach->user->name }}</a> - <span style="font-weight: normal " class="text-dark"">{{date('d.m.Y H:i', strtotime($nach->created_at))}}</span>
@else
<span style="font-weight: normal " class="text-dark"">{{date('d.m.Y H:i', strtotime($nach->created_at))}}</span>
@endif
</h6>
@if ($nach->category)
<a href="{{ route('category.get', [$nach->category->slug]) }}">
<div class="badge badge-primary">
<p style="margin:3px;font-size:15px;">{{ $nach->category->name}}</p>
</div>
</a>
@endif
@if ($nach->image)
<img src="{{ asset('uploads/' . $nach->image) }}" class="img-responsive" style="max-width: 100%;margin-bottom: 20px; margin-top:20px; display: block;">
@endif
<p class="card-text">
{!! $nach->nachrichten !!}
</p>
@if ($nach->type_id == 2)
<p class="card-text">
<p style="font-weight:600;">{{ __('public.work-location') }}</p> {{ isset($nach->additional_fields['workplace']) ? $nach->additional_fields['workplace'] : '-'}}
</p>
<p class="card-text">
<p style="font-weight:600;">{{ __('public.contact-data') }}</p> {!! isset($nach->additional_fields['contact_info']) ? $nach->additional_fields['contact_info'] : '-' !!}
</p>
@endif
@if($nach->type_id == 3)
<hr>
<div class="row">
@if($nach->show_total_paid_action == 1)
@if ($nach->actions->count() > 1)
<div class="col-12">
<i class="text-center">{{ __('public.vote-distribution') }}</i>
<div class="progress">
@foreach ($nach->actions as $action)
<div class="progress-bar bg-{{ $action->color }}" role="progressbar" style="width: {{ !empty($nach->total_paid_actions()) ? round(($action->payments()->where('status', 1)->sum('amount') * 100) / $nach->total_paid_actions()) : 0 }}%" aria-valuenow="66" aria-valuemin="0" aria-valuemax="100" title="{{ $action->payments()->where('status', 1)->sum('amount') }} sats">{{ !empty($nach->total_paid_actions()) ? round(($action->payments()->where('status', 1)->sum('amount') * 100) / $nach->total_paid_actions()) : 0 }}% </div>
@endforeach
</div>
<br>
</div>
@endif
@endif
@foreach ($nach->actions as $action)
<div class="col">
<small>{{ $action->description }}</small>
<br>
@if ($action->type == 2)
<br>
<textarea class="form-control" id="message_action_{{ $action->id }}" rows="3" placeholder="Write here your message.."></textarea>
@endif
<!-- @if($nach->show_total_paid_action == 1)
<br>
@if($action->type == 5)
<i class="text-center">Donation Goal: 10000 sats.</i>
<div class="progress">
<div class="progress-bar bg-{{ $action->color }}" role="progressbar" aria-valuenow="{{ $action->payments()->where('status', 1)->sum('amount') }}" aria-valuemin="0" aria-valuemax="1000">{{ $action->payments()->where('status', 1)->sum('amount') }} sats</div>
</div>
@else
<i class="text-center">Total paid: {{ $nach->actions->first()->payments()->where('status', 1)->sum('amount') }} sats</i>
@endif
@endif-->
</div>
@endforeach
</div>
<div class="row">
@foreach ($nach->actions as $action)
<div class="col">
<a href="" style="margin-top: 20px;" id="action{{ $action->id }}" class="btn btn-{{ $action->color }} mx-0 d-block get-action-invoice" data-id="{{ $action->id }}" data-type="{{ $action->type }}" data-execute="0"><i class="fal fa-{{ $action->icon }}"></i> {{ $action->name }} for {{ $action->amount }} sats.</a>
</div>
@endforeach
</div>
@endif
@if(sizeof($nach->files) > 0)
<br>
<h5>{{ __('public.files-download') }}</h5>
<div class="row">
@foreach ($nach->files as $file)
<div class="col-lg-12">
<a href="{{ asset($file->url)}}" class="btn btn-primary" onclick="ga('send', 'event', 'File Download', 'User', '{{$file->filename}}');" >
<i class="fas fa-download"></i>
{{$file->filename}}
</a>
<br>
<br>
</div>
@endforeach
</div>
@endif
</div>
@if (env('APP_COMMENTS', false))
<div class="card-footer" id="comment_button_{{$nach->id}}">
@if(sizeof($nach->comments) > 0)
<a href="#" onclick="showComments(event, {{$nach->id}})"> <span class="badge badge-primary">{{sizeof($nach->comments)}}</span> {{ __('public.see-comments') }}</a>
@else
<i>{{ __('public.no-comments-yet') }}</i>
@endif
<button class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#exampleModal2" onclick="setCommentId({{$nach->id}}),ga('send', 'event', 'Read Comments', 'Website', '{{$nach->title}}');">
<i class="fas fa-comment"></i> {{ __('public.comment') }}
</button>
</div>
@endif
<div style="display:none" id="comments_{{$nach->id}}">
<div class="card-footer bg-primary">
<a class="text-white"> <span class="badge badge-light">{{sizeof($nach->comments)}}</span> {{ __('public.comments') }}</a>
<button class="btn btn-dark btn-sm float-right" data-toggle="modal" data-target="#exampleModal2" onclick="setCommentId({{$nach->id}}),ga('send', 'event', 'Create Comment', 'Modal for Comment Creation', '{{$nach->title}}');">
<i class="fas fa-comment"></i> {{ __('public.comment') }}
</button>
</div>
<table>
@foreach($nach->comments as $comment)
<row>
<div class="card-footer">
<i class="fas fa-user" style="color: #007BFF"></i> {{$comment->name}}:
<!-- For now taking that out, time is wrong... -->
<span class="float-right" title="{{date('d.m.Y | H:i', strtotime($comment->created_at))}} Uhr">{{date('d.m.Y H:i', strtotime($comment->created_at))}} Uhr</span>
</div>
<div class="card-body comment-text">
<p class="card-text">
{{$comment->comment}}
</p>
</div>
</row>
@endforeach
</table>
</div>
</div>
</div>
@endif
</article>
</div>
</div>
</section>
<section>
<div class="container">
<div class="row">
<div class="col-lg-12">
<hr>
<br>
<br>
<br>
<h3>{{ __('public.read-more') }}</h3>
<br>
</div>
@foreach ($categories->take(4)->shuffle()->all() as $category)
<div class="col-sm-6 {{ (isset($categoryModel) and $category->id == $categoryModel->id) ? 'd-none' : '' }}" >
<a href="{{ url('/' . $category->slug) }}" onclick="location.href = '{{ url('/' . $category->slug) }}';" >
<div class="card info-card shadow-lg" style="margin-bottom: 30px;">
<div class="card-body">
<div class="row">
<div class="col-8">
<h5 class="card-title">
<i class="
@if($category->icon == 'bitcoin')
fab
@else
fal
@endif
fa-{{$category->icon}}" style="font-size: 1.3rem">
</i> {{ $category->name }}
</h5>
</div>
<div class="col-4 text-right">
<h5><i class="fal fa-arrow-circle-right fa-3x" style="font-size: 30px;"></i></h5>
</div>
</div>
</div>
</div>
</a>
</div>
@endforeach
</div>
</div>
</section>
@include('template.'.\Setting::get('template', 'default').'.content.includes.type-iptt')
@include('template.'.\Setting::get('template', 'default').'.content.includes.new-comment')
@include('template.'.\Setting::get('template', 'default').'.content.includes.premium-pass-qr')
@if(!\Session::get('premium_code'))
@if (env('PAYMENT', false))
@include('template.'.\Setting::get('template', 'default').'.content.includes.premium-pass')
@endif
@else
@include('template.'.\Setting::get('template', 'default').'.content.includes.premium-referral')
@endif
@stop
@section('scripts')
<script src="https://cdnjs.cloudflare.com/ajax/libs/jscroll/2.4.1/jquery.jscroll.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.countdown/2.2.0/jquery.countdown.min.js"></script>
<script src="{{ asset('template/js/dropzone.min.js') }}"></script>
<script src="{{ asset('template/js/fslightbox.js') }}"></script>
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script>
toastr.options = {
"progressBar": true
};
</script>
@if (env('APP_WRITE', false))
<script src="https://cdn.tiny.cloud/1/0015awrvvurgnwz3e0uid83chhzb7lnbi6wyn4ukk7b4lh9k/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
<script src="{{ asset('template/js/tiny-de.js') }}"></script>
@endif
@if (\Session::has('success_plan'))
<script>
toastr.success('{{ \Session::get('success_plan') }}', 'Success!');
</script>
@endif
<script>
$('.enter-premium-code').submit(function() {
event.preventDefault();
var code = $('#premium_code').val();
$('.btn-enter-premium').append('<i class="fas fa-sync fa-spin fa-premium-enter" style="font-size: 17px;color: #fff;margin-left:12px;position: relative;left:6px;display: inline-block !important;margin:auto;text-align:center;"></i>');
$.ajax({
type: 'GET',
dataType : 'json',
url: "{{ url('enterPremiumCode') }}/" + code,
success: function(data) {
$('.fa-premium-enter').remove();
if (data.code == 1) {
$('#content_premium').html('<div class="alert alert-danger" role="alert">Code not found or expired.</div>');
}
if (data.code == 2) {
$('#content_premium').html('<div class="alert alert-info" role="alert">Make the payment to activate your code. Payment expiration: '+data.payment_expired+' <br> <br><a href="lightning:'+data.payment_request+'"><img src="data:image/png;base64,' + data.qr_code + '" class="img-fluid rounded mx-auto d-block"/></a></div>');
}
if (data.code == 3) {
window.location.href = '{{ url("/") }}';
}
},
error: function(data) {
$('.fa-premium-enter').remove();
alert('error!');
}
});
});
$(document).on('shown.bs.modal', '.modal', function() {
$(this).find('[autofocus]').focus();
});
$.ajaxSetup({
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }
});
if($.cookie('close_premium_alert') == undefined){
$('#alert-premium').css('display', 'block');
$('.bg-premium-code').css('display', 'none');
} else {
$('#alert-premium').css('display', 'none');
$('.bg-premium-code').css('display', 'block');
}
$('.close-premium').click(function() {
$('#alert-premium').css('display', 'none');
$('.bg-premium-code').css('display', 'block');
$.cookie('close_premium_alert', true);
});
$('.bg-premium-code').click(function() {
$('#alert-premium').css('display', 'block');
$('.bg-premium-code').css('display', 'none');
$.removeCookie('close_premium_alert');
});
function update_counter(){
$(".counter-class").each(function() {
var id = $(this).data('id');
var date = $(this).data('date');
$("#counter_" + id)
.countdown(date, function(event) {
$(this).text(
event.strftime('%-D day%!D %Hh %Mmin %Ssec.')
);
});
});
}
update_counter();
$(document).on('submit', '#formStripePremium', function(event) {
event.preventDefault();
$('.btn-sub-stripe').append('<i class="fa fa-spinner fa-spinner-bt fa-spin fa-3x fa-fw" style="font-size:20px;margin-left:10px;"></i>');
Stripe.setPublishableKey('{{ \Setting::get('stripe_publish_key') }}');
var valid = $('[name="card_valid"]').val();
var valid = valid.split('-');
var year = valid[0];
var moth = valid[1];
Stripe.card.createToken({
number: $('[name="card_number"]').val(),
cvc: $('[name="card_csv"]').val(),
exp_month: moth,
exp_year: year
}, stripeResponseHandler);
function stripeResponseHandler(status, response) {
// Grab the form:
var $form = $('#payment-form');
if (response.error) { // Problem!
toastr.remove();
$('.fa-spinner-bt').remove();
toastr.error('Error!', response.error.message);
return;
} else { // Token was created!
// Get the token ID:
var token = response.id;
var id = $('#stripe_premium_code_id').val();
$.ajax({
type: 'POST',
data: {
'token_stripe' : token,
'email_stripe' : $('#email_stripe').val()
},
dataType : 'json',
url: "{{ url('verifyInvoiceByPlanStripe') }}/" + id,
success: function(data) {
if (data.status == 3) {
toastr.remove();
$('.fa-spinner-bt').remove();
alert('Error! Please try again.');
}
if (data.status == 2) {
window.location.href = '{{ url("/") }}';
}
},
error: function(data) {
toastr.remove();
$('.fa-spinner-bt').remove();
toastr.error('Error!', 'Error Ajax');
}
});
}
}
});
function number_format (number, decimals, dec_point, thousands_sep) {
// Strip all characters but numerical ones.
number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec) {
var k = Math.pow(10, prec);
return '' + Math.round(n * k) / k;
};
// Fix for IE parseFloat(0.55).toFixed(0) = 0;
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
if (s[0].length > 3) {
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
}
if ((s[1] || '').length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
}
return s.join(dec);
}
$(document).on('click', '.lnd-pay-card', function(event) {
event.preventDefault();
var premium_code_id = $(this).attr('data-premium-id');
var premium_plan_days = $(this).attr('data-premium-days');
var premium_expired_at = $(this).attr('data-expired-at');
var btc_base = parseFloat($('#amountBtc').val());
var premium_amount = (parseInt($(this).attr('data-amount')) / 100000000 * btc_base);
console.log(premium_amount);
var formatted_amount = number_format(premium_amount, 2, '.', '');
$('#stripe_premium_code_id').val(premium_code_id);
if (premium_code_id > 0) {
$('#exampleModalLabelPremiumStripe').html('<i class="fal fa-gem"></i> Buy '+premium_plan_days +' day Premium Plan');
$('.span-cost-premium-stripe').html('$' + formatted_amount);
$('.span-date-premium-stripe').html(premium_expired_at);
$('.span-days-premium-stripe').html(premium_plan_days);
$('.modal').modal('hide');
$('#stripe-modal').modal('show');
}
});
$(document).on("click", '.get-premium-invoice', function(event) {
event.preventDefault();
var id = $(this).data('id');
$(this).append('<i class="fas fa-sync fa-spin fa-premium-plan-icon" style="font-size: 20px;color: #fff;margin-left:12px;position: relative;left:12px;display: inline-block !important;margin:auto;text-align:center;"></i>');
$.ajax({
type: 'GET',
dataType : 'json',
url: "{{ url('createInvoicePlan') }}/" + id,
success: function(data) {
$('.fa-premium-plan-icon').remove();
$('#exampleModalLabelPremium').html('<i class="fal fa-gem"></i> Buy '+data.premium_plan_days +' day Premium Plan');
$('.span-cost-premium').html(data.amount + ' sats');
$('.span-date-premium').html(data.expired_at);
$('.span-days-premium').html(data.premium_plan_days);
$('.span-qrcode-premium').empty().html('<a href="LIGHTNING:'+data.payment_request+'"><img src="data:image/png;base64,' + data.qr_code + '" class="img-fluid rounded mx-auto d-block"/></a>');
$('.lnd-pay-card').attr('data-premium-id', data.premium_code_id);
$('.lnd-pay-card').attr('data-premium-days', data.premium_plan_days);
$('.lnd-pay-card').attr('data-expired-at', data.expired_at);
$('.lnd-pay-card').attr('data-amount', data.amount);
$('.modal').modal('hide');
$('#buy-pass').modal('show');
let interval = setInterval(function(){
verifyIntervalPremium(data.add_index, data.premium_code_id);
}, 1000);
function verifyIntervalPremium(add_index, premium_code_id)
{
$.ajax({
type: 'GET',
dataType : 'json',
url: "{{ url('verifyInvoicePlan') }}/" + add_index + "/" + premium_code_id,
success: function(data) {
if (data.status == 3) {
stopInterval();
alert('Error! Please try again.');
}
if (data.status == 2) {
stopInterval();
//data.days
window.location.href = '{{ url("/") }}';
}
},
error: function(data) {
//alert('error!');
}
});
}
function stopInterval()
{
clearInterval(interval);
}
},
error: function(data) {
$('.fa-premium-plan-icon').remove();
alert('error!');
}
});
});
$(document).on("click", '.get-action-invoice', function(event) {
event.preventDefault();
var id = $(this).data('id');
var type = $(this).data('type');
var message = '';
if (type == 2) {
if ($('#message_action_' + id).val()) {
var message = $('#message_action_' + id).val();
}
}
$(this).append('<i class="fas fa-sync fa-spin fa-action-plan-icon" style="font-size: 20px;color: #fff;margin-left:12px;position: relative;left:12px;display: inline-block !important;margin:auto;text-align:center;"></i>');
$.ajax({
type: 'POST',
dataType : 'json',
data: {
'message' : message
},
url: "{{ url('createInvoiceAction') }}/" + id,
success: function(data) {
$('.fa-action-plan-icon').remove();
$('#exampleModalLabelAction').html('<i class="fal fa-play-circle"></i> '+data.action_name +' for '+data.action_amount+' sats.');
$('.span-cost-action').html(data.action_amount + ' sats');
$('.span-qrcode-action').empty().html('<a href="LIGHTNING:'+data.payment_request+'"><img src="data:image/png;base64,' + data.qr_code + '" class="img-fluid rounded mx-auto d-block"/></a>');
$('.span-name-action').html(data.action_name);
$('#iot-invoice').modal('show');
let interval = setInterval(function(){
verifyIntervalAction(data.add_index, data.id, id);
}, 3000);
function verifyIntervalAction(add_index, id, actionId)
{
console.log($('#action'+actionId).data('execute'));
if ($('#action'+actionId).data('execute') == 1) {
return;
}
$('#action'+actionId).data('execute', 1);
$.ajax({
type: 'GET',
dataType : 'json',
url: "{{ url('verifyInvoiceAction') }}/" + add_index + "/" + id,
success: function(data) {
if (data.status == 3) {
stopInterval();
$('#action'+data.action.id).data('execute', 0);
alert('Error! Please try again.');
}
if (data.status == 2) {
stopInterval();
$('#action'+data.action.id).attr('data-execute', 1);
if (data.action.type == 1) {
window.location.href = '{{ url("/") }}';
}
if (data.action.type == 2) {
toastr.success(data.action.name, 'Success!');
$('.modal').modal('hide');
}
if (data.action.type == 3) {
toastr.success(data.action.name, 'Success!');
$('.modal').modal('hide');
}
if (data.action.type == 4) {
window.open(
data.action.target,
'_blank'
);
toastr.success(data.action.name, 'Success!');
$('.modal').modal('hide');
}
}
if (data.status == 1) {
$('#action'+actionId).data('execute', 0);
}
},
error: function(data) {
//alert('error!');
}
});
}
function stopInterval()
{
clearInterval(interval);
}
},
error: function(data) {
$('.fa-action-plan-icon').remove();
alert('error!');
}
});
});
</script>
<script>
$(document).on('focusin', function(e) {
if ($(e.target).closest(".tox").length) {
e.stopImmediatePropagation();
}
});
$('[name="paid"]').change(function() {
event.preventDefault();
if (this.value == 1) {
var data_html = '<div class="form-group"><label for="paidAmount">Bezahlbarer Betrag</label><input type="number" value="1000" class="form-control" id="paidAmount" placeholder="Bezahlbarer Betrag" name="paidAmount" required="required"></div>';
$('.form-amount').html(data_html);
} else {
$('.form-amount').empty();
}
});
$(document).on("click", '.get-collapse-invoice', function(event) {
event.preventDefault();
var id = $(this).data('id');
var isExpanded = $('#ln-invoice-' + id).hasClass('show');
$('#ln-invoice-' + id).collapse('toggle');
if (isExpanded == false) {
$('.pay-news-' + id).html('<i class="fas fa-sync fa-spin" style="font-size: 34px;color: #fff;display: block;margin:auto;text-align:center;"></i>');
$.ajax({
type: 'GET',
dataType : 'json',
url: "{{ url('createInvoice') }}/" + id,
success: function(data) {
$('.pay-news-' + id).empty().html('<img src="data:image/png;base64,' + data.qr_code + '" class="img-fluid rounded mx-auto d-block"/>');
$('.pay-news-' + id).attr('href', 'LIGHTNING:' + data.payment_request);
$('#pay-news-title-' + id).empty().html('<div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text" id="basic-addon1"> <a href=""><i class="fal fa-copy"></i></a></span></div><input type="text" class="form-control" value="'+data.payment_request+'" aria-describedby="basic-addon1"></div>');
let interval = setInterval(function(){
verifyInterval(data.add_index, data.id);
}, 2000);
function verifyInterval(add_index, id)
{
$.ajax({
type: 'GET',
dataType : 'json',
url: "{{ url('verifyInvoice') }}/" + add_index + "/" + id,
success: function(data) {
if (data.status == 3) {
stopInterval();
alert('erro tente novamente!');
}
if (data.status == 2) {
stopInterval();
var content = data.content;
var idContent = data.id;
toastr.remove();
toastr.success('Premium content unlocked.', 'Success!');
$('#payment-request-' + idContent).remove();
$('.pay-preview-' + idContent).remove();
$('.card-preview-' + idContent).css('background', 'none');
$('#text_news_' + idContent).html(content);
if (data.nach_type == 2) {
if (data.additional_fields.workplace) {
var workplace = data.additional_fields.workplace;
} else {
var workplace = "";
}
if (data.additional_fields.contact_info) {
var contact_info = data.additional_fields.contact_info;
} else {
var contact_info = "";
}
}
if (data.nach_type == 3) {
var content_action = '<hr><div class="row">';
jQuery.each( data.actions, function( i, val ) {
var class_act = 'col-md-6';
if (data.actions.length == 1) {
var class_act = 'col-md-12';
}
content_action += '<div class="'+class_act+'">';
content_action += '<small>Description: '+val.description+'</small><br>';
if (data.show_total_paid_action) {
if (data.total_actions == 1) {
content_action += '<p>Total paid: '+data.total_paid_action+' sats</p>';
} else {
if (data.total_paid_action > 0) {
var diff = (val.total_paid * 100) / data.total_paid_action;
} else {
var diff = 0;
}
content_action+= '<div class="progress">';
content_action+= '<div class="progress-bar bg-'+val.color+'" role="progressbar" style="width: '+ diff +'%" aria-valuenow="66" aria-valuemin="0" aria-valuemax="100">'+val.total_paid+' sats</div>';
content_action+= '</div>';
}
}
content_action += '<a href="" id="action'+val.id+'" style="margin-top: 20px;" class="btn btn-'+val.color+' mx-0 d-block get-action-invoice" data-id="'+val.id+'" data-type="'+val.type+'" data-execute="0"><i class="fal fa-'+val.icon+'"></i> '+val.name+' for '+val.amount+' sats.</a>';
content_action += '</div>';
});
content_action += '</div>';
$('#box_action_' +idContent).html(content_action);
}
$('#text_news_workplace_' + idContent).html(workplace);
$('#text_news_contact_info_' + idContent).html(contact_info);
}
},
error: function(data) {
//alert('error!');
}
});
}
function stopInterval()
{
clearInterval(interval);
}
},
error: function(data) {
alert('error!');
}
});
} else {
$('.pay-news-' + id).empty();
$('#pay-news-title-' + id).empty();
}
});
tinymce.init({
selector: '#exampleFormControlTextarea1',
plugins: 'advlist link image lists',
toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | link | unlink | image',
height: '250',
directionality : 'de',
language : 'de',
setup: function (editor) {
editor.on('change', function (e) {
editor.save();
});
}
});
var uploadedDocumentMap = {}
myDropzone = Dropzone.options.imageDropzone = {
url: '{{ url('addFile') }}',
maxFilesize: 2, // MB
acceptedFiles: 'image/*,application/pdf,.doc,.docx,.xls,.xlsx',
addRemoveLinks: true,
headers: {
'X-CSRF-TOKEN': "{{ csrf_token() }}"
},
success: function (file, response) {
$('form').append('<input type="hidden" name="files[]" value="' + response.name + '|'+ response.original_name +'">')
uploadedDocumentMap[file.name] = response.name
},
removedfile: function (file) {
file.previewElement.remove()
var name = ''
if (typeof file.file_name !== 'undefined') {
name = file.file_name
} else {
name = uploadedDocumentMap[file.name]
}
$('form').find('input[name="files[]"][value="' + name + '"]').remove()
}
}
</script>
<script>
function setCommentId(id) {
document.getElementById('comment_nach_id').value = id
}
function showComments(event, id) {
event.preventDefault();
document.getElementById('comment_button_' + id).style.display = 'none';
document.getElementById('comments_' + id).style.display = "";
return false;
}
function angebote() {
window.location.href = "{{url('angebote')}}"
}
</script>
@stop