mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-11 16:18:40 +00:00
update settings
This commit is contained in:
parent
c494809622
commit
d25866b0d0
|
|
@ -19,7 +19,7 @@
|
|||
"name": "Letter",
|
||||
"type": "default_letter",
|
||||
"virtualPath": "/Modules/Organization/Templates",
|
||||
"path": "/Modules/Media/Files/Modules/Organization/Templates",
|
||||
"path": "/Modules/Organization/Templates",
|
||||
"files": [
|
||||
"/Modules/Organization/Admin/Install/Media/letter.doc.php"
|
||||
"/Modules/Organization/Admin/Install/Media/letter.pdf.php"
|
||||
|
|
|
|||
|
|
@ -237,16 +237,28 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/department-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004704001, $request, $response));
|
||||
|
||||
$mapper = DepartmentMapper::getAll()->with('parent')->with('unit')->limit(25);
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = DepartmentMapper::getAll()->with('parent')->with('unit')->limit($pageLimit + 1);
|
||||
|
||||
/** @var \Modules\Organization\Models\Department[] $departments */
|
||||
$departments = [];
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->setData('departments', $mapper->where('id', (int) ($request->getData('id') ?? 0), '<')->execute());
|
||||
$departments = $mapper->where('id', (int) ($request->getData('id') ?? 0), '<')->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->setData('departments', $mapper->where('id', (int) ($request->getData('id') ?? 0), '>')->execute());
|
||||
$departments = $mapper->where('id', (int) ($request->getData('id') ?? 0), '>')->execute();
|
||||
} else {
|
||||
$view->setData('departments', $mapper->where('id', 0, '>')->execute());
|
||||
$departments = $mapper->where('id', 0, '>')->execute();
|
||||
}
|
||||
|
||||
$view->setData('hasMore', ($count = \count($departments)) > $pageLimit);
|
||||
|
||||
if ($count > $pageLimit) {
|
||||
\array_pop($departments);
|
||||
}
|
||||
$view->setData('departments', $departments);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,14 @@ use phpOMS\Uri\UriFactory;
|
|||
*/
|
||||
$departments = $this->getData('departments') ?? [];
|
||||
|
||||
$previous = empty($departments) ? '{/prefix}organization/department/list' : '{/prefix}organization/department/list?{?}&id=' . \reset($departments)->getId() . '&ptype=p';
|
||||
$next = empty($departments) ? '{/prefix}organization/department/list' : '{/prefix}organization/department/list?{?}&id=' . \end($departments)->getId() . '&ptype=n';
|
||||
$previous = empty($departments)
|
||||
? '{/prefix}organization/department/list'
|
||||
: '{/prefix}organization/department/list?{?}&id=' . \reset($departments)->getId() . '&ptype=p';
|
||||
$next = empty($departments)
|
||||
? '{/prefix}organization/department/list'
|
||||
: '{/prefix}organization/department/list?{?}&id='
|
||||
. ($this->getData('hasMore') ? \end($departments)->getId() : $this->request->getData('id'))
|
||||
. '&ptype=n';
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user