Prepare modules

This commit is contained in:
2025-03-22 12:41:56 -06:00
parent 04f5e973d7
commit 3916c62935
74 changed files with 4431 additions and 194 deletions

View File

@ -0,0 +1,67 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
use Livewire\Component;
class ChatSettings extends Component
{
private $targetNotify = "#website-chat-settings-card .notification-container";
public $chat_provider,
$chat_whatsapp_number,
$chat_whatsapp_message;
public function mount()
{
$this->resetForm();
}
public function save()
{
if ($this->chat_provider == 'whatsapp') {
$this->validate([
'chat_whatsapp_number' => 'required|string|max:20',
'chat_whatsapp_message' => 'required|string|max:255',
]);
}
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$SettingsService->set('chat.provider', $this->chat_provider, null, 'vuexy-website-admin');
$SettingsService->set('chat.whatsapp_number', $this->chat_whatsapp_number, null, 'vuexy-website-admin');
$SettingsService->set('chat.whatsapp_message', $this->chat_whatsapp_message, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars('chat');
$this->chat_provider = $settings['provider'];
$this->chat_whatsapp_number = $settings['whatsapp_number'];
$this->chat_whatsapp_message = $settings['whatsapp_message'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.chat-settings');
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
use Livewire\Component;
class ContactFormSettings extends Component
{
private $targetNotify = "#website-contact-form-settings-card .notification-container";
public $to_email,
$to_email_cc,
$subject,
$submit_message;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'to_email' => 'required|email',
'to_email_cc' => 'nullable|email',
'subject' => 'required|string',
'submit_message' => 'required|string'
]);
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$SettingsService->set('contact.form.to_email', $this->to_email, null, 'vuexy-website-admin');
$SettingsService->set('contact.form.to_email_cc', $this->to_email_cc, null, 'vuexy-website-admin');
$SettingsService->set('contact.form.subject', $this->subject, null, 'vuexy-website-admin');
$SettingsService->set('contact.form.submit_message', $this->submit_message, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars('contact');
$this->to_email = $settings['form']['to_email'];
$this->to_email_cc = $settings['form']['to_email_cc'];
$this->subject = $settings['form']['subject'];
$this->submit_message = $settings['form']['submit_message'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.contact-form-settings');
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
use Livewire\Component;
class ContactInfoSettings extends Component
{
private $targetNotify = "#website-contact-info-settings-card .notification-container";
public $phone_number,
$phone_number_ext,
$phone_number_2,
$phone_number_2_ext,
$email,
$horario;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'phone_number' => 'nullable|string',
'phone_number_ext' => 'nullable|string',
'phone_number_2' => 'nullable|string',
'phone_number_2_ext' => 'nullable|string',
'email' => 'nullable|email',
'horario' => 'nullable|string',
]);
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$SettingsService->set('contact.phone_number', $this->phone_number, null, 'vuexy-website-admin');
$SettingsService->set('contact.phone_number_ext', $this->phone_number_ext, null, 'vuexy-website-admin');
$SettingsService->set('contact.phone_number_2', $this->phone_number_2, null, 'vuexy-website-admin');
$SettingsService->set('contact.phone_number_2_ext', $this->phone_number_2_ext, null, 'vuexy-website-admin');
$SettingsService->set('contact.email', $this->email, null, 'vuexy-website-admin');
$SettingsService->set('contact.horario', $this->horario, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars('contact');
$this->phone_number = $settings['phone_number'];
$this->phone_number_ext = $settings['phone_number_ext'];
$this->phone_number_2 = $settings['phone_number_2'];
$this->phone_number_2_ext = $settings['phone_number_2_ext'];
$this->email = $settings['email'];
$this->horario = $settings['horario'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.contact-info-settings');
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
use Livewire\Component;
class GoogleAnalyticsSettings extends Component
{
private $targetNotify = "#website-analytics-settings-card .notification-container";
public $google_analytics_enabled,
$google_analytics_id;
public function mount()
{
$this->resetForm();
}
public function save()
{
if ($this->google_analytics_enabled) {
$this->validate([
'google_analytics_id' => 'required|string|min:12|max:30',
]);
}
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$SettingsService->set('google.analytics_enabled', $this->google_analytics_enabled, null, 'vuexy-website-admin');
$SettingsService->set('google.analytics_id', $this->google_analytics_id, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars('google');
$this->google_analytics_enabled = $settings['analytics']['enabled'];
$this->google_analytics_id = $settings['analytics']['id'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.analytics-settings');
}
}

View File

@ -0,0 +1,69 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
use Livewire\Component;
class LocationSettings extends Component
{
private $targetNotify = "#website-location-settings-card .notification-container";
public $direccion,
$location_lat,
$location_lng;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'direccion' => ['nullable', 'string', 'max:255'],
'location_lat' => ['nullable', 'numeric'],
'location_lng' => ['nullable', 'numeric'],
]);
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$location_lat = $this->location_lat? (float) $this->location_lat: null;
$location_lng = $this->location_lng? (float) $this->location_lng: null;
$SettingsService->set('contact.direccion', $this->direccion, null, 'vuexy-website-admin');
$SettingsService->set('contact.location.lat', $location_lat, null, 'vuexy-website-admin');
$SettingsService->set('contact.location.lng', $location_lng, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars('contact');
$this->direccion = $settings['direccion'];
$this->location_lat = $settings['location']['lat'];
$this->location_lng = $settings['location']['lng'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.location-settings');
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Livewire\Component;
use Livewire\WithFileUploads;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteSettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
class LogoOnDarkBgSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#logo-on-dark-bg-settings-card .notification-container";
public $website_image_logo_dark,
$upload_image_logo_dark;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'upload_image_logo_dark' => 'required|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
// Procesar favicon si se ha cargado una imagen
app(WebsiteSettingsService::class)->processAndSaveImageLogo($this->upload_image_logo_dark, 'dark');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars();
$this->upload_image_logo_dark = null;
$this->website_image_logo_dark = $settings['image_logo']['large_dark'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.logo-on-dark-bg-settings');
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Livewire\Component;
use Livewire\WithFileUploads;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteSettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
class LogoOnLightBgSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#logo-on-light-bg-settings-card .notification-container";
public $website_image_logo,
$upload_image_logo;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'upload_image_logo' => 'required|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
// Procesar favicon si se ha cargado una imagen
app(WebsiteSettingsService::class)->processAndSaveImageLogo($this->upload_image_logo);
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars();
$this->upload_image_logo = null;
$this->website_image_logo = $settings['image_logo']['large'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.logo-on-light-bg-settings');
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
use Livewire\Component;
class SocialMediaSettings extends Component
{
private $targetNotify = "#website-social-settings-card .notification-container";
public $social_whatsapp,
$social_whatsapp_message,
$social_facebook,
$social_instagram,
$social_linkedin,
$social_tiktok,
$social_x_twitter,
$social_google,
$social_pinterest,
$social_youtube,
$social_vimeo;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'social_whatsapp' => 'string|max:20',
'social_whatsapp_message' => 'string|max:255',
'social_facebook' => 'url',
'social_instagram' => 'url',
'social_linkedin' => 'url',
'social_tiktok' => 'url',
'social_x_twitter' => 'url',
'social_google' => 'url',
'social_pinterest' => 'url',
'social_youtube' => 'url',
'social_vimeo' => 'url',
]);
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$SettingsService->set('social.whatsapp', $this->social_whatsapp, null, 'vuexy-website-admin');
$SettingsService->set('social.whatsapp_message', $this->social_whatsapp_message, null, 'vuexy-website-admin');
$SettingsService->set('social.facebook', $this->social_facebook, null, 'vuexy-website-admin');
$SettingsService->set('social.instagram', $this->social_instagram, null, 'vuexy-website-admin');
$SettingsService->set('social.linkedin', $this->social_linkedin, null, 'vuexy-website-admin');
$SettingsService->set('social.tiktok', $this->social_tiktok, null, 'vuexy-website-admin');
$SettingsService->set('social.x_twitter', $this->social_x_twitter, null, 'vuexy-website-admin');
$SettingsService->set('social.google', $this->social_google, null, 'vuexy-website-admin');
$SettingsService->set('social.pinterest', $this->social_pinterest, null, 'vuexy-website-admin');
$SettingsService->set('social.youtube', $this->social_youtube, null, 'vuexy-website-admin');
$SettingsService->set('social.vimeo', $this->social_vimeo, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getSocialVars();
$this->social_whatsapp = $settings['whatsapp'];
$this->social_whatsapp_message = $settings['whatsapp_message'];
$this->social_facebook = $settings['facebook'];
$this->social_instagram = $settings['instagram'];
$this->social_linkedin = $settings['linkedin'];
$this->social_tiktok = $settings['tiktok'];
$this->social_x_twitter = $settings['x_twitter'];
$this->social_google = $settings['google'];
$this->social_pinterest = $settings['pinterest'];
$this->social_youtube = $settings['youtube'];
$this->social_vimeo = $settings['vimeo'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.social-media-settings');
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Livewire\Component;
use Koneko\VuexyAdmin\Services\SettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
class WebsiteDescriptionSettings extends Component
{
private $targetNotify = "#website-description-settings-card .notification-container";
public $title,
$description;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'title' => 'required|string|max:255',
'description' => 'nullable|string|max:255',
]);
// Guardar título del sitio en configuraciones
$SettingsService = app(SettingsService::class);
$SettingsService->set('website.title', $this->title, null, 'vuexy-website-admin');
$SettingsService->set('website.description', $this->description, null, 'vuexy-website-admin');
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars();
$this->title = $settings['title'];
$this->description = $settings['description'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.website-description-settings');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace Koneko\VuexyWebsiteAdmin\Livewire\VuexyWebsiteAdmin;
use Livewire\Component;
use Livewire\WithFileUploads;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteSettingsService;
use Koneko\VuexyWebsiteAdmin\Services\WebsiteTemplateService;
class WebsiteFaviconSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#website-favicon-settings-card .notification-container";
public $website_favicon_16x16,
$website_favicon_76x76,
$website_favicon_120x120,
$website_favicon_152x152,
$website_favicon_180x180,
$website_favicon_192x192;
public $upload_image_favicon;
public function mount()
{
$this->resetForm();
}
public function save()
{
$this->validate([
'upload_image_favicon' => 'required|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
// Procesar favicon
app(WebsiteSettingsService::class)->processAndSaveFavicon($this->upload_image_favicon);
// Limpiar cache de plantilla
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
// Recargamos el formulario
$this->resetForm();
// Notificación de éxito
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function resetForm()
{
// Obtener los valores de las configuraciones de la base de datos
$settings = app(WebsiteTemplateService::class)->getWebsiteVars();
$this->upload_image_favicon = null;
$this->website_favicon_16x16 = $settings['favicon']['16x16'];
$this->website_favicon_76x76 = $settings['favicon']['76x76'];
$this->website_favicon_120x120 = $settings['favicon']['120x120'];
$this->website_favicon_152x152 = $settings['favicon']['152x152'];
$this->website_favicon_180x180 = $settings['favicon']['180x180'];
$this->website_favicon_192x192 = $settings['favicon']['192x192'];
}
public function render()
{
return view('vuexy-website-admin::livewire.vuexy.website-favicon-settings');
}
}