diff --git a/module/LogisticsBundle/Controller/Admin/OrderController.php b/module/LogisticsBundle/Controller/Admin/OrderController.php
index fd0a5fe060..bc9a576804 100644
--- a/module/LogisticsBundle/Controller/Admin/OrderController.php
+++ b/module/LogisticsBundle/Controller/Admin/OrderController.php
@@ -69,6 +69,57 @@ public function viewAction()
)
);
+ if ($this->getRequest()->isPost()) {
+ if ($this->getRequest()->getPost()->toArray()['submit'] == 'orderReview') {
+ $this->initAjax();
+ $orderForm = $this->getForm('logistics_admin_order_review');
+ $orderForm->setData($this->getRequest()->getPost());
+ if ($orderForm->isValid()) {
+ error_log('Valid: order form');
+ if ($this->getLastOrderByRequest($order->getRequest())->isReviewed()) {
+ error_log('existed');
+ $orderForm->hydrateObject(
+ $this->recreateOrder(
+ $this->getLastOrderByRequest($order->getRequest()),
+ $academic->getUnit($this->getCurrentAcademicYear())->getName())
+ );
+ } else {
+ error_log('didnt exist');
+ $newOrder = $orderForm->hydrateObject(
+ $this->recreateOrder($order, $academic->getUnit($this->getCurrentAcademicYear())->getName())
+ );
+ $newOrder->review();
+ $this->getEntityManager()->persist($newOrder);
+ }
+ $this->getEntityManager()->flush();
+
+ $this->flashMessenger()->success(
+ 'Success',
+ 'The request was succesfully reviewed.'
+ );
+ return new ViewModel(
+ array(
+ 'result' => (object)array('status' => 'success'),
+ )
+ );
+// return new ViewModel(
+// array(
+// 'result' => (object)array('status' => json_encode($this->getRequest()->getPost())),
+// )
+// );
+ }
+ } elseif ($this->getRequest()->getPost()->toArray()['submit'] == 'articleReview') {
+ $articleForm->setData($this->getRequest()->getPost());
+ if ($orderForm->isValid()) {
+ error_log('Valid: article form');
+ $this->flashMessenger()->success(
+ 'Success',
+ 'The request was succesfully reviewed.'
+ );
+ }
+ }
+ }
+
return new ViewModel(
array(
'order' => $order,
@@ -103,7 +154,7 @@ public function reviewOrderAction()
if ($this->getRequest()->isPost()) {
error_log('post');
$orderForm->setData($this->getRequest()->getPost());
- error_log($this->getRequest()->getPost()[0]);
+ error_log(json_encode($this->getRequest()->getPost()));
if ($orderForm->isValid()) {
error_log('valid');
diff --git a/module/LogisticsBundle/Controller/InventoryController.php b/module/LogisticsBundle/Controller/InventoryController.php
index d800f4104e..e1fe3ddce3 100644
--- a/module/LogisticsBundle/Controller/InventoryController.php
+++ b/module/LogisticsBundle/Controller/InventoryController.php
@@ -2,6 +2,7 @@
namespace LogisticsBundle\Controller;
+use DateTime;
use Laminas\View\Model\ViewModel;
use LogisticsBundle\Entity\Inventory;
@@ -15,7 +16,7 @@ public function indexAction()
->findAllNotZeroQuery(),
$this->getParam('page')
);
-
+
return new ViewModel(
array(
'paginator' => $paginator,
diff --git a/module/LogisticsBundle/Entity/Inventory.php b/module/LogisticsBundle/Entity/Inventory.php
index 92457e0538..1cedb05df6 100644
--- a/module/LogisticsBundle/Entity/Inventory.php
+++ b/module/LogisticsBundle/Entity/Inventory.php
@@ -2,6 +2,7 @@
namespace LogisticsBundle\Entity;
+use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
@@ -115,6 +116,13 @@ class Inventory
*/
private $expiryDate;
+ /**
+ * @var DateTime The expiry date
+ *
+ * @ORM\Column(name="expiry_date", type="DateTime", nullable=true)
+ */
+ private $expiryDate_;
+
/**
* Inventory constructor
*/
diff --git a/module/LogisticsBundle/Form/Admin/Order/OrderArticleMap/Review.php b/module/LogisticsBundle/Form/Admin/Order/OrderArticleMap/Review.php
index 92a7e42893..dc2d5376a3 100644
--- a/module/LogisticsBundle/Form/Admin/Order/OrderArticleMap/Review.php
+++ b/module/LogisticsBundle/Form/Admin/Order/OrderArticleMap/Review.php
@@ -48,6 +48,8 @@ public function init()
),
)
);
+
+ $this->addSubmit('articleReview', 'articleSubmit hide');
}
}
diff --git a/module/LogisticsBundle/Form/Admin/Order/Review.php b/module/LogisticsBundle/Form/Admin/Order/Review.php
index 8d8b6e0b09..0df7371738 100644
--- a/module/LogisticsBundle/Form/Admin/Order/Review.php
+++ b/module/LogisticsBundle/Form/Admin/Order/Review.php
@@ -24,7 +24,7 @@ public function init()
{
parent::init();
- $this->remove('submit')->addSubmit('review', 'hide');
+ $this->remove('submit')->addSubmit('orderReview', 'orderSubmit hide');
if ($this->order !== null) {
$this->bind($this->order);
diff --git a/module/LogisticsBundle/Form/Inventory/Edit.php b/module/LogisticsBundle/Form/Inventory/Edit.php
index 7db79668ff..bfbd962c53 100644
--- a/module/LogisticsBundle/Form/Inventory/Edit.php
+++ b/module/LogisticsBundle/Form/Inventory/Edit.php
@@ -16,8 +16,7 @@ public function init()
{
parent::init();
- $nameField = $this->get('name');
- $nameField->setRequired();
+ $nameField = $this->get('name')->setRequired();
// $this->remove('unit')->remove('perUnit');
diff --git a/module/LogisticsBundle/Resources/layouts/logistics/base.twig b/module/LogisticsBundle/Resources/layouts/logistics/base.twig
index cfa90c1d9e..7e090179f1 100644
--- a/module/LogisticsBundle/Resources/layouts/logistics/base.twig
+++ b/module/LogisticsBundle/Resources/layouts/logistics/base.twig
@@ -27,6 +27,11 @@
{{ translate('Material') }}
{% endif %}
+ {% if hasAccess('logistics_inventory', 'index') %}
+
+ {{ translate('Flesserke') }}
+
+ {% endif %}
{% if hasAccess('logistics_index', 'index') %}
{{ translate('Van') }}
@@ -42,11 +47,7 @@
{# {{ translate('Lease') }}#}
{# #}
{# {% endif %}#}
- {% if hasAccess('logistics_inventory', 'index') %}
-
- {{ translate('Inventory') }}
-
- {% endif %}
+
{# {% if hasAccess('logistics_inventory', 'add') %}#}
{# #}
{# {{ translate('Flesserke Form') }}#}
diff --git a/module/LogisticsBundle/Resources/views/logistics/admin/order/view.twig b/module/LogisticsBundle/Resources/views/logistics/admin/order/view.twig
index 7aeca354c2..516a1ff382 100644
--- a/module/LogisticsBundle/Resources/views/logistics/admin/order/view.twig
+++ b/module/LogisticsBundle/Resources/views/logistics/admin/order/view.twig
@@ -313,28 +313,38 @@
var id = $this.data('id');
reviewAll.find('.edit').unbind('click').click(function () {
+ var reviewOrder = $('#review-order');
+ var orderSubmit = reviewOrder.find('.orderSubmit');
+ console.log(orderSubmit);
+ orderSubmit.click();
+ if ('success' == orderData.status) {
+ var reviewArticle = $('#review-article');
+ var articleSubmit = reviewArticle.find('.articleSubmit');
+ console.log(articleSubmit);
+ articleSubmit.click();
+ }
console.log('click');
- $.post('{{ url('logistics_admin_order', {"action": "reviewOrder"})}}' + id, function (orderData) {
- console.log(orderData.status);
- if (orderData && 'success' == orderData.status) {
- $('.flashmessage').addClass('hide');
- // $('.article_removed_success').removeClass('hide');
- // $('.item-' + id).remove();
- reviewAll.modal('hide');
- $.post('{{ url('logistics_admin_order', {"action": "reviewArticles"})}}' + id, function (data) {
- if (data && 'success' == data.status) {
- $('.flashmessage').addClass('hide');
- // $('.article_removed_success').removeClass('hide');
- // $('.item-' + id).remove();
- reviewAll.modal('hide');
- } else {
- errorRemove();
- }
- }, 'json').error(errorRemove);
- } else {
- errorRemove();
- }
- }, 'json').error(errorRemove);
+ {# $.post('{{ url('logistics_admin_order', {"action": "reviewOrder"})}}' + id, function (orderData) {#}
+ {# console.log(orderData.status);#}
+ {# if (orderData && 'success' == orderData.status) {#}
+ {# $('.flashmessage').addClass('hide');#}
+ {# // $('.article_removed_success').removeClass('hide');#}
+ {# // $('.item-' + id).remove();#}
+ {# reviewAll.modal('hide');#}
+ {# $.post('{{ url('logistics_admin_order', {"action": "reviewArticles"})}}' + id, function (data) {#}
+ {# if (data && 'success' == data.status) {#}
+ {# $('.flashmessage').addClass('hide');#}
+ {# // $('.article_removed_success').removeClass('hide');#}
+ {# // $('.item-' + id).remove();#}
+ {# reviewAll.modal('hide');#}
+ {# } else {#}
+ {# errorRemove();#}
+ {# }#}
+ {# }, 'json').error(errorRemove);#}
+ {# } else {#}
+ {# errorRemove();#}
+ {# }#}
+ {# }, 'json').error(errorRemove);#}
});
reviewAll.modal();
{# {{ url('logistics_admin_order', {"action" : 'review', "id" : order.getId()}) }}#}
diff --git a/module/LogisticsBundle/Resources/views/logistics/inventory/index.twig b/module/LogisticsBundle/Resources/views/logistics/inventory/index.twig
index 6d0418f168..a48f46587c 100644
--- a/module/LogisticsBundle/Resources/views/logistics/inventory/index.twig
+++ b/module/LogisticsBundle/Resources/views/logistics/inventory/index.twig
@@ -1,8 +1,6 @@
{% extends 'logistics/base.twig' %}
{% block content %}
- {# {% include 'logistics/inventory/partials/navigation.twig' %}#}
-
{% include 'admin/partials/flashMessenger.twig' %}
{# Page header + button to add page #}
@@ -19,11 +17,11 @@
{% endif %}
-{# {% if authenticatedPerson is null %}#}
-{# {{ translate('Please login to view Flesserke.') }}
#}
-{# {% elseif not hasAccess('logistics_inventory', 'index') %}#}
-{# {{ translate('You have no access to Flesserke.') }}
{{ translate('To ask for access send a mail to it@vtk.be') }}
#}
-{# {% else %}#}
+ {% if authenticatedPerson is null %}
+ {{ translate('Please login to view Flesserke.') }}
+ {% elseif not hasAccess('logistics_inventory', 'index') %}
+ {{ translate('You have no access to Flesserke.') }}
{{ translate('To ask for access send a mail to it@vtk.be') }}
+ {% else %}
{#
#}
@@ -67,9 +65,14 @@
{% endif %}
+ {% set today = "now"|date('d/m/Y') %}
{% for article in paginator %}
- {# {% if article.getExpiryDate() <= date('d/m/y') %}#}
-
+{# {% if article.getExpiryDate() %}{% set exp = "19/02/2025"|date('Y-m-d') %}{% endif %}#}
+
{{ article.getName() }} |
{{ article.getCategory() }} |
{{ article.getBrand() }} |
@@ -101,35 +104,32 @@
{% include 'admin/partials/paginationControl.twig' %}
-
-
-
-
-
-
- You are about to delete the following article: !
- Please note that this operation cannot be undone!
-
-
- Are you sure you want to continue?
-
-
-
-
-
-
-{# {% endif %}#}
+{# #}
+{#
#}
+{#
#}
+{# #}
+{#
#}
+{#
#}
+{# You are about to delete the following article: !#}
+{# Please note that this operation cannot be undone!#}
+{#
#}
+{#
#}
+{# Are you sure you want to continue?#}
+{#
#}
+{# #}
+{#
#}
+{#
#}
+{#
#}
+{#
#}
+ {% endif %}
{% endblock %}
{% block content_script %}
-
{% endblock %}
diff --git a/module/LogisticsBundle/Resources/views/logistics/inventory/partials/navigation.twig b/module/LogisticsBundle/Resources/views/logistics/inventory/partials/navigation.twig
deleted file mode 100644
index a3df2e930d..0000000000
--- a/module/LogisticsBundle/Resources/views/logistics/inventory/partials/navigation.twig
+++ /dev/null
@@ -1,14 +0,0 @@
-
\ No newline at end of file