File: /var/www/vhost/disk-apps/alq-cali.bikenow.co/resources/views/news_club/form.blade.php
@csrf
<?php
$descriptionExists = isset($publication->description) && !empty($publication->description);
?>
<div class="card-body">
<div class="row">
<div class="form-group col-sm-12">
<label for="image">{{ Lang::get('messages.news_club.image') }}
{{ Lang::get('messages.optional') }}</label>
<a href="https://compresspng.com/es/" target="_blank" data-toggle="tooltip" data-placement="top"
title="{{ __('messages.photos_club.compress') }}">
<i class="fa fa-question-circle-o text-black" style="cursor: pointer;"></i>
</a>
@include('photos_club.dropzone')
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="name">{{ Lang::get('messages.news_club.link') }} </label>
<i class="fa fa-question-circle-o text-black" data-toggle="tooltip" data-placement="top"
title="{{ __('messages.news_club.help') }}" style="cursor: pointer;"></i>
<textarea type="text" class="form-control" rows="4" name="link">{{ $publicationContentLink ?? old('name') }}</textarea>
</div>
</div>
<input type="hidden" class="form-control" id="current_url" name="current_url" required>
<input type="hidden" class="form-control" id="id" name="id" required
value="{{ $publication->id ?? old('id') }}">
<div class="row">
<div class="form-group col-sm-12">
<label for="name">{{ Lang::get('messages.news_club.name') }} </label>
<input type="text" class="form-control" maxlength="100" name="name" required
value="{{ $publication->name ?? old('name') }}">
</div>
</div>
<div class="box collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">{{ Lang::get('messages.parameters_club.parameters') }}</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
<div class="box-body">
{{-- fecha inicio y fin --}}
<div class="row">
<div class="col-6 col-md-6">
<div class="form-group">
<label for="init_date"
class="ul-form__label">{{ Lang::get('messages.photos_club.init_date') }}</label>
<input type="datetime-local" class="form-control" name="init_date" placeholder=""
value="{{ isset($publication) ? str_replace(' ', 'T', $publication->init_date) : old('init_date') }}"
required>
</div>
</div>
<div class="col-6 col-md-6">
<div class="form-group">
<label for="end_date"
class="ul-form__label">{{ Lang::get('messages.photos_club.end_date') }}</label>
<input type="datetime-local" class="form-control" name="end_date" placeholder=""
value="{{ isset($publication) ? str_replace(' ', 'T', $publication->end_date) : old('end_date') }}"
required>
</div>
</div>
</div>
<div class="row">
<div class="col-6 col-md-6">
<div class="form-group">
<label>{{ Lang::get('messages.news_club.enable_reactions') }}</label>
<select class="form-control" name="likes_enabled">
<option value="1"
{{ isset($publication) && $publication->likes_enabled ? 'selected' : '' }}>
{{ Lang::get('messages.yes') }}</option>
<option value="0"
{{ isset($publication) && !$publication->likes_enabled ? 'selected' : '' }}>
{{ Lang::get('messages.no') }}</option>
</select>
</div>
</div>
<div class="col-6 col-md-6">
<div class="form-group">
<label>{{ Lang::get('messages.news_club.enable_comments') }}</label>
<select class="form-control" name="comments_enabled">
<option value="1"
{{ isset($publication) && $publication->comments_enabled ? 'selected' : '' }}>
{{ Lang::get('messages.yes') }}</option>
<option value="0"
{{ isset($publication) && !$publication->comments_enabled ? 'selected' : '' }}>
{{ Lang::get('messages.no') }}</option>
</select>
</div>
</div>
</div>
<div class="row">
{{-- segmentacion --}}
<div class="col-4 col-sm-12">
<div class="form-group">
<label for="tags">{{ Lang::get('messages.news_club.segmentation') }}
{{ Lang::get('messages.optional') }}</label>
@include('layouts.multiselect')
</div>
</div>
</div>
@include('notification_push_config.notificationPushConfig')
</div>
</div>
<div class="box collapsed-box">
<div class="box-header with-border">
<h3 class="box-title">Noticias personalizada</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
<div class="box-body">
<div class="form-group">
<label for="create-news">¿Crear Noticia?</label>
<select class="form-control" id="create-news" name="create-news" onchange="toggleNewsForm()">
<option value="no" <?= !$descriptionExists ? 'selected' : '' ?>>No</option>
<option value="si" <?= $descriptionExists ? 'selected' : '' ?>>Sí</option>
</select>
</div>
{{-- description --}}
<div class="row" id="news-form" style="display: <?= $descriptionExists ? 'block' : 'none' ?>;">
<div class="col-4 col-sm-12">
<div class="form-group">
<label for="description">{{ Lang::get('messages.news_club.description') }}
{{ Lang::get('messages.optional') }}</label>
<textarea type="text" class="form-control" rows="4" name="description" id="description">{{ $publication->description ?? old('description') }}</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<script src="{{ asset('js/jQuery/jquery-2.2.3.min.js') }}"></script>
<script src="{{ asset('js/crud.js') . '?v=' . time() }}"></script>
<script src="{{ asset('js/news_club.js') . '?v=' . time() }}"></script>
<script src="{{ asset('js/bootstrap/js/bootstrap.min.js') }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.2/min/dropzone.min.js"></script>
<script>
var initDateInput = document.getElementsByName("init_date")[0];
var publicationTime = {{ $parameters->publication_time }};
if (!initDateInput.value) {
var now = new Date();
var formattedNow = now.getFullYear() + '-' +
('0' + (now.getMonth() + 1)).slice(-2) + '-' +
('0' + now.getDate()).slice(-2) + 'T' +
('0' + now.getHours()).slice(-2) + ':' +
('0' + now.getMinutes()).slice(-2);
initDateInput.value = formattedNow;
}
var endDate = new Date(now.getFullYear(), now.getMonth() + publicationTime, now.getDate(), now.getHours(), now.getMinutes());
var formattedEndDate = endDate.getFullYear() + '-' +
('0' + (endDate.getMonth() + 1)).slice(-2) + '-' +
('0' + endDate.getDate()).slice(-2) + 'T' +
('0' + endDate.getHours()).slice(-2) + ':' +
('0' + endDate.getMinutes()).slice(-2);
document.getElementsByName("end_date")[0].value = formattedEndDate;
function toggleNewsForm() {
var createNews = document.getElementById('create-news').value;
var newsForm = document.getElementById('news-form');
var descriptionField = document.getElementById('description');
if (createNews === 'si') {
newsForm.style.display = 'block';
descriptionField.setAttribute('required', 'required');
} else {
newsForm.style.display = 'none';
descriptionField.removeAttribute('required');
descriptionField.value = '';
}
}
// Captura la URL actual de la página
var currentUrl = window.location.href;
// Crear una URL con el objeto URL para facilitar la manipulación
var url = new URL(currentUrl);
// Construir la nueva URL
var baseUrl = url.origin; // Esto obtiene "http://polarigo-web.test"
var newPath = 'news-club-personal/';
// Concatenar la base URL con el nuevo segmento
var newUrl = baseUrl + '/' + newPath;
// Asignar la nueva URL al campo oculto
document.getElementById('current_url').value = newUrl;
</script>