diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 425e0f8..5bc44a0 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\LoanManagement\Controller; +use Modules\LoanManagement\Models\LoanMapper; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; @@ -47,6 +48,9 @@ final class BackendController extends Controller $view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008301001, $request, $response); + $view->data['loans'] = LoanMapper::getAll() + ->executeGetArray(); + return $view; } @@ -65,12 +69,39 @@ final class BackendController extends Controller public function viewLoanCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-list'); + $view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-view'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008301001, $request, $response); return $view; } + /** + * Routing end-point for application behavior. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewLoanView(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-view'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008301001, $request, $response); + + $view->data['loan'] = LoanMapper::get() + ->with('loanProvider') + ->with('loanProvider/account') + ->where('id', (int) $request->getData('id')) + ->execute(); + + return $view; + } + /** * Routing end-point for application behavior. * diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php new file mode 100755 index 0000000..6dc09bd --- /dev/null +++ b/Theme/Backend/Lang/de.lang.php @@ -0,0 +1,24 @@ + [ + 'Loans' => 'Darlehen', + 'Loan' => 'Darlehen', + 'Name' => 'Name', + 'Description' => 'Beschreibung', + 'Supplier' => 'Anbieter', + 'Start' => 'Start', + 'End' => 'Ende', + 'Rate%' => 'Zinsen %', +]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 5ed9bb5..df03ac1 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -14,4 +14,11 @@ declare(strict_types=1); return ['LoanManagement' => [ 'Loans' => 'Loans', + 'Loan' => 'Loan', + 'Name' => 'Name', + 'Description' => 'Description', + 'Supplier' => 'Supplier', + 'Start' => 'Start', + 'End' => 'End', + 'Rate%' => 'Rate %', ]]; diff --git a/Theme/Backend/loan-list.tpl.php b/Theme/Backend/loan-list.tpl.php index 71a46b4..407cf59 100755 --- a/Theme/Backend/loan-list.tpl.php +++ b/Theme/Backend/loan-list.tpl.php @@ -12,4 +12,44 @@ */ declare(strict_types=1); -echo $this->data['nav']->render(); +use phpOMS\Uri\UriFactory; + +/** + * @var \phpOMS\Views\View $this + */ +$loans = $this->data['loans']; + +echo $this->data['nav']->render(); ?> + +
+
+
+
getHtml('Loans'); ?>download
+
+ + + + + $value) : ++$c; + $url = UriFactory::build('{/base}/finance/loan/view?{?}&id=' . $value->id); ?> + +
getHtml('ID', '0', '0'); ?> + getHtml('Loan'); ?> + getHtml('Name'); ?> + getHtml('Start'); ?> + getHtml('End'); ?> +
id; ?> + + name; ?> + start?->format('Y-m-d'); ?> + end?->format('Y-m-d'); ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+
+
+
+
diff --git a/Theme/Backend/loan-table.tpl.php b/Theme/Backend/loan-table.tpl.php index ee5027c..dd9364a 100755 --- a/Theme/Backend/loan-table.tpl.php +++ b/Theme/Backend/loan-table.tpl.php @@ -16,36 +16,12 @@ echo $this->data['nav']->render(); $length = \max(12, 12); ?> -
-
getHtml('Loans'); ?>download
-
- - - - - - - -
Loan - - - - -
Test - Interest
Other costs
Repayment
Payout - -
- -
Test - Interest
Other costs
Repayment
Payout - -
- -
Test - Interest
Other costs
Repayment
Payout - -
- \ No newline at end of file +
+ +
+ + + \ No newline at end of file diff --git a/Theme/Backend/loan-view.tpl.php b/Theme/Backend/loan-view.tpl.php new file mode 100644 index 0000000..78197e7 --- /dev/null +++ b/Theme/Backend/loan-view.tpl.php @@ -0,0 +1,87 @@ +data['loan'] ?? new NullLoan(); +$isNew = $loan->id === 0; + +echo $this->data['nav']->render(); ?> +
+ +
+ +
+ +
+ request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>> +
+
+
+
+
+
getHtml('Loan'); ?>
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + + + + +
+
+
+
+
+
+
+
\ No newline at end of file