summaryrefslogtreecommitdiffstats
path: root/admin/survey/script/surveyCondition.js
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
commit19985dbb8c0aa66dc4bf7905abc1148de909097d (patch)
tree2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /admin/survey/script/surveyCondition.js
download1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip
Diffstat (limited to 'admin/survey/script/surveyCondition.js')
-rw-r--r--admin/survey/script/surveyCondition.js81
1 files changed, 81 insertions, 0 deletions
diff --git a/admin/survey/script/surveyCondition.js b/admin/survey/script/surveyCondition.js
new file mode 100644
index 0000000..3670c7e
--- /dev/null
+++ b/admin/survey/script/surveyCondition.js
@@ -0,0 +1,81 @@
+function showSurveyCondition(cid)
+{
+ var chooseProfileJSAction = $("#chooseProfileJSAction").val();
+ $("#fullscreen").load('ajax.php?t=surveyCondition&a=showCondition', {anketa:srv_meta_anketa_id,cid:cid, surveyConditionProfileAction:chooseProfileJSAction});
+}
+
+function newSurveyCondition()
+{
+ var name = $("#newSurveyConditionName").val();
+ var chooseProfileJSAction = $("#chooseProfileJSAction").val();
+ // kreiramo nov profil z novim id
+ $.post('ajax.php?t=surveyCondition&a=newCondition', { anketa : srv_meta_anketa_id, name : name, surveyConditionProfileAction:chooseProfileJSAction},
+ function(response)
+ {
+ var data = jQuery.parseJSON(response);
+ if (data.if_id > 0)
+ {
+ showSurveyCondition(data.if_id);
+ }
+ else
+ {
+ alert('Error! (errCode:'+data.error+')');
+ }
+ }
+ )
+}
+
+function deleteSurveyCondition(cid)
+{
+ var chooseProfileJSAction = $("#chooseProfileJSAction").val();
+ // kreiramo nov profil z novim id
+ $.post('ajax.php?t=surveyCondition&a=deleteCondition', { anketa : srv_meta_anketa_id, cid:cid, surveyConditionProfileAction:chooseProfileJSAction},
+ function(response)
+ {
+ var data = jQuery.parseJSON(response);
+ if (data.error == 0)
+ {
+ showSurveyCondition(data.cid);
+
+ if ( $("#surveyConditionPage").val() == 'invitations')
+ {
+ // osvežimo background
+ $("#conditionProfileNote").hide();
+ //
+ $("#inv_rec_filter a").data('cid',0);
+ }
+ }
+ else
+ {
+ alert('Error! (errCode:'+data.error+')');
+ }
+ }
+ );
+}
+function showRenameSurveyCondition(cid)
+{
+ var chooseProfileJSAction = $("#chooseProfileJSAction").val();
+ $("#surveyConditionCover").show();
+ $("#divConditionProfiles #renameProfileDiv").load('ajax.php?t=surveyCondition&a=showRename', { anketa : srv_meta_anketa_id, cid:cid}).show();
+
+}
+function renameSurveyCondition()
+{
+ var cid = $("#divConditionProfiles #renameProfileId").val();
+ var name = $("#divConditionProfiles #renameProfileName").val();
+ $.post('ajax.php?t=surveyCondition&a=renameCondition', { anketa : srv_meta_anketa_id, cid:cid, name:name},
+ function(response)
+ {
+ var data = jQuery.parseJSON(response);
+ if (data.error == 0 && data.if_id > 0)
+ {
+ showSurveyCondition(data.if_id);
+ }
+ else
+ {
+ alert(data.errorMsg+'');
+ }
+ }
+ );
+
+} \ No newline at end of file