mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadidos assets y js
This commit is contained in:
0
httpdocs/assets/js/index.html
Executable file → Normal file
0
httpdocs/assets/js/index.html
Executable file → Normal file
0
httpdocs/assets/js/login.js
Executable file → Normal file
0
httpdocs/assets/js/login.js
Executable file → Normal file
0
httpdocs/assets/js/main.js
Executable file → Normal file
0
httpdocs/assets/js/main.js
Executable file → Normal file
@ -6,6 +6,7 @@ class Ajax{
|
||||
this.success = success;
|
||||
this.error = error;
|
||||
this.type = type;
|
||||
this.jqXHR = null;
|
||||
}
|
||||
post(){
|
||||
(this.type == 'default') ? this.ajax('POST'): this.ajaxForm('POST');
|
||||
@ -19,8 +20,21 @@ class Ajax{
|
||||
delete(){
|
||||
(this.type == 'default') ? this.ajax('DELETE'): this.ajaxForm('DELETE');
|
||||
}
|
||||
abort() {
|
||||
if (this.jqXHR) {
|
||||
this.jqXHR.abort();
|
||||
this.jqXHR = null; // Limpiamos la referencia a la petición
|
||||
}
|
||||
}
|
||||
setData(data){
|
||||
this.data = data;
|
||||
}
|
||||
ajax(method){
|
||||
$.ajax({
|
||||
if (this.jqXHR) {
|
||||
this.jqXHR.abort();
|
||||
}
|
||||
|
||||
this.jqXHR = $.ajax({
|
||||
url : this.url,
|
||||
type : method,
|
||||
data: this.data,
|
||||
@ -30,7 +44,11 @@ class Ajax{
|
||||
})
|
||||
}
|
||||
ajaxForm(method){
|
||||
$.ajax({
|
||||
if (this.jqXHR) {
|
||||
this.jqXHR.abort();
|
||||
}
|
||||
|
||||
this.jqXHR = $.ajax({
|
||||
url : this.url,
|
||||
type : method,
|
||||
data: this.data,
|
||||
|
||||
@ -54,14 +54,15 @@ class Chat {
|
||||
if (this.chatContactsBody[0]) {
|
||||
this.scrollbarContacts = new PerfectScrollbar(this.chatContactsBody[0], {
|
||||
wheelPropagation: false,
|
||||
suppressScrollX: true
|
||||
suppressScrollX: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.chatHistoryBody[0]) {
|
||||
this.scrollbarChatHistory = new PerfectScrollbar(this.chatHistoryBody[0], {
|
||||
wheelPropagation: false,
|
||||
suppressScrollX: true
|
||||
suppressScrollX: true,
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -481,6 +482,9 @@ export const showNotificationMessages = (dom) => {
|
||||
if(data.totalMessages > 0){
|
||||
$("#chat-notification-number").removeClass("d-none")
|
||||
$("#chat-notification-number").text(data.totalMessages ?? 0)
|
||||
}else{
|
||||
$("#chat-notification-number").addClass("d-none")
|
||||
$("#chat-notification-number").text(0)
|
||||
}
|
||||
data?.internals?.map((e) => {
|
||||
let numberOfMessages = e.unreadMessages
|
||||
@ -508,7 +512,7 @@ export const showNotificationMessages = (dom) => {
|
||||
dom.append(
|
||||
`
|
||||
<li class="">
|
||||
<a href="/presupuestos/cosidotapablanda/edit/${e.presupuestoId}" class="d-flex align-items-center flex-grow">
|
||||
<a href="${e.uri}" class="d-flex align-items-center flex-grow">
|
||||
<div class="avatar d-block flex-shrink-0">
|
||||
<span class="avatar-initial rounded-circle bg-label-primary">${e.presupuestoId}</span>
|
||||
</div>
|
||||
@ -528,7 +532,7 @@ export const showNotificationMessages = (dom) => {
|
||||
dom.append(
|
||||
`
|
||||
<li class="">
|
||||
<a href="/facturas/edit/${e.facturaId}" class="d-flex align-items-center flex-grow">
|
||||
<a href="${e.uri}" class="d-flex align-items-center flex-grow">
|
||||
<div class="avatar d-block flex-shrink-0">
|
||||
<span class="avatar-initial rounded-circle bg-label-primary">${e.facturaId}</span>
|
||||
</div>
|
||||
@ -548,7 +552,7 @@ export const showNotificationMessages = (dom) => {
|
||||
dom.append(
|
||||
`
|
||||
<li class="">
|
||||
<a href="/pedidos/edit/${e.pedidoId}" class="d-flex align-items-center flex-grow">
|
||||
<a href="${e.uri}" class="d-flex align-items-center flex-grow">
|
||||
<div class="avatar d-block flex-shrink-0">
|
||||
<span class="avatar-initial rounded-circle bg-label-primary">${e.pedidoId}</span>
|
||||
</div>
|
||||
|
||||
@ -4,9 +4,11 @@
|
||||
* @param {String} url
|
||||
* @param {String} placeholder
|
||||
*/
|
||||
let ClassSelect = function (domItem, url, placeholder, allowClear = false) {
|
||||
let ClassSelect = function (domItem, url, placeholder, allowClear = false, params = {}) {
|
||||
this.url = url;
|
||||
this.item = domItem;
|
||||
this.params = params;
|
||||
|
||||
this.config = {
|
||||
placeholder: placeholder,
|
||||
allowClear: allowClear,
|
||||
@ -15,10 +17,18 @@ let ClassSelect = function (domItem, url, placeholder, allowClear = false) {
|
||||
url: () => {
|
||||
return this.url;
|
||||
},
|
||||
data: function (params) {
|
||||
return {
|
||||
q: $.trim(params.term),
|
||||
};
|
||||
data: (params) => {
|
||||
let q = $.trim(params.term);
|
||||
let d = {
|
||||
q: q,
|
||||
page: params.page || 1,
|
||||
};
|
||||
|
||||
for (let key in this.params) {
|
||||
d[key] = this.params[key];
|
||||
}
|
||||
|
||||
return d;
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {
|
||||
@ -48,6 +58,9 @@ let ClassSelect = function (domItem, url, placeholder, allowClear = false) {
|
||||
this.reset = function () {
|
||||
this.item.val(null).trigger("change");
|
||||
};
|
||||
this.setParams = function(params){
|
||||
this.params = params;
|
||||
};
|
||||
this.getVal = function () {
|
||||
return this.item.val();
|
||||
};
|
||||
|
||||
@ -5,7 +5,9 @@ $(document).ready(() => {
|
||||
let chat = new Chat($("#chat-factura"))
|
||||
chat.init()
|
||||
chat.initFactura()
|
||||
if($("#internal_messages_chat").length > 0){
|
||||
let internalMessages = new InternalMessages($("#internal_messages_chat"))
|
||||
internalMessages.init()
|
||||
}
|
||||
|
||||
})
|
||||
@ -5,7 +5,9 @@ $(document).ready(() => {
|
||||
let chat = new Chat($("#chat-pedido"))
|
||||
chat.init()
|
||||
chat.initPedido()
|
||||
let internalMessages = new InternalMessages($("#internal_messages_chat"))
|
||||
internalMessages.init()
|
||||
if($("#internal_messages_chat").length > 0){
|
||||
let internalMessages = new InternalMessages($("#internal_messages_chat"))
|
||||
internalMessages.init()
|
||||
}
|
||||
|
||||
})
|
||||
@ -5,7 +5,9 @@ $(document).ready(() => {
|
||||
let chat = new Chat($("#chat-presupuesto"))
|
||||
chat.init()
|
||||
chat.initPresupuesto()
|
||||
if($("#internal_messages_chat").length > 0){
|
||||
let internalMessages = new InternalMessages($("#internal_messages_chat"))
|
||||
internalMessages.init()
|
||||
}
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user