mirror of
https://github.com/Karaka-Management/oms-ProjectManagement.git
synced 2026-01-11 07:38:40 +00:00
started with template fixes
This commit is contained in:
parent
1364ac768f
commit
acb7df796b
32
Admin/Routes/Web/Api.php
Normal file
32
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\ProjectManagement\Controller\ApiController;
|
||||
use Modules\ProjectManagement\Models\PermissionCategory;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/projectmanagement(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\ProjectManagement\Controller\ApiController:apiProjectCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::PROJECT,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -14,6 +14,16 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ProjectManagement\Controller;
|
||||
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use Modules\ProjectManagement\Models\ProgressType;
|
||||
use Modules\ProjectManagement\Models\Project;
|
||||
use Modules\ProjectManagement\Models\ProjectMapper;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
|
||||
/**
|
||||
* ProjectManagement api controller class.
|
||||
*
|
||||
|
|
@ -24,4 +34,99 @@ namespace Modules\ProjectManagement\Controller;
|
|||
*/
|
||||
final class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiProjectCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateProjectCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$project = $this->createProjectFromRequest($request);
|
||||
$this->createModel($request->header->account, $project, ProjectMapper::class, 'card', $request->getOrigin());
|
||||
|
||||
$this->createStandardCreateResponse($request, $response, $project);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create card from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return Project
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function createProjectFromRequest(RequestAbstract $request) : Project
|
||||
{
|
||||
$project = new Project();
|
||||
$project->name = $request->getDataString('name') ?? '';
|
||||
$project->descriptionRaw = $request->getDataString('plain') ?? '';
|
||||
$project->description = Markdown::parse($request->getDataString('plain') ?? '');
|
||||
$project->start = $request->getDataDateTime('start') ?? $project->start;
|
||||
$project->end = $request->getDataDateTime('end') ?? $project->end;
|
||||
$project->createdBy = new NullAccount($request->header->account);
|
||||
$project->progressType = ProgressType::tryFromValue($request->getDataInt('progresstype')) ?? ProgressType::MANUAL;
|
||||
$project->progress = $request->getDataInt('progress') ?? 0;
|
||||
$project->budgetCosts->value = $request->getDataInt('budgetcosts') ?? 0;
|
||||
$project->actualCosts->value = $request->getDataInt('actualcosts') ?? 0;
|
||||
|
||||
// @todo implement unit
|
||||
//$project->unit = $this->app->unitId;
|
||||
|
||||
if (!empty($uploadedFiles = $request->files)) {
|
||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||
[],
|
||||
[],
|
||||
$uploadedFiles,
|
||||
$request->header->account,
|
||||
__DIR__ . '/../../../Modules/Media/Files/Modules/ProjectManagement',
|
||||
'/Modules/ProjectManagement',
|
||||
);
|
||||
|
||||
foreach ($uploaded as $media) {
|
||||
$project->files[] = $media;
|
||||
}
|
||||
}
|
||||
|
||||
$mediaFiles = $request->getDataJson('media');
|
||||
foreach ($mediaFiles as $media) {
|
||||
$project->files[] = new NullMedia($media);
|
||||
}
|
||||
|
||||
return $project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate card create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateProjectCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['name'] = !$request->hasData('name'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ProjectManagement\Controller;
|
||||
|
||||
use Modules\ProjectManagement\Models\NullProject;
|
||||
use Modules\ProjectManagement\Models\ProjectMapper;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
|
|
@ -51,7 +52,7 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/ProjectManagement/Theme/Backend/projectmanagement-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001701001, $request, $response);
|
||||
|
||||
$projects = ProjectMapper::getAll()->sort('id', OrderType::DESC)->limit(25);
|
||||
$projects = ProjectMapper::getAll()->sort('id', OrderType::DESC)->limit(25)->executeGetArray();
|
||||
$view->data['projects'] = $projects;
|
||||
|
||||
return $view;
|
||||
|
|
@ -72,9 +73,11 @@ final class BackendController extends Controller
|
|||
public function viewProjectManagementCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/ProjectManagement/Theme/Backend/projectmanagement-create');
|
||||
$view->setTemplate('/Modules/ProjectManagement/Theme/Backend/projectmanagement-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001701001, $request, $response);
|
||||
|
||||
$view->data['project'] = new NullProject();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class Project
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(string $name = '')
|
||||
public function __construct()
|
||||
{
|
||||
$this->start = new \DateTime('now');
|
||||
$this->end = new \DateTime('now');
|
||||
|
|
@ -189,61 +189,6 @@ class Project
|
|||
$this->actualEarnings = new FloatInt();
|
||||
$this->budgetCosts = new FloatInt();
|
||||
$this->budgetEarnings = new FloatInt();
|
||||
|
||||
$this->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get progress type
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProgressType() : int
|
||||
{
|
||||
return $this->progressType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set progress type
|
||||
*
|
||||
* @param int $type Progress type
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProgressType(int $type) : void
|
||||
{
|
||||
$this->progressType = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Project name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name) : void
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->calendar->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -280,4 +225,5 @@ class Project
|
|||
|
||||
use \Modules\Media\Models\MediaListTrait;
|
||||
use \Modules\Attribute\Models\AttributeHolderTrait;
|
||||
// @todo implement tags
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\ProjectManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Project'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form>
|
||||
<table class="layout wf-100">
|
||||
<tr><td colspan="3"><label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<tr><td colspan="2"><input type="text" id="iName" name="name" placeholder="" required><td>
|
||||
<tr><td colspan="3"><label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<tr><td colspan="2"><textarea id="iDescription" name="description"></textarea><td>
|
||||
<tr><td colspan="3"><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
|
||||
<tr><td colspan="2"><select id="iStatus" name="status">
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectStatus::ACTIVE); ?>"><?= $this->getHtml('Active'); ?>
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectStatus::INACTIVE); ?>"><?= $this->getHtml('Inactive'); ?>
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectStatus::FINISHED); ?>"><?= $this->getHtml('Finished'); ?>
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectStatus::CANCELED); ?>"><?= $this->getHtml('Canceled'); ?>
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectStatus::HOLD); ?>"><?= $this->getHtml('Hold'); ?>
|
||||
</select><td>
|
||||
<tr><td colspan="3"><label for="iFiles"><?= $this->getHtml('Files'); ?></label>
|
||||
<tr><td colspan="2"><input type="file" id="iFiles" name="file" multiple><td>
|
||||
<tr><td><label for="iDue"><?= $this->getHtml('Start'); ?></label><td><label for="iDue"><?= $this->getHtml('Due'); ?></label><td>
|
||||
<tr><td><input type="datetime-local" id="iDue" name="due"><td><input type="datetime-local" id="iDue" name="due"><td>
|
||||
<tr><td><label for="iResponsibility"><?= $this->getHtml('Responsibility'); ?></label><td><label for="iUser"><?= $this->getHtml('UserGroup'); ?></label><td>
|
||||
<tr><td><select id="iStatus" name="status">
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectResponsibility::MANAGER); ?>"><?= $this->getHtml('Manager'); ?>
|
||||
<option value="<?= $this->printHtml(\Modules\ProjectManagement\Models\ProjectResponsibility::OTHER); ?>"><?= $this->getHtml('Other'); ?>
|
||||
</select>
|
||||
<td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iUser" name="user" placeholder=""></span><td><button><?= $this->getHtml('Add', '0', '0'); ?></button>
|
||||
<tr><td colspan="3"><label for="iBudget"><?= $this->getHtml('Budget'); ?></label>
|
||||
<tr><td colspan="2"><input type="text" id="iBudget" name="budget" placeholder=""><td>
|
||||
<tr><td colspan="3"><input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-project">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -37,12 +37,12 @@ echo $this->data['nav']->render(); ?>
|
|||
$url = \phpOMS\Uri\UriFactory::build('projectmanagement/view?{?}&id=' . $value->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Start'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getStart()->format('Y-m-d')); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Due'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getEnd()->format('Y-m-d')); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Start'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->start?->format('Y-m-d')); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Due'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->end?->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,51 +12,107 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\EventManagement\Models\ProgressType;
|
||||
|
||||
/** \Modules\ProjectManagement\Models\Project $project */
|
||||
$project = $this->data['project'];
|
||||
|
||||
$isNew = $project->id === 0;
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->printHtml($project->getName()); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form id="fProject" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/api}projectmanagement?{?}&csrf={$CSRF}'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tbody>
|
||||
<tr><td colspan="2"><label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<tr><td colspan="2"><input type="text" id="iName" name="name" placeholder="Name" value="<?= $this->printHtml($project->getName()); ?>" required>
|
||||
<tr><td><label for="iStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<td><label for="iEnd"><?= $this->getHtml('End'); ?></label>
|
||||
<tr><td><input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($project->getStart()->format('Y-m-d\TH:i:s')); ?>">
|
||||
<td><input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($project->getEnd()->format('Y-m-d\TH:i:s')); ?>">
|
||||
<tr><td colspan="2"><label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<tr><td colspan="2"><textarea id="iDescription" name="desc"><?= $this->printHtml($project->description); ?></textarea>
|
||||
<tr><td colspan="2"><label for="iProgressType"><?= $this->getHtml('Progress'); ?></label>
|
||||
<tr><td><select id="iProgressType" name="progressType">
|
||||
<option value="<?= \Modules\ProjectManagement\Models\ProgressType::MANUAL; ?>"><?= $this->getHtml('Manual'); ?>
|
||||
<option value="<?= \Modules\ProjectManagement\Models\ProgressType::LINEAR; ?>"><?= $this->getHtml('Linear'); ?>
|
||||
<option value="<?= \Modules\ProjectManagement\Models\ProgressType::EXPONENTIAL; ?>"><?= $this->getHtml('Exponential'); ?>
|
||||
<option value="<?= \Modules\ProjectManagement\Models\ProgressType::LOG; ?>"><?= $this->getHtml('Log'); ?>
|
||||
<option value="<?= \Modules\ProjectManagement\Models\ProgressType::TASKS; ?>"><?= $this->getHtml('Tasks'); ?>
|
||||
</select>
|
||||
<td><input type="text" id="iProgress" name="progress" value="<?= $project->getProgress(); ?>"<?= $project->getProgressType() !== \Modules\ProjectManagement\Models\ProgressType::MANUAL ? ' disabled' : ''; ?>>
|
||||
<tr><td><label for="iBudget"><?= $this->getHtml('Budget'); ?></label><td><label for="iActual"><?= $this->getHtml('Actual'); ?></label>
|
||||
<tr><td><input type="text" id="iBudget" name="budget" placeholder=""><td><input type="text" id="iActual" name="actual">
|
||||
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-projectmanagement-profile">
|
||||
</table>
|
||||
</form>
|
||||
<section class="portlet">
|
||||
<form id="fProject" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= \phpOMS\Uri\UriFactory::build('{/api}projectmanagement?{?}&csrf={$CSRF}'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('Project'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" name="id" id="iId" value="<?= $project->id; ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" id="iName" name="name" value="<?= $this->printHtml($project->name); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="flex-line">
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="iStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($project->start->format('Y-m-d\TH:i:s')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="iEnd"><?= $this->getHtml('End'); ?></label>
|
||||
<input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($project->end->format('Y-m-d\TH:i:s')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<textarea id="iDescription" name="desc"><?= $this->printHtml($project->description); ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iProgressType"><?= $this->getHtml('Progress'); ?></label>
|
||||
<div class="flex-line wf-100">
|
||||
<div>
|
||||
<select id="iProgressType" name="progressType">
|
||||
<option value="<?= ProgressType::MANUAL; ?>"><?= $this->getHtml('Manual'); ?>
|
||||
<option value="<?= ProgressType::LINEAR; ?>"><?= $this->getHtml('Linear'); ?>
|
||||
<option value="<?= ProgressType::EXPONENTIAL; ?>"><?= $this->getHtml('Exponential'); ?>
|
||||
<option value="<?= ProgressType::LOG; ?>"><?= $this->getHtml('Log'); ?>
|
||||
<option value="<?= ProgressType::TASKS; ?>"><?= $this->getHtml('Tasks'); ?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" id="iProgress" name="progress" value="<?= $project->progress; ?>"<?= $project->progressType !== ProgressType::MANUAL ? ' disabled' : ''; ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-line">
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="iBudget"><?= $this->getHtml('Budget'); ?></label><td>
|
||||
<input type="text" id="iBudget" name="budget">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="iActual"><?= $this->getHtml('Actual'); ?></label>
|
||||
<input type="text" id="iActual" name="actual">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($isNew) : ?>
|
||||
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
<?php else : ?>
|
||||
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="box wf-100">
|
||||
<?= $this->getData('tasklist')->render($project->tasks); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<?= $this->getData('calendar')->render($project->getCalendar()); ?>
|
||||
|
|
@ -66,11 +122,4 @@ echo $this->data['nav']->render(); ?>
|
|||
<?= $this->getData('medialist')->render($project->files); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="box wf-100">
|
||||
<header><h1>Finances</h1></header>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ final class ProjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$project = new Project();
|
||||
|
||||
$project->setName('Projectname');
|
||||
$project->name = 'Projectname';
|
||||
$project->description = 'Description';
|
||||
$project->createdBy = new NullAccount(1);
|
||||
$project->start = new \DateTime('2000-05-05');
|
||||
|
|
@ -60,7 +60,7 @@ final class ProjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$project->tasks[] = $task2;
|
||||
|
||||
$project->progress = 10;
|
||||
$project->setProgressType(ProgressType::TASKS);
|
||||
$project->progressType = ProgressType::TASKS;
|
||||
|
||||
$media = new Media();
|
||||
$media->createdBy = new NullAccount(1);
|
||||
|
|
@ -77,7 +77,7 @@ final class ProjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$projectR = ProjectMapper::get()->with('files')->where('id', $project->id)->execute();
|
||||
|
||||
self::assertEquals($project->getName(), $projectR->getName());
|
||||
self::assertEquals($project->name, $projectR->name);
|
||||
self::assertEquals($project->description, $projectR->description);
|
||||
self::assertEquals($project->budgetEarnings->getAmount(), $projectR->budgetEarnings->getAmount());
|
||||
self::assertEquals($project->budgetCosts->getAmount(), $projectR->budgetCosts->getAmount());
|
||||
|
|
@ -87,7 +87,7 @@ final class ProjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($project->start->format('Y-m-d'), $projectR->start->format('Y-m-d'));
|
||||
self::assertEquals($project->end->format('Y-m-d'), $projectR->end->format('Y-m-d'));
|
||||
self::assertEquals($project->progress, $projectR->progress);
|
||||
self::assertEquals($project->getProgressType(), $projectR->getProgressType());
|
||||
self::assertEquals($project->progressType, $projectR->progressType);
|
||||
|
||||
$expected = $project->files;
|
||||
$actual = $projectR->files;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->project->start->format('Y-m-d'));
|
||||
self::assertEquals((new \DateTime('now'))->modify('+1 month')->format('Y-m-d'), $this->project->end->format('Y-m-d'));
|
||||
self::assertEquals(0, $this->project->createdBy->id);
|
||||
self::assertEquals('', $this->project->getName());
|
||||
self::assertEquals('', $this->project->name);
|
||||
self::assertEquals('', $this->project->description);
|
||||
self::assertEquals(0, $this->project->budgetCosts->getInt());
|
||||
self::assertEquals(0, $this->project->budgetEarnings->getInt());
|
||||
|
|
@ -52,7 +52,7 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(0, $this->project->actualEarnings->getInt());
|
||||
self::assertEquals(0, $this->project->progress);
|
||||
self::assertEquals([], $this->project->files);
|
||||
self::assertEquals(ProgressType::MANUAL, $this->project->getProgressType());
|
||||
self::assertEquals(ProgressType::MANUAL, $this->project->progressType);
|
||||
self::assertEmpty($this->project->tasks);
|
||||
}
|
||||
|
||||
|
|
@ -63,13 +63,6 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(1, $this->project->createdBy->id);
|
||||
}
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testNameInputOutput() : void
|
||||
{
|
||||
$this->project->setName('Name');
|
||||
self::assertEquals('Name', $this->project->getName());
|
||||
}
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testDescriptionInputOutput() : void
|
||||
{
|
||||
|
|
@ -84,22 +77,15 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(10, $this->project->progress);
|
||||
}
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testProgressTypeInputOutput() : void
|
||||
{
|
||||
$this->project->setProgressType(ProgressType::TASKS);
|
||||
self::assertEquals(ProgressType::TASKS, $this->project->getProgressType());
|
||||
}
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->project->setName('Name');
|
||||
$this->project->name = 'Name';
|
||||
$this->project->description = 'Description';
|
||||
$this->project->start = new \DateTime();
|
||||
$this->project->end = new \DateTime();
|
||||
$this->project->progress = 10;
|
||||
$this->project->setProgressType(ProgressType::TASKS);
|
||||
$this->project->progressType = ProgressType::TASKS;
|
||||
|
||||
$serialized = $this->project->jsonSerialize();
|
||||
unset($serialized['calendar']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user