if ($('#union_clients').length > 0) { var union_clients = new Vue({ el: '#union_clients', components: { vuejsDatepicker: window.vuejsDatepicker, draggable: window.vuedraggable }, data() { return { is_show: false, agency_id: $('#session_agency_id').val(), user_id: $('#session_user_id').val(), prealoaderSearch: false, prealoaderDop: false, clients_search: [], clients_dop: [], client_dop_id: null, fio_search: '', phone_search: '', id_search: null, isError: false, text_error: "", is_show_error: false, client_main: null, prealoaderMain: false, is_union_req: false, is_union: false, } }, methods: { //Открытие open() { $('.ui-tooltip').remove(); //this.clear(); this.is_show = true; this.search_dop(); }, close() { this.is_show = false; if(this.is_union){ var page = window.location.pathname; console.log(page); if (page == '/clients.php') { let sort_order = $('select[name=sort_order]').val(); console.log(sort_order); get_list(page, sort_order); } $('#send_bg_new').fadeOut(500); $("#send_bg_new .edit-modal").toggle(10); $("body").removeClass("lock"); } this.clear(); }, clear() { this.prealoaderSearch = false; this.clients_search = []; this.clients_dop = []; this.client_dop_id = null; this.prealoaderDop = false; this.fio_search = ''; this.phone_search = ''; this.id_search = null; this.isError = false; this.text_error = ""; this.is_show_error = false; this.client_main = null; this.prealoaderMain = false; this.is_union_req = false; this.is_union = false; }, async search_dop(){ console.log(this.client_dop_id); if(!this.isEmpty(this.client_dop_id)){ this.prealoaderDop = true; axios.post('/ajax/vue_ajax/ajax_union_clients.php', { request: 'search_client', id: this.client_dop_id, agency_id: this.agency_id, user_id: this.user_id, }, ) .then((response) => { this.prealoaderDop = false; this.clients_dop = []; console.log(response.data); var res = response.data; if(res.total > 0){ this.clients_dop = res.clients; } }) .catch(function(error) { console.log(error); }); } }, async search(){ if(this.isEmpty(this.id_search) && this.isEmpty(this.fio_search) && this.isEmpty(this.phone_search)){ this.text_error = "Введите хотя бы один параметр поиска"; this.is_show_error = true; } else { this.prealoaderSearch = true; axios.post('/ajax/vue_ajax/ajax_union_clients.php', { request: 'search_client', id: this.id_search, phone: this.phone_search, fio: this.fio_search, agency_id: this.agency_id, user_id: this.user_id, }, ) .then((response) => { this.prealoaderSearch = false; this.clients_search = []; console.log(response.data); var res = response.data; if(res.total > 0){ this.clients_search = res.clients; } }) .catch(function(error) { console.log(error); }); } }, async start_union(){ this.prealoaderDop = true; this.prealoaderMain = true; var main_id = this.client_main.id; var dop_ids = []; var is_union_req = 0; if(this.is_union_req) is_union_req = 1; for(var i = 0; i { console.log(response.data); this.prealoaderDop = false; this.prealoaderMain = false; this.clients_dop = []; this.is_union = true; if(this.isEmpty(this.id_search) && this.isEmpty(this.fio_search) && this.isEmpty(this.phone_search)){ /******/ } else { this.search(); } }) .catch(function(error) { console.log(error); }); }, send_dop(client){ $('.ui-tooltip').remove(); var is_send = true; var index = 0; var index1 = 0 for(var i=0; i