Skip to content

Commit

Permalink
- Added view page for inventory batches
Browse files Browse the repository at this point in the history
- added changes regarding navigation around inventory and inventory batches
- updated layout on inventory batch pages
  • Loading branch information
24198 committed Apr 14, 2021
1 parent 41316ec commit 5612933
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,23 @@ public function manageBatchesAction(InventoryLevel $inventoryLevel, Request $req
$request
);
}

/**
* @Route(
* path="/manage-batches/view/{id}",
* requirements={"id"="\d+"},
* name="marello_inventory_inventorylevel_batches_view"
* )
* @Template("MarelloInventoryBundle:InventoryLevel:batchesView.html.twig")
*
* @param InventoryLevel $inventoryLevel
*
* @return array
*/
public function viewAction(InventoryLevel $inventoryLevel)
{
return [
'entity' => $inventoryLevel
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function onBuildBefore(BuildBefore $event)
$columns,
[
'manageBatches' => [
'label' => 'marello.inventory.inventorylevel.form.manage_batches.label',
'label' => 'marello.inventory.inventorylevel.grid.batches.label',
'type' => 'twig',
'frontend_type' => 'html',
'template' => 'MarelloInventoryBundle:Inventory/Datagrid:manageBatches.html.twig',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,46 @@ datagrids:
productName:
type: localized_value
data_name: p.names

marello-inventory-batches:
extended_entity_name: Marello\Bundle\InventoryBundle\Entity\InventoryBatch
source:
type: orm
query:
select:
- ib
from:
- { table: MarelloInventoryBundle:InventoryBatch, alias: ib }
where:
and:
- IDENTITY(ib.inventoryLevel) = :inventoryLevelId
bind_parameters:
inventoryLevelId: inventoryLevelId
columns:
batchNumber:
label: marello.inventory.inventorybatch.batch_number.label
frontend_type: string
data_name: batchNumber
quantity:
label: marello.inventory.inventorybatch.quantity.label
frontend_type: integer
data_name: quantity
receivedDate:
label: marello.inventory.inventorybatch.date_received.label
frontend_type: datetime
data_name: deliveryDate
expirationDate:
label: marello.inventory.inventorybatch.expiration_date.label
frontend_type: datetime
data_name: expirationDate
purchasePrice:
label: marello.inventory.inventorybatch.purchase_price.label
frontend_type: currency
data_name: purchasePrice
options:
export: false
mass_actions: ~
toolbarOptions:
hide: true
pagination:
hide: true
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
}

.inventorylevel-adjustment {
.inventorylevel-adjustment, .inventorybatch-adjustment {
.selector {
width: 100px !important;

Expand All @@ -48,6 +48,12 @@
}
}

.inventorybatch-delivery-date, .inventorybatch-purchase-price, .inventorybatch-expiration-date {
input[type=text] {
width: 100px !important;
}
}

// Font Awesome
.fa-caret-down:before {
content: "\f0d7";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ marello:

grid:
warehouse_code.label: Warehouse Code
batches.label: Batches
view_batches.label: View Batches

form:
manage_batches.label: Manage Batches
Expand All @@ -123,7 +125,7 @@ marello:
batch_reference.label: Batch Reference
purchase_reference.label: Purchase Reference
quantity.label: Quantity
delivery_date.label: Delivery Date
date_received.label: Date Received
expiration_date.label: Expiration Date
purchase_price.label: Purchase Price
total_price.label: Total Price
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
</div>
</td>
<td class="inventorybatch-adjustment {{ form.adjustmentQuantity.vars.errors|length ? 'has-errors' : '' }}">
<div class="control-group control-group-datetime">
<div class="fields-row">
<div class="marello-line-item-related-field">
{{ form_widget(form.adjustmentOperator) }}
</div>
Expand All @@ -118,20 +118,20 @@
{{ form_errors(form.adjustmentQuantity) }}
</div>
</td>
<td class="inventorybatch-delivery-date" {{ form.deliveryDate.vars.errors|length ? 'has-errors' : '' }}">
<div class="control-group control-group-integer">
<td class="inventorybatch-delivery-date {{ form.deliveryDate.vars.errors|length ? 'has-errors' : '' }}">
<div class="fields-row">
{{ form_widget(form.deliveryDate) }}
</div>
{{ form_errors(form.deliveryDate) }}
</td>
<td class="inventorybatch-purchase-price" {{ form.purchasePrice.vars.errors|length ? 'has-errors' : '' }}">
<div class="control-group control-group-integer">
<td class="inventorybatch-purchase-price {{ form.purchasePrice.vars.errors|length ? 'has-errors' : '' }}">
<div class="fields-row">
{{ form_widget(form.purchasePrice) }}
</div>
{{ form_errors(form.purchasePrice) }}
</td>
<td class="inventorybatch-expiration-date" {{ form.expirationDate.vars.errors|length ? 'has-errors' : '' }}">
<div class="control-group control-group-datetime">
<td class="inventorybatch-expiration-date {{ form.expirationDate.vars.errors|length ? 'has-errors' : '' }}">
<div class="fields-row">
{{ form_widget(form.expirationDate) }}
</div>
{{ form_errors(form.expirationDate) }}
Expand Down Expand Up @@ -178,7 +178,7 @@
<th class="inventorybatch-line-item-batch-number"><span>{{ 'marello.inventory.inventorybatch.batch_number.label'|trans }}</span></th>
<th class="inventorybatch-line-item-quantity"><span>{{ 'marello.inventory.inventorybatch.quantity.label'|trans }}</span></th>
<th class="inventorylevel-line-item-adjustment"><span>{{ 'marello.inventory.model.warehouse.adjustment.label'|trans }}</span></th>
<th class="inventorylevel-line-item-delivery-date"><span>{{ 'marello.inventory.inventorybatch.delivery_date.label'|trans }}</span></th>
<th class="inventorylevel-line-item-delivery-date"><span>{{ 'marello.inventory.inventorybatch.date_received.label'|trans }}</span></th>
<th class="inventorylevel-line-item-purchase-price"><span>{{ 'marello.inventory.inventorybatch.purchase_price.label'|trans }}</span></th>
<th class="inventorylevel-line-item-expiration-date"><span>{{ 'marello.inventory.inventorybatch.expiration_date.label'|trans }}</span></th>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="marello-line-item-related-field">
<a href="{{ path('marello_inventory_inventorylevel_manage_batches', {'id': record.getValue('id')}) }}">
{{ 'marello.inventory.inventorylevel.form.manage_batches.label'|trans }}
<a href="{{ path('marello_inventory_inventorylevel_batches_view', {'id': record.getValue('id')}) }}">
{{ 'marello.inventory.inventorylevel.grid.view_batches.label'|trans }}
</a>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{% extends 'OroUIBundle:actions:view.html.twig' %}
{% import 'OroUIBundle::macros.html.twig' as UI %}
{% import 'OroDataGridBundle::macros.html.twig' as dataGrid %}

{% block navButtons %}
{{ UI.cancelButton(path('marello_inventory_inventory_view', { 'id': entity.inventoryItem.id }), 'Back'|trans) }}
{% if is_granted('EDIT', entity) %}
{{ UI.editButton({
'path' : path('marello_inventory_inventorylevel_manage_batches', { id: entity.id }),
'entity_label': 'marello.inventory.inventorybatch.entity_label'|trans
}) }}
{% endif %}
{% endblock navButtons %}

{% block pageHeader %}
{% set breadcrumbs = {
'entity': form.vars.value,
'indexPath': path('marello_inventory_inventory_index'),
'indexLabel': 'marello.inventory.label'|trans,
'entityTitle': 'marello.inventory.inventorybatch.entity_plural_label'|trans,
'additional': [{
'indexPath': path('marello_inventory_inventory_view', {'id': entity.inventoryItem.id}),
'indexLabel': entity.inventoryItem.product.sku
}]
} %}
{{ parent() }}
{% endblock pageHeader %}

{% block content_data %}
{% set id = 'marello-inventory-batches-view' %}
{% set generalSubblocks = [] %}

{% set productInformationWidget %}
<div class="widget-content">
<div class="row-fluid form-horizontal">
<div class="responsive-block">
<div class="box-type1">
{{ oro_widget_render({
'widgetType': 'block',
'url': path('marello_inventory_widget_info', {id: entity.inventoryItem.id}),
'title': 'marello.product.product_information'|trans
}) }}
</div>
</div>
</div>
</div>
{% endset %}
{% set generalSubblocks = generalSubblocks|merge([{'data' : [productInformationWidget] }]) %}

{% set inventoryLevelInformationWidget %}
<div class="responsive-block">
<div class="box-type1">
<div class="title">
<span class="widget-title">{{ 'marello.inventory.information.label'|trans }}</span>
</div>
{{ UI.renderProperty('marello.inventory.inventorylevel.warehouse.label'|trans, entity.warehouse.label) }}
{{ UI.renderProperty('marello.inventory.inventorylevel.pick_location.label'|trans, entity.picklocation) }}
{{ UI.renderProperty('marello.inventory.inventorylevel.inventory.label'|trans, entity.inventoryQty) }}
</div>
</div>
{% endset %}
{% set generalSubblocks = generalSubblocks|merge([{'data' : [inventoryLevelInformationWidget]}]) %}

{% set dataBlocks = [
{
'title': 'General Information'|trans,
'class': 'active',
'subblocks': generalSubblocks
}
] %}

{% set dataBlocks = dataBlocks|merge([{
'title' : 'marello.inventory.inventorybatch.entity_plural_label'|trans,
'subblocks': [{
'title' : null,
'data' : [
dataGrid.renderGrid('marello-inventory-batches', {'inventoryLevelId': entity.id})
]
}]
}])
%}

{% set data = { 'dataBlocks': dataBlocks } %}
{{ parent() }}
{% endblock content_data %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
{% if entity.id and is_granted('marello_inventory_inventory_update') %}
{% set html = '' %}
{% set html = UI.saveAndCloseButton({
'route': 'marello_inventory_inventory_update',
'params': {'id': entity.inventoryItem.id}
'route': 'marello_inventory_inventorylevel_batches_view',
'params': {'id': entity.id}
}) %}
{% set html = html ~ UI.saveAndStayButton({
'route': 'marello_inventory_inventorylevel_manage_batches',
Expand All @@ -26,10 +26,10 @@
'entity': form.vars.value,
'indexPath': path('marello_inventory_inventory_index'),
'indexLabel': 'marello.inventory.label'|trans,
'entityTitle': 'marello.inventory.inventorybatch.entity_plural_label'|trans ~ ' - ' ~ entity.inventoryItem.product.sku,
'entityTitle': 'marello.inventory.inventorybatch.entity_plural_label'|trans,
'additional': [{
'indexPath': path('marello_inventory_inventory_update', {'id': entity.inventoryItem.id}),
'indexLabel': 'marello.inventory.inventorylevel.entity_plural_label'|trans,
'indexLabel': entity.inventoryItem.product.sku
}]
} %}
{{ parent() }}
Expand All @@ -55,15 +55,6 @@
{% endset %}
{% set generalSubblocks = generalSubblocks|merge([{'data' : [productInformationWidget] }]) %}

{% set totalsWidget %}
<div class="responsive-block">
<div class="box-type1">
{% placeholder marello_inventory_levels_totals with {'entity' : entity.inventoryItem} %}
</div>
</div>
{% endset %}
{% set generalSubblocks = generalSubblocks|merge([{'data' : [totalsWidget] }]) %}

{% set inventoryLevelInformationWidget %}
<div class="responsive-block">
<div class="box-type1">
Expand All @@ -72,6 +63,7 @@
</div>
{{ UI.renderProperty('marello.inventory.inventorylevel.warehouse.label'|trans, entity.warehouse.label) }}
{{ UI.renderProperty('marello.inventory.inventorylevel.pick_location.label'|trans, entity.picklocation) }}
{{ UI.renderProperty('marello.inventory.inventorylevel.inventory.label'|trans, entity.inventoryQty) }}
</div>
</div>
{% endset %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}

.marello-line-item-related-field {
margin: 5px 0 0 5px;
margin: 0 0 0 5px;
float:left;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ operations:
method_parameters: [$.data]
attribute: $.inventoryitem
- '@redirect':
route: marello_inventory_inventory_update
route: marello_inventory_inventory_view
route_parameters:
id: $.inventoryitem.id
action_groups:
Expand Down

0 comments on commit 5612933

Please sign in to comment.