2026-05-22 20:21:54 +02:00
|
|
|
|
Vue.config.devtools = true;
|
|
|
|
|
|
|
|
|
|
|
|
Vue.component('v-select', VueSelect.VueSelect);
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
// JW-style toast (стили — crm.css). Дубликат из requisitions_vue.js с idempotent-гардом.
|
|
|
|
|
|
if (typeof window.jwShowCopyToast !== 'function') {
|
|
|
|
|
|
window.jwShowCopyToast = function (text) {
|
|
|
|
|
|
var container = document.getElementById('jw-toast-container');
|
|
|
|
|
|
if (!container) {
|
|
|
|
|
|
container = document.createElement('div');
|
|
|
|
|
|
container.id = 'jw-toast-container';
|
|
|
|
|
|
container.className = 'jw-toast-container';
|
|
|
|
|
|
document.body.appendChild(container);
|
|
|
|
|
|
}
|
|
|
|
|
|
var toast = document.createElement('div');
|
|
|
|
|
|
toast.className = 'jw-toast';
|
|
|
|
|
|
toast.textContent = String(text || '');
|
|
|
|
|
|
container.appendChild(toast);
|
|
|
|
|
|
void toast.offsetWidth; // reflow для transition
|
|
|
|
|
|
toast.classList.add('jw-toast-show');
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
toast.classList.remove('jw-toast-show');
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
if (toast.parentNode) toast.parentNode.removeChild(toast);
|
|
|
|
|
|
}, 250);
|
|
|
|
|
|
}, 3500);
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 20:21:54 +02:00
|
|
|
|
var requisitions_client = new Vue({
|
|
|
|
|
|
el: '#requisitions_list_client',
|
|
|
|
|
|
name: 'requisitions_list_client',
|
|
|
|
|
|
components: {
|
|
|
|
|
|
Multiselect: window.VueMultiselect.default,
|
|
|
|
|
|
vuejsDatepicker: window.vuejsDatepicker
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
req: [],
|
|
|
|
|
|
isAddObj: 0,
|
|
|
|
|
|
isPreloader: 0,
|
|
|
|
|
|
user_id: $("#sid").attr("data-id"),
|
|
|
|
|
|
funnel_id: $('#funnelIdClients').val(),
|
|
|
|
|
|
clientId: 0,
|
|
|
|
|
|
isReqClient: 0,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
//Список
|
|
|
|
|
|
getList() {
|
|
|
|
|
|
if (this.clientId > 0) {
|
|
|
|
|
|
this.req = [];
|
|
|
|
|
|
this.isAddObj = 0;
|
|
|
|
|
|
$('#addReqClientFormList').attr("data-client", this.clientId);
|
|
|
|
|
|
this.isReqClient = 0;
|
|
|
|
|
|
if (document.location.pathname == '/add-object.php' || document.location.pathname == '/my-objects.php' || document.location.pathname == '/agency-objects.php') {
|
|
|
|
|
|
this.isAddObj = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
//requisitions_client.isPreloader=true;
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_all',
|
|
|
|
|
|
client_id: this.clientId,
|
|
|
|
|
|
funnel_id: this.funnel_id,
|
|
|
|
|
|
//user_id: this.user_id,
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.req = response.data.req;
|
|
|
|
|
|
//requisitions_client.isPreloader=false;
|
|
|
|
|
|
if (!requisitions_client.isEmpty(requisitions_client.req)) {
|
|
|
|
|
|
this.isReqClient = 1;
|
|
|
|
|
|
//$("#requisitions_list_client .clients").show();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isReqClient = 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение бара воронки
|
|
|
|
|
|
getBarFunnel(reqId) {
|
|
|
|
|
|
if (this.req['req' + reqId]) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_bar_funnel',
|
|
|
|
|
|
funnel_id: this.req['req' + reqId].funnel_id,
|
|
|
|
|
|
req_id: reqId
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.req['req' + reqId].steps = response.data;
|
|
|
|
|
|
requisitions_client.isPreloader = 0;
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Для редактирования
|
|
|
|
|
|
getReq(id) {
|
|
|
|
|
|
$('#send_bg_new .closer').click();
|
|
|
|
|
|
req_form.openReqForm();
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id] === undefined) {
|
|
|
|
|
|
//console.log(this.req[id]);
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_req_id',
|
|
|
|
|
|
req_id: id
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
//console.log(response.data);
|
|
|
|
|
|
requisitions_client.$set(requisitions_client, 'req', response.data);
|
|
|
|
|
|
|
|
|
|
|
|
//console.log(requisitions_client.req[id].object_id);
|
|
|
|
|
|
if (requisitions_client.req[id].object_id > 0 && requisitions_client.isEmpty(requisitions_client.req[id].object)) {
|
|
|
|
|
|
|
|
|
|
|
|
requisitions_client.getObject(requisitions_client.req[id].object_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_client.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].client_id > 0 && this.isEmpty(this.req[id].client)) {
|
|
|
|
|
|
this.getClient(this.req[id].client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_client.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].object_id > 0 && this.isEmpty(this.req[id].object)) {
|
|
|
|
|
|
this.getObject(this.req[id].object_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_client.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].client_id > 0 && this.isEmpty(this.req[id].client)) {
|
|
|
|
|
|
this.getClient(this.req[id].client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_client.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение объекта
|
|
|
|
|
|
getObject(object_id, reqId, forma) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_object',
|
|
|
|
|
|
object_id: object_id
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
|
this.req[reqId].object = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(requisitions_client.req[reqId]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение клиента
|
|
|
|
|
|
getClient(client_id, reqId, forma) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_client',
|
|
|
|
|
|
client_id: client_id
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
|
this.req[reqId].client = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(requisitions_client.req[reqId]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//открыть/закрыть подробности
|
|
|
|
|
|
toggleClient(id) {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].isMainInfo) {
|
|
|
|
|
|
this.req[id].isMainInfo = false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].object_id > 0 && this.isEmpty(this.req[id].object)) {
|
|
|
|
|
|
this.getObject(this.req[id].object_id, id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].client_id > 0 && this.isEmpty(this.req[id].client)) {
|
|
|
|
|
|
this.getClient(this.req[id].client_id, id);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.req[id].isMainInfo = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать объект
|
|
|
|
|
|
showObject(id) {
|
|
|
|
|
|
$('#liObject').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать клиента
|
|
|
|
|
|
showClient() {
|
|
|
|
|
|
$('#liGlobal').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
openCardClient(client_id, ignoreFunnelsUpdate = false) {
|
|
|
|
|
|
openClientEventsWindowNew(client_id, $('#session_to_send').val(), 0, undefined, undefined, ignoreFunnelsUpdate);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Проверка на пустоту
|
|
|
|
|
|
isEmpty(data) {
|
|
|
|
|
|
if (typeof(data) === 'object') {
|
|
|
|
|
|
if (JSON.stringify(data) === '{}' || JSON.stringify(data) === '[]') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else if (!data) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'string') {
|
|
|
|
|
|
if (!data.trim()) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'undefined') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Открыть редактирование параметров автопоиска
|
|
|
|
|
|
openAutoSearchFiltr(req_id, filter_id) {
|
|
|
|
|
|
autosearch_filtr.openAutoSearchFiltr(req_id, filter_id);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Открыть список объектов автопоиска
|
|
|
|
|
|
showAutoSearchObjects(filter_id, event) {
|
|
|
|
|
|
let req_id = $(event.target).data('id');
|
|
|
|
|
|
$('#send_bg_new').fadeOut(300);
|
|
|
|
|
|
$('#send_new').toggle(100);
|
|
|
|
|
|
$("body").removeClass("lock");
|
|
|
|
|
|
|
|
|
|
|
|
autosearch_objs.openAutoSearchResults(filter_id, req_id);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
//this.getList();
|
|
|
|
|
|
},
|
|
|
|
|
|
created: function() {
|
|
|
|
|
|
|
|
|
|
|
|
$(".clients").removeClass("hidden");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
var requisitions_object = new Vue({
|
|
|
|
|
|
el: '#requisitions_list_object',
|
|
|
|
|
|
components: {
|
|
|
|
|
|
Multiselect: window.VueMultiselect.default,
|
|
|
|
|
|
vuejsDatepicker: window.vuejsDatepicker
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
req: [],
|
|
|
|
|
|
//isPreloader: true,
|
|
|
|
|
|
agency_id: $('#session_agency_id').val(),
|
|
|
|
|
|
user_id: $("#sid").attr("data-id"),
|
|
|
|
|
|
//funnel_id: $('#funnelIdClients').val(),
|
|
|
|
|
|
objectId: 0,
|
|
|
|
|
|
isReqClient: 0,
|
|
|
|
|
|
isShow: false,
|
|
|
|
|
|
page: 1,
|
|
|
|
|
|
all_pages: 1,
|
|
|
|
|
|
prevPage: 0,
|
|
|
|
|
|
ot: 0,
|
|
|
|
|
|
do: 0,
|
|
|
|
|
|
pagePagin: [],
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
//Список
|
|
|
|
|
|
getList() {
|
|
|
|
|
|
this.req = [];
|
|
|
|
|
|
requisitions_object.isReqClient = 0;
|
|
|
|
|
|
this.pagePagin = [];
|
|
|
|
|
|
this.ot = 0;
|
|
|
|
|
|
this.do = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var requestData = {
|
|
|
|
|
|
request: 'get_all',
|
|
|
|
|
|
object_id: this.objectId,
|
|
|
|
|
|
page: this.page,
|
|
|
|
|
|
per_page: 5,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (this.periodStart && this.periodEnd) {
|
|
|
|
|
|
requestData.filtr = {
|
|
|
|
|
|
period: 'period',
|
|
|
|
|
|
onDate: this.periodStart,
|
|
|
|
|
|
offDate: this.periodEnd
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//console.log(this.objectId);
|
|
|
|
|
|
//requisitions_client.isPreloader=true;
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', requestData)
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
// console.log(response.data);
|
|
|
|
|
|
this.req = response.data.req;
|
|
|
|
|
|
//requisitions_client.isPreloader=false;
|
|
|
|
|
|
if (!requisitions_object.isEmpty(requisitions_object.req)) {
|
|
|
|
|
|
requisitions_object.isReqClient = 1;
|
|
|
|
|
|
this.all_pages = parseInt(response.data.allPages);
|
|
|
|
|
|
if (this.all_pages > 1) {
|
|
|
|
|
|
if (this.page > 1)
|
|
|
|
|
|
this.prevPage = this.page - 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.all_pages > 8) {
|
|
|
|
|
|
if (this.page > 4) {
|
|
|
|
|
|
this.ot = this.page - 3;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.ot = 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.page < this.all_pages - 4) {
|
|
|
|
|
|
this.do = this.page + 3;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.do = this.all_pages;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.ot = 2;
|
|
|
|
|
|
this.do = this.all_pages;
|
|
|
|
|
|
}
|
|
|
|
|
|
for (var i = this.ot; i < this.do; i++) {
|
|
|
|
|
|
this.pagePagin.push(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
//$("#requisitions_list_client .clients").show();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
requisitions_object.isReqClient = 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Пагинация
|
|
|
|
|
|
pagin(page) {
|
|
|
|
|
|
this.page = page;
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Пагинация
|
|
|
|
|
|
goToRequisitionsPage(event) {
|
|
|
|
|
|
if (event.keyCode === 13) {
|
|
|
|
|
|
var pageNum = $('#requisitionClientPageNumberInputForManualGoToPage').val();
|
|
|
|
|
|
|
|
|
|
|
|
if (pageNum) {
|
|
|
|
|
|
this.page = Number.parseInt(pageNum);
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
$('#requisitionClientPageNumberInputForManualGoToPage').val('');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение бара воронки
|
|
|
|
|
|
getBarFunnel(reqId) {
|
|
|
|
|
|
if (this.req['req' + reqId]) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_bar_funnel',
|
|
|
|
|
|
funnel_id: this.req['req' + reqId].funnel_id,
|
|
|
|
|
|
req_id: reqId
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.req['req' + reqId].steps = response.data;
|
|
|
|
|
|
requisitions_client.isPreloader = 0;
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Для редактирования
|
|
|
|
|
|
getReq(id) {
|
|
|
|
|
|
$('#send_bg_new .closer').click();
|
|
|
|
|
|
req_form.openReqForm();
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id] === undefined) {
|
|
|
|
|
|
//console.log(this.req[id]);
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_req_id',
|
|
|
|
|
|
req_id: id
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
//console.log(response.data);
|
|
|
|
|
|
requisitions_object.$set(requisitions_object, 'req', response.data);
|
|
|
|
|
|
|
|
|
|
|
|
//console.log(requisitions_client.req[id].object_id);
|
|
|
|
|
|
if (requisitions_object.req[id].object_id > 0 && requisitions_object.isEmpty(requisitions_object.req[id].object)) {
|
|
|
|
|
|
|
|
|
|
|
|
requisitions_object.getObject(requisitions_object.req[id].object_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_object.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].client_id > 0 && this.isEmpty(this.req[id].client)) {
|
|
|
|
|
|
this.getClient(this.req[id].client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_object.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].object_id > 0 && this.isEmpty(this.req[id].object)) {
|
|
|
|
|
|
this.getObject(this.req[id].object_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_object.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].client_id > 0 && this.isEmpty(this.req[id].client)) {
|
|
|
|
|
|
this.getClient(this.req[id].client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(requisitions_object.req[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение объекта
|
|
|
|
|
|
getObject(object_id, reqId, forma) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_object',
|
|
|
|
|
|
object_id: object_id
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
|
this.req[reqId].object = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(requisitions_object.req[reqId]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение клиента
|
|
|
|
|
|
getClient(client_id, reqId, forma) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
request: 'get_client',
|
|
|
|
|
|
client_id: client_id
|
|
|
|
|
|
}, )
|
2026-05-22 20:21:54 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
|
this.req[reqId].client = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(requisitions_object.req[reqId]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//открыть/закрыть подробности
|
|
|
|
|
|
toggleClient(id) {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].isMainInfo) {
|
|
|
|
|
|
this.req[id].isMainInfo = false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].object_id > 0 && this.isEmpty(this.req[id].object)) {
|
|
|
|
|
|
this.getObject(this.req[id].object_id, id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.req[id].client_id > 0 && this.isEmpty(this.req[id].client)) {
|
|
|
|
|
|
this.getClient(this.req[id].client_id, id);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.req[id].isMainInfo = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать объект
|
|
|
|
|
|
showObject(id) {
|
|
|
|
|
|
$('#liObject').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать клиента
|
|
|
|
|
|
showClient() {
|
|
|
|
|
|
$('#liGlobal').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Открыть форму
|
|
|
|
|
|
openForm(objectId, periodStart, periodEnd) {
|
|
|
|
|
|
console.log('openForm', objectId, periodStart, periodEnd);
|
|
|
|
|
|
this.page = 1;
|
|
|
|
|
|
this.isShow = true;
|
|
|
|
|
|
this.objectId = objectId;
|
|
|
|
|
|
this.periodStart = periodStart;
|
|
|
|
|
|
this.periodEnd = periodEnd;
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
$("body").addClass("lock");
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//закрыть форму
|
|
|
|
|
|
closeForm() {
|
|
|
|
|
|
this.isShow = false;
|
|
|
|
|
|
$("body").removeClass("lock");
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
openCardClient(client_id, ignoreFunnelsUpdate = false) {
|
|
|
|
|
|
openClientEventsWindowNew(client_id, $('#session_to_send').val(), 0, undefined, undefined, ignoreFunnelsUpdate);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Проверка на пустоту
|
|
|
|
|
|
isEmpty(data) {
|
|
|
|
|
|
if (typeof(data) === 'object') {
|
|
|
|
|
|
if (JSON.stringify(data) === '{}' || JSON.stringify(data) === '[]') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else if (!data) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'string') {
|
|
|
|
|
|
if (!data.trim()) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'undefined') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
//this.getList();
|
|
|
|
|
|
},
|
|
|
|
|
|
created: function() {
|
|
|
|
|
|
|
|
|
|
|
|
$("#requisitions_list_object").removeClass("hidden");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var room_requisitions = new Vue({
|
|
|
|
|
|
name: 'room_requisitions',
|
|
|
|
|
|
el: '#room_requisitions',
|
|
|
|
|
|
components:
|
2026-07-06 20:13:55 +02:00
|
|
|
|
{
|
|
|
|
|
|
Multiselect: window.VueMultiselect.default,
|
|
|
|
|
|
vuejsDatepicker: window.vuejsDatepicker
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
data()
|
|
|
|
|
|
{
|
|
|
|
|
|
return {
|
|
|
|
|
|
requisitions: [],
|
|
|
|
|
|
agency_id: $('#session_agency_id').val(),
|
|
|
|
|
|
user_id: $("#sid").attr("data-id"),
|
|
|
|
|
|
complexRoomId: 0,
|
|
|
|
|
|
apartmentTitle: null,
|
|
|
|
|
|
inProgress: false,
|
|
|
|
|
|
isShow: false,
|
|
|
|
|
|
page: 1,
|
|
|
|
|
|
all_pages: 1,
|
|
|
|
|
|
prevPage: 0,
|
|
|
|
|
|
ot: 0,
|
|
|
|
|
|
do: 0,
|
|
|
|
|
|
pagePagin: [],
|
2026-07-06 20:13:55 +02:00
|
|
|
|
complexBus: null,
|
|
|
|
|
|
// Состояние модалки копирования заявки. employees — серверный пререндер window.__copyEmployeesList; фильтр в Vue (без Select2).
|
|
|
|
|
|
copyModal: {
|
|
|
|
|
|
open: false,
|
|
|
|
|
|
srcId: null,
|
|
|
|
|
|
funnels: [],
|
|
|
|
|
|
funnelId: null,
|
|
|
|
|
|
employees: [],
|
|
|
|
|
|
whoWorkId: null,
|
|
|
|
|
|
whoWorkSearch: '',
|
|
|
|
|
|
whoWorkOpen: false,
|
|
|
|
|
|
whoWorkLabel: '',
|
|
|
|
|
|
defaultWhoWorkId: null,
|
|
|
|
|
|
warnings: [],
|
|
|
|
|
|
submitting: false,
|
|
|
|
|
|
error: null,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
// Фильтр сотрудников по whoWorkSearch (case-insensitive).
|
|
|
|
|
|
copyFilteredEmployees: function() {
|
|
|
|
|
|
var q = (this.copyModal.whoWorkSearch || '').toLowerCase().trim();
|
|
|
|
|
|
var emps = this.copyModal.employees || [];
|
|
|
|
|
|
if (!q) return emps;
|
|
|
|
|
|
return emps.filter(function(e) {
|
|
|
|
|
|
return (e.name || '').toLowerCase().indexOf(q) !== -1;
|
|
|
|
|
|
});
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods:
|
|
|
|
|
|
{
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Список
|
|
|
|
|
|
getList()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.requisitions = [];
|
|
|
|
|
|
this.inProgress = true;
|
|
|
|
|
|
this.pagePagin = [];
|
|
|
|
|
|
this.ot = 0;
|
|
|
|
|
|
this.do = 0;
|
|
|
|
|
|
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_all',
|
|
|
|
|
|
complex_room_id: this.complexRoomId,
|
|
|
|
|
|
page: this.page,
|
|
|
|
|
|
per_page: 5,
|
|
|
|
|
|
})
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.requisitions = response.data.req;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (!this.isEmpty(this.requisitions)) {
|
|
|
|
|
|
this.all_pages = parseInt(response.data.allPages);
|
|
|
|
|
|
if (this.all_pages > 1) {
|
|
|
|
|
|
if (this.page > 1)
|
|
|
|
|
|
this.prevPage = this.page - 1;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.all_pages > 8) {
|
|
|
|
|
|
if (this.page > 4) {
|
|
|
|
|
|
this.ot = this.page - 3;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.ot = 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.page < this.all_pages - 4) {
|
|
|
|
|
|
this.do = this.page + 3;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.do = this.all_pages;
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
} else {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
this.ot = 2;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
this.do = this.all_pages;
|
|
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
for (var i = this.ot; i < this.do; i++) {
|
|
|
|
|
|
this.pagePagin.push(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
//$("#requisitions_list_client .clients").show();
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(() => this.inProgress = false);
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Пагинация
|
|
|
|
|
|
pagin(page)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.page = page;
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Пагинация
|
|
|
|
|
|
goToRequisitionsPage(event)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (event.keyCode === 13) {
|
|
|
|
|
|
var pageNum = $('#requisitionClientPageNumberInputForManualGoToPage').val();
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (pageNum) {
|
|
|
|
|
|
this.page = Number.parseInt(pageNum);
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
$('#requisitionClientPageNumberInputForManualGoToPage').val('');
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Получение бара воронки
|
|
|
|
|
|
getBarFunnel(reqId)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.requisitions['req' + reqId]) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_bar_funnel',
|
|
|
|
|
|
funnel_id: this.requisitions['req' + reqId].funnel_id,
|
|
|
|
|
|
req_id: reqId
|
|
|
|
|
|
}, )
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.requisitions['req' + reqId].steps = response.data;
|
|
|
|
|
|
requisitions_client.isPreloader = 0;
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Для редактирования
|
|
|
|
|
|
getReq(id)
|
|
|
|
|
|
{
|
|
|
|
|
|
$('#send_bg_new .closer').click();
|
|
|
|
|
|
req_form.openReqForm();
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id] === undefined) {
|
|
|
|
|
|
//console.log(this.req[id]);
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_req_id',
|
|
|
|
|
|
req_id: id
|
|
|
|
|
|
}, )
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.$set(this, 'requisitions', response.data);
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id].complex_room_id > 0 && this.isEmpty(this.requisitions[id].object)) {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
this.getRoom(this.requisitions[id].complex_room_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.requisitions[id]);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id].client_id > 0 && this.isEmpty(this.requisitions[id].client)) {
|
|
|
|
|
|
this.getClient(this.requisitions[id].client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.requisitions[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
2026-05-22 20:21:54 +02:00
|
|
|
|
} else {
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id].complex_room_id > 0 && this.isEmpty(this.requisitions[id].object)) {
|
|
|
|
|
|
this.getRoom(this.requisitions[id].complex_room_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.requisitions[id]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.requisitions[id].client_id > 0 && this.isEmpty(this.requisitions[id].client)) {
|
|
|
|
|
|
this.getClient(this.requisitions[id].client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.requisitions[id]);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Получение объекта
|
|
|
|
|
|
getRoom(complex_room_id, reqId, forma)
|
|
|
|
|
|
{
|
|
|
|
|
|
axios.post('/ajax/vue_ajax/complex_axios.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_room_requisitions',
|
|
|
|
|
|
complex_room_id
|
|
|
|
|
|
}, )
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.requisitions[reqId].object = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(this.requisitions[reqId]);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Получение клиента
|
|
|
|
|
|
getClient(client_id, reqId, forma)
|
|
|
|
|
|
{
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_client',
|
|
|
|
|
|
client_id: client_id
|
|
|
|
|
|
}, )
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.requisitions[reqId].client = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(this.requisitions[reqId]);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//открыть/закрыть подробности
|
|
|
|
|
|
toggleClient(id)
|
|
|
|
|
|
{
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id].isMainInfo) {
|
|
|
|
|
|
this.requisitions[id].isMainInfo = false;
|
|
|
|
|
|
} else {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id].complex_room_id > 0 && this.isEmpty(this.requisitions[id].object)) {
|
|
|
|
|
|
this.getRoom(this.requisitions[id].complex_room_id, id);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.requisitions[id].client_id > 0 && this.isEmpty(this.requisitions[id].client)) {
|
|
|
|
|
|
this.getClient(this.requisitions[id].client_id, id);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.requisitions[id].isMainInfo = true;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать объект
|
|
|
|
|
|
showObject()
|
|
|
|
|
|
{
|
|
|
|
|
|
$('#liObject').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать клиента
|
|
|
|
|
|
showClient()
|
|
|
|
|
|
{
|
|
|
|
|
|
$('#liGlobal').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Открыть форму
|
|
|
|
|
|
openForm(complexRoomId)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.page = 1;
|
|
|
|
|
|
this.isShow = true;
|
|
|
|
|
|
this.complexRoomId = complexRoomId;
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
$("body").addClass("lock");
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//закрыть форму
|
|
|
|
|
|
closeForm()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.isShow = false;
|
|
|
|
|
|
$("body").removeClass("lock");
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
openCardClient(client_id, ignoreFunnelsUpdate = false) {
|
|
|
|
|
|
openClientEventsWindowNew(client_id, $('#session_to_send').val(), 0, undefined, undefined, ignoreFunnelsUpdate);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Проверка на пустоту
|
|
|
|
|
|
isEmpty(data)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (typeof(data) === 'object') {
|
|
|
|
|
|
if (JSON.stringify(data) === '{}' || JSON.stringify(data) === '[]') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else if (!data) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'string') {
|
|
|
|
|
|
if (!data.trim()) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'undefined') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
observeRefs()
|
|
|
|
|
|
{
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
|
if (window.complexBus) {
|
|
|
|
|
|
this.complexBus = window.complexBus
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 200)
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Открыть модалку копирования. Funnels/employees — серверный пререндер из room_requisitions.php / footer.php.
|
|
|
|
|
|
openCopyRequisitionModal: function(reqId) {
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
var preFunnels = Array.isArray(window.__copyFunnelsList) ? window.__copyFunnelsList : [];
|
|
|
|
|
|
var preEmployees = Array.isArray(window.__copyEmployeesList) ? window.__copyEmployeesList : [];
|
|
|
|
|
|
var employeesNormalized = preEmployees.map(function (e) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
id: parseInt(e.id, 10),
|
|
|
|
|
|
name: e.name,
|
|
|
|
|
|
group: e.group || null,
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
self.copyModal = {
|
|
|
|
|
|
open: true,
|
|
|
|
|
|
srcId: reqId,
|
|
|
|
|
|
funnels: preFunnels.map(function (f) {
|
|
|
|
|
|
return { id: parseInt(f.id, 10), name: f.name };
|
|
|
|
|
|
}),
|
|
|
|
|
|
funnelId: null,
|
|
|
|
|
|
employees: employeesNormalized,
|
|
|
|
|
|
whoWorkId: null,
|
|
|
|
|
|
whoWorkSearch: '',
|
|
|
|
|
|
whoWorkOpen: false,
|
|
|
|
|
|
whoWorkLabel: '',
|
|
|
|
|
|
defaultWhoWorkId: null,
|
|
|
|
|
|
warnings: [],
|
|
|
|
|
|
submitting: false,
|
|
|
|
|
|
error: null,
|
|
|
|
|
|
};
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {request: 'copy_preview', req_id: reqId})
|
|
|
|
|
|
.then(function (res) {
|
|
|
|
|
|
if (!res.data.success) {
|
|
|
|
|
|
self.copyModal.error = res.data.error || 'Не удалось загрузить данные';
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
self.copyModal.warnings = res.data.warnings || [];
|
|
|
|
|
|
// Дефолтная воронка — из исходника, иначе первая доступная.
|
|
|
|
|
|
var defaultFunnelId = res.data.default_funnel_id;
|
|
|
|
|
|
var funnelMatch = self.copyModal.funnels.find(function (f) {
|
|
|
|
|
|
return parseInt(f.id, 10) === parseInt(defaultFunnelId, 10);
|
|
|
|
|
|
});
|
|
|
|
|
|
if (funnelMatch) {
|
|
|
|
|
|
self.copyModal.funnelId = parseInt(defaultFunnelId, 10);
|
|
|
|
|
|
} else if (self.copyModal.funnels.length > 0) {
|
|
|
|
|
|
self.copyModal.funnelId = self.copyModal.funnels[0].id;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
self.copyModal.funnelId = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
self.copyModal.defaultWhoWorkId = res.data.default_who_work_id;
|
|
|
|
|
|
var defaultId = res.data.default_who_work_id;
|
|
|
|
|
|
var hasInList = employeesNormalized.some(function (e) { return e.id === parseInt(defaultId, 10); });
|
|
|
|
|
|
var chosenId = hasInList
|
|
|
|
|
|
? parseInt(defaultId, 10)
|
|
|
|
|
|
: (employeesNormalized.length > 0 ? employeesNormalized[0].id : null);
|
|
|
|
|
|
self.copyModal.whoWorkId = chosenId;
|
|
|
|
|
|
// whoWorkLabel — имя в свернутом поле; whoWorkSearch держим пустым (полный список при открытии).
|
|
|
|
|
|
var chosenEmp = employeesNormalized.find(function (e) { return e.id === chosenId; });
|
|
|
|
|
|
self.copyModal.whoWorkLabel = chosenEmp ? chosenEmp.name : '';
|
|
|
|
|
|
self.copyModal.whoWorkSearch = '';
|
|
|
|
|
|
self.copyModal.whoWorkOpen = false;
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function () {
|
|
|
|
|
|
self.copyModal.error = 'Сетевая ошибка';
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Выбор сотрудника. Сбрасываем whoWorkSearch, чтобы следующий раз показать полный список.
|
|
|
|
|
|
selectCopyWhoWork: function(emp) {
|
|
|
|
|
|
this.copyModal.whoWorkId = emp.id;
|
|
|
|
|
|
this.copyModal.whoWorkLabel = emp.name;
|
|
|
|
|
|
this.copyModal.whoWorkSearch = '';
|
|
|
|
|
|
this.copyModal.whoWorkOpen = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Отправка копии: создаёт заявку и обновляет список комнаты.
|
|
|
|
|
|
submitCopy: function() {
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
if (self.copyModal.submitting) return;
|
|
|
|
|
|
|
|
|
|
|
|
var whoWorkId = parseInt(self.copyModal.whoWorkId, 10);
|
|
|
|
|
|
|
|
|
|
|
|
if (isNaN(whoWorkId) || self.copyModal.funnelId === null || self.copyModal.funnelId === undefined) {
|
|
|
|
|
|
self.copyModal.error = 'Заполните воронку и ответственного';
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
self.copyModal.submitting = true;
|
|
|
|
|
|
self.copyModal.error = null;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
|
|
|
|
|
request: 'copy',
|
|
|
|
|
|
req_id: self.copyModal.srcId,
|
|
|
|
|
|
funnel_id: self.copyModal.funnelId,
|
|
|
|
|
|
who_work_id: whoWorkId,
|
|
|
|
|
|
}).then(function (res) {
|
|
|
|
|
|
self.copyModal.submitting = false;
|
|
|
|
|
|
if (!res.data.success) {
|
|
|
|
|
|
self.copyModal.error = res.data.error || 'Не удалось создать копию';
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
self.copyModal.open = false;
|
|
|
|
|
|
if (typeof window.jwShowCopyToast === 'function') {
|
|
|
|
|
|
window.jwShowCopyToast('Копия заявки создана');
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof self.getList === 'function') self.getList();
|
|
|
|
|
|
}).catch(function () {
|
|
|
|
|
|
self.copyModal.submitting = false;
|
|
|
|
|
|
self.copyModal.error = 'Сетевая ошибка';
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Закрыть модалку копирования.
|
|
|
|
|
|
closeCopyModal: function() {
|
|
|
|
|
|
this.copyModal.open = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Закрытие picker сотрудников по клику вне него (mousedown, чтобы опередить click внутри).
|
|
|
|
|
|
onCopyModalDocumentClick: function(e) {
|
|
|
|
|
|
if (!this.copyModal.whoWorkOpen) return;
|
|
|
|
|
|
var picker = this.$refs && this.$refs.copyWhoWorkPicker;
|
|
|
|
|
|
if (picker && (picker === e.target || picker.contains(e.target))) return;
|
|
|
|
|
|
this.copyModal.whoWorkOpen = false;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted()
|
2026-07-06 20:13:55 +02:00
|
|
|
|
{
|
2026-05-22 20:21:54 +02:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.observeRefs();
|
|
|
|
|
|
});
|
2026-07-06 20:13:55 +02:00
|
|
|
|
document.addEventListener('mousedown', this.onCopyModalDocumentClick);
|
2026-05-22 20:21:54 +02:00
|
|
|
|
},
|
2026-07-06 20:13:55 +02:00
|
|
|
|
beforeDestroy: function()
|
2026-05-22 20:21:54 +02:00
|
|
|
|
{
|
2026-07-06 20:13:55 +02:00
|
|
|
|
document.removeEventListener('mousedown', this.onCopyModalDocumentClick);
|
2026-05-22 20:21:54 +02:00
|
|
|
|
},
|
2026-07-06 20:13:55 +02:00
|
|
|
|
watch:
|
|
|
|
|
|
{
|
|
|
|
|
|
complexBus(complexBus)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (complexBus) {
|
|
|
|
|
|
complexBus.$on('apartment-open-requisitions', (apartment) => {
|
|
|
|
|
|
if (apartment)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.complexRoomId = apartment.id
|
|
|
|
|
|
this.apartmentTitle = apartment.title
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
this.isShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// Watch 'copyModal.funnelId' удалён: список сотрудников не зависит от воронки, заполняется один раз из window.__copyEmployeesList.
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
created: function()
|
|
|
|
|
|
{
|
|
|
|
|
|
$("#room_requisitions").removeClass("hidden");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var room_reservation = new Vue({
|
|
|
|
|
|
name: 'room_reservation',
|
|
|
|
|
|
el: '#room_reservation',
|
|
|
|
|
|
components:
|
2026-07-06 20:13:55 +02:00
|
|
|
|
{
|
|
|
|
|
|
Multiselect: window.VueMultiselect.default,
|
|
|
|
|
|
vuejsDatepicker: window.vuejsDatepicker
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
data()
|
|
|
|
|
|
{
|
|
|
|
|
|
return {
|
|
|
|
|
|
reservation: [],
|
|
|
|
|
|
agency_id: $('#session_agency_id').val(),
|
|
|
|
|
|
user_id: $("#sid").attr("data-id"),
|
|
|
|
|
|
reservationId: 0,
|
|
|
|
|
|
apartmentTitle: null,
|
|
|
|
|
|
inProgress: false,
|
|
|
|
|
|
isShow: false,
|
|
|
|
|
|
complexBus: null
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods:
|
|
|
|
|
|
{
|
2026-07-06 20:13:55 +02:00
|
|
|
|
getReservation()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.reservation = [];
|
|
|
|
|
|
this.inProgress = true;
|
|
|
|
|
|
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_req_id',
|
|
|
|
|
|
req_id: this.reservationId
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((response) => {
|
2026-07-06 20:13:55 +02:00
|
|
|
|
this.reservation = response.data[`req${this.reservationId}`];
|
2026-05-22 20:21:54 +02:00
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.error(error);
|
2026-07-06 20:13:55 +02:00
|
|
|
|
})
|
|
|
|
|
|
.finally(() => this.inProgress = false);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Получение бара воронки
|
|
|
|
|
|
getBarFunnel(reqId)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.reservationId == reqId) {
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
|
|
|
|
|
request: 'get_bar_funnel',
|
|
|
|
|
|
funnel_id: this.reservation.funnel_id,
|
|
|
|
|
|
req_id: reqId
|
|
|
|
|
|
}, )
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.reservation.steps = response.data;
|
|
|
|
|
|
requisitions_client.isPreloader = 0;
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Для редактирования
|
|
|
|
|
|
getReq(id)
|
|
|
|
|
|
{
|
|
|
|
|
|
$('#send_bg_new .closer').click();
|
|
|
|
|
|
req_form.openReqForm();
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservationId === undefined) {
|
|
|
|
|
|
//console.log(this.req[id]);
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_req_id',
|
|
|
|
|
|
req_id: id
|
|
|
|
|
|
}, )
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.$set(this, 'reservation', response.data);
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservation.complex_room_id > 0 && this.isEmpty(this.reservation.object)) {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
this.getRoom(this.reservation.complex_room_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.reservation);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservation.client_id > 0 && this.isEmpty(this.reservation.client)) {
|
|
|
|
|
|
this.getClient(this.reservation.client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.reservation);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
});
|
2026-05-22 20:21:54 +02:00
|
|
|
|
} else {
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservation.complex_room_id > 0 && this.isEmpty(this.reservation.object)) {
|
|
|
|
|
|
this.getRoom(this.reservation.complex_room_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.reservation);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.reservation.client_id > 0 && this.isEmpty(this.reservation.client)) {
|
|
|
|
|
|
this.getClient(this.reservation.client_id, id, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
req_form.setReq(this.reservation);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Получение объекта
|
|
|
|
|
|
getRoom(complex_room_id, reqId, forma)
|
|
|
|
|
|
{
|
|
|
|
|
|
axios.post('/ajax/vue_ajax/complex_axios.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_room_requisitions',
|
|
|
|
|
|
complex_room_id
|
|
|
|
|
|
})
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.reservation.object = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(this.reservation);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//Получение клиента
|
|
|
|
|
|
getClient(client_id, reqId, forma)
|
|
|
|
|
|
{
|
|
|
|
|
|
axios.post('/ajax/ajax_vue_requisitions.php', {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
request: 'get_client',
|
|
|
|
|
|
client_id: client_id
|
|
|
|
|
|
}, )
|
2026-07-06 20:13:55 +02:00
|
|
|
|
.then((response) => {
|
|
|
|
|
|
this.reservation.client = response.data;
|
|
|
|
|
|
if (forma) {
|
|
|
|
|
|
req_form.setReq(this.reservation);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
//открыть/закрыть подробности
|
|
|
|
|
|
toggleClient(id)
|
|
|
|
|
|
{
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservation.isMainInfo) {
|
|
|
|
|
|
this.reservation.isMainInfo = false;
|
|
|
|
|
|
} else {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservation.complex_room_id > 0 && this.isEmpty(this.reservation.object)) {
|
|
|
|
|
|
this.getRoom(this.reservation.complex_room_id, id);
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
|
2026-07-06 20:13:55 +02:00
|
|
|
|
if (this.reservation.client_id > 0 && this.isEmpty(this.reservation.client)) {
|
|
|
|
|
|
this.getClient(this.reservation.client_id, id);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.reservation.isMainInfo = true;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать объект
|
|
|
|
|
|
showObject()
|
|
|
|
|
|
{
|
|
|
|
|
|
$('#liObject').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//показать клиента
|
|
|
|
|
|
showClient()
|
|
|
|
|
|
{
|
|
|
|
|
|
$('#liGlobal').click();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Открыть форму
|
|
|
|
|
|
openForm(reservationId)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.page = 1;
|
|
|
|
|
|
this.isShow = true;
|
|
|
|
|
|
this.reservationId = reservationId;
|
|
|
|
|
|
this.getList();
|
|
|
|
|
|
$("body").addClass("lock");
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//закрыть форму
|
|
|
|
|
|
closeForm()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.isShow = false;
|
|
|
|
|
|
$("body").removeClass("lock");
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
openCardClient(client_id, ignoreFunnelsUpdate = false) {
|
|
|
|
|
|
openClientEventsWindowNew(client_id, $('#session_to_send').val(), 0, undefined, undefined, ignoreFunnelsUpdate);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Проверка на пустоту
|
|
|
|
|
|
isEmpty(data)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (typeof(data) === 'object') {
|
|
|
|
|
|
if (JSON.stringify(data) === '{}' || JSON.stringify(data) === '[]') {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else if (!data) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'string') {
|
|
|
|
|
|
if (!data.trim()) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else if (typeof(data) === 'undefined') {
|
2026-05-22 20:21:54 +02:00
|
|
|
|
return true;
|
2026-07-06 20:13:55 +02:00
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
observeRefs()
|
|
|
|
|
|
{
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
|
if (window.complexBus) {
|
|
|
|
|
|
this.complexBus = window.complexBus
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 200)
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted()
|
2026-07-06 20:13:55 +02:00
|
|
|
|
{
|
2026-05-22 20:21:54 +02:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.observeRefs();
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
watch:
|
|
|
|
|
|
{
|
2026-07-06 20:13:55 +02:00
|
|
|
|
complexBus(complexBus)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (complexBus) {
|
|
|
|
|
|
complexBus.$on('apartment-open-reservation', (reservation) => {
|
|
|
|
|
|
if (reservation)
|
|
|
|
|
|
{
|
|
|
|
|
|
openClientEventsWindowNew(0, $('#session_to_send').val(), 0, reservation.id);
|
|
|
|
|
|
// this.reservationId = reservation.id
|
|
|
|
|
|
// this.apartmentTitle = reservation.apartment_title
|
|
|
|
|
|
// this.getReservation();
|
|
|
|
|
|
// this.isShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2026-05-22 20:21:54 +02:00
|
|
|
|
}
|
2026-07-06 20:13:55 +02:00
|
|
|
|
},
|
2026-05-22 20:21:54 +02:00
|
|
|
|
created: function()
|
|
|
|
|
|
{
|
|
|
|
|
|
$("#room_reservation").removeClass("hidden");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|