update allocation
This commit is contained in:
parent
d4c3ead9cb
commit
4ab40c3523
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\User;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Promise\Utils;
|
||||
|
||||
|
|
@ -108,6 +109,39 @@ class JiraService
|
|||
return json_decode($response->getBody()->getContents(), true);
|
||||
}
|
||||
|
||||
public function getUserByEmail($email)
|
||||
{
|
||||
|
||||
$response = $this->client->get("/rest/api/3/user/search?query={$email}", [
|
||||
'headers' => [
|
||||
'Authorization' => $this->authHeader,
|
||||
'Accept' => 'application/json'
|
||||
]
|
||||
]);
|
||||
|
||||
if ($response->getStatusCode() == 200) {
|
||||
return json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getUsersByEmails($all_users)
|
||||
{
|
||||
$users = [];
|
||||
|
||||
foreach ($all_users as $user) {
|
||||
$user_info = $this->getUserByEmail($user->email);
|
||||
|
||||
if (isset($user_info[0]['self'])) {
|
||||
$user_info[0]['emailAddress'] = $user->email;
|
||||
$users[] = $user_info;
|
||||
}
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
public function getUserWorkLogs($accountId, $startDate, $endDate)
|
||||
{
|
||||
$body = [
|
||||
|
|
@ -191,11 +225,14 @@ class JiraService
|
|||
|
||||
public function getAllUserDoing()
|
||||
{
|
||||
$users = $this->getAllUsers();
|
||||
$all_users = User::all();
|
||||
$users = $this->getUsersByEmails($all_users);
|
||||
// $projects = $this->getAllProjects();
|
||||
$groupedIssues = [];
|
||||
$users_data = [];
|
||||
$user_warning = [];
|
||||
foreach ($users as $user) {
|
||||
$user = $user[0];
|
||||
$users_data[$user['displayName']]['user'] = $user;
|
||||
$users_data[$user['displayName']]['total_spent'] = 0;
|
||||
$users_data[$user['displayName']]['total_est'] = 0;
|
||||
|
|
@ -216,6 +253,10 @@ class JiraService
|
|||
|
||||
$issues = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
if(count($issues['issues']) == 0){
|
||||
$user_warning[] = $user;
|
||||
}
|
||||
|
||||
foreach ($issues['issues'] as $issue) {
|
||||
$projectName = $issue['fields']['project']['name'];
|
||||
$username = $issue['fields']['assignee']['displayName'];
|
||||
|
|
@ -245,7 +286,7 @@ class JiraService
|
|||
|
||||
|
||||
|
||||
return ['projects' => $groupedIssues, 'users' => $users_data];
|
||||
return ['projects' => $groupedIssues, 'users' => $users_data, 'warningList' => $user_warning];
|
||||
// return $projects;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
.blinking-background {
|
||||
/* Đặt thời gian nhấp nháy */
|
||||
animation: blinkBackground 1s infinite;
|
||||
}
|
||||
|
||||
@keyframes blinkBackground {
|
||||
0% {
|
||||
background-color: #ffa200; /* Màu vàng */
|
||||
}
|
||||
50% {
|
||||
background-color: #ffffff; /* Màu xanh */
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
100% {
|
||||
background-color: #ffa200; /* Màu vàng */
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -186,12 +186,10 @@ const mainRoutes = [
|
|||
<Allocation />
|
||||
</>
|
||||
}
|
||||
></BasePage>
|
||||
></BasePage>
|
||||
</ProtectedRoute>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/profile',
|
||||
)},
|
||||
{path: '/profile',
|
||||
element: (
|
||||
<ProtectedRoute mode="route" permission="admin,hr">
|
||||
<BasePage
|
||||
|
|
|
|||
Loading…
Reference in New Issue