Prepare modules
This commit is contained in:
41
resources/js/google-analytics-settings-card.js
Normal file
41
resources/js/google-analytics-settings-card.js
Normal file
@ -0,0 +1,41 @@
|
||||
import '@vuexy-admin/notifications/LivewireNotification.js';
|
||||
import FormCustomListener from '@vuexy-admin/forms/formCustomListener';
|
||||
import registerLivewireHookOnce from '@vuexy-admin/livewire/registerLivewireHookOnce';
|
||||
|
||||
// Inicializar formularios de ajustes de análisis de datos
|
||||
window.AnalyticsSettingsForm = new FormCustomListener({
|
||||
formSelector: '#website-analytics-settings-card',
|
||||
buttonSelectors: ['.btn-save', '.btn-cancel'],
|
||||
callbacks: [() => {}],
|
||||
dispatchOnSubmit: 'save',
|
||||
validationConfig: {
|
||||
fields: {
|
||||
google_analytics_id: {
|
||||
validators: {
|
||||
callback: {
|
||||
message: 'ID de medición de Google Analytics no tienen un formato válido.',
|
||||
callback: function (input) {
|
||||
if (document.getElementById('google_analytics_enabled').checked) {
|
||||
return input.value.trim() !== '';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap5: new FormValidation.plugins.Bootstrap5({
|
||||
eleValidClass: '',
|
||||
rowSelector: '.fv-row'
|
||||
}),
|
||||
submitButton: new FormValidation.plugins.SubmitButton(),
|
||||
autoFocus: new FormValidation.plugins.AutoFocus()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerLivewireHookOnce('morphed', 'vuexy-website-admin::analytics-index', (component) => {
|
||||
AnalyticsSettingsForm.reloadValidation();
|
||||
});
|
Reference in New Issue
Block a user