mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-02-08 20:38:41 +00:00
Draft organization form implementations
This commit is contained in:
parent
5acce32b6b
commit
0617fdaa83
|
|
@ -6,19 +6,55 @@ return [
|
|||
'^.*/api/organization/position.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiPositionCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiPositionGet',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiPositionSet',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiPositionDelete',
|
||||
'verb' => RouteVerb::DELETE,
|
||||
],
|
||||
],
|
||||
'^.*/api/organization/department.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiDepartmentCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiDepartmentGet',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiDepartmentSet',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiDepartmentDelete',
|
||||
'verb' => RouteVerb::DELETE,
|
||||
],
|
||||
],
|
||||
'^.*/api/organization/unit.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiUnitCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiUnitGet',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiUnitSet',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Organization\Controller:apiUnitDelete',
|
||||
'verb' => RouteVerb::DELETE,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -386,7 +386,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
}
|
||||
|
||||
$unit = UnitMapper::get((int) $request->getData('id'));
|
||||
$response->set($request->__toString(), $unit->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Unit',
|
||||
'message' => 'Unit successfully returned.',
|
||||
'response' => $unit->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiUnitSet(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -410,7 +415,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
|
||||
UnitMapper::update($unit);
|
||||
|
||||
$response->set($request->__toString(), $unit->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Unit',
|
||||
'message' => 'Unit successfully updated.',
|
||||
'response' => $unit->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiUnitDelete(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -426,7 +436,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$unit = UnitMapper::get((int) $request->getData('id'));
|
||||
$status = UnitMapper::delete($unit);
|
||||
|
||||
$response->set($request->__toString(), $status);
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Unit',
|
||||
'message' => 'Unit successfully deleted.',
|
||||
'response' => $status
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiUnitCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -455,7 +470,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
|
||||
UnitMapper::create($unit);
|
||||
|
||||
$response->set($request->__toString(), $unit->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Unit',
|
||||
'message' => 'Unit successfully created.',
|
||||
'response' => $unit->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
private function validatePositionCreate(RequestAbstract $request) : array
|
||||
|
|
@ -488,7 +508,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
}
|
||||
|
||||
$position = PositionMapper::get((int) $request->getData('id'));
|
||||
$response->set($request->__toString(), $position->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Position',
|
||||
'message' => 'Position successfully returned.',
|
||||
'response' => $position->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiPositionDelete(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -504,7 +529,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$position = PositionMapper::get((int) $request->getData('id'));
|
||||
$status = PositionMapper::delete($position);
|
||||
|
||||
$response->set($request->__toString(), $status);
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Position',
|
||||
'message' => 'Position successfully deleted.',
|
||||
'response' => $status
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiPositionSet(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -531,7 +561,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
|
||||
PositionMapper::update($position);
|
||||
|
||||
$response->set($request->__toString(), $position->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Position',
|
||||
'message' => 'Position successfully updated.',
|
||||
'response' => $position->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiPositionCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -563,7 +598,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
|
||||
PositionMapper::create($position);
|
||||
|
||||
$response->set($request->__toString(), $position->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Position',
|
||||
'message' => 'Position successfully created.',
|
||||
'response' => $position->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
private function validateDepartmentCreate(RequestAbstract $request) : array
|
||||
|
|
@ -595,7 +635,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
}
|
||||
|
||||
$department = DepartmentMapper::get((int) $request->getData('id'));
|
||||
$response->set($request->__toString(), $department->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Department',
|
||||
'message' => 'Department successfully returned.',
|
||||
'response' => $department->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiDepartmentSet(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -622,7 +667,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
|
||||
DepartmentMapper::update($department);
|
||||
|
||||
$response->set($request->__toString(), $department->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Department',
|
||||
'message' => 'Department successfully updated.',
|
||||
'response' => $department->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiDepartmentDelete(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -638,7 +688,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$department = DepartmentMapper::get((int) $request->getData('id'));
|
||||
$status = DepartmentMapper::delete($department);
|
||||
|
||||
$response->set($request->__toString(), $status);
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Department',
|
||||
'message' => 'Department successfully deleted.',
|
||||
'response' => $status
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiDepartmentCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
|
|
@ -668,6 +723,11 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
|
||||
DepartmentMapper::create($department);
|
||||
|
||||
$response->set($request->__toString(), $department->jsonSerialize());
|
||||
$response->set($request->__toString(), [
|
||||
'status' => 'ok',
|
||||
'title' => 'Department',
|
||||
'message' => 'Department successfully created.',
|
||||
'response' => $department->jsonSerialize()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Unit') ?></h1></header>
|
||||
<div class="inner">
|
||||
<form id="fUnitCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/rootPath}{/lang}/api/organization/unit'); ?>">
|
||||
<form id="fUnitCreate" method="put" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/unit'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
||||
<tr><td><input type="text" name="name" id="iName" placeholder=" Orange Management" required>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Unit') ?></h1></header>
|
||||
<div class="inner">
|
||||
<form id="iUnit" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/organization/unit?{?}') ?>" method="PUT">
|
||||
<form id="iUnit" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/organization/unit') ?>" method="post">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
|
||||
<tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($unit->getName()); ?>">
|
||||
|
|
@ -31,11 +31,12 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" name="parent" id="iParent" value="<?= $this->printHtml($unit->getParent()->getName()); ?>" required></span>
|
||||
<tr><td><label for="iStatus"><?= $this->getHtml('Status') ?></label>
|
||||
<tr><td><select name="status" id="iStatus">
|
||||
<option><?= $this->getHtml('Active') ?>
|
||||
<option><?= $this->getHtml('Inactive') ?>
|
||||
<option value="<?= $this->printHtml(\Modules\Organization\Models\Status::ACTIVE); ?>"<?= \Modules\Organization\Models\Status::ACTIVE === $group->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('Active') ?>
|
||||
<option value="<?= $this->printHtml(\Modules\Organization\Models\Status::INACTIVE); ?>"<?= \Modules\Organization\Models\Status::INACTIVE === $group->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('Inactive') ?>
|
||||
</select>
|
||||
<tr><td><label for="iDescription"><?= $this->getHtml('Description') ?></label>
|
||||
<tr><td><textarea name="description" id="iDescription"><?= $this->printHtml($unit->getDescription()); ?></textarea>
|
||||
<tr><td>
|
||||
<textarea name="description" id="iDescription"><?= $this->printHtml($unit->getDescription()); ?></textarea>
|
||||
<tr><td><input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', 0); ?>">
|
||||
</table>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user