Skip to content

Commit 65e2047

Browse files
Merge pull request #31 from Purple-Stock/feat/29-product-show-page-styles
Feat/29 product show page styles
2 parents a9bd619 + 7efa42c commit 65e2047

File tree

2 files changed

+58
-46
lines changed

2 files changed

+58
-46
lines changed

app/views/products/show.html.erb

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,62 @@
1-
<%- model_class = Product -%>
2-
<div class="section-header">
3-
<div class="page-header">
4-
<h1><%= t 'products.two', :default => model_class.model_name.human.titleize %></h1>
5-
</div>
6-
</div>
7-
8-
<div class="section-body">
9-
<div class="card">
10-
<div class="card-body">
11-
12-
<dl class="dl-horizontal">
13-
<dt><strong><%= model_class.human_attribute_name(:custom_id) %>:</strong></dt>
14-
<dd><%= @product.custom_id %></dd>
15-
<dt><strong><%= model_class.human_attribute_name(:sku) %>:</strong></dt>
16-
<dd><%= @product.sku %></dd>
17-
<dt><strong><%= t('products.name') %>:</strong></dt>
18-
<dd><%= @product.name %></dd>
19-
<dt><strong><%= t('products.price') %>:</strong></dt>
20-
<dd><%= @product.price %></dd>
21-
<dt><strong><%= t('products.entry') %>:</strong></dt>
22-
<dd><%= Services::Product::CountQuantity.call(product: @product, product_command: 'purchase_product') %></dd>
23-
<dt><strong><%= t('products.exit') %>:</strong></dt>
24-
<dd><%= Services::Product::CountQuantity.call(product: @product, product_command: 'sale_product') %></dd>
25-
<dt><strong><%= t('products.balance') %>:</strong></dt>
26-
<dd><%= Services::Product::CountQuantity.call(product: @product, product_command: 'balance_product') %></dd>
27-
<dt><strong><%= t('products.rq_code') %></strong></dt>
28-
<dd><%= image_tag(Services::Product::GenerateQrCode.call(product: @product)) %></dd>
29-
<dt><strong><%= t('products.image') %>:</strong></dt>
30-
<dd><%= image_tag(@product.image.attached? ? @product.image : "https://purple-stock.s3-sa-east-1.amazonaws.com/images.png", size: "150") %></dd>
31-
<dt><strong><%= t('products.highlight') %>:</strong></dt>
32-
<dd><%= @product.highlight %></dd>
33-
<dt><strong><%= t('products.category') %>:</strong></dt>
34-
<dd><%= @product.category.try(:name) %></dd>
35-
<dt><strong><%= t('products.active') %>:</strong></dt>
36-
<dd><%= @product.active %></dd>
37-
38-
</dl>
39-
40-
<%= link_to t('.back', :default => t("helpers.links.back")),
41-
products_path, :class => 'btn btn-default' %>
1+
<section class="main-content">
2+
<div class="row">
3+
<div class="col-md-12">
4+
<h1 class="display-4"><%= @product.name %></h1>
5+
<hr>
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>
52+
<%= link_to t('helpers.links.back'), products_path, class: 'btn btn-primary btn-lg' %>
4253
<%= link_to t('.edit', :default => t("helpers.links.edit")),
43-
edit_product_path(@product), :class => 'btn btn-default' %>
54+
edit_product_path(@product), :class => 'btn btn-dark btn-lg' %>
4455
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
45-
product_path(@product),
46-
title: t('destroy'), class: 'btn btn-danger',
47-
method: :delete,
56+
product_path(@product),
57+
title: t('destroy'), class: 'btn btn-danger btn-lg',
58+
method: :delete,
4859
data: { toggle: 'tooltip', turbo: true, turbo_method: :delete, turbo_confirm: t('confirm') } %>
4960
</div>
5061
</div>
51-
</div>
62+
</section>

config/locales/pt-BR.models.products.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pt-BR:
2323
bling:
2424
true: Sim
2525
false: Não
26+
custom_id: ID do Cliente
2627

2728
products:
2829
one: Produto

0 commit comments

Comments
 (0)