OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
42
app/Domain/Reports/Hxcontrollers/Outcome.php
Normal file
42
app/Domain/Reports/Hxcontrollers/Outcome.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Leantime\Domain\Reports\Hxcontrollers;
|
||||
|
||||
use Leantime\Core\Controller\HtmxController;
|
||||
use Leantime\Domain\Tickets\Services\Tickets as TicketService;
|
||||
|
||||
/**
|
||||
* Inline outcome & impact capture on the report screens: saves the narrative onto the
|
||||
* milestone and re-renders the outcome block in place.
|
||||
*/
|
||||
class Outcome extends HtmxController
|
||||
{
|
||||
protected static string $view = 'reports::partials.outcome';
|
||||
|
||||
private TicketService $ticketService;
|
||||
|
||||
public function init(TicketService $ticketService): void
|
||||
{
|
||||
$this->ticketService = $ticketService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists the outcome narrative. patchTicket() authorizes editor+ against the
|
||||
* milestone's own project, so a smuggled milestone id can't cross projects.
|
||||
*/
|
||||
public function save(): void
|
||||
{
|
||||
$milestoneId = (int) ($_POST['milestoneId'] ?? 0);
|
||||
$outcomeImpact = trim((string) ($_POST['outcomeImpact'] ?? ''));
|
||||
|
||||
$this->ticketService->patchTicket($milestoneId, ['outcomeImpact' => $outcomeImpact]);
|
||||
|
||||
$milestone = $this->ticketService->getTicket($milestoneId);
|
||||
|
||||
$this->tpl->assign('milestone', $milestone);
|
||||
$this->tpl->assign('canEdit', true);
|
||||
$this->tpl->setNotification($this->language->__('notifications.outcome_saved'), 'success');
|
||||
}
|
||||
}
|
||||
39
app/Domain/Reports/Hxcontrollers/ProjectReport.php
Normal file
39
app/Domain/Reports/Hxcontrollers/ProjectReport.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Leantime\Domain\Reports\Hxcontrollers;
|
||||
|
||||
use Leantime\Core\Controller\HtmxController;
|
||||
use Leantime\Domain\Reports\Models\ReportPeriod;
|
||||
use Leantime\Domain\Reports\Services\ReportEngine;
|
||||
|
||||
/**
|
||||
* Re-renders the project report body when the period filter changes (the page shell with
|
||||
* header and period picker stays in place).
|
||||
*/
|
||||
class ProjectReport extends HtmxController
|
||||
{
|
||||
protected static string $view = 'reports::partials.projectReportBody';
|
||||
|
||||
private ReportEngine $reportEngine;
|
||||
|
||||
public function init(ReportEngine $reportEngine): void
|
||||
{
|
||||
$this->reportEngine = $reportEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the report body for the requested period. Authorization happens in the engine
|
||||
* (reports.view per project) — an unauthorized project yields an empty report.
|
||||
*/
|
||||
public function get(): void
|
||||
{
|
||||
$projectId = (int) session('currentProject');
|
||||
$period = ReportPeriod::fromRequest($this->incomingRequest->query->all());
|
||||
|
||||
$this->tpl->assign('projectId', $projectId);
|
||||
$this->tpl->assign('period', $period);
|
||||
$this->tpl->assign('report', $this->reportEngine->buildReport([$projectId], $period));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user