2021-08-25 10:31:01 +02:00
|
|
|
// meta podatki
|
|
|
|
var srv_meta_anketa_id = $("#srv_meta_anketa").val();
|
|
|
|
|
|
|
|
// avtomatsko vsake 30 sekund preverimo, ce se je pojavila kaksna nova stevilka
|
|
|
|
function preveri_nove_stevilke () {
|
|
|
|
$.timer(30000, function (timer) {
|
|
|
|
|
|
|
|
$('#preveri_stevilke').load('ajax.php?t=telefon&a=preveri_stevilke', {anketa: srv_meta_anketa_id});
|
|
|
|
timer.stop();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// dashboard filter na datum
|
|
|
|
function tel_date_filter () {
|
|
|
|
|
|
|
|
// Ce imamo nastavljen datum "od"
|
|
|
|
var dateFrom = $('#tel_dash_dateFrom').val();
|
|
|
|
var dateFromText = '';
|
|
|
|
if(dateFrom != '')
|
|
|
|
dateFromText = '&date_from=' + dateFrom;
|
|
|
|
|
|
|
|
// Ce imamo nastavljen datum "do"
|
|
|
|
var dateTo = $('#tel_dash_dateTo').val();
|
|
|
|
var dateToText = '';
|
|
|
|
if(dateTo != '')
|
|
|
|
dateToText = '&date_to=' + dateTo;
|
|
|
|
|
|
|
|
var srv_site_url = $("#srv_site_url").val();
|
|
|
|
srv_site_url += 'admin/survey/index.php?anketa='+srv_meta_anketa_id+'&a=telephone&m=dashboard'+dateFromText+dateToText;
|
|
|
|
window.location.href = srv_site_url;
|
|
|
|
}
|
2020-08-14 13:36:36 +02:00
|
|
|
|
|
|
|
function showPhnList(pid) {
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=recipients_lists', {anketa:srv_meta_anketa_id, pid:pid });
|
|
|
|
}
|
|
|
|
|
|
|
|
function phn_settings_save() {
|
|
|
|
var form_serialize = $("#phn_settings").serializeArray();
|
|
|
|
form_serialize[form_serialize.length] = {name:'anketa', value:srv_meta_anketa_id}
|
|
|
|
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=settings_save', form_serialize, function(){
|
2022-03-11 00:34:08 +01:00
|
|
|
actionNotePopup('success_save', 'success');
|
2020-08-14 13:36:36 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function phn_set_sort_field(field,type) {
|
|
|
|
$.post('ajax.php?t=telephone&m=setSortField', {anketa:srv_meta_anketa_id,noNavi:'true', field:field,type:type}, function() {
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=view_recipients', {anketa:srv_meta_anketa_id});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//avtomatsko vsake 10 sekund preverimo, ce se je pojavila kaksna nova stevilka
|
|
|
|
function preveriStevilkeTimer () {
|
|
|
|
$.timer(10000, function (timer) {
|
|
|
|
$('#preveri_stevilke').load('ajax.php?t=telephone&m=preveriStevilkeTimer', {anketa:srv_meta_anketa_id, noNavi: false});
|
|
|
|
timer.stop();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function phn_add_recipients() {
|
|
|
|
|
|
|
|
var recipients_list = $("#inv_recipients_list").val();
|
|
|
|
var fields = [];
|
|
|
|
var pid = $("#phn_import_list_profiles ol li.active").attr('pid');
|
|
|
|
|
|
|
|
$('ul').children('li.inv_field_enabled').each(function(idx, elm) {
|
|
|
|
fields.push(elm.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (fields.length > 0) {
|
|
|
|
if (recipients_list.length > 0) {
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=addRecipients', {anketa:srv_meta_anketa_id, pid:pid, recipients_list:recipients_list, fields:fields});
|
|
|
|
// porihtamo še navigacijo - hardcoded
|
|
|
|
$elm = $("ul.secondNavigation li.inv_ff_left_on");
|
|
|
|
$elm.prev().find('a').removeClass('active');
|
|
|
|
$elm.next().find('a').addClass('active');
|
|
|
|
$elm.removeClass('inv_ff_left_on').addClass('inv_ff_right_on').next().next().addClass('inv_ff_left_on');
|
|
|
|
} else {
|
2022-05-20 04:34:13 +02:00
|
|
|
genericAlertPopup('srv_invitation_note1',null,'PopUpNarrow');
|
2020-08-14 13:36:36 +02:00
|
|
|
}
|
|
|
|
} else {
|
2022-05-20 04:34:13 +02:00
|
|
|
genericAlertPopup('srv_invitation_note2',null,'PopUpNarrow');
|
2020-08-14 13:36:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function phnStartSurvey(usr_id){
|
|
|
|
// na trenutrni strani nastavimo marker na A
|
|
|
|
/*$.post('ajax.php?t=telephone&m=startSurvey', {anketa:srv_meta_anketa_id, usr_id:usr_id, noNavi:'true'}, function(data) {
|
|
|
|
data = jQuery.parseJSON(data);
|
|
|
|
if (data.error == "" && data.reloadUrl != "" && data.surveyUrl != "") {
|
|
|
|
window.open(data.surveyUrl, '_blank');
|
|
|
|
window.location = data.reloadUrl;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
alert(data.msg);
|
|
|
|
}
|
|
|
|
});*/
|
|
|
|
|
|
|
|
// Ajax mora bit sync, ker drugace nekateri browserji blokirajo window.open popup
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: 'ajax.php?t=telephone&m=startSurvey',
|
|
|
|
data: {anketa:srv_meta_anketa_id, usr_id:usr_id, noNavi:'true'},
|
|
|
|
success: function(return_data) {
|
|
|
|
return_data = jQuery.parseJSON(return_data);
|
|
|
|
if (return_data.error == "" && return_data.reloadUrl != "" && return_data.surveyUrl != "") {
|
|
|
|
window.open(return_data.surveyUrl, '_blank');
|
|
|
|
window.location = return_data.reloadUrl;
|
|
|
|
return false;
|
|
|
|
} else {
|
2021-11-05 08:06:00 +01:00
|
|
|
genericAlertPopup('alert_parameter_datamsg');
|
2020-08-14 13:36:36 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-04-07 23:26:41 +02:00
|
|
|
function phnNextActionChange(phnNextAction) {
|
2020-08-14 13:36:36 +02:00
|
|
|
var phnNextAction = $("input[name=phnNextAction]:checked").val();
|
|
|
|
$.post('ajax.php?t=telephone&m=setNextAction', {anketa:srv_meta_anketa_id,noNavi:'true',phnNextAction:phnNextAction});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function phnAddMarker(usr_id,marker) {
|
|
|
|
if (marker == 'T') {
|
|
|
|
window.location = ('ajax.php?anketa='+srv_meta_anketa_id+'&t=telephone&m=addmark&usr_id='+usr_id+'&status='+marker+'&datetime='+$("#T_datetime").val());
|
|
|
|
} else if (marker== 'P') {
|
|
|
|
window.location = ('ajax.php?anketa='+srv_meta_anketa_id+'&t=telephone&m=addmark&usr_id='+usr_id+'&status='+marker+'&datetime='+$("#P_datetime").val());
|
|
|
|
} else {
|
|
|
|
window.location = ('ajax.php?anketa='+srv_meta_anketa_id+'&t=telephone&m=addmark&usr_id='+usr_id+'&status='+marker);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function phnSetUserComment(what,usr_id) {
|
|
|
|
var comment = $(what).html();
|
|
|
|
$.post('ajax.php?t=telephone&m=setUserComment', {anketa:srv_meta_anketa_id,noNavi:'true',usr_id:usr_id,comment:comment});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function phnDeleteProfile() {
|
|
|
|
var pid = $("#phn_import_list_profiles ol li.active").attr("pid");
|
|
|
|
if (confirm(lang['srv_inv_recipients_delete_profile_confirm'])) {
|
|
|
|
$.post('ajax.php?t=telephone&m=deleteProfile', {anketa:srv_meta_anketa_id, pid:pid, noNavi:'true'}, function(data) {
|
|
|
|
// osvežimo polja
|
|
|
|
//inv_change_import_type();
|
|
|
|
var new_pid = $("#phn_import_list_profiles ol li").first().attr('pid');
|
|
|
|
// če je slučajno isti kot smo ga zbrisli izberemo nasledenjega
|
|
|
|
if (new_pid == pid) {
|
|
|
|
var new_pid = $("#phn_import_list_profiles ol li").first().next().attr('pid');
|
|
|
|
}
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=recipients_lists', {anketa:srv_meta_anketa_id, pid:new_pid });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function phnEditProfile(inv_rid) {
|
|
|
|
var pid = $("#phn_import_list_profiles ol li.active").attr("pid");
|
|
|
|
|
|
|
|
$('#fade').fadeTo('slow', 1);
|
|
|
|
$('#fullscreen').html('').fadeIn('slow');
|
|
|
|
$("#fullscreen").load('ajax.php?t=telephone&m=editProfile', {anketa:srv_meta_anketa_id, pid:pid, noNavi:'true'});
|
|
|
|
}
|
|
|
|
function phnUpdateProfile() {
|
|
|
|
var pid = $("#rec_profile_pid").val();
|
|
|
|
var profile_name = $("#rec_profile_name").val();
|
|
|
|
var profile_comment = $("#rec_profile_comment").val();
|
|
|
|
var profile_respondents = $("#rec_profile_respondents").val();
|
|
|
|
$("#inv_error_note").addClass('hidden');
|
|
|
|
$.post('ajax.php?t=telephone&m=updateProfile', {anketa:srv_meta_anketa_id, pid:pid, profile_name:profile_name, profile_comment:profile_comment, profile_respondents:profile_respondents, noNavi:'true'}, function(data) {
|
|
|
|
data = jQuery.parseJSON(data);
|
|
|
|
if (data.error == "0") {
|
|
|
|
$('#fade').fadeOut('slow');
|
|
|
|
$('#fullscreen').fadeOut('slow').html('');
|
|
|
|
// osvežimo polja
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=recipients_lists', {anketa:srv_meta_anketa_id, pid:pid });
|
|
|
|
} else {
|
|
|
|
$("#inv_error_note").html(data.msg);
|
|
|
|
$("#inv_error_note").show();
|
|
|
|
$("#inv_error_note").removeClass('hidden');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function phnSaveProfile() {
|
|
|
|
var pid = $("#phn_import_list_profiles ol li.active").attr("pid");
|
|
|
|
var recipients_list = $("#inv_recipients_list").val();
|
|
|
|
var fields = [];
|
|
|
|
$('ul').children('li.inv_field_enabled').each(function(idx, elm) {
|
|
|
|
fields.push(elm.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=saveProfile', {anketa:srv_meta_anketa_id, recipients_list:recipients_list, fields:fields, pid:pid});
|
|
|
|
}
|
|
|
|
function phnGetNewProfileName() {
|
|
|
|
var pid = $("#phn_import_list_profiles ol li.active").attr("pid");
|
|
|
|
var recipients_list = $("#inv_recipients_list").val();
|
|
|
|
var fields = [];
|
|
|
|
$('ul').children('li.inv_field_enabled').each(function(idx, elm) {
|
|
|
|
fields.push(elm.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
// ponudimo box za ime ipd
|
|
|
|
if ( pid != 'undefined' ) {
|
|
|
|
if (fields.length > 0) {
|
|
|
|
if (recipients_list.length > 0) {
|
|
|
|
$('#fade').fadeTo('slow', 1);
|
|
|
|
$('#fullscreen').html('').fadeIn('slow');
|
|
|
|
$("#fullscreen").load('ajax.php?t=telephone&m=getProfileName', {anketa:srv_meta_anketa_id, recipients_list:recipients_list, fields:fields, noNavi:'true', pid:pid});
|
|
|
|
} else {
|
2022-05-20 04:34:13 +02:00
|
|
|
genericAlertPopup('srv_invitation_note1',null,'PopUpNarrow');
|
2020-08-14 13:36:36 +02:00
|
|
|
}
|
|
|
|
} else {
|
2022-05-20 04:34:13 +02:00
|
|
|
genericAlertPopup('srv_invitation_note2',null,'PopUpNarrow');
|
2020-08-14 13:36:36 +02:00
|
|
|
}
|
|
|
|
} else {
|
2022-05-20 04:34:13 +02:00
|
|
|
genericAlertPopup('alert_invalidPID',null,'PopUpNarrow');
|
2020-08-14 13:36:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function phnSaveNewProfile() {
|
|
|
|
var pid = $("#phn_import_list_profiles ol li.active").attr("pid");
|
|
|
|
var recipients_list = $("#inv_recipients_list").val();
|
|
|
|
var fields = [];
|
|
|
|
$('ul').children('li.inv_field_enabled').each(function(idx, elm) {
|
|
|
|
fields.push(elm.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
var profile_id = $("#profile_id").val();
|
|
|
|
var profile_name = $("#inv_recipients_profile_name").find("#rec_profile_name").val();
|
|
|
|
var profile_comment = $("#inv_recipients_profile_name").find("#rec_profile_comment").val();
|
|
|
|
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=saveNewProfile', {anketa:srv_meta_anketa_id, recipients_list:recipients_list, fields:fields, profile_id:profile_id, profile_name:profile_name, profile_comment:profile_comment});
|
|
|
|
$('#fade').fadeOut('slow');
|
|
|
|
$('#fullscreen').fadeOut('slow').html('');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function phn_new_recipients_list_change(what) {
|
|
|
|
if ($(what).val() == 0) {
|
|
|
|
$("#new_recipients_list_span").show();
|
|
|
|
$("#rec_profile_comment").val('');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$("#new_recipients_list_span").hide();
|
|
|
|
$("#rec_profile_comment").val($(what).find('option:selected').attr('comment'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function phnGoToUser(usr_id) {
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=goToUser', {anketa:srv_meta_anketa_id, noNavi:'false', showUser:usr_id});
|
|
|
|
}
|
|
|
|
|
|
|
|
function phnShowPopupAddMarker(usr_id,marker) {
|
|
|
|
$('#fade').fadeTo('slow', 1);
|
|
|
|
$('#telephone_popup').show().load('ajax.php?t=telephone&m=showPopupAddMarker', {anketa: srv_meta_anketa_id, usr_id:usr_id,marker:marker, noNavi:'true'}, function () {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function tel_filter_recipients() {
|
|
|
|
|
|
|
|
var tel_filter_value = $("#tel_rec_filter_value").val();
|
|
|
|
$.post('ajax.php?t=telephone&m=set_recipient_filter', {anketa:srv_meta_anketa_id, tel_filter_value:tel_filter_value}, function() {
|
|
|
|
$("#globalSettingsInner").load('ajax.php?t=telephone&m=view_recipients', {anketa:srv_meta_anketa_id});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pobrisemo zadnji status da se lahko respondent ponovno kliče
|
|
|
|
function phnUndoStatus(usr_id) {
|
|
|
|
|
|
|
|
$.post('ajax.php?t=telephone&m=undoLastStatus', {anketa:srv_meta_anketa_id, usr_id:usr_id}, function() {
|
|
|
|
phnGoToUser(usr_id);
|
|
|
|
});
|
|
|
|
}
|
2021-08-25 10:31:01 +02:00
|
|
|
|
|
|
|
// Sortiranje box-ov pri dodajanju respondentov
|
|
|
|
function initTelephoneConnectedSortable(){
|
|
|
|
|
|
|
|
// Na mobitelu ne inicializiramo sorrtiranja, ker potem gumbi niso klikabilni (na nekaterih androidih ne deluje ok)
|
|
|
|
if($(window).width() < 850)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
$('ul.connectedSortable').sortable({
|
|
|
|
update: function(){
|
|
|
|
refreshFieldsList();
|
|
|
|
},
|
|
|
|
forcePlaceholderSize:'true',
|
|
|
|
tolerance:'pointer',
|
|
|
|
placeholder:'inv_field_placeholder'
|
|
|
|
});
|
|
|
|
}
|