Bring spree/admin/adjustments pages from spree_backend

This commit is contained in:
luisramos0
2019-07-16 20:49:34 +01:00
parent 77c78f35d3
commit c1c5dcac09
5 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<table class="index" data-hook="adjustments">
<thead data-hook="adjustmment_head">
<tr>
<th><%= "#{Spree.t('date')}/#{Spree.t('time')}" %></th>
<th><%= Spree.t(:description) %></th>
<th><%= Spree.t(:amount) %></th>
<th><%= Spree.t(:state) %></th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
<% @collection.each do |adjustment|
@edit_url = edit_admin_order_adjustment_path(@order, adjustment)
@delete_url = admin_order_adjustment_path(@order, adjustment)
%>
<tr id="<%= spree_dom_id(adjustment) %>" data-hook="adjustment_row" class="<%= cycle('odd', 'even')%>">
<td class="align-center"><%= pretty_time(adjustment.created_at) %></td>
<td class="align-center"><%= adjustment.label %></td>
<td class="align-center"><%= adjustment.display_amount.to_html %></td>
<td class="align-center"><%= adjustment_state(adjustment) %></td>
<td class='actions'>
<%= link_to_edit adjustment, :no_text => true %>
<%= link_to_delete adjustment, :no_text => true %>
<%= link_to_toggle_adjustment_state @order, adjustment, :no_text => true %>
</td>
</tr>
<% end %>
<tr>
<td class="align-center" colspan='4'>
<%= button_to Spree.t(:open_all_adjustments), open_adjustments_admin_order_path(@order), :method => :get %>&nbsp;
<%= button_to Spree.t(:close_all_adjustments), close_adjustments_admin_order_path(@order), :method => :get %>
</td>
<td class='actions'>&nbsp;</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,16 @@
<div data-hook="admin_adjustment_form_fields" class="row">
<div class="alpha three columns">
<%= f.field_container :amount do %>
<%= f.label :amount, raw(Spree.t(:amount) + content_tag(:span, " *", :class => "required")) %>
<%= text_field :adjustment, :amount, :class => 'fullwidth' %>
<%= f.error_message_on :amount %>
<% end %>
</div>
<div class="omega nine columns">
<%= f.field_container :label do %>
<%= f.label :label, raw(Spree.t(:description) + content_tag(:span, " *", :class => "required")) %>
<%= text_field :adjustment, :label, :class => 'fullwidth' %>
<%= f.error_message_on :label %>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,22 @@
<%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Adjustments' } %>
<% content_for :page_title do %>
<i class="icon-arrow-right"></i> <%= Spree.t(:edit) %> <%= Spree.t(:adjustment) %>
<% end %>
<% content_for :page_actions do %>
<li><%= button_link_to Spree.t(:back_to_adjustments_list), spree.admin_order_adjustments_url(@order), :icon => 'icon-arrow-left' %></li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @adjustment } %>
<%= form_for @adjustment, :url => admin_order_adjustment_path(@order, @adjustment), :method => :put do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="filter-actions actions" data-hook="buttons">
<%= button Spree.t(:continue), 'icon-arrow-right' %>
<span class="or"><%= Spree.t(:or) %></span>
<%= link_to_with_icon 'icon-remove', Spree.t('actions.cancel'), admin_order_adjustments_url(@order), :class => 'button' %>
</div>
</fieldset>
<% end %>

View File

@@ -0,0 +1,14 @@
<%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Adjustments' } %>
<% content_for :page_title do %>
<i class="icon-arrow-right"></i> <%= Spree.t(:adjustments) %>
<% end %>
<% content_for :page_actions do %>
<li><%= button_link_to Spree.t(:new_adjustment), new_admin_order_adjustment_url(@order), :icon => 'icon-plus' %></li>
<li><%= button_link_to Spree.t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left' %></li>
<% end %>
<%= render :partial => 'adjustments_table' %>
<%= button_link_to Spree.t(:continue), @order.cart? ? new_admin_order_payment_url(@order) : admin_orders_url, :icon => 'icon-arrow-right' %>

View File

@@ -0,0 +1,23 @@
<%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Adjustments' } %>
<% content_for :page_title do %>
<i class="icon-arrow-right"></i> <%= Spree.t(:new_adjustment) %>
<% end %>
<% content_for :page_actions do %>
<li><%= button_link_to Spree.t(:back_to_adjustments_list), spree.admin_order_adjustments_url(@order), :icon => 'icon-arrow-left' %></li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @adjustment } %>
<%= form_for @adjustment, :url => admin_order_adjustments_path do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="filter-actions actions" data-hook="buttons">
<%= button Spree.t(:continue), 'icon-arrow-right' %>
<span class="or"><%= Spree.t(:or) %></span>
<%= button_link_to Spree.t('actions.cancel'), admin_order_adjustments_url(@order), :icon => 'icon-remove' %>
</div>
</fieldset>
<% end %>