news blade
parent
c74afbfbe2
commit
0739af6e0c
|
@ -21,177 +21,12 @@
|
|||
|
||||
|
||||
<div class="article-feed">
|
||||
<article class="newsentry" style="width: 100%;" data-slug="{{ $nach->category->slug }}/{{ $nach->slug }}">
|
||||
<article class="newsentry" style="width: 100%;">
|
||||
|
||||
|
||||
@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-warning">
|
||||
<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;">
|
||||
|
@ -202,27 +37,16 @@
|
|||
<br>
|
||||
@endif
|
||||
|
||||
<a href="{{ route('nachrichten.get', [$nach->category->slug, $nach->slug]) }}">
|
||||
<a href="#">
|
||||
<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;">
|
||||
|
@ -233,160 +57,15 @@
|
|||
{!! $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>
|
||||
|
@ -400,12 +79,10 @@
|
|||
<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 = {
|
||||
|
@ -413,609 +90,7 @@
|
|||
};
|
||||
</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
|
||||
|
|
Loading…
Reference in New Issue