Kolektor - posiljanje opomnikov

This commit is contained in:
pero1203 2022-08-10 11:54:58 +02:00
parent 15437635c7
commit d3eccbaed9
6 changed files with 1642 additions and 1460 deletions

View File

@ -128,7 +128,7 @@ class Kolektor {
echo ' <td>'.date('j.n.Y H:i:s', strtotime($response['insert_time'])).'</td>';
echo ' <td>'.$this->statuses[$response['status']].'</td>';
echo ' <td><a href="'.$site_url.'admin/survey/index.php?anketa='.$response['ank_id'].'&a=data">Preglej odgovore</a></td>';
echo ' <td>Pošlji opomnik</td>'; // TODO
echo ' <td><span onClick="kolektorSendRespondentNotificationPopup(\''.$response['respondent_id'].'\');">Pošlji opomnik</span></td>'; // TODO
echo ' </tr>';
}
@ -223,7 +223,13 @@ class Kolektor {
// Sporocilo respondentu
$text = 'Pozdravljeni,&#10;&#10;Prosimo vas, če lahko izpolnite anketo.&#10;&#10;Povezava do ankete: #URL#&#10;&#10;Lep pozdrav,&#10;&#10;Kolektor ETRA';
$text = 'Pozdravljeni,
Prosimo vas, če lahko izpolnite anketo. Povezava do ankete: #URL#
Lep pozdrav,
Kolektor ETRA';
echo '<div class="kolektor_setting '.(isset($error['respondent_message']) ? 'error' : '').'">';
echo ' <div class="setting_line">Spremno besedilo:</div>';
@ -243,6 +249,32 @@ class Kolektor {
echo '</form>';
}
// Prikaze formo za posiljanje opomnika respondentu
public function displaySendRespondentNotification($respondent_id){
echo '<div class="popup_close"><a href="#" onclick="kolektorCreateResponseClose();">✕</a></div>';
echo '<h2>Pošiljanje opomnika respondentu</h2>';
// Sporocilo respondentu - dobimo prvotnega
$sql = sisplet_query("SELECT respondent_message FROM kolektor_survey_response WHERE respondent_id='".$respondent_id."'");
$row = mysqli_fetch_array($sql);
$text = $row['respondent_message'];
echo '<div class="kolektor_setting">';
echo ' <div class="setting_line">Besedilo opomnika:</div>';
echo ' <textarea name="respondent_message">'.$text.'</textarea>';
echo '</div>';
echo '<input type="hidden" name="respondent_id" value="'.$respondent_id.'">';
// Gumbi
echo '<div class="button_holder">';
echo ' <button class="medium white-blue" type="button" onClick="kolektorCreateResponseClose();">Zapri</button>';
echo ' <button class="medium blue" type="button" onClick="kolektorSendRespondentNotification();">Pošlji opomnik respondentu</button>';
echo '</div>';
}
public function displayResponseDetails(){
@ -264,6 +296,7 @@ class Kolektor {
$this->displayAddResponse();
echo '</div>';
}
elseif($_GET['a'] == 'add_repsonse'){
$response_data['ank_id'] = (isset($_POST['kolektor_survey'])) ? $_POST['kolektor_survey'] : '';
@ -305,7 +338,38 @@ class Kolektor {
KolektorResponse::addResponse($response_data);
}
}
elseif($_GET['a'] == 'send_respondent_notification_popup'){
$respondent_id = (isset($_POST['respondent_id'])) ? $_POST['respondent_id'] : 0;
if($respondent_id > 0){
echo '<div id="kolektor_send_respondent_notification">';
$this->displaySendRespondentNotification($respondent_id);
echo '</div>';
}
}
elseif($_GET['a'] == 'send_respondent_notification'){
$respondent_id = (isset($_POST['respondent_id'])) ? $_POST['respondent_id'] : '';
$notification = (isset($_POST['notification'])) ? $_POST['notification'] : '';
$kn = new KolektorNotifications($respondent_id);
$kn->sendRespondentNotification($notification);
// Uspesno prozenje
echo '<div class="popup_close"><a href="#" onclick="window.location.reload();">✕</a></div>';
echo '<h2>Pošiljanje opomnika respondentu</h2>';
echo 'Opomnik uspešno poslan.';
// Gumb koncaj
echo '<div class="button_holder">';
echo ' <button class="medium white-blue" type="button" onClick="window.location.reload();">Zapri</button>';
echo '</div>';
}
}
}

View File

@ -71,7 +71,7 @@ class KolektorNotifications {
$body = ($respondent_message != '') ? $respondent_message : $this->response['respondent_message'];
// Zamenjamo line breake in #URL#
$body = nl2br(stripslashes($body));
//$body = nl2br(stripslashes($body));
$body = str_replace('#URL#', '<a href="'.$url.'">Kolektor anketa</a>', $body);

View File

@ -67,3 +67,24 @@ function kolektorOtherFunction(){
}
// Popup za posiljanje opomnika respondentu
function kolektorSendRespondentNotificationPopup(respondent_id){
$("#fullscreen").addClass('PopUpNarrow').addClass('divPopUp');
$("#fullscreen").load('ajax.php?t=kolektor&a=send_respondent_notification_popup', {respondent_id: respondent_id}, function() {
$('#fade').fadeTo('slow', 1);
$('#fullscreen').show();
});
}
// Posiljanje opomnika respondentu
function kolektorSendRespondentNotification(){
var notification = $('textarea[name="respondent_message"]').val();
var respondent_id = $('input[name="respondent_id"]').val();
$('#kolektor_send_respondent_notification').load('ajax.php?t=kolektor&a=send_respondent_notification', {respondent_id:respondent_id, notification:notification});
}

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,19 @@
table.kolektor_reponses{
width: 100%;
tr{
td{
a,
span{
cursor: pointer;
color: $blue;
text-decoration: none;
}
}
}
}
}
@ -62,5 +71,15 @@
width: 100%;
}
}
}
}
// Popup za posiljanje opomnika respondentu
#kolektor_send_respondent_notification{
max-height: 95vh;
overflow-y: auto;
textarea{
width: 100%;
height: 200px;
}
}