Skip to content

Commit 175b7cb

Browse files
committed
PC-27: Update styles for Quote items
1 parent 819c12b commit 175b7cb

4 files changed

Lines changed: 52 additions & 32 deletions

File tree

app/admin/quotes.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
form html: { class: 'quote-form' } do |f|
3636
f.inputs do
37-
f.input :customer, as: :select, collection: Customer.pluck(:company_name, :id)
38-
f.input :user, as: :select, collection: User.order(:name).pluck(:name, :id)
37+
f.input :customer, as: :select, collection: Customer.pluck(:company_name, :id), input_html: { class: 'custom-select' }
38+
f.input :user, as: :select, collection: User.order(:name).pluck(:name, :id), input_html: { class: 'custom-select' }
3939
f.input :categories, as: :check_boxes,
4040
collection: Category.enabled.order(:name).pluck(:name, :id),
4141
wrapper_html: { class: 'categories-wrapper' }
@@ -90,7 +90,7 @@
9090
)
9191

9292
qf.input :price, as: :number, input_html: { min: 0, readonly: true, value: qf.object.price || 0, class: 'read-only-price' }, hint: 'Price will be calculated automatically based on Pricing parameters'
93-
qf.input :discount, as: :number, input_html: { min: 0 }
93+
qf.input :discount, as: :number, input_html: { min: 0, class: 'discount-input' }
9494
qf.input :final_price, as: :number, input_html: { min: 0, readonly: true, value: qf.object.final_price || 0, class: 'read-only-price' }, hint: 'Final price will be calculated automatically based on Discount'
9595

9696
qf.template.concat(

app/assets/stylesheets/active_admin.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ span.category-name-field {
256256
margin-bottom: 0.5rem;
257257
}
258258

259-
label.item-name-label {
259+
label.item-name-label,
260+
label.category-name-label {
260261
padding-left: 10px;
261262
width: 20%;
262263
float: left;
@@ -292,4 +293,14 @@ ol li:last-child a.has_many_remove {
292293
display: none;
293294
}
294295

295-
@import 'active_admin/forms/select';
296+
.param-input {
297+
margin-left: 8px;
298+
padding: 5.8px;
299+
border: 1px solid #c9d0d6 !important;
300+
}
301+
302+
.discount-input {
303+
width: 30% !important;
304+
}
305+
306+
@import 'active_admin/forms/select';

app/assets/stylesheets/active_admin/forms/_select.scss

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$select-image-arrow-dark-url: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZmlsbDogcmdiYSgwLCAwLCAwLCAxKTt0cmFuc2Zvcm06IDttc0ZpbHRlcjo7Ij48cGF0aCBkPSJNMTYuMjkzIDkuMjkzIDEyIDEzLjU4NiA3LjcwNyA5LjI5M2wtMS40MTQgMS40MTRMMTIgMTYuNDE0bDUuNzA3LTUuNzA3eiI+PC9wYXRoPjwvc3ZnPg==';
22
$select-border-color: #c9d0d6;
3-
$select-background-color: #FFF;
3+
$select-background-color: #fff;
44
$select-focus-border-color: #99a2aa;
55

66
form.filter_form {
@@ -68,12 +68,18 @@ form.filter_form {
6868
background: #e6e6e6 !important;
6969
}
7070

71-
72-
// qoute items
71+
// quote items
7372
.quote-parameters-container {
7473
display: flex;
7574
}
7675

76+
.quote-parameter-wrapper {
77+
display: flex;
78+
flex-direction: column;
79+
gap: 8px;
80+
margin-top: 10px;
81+
}
82+
7783
.quote-item-header-wrapper {
7884
margin-bottom: 1rem;
7985
display: flex;
@@ -95,4 +101,9 @@ form.filter_form {
95101

96102
.quote-parameters-preview {
97103
padding-left: 0.4rem;
98-
}
104+
}
105+
106+
.custom-select {
107+
padding: 4px;
108+
width: 30%;
109+
}

app/views/admin/quotes/_quote_item_parameters.html.erb

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,47 @@
11
<div class="quote-parameter-wrapper">
22
<% if fixed_parameters.present? %>
33
<div class="quote-params-block">
4-
<strong>Fixed Parameters:</strong>
54
<ul>
65
<% fixed_parameters.each do |name, value| %>
7-
<li><strong><%= name %></strong>: <%= value %></li>
6+
<li><%= name %>: <%= value %></li>
87
<% end %>
98
</ul>
109
</div>
1110
<% end %>
1211
<% if open_parameters_label.present? %>
1312
<div class="quote-params-block">
14-
<strong>Open Parameters:</strong>
1513
<ul>
1614
<% open_parameters_label.each do |label| %>
17-
<li><%= label %>
18-
<input type="number"
19-
name="quote[quote_items_attributes][NEW_RECORD][open_param_values][<%= label %>]"
20-
class="quote-open-param-input"
21-
step="any"
22-
min="0"
23-
value="<%= open_param_values[label].presence || '' %>"
24-
style="margin-left: 5px;" />
15+
<li>
16+
<label>
17+
<%= label %>
18+
<input type="number"
19+
name="quote[quote_items_attributes][NEW_RECORD][open_param_values][<%= label %>]"
20+
class="quote-open-param-input param-input"
21+
value="<%= open_param_values[label].presence || '' %>" />
22+
</label>
2523
</li>
2624
<% end %>
2725
</ul>
2826
</div>
2927
<% end %>
3028
<% if select_parameters.present? %>
3129
<div class="quote-params-block">
32-
<strong>Select Options:</strong>
3330
<ul>
3431
<% select_parameters.each do |sel_name, data| %>
3532
<li>
36-
<label><%= sel_name %>:</label>
37-
<select name="quote[quote_items_attributes][NEW_RECORD][select_param_values][<%= sel_name %>]"
38-
class="quote-select-param-input"
39-
style="margin-left: 5px;">
40-
<option value="">— Select —</option>
41-
<% data['options'].each do |label, val| %>
42-
<option value="<%= val %>" <%= 'selected' if select_param_values[sel_name].to_s == val.to_s %>>
43-
<%= label %> (<%= val %>)
44-
</option>
45-
<% end %>
46-
</select>
33+
<label>
34+
<%= sel_name %>
35+
<select name="quote[quote_items_attributes][NEW_RECORD][select_param_values][<%= sel_name %>]"
36+
class="quote-select-param-input param-input">
37+
<option value="">— Select —</option>
38+
<% data['options'].each do |label, val| %>
39+
<option value="<%= val %>" <%= 'selected' if select_param_values[sel_name].to_s == val.to_s %>>
40+
<%= label %> (<%= val %>)
41+
</option>
42+
<% end %>
43+
</select>
44+
</label>
4745
</li>
4846
<% end %>
4947
</ul>

0 commit comments

Comments
 (0)