Redesign - kvota in kalkulacija

This commit is contained in:
pero1203 2022-06-03 12:27:50 +02:00
parent c8f3d501a6
commit e885287bd7
8 changed files with 1128 additions and 331 deletions

View File

@ -8854,23 +8854,10 @@ class Branching {
echo '</div>'; echo '</div>';
echo '<div id="arrows_more_calculation" onclick=" $(\'#calculation_editing_inner\').animate({ scrollTop: $(\'#calculation_editing_inner\').attr(\'scrollHeight\') }, 2000); "><img src="img_0/bullet_arrow_down.png" /> '.$lang['srv_more'].'</div>';
?><script> ?><script>
$('#calculation_editing_inner').sortable({items: 'form', handle: 'img.move', stop: function () { $('#calculation_editing_inner').sortable({items: 'form', handle: '.move', stop: function () {
calculation_sort(<?=$condition?>); calculation_sort(<?=$condition?>);
} }); } });
$('#calculation_editing_inner').scroll(function() {
if ( isScrolledIntoView('#calculation_editing_operators', '#calculation_editing_inner') )
$('#arrows_more_calculation').fadeOut(1000);
else
$('#arrows_more_calculation').fadeIn(1000);
});
$('#calculation_editing_inner').resize(function() {
$('#calculation_editing_inner').scroll();
});
$('#calculation_editing_inner').scroll();
</script><? </script><?
} }
@ -8886,23 +8873,25 @@ class Branching {
echo '</div>'; echo '</div>';
echo '<div class="calculation_editing_body">'; echo '<div class="calculation_editing_body">';
$sql = sisplet_query("SELECT * FROM srv_calculation WHERE cnd_id = '$condition' ORDER BY vrstni_red"); $sql = sisplet_query("SELECT * FROM srv_calculation WHERE cnd_id = '$condition' ORDER BY vrstni_red");
if (mysqli_num_rows($sql) == 0) { if (mysqli_num_rows($sql) == 0) {
sisplet_query("INSERT INTO srv_calculation (id, cnd_id, vrstni_red) VALUES ('', '$condition', '1')"); sisplet_query("INSERT INTO srv_calculation (id, cnd_id, vrstni_red) VALUES ('', '$condition', '1')");
$sql = sisplet_query("SELECT * FROM srv_calculation WHERE cnd_id = '$condition' ORDER BY vrstni_red"); $sql = sisplet_query("SELECT * FROM srv_calculation WHERE cnd_id = '$condition' ORDER BY vrstni_red");
} }
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$this->calculation_edit($row['id'], $vrednost); $this->calculation_edit($row['id'], $vrednost);
} }
echo '</div>';
echo '<p class="div_calculation_bottom" id="calculation_editing_operators">'.$lang['srv_add_cond'].':
echo '<p class="bottom16" id="calculation_editing_operators">'.$lang['srv_add_cond'].': <a href="#" onclick="calculation_add(\''.$condition.'\', \'0\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;+&nbsp;</strong></a>,
<a href="#" onclick="calculation_add(\''.$condition.'\', \'0\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;+&nbsp;</strong></a>, <a href="#" onclick="calculation_add(\''.$condition.'\', \'1\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;-&nbsp;</strong></a>,
<a href="#" onclick="calculation_add(\''.$condition.'\', \'1\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;-&nbsp;</strong></a>, <a href="#" onclick="calculation_add(\''.$condition.'\', \'2\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;*&nbsp;</strong></a>,
<a href="#" onclick="calculation_add(\''.$condition.'\', \'2\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;*&nbsp;</strong></a>, <a href="#" onclick="calculation_add(\''.$condition.'\', \'3\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;/&nbsp;</strong></a>
<a href="#" onclick="calculation_add(\''.$condition.'\', \'3\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;/&nbsp;</strong></a>
</p>'; </p>';
echo '</div>';
} }
/** /**
@ -8929,53 +8918,13 @@ class Branching {
$row_count = mysqli_fetch_array($sql_count); $row_count = mysqli_fetch_array($sql_count);
// Headerji tabele - staro
if ($row['vrstni_red'] == 1 && $row_count['count'] > 1) {
echo '<table class="tbl_condition_editing">';
echo '<tr>';
echo '<th style="text-align:center; width:50px">'.$lang['srv_oklepaji'].'</th>'; // gumbi oklepaji
echo '<th style="width:70px">&nbsp;</th>'; // logicni operatorji
echo '<th style="width:50px">&nbsp;</th>'; // oklepaji
echo '<th >&nbsp;</th>';
echo '<th style="text-align:center; width:50px;">'.$lang['srv_zaklepaji'].'</th>'; // gumbi zaklepaji
echo '<th style="text-align:center; width:60px">'.$lang['edit2'].'</th>'; // move
echo '</tr>';
echo '</table>';
//Samo ena vrstica /spremenljivka/ v kalkulaciji
} elseif ($row['vrstni_red'] == 1) {
//echo '<table class="tbl_condition_editing"><tr><th>&nbsp;</th></tr></table>';
}
// form // form
echo '<form name="calculation_'.$calculation.'" id="calculation_'.$calculation.'" action="" method="post" onsubmit="calculation_edit(\''.$calculation.'\'); return false;">'."\n\r"; echo '<form name="calculation_'.$calculation.'" id="calculation_'.$calculation.'" action="" method="post" onsubmit="calculation_edit(\''.$calculation.'\'); return false;">'."\n\r";
echo '<table class="tbl_condition_editing" style="margin-bottom:10px; padding-bottom:10px; background-color:white">';
echo '<tr>';
// left_bracket
if ($row_count['count'] != 1 || $row['left_bracket']>0 || $row['right_bracket']>0) {
echo '<td class="tbl_ce_lol white" style="width:50px; text-align:center;" >';
echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'left\', \'plus\' ); return false;" title="'.$lang['srv_oklepaj_add'].'"><span class="faicon add"></span></a>';
if ($row['left_bracket'] > 0)
echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'left\', \'minus\'); return false;" title="'.$lang['srv_oklepaj_rem'].'"><span class="faicon delete_circle"></span></a>';
else
echo '<span class="faicon delete_circle icon-grey_normal"></span>';
}
else {
echo '<td class="tbl_ce_lol white" style="width:50px; text-align:center;" >';
}
echo '</td>';
// operator // operator
echo '<td class="tbl_ce_tb white" style="width:77px; text-align:center">'; if ($row['vrstni_red'] > 1) {
echo '<div class="condition_editing_row operator">';
if ($row['vrstni_red'] == 1) {
// nimamo nic..
} else {
if ($row['operator']==0) if ($row['operator']==0)
echo '<a href="#" onclick="calculation_operator_edit(\''.$calculation.'\', \'1\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;+&nbsp;</a>'; echo '<a href="#" onclick="calculation_operator_edit(\''.$calculation.'\', \'1\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;+&nbsp;</a>';
@ -8985,22 +8934,60 @@ class Branching {
echo '<a href="#" onclick="calculation_operator_edit(\''.$calculation.'\', \'3\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;*&nbsp;</a>'; echo '<a href="#" onclick="calculation_operator_edit(\''.$calculation.'\', \'3\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;*&nbsp;</a>';
if ($row['operator']==3) if ($row['operator']==3)
echo '<a href="#" onclick="calculation_operator_edit(\''.$calculation.'\', \'0\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;/&nbsp;</a>'; echo '<a href="#" onclick="calculation_operator_edit(\''.$calculation.'\', \'0\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;/&nbsp;</a>';
echo '</div>';
} }
echo '</td>';
echo '<div class="condition_editing_row">';
// move
echo '<div class="move_holder">';
if ($row_count['count'] != 1 )
echo '<span class="faicon move_updown move" title="'.$lang['srv_move'].'" />';
echo '</div>';
// Srednji bel del
echo '<div class="white_holder">';
// left_bracket // left_bracket
echo '<td class="tbl_ce_tb white" style="width:40px; text-align:center">'; echo '<div class="column bracket left">';
if ($row_count['count'] != 1 || $row['left_bracket']>0 || $row['right_bracket']>0) {
echo '<div class="bracket_icons">';
echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'left\', \'plus\' ); return false;" title="'.$lang['srv_oklepaj_add'].'"><span class="faicon add"></span></a>';
if ($row['left_bracket'] > 0)
echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'left\', \'minus\'); return false;" title="'.$lang['srv_oklepaj_rem'].'"><span class="faicon delete_circle"></span></a>';
else
echo '<span class="faicon delete_circle icon-grey_normal"></span>';
echo '</div>';
echo '<div class="bracket_text">'.$lang['srv_oklepaji'].'</div>';
}
echo '</div>';
// left_bracket
echo '<div class="column display_bracket left">';
for ($i=$row['left_bracket']; $i>0; $i--) { for ($i=$row['left_bracket']; $i>0; $i--) {
echo ' ( '; } echo ' ( ';
echo '</td>'; }
echo '</div>';
// spremenljivka // spremenljivka
echo '<td class="tbl_ce_tb white" style="width:auto">'; echo '<div class="column variable">';
if ($row['spr_id']==0) echo '<span class="red">'.$lang['srv_select_spr'].'!</span>';
echo '<br />'; if ($row['spr_id']==0)
echo '<select name="calculation_spremenljivka_'.$calculation.'" id="calculation_spremenljivka_'.$calculation.'" size="1" style="width:'.($row['spr_id']==-1?'100':'150').'px" onchange="javascript:calculation_edit(\''.$calculation.'\', \''.$vrednost.'\');">'."\n\r"; echo '<span class="red">'.$lang['srv_select_spr'].'!</span>';
echo '<select name="calculation_spremenljivka_'.$calculation.'" id="calculation_spremenljivka_'.$calculation.'" size="1" class="dropdown medium" style="width:'.($row['spr_id']==-1?'100':'150').'px" onchange="javascript:calculation_edit(\''.$calculation.'\', \''.$vrednost.'\');">'."\n\r";
echo '<option value="0"></option>'; echo '<option value="0"></option>';
echo '<option value="-1"'. ($row['spr_id']==-1 ?' selected="selected"':'').' style="color: blue">&nbsp;&nbsp;&nbsp; '.$lang['srv_number'].'</option>'; echo '<option value="-1"'. ($row['spr_id']==-1 ?' selected="selected"':'').' style="color: blue">&nbsp;&nbsp;&nbsp; '.$lang['srv_number'].'</option>';
@ -9114,8 +9101,7 @@ class Branching {
// number vnos // number vnos
if ($row['spr_id'] == -1) { if ($row['spr_id'] == -1) {
//if ($row['number'] == 0) $row['number'] = ''; echo ' <input type="text" name="number" id="calculation_number_'.$calculation.'" value="'.$row['number'].'" class="medium" style="width: 40px;">';
echo ' <input type="text" name="number" id="calculation_number_'.$calculation.'" value="'.$row['number'].'" style="width:40px" >';
echo '<script type="text/javascript">'; // shranimo ko zapustmo input polje echo '<script type="text/javascript">'; // shranimo ko zapustmo input polje
echo '$(document).ready(function() {' . echo '$(document).ready(function() {' .
@ -9124,56 +9110,56 @@ class Branching {
' });' . ' });' .
'});'; '});';
echo '</script>'; echo '</script>';
} }
echo '<br />&nbsp;'."\n\r"; echo '</div>';
echo '</td>';
// right_bracket // right_bracket
echo '<td class="tbl_ce_tb white" style="width:40px; text-align:center">'; echo '<div class="column display_bracket right">';
for ($i=$row['right_bracket']; $i>0; $i--) { for ($i=$row['right_bracket']; $i>0; $i--) {
echo ' ) '; echo ' ) ';
} }
echo '</td>';
echo '</div>';
// right_bracket buttons // right_bracket buttons
echo '<div class="column bracket right">';
if ($row_count['count'] != 1 || $row['right_bracket']>0 || $row['left_bracket']>0) { if ($row_count['count'] != 1 || $row['right_bracket']>0 || $row['left_bracket']>0) {
echo '<td class="tbl_ce_lor" style="width:50px; text-align:center" nowrap>';
echo '<div class="bracket_icons">';
if ($row['right_bracket'] > 0) if ($row['right_bracket'] > 0)
echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'right\', \'minus\'); return false;" title="'.$lang['srv_zaklepaj_rem'].'"><span class="faicon delete_circle"></span></a>'; echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'right\', \'minus\'); return false;" title="'.$lang['srv_zaklepaj_rem'].'"><span class="faicon delete_circle"></span></a>';
else else
echo '<span class="faicon delete_circle icon-grey_normal"></span>'; echo '<span class="faicon delete_circle icon-grey_normal"></span>';
echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'right\', \'plus\' ); return false;" title="'.$lang['srv_zaklepaj_add'].'"><span class="faicon add"></span></a>'; echo '<a href="#" onclick="javascript:calculation_bracket_edit_new(\''.$calculation.'\', \''.$vrednost.'\', \'right\', \'plus\' ); return false;" title="'.$lang['srv_zaklepaj_add'].'"><span class="faicon add"></span></a>';
} else {
echo '<td class="tbl_ce_lor white" style="width:50px; text-align:center" nowrap>';
// echo '<span class="sprites delete_blue_light"></span>';
// echo '<span class="sprites add_blue_light"></span>';
}
echo '</td>';
// move echo '</div>';
echo '<td class="tbl_ce_bck_blue white" style="text-align:right; width:30px">';
if ($row_count['count'] != 1 ) echo '<div class="bracket_text">'.$lang['srv_zaklepaji'].'</div>';
echo '<img src="img_0/move_updown.png" class="move" title="'.$lang['srv_move'].'" />'; }
echo '</td>';
echo '</div>';
echo '</div>';
// remove // remove
echo '<td class="tbl_ce_bck_blue white" style="text-align:left; width:30px">'; echo '<div class="delete_holder">';
$sql3 = sisplet_query("SELECT * FROM srv_calculation WHERE cnd_id='$row[cnd_id]'"); $sql3 = sisplet_query("SELECT * FROM srv_calculation WHERE cnd_id='$row[cnd_id]'");
if (mysqli_num_rows($sql3) != 1 ) if (mysqli_num_rows($sql3) != 1 )
echo ' <a href="#" onclick="calculation_remove(\''.$row['cnd_id'].'\', \''.$calculation.'\', \''.$vrednost.'\'); return false;" title="'.$lang['srv_if_rem'].'"><span class="faicon delete icon-grey_dark_link delte-if-block"></span></a>'."\n\r"; echo ' <a href="#" onclick="calculation_remove(\''.$row['cnd_id'].'\', \''.$calculation.'\', \''.$vrednost.'\'); return false;" title="'.$lang['srv_if_rem'].'"><span class="faicon delete"></span></a>'."\n\r";
echo '</td>';
echo '</div>';
echo '</tr>'; echo '</div>';
echo '</table>';
echo '</form>'."\n\r";
echo '</form>';
} }
/** /**

View File

@ -2673,6 +2673,30 @@ class BranchingAjax {
$b->repare_condition($if); $b->repare_condition($if);
$b->calculation_editing_inner($condition); $b->calculation_editing_inner($condition);
} }
function ajax_quota_sort() {
Common::getInstance()->Init($this->anketa);
Common::getInstance()->updateEditStamp();
$condition = $_POST['condition'];
$sortable = $_POST['sortable'];
$sortable = explode('&', $sortable);
$i=1;
foreach ($sortable AS $val) {
$quota = explode('=', $val);
$quota = $quota[1];
$s = sisplet_query("UPDATE srv_quota SET vrstni_red='{$i}' WHERE id='{$quota}'");
if (!$s) echo mysqli_error($GLOBALS['connect_db']);
$i++;
}
$b = new Branching($this->anketa);
$b->repare_condition($if);
//$b->calculation_editing_inner($condition);
}
function ajax_spremenljivka_preview_print() { function ajax_spremenljivka_preview_print() {
global $lang; global $lang;

View File

@ -154,37 +154,46 @@ class SurveyQuotas {
echo '<div class="popup_close"><a href="#" onClick="quota_editing_close(\''.$condition.'\', \''.$vrednost.'\'); return false;">✕</a></div>'; echo '<div class="popup_close"><a href="#" onClick="quota_editing_close(\''.$condition.'\', \''.$vrednost.'\'); return false;">✕</a></div>';
echo '<div id="quota_editing_inner">'; echo '<div id="quota_editing_inner" class="podatki">';
$this->quota_editing_inner($condition, $vrednost); $this->quota_editing_inner($condition, $vrednost);
echo '</div>'; echo '</div>';
echo '<div id="bottom_space">'; echo '<div id="bottom_options">';
$row = Cache::srv_spremenljivka(-$condition); $row = Cache::srv_spremenljivka(-$condition);
if ($condition < 0) { if ($condition < 0) {
echo '<p style="float:left; padding:0; margin:0; margin-left:20px">'.$lang['srv_variable'].': <input type="text" id="variable_'.(-$condition).'" value="'.$row['variable'].'" onkeyup="quota_edit_variable(\''.-$condition.'\');" style="width:60px" /></p>'; echo '<div class="setting_horizontal_wrapper">';
echo '<div class="setting_holder">';
echo ' <label>'.$lang['srv_variable'].':</label>';
echo ' <input type="text" id="variable_'.(-$condition).'" class="large" value="'.$row['variable'].'" onkeyup="quota_edit_variable(\''.-$condition.'\');" />';
echo '</div>';
echo '</div>';
} }
echo '<div id="condition_editing_close">';
// kvota kot spremenljivka (lahko jo zbrisemo)
if ($condition < 0) {
echo '<span class="buttonwrapper spaceRight floatLeft">';
echo '<a class="ovalbutton ovalbutton_gray" href="#" onclick="brisi_spremenljivko(\''.(-$condition).'\'); return false;"><span>'.$lang['srv_anketadelete_txt'].'</span></a>';
echo '</span>';
}
echo '<span class="buttonwrapper spaceRight floatLeft">';
echo '<a class="ovalbutton ovalbutton_gray" href="#" onclick="quota_editing_close(\''.$condition.'\', \''.$vrednost.'\'); return false;"><span>'.$lang['srv_zapri'].'</span></a>';
echo '</span>';
echo '<span class="buttonwrapper floatLeft">';
echo '<a class="ovalbutton ovalbutton_orange" href="#" onclick="quota_editing_close(\''.$condition.'\', \''.$vrednost.'\'); return false;"><span>'.$lang['srv_potrdi'].'</span></a>';
echo '</span>';
echo '</div>'; echo '</div>';
echo '<div id="condition_editing_close" class="podatki">';
echo ' <div class="button_holder">';
// kalkulacija kot spremenljivka (lahko jo zbrisemo)
if ($condition < 0)
echo ' <button class="medium white-blue" onclick="brisi_spremenljivko(\''.(-$condition).'\'); return false;">'.$lang['srv_anketadelete_txt'].'</button>';
echo ' <button class="medium white-blue" onclick="quota_editing_close(\''.$condition.'\', \''.$vrednost.'\'); return false;">'.$lang['srv_zapri'].'</button>';
echo ' <button class="medium blue" onclick="quota_editing_close(\''.$condition.'\', \''.$vrednost.'\'); return false;">'.$lang['srv_potrdi'].'</button>';
echo ' </div>';
echo '</div>'; echo '</div>';
?><script>
$('#quota_editing_inner').sortable({items: 'form', handle: '.move', stop: function () {
quota_sort(<?=$condition?>);
} });
</script><?
} }
private function quota_editing_inner ($condition, $vrednost=0) { private function quota_editing_inner ($condition, $vrednost=0) {
@ -192,23 +201,16 @@ class SurveyQuotas {
echo '<div class="quota_editing_preview">'; echo '<div class="quota_editing_preview">';
echo '<h2>'.$lang['srv_quota'].'</h2>'; echo '<h2><span class="blue faicon edit"></span>'.$lang['srv_quota'].'</h2>';
echo '<div id="quota_editing_calculations">'; echo '<div id="quota_editing_calculations">';
echo $this->quota_display($condition, 1); echo $this->quota_display($condition, 1);
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
echo '<div class="condition_editing_body">';
echo '<h2>'.$lang['srv_edit_quota'].'</h2>'; echo '<div class="quota_editing_body">';
echo '</div>';
// Vrednost kvote
/*$rowS = Cache::srv_spremenljivka(-$condition);
echo '<div id="quota_value_holder">';
echo $lang['srv_quota_value'].': ';
echo ' <input type="text" name="value" id="quota_value" value="'.$rowS['vsota_limit'].'" style="width:50px" onkeypress="checkNumber(this, 6, 0);" onkeyup="checkNumber(this, 9, 0);" onBlur="quota_value_edit(\''.$rowS['id'].'\');">';
echo '</div>';*/
$sql = sisplet_query("SELECT id FROM srv_quota WHERE cnd_id = '$condition' ORDER BY vrstni_red"); $sql = sisplet_query("SELECT id FROM srv_quota WHERE cnd_id = '$condition' ORDER BY vrstni_red");
if (mysqli_num_rows($sql) == 0) { if (mysqli_num_rows($sql) == 0) {
sisplet_query("INSERT INTO srv_quota (id, cnd_id, vrstni_red) VALUES ('', '$condition', '1')"); sisplet_query("INSERT INTO srv_quota (id, cnd_id, vrstni_red) VALUES ('', '$condition', '1')");
@ -218,12 +220,14 @@ class SurveyQuotas {
$this->quota_edit($row['id'], $vrednost); $this->quota_edit($row['id'], $vrednost);
} }
echo '<p id="quota_editing_operators" style="margin-left:62px">'.$lang['srv_add_cond'].': echo '<p id="quota_editing_operators" class="div_quota_bottom">'.$lang['srv_add_cond'].':
<a href="#" onclick="quota_add(\''.$condition.'\', \'0\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;+&nbsp;</strong></a>, <a href="#" onclick="quota_add(\''.$condition.'\', \'0\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;+&nbsp;</strong></a>,
<a href="#" onclick="quota_add(\''.$condition.'\', \'1\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;-&nbsp;</strong></a>, <a href="#" onclick="quota_add(\''.$condition.'\', \'1\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;-&nbsp;</strong></a>,
<a href="#" onclick="quota_add(\''.$condition.'\', \'2\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;*&nbsp;</strong></a>, <a href="#" onclick="quota_add(\''.$condition.'\', \'2\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;*&nbsp;</strong></a>,
<a href="#" onclick="quota_add(\''.$condition.'\', \'3\', \''.$vrednost.'\'); return false;"><strong style="font-size:18px">&nbsp;/&nbsp;</strong></a> <a href="#" onclick="quota_add(\''.$condition.'\', \'3\', \''.$vrednost.'\'); return false;" class="noline"><strong style="font-size:18px">&nbsp;/&nbsp;</strong></a>
</p>'; </p>';
echo '</div>';
} }
/** /**
@ -251,74 +255,76 @@ class SurveyQuotas {
if (!$sql_count) die(); if (!$sql_count) die();
$row_count = mysqli_fetch_array($sql_count); $row_count = mysqli_fetch_array($sql_count);
if ($row['vrstni_red'] == 1 && $row_count['count'] > 1) {
echo '<table class="tbl_condition_editing">';
echo '<tr>';
echo '<th style="text-align:center; width:50px">'.$lang['srv_oklepaji'].'</th>'; // gumbi oklepaji
echo '<th style="width:70px">&nbsp;</th>'; // logicni operatorji
echo '<th style="width:50px">&nbsp;</th>'; // oklepaji
echo '<th >&nbsp;</th>';
echo '<th style="text-align:center; width:50px;">'.$lang['srv_zaklepaji'].'</th>'; // gumbi zaklepaji
echo '<th style="text-align:center; width:60px">'.$lang['edit2'].'</th>'; // move
echo '</tr>';
echo '</table>';
} elseif ($row['vrstni_red'] == 1) { // operator
echo '<table class="tbl_condition_editing"><tr><th>&nbsp;</th></tr></table>'; if ($row['vrstni_red'] > 1) {
echo '<div class="condition_editing_row operator">';
if ($row['operator']==0)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'1\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;+&nbsp;</a>';
if ($row['operator']==1)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'2\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;-&nbsp;</a>';
if ($row['operator']==2)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'3\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;*&nbsp;</a>';
if ($row['operator']==3)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'0\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;/&nbsp;</a>';
echo '</div>';
} }
// form // form
echo '<form name="quota_'.$quota.'" id="quota_'.$quota.'" action="" method="post" onsubmit="quota_edit(\''.$quota.'\'); return false;">'."\n\r"; echo '<form name="quota_'.$quota.'" id="quota_'.$quota.'" action="" method="post" onsubmit="quota_edit(\''.$quota.'\'); return false;">'."\n\r";
echo '<table class="tbl_condition_editing" style="margin-bottom:10px; padding-bottom:10px; background-color:white">';
echo '<tr>'; echo '<div class="condition_editing_row">';
// move
echo '<div class="move_holder">';
if ($row_count['count'] != 1 )
echo '<span class="faicon move_updown move" title="'.$lang['srv_move'].'"></span>';
echo '</div>';
// Srednji bel del
echo '<div class="white_holder">';
// left_bracket // left_bracket
echo '<div class="column bracket left">';
if ($row_count['count'] != 1 || $row['left_bracket']>0 || $row['right_bracket']>0) { if ($row_count['count'] != 1 || $row['left_bracket']>0 || $row['right_bracket']>0) {
echo '<td class="tbl_ce_lol white" style="width:50px; text-align:center;" >';
echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'left\', \'plus\' ); return false;" title="'.$lang['srv_oklepaj_add'].'"><span class="faicon add small"></span></a>'; echo '<div class="bracket_icons">';
if ($row['left_bracket'] > 0)
echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'left\', \'minus\'); return false;" title="'.$lang['srv_oklepaj_rem'].'"><span class="faicon add small"></span></a>'; echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'left\', \'plus\' ); return false;" title="'.$lang['srv_oklepaj_add'].'"><span class="faicon add"></span></a>';
if ($row['left_bracket'] > 0)
echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'left\', \'minus\'); return false;" title="'.$lang['srv_oklepaj_rem'].'"><span class="faicon delete_circle"></span></a>';
else else
echo '<span class="faicon delete_circle icon-grey_normal"></span>'; echo '<span class="faicon delete_circle icon-grey_normal"></span>';
echo '</div>';
echo '<div class="bracket_text">'.$lang['srv_oklepaji'].'</div>';
} }
else {
echo '<td class="tbl_ce_lol white" style="width:50px; text-align:center;" >';
}
echo '</td>';
// operator
echo '<td class="tbl_ce_tb white" style="width:77px; text-align:center">';
if ($row['vrstni_red'] == 1) {
// nimamo nic..
} else {
if ($row['operator']==0)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'1\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;+&nbsp;</a>';
if ($row['operator']==1)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'2\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;-&nbsp;</a>';
if ($row['operator']==2)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'3\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;*&nbsp;</a>';
if ($row['operator']==3)
echo '<a href="#" onclick="quota_operator_edit(\''.$quota.'\', \'0\'); return false;" style="font-weight:bold; font-size:18px" title="'.$lang['srv_edit_condition_conjunction'].'">&nbsp;/&nbsp;</a>';
}
echo '</td>';
echo '</div>';
// left_bracket // left_bracket
echo '<td class="tbl_ce_tb white" style="width:40px; text-align:center">'; echo '<div class="column display_bracket left">';
for ($i=$row['left_bracket']; $i>0; $i--) { for ($i=$row['left_bracket']; $i>0; $i--) {
echo ' ( '; } echo ' ( ';
echo '</td>'; }
echo '</div>';
// spremenljivka // spremenljivka
echo '<td class="tbl_ce_tb white" style="width:auto">'; echo '<div class="column variable">';
if ($row['spr_id']==0) echo '<span class="red">'.$lang['srv_select_spr'].'!</span>'; if ($row['spr_id']==0) echo '<span class="red">'.$lang['srv_select_spr'].'!</span>';
echo '<br />';
echo '<select name="quota_spremenljivka_'.$quota.'" id="quota_spremenljivka_'.$quota.'" size="1" style="width:150px" onchange="javascript:quota_edit(\''.$quota.'\', \''.$vrednost.'\');">'."\n\r"; echo '<select name="quota_spremenljivka_'.$quota.'" id="quota_spremenljivka_'.$quota.'" class="dropdown medium" size="1" style="width:150px" onchange="javascript:quota_edit(\''.$quota.'\', \''.$vrednost.'\');">'."\n\r";
echo '<option value="0"></option>'; echo '<option value="0"></option>';
@ -443,61 +449,54 @@ class SurveyQuotas {
echo '</select>'; echo '</select>';
echo '</div>';
// Vrednost kvote
/*echo ' <input type="text" name="value" id="quota_value_'.$quota.'" value="'.$row['value'].'" style="width:40px" >';
echo '<script type="text/javascript">'; // shranimo ko zapustmo input polje
echo '$(document).ready(function() {' .
' $("input#quota_value_'.$quota.'").bind("blur", {}, function(e) {' .
' quota_edit(\''.$quota.'\', \''.$vrednost.'\'); return false; ' .
' });' .
'});';
echo '</script>';*/
echo '<br />&nbsp;'."\n\r";
echo '</td>';
// right_bracket // right_bracket
echo '<td class="tbl_ce_tb white" style="width:40px; text-align:center">'; echo '<div class="column display_bracket right">';
for ($i=$row['right_bracket']; $i>0; $i--) { for ($i=$row['right_bracket']; $i>0; $i--) {
echo ' ) '; echo ' ) ';
} }
echo '</td>';
echo '</div>';
// right_bracket buttons // right_bracket buttons
echo '<div class="column bracket right">';
if ($row_count['count'] != 1 || $row['right_bracket']>0 || $row['left_bracket']>0) { if ($row_count['count'] != 1 || $row['right_bracket']>0 || $row['left_bracket']>0) {
echo '<td class="tbl_ce_lor" style="width:50px; text-align:center" nowrap>';
echo '<div class="bracket_icons">';
if ($row['right_bracket'] > 0) if ($row['right_bracket'] > 0)
echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'right\', \'minus\'); return false;" title="'.$lang['srv_zaklepaj_rem'].'"><span class="faicon delete_circle"></span></a>'; echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'right\', \'minus\'); return false;" title="'.$lang['srv_zaklepaj_rem'].'"><span class="faicon delete_circle"></span></a>';
else else
echo '<span class="faicon delete_circle icon-grey_normal"></span>'; echo '<span class="faicon delete_circle icon-grey_normal"></span>';
echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'right\', \'plus\' ); return false;" title="'.$lang['srv_zaklepaj_add'].'"><span class="faicon add small"></span></a>'; echo '<a href="#" onclick="javascript:quota_bracket_edit_new(\''.$quota.'\', \''.$vrednost.'\', \'right\', \'plus\' ); return false;" title="'.$lang['srv_zaklepaj_add'].'"><span class="faicon add"></span></a>';
}
else { echo '</div>';
echo '<td class="tbl_ce_lor white" style="width:50px; text-align:center" nowrap>';
} echo '<div class="bracket_text">'.$lang['srv_zaklepaji'].'</div>';
echo '</td>'; }
echo '</div>';
echo '</div>';
// move
echo '<td class="tbl_ce_bck_blue white" style="text-align:right; width:30px">';
if ($row_count['count'] != 1 )
echo '<img src="img_0/move_updown.png" class="move" title="'.$lang['srv_move'].'" />';
echo '</td>';
// remove // remove
echo '<td class="tbl_ce_bck_blue white" style="text-align:left; width:30px">'; echo '<div class="delete_holder">';
$sql3 = sisplet_query("SELECT id FROM srv_quota WHERE cnd_id='$row[cnd_id]'"); $sql3 = sisplet_query("SELECT id FROM srv_quota WHERE cnd_id='$row[cnd_id]'");
if (mysqli_num_rows($sql3) != 1 ) if (mysqli_num_rows($sql3) != 1 )
echo ' <a href="#" onclick="quota_remove(\''.$row['cnd_id'].'\', \''.$quota.'\', \''.$vrednost.'\'); return false;" title="'.$lang['srv_if_rem'].'"><span class="faicon delete icon-grey_dark_link delte-if-block"></span></a>'."\n\r"; echo ' <a href="#" onclick="quota_remove(\''.$row['cnd_id'].'\', \''.$quota.'\', \''.$vrednost.'\'); return false;" title="'.$lang['srv_if_rem'].'"><span class="faicon delete icon-grey_dark_link delte-if-block"></span></a>'."\n\r";
echo '</td>';
echo '</div>';
echo '</tr>'; echo '</div>';
echo '</table>';
echo '</form>'."\n\r"; echo '</form>'."\n\r";
} }

