Просмотр исходного кода

email client feedback link to helen

master
patrick 6 лет назад
Родитель
Сommit
2720d48e15
6 измененных файлов: 151 добавлений и 2 удалений
  1. +14
    -0
      NdisPrice.php
  2. +9
    -0
      css/xeroc.css
  3. +40
    -0
      html/bts_client_invoice_template.html
  4. +31
    -0
      html/email_feedback_url.html
  5. +19
    -0
      js/bts_timesheet.js
  6. +38
    -2
      ts.php

+ 14
- 0
NdisPrice.php Просмотреть файл

@@ -62,6 +62,20 @@ class NdisPrice{
return "";
}
public function get_tos_full_str($ndis_code)
{
foreach ($this->tos as $r){
if ($ndis_code == $r->code){
return sprintf("%.2f - %s %s %s",
(float) $r->price,
$r->name,
$this->get_level((int) $r->level),
$r->ot);
}
}
return "";
}
public function get_tos_price($ndis_code)
{
foreach ($this->tos as $r){

+ 9
- 0
css/xeroc.css Просмотреть файл

@@ -178,4 +178,13 @@ img.waiting_invoice_number{
animation: blinker 0.3s linear infinite;
}

td.invoice_summary{
text-align:center;
background-color:lightcyan;
font-weight:900;
color:green;
}

td.invoice_summary_header{
background-color: #ededed;
}

+ 40
- 0
html/bts_client_invoice_template.html Просмотреть файл

@@ -49,6 +49,46 @@
</td>
</tr>
{{/jobs}}
{{#has_summary}}
<tr>
<td colspan=9 class=invoice_summary>
Summary for above client
</td>
</tr>
<tr>
<td></td>
<td class="invoice_summary_header" colspan=1>Name of Service</td>
<td class="invoice_summary_header" colspan=2>NDIS code</td>
<td class="invoice_summary_header" colspan=1>Total Hours</td>
<td class="invoice_summary_header" colspan=3> </td>
<td></td>
</tr>
{{/has_summary}}
{{#summary}}
<tr>
<td></td>
<td colspan=1>{{tos}}</td>
<td colspan=2>{{ndis}}</td>
<td colspan=1>{{Hours}}</td>
<td colspan=3> </td>
<td></td>
</tr>
{{/summary}}
{{#has_summary}}
<tr>
<td></td>
<td class="invoice_summary_header" colspan=1>Name of Service</td>
<td class="invoice_summary_header" colspan=2>NDIS code</td>
<td class="invoice_summary_header" colspan=1>Total Hours</td>
<td class="invoice_summary_header" colspan=3> </td>
<td></td>
<tr>
<td colspan=9 class=invoice_summary>
End of summary
</td>
</tr>
</tr>
{{/has_summary}}
</tbody>
</table>
</td>

+ 31
- 0
html/email_feedback_url.html Просмотреть файл

@@ -0,0 +1,31 @@
Dear Helen,

This is your Feedback link for

=== {{display_name}} =====
SMS content below:


------------- copy from here -----------------

Dear {{display_name}},
please use it confirm our staff has provided service for you
http://acaresydney.com.au/feedback_card/{{user_login}}

------------- copy end here--------------------




**************************************************************
Please DO NOT click this link on your office computer,
you will become this customer instead of timesheet manager.
If you happen to click it by mistake,
please contact your IT support to have this error fixed.
**************************************************************

Kind Regards
Team of
AcareSydney WebOffice
Hotline 02 8103 5092

+ 19
- 0
js/bts_timesheet.js Просмотреть файл

@@ -1471,6 +1471,25 @@
$( ".boundary_datepicker" ).datepicker();
$( ".boundary_datepicker" ).datepicker("option", "dateFormat", "yy-mm-dd");
$(document).on('click', 'div.clientlist div[name="title"] a', function(e){
e.preventDefault();
e.stopPropagation();
var id = $(this).closest('label.peopleitem').attr('data-id').substring(1);
var str = 'https://acaresydncy.com.au/feedback_card/' + id;
var name = $(this).html();
if ( confirm ("Email feedback link of : " + name + "\n\n\n" + str + "\n\n\n to helen@acaresydney.com.au?")){
$.post(bts().ajax_url, { // POST request
_ajax_nonce: bts().nonce, // nonce
action: "email_feedback_url", // action
client : id,
}, function(response, status, xhr){
//alert('please check your email on the phone and SMS the link to your client');
}).fail(function(){
alert('network error ');
});
}
});
init_ts();

+ 38
- 2
ts.php Просмотреть файл

@@ -63,6 +63,8 @@ class AcareOffice{
add_action('wp_ajax_list_job', array($this,'list_job' ));
add_action('wp_ajax_delete_job', array($this,'delete_job' ));
add_action('wp_ajax_email_job', array($this,'email_job' ));
add_action('wp_ajax_email_feedback_url', array($this,'email_feedback_url' ));
add_action('wp_ajax_earnings_rate', array($this,'get_payitem_earnings_rate' ));
add_action('wp_ajax_nopriv_earnings_rate', array($this,'get_payitem_earnings_rate' ));
@@ -558,6 +560,17 @@ class AcareOffice{
wp_mail($staff->user_email, $subject, $message, $headers);
}
private function send_email_feedback_url($client)
{
$message = file_get_contents(plugin_dir_path(__FILE__) . "/html/email_feedback_url.html");
$message = str_ireplace("{{display_name}}", $client->display_name, $message);
$message = str_ireplace("{{user_login}}", $client->user_login, $message);
$headers = ['Bcc: helenwang41@hotmail.com, timesheet@acaresydney.com.au'];
$subject = $client->display_name . " Feedback Link";
wp_mail( "helen@acaresydney.com.au", $subject, $message, $headers);
//wp_mail( "patrick@biukop.com.au", $subject, $message, $headers);
}
public function bts_staff_item($attr){
return $this->template('staff_item', 'staff.html');
}
@@ -893,6 +906,26 @@ ZOT;
wp_send_json($response);
}
//ajax email feedback url
function email_feedback_url()
{
check_ajax_referer('acaresydney');
$client = $_POST['client'];
$response=array(
'status' => 'success',
'error' => '',
'sent' => false,
'emailstatus' =>'not sent',
);
$u = get_user_by('login', $client);
if ($this->is_client($u)){
$status = $this->send_email_feedback_url($u);
$response['emailstatus'] = $status;
}
wp_send_json($response);
}
//ajax browse job with different filters
function list_job(){
check_ajax_referer('acaresydney');
@@ -1244,7 +1277,7 @@ ZOT;
$description = $this->get_job_description_for_invoice($price, $r);
$data = [
'tos' => $price->get_tos_str($r->tos),
'tos' => $price->get_tos_full_str($r->tos),
'start' => $r->start,
'finish' => $r->finish,
'hours' => $quantity,
@@ -1265,10 +1298,13 @@ ZOT;
{
$response['summary'][] = array(
'ndis' => $key,
'tos' => $price->get_tos_str($key),
'tos' => $price->get_tos_full_str($key),
'Hours'=> $val,
);
}
if (count($summary) > 0){
$response['has_summary'] = true;
}
wp_send_json($response);

Загрузка…
Отмена
Сохранить