add private draft

This commit is contained in:
Dennis Eichhorn 2022-03-22 16:34:00 +01:00
parent 26669eeeb0
commit fbf865aaff
6 changed files with 362 additions and 0 deletions

View File

@ -241,6 +241,38 @@
"permission": { "permission": 2, "type": null, "element": null },
"parent": 1003401001,
"children": [
{
"id": 1005109101,
"pid": "/",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "{/prefix}private/purchase/billing/dashboard?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Billing",
"permission": { "permission": 2, "type": null, "element": null },
"parent": 1005109001,
"children": [
]
},
{
"id": 1005109101,
"pid": "/",
"type": 3,
"subtype": 1,
"name": "Upload",
"uri": "{/prefix}private/purchase/billing/upload?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "Billing",
"permission": { "permission": 2, "type": null, "element": null },
"parent": 1005109001,
"children": [
]
}
]
}
]

View File

@ -631,6 +631,16 @@
"foreignTable": "group",
"foreignKey": "group_id"
},
"billing_bill_responsible_status": {
"name": "billing_bill_responsible_status",
"type": "INT",
"null": false
},
"billing_bill_responsible_type": {
"name": "billing_bill_responsible_type",
"type": "INT",
"null": false
},
"billing_bill_responsible_account": {
"name": "billing_bill_responsible_account",
"type": "INT",

View File

@ -51,6 +51,7 @@ return [
],
],
],
'^.*/purchase/bill/create.*$' => [
[
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoiceCreate',
@ -84,6 +85,18 @@ return [
],
],
],
'^.*/purchase/bill/upload\?.*$' => [
[
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoiceUpload',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_INVOICE,
],
],
],
'^.*/warehouse/bill/create.*$' => [
[
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockInvoiceCreate',
@ -117,6 +130,7 @@ return [
],
],
],
'^.*/sales/analysis/bill(\?.*|$)$' => [
[
'dest' => '\Modules\Billing\Controller\BackendController:viewBillAnalysis',
@ -150,4 +164,27 @@ return [
],
],
],
'^.*/private/purchase/billing/dashboard.*$' => [
[
'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillDashboard',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::PRIVATE_DASHBOARD,
],
],
],
'^.*/private/purchase/billing/upload.*$' => [
[
'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillUpload',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::PRIVATE_BILL_UPLOAD,
],
],
],
];

View File

@ -656,4 +656,99 @@ final class BackendController extends Controller
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewBillingPurchaseInvoiceUpload(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-upload');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response));
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewPrivatePurchaseBillUpload(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/user-purchase-bill-upload');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response));
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewPrivatePurchaseBillDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Billing/Theme/Backend/user-purchase-bill-dashboard');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response));
$mapperQuery = PurchaseBillMapper::getAll()
->with('type')
->with('type/l11n')
->with('supplier')
->where('type/transferType', BillTransferType::PURCHASE)
->sort('id', OrderType::DESC)
->limit(25);
if ($request->getData('ptype') === 'p') {
$view->setData('bills',
$mapperQuery
->where('id', (int) ($request->getData('id') ?? 0), '<')
->where('supplier', null, '!=')
->where('type/l11n/language', $response->getLanguage())
->execute()
);
} elseif ($request->getData('ptype') === 'n') {
$view->setData('bills',
$mapperQuery->where('id', (int) ($request->getData('id') ?? 0), '>')
->where('supplier', null, '!=')
->where('type/l11n/language', $response->getLanguage())
->execute()
);
} else {
$view->setData('bills',
$mapperQuery->where('id', 0, '>')
->where('supplier', null, '!=')
->where('type/l11n/language', $response->getLanguage())
->execute()
);
}
return $view;
}
}

View File

@ -31,4 +31,9 @@ abstract class PermissionCategory extends Enum
public const PURCHASE_INVOICE = 2;
public const SALES_ANALYSIS = 4;
public const PRIVATE_DASHBOARD = 5;
public const PRIVATE_BILL_UPLOAD = 6;
}

View File

@ -0,0 +1,183 @@
<?php
/**
* Karaka
*
* PHP Version 8.0
*
* @package Modules\Billing
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://karaka.app
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$bills = $this->getData('bills') ?? [];
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Bills'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="slider">
<table id="billList" class="default sticky">
<thead>
<tr>
<td><label class="checkbox" for="iBillSelect-0">
<input type="checkbox" id="iBillSelect-0" name="billselect">
<span class="checkmark"></span>
</label>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<label for="billList-sort-1">
<input type="radio" name="billList-sort" id="billList-sort-1">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-2">
<input type="radio" name="billList-sort" id="billList-sort-2">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Type'); ?>
<label for="billList-sort-3">
<input type="radio" name="billList-sort" id="billList-sort-3">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-4">
<input type="radio" name="billList-sort" id="billList-sort-4">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('SupplierID'); ?>
<label for="billList-sort-5">
<input type="radio" name="billList-sort" id="billList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-6">
<input type="radio" name="billList-sort" id="billList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Supplier'); ?>
<label for="billList-sort-7">
<input type="radio" name="billList-sort" id="billList-sort-7">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-8">
<input type="radio" name="billList-sort" id="billList-sort-8">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Address'); ?>
<label for="billList-sort-9">
<input type="radio" name="billList-sort" id="billList-sort-9">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-10">
<input type="radio" name="billList-sort" id="billList-sort-10">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Postal'); ?>
<label for="billList-sort-11">
<input type="radio" name="billList-sort" id="billList-sort-11">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-12">
<input type="radio" name="billList-sort" id="billList-sort-12">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('City'); ?>
<label for="billList-sort-13">
<input type="radio" name="billList-sort" id="billList-sort-13">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-14">
<input type="radio" name="billList-sort" id="billList-sort-14">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Country'); ?>
<label for="billList-sort-15">
<input type="radio" name="billList-sort" id="billList-sort-15">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-16">
<input type="radio" name="billList-sort" id="billList-sort-16">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Net'); ?>
<label for="billList-sort-7">
<input type="radio" name="billList-sort" id="billList-sort-7">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-18">
<input type="radio" name="billList-sort" id="billList-sort-18">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Created'); ?>
<label for="billList-sort-23">
<input type="radio" name="billList-sort" id="billList-sort-23">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="billList-sort-24">
<input type="radio" name="billList-sort" id="billList-sort-24">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<tbody>
<?php $count = 0;
foreach ($bills as $key => $value) :
++$count;
$url = UriFactory::build('{/prefix}purchase/bill?{?}&id=' . $value->getId());
?>
<tr data-href="<?= $url; ?>">
<td><label class="checkbox" for="iBillSelect-<?= $key; ?>">
<input type="checkbox" id="iBillSelect-<?= $key; ?>" name="billselect">
<span class="checkmark"></span>
</label>
<td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a>
<td><a class="content" href="<?= $supplier = UriFactory::build('{/prefix}purchase/supplier/profile?{?}&id=' . $value->supplier->getId()); ?>"><?= $value->supplier->number; ?></a>
<td><a class="content" href="<?= $supplier; ?>"><?= $this->printHtml($value->billTo); ?></a>
<td><a href="<?= $url;
?>"><?= $value->billAddress; ?></a>
<td><a href="<?= $url; ?>"><?= $value->billZip; ?></a>
<td><a href="<?= $url; ?>"><?= $value->billCity; ?></a>
<td><a href="<?= $url; ?>"><?= $value->billCountry; ?></a>
<td><a href="<?= $url; ?>"><?= $value->netSales->getCurrency(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="12" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>
</div>