View File

@ -1742,6 +1742,17 @@ function calculation_sort(condition) {
}); });
} }
function quota_sort(condition) {
$('#quota_editing_inner').load('ajax.php?t=branching&a=quota_sort', {
'condition': condition,
sortable: $('#quota_editing_inner').sortable('serialize'),
anketa: srv_meta_anketa_id
}, function () {
$('#quota_editing_inner').scroll();
});
}
function calculation_edit(calculation, vrednost) { function calculation_edit(calculation, vrednost) {
var spr_id = document var spr_id = document

File diff suppressed because it is too large Load Diff

View File

@ -521,14 +521,18 @@ and open the template in the editor.
} }
//IF - vsebina pogoja //IF - vsebina pogoja, kalkulacije, kvote
#div_condition_editing_inner { #div_condition_editing_inner,
#quota_editing_inner,
#calculation_editing_inner{
.condition_editing_preview { .condition_editing_preview {
} }
.condition_editing_body{ .condition_editing_body,
.quota_editing_body,
.calculation_editing_body{
max-height: 70vh; max-height: 70vh;
overflow-y: auto; overflow-y: auto;
@ -691,8 +695,10 @@ and open the template in the editor.
} }
} }
.div_condition_bottom { .div_condition_bottom,
margin: 4px 0 0 22px; .div_quota_bottom,
.div_calculation_bottom {
margin: 8px 0 0 22px;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;

View File

@ -29,7 +29,8 @@
/* Calculation edit */ /* Calculation edit */
#calculation { #calculation,
#quota {
@include popup_general(); @include popup_general();
display: none; display: none;
@ -42,7 +43,8 @@
height: auto; height: auto;
width: 600px; width: 600px;
#calculation_editing_inner { #calculation_editing_inner,
#quota_editing_inner {
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
@ -53,19 +55,39 @@
&.podatki { &.podatki {
margin-bottom: 0; margin-bottom: 0;
} }
}
.calculation_editing_body{ .calculation_editing_body,
max-height: 40vh; .quota_editing_body{
overflow-y: auto; max-height: 40vh;
overflow-y: auto;
margin: 16px 0 16px 0;
padding: 12px;
background-color: $medium-blue;
border: 1px #cce4f9 solid;
.condition_editing_row{
margin-bottom: 0;
margin: 20px 0; &.operator{
padding: 10px 5px 5px 5px; padding-left: 22px;
margin: 8px 0;
border: 1px $blue solid; a{
font-size: 20px;
text-decoration: none;
}
}
.tbl_condition_editing{ .variable{
margin-bottom: 5px; flex-direction: row;
input[type="text"]{
margin-left: 8px;
}
}
}
} }
} }

View File

@ -25,14 +25,4 @@ and open the template in the editor.
} }
#bottom_space { #bottom_space {
padding: 0; padding: 0;
}
#calculation_editing_calculations {
/*min-height: 40px;*/
padding: 0 0 10px 0;
span.calculations_display {
font-size: 20px;
}
} }