commit
0ae9a4c19c
|
@ -97,9 +97,9 @@ function apiRouter (FastRoute\RouteCollector $r) {
|
|||
requireLogin() || accessDenied();
|
||||
$users->online_time_update();
|
||||
if($users->hasRole(Role::FULL_VIEWER)) {
|
||||
$response = $db->select("SELECT * FROM `".DB_PREFIX."_profiles` ORDER BY available DESC, chief DESC, services ASC, trainings DESC, availability_minutes DESC, name ASC WHERE `hidden` = 0");
|
||||
$response = $db->select("SELECT * FROM `".DB_PREFIX."_profiles` WHERE `hidden` = 0 ORDER BY available DESC, chief DESC, services ASC, trainings DESC, availability_minutes ASC, name ASC");
|
||||
} else {
|
||||
$response = $db->select("SELECT `id`, `chief`, `online_time`, `available`, `availability_minutes`, `name`, `driver`, `services` FROM `".DB_PREFIX."_profiles` ORDER BY available DESC, chief DESC, services ASC, trainings DESC, availability_minutes DESC, name ASC WHERE `hidden` = 0");
|
||||
$response = $db->select("SELECT `id`, `chief`, `online_time`, `available`, `availability_minutes`, `name`, `driver`, `services` FROM `".DB_PREFIX."_profiles` WHERE `hidden` = 0 ORDER BY available DESC, chief DESC, services ASC, trainings DESC, availability_minutes ASC, name ASC");
|
||||
}
|
||||
apiResponse(
|
||||
!is_null($response) ? $response : []
|
||||
|
|
|
@ -61,16 +61,16 @@ function sendTelegramNotification($message)
|
|||
$chats = $db->select("SELECT * FROM `".DB_PREFIX."_bot_telegram_notifications`");
|
||||
if(!is_null($chats)) {
|
||||
foreach ($chats as $chat) {
|
||||
if($chat['last_notification'] === $message) continue;
|
||||
if(urldecode($chat['last_notification']) === $message) continue;
|
||||
$chat = $chat['chat_id'];
|
||||
$Bot->sendMessage([
|
||||
"chat_id" => $chat,
|
||||
"text" => $message
|
||||
]);
|
||||
$db->update(
|
||||
"`".DB_PREFIX."_bot_telegram_notifications`",
|
||||
["last_notification" => $message],
|
||||
["id" => $chat["id"]]
|
||||
DB_PREFIX."_bot_telegram_notifications",
|
||||
["last_notification" => urlencode($message)],
|
||||
["chat_id" => $chat]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ class Services {
|
|||
|
||||
public function increment_counter($increment)
|
||||
{
|
||||
$increment = str_replace(";", ",", $increment);
|
||||
$increment = implode(",", array_unique(explode(",", str_replace(";", ",", $increment))));
|
||||
$this->db->exec(
|
||||
"UPDATE `".DB_PREFIX."_profiles` SET `services`= services + 1 WHERE id IN ($increment)"
|
||||
);
|
||||
|
@ -369,7 +369,7 @@ class Services {
|
|||
|
||||
public function decrement_counter($decrement)
|
||||
{
|
||||
$decrement = str_replace(";", ",", $decrement);
|
||||
$decrement = implode(",", array_unique(explode(",", str_replace(";", ",", $decrement))));
|
||||
$this->db->exec(
|
||||
"UPDATE `".DB_PREFIX."_profiles` SET `services`= services - 1 WHERE id IN ($decrement)"
|
||||
);
|
||||
|
@ -392,7 +392,7 @@ class Services {
|
|||
);
|
||||
$serviceId = $this->db->getLastInsertId();
|
||||
|
||||
$this->increment_counter($chief.";".$drivers.";".$crew);
|
||||
$this->increment_counter($chief.",".$drivers.",".$crew);
|
||||
logger("Service added");
|
||||
|
||||
return $serviceId;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<label>Altri membri della squadra</label>
|
||||
<br>
|
||||
<ng-container *ngFor="let user of users">
|
||||
<div class="form-check" *ngIf="!user.chief && !user.driver">
|
||||
<div class="form-check" *ngIf="!user.chief">
|
||||
<input class="form-check-input crew-{{ user.id }}" [class.is-invalid]="!isFieldValid('crew')"
|
||||
(change)="onCrewCheckboxChange($event)" [checked]="isCrewSelected(user.id)" type="checkbox" value='{{ user.id }}'>
|
||||
<label class="form-check-label" for="crew-{{ user.id }}">
|
||||
|
|
|
@ -77,11 +77,7 @@
|
|||
<td>{{ row.chief }}</td>
|
||||
<td>{{ row.drivers }}</td>
|
||||
<td>{{ row.crew }}</td>
|
||||
<td>
|
||||
<img class="cursor-pointer" src="./api/place_image?lat={{ row.lat }}&lng={{ row.lng }}" (click)="openPlaceDetails(row.lat, row.lng)">
|
||||
<br>
|
||||
{{ row.place_name }}
|
||||
</td>
|
||||
<td>{{ row.place_name }}</td>
|
||||
<td>{{ row.notes }}</td>
|
||||
<td>{{ row.type }}</td>
|
||||
<td hidden><i class="fa fa-edit"></i></td>
|
||||
|
|
Loading…
Reference in New Issue