Auditor diff draft

This commit is contained in:
Dennis Eichhorn 2019-02-14 23:43:06 +01:00
parent f6c0394405
commit 265a4a0d5c
4 changed files with 15 additions and 12 deletions

View File

@ -103,9 +103,10 @@ final class ApiController extends Controller
*/
public function apiUnitSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$unit = $this->updateUnitFromRequest($request);
$this->updateModel($request, $unit, $unit, UnitMapper::class, 'unit');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully updated.', $unit);
$old = clone UnitMapper::get((int) $request->getData('id'));
$new = $this->updateUnitFromRequest($request);
$this->updateModel($request, $old, $new, UnitMapper::class, 'unit');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully updated.', $new);
}
/**
@ -282,9 +283,10 @@ final class ApiController extends Controller
*/
public function apiPositionSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$position = $this->updatePositionFromRequest($request);
$this->updateModel($request, $position, $position, PositionMapper::class, 'position');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully updated.', $position);
$old = clone PositionMapper::get((int) $request->getData('id'));
$new = $this->updatePositionFromRequest($request);
$this->updateModel($request, $old, $new, PositionMapper::class, 'position');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully updated.', $new);
}
/**
@ -426,9 +428,10 @@ final class ApiController extends Controller
*/
public function apiDepartmentSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$department = $this->updateDepartmentFromRequest($request);
$this->updateModel($request, $department, $department, DepartmentMapper::class, 'department');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $department);
$old = clone DepartmentMapper::get((int) $request->getData('id'));
$new = $this->updateDepartmentFromRequest($request);
$this->updateModel($request, $old, $new, DepartmentMapper::class, 'department');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $new);
}
/**

View File

@ -21,7 +21,7 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Department') ?></h1></header>
<div class="inner">
<form id="fDepartmentCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/rootPath}{/lang}/api/organization/department'); ?>">
<form id="fDepartmentCreate" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/rootPath}{/lang}/api/organization/department'); ?>">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
<tr><td><input type="text" name="name" id="iName" placeholder="&#xf040; R&D" required>

View File

@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Department') ?></h1></header>
<div class="inner">
<form id="iDepartment" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/backend/organization/department?{?}') ?>" method="PUT">
<form id="iDepartment" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/api/organization/department?{?}') ?>" method="POST">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
<tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($department->getName()); ?>">

View File

@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Position') ?></h1></header>
<div class="inner">
<form id="iPosition" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/backend/organization/position?{?}') ?>" method="PUT">
<form id="iPosition" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/api/organization/position?{?}') ?>" method="POST">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
<tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($position->getName()); ?>">