PageSourceSearch

https://lustkar.com/FUNCIONES_JAVASCRIPT/FormularioContacto.js

js lustkar.com collected 2026-10-02 00:52:25 UTC 13,802 bytes, 357 lines download raw bytes

1/*
2 * 20220623 - JM
3 */
4function validarDatosContacto() {
5    var Datos = { validado: false }
6    try {
7        const ContactoNombre = document.getElementById('NombreFormulario');
8        const ContactoCorreo = document.getElementById('CorreoFormulario');
9        const ContactoTelefono = document.getElementById('TelefonoFormulario');
10        const ContactoComentarios = document.getElementById('AsuntoFormulario');
11
12        const Nombre = ContactoNombre.value.trim();
13        const Correo = ContactoCorreo.value.trim();
14        const Telefono = ContactoTelefono.value.trim();
15        const Mensaje = ContactoComentarios.value.trim();
16
17        // VALIDAR INFO
18        jsonValidar = {
19            Datos: {
20                Nombre: Nombre,
21                Correo: Correo,
22                Telefono: Telefono,
23                Mensaje: Mensaje
24            },
25            Reglas: {
26                Nombre: { noVacio: true, longitudEntre: { min: 1, max: 40 } },
27                Correo: { noVacio: true, emailValido: true },
28                Telefono: { noVacio: true, longitudEntre: { min: 10, max: 13, unidad: 'Digitos' } },
29                Mensaje: { noVacio: true, longitudEntre: { min: 1, max: 400 } }
30            }
31        }
32
33        validar(jsonValidar);
34
35        if (setHayErrores)
36            throw { mensaje: rrErrores.join('\n') };
37
38        Datos.Nombre = Nombre;
39        Datos.Correo = Correo;
40        Datos.Telefono = Telefono;
41        Datos.Mensaje = Mensaje;
42        Datos.validado = true;
43
44    } catch (error) {
45        mostrarMensajeError(error?.mensaje, "");
46    }
47    return Datos;
48}
49
50
51
52function mostarDatosFormularioContacto(Procedencia) {
53
54    let procedencia = (Procedencia != null || Procedencia != undefined) ? Procedencia : 'Lustkar';
55
56    console.log(procedencia);
57
58    var fdMos = new FormData();
59    fdMos.append("llaveAcceso", "U4gYHV78KupAa2q");
60    fdMos.append("solicitud", "mostarDatosFormularioContacto");
61
62    $.ajax({
63        url: "../CODE/FormularioContactoCODE.php",
64        type: "POST",
65        data: fdMos,
66        dataType: "json",
67        error: function (err) {
68            console.log("AJAX error in request: " + decode_utf8(JSON.stringify(err, null, 2)));
69        },
70        processData: false,
71        contentType: false,
72        cache: false,
73        success: function (dataresponse) {
74
75            if (dataresponse.status == true) {
76                console.log("mssg: " + decode_utf8(dataresponse.mensaje));
77                console.log(dataresponse);
78                var rrMostrarDat = dataresponse.rrMostrarDat;
79
80                enviarFormularioContacto(rrMostrarDat, procedencia);
81
82            } else {
83                console.log("Error: " + decode_utf8(dataresponse.mensaje));
84
85            }
86        }
87    });
88} // Fin mostarDatosFormularioContacto
89
90function enviarFormularioContacto(rrMostrarDat, Procedencia) {
91
92    let procedencia = (Procedencia != null || Procedencia != undefined) ? Procedencia : 'Lustkar';
93
94    var AgProcedencia = "PWeb";
95
96    var TextNombre = document.getElementById("NombreFormulario");
97    var TextCorreo = document.getElementById("CorreoFormulario");
98    var TextTelefono = document.getElementById("TelefonoFormulario");
99    var TextMensaje = document.getElementById("AsuntoFormulario");
100    var TextAsunto = 'Contacto';
101
102
103    var fdIns = new FormData();
104    fdIns.append("llaveAcceso", "WaiaTN4CtSGG67n");
105    fdIns.append("solicitud", "insertarFormularioContacto");
106    fdIns.append("TextNombre", TextNombre.value);
107    fdIns.append("TextCorreo", TextCorreo.value);
108    fdIns.append("TextTelefono", TextTelefono.value);
109    fdIns.append("TextAsunto", TextAsunto);
110    fdIns.append("TextMensaje", TextMensaje.value);
111    fdIns.append("AgConnTercero", rrMostrarDat[0].AgConnTercero);
112    fdIns.append("Procedencia", procedencia);
113    fdIns.append("secretToken", rrMostrarDat[0].secretToken);
114    fdIns.append("AgProcedencia", AgProcedencia);
115
116    $.ajax({
117        url: "https://kimerkia.com/kmknet/APPS/Forseti/ENDPOINT/V1/FormularioContacto.php",
118        headers: { "Authorization": "key=" + rrMostrarDat[0].Token },
119        type: "POST",
120        data: fdIns,
121        dataType: "json",
122        error: function (err) {
123            console.log("AJAX error in request: " + decode_utf8(JSON.stringify(err, null, 2)));
124
125
126        },
127        processData: false,
128        contentType: false,
129        cache: false,
130        success: function (dataresponse) {
131
132
133
134            if (dataresponse.status == true) {
135                console.log("mssg: " + decode_utf8(dataresponse.mensaje));
136                //enviarCorreo(Procedencia);
137
138
139                TextNombre.value = "";
140                TextCorreo.value = "";
141                TextTelefono.value = "";
142                TextAsunto.value = "";
143                TextMensaje.value = "";
144
145                mostrarMensajeExito('Gracias por ponerte en contacto con nosotros. Te responderemos lo mas rápido posible.');
146                // NotSS.innerHTML = sHTMLEnv += `<div class="alert alert-success" role="alert">Gracias por ponerte en contacto con nosotros. Te responderemos lo mas rápido posible.</div>`;
147
148            } else {
149                console.log("Error: " + decode_utf8(dataresponse.mensaje));
150                mostrarMensajeError("Error: " + decode_utf8(dataresponse.mensaje));
151            }
152        }
153    });
154} // Fin enviarFormularioContacto
155
156function enviarCorreo(Procedencia) {
157
158    let procedencia = (Procedencia != null || Procedencia != undefined) ? Procedencia : 'Lustkar';
159
160    var TextNombre = document.getElementById("NombreFormulario");
161    var TextCorreo = document.getElementById("CorreoFormulario");
162    var TextTelefono = document.getElementById("TelefonoFormulario");
163    var TextMensaje = document.getElementById("AsuntoFormulario");
164
165    var TextAsunto = 'Contacto';
166
167    var fdEnv = new FormData();
168    fdEnv.append("llaveAcceso", "U4gYHV78KupAa2q");
169    fdEnv.append("solicitud", "enviarCorreo");
170    fdEnv.append("TextNombre", TextNombre.value);
171    fdEnv.append("TextCorreo", TextCorreo.value);
172    fdEnv.append("TextTelefono", TextTelefono.value);
173    fdEnv.append("TextAsunto", TextAsunto);
174    fdEnv.append("TextMensaje", TextMensaje.value);
175    fdEnv.append("Procedencia", procedencia);
176
177    $.ajax({
178        url: "../CODE/FormularioContactoCODE.php",
179        type: "POST",
180        data: fdEnv,
181        dataType: "json",
182        error: function (err) {
183            console.log("AJAX error in request: " + decode_utf8(JSON.stringify(err, null, 2)));
184        },
185        processData: false,
186        contentType: false,
187        cache: false,
188        success: function (dataresponse) {
189
190            if (dataresponse.status == true) {
191                console.log("mssg: " + decode_utf8(dataresponse.mensaje));
192                mostrarMensajeExito('Gracias por ponerte en contacto con nosotros. Te responderemos lo mas rápido posible.');
193
194            } else {
195                console.log("Error: " + decode_utf8(dataresponse.mensaje));
196                mostrarMensajeError("Error: " + decode_utf8(dataresponse.mensaje));
197
198            }
199        }
200    });
201} // Fin enviarCorreo
202
203/**
204 * 20220915 - O.G.
205 */
206function enviarFormularioContactoLustkar() {
207    // const QueryString = location.href;
208    // if (!QueryString.includes('Auto.php')) { enviarFormularioContactoForxeti(); return; }
209    try {
210        var TextNombre = document.getElementById("NombreFormulario");
211        var TextCorreo = document.getElementById("CorreoFormulario");
212        var TextTelefono = document.getElementById("TelefonoFormulario");
213        var TextMensaje = document.getElementById("AsuntoFormulario");
214        let AgAgencia = document.getElementById('BtnEnviarForCon').getAttribute('data-agencia') ?? 'TYPEW2647SKU25I';
215
216        let vehiculolustkar = '';
217        let origenForm = '';
218        if (AgAgencia === 'TYPEW2647SKU25I') {
219            vehiculolustkar = 'Formulario de Contacto';
220            origenForm = 'lustkarWeb';
221        }
222        else {
223            vehiculolustkar = document.getElementById('vehiculolustkar').innerHTML;
224            origenForm = 'lustkarWebVehiculo';
225        }
226
227        // VALIDAR INFO
228        let jsonValidar = {
229            Datos: {
230                Nombre: TextNombre.value,
231                Correo: TextCorreo.value,
232                Telefono: TextTelefono.value,
233                Mensaje: TextMensaje.value,
234                Agencia: AgAgencia
235            },
236            Reglas: {
237                Nombre: { noVacio: true, longitudEntre: { min: 1, max: 40 } },
238                Correo: { noVacio: true, emailValido: true },
239                Telefono: { noVacio: true, longitudEntre: { min: 10, max: 13, unidad: 'Digitos' } },
240                Mensaje: { noVacio: true, longitudEntre: { min: 1, max: 400 } },
241                Agencia: { noVacio: true }
242            }
243        }
244
245        validar(jsonValidar);
246
247        if (setHayErrores)
248            throw { mensaje: rrErrores[0] };
249
250        var fdMensajeLustkar = new FormData();
251        fdMensajeLustkar.append("llaveAcceso", "jRW{gd/2mz_$Y!c");
252        fdMensajeLustkar.append("solicitud", "enviarMensaje");
253        fdMensajeLustkar.append("TextNombre", TextNombre.value);
254        fdMensajeLustkar.append("TextCorreo", TextCorreo.value);
255        fdMensajeLustkar.append("TextTelefono", TextTelefono.value);
256        fdMensajeLustkar.append("TextMensaje", TextMensaje.value);
257        fdMensajeLustkar.append("TextOrigen", origenForm);
258        fdMensajeLustkar.append("Titulo", vehiculolustkar);
259        fdMensajeLustkar.append("AgAgencia", AgAgencia);
260
261        $.ajax({
262            url: '../CODE/LustkarIndexCODE.php',
263            type: 'POST',
264            dataType: 'json',
265            data: fdMensajeLustkar,
266            processData: false,
267            contentType: false,
268            cache: false,
269            error: function (err) {
270                console.log("AJAX error in request: " + decode_utf8(JSON.stringify(err, null, 2)));
271            },
272            success: function (dataresponse) {
273                if (dataresponse.status !== true) { mostrarMensajeError("Error: " + decode_utf8(dataresponse.mensaje)); return; }
274
275                TextNombre.value = "";
276                TextCorreo.value = "";
277                TextTelefono.value = "";
278                TextMensaje.value = "";
279
280                mostrarMensajeExito('Gracias por ponerte en contacto con nosotros. Te responderemos lo mas rápido posible.');
281            }
282        });
283    } catch (error) {
284        console.log(error);
285        mostrarMensajeError(error?.mensaje, "");
286    }
287} // Fin enviarFormularioContactoLustkar
288
289/**
290 * 20220915 - O.G.
291 */
292function enviarFormularioContactoForxeti() {
293    try {
294        var TextNombre = document.getElementById("NombreFormulario");
295        var TextCorreo = document.getElementById("CorreoFormulario");
296        var TextTelefono = document.getElementById("TelefonoFormulario");
297        var TextMensaje = document.getElementById("AsuntoFormulario");
298
299        // VALIDAR INFO
300        let jsonValidar = {
301            Datos: {
302                Nombre: TextNombre.value,
303                Correo: TextCorreo.value,
304                Telefono: TextTelefono.value,
305                Mensaje: TextMensaje.value,
306            },
307            Reglas: {
308                Nombre: { noVacio: true, longitudEntre: { min: 1, max: 40 } },
309                Correo: { noVacio: true, emailValido: true },
310                Telefono: { noVacio: true, longitudEntre: { min: 10, max: 13, unidad: 'Digitos' } },
311                Mensaje: { noVacio: true, longitudEntre: { min: 1, max: 400 } },
312            }
313        }
314
315        validar(jsonValidar);
316
317        if (setHayErrores)
318            throw { mensaje: rrErrores[0] };
319
320        var fdMensajeLustkar = new FormData();
321        fdMensajeLustkar.append("secretToken", "TnEqGukga#QLrE2t5tgAL0o5wSIz9yyYtnWUFIfo1Q");
322        fdMensajeLustkar.append("TextNombre", TextNombre.value);
323        fdMensajeLustkar.append("TextCorreo", TextCorreo.value);
324        fdMensajeLustkar.append("TextTelefono", TextTelefono.value);
325        fdMensajeLustkar.append("TextAsunto", TextTelefono.value);
326        fdMensajeLustkar.append("TextMensaje", TextMensaje.value);
327        fdMensajeLustkar.append("AgConnTercero", 'c9477506f8d96952b60f9e4d2481e2ce');
328        fdMensajeLustkar.append("AgProcedencia", 'PWeb');
329
330        $.ajax({
331            url: 'https://forxeti.com//ENDPOINT/V1/FormularioContacto.php',
332            headers: { "Authorization": "key=iRa#GKkqwPoy4Op0sr6CQg6L5t1mf0GOgapR2" },
333            type: 'POST',
334            dataType: 'json',
335            data: fdMensajeLustkar,
336            processData: false,
337            contentType: false,
338            cache: false,
339            error: function (err) {
340                console.log("AJAX error in request: " + decode_utf8(JSON.stringify(err, null, 2)));
341            },
342            success: function (dataresponse) {
343                if (dataresponse.status !== true) { mostrarMensajeError("Error: " + decode_utf8(dataresponse.mensaje)); return; }
344
345                TextNombre.value = "";
346                TextCorreo.value = "";
347                TextTelefono.value = "";
348                TextMensaje.value = "";
349
350                mostrarMensajeExito('Gracias por ponerte en contacto con nosotros. Te responderemos lo mas rápido posible.');
351            }
352        });
353    } catch (error) {
354        console.log(error);
355        mostrarMensajeError(error?.mensaje, "");
356    }
357} // Fin enviarFormularioContactoForxeti

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.