Skip to content

Commit 7efa42c

Browse files
feat products/show.html.erb: task #29
MOve qr code to a separate table and product data in another right table.
1 parent de63f3d commit 7efa42c

File tree

1 file changed

+46
-24
lines changed

1 file changed

+46
-24
lines changed

app/views/products/show.html.erb

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,52 @@
33
<div class="col-md-12">
44
<h1 class="display-4"><%= @product.name %></h1>
55
<hr>
6-
<dl class="row">
7-
<dt class="col-sm-3"><%= t('activerecord.attributes.product.custom_id') %></dt>
8-
<dd class="col-sm-9"><%= @product.custom_id %></dd>
9-
<dt class="col-sm-3"><%= t('activerecord.attributes.product.sku') %>:</dt>
10-
<dd class="col-sm-9"><%= @product.sku %></dd>
11-
<dt class="col-sm-3"><%= t('products.price') %>:</dt>
12-
<dd class="col-sm-9"><%= @product.price %></dd>
13-
<dt class="col-sm-3"><%= t('products.entry') %>:</dt>
14-
<dd class="col-sm-9"><%= Services::Product::CountQuantity.call(product: @product, product_command: 'purchase_product') %></dd>
15-
<dt class="col-sm-3"><%= t('products.exit') %>:</dt>
16-
<dd class="col-sm-9"><%= Services::Product::CountQuantity.call(product: @product, product_command: 'sale_product') %></dd>
17-
<dt class="col-sm-3"><%= t('products.balance') %>:</dt>
18-
<dd class="col-sm-9"><%= Services::Product::CountQuantity.call(product: @product, product_command: 'balance_product') %></dd>
19-
<dt class="col-sm-3"><%= t('products.rq_code') %></dt>
20-
<dd class="col-sm-9"><%= image_tag(Services::Product::GenerateQrCode.call(product: @product)) %></dd>
21-
<dt class="col-sm-3"><%= t('products.image') %>:</dt>
22-
<dd class="col-sm-9"><%= image_tag(@product.image.attached? ? @product.image : "https://purple-stock.s3-sa-east-1.amazonaws.com/images.png", size: "150") %></dd>
23-
<dt class="col-sm-3"><%= t('products.highlight') %>:</dt>
24-
<dd class="col-sm-9"><%= @product.highlight %></dd>
25-
<dt class="col-sm-3"><%= t('products.category') %>:</dt>
26-
<dd class="col-sm-9"><%= @product.category.try(:name) %></dd>
27-
<dt class="col-sm-3"><%= t('products.active') %>:</dt>
28-
<dd class="col-sm-9"><%= @product.active %></dd>
29-
</dl>
6+
<table>
7+
<!-- What to do with image? <dd class="col-sm-9"><%= image_tag(@product.image.attached? ? @product.image : "https://purple-stock.s3-sa-east-1.amazonaws.com/images.png", size: "150") %></dd> -->
8+
<tr class="row">
9+
<td><%= image_tag(Services::Product::GenerateQrCode.call(product: @product)) %></td>
10+
<td class="mt-md-5">
11+
<table>
12+
<tr>
13+
<th class="col"><%= t('activerecord.attributes.product.custom_id') %></th>
14+
<td class="col"><%= @product.custom_id %></td>
15+
</tr>
16+
<tr>
17+
<th class="col"><%= t('activerecord.attributes.product.sku') %></th>
18+
<td class="col"><%= @product.sku %></td>
19+
</tr>
20+
<tr>
21+
<th class="col"><%= t('products.price') %></th>
22+
<td class="col"><%= @product.price %></td>
23+
</tr>
24+
<tr>
25+
<th class="col"><%= t('products.entry') %></th>
26+
<td class="col"><%= Services::Product::CountQuantity.call(product: @product, product_command: 'purchase_product') %></td>
27+
</tr>
28+
<tr>
29+
<th class="col"><%= t('products.exit') %></th>
30+
<td class="col"><%= Services::Product::CountQuantity.call(product: @product, product_command: 'sale_product') %></td>
31+
</tr>
32+
<tr>
33+
<th class="col"><%= t('products.balance') %></th>
34+
<td class="col"><%= Services::Product::CountQuantity.call(product: @product, product_command: 'balance_product') %></td>
35+
</tr>
36+
<tr>
37+
<th class="col"><%= t('products.highlight') %></th>
38+
<td class="col"><%= @product.highlight %></td>
39+
</tr>
40+
<tr>
41+
<th class="col"><%= t('products.category') %></th>
42+
<td class="col"><%= @product.category.try(:name) %></td>
43+
</tr>
44+
<tr>
45+
<th class="col"><%= t('products.active') %>:</th>
46+
<td class="col"><%= @product.active %></td>
47+
</tr>
48+
</table>
49+
</td>
50+
</tr>
51+
</table>
3052
<%= link_to t('helpers.links.back'), products_path, class: 'btn btn-primary btn-lg' %>
3153
<%= link_to t('.edit', :default => t("helpers.links.edit")),
3254
edit_product_path(@product), :class => 'btn btn-dark btn-lg' %>

0 commit comments

Comments
 (0)