Przeglądaj źródła

moving client calculation to server for some browser does not support getWeekDay

master
patrick 6 lat temu
rodzic
commit
b40bd3db3a
2 zmienionych plików z 28 dodań i 12 usunięć
  1. +24
    -1
      UserJob.php
  2. +4
    -11
      js/feedback_card.js

+ 24
- 1
UserJob.php Wyświetl plik

@@ -75,7 +75,7 @@ class UserJob{
if ($this->db->last_error == ""){
$response['status'] = 'success';
foreach( $jobs as $s){
$response['jobs'][] = array(
$el = array(
'id' => $s->id,
'tos' => $s->tos,
'start'=> $s->start,
@@ -89,7 +89,16 @@ class UserJob{
'rate_str'=> $this->get_rate_str($s->rate),
'tos_str'=> $this->get_tos_str($s->tos),
'staff_name' => $this->get_display_name($s->staff),
//extra field for GUI
'hl_start_date' => $this->get_date_month($s->start),
'hl_start' => $this->get_hh_mm($s->start),
'hl_finish' => $this->get_hh_mm($s->finish),
'rated' => ($s->rating >=1 && $s->rating<=5)? 'rated': '',
'start_day' => $this->get_weekday_name($s->start),
'finish_day' => $this->get_weekday_name($s->finish),
);
$el['checked_' . $s->rating] = 'checked';
$response['jobs'][]=$el;
}
}else{
@@ -98,6 +107,20 @@ class UserJob{
}
return $response;
}
private function get_date_month($strdate){
$d = new \DateTime($strdate);
return $d->format('d/n');
}
private function get_hh_mm($strdate){
$d = new \DateTime($strdate);
return $d->format('H:i');
}

private function get_weekday_name($strdate){
$d = new \DateTime($strdate);
return $d->format("D");
}
private function get_rate_str($earnings_rate_id)
{

+ 4
- 11
js/feedback_card.js Wyświetl plik

@@ -22,7 +22,7 @@
finish: get_finish_date(),
}, function(response, status, xhr){
if (response.status == "success"){
pre_process(response);
//pre_process(response);
load_client_jobs(response);
}else{
display_error(response);
@@ -37,8 +37,8 @@
$.each(response.jobs, function(idx, val){

val.hl_start_date = get_hl_start_date(val.start);
val.hl_start = get_hl_start(val.start);
val.hl_finish = get_hl_finish(val.finish);
val.hl_start = get_hh_mm(val.start);
val.hl_finish = get_hh_mm(val.finish);
val.checked_1 = get_checked(1, val.rating);
val.checked_2 = get_checked(2, val.rating);
@@ -66,14 +66,7 @@
m = s.getMonth() + 1;
return dd +"/" + m;
}
function get_hl_start(start)
{
return get_hh_mm(start);
}
function get_hl_finish(finish)
{
return get_hh_mm(finish);
}

function get_hh_mm(date){
var s = new Date(date);
var hh = s.getHours();

Ładowanie…
Anuluj
Zapisz