Merge pull request 'Sprint-4/MS-38-BE-Evaluation' (#55) from Sprint-4/MS-38-BE-Evaluation into master
Reviewed-on: #55
This commit is contained in:
commit
06ed7722fa
|
|
@ -0,0 +1,253 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Admin\app\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Services\JiraService;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Modules\Admin\app\Models\TechnicalUser;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\Admin\app\Models\UserCriteria;
|
||||||
|
use PhpOffice\PhpWord\IOFactory;
|
||||||
|
use PhpOffice\PhpWord\PhpWord;
|
||||||
|
|
||||||
|
class EvaluationController extends Controller
|
||||||
|
{
|
||||||
|
protected $jiraService;
|
||||||
|
|
||||||
|
public function __construct(JiraService $jiraService)
|
||||||
|
{
|
||||||
|
$this->jiraService = $jiraService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sprintReview(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'userID' => 'required|exists:users,id',
|
||||||
|
'fromDate' => 'nullable|date',
|
||||||
|
'toDate' => 'nullable|date',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$userEmail = User::findOrFail($request->input('userID'))->email;
|
||||||
|
|
||||||
|
$projects = $this->jiraService->getAllProjects();
|
||||||
|
|
||||||
|
$query = UserCriteria::where('user_email', $userEmail);
|
||||||
|
|
||||||
|
// Date filter
|
||||||
|
if ($request->filled('fromDate')) {
|
||||||
|
$fromDate = Carbon::parse($request->input('fromDate'));
|
||||||
|
$query->where('created_at', '>=', $fromDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('toDate')) {
|
||||||
|
$toDate = Carbon::parse($request->input('toDate'));
|
||||||
|
$query->where('created_at', '<=', $toDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End query
|
||||||
|
$userCriterias = $query->with(['sprint', 'criteria'])->get();
|
||||||
|
|
||||||
|
$projectsData = $userCriterias->groupBy('sprint.project_id')->map(function ($userCriteriasByProject, $projectId) use ($projects) {
|
||||||
|
$result = self::getProjectById($projects, $projectId);
|
||||||
|
return [
|
||||||
|
'name' => $result['name'],
|
||||||
|
'sprints' => $userCriteriasByProject->groupBy('sprint.id')->map(function ($userCriteriasBySprint) {
|
||||||
|
$sprint = $userCriteriasBySprint->first()->sprint;
|
||||||
|
return [
|
||||||
|
'name' => $sprint->name,
|
||||||
|
'criterias' => $userCriteriasBySprint->map(function ($userCriteria) {
|
||||||
|
$criteria = $userCriteria->criteria;
|
||||||
|
return [
|
||||||
|
'criteria' => $criteria->name,
|
||||||
|
'note' => $userCriteria->note ?? '',
|
||||||
|
'createdBy' => $userCriteria->created_by ?? '',
|
||||||
|
'point' => $userCriteria->point ?? '',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})->values()
|
||||||
|
];
|
||||||
|
})->values();
|
||||||
|
|
||||||
|
return AbstractController::ResultSuccess($projectsData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProjectById($projects, $inputId)
|
||||||
|
{
|
||||||
|
$filteredProjects = array_filter($projects, function ($project) use ($inputId) {
|
||||||
|
return $project['id'] == $inputId;
|
||||||
|
});
|
||||||
|
return array_values($filteredProjects) ? array_values($filteredProjects)[0] : array_values($filteredProjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function technical(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'user_id' => 'required|exists:users,id',
|
||||||
|
'keyword' => 'nullable|string'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::findOrFail($request->input('user_id'));
|
||||||
|
|
||||||
|
$query = TechnicalUser::query();
|
||||||
|
$query = TechnicalUser::where('user_id', $user->id);
|
||||||
|
|
||||||
|
if ($request->filled('keyword')) {
|
||||||
|
$keyword = '%' . $request->input('keyword') . '%';
|
||||||
|
$query->whereHas('technical', fn($q) => $q->where('name', 'like', $keyword))
|
||||||
|
->with('technical');
|
||||||
|
} else {
|
||||||
|
$query->with('technical');
|
||||||
|
}
|
||||||
|
|
||||||
|
$technical_users = $query->where('point', '>', 0)->get();
|
||||||
|
|
||||||
|
return AbstractController::ResultSuccess(
|
||||||
|
$technical_users
|
||||||
|
->map(function ($user) {
|
||||||
|
return [
|
||||||
|
'id' => $user->id,
|
||||||
|
'point' => $user->point,
|
||||||
|
'updated_at' => $user->updated_at,
|
||||||
|
'technical' => [
|
||||||
|
'id' => $user->technical->id,
|
||||||
|
'name' => $user->technical->name,
|
||||||
|
'level' => $user->technical->level,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function report(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'userID' => 'required|exists:users,id',
|
||||||
|
'fromDate' => 'nullable|date',
|
||||||
|
'toDate' => 'nullable|date',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Query User
|
||||||
|
$user = User::findOrFail($request->input('userID'));
|
||||||
|
$userEmail = $user->email;
|
||||||
|
|
||||||
|
// Query User Criteria
|
||||||
|
$query = UserCriteria::where('user_email', $userEmail);
|
||||||
|
|
||||||
|
if ($request->filled('fromDate')) {
|
||||||
|
$fromDate = Carbon::parse($request->input('fromDate'));
|
||||||
|
$query->where('created_at', '>=', $fromDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('toDate')) {
|
||||||
|
$toDate = Carbon::parse($request->input('toDate'));
|
||||||
|
$query->where('created_at', '<=', $toDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
$userCriterias = $query->with(['sprint', 'criteria'])->get();
|
||||||
|
|
||||||
|
|
||||||
|
// Structure projects data
|
||||||
|
$projects = $this->jiraService->getAllProjects();
|
||||||
|
|
||||||
|
$projectsData = $userCriterias->groupBy('sprint.project_id')->map(function ($userCriteriasByProject, $projectId) use ($projects) {
|
||||||
|
$result = self::getProjectById($projects, $projectId);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $result['name'],
|
||||||
|
'sprints' => $userCriteriasByProject->groupBy('sprint.id')->map(function ($userCriteriasBySprint) {
|
||||||
|
$sprint = $userCriteriasBySprint->first()->sprint;
|
||||||
|
return [
|
||||||
|
'name' => $sprint->name,
|
||||||
|
'criterias' => $userCriteriasBySprint->map(function ($userCriteria) {
|
||||||
|
$criteria = $userCriteria->criteria;
|
||||||
|
return [
|
||||||
|
'criteria' => $criteria->name,
|
||||||
|
'note' => $userCriteria->note ?? '',
|
||||||
|
'createdBy' => $userCriteria->created_by ?? '',
|
||||||
|
'point' => $userCriteria->point ?? '',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})->values()
|
||||||
|
];
|
||||||
|
})->values();
|
||||||
|
|
||||||
|
// Generate Word document
|
||||||
|
$phpWord = new PhpWord();
|
||||||
|
$phpWord->setDefaultFontName('Times New Roman');
|
||||||
|
$phpWord->setDefaultFontSize(12);
|
||||||
|
$section = $phpWord->addSection();
|
||||||
|
|
||||||
|
$section->addText('Staff Evaluation', [
|
||||||
|
'bold' => true,
|
||||||
|
'size' => 20,
|
||||||
|
'color' => '000000',
|
||||||
|
], [
|
||||||
|
'align' => 'center',
|
||||||
|
'spaceAfter' => 600,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->filled('fromDate')) {
|
||||||
|
$fromDate = Carbon::parse($request->input('fromDate'));
|
||||||
|
$section->addText("From: " . $fromDate->format('d-m-Y'), ['name' => 'Times New Roman', 'size' => 12], ['align' => 'end']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->filled('toDate')) {
|
||||||
|
$toDate = Carbon::parse($request->input('toDate'));
|
||||||
|
$section->addText("To: " . $toDate->format('d-m-Y'), ['name' => 'Times New Roman', 'size' => 12], ['align' => 'end']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$section->addText("{$user->name}", [
|
||||||
|
'bold' => true,
|
||||||
|
'size' => 14,
|
||||||
|
'color' => '000000',
|
||||||
|
], [
|
||||||
|
'spaceAfter' => 400,
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($projectsData as $project) {
|
||||||
|
$section->addText("Project: {$project['name']}", ['bold' => true, 'size' => 14, 'color' => '000080']);
|
||||||
|
|
||||||
|
foreach ($project['sprints'] as $sprint) {
|
||||||
|
$section->addText("Sprint: {$sprint['name']}", ['bold' => true, 'italic' => true, 'size' => 12, 'color' => '000000']);
|
||||||
|
|
||||||
|
$table = $section->addTable([
|
||||||
|
'borderColor' => '000000',
|
||||||
|
'borderSize' => 6,
|
||||||
|
'cellMargin' => 80,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$table->addRow();
|
||||||
|
$table->addCell(2000)->addText('Criteria', ['bold' => true]);
|
||||||
|
$table->addCell(2000)->addText('Note', ['bold' => true]);
|
||||||
|
$table->addCell(2000)->addText('Created By', ['bold' => true]);
|
||||||
|
$table->addCell(2000)->addText('Points', ['bold' => true]);
|
||||||
|
|
||||||
|
foreach ($sprint['criterias'] as $criteria) {
|
||||||
|
$table->addRow();
|
||||||
|
$table->addCell(2000)->addText($criteria['criteria']);
|
||||||
|
$table->addCell(2000)->addText($criteria['note']);
|
||||||
|
$table->addCell(2000)->addText($criteria['createdBy']);
|
||||||
|
$table->addCell(2000)->addText($criteria['point']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$section->addText(' ', [], [
|
||||||
|
'spaceAfter' => 600,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$section->addText(' ', [], [
|
||||||
|
'spaceAfter' => 600,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tempFile = tempnam(sys_get_temp_dir(), 'word');
|
||||||
|
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
|
||||||
|
$objWriter->save($tempFile);
|
||||||
|
|
||||||
|
return response()->download($tempFile, "$user->name.docx")->deleteFileAfterSend(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ use Modules\Admin\app\Http\Controllers\TicketController;
|
||||||
use Modules\Admin\app\Http\Controllers\TimekeepingController;
|
use Modules\Admin\app\Http\Controllers\TimekeepingController;
|
||||||
use Modules\Admin\app\Http\Controllers\TrackingController;
|
use Modules\Admin\app\Http\Controllers\TrackingController;
|
||||||
use Modules\Admin\app\Http\Controllers\CriteriasController;
|
use Modules\Admin\app\Http\Controllers\CriteriasController;
|
||||||
|
use Modules\Admin\app\Http\Controllers\EvaluationController;
|
||||||
use Modules\Admin\app\Http\Controllers\ProfileController;
|
use Modules\Admin\app\Http\Controllers\ProfileController;
|
||||||
use Modules\Admin\app\Http\Controllers\TechnicalController;
|
use Modules\Admin\app\Http\Controllers\TechnicalController;
|
||||||
use Modules\Admin\app\Http\Controllers\TestCaseForSprintController;
|
use Modules\Admin\app\Http\Controllers\TestCaseForSprintController;
|
||||||
|
|
@ -175,6 +176,14 @@ Route::middleware('api')
|
||||||
Route::post('/profiles-data/update', [ProfileController::class, 'updateProfilesData'])->middleware('check.permission:admin.hr.staff.tester');
|
Route::post('/profiles-data/update', [ProfileController::class, 'updateProfilesData'])->middleware('check.permission:admin.hr.staff.tester');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::group([
|
||||||
|
'prefix' => 'evaluation',
|
||||||
|
], function () {
|
||||||
|
Route::get('/sprint-review', [EvaluationController::class, 'sprintReview'])->middleware('check.permission:admin');
|
||||||
|
Route::get('/technical', [EvaluationController::class, 'technical'])->middleware('check.permission:admin');
|
||||||
|
Route::get('/report', [EvaluationController::class, 'report'])->middleware('check.permission:admin');
|
||||||
|
});
|
||||||
|
|
||||||
Route::group([
|
Route::group([
|
||||||
'prefix' => 'technical',
|
'prefix' => 'technical',
|
||||||
], function () {
|
], function () {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exports;
|
||||||
|
|
||||||
|
use App\Models\Technical;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
|
use Modules\Admin\app\Models\Technical as ModelsTechnical;
|
||||||
|
|
||||||
|
class TechnicalsExport implements FromCollection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Support\Collection
|
||||||
|
*/
|
||||||
|
public function collection()
|
||||||
|
{
|
||||||
|
return ModelsTechnical::all();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
"laravel/ui": "^4.3",
|
"laravel/ui": "^4.3",
|
||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"nwidart/laravel-modules": "^10.0",
|
"nwidart/laravel-modules": "^10.0",
|
||||||
|
"phpoffice/phpword": "^1.3",
|
||||||
"pion/laravel-chunk-upload": "^1.5",
|
"pion/laravel-chunk-upload": "^1.5",
|
||||||
"predis/predis": "^2.2",
|
"predis/predis": "^2.2",
|
||||||
"simplesoftwareio/simple-qrcode": "^4.2",
|
"simplesoftwareio/simple-qrcode": "^4.2",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "6bac35902964ded629f238acceaf2c81",
|
"content-hash": "3c46ab46834a4aa1178208be43c9e064",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
|
|
@ -3389,6 +3389,58 @@
|
||||||
],
|
],
|
||||||
"time": "2024-01-28T10:04:15+00:00"
|
"time": "2024-01-28T10:04:15+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpoffice/math",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPOffice/Math.git",
|
||||||
|
"reference": "fc2eb6d1a61b058d5dac77197059db30ee3c8329"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPOffice/Math/zipball/fc2eb6d1a61b058d5dac77197059db30ee3c8329",
|
||||||
|
"reference": "fc2eb6d1a61b058d5dac77197059db30ee3c8329",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-xml": "*",
|
||||||
|
"php": "^7.1|^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^0.12.88 || ^1.0.0",
|
||||||
|
"phpunit/phpunit": "^7.0 || ^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpOffice\\Math\\": "src/Math/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Progi1984",
|
||||||
|
"homepage": "https://lefevre.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Math - Manipulate Math Formula",
|
||||||
|
"homepage": "https://phpoffice.github.io/Math/",
|
||||||
|
"keywords": [
|
||||||
|
"MathML",
|
||||||
|
"officemathml",
|
||||||
|
"php"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/PHPOffice/Math/issues",
|
||||||
|
"source": "https://github.com/PHPOffice/Math/tree/0.2.0"
|
||||||
|
},
|
||||||
|
"time": "2024-08-12T07:30:45+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpoffice/phpspreadsheet",
|
"name": "phpoffice/phpspreadsheet",
|
||||||
"version": "1.29.1",
|
"version": "1.29.1",
|
||||||
|
|
@ -3494,6 +3546,115 @@
|
||||||
},
|
},
|
||||||
"time": "2024-09-03T00:55:32+00:00"
|
"time": "2024-09-03T00:55:32+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpoffice/phpword",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPOffice/PHPWord.git",
|
||||||
|
"reference": "8392134ce4b5dba65130ba956231a1602b848b7f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/8392134ce4b5dba65130ba956231a1602b848b7f",
|
||||||
|
"reference": "8392134ce4b5dba65130ba956231a1602b848b7f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-xml": "*",
|
||||||
|
"php": "^7.1|^8.0",
|
||||||
|
"phpoffice/math": "^0.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dompdf/dompdf": "^2.0",
|
||||||
|
"ext-gd": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"ext-zip": "*",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.3",
|
||||||
|
"mpdf/mpdf": "^8.1",
|
||||||
|
"phpmd/phpmd": "^2.13",
|
||||||
|
"phpstan/phpstan-phpunit": "@stable",
|
||||||
|
"phpunit/phpunit": ">=7.0",
|
||||||
|
"symfony/process": "^4.4 || ^5.0",
|
||||||
|
"tecnickcom/tcpdf": "^6.5"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"dompdf/dompdf": "Allows writing PDF",
|
||||||
|
"ext-gd2": "Allows adding images",
|
||||||
|
"ext-xmlwriter": "Allows writing OOXML and ODF",
|
||||||
|
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
|
||||||
|
"ext-zip": "Allows writing OOXML and ODF"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpOffice\\PhpWord\\": "src/PhpWord"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-3.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Baker"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Gabriel Bull",
|
||||||
|
"email": "me@gabrielbull.com",
|
||||||
|
"homepage": "http://gabrielbull.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Franck Lefevre",
|
||||||
|
"homepage": "https://rootslabs.net/blog/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ivan Lanin",
|
||||||
|
"homepage": "http://ivan.lanin.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Roman Syroeshko",
|
||||||
|
"homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Antoine de Troostembergh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
|
||||||
|
"homepage": "https://phpoffice.github.io/PHPWord/",
|
||||||
|
"keywords": [
|
||||||
|
"ISO IEC 29500",
|
||||||
|
"OOXML",
|
||||||
|
"Office Open XML",
|
||||||
|
"OpenDocument",
|
||||||
|
"OpenXML",
|
||||||
|
"PhpOffice",
|
||||||
|
"PhpWord",
|
||||||
|
"Rich Text Format",
|
||||||
|
"WordprocessingML",
|
||||||
|
"doc",
|
||||||
|
"docx",
|
||||||
|
"html",
|
||||||
|
"odf",
|
||||||
|
"odt",
|
||||||
|
"office",
|
||||||
|
"pdf",
|
||||||
|
"php",
|
||||||
|
"reader",
|
||||||
|
"rtf",
|
||||||
|
"template",
|
||||||
|
"template processor",
|
||||||
|
"word",
|
||||||
|
"writer"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/PHPOffice/PHPWord/issues",
|
||||||
|
"source": "https://github.com/PHPOffice/PHPWord/tree/1.3.0"
|
||||||
|
},
|
||||||
|
"time": "2024-08-30T18:03:42+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpoption/phpoption",
|
"name": "phpoption/phpoption",
|
||||||
"version": "1.9.3",
|
"version": "1.9.3",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -74,3 +74,6 @@ export const createTestCase = API_URL + 'v1/admin/criterias/test-cases'
|
||||||
//Profile
|
//Profile
|
||||||
export const getProfilesData = API_URL + 'v1/admin/criterias/profiles-data'
|
export const getProfilesData = API_URL + 'v1/admin/criterias/profiles-data'
|
||||||
export const updateProfilesData = API_URL + 'v1/admin/criterias/profiles-data/update'
|
export const updateProfilesData = API_URL + 'v1/admin/criterias/profiles-data/update'
|
||||||
|
|
||||||
|
export const evaluation = API_URL + 'v1/admin/evaluation/report'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { getProfilesData } from '@/api/Admin'
|
import { evaluation, getProfilesData } from '@/api/Admin'
|
||||||
import DataTableAll from '@/components/DataTable/DataTable'
|
import DataTableAll from '@/components/DataTable/DataTable'
|
||||||
import ProjectInvolvement from '@/components/ProjectInvolvement/ProjectInvolvement'
|
import ProjectInvolvement from '@/components/ProjectInvolvement/ProjectInvolvement'
|
||||||
import { get } from '@/rtk/helpers/apiService'
|
import { get } from '@/rtk/helpers/apiService'
|
||||||
|
|
@ -8,6 +8,7 @@ import { notifications } from '@mantine/notifications'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import classes from './StaffEvaluation.module.css'
|
import classes from './StaffEvaluation.module.css'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
id: number
|
id: number
|
||||||
|
|
@ -81,6 +82,37 @@ const StaffEvaluation = () => {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const downloadFile = async () => {
|
||||||
|
await axios({
|
||||||
|
url: evaluation,
|
||||||
|
method: 'GET',
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwMDAvYXBpL3YxL2FkbWluL2xvZ2luIiwiaWF0IjoxNzI2ODE3ODU3LCJleHAiOjE3MjY5MDQyNTcsIm5iZiI6MTcyNjgxNzg1NywianRpIjoid0kzeXM5SGZiV21wS3pONSIsInN1YiI6IjE2IiwicHJ2IjoiZDJmZjI5MzM5YThhM2U4MmMzNTgyYTVhOGU3MzlkZjE3ODliYjEyZiJ9.oEHW0cIlQkawYQMVZnz5TZ5twzY18301eLmXjC55LfY`,
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
...filter,
|
||||||
|
userID: 3,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
const fileURL = window.URL.createObjectURL(new Blob([response.data]))
|
||||||
|
const fileLink = document.createElement('a')
|
||||||
|
|
||||||
|
fileLink.href = fileURL
|
||||||
|
fileLink.setAttribute('download', 'RENAME_WORD_FILE.docx') // -------------> RENAME_WORD_FILE
|
||||||
|
document.body.appendChild(fileLink)
|
||||||
|
|
||||||
|
fileLink.click()
|
||||||
|
|
||||||
|
fileLink.remove()
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error downloading the file:', error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const result = await getListProfilesData()
|
const result = await getListProfilesData()
|
||||||
|
|
@ -193,10 +225,7 @@ const StaffEvaluation = () => {
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
// m={5}
|
// m={5}
|
||||||
onClick={() => {
|
onClick={() => downloadFile()}
|
||||||
// setAction('add')
|
|
||||||
// form.reset()
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Export
|
Export
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,6 @@ openpyxl
|
||||||
pyzbar
|
pyzbar
|
||||||
opencv-python
|
opencv-python
|
||||||
qrcode
|
qrcode
|
||||||
pyautogui
|
pyautogui
|
||||||
|
requests
|
||||||
|
pillow
|
||||||
Loading…
Reference in New Issue