Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx

This commit is contained in:
2025-01-25 04:23:40 -06:00
parent c3045b43b1
commit 64d505910f
1283 changed files with 140198 additions and 0 deletions

View File

@ -0,0 +1,64 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class AnalyticsSettings extends Component
{
private $targetNotify = "#website-analytics-settings-card .notification-container";
public $google_analytics_enabled,
$google_analytics_id;
protected $listeners = ['saveAnalyticsSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$WebsiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $WebsiteTemplateService->getWebsiteVars('google');
$this->google_analytics_enabled = $settings['analytics']['enabled'];
$this->google_analytics_id = $settings['analytics']['id'];
}
public function save()
{
if ($this->google_analytics_enabled) {
$this->validate([
'google_analytics_id' => 'required|string|min:12|max:30',
]);
}
$websiteSettingsService = app(WebsiteSettingsService::class);
// Guardar título del App en configuraciones
$websiteSettingsService->updateSetting('google_analytics_enabled', $this->google_analytics_enabled);
$websiteSettingsService->updateSetting('google_analytics_id', $this->google_analytics_id);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.analytics-settings');
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class ChatSettings extends Component
{
private $targetNotify = "#website-chat-settings-card .notification-container";
public $chat_provider,
$chat_whatsapp_number,
$chat_whatsapp_message;
protected $listeners = ['saveChatSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars('chat');
$this->chat_provider = $settings['provider'];
$this->chat_whatsapp_number = $settings['whatsapp_number'];
$this->chat_whatsapp_message = $settings['whatsapp_message'];
}
public function save()
{
if ($this->chat_provider == 'whatsapp') {
$this->validate([
'chat_whatsapp_number' => 'required|string|max:20',
'chat_whatsapp_message' => 'required|string|max:255',
]);
}
$websiteSettingsService = app(WebsiteSettingsService::class);
// Guardar título del App en configuraciones
$websiteSettingsService->updateSetting('chat_provider', $this->chat_provider);
$websiteSettingsService->updateSetting('chat_whatsapp_number', preg_replace('/\D/', '', $this->chat_whatsapp_number));
$websiteSettingsService->updateSetting('chat_whatsapp_message', $this->chat_whatsapp_message);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.chat-settings');
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class ContactFormSettings extends Component
{
private $targetNotify = "#website-contact-form-settings-card .notification-container";
public $contact_form_email,
$contact_form_email_cc,
$contact_form_subject;
protected $listeners = ['saveContactFormSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->contact_form_email = $settings['contact']['form']['email'];
$this->contact_form_email_cc = $settings['contact']['form']['email_cc'];
$this->contact_form_subject = $settings['contact']['form']['subject'];
}
public function save()
{
$this->validate([
'contact_form_email' => 'required|email',
'contact_form_email_cc' => 'nullable|email',
'contact_form_subject' => 'required|string'
]);
$websiteSettingsService = app(WebsiteSettingsService::class);
// Guardar título del App en configuraciones
$websiteSettingsService->updateSetting('contact_form_email', $this->contact_form_email);
$websiteSettingsService->updateSetting('contact_form_email_cc', $this->contact_form_email_cc);
$websiteSettingsService->updateSetting('contact_form_subject', $this->contact_form_subject);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.contact-form-settings');
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class ContactInfoSettings extends Component
{
private $targetNotify = "#website-contact-info-settings-card .notification-container";
public $contact_phone_number,
$contact_phone_number_ext,
$contact_email;
protected $listeners = ['saveContactInfoSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->contact_phone_number = $settings['contact']['phone_number'];
$this->contact_phone_number_ext = $settings['contact']['phone_number_ext'];
$this->contact_email = $settings['contact']['email'];
}
public function save()
{
$this->validate([
'contact_phone_number' => ['nullable', 'string', 'max:20'],
'contact_phone_number_ext' => ['nullable', 'string', 'max:10'],
'contact_email' => ['nullable', 'email']
]);
$websiteSettingsService = app(WebsiteSettingsService::class);
// Guardar título del App en configuraciones
$websiteSettingsService->updateSetting('contact_phone_number', $this->contact_phone_number);
$websiteSettingsService->updateSetting('contact_phone_number_ext', $this->contact_phone_number_ext);
$websiteSettingsService->updateSetting('contact_email', $this->contact_email);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.contact-info-settings');
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use Livewire\WithFileUploads;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class FaviconSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#website-favicon-settings-card .notification-container";
public $upload_image_favicon;
public $website_favicon_16x16,
$website_favicon_76x76,
$website_favicon_120x120,
$website_favicon_152x152,
$website_favicon_180x180,
$website_favicon_192x192;
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
$this->upload_image_favicon = null;
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$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 save()
{
$this->validate([
'upload_image_favicon' => 'required|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
// Procesar favicon si se ha cargado una imagen
$websiteSettingsService = app(WebsiteSettingsService::class);
$websiteSettingsService->processAndSaveFavicon($this->upload_image_favicon);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.favicon-settings');
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use Livewire\WithFileUploads;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class ImageLogoSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#website-image-logo-settings-card .notification-container";
public $website_image_logo,
$website_image_logo_dark;
public $upload_image_logo,
$upload_image_logo_dark;
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
$this->upload_image_logo = null;
$this->upload_image_logo_dark = null;
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->website_image_logo = $settings['image_logo']['large'];
$this->website_image_logo_dark = $settings['image_logo']['large_dark'];
}
public function save()
{
$this->validate([
'upload_image_logo' => 'nullable|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
'upload_image_logo_dark' => 'nullable|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
$websiteSettingsService = app(WebsiteSettingsService::class);
// Procesar favicon si se ha cargado una imagen
if ($this->upload_image_logo) {
$websiteSettingsService->processAndSaveImageLogo($this->upload_image_logo);
}
if ($this->upload_image_logo_dark) {
$websiteSettingsService->processAndSaveImageLogo($this->upload_image_logo_dark, 'dark');
}
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.image-logo-settings');
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Rules\NotEmptyHtml;
use Modules\Admin\App\Services\WebsiteSettingsService;
class LegalSettings extends Component
{
private $targetNotify = "#website-legal-settings-card .notification-container";
public $legalVars = [];
public $currentSection = null;
protected $listeners = [
'saveLegal' => 'save',
];
public function mount()
{
$this->loadSettings();
// Seleccionar la primera sección por defecto
$this->currentSection = array_key_first($this->legalVars);
}
function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
switch ($this->currentSection) {
case 'legal_terminos_y_condiciones':
$this->legalVars['legal_terminos_y_condiciones'] = $websiteTemplateService->getLegalVars('legal_terminos_y_condiciones');
break;
case 'legal_aviso_de_privacidad':
$this->legalVars['legal_aviso_de_privacidad'] = $websiteTemplateService->getLegalVars('legal_aviso_de_privacidad');
break;
case 'legal_politica_de_devoluciones':
$this->legalVars['legal_politica_de_devoluciones'] = $websiteTemplateService->getLegalVars('legal_politica_de_devoluciones');
break;
case 'legal_politica_de_envios':
$this->legalVars['legal_politica_de_envios'] = $websiteTemplateService->getLegalVars('legal_politica_de_envios');
break;
case 'legal_politica_de_cookies':
$this->legalVars['legal_politica_de_cookies'] = $websiteTemplateService->getLegalVars('legal_politica_de_cookies');
break;
case 'legal_autorizaciones_y_licencias':
$this->legalVars['legal_autorizaciones_y_licencias'] = $websiteTemplateService->getLegalVars('legal_autorizaciones_y_licencias');
break;
case 'legal_informacion_comercial':
$this->legalVars['legal_informacion_comercial'] = $websiteTemplateService->getLegalVars('legal_informacion_comercial');
break;
case 'legal_consentimiento_para_el_login_de_terceros':
$this->legalVars['legal_consentimiento_para_el_login_de_terceros'] = $websiteTemplateService->getLegalVars('legal_consentimiento_para_el_login_de_terceros');
break;
case 'legal_leyendas_de_responsabilidad':
$this->legalVars['legal_leyendas_de_responsabilidad'] = $websiteTemplateService->getLegalVars('legal_leyendas_de_responsabilidad');
break;
default:
$this->legalVars = $websiteTemplateService->getLegalVars();
}
}
public function rules()
{
$rules = [];
if ($this->legalVars[$this->currentSection]['enabled']) {
$rules["legalVars.{$this->currentSection}.content"] = ['required', 'string', new NotEmptyHtml];
}
$rules["legalVars.{$this->currentSection}.enabled"] = 'boolean';
return $rules;
}
public function save()
{
$this->validate($this->rules());
$websiteSettingsService = app(WebsiteSettingsService::class);
$websiteSettingsService->updateSetting($this->currentSection . '_enabled', $this->legalVars[$this->currentSection]['enabled']);
$websiteSettingsService->updateSetting($this->currentSection . '_content', $this->legalVars[$this->currentSection]['content']);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.legal-settings');
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class LocationSettings extends Component
{
private $targetNotify = "#website-location-settings-card .notification-container";
public $contact_direccion,
$contact_horario,
$contact_location_lat,
$contact_location_lng;
protected $listeners = ['saveLocationSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->contact_direccion = $settings['contact']['direccion'];
$this->contact_horario = $settings['contact']['horario'];
$this->contact_location_lat = $settings['contact']['location']['lat'];
$this->contact_location_lng = $settings['contact']['location']['lng'];
}
public function save()
{
$this->validate([
'contact_direccion' => ['nullable', 'string', 'max:255'],
'contact_horario' => ['nullable', 'string', 'max:255'],
'contact_location_lat' => ['nullable', 'numeric'],
'contact_location_lng' => ['nullable', 'numeric'],
]);
$websiteSettingsService = app(WebsiteSettingsService::class);
// Guardar título del App en configuraciones
$websiteSettingsService->updateSetting('contact_direccion', $this->contact_direccion);
$websiteSettingsService->updateSetting('contact_horario', $this->contact_horario);
$websiteSettingsService->updateSetting('contact_location_lat', $this->contact_location_lat);
$websiteSettingsService->updateSetting('contact_location_lng', $this->contact_location_lng);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.location-settings');
}
}

View File

@ -0,0 +1,100 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
use Modules\Admin\App\Services\WebsiteSettingsService;
class SocialSettings 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;
protected $listeners = ['saveSocialSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->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 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',
]);
$websiteSettingsService = app(websiteSettingsService::class);
// Guardar título del App en configuraciones
$websiteSettingsService->updateSetting('social_whatsapp', preg_replace('/\D/', '', $this->social_whatsapp));
$websiteSettingsService->updateSetting('social_whatsapp_message', $this->social_whatsapp_message);
$websiteSettingsService->updateSetting('social_facebook', $this->social_facebook);
$websiteSettingsService->updateSetting('social_instagram', $this->social_instagram);
$websiteSettingsService->updateSetting('social_linkedin', $this->social_linkedin);
$websiteSettingsService->updateSetting('social_tiktok', $this->social_tiktok);
$websiteSettingsService->updateSetting('social_x_twitter', $this->social_x_twitter);
$websiteSettingsService->updateSetting('social_google', $this->social_google);
$websiteSettingsService->updateSetting('social_pinterest', $this->social_pinterest);
$websiteSettingsService->updateSetting('social_youtube', $this->social_youtube);
$websiteSettingsService->updateSetting('social_vimeo', $this->social_vimeo);
app(WebsiteTemplateService::class)->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.social-settings');
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
class TemplateSettings extends Component
{
private $targetNotify = "#website-template-settings-card .notification-container";
public $website_tpl_style_switcher,
$website_tpl_footer_text;
protected $listeners = ['saveTemplateSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->website_tpl_style_switcher = $settings['template']['style_switcher'];
$this->website_tpl_footer_text = $settings['template']['footer_text'];
}
public function save()
{
$this->validate([
'website_tpl_footer_text' => 'nullable|string|max:50',
]);
$websiteTemplateService = app(WebsiteTemplateService::class);
// Guardar título del App en configuraciones
$websiteTemplateService->updateSetting('website_tpl_style_switcher', $this->website_tpl_style_switcher);
$websiteTemplateService->updateSetting('website_tpl_footer_text', $this->website_tpl_footer_text);
$websiteTemplateService->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.template-settings');
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
class WebsiteSettings extends Component
{
private $targetNotify = "#website-settings-card .notification-container";
public $website_title,
$website_description;
protected $listeners = ['saveWebsiteSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->website_title = $settings['title'];
$this->website_description = $settings['description'];
}
public function save()
{
$this->validate([
'website_title' => 'string|required|max:50',
'website_description' => 'string|max:160',
]);
$websiteTemplateService = app(WebsiteTemplateService::class);
// Guardar título del App en configuraciones
$websiteTemplateService->updateSetting('website_title', $this->website_title);
$websiteTemplateService->updateSetting('website_description', $this->website_description);
$websiteTemplateService->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.website-settings');
}
}