app/views/plugins/ecommerce/admin/orders/index.html.erb in camaleon_ecommerce-1.2 vs app/views/plugins/ecommerce/admin/orders/index.html.erb in camaleon_ecommerce-1.2.1

- old
+ new

@@ -1,86 +1,77 @@ <div class="panel panel-default" id="commerce-orders-list"> <div class="panel-heading"> - <h4><span class="fa fa-cog"></span> <%= t('plugin.ecommerce.orders') %></h4> + <h4><span class="fa fa-cog"></span> <%= t('plugins.ecommerce.orders') %></h4> </div> <div class="panel-body"> - <div class="box-adv-search pull-right" id="orders-box-adv-search"> + <%= form_tag(url_for(action: :index), class: 'pull-right', method: 'get') do %> <div class="input-group" id="adv-search"> - <input type="text" class="form-control" placeholder="<%= t('plugin.ecommerce.search_order_number') %>" name="q" value="<%= params[:q] %>"/> - + <input type="text" class="form-control" placeholder="<%= t('plugins.ecommerce.search_order_number') %>" name="q" value="<%= params[:q] %>"/> <div class="input-group-btn"> - <div class="btn-group" role="group"> - <div class="dropdown dropdown-lg"> - <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> - <span class="caret"></span></button> - <div class="dropdown-menu dropdown-menu-right" role="menu"> - <form action="<%= url_for(action: :index) %>" method="get" class="form-horizontal" role="form"> - <div class="form-group"> - <label for="contain"><%= t('plugin.ecommerce.table.customer') %> </label> - <input class="form-control" type="text" name="c" value="<%= params[:c] %>"/> - </div> - <div class="form-group"> - <label for="contain"><%= t('plugin.ecommerce.e_mail_address') %></label> - <input class="form-control" type="email" name="e" value="<%= params[:e] %>"/> - </div> - <div class="form-group"> - <label for="contain"><%= t('plugin.ecommerce.phone_number') %></label> - <input class="form-control" type="text" name="p" value="<%= params[:p] %>"/> - </div> - <div class="form-group"> - <label for="contain"><%= t('plugin.ecommerce.table.status') %></label> - <%= select_tag "s", options_for_select([[""], [t('plugin.ecommerce.select.received'), "received"], [t('plugin.ecommerce.select.unpaid'), "unpaid"], [t('plugin.ecommerce.select.accepted'), "accepted"], [t('plugin.ecommerce.select.shipped'), "shipped"], [t('plugin.ecommerce.select.closed'), "closed"], [t('plugin.ecommerce.select.canceled'), "canceled"]], params[:s]), class: 'form-control' %> - </div> - - <button type="submit" class="btn btn-primary"> - <span class="fa fa-search" aria-hidden="true"></span></button> - </form> - </div> - </div> - <button type="button" class="btn btn-primary"> - <span class="fa fa-search" aria-hidden="true"></span></button> - </div> + <button type="button" title="<%= t('plugins.ecommerce.advanced_search', default: 'Advanced Search') %>" class="btn btn-default" id="ecommerce_adv_search_btn"><span class="caret"></span></button> + <button type="submit" class="btn btn-primary"><span class="fa fa-search"></span></button> </div> </div> + <% end %> + <div class="hidden" id="commerce_adv_search_modal"> + <%= form_tag(url_for(action: :index), method: :get) do %> + <div class="form-group"> + <label for="contain"><%= t('plugins.ecommerce.table.customer') %> </label> + <input class="form-control" type="text" name="c" value="<%= params[:c] %>"/> + </div> + <div class="form-group"> + <label for="contain"><%= t('plugins.ecommerce.e_mail_address') %></label> + <input class="form-control" type="email" name="e" value="<%= params[:e] %>"/> + </div> + <!--<div class="form-group">--> + <!--<label for="contain"><%= t('plugins.ecommerce.phone_number') %></label>--> + <!--<input class="form-control" type="text" name="p" value="<%= params[:p] %>"/>--> + <!--</div>--> + <div class="form-group"> + <label for="contain"><%= t('plugins.ecommerce.table.status') %></label> + <%= select_tag "s", options_for_select([[""], [t('plugins.ecommerce.select.accepted'), "accepted"], [cama_t('plugins.ecommerce.select.shipped'), "shipped"], [cama_t('plugins.ecommerce.select.canceled'), "canceled"], [cama_t('plugins.ecommerce.select.paid'), "paid"], [cama_t('plugins.ecommerce.select.pending'), "on_delivery|bank_pending"]], params[:s]), class: 'form-control' %> + </div> + <button type="submit" class="btn btn-primary"><span class="fa fa-search" aria-hidden="true"></span> <%= t("camaleon_cms.admin.button.search") %></button> + <% end %> </div> <div class="hidden" id="commerce_cancel_modal"> <%= form_tag '#' do %> <div class="form-group"> - <%= label_tag nil, t('plugin.ecommerce.table.description', default: 'Description') %> + <%= label_tag nil, t('plugins.ecommerce.table.description', default: 'Description') %> <%= text_area_tag 'description', '', class: 'form-control required' %> </div> <div class=""> - <span class="input-group-btn"><button class="btn btn-default" type="submit"><%= t('plugin.ecommerce.table.make_canceled', default: 'Mark as Canceled') %></button></span> + <span class="input-group-btn"><button class="btn btn-default" type="submit"><%= t('plugins.ecommerce.table.make_canceled', default: 'Mark as Canceled') %></button></span> </div> <% end %> </div> <div class="hidden" id="commerce_shipped_modal"> <%= form_tag '#' do %> <div> - <%= label_tag nil, t('plugin.ecommerce.show_order.consignment_number', default: 'Consignment Number') %> + <%= label_tag nil, t('plugins.ecommerce.show_order.consignment_number', default: 'Consignment Number') %> </div> <div class="input-group"> <%= text_field_tag 'consignment_number', '', class: 'form-control' %> - <span class="input-group-btn"><button class="btn btn-default" type="submit"><%= t('plugin.ecommerce.table.make_shipped', default: 'Mark as Shipped') %></button></span> + <span class="input-group-btn"><button class="btn btn-default" type="submit"><%= t('plugins.ecommerce.table.make_shipped', default: 'Mark as Shipped') %></button></span> </div> <% end %> </div> <table class="table"> <thead> <tr> - <th id=""><%= t('plugin.ecommerce.table.id') %></th> - <th id=""><%= t('plugin.ecommerce.table.customer') %></th> - <th id=""><%= t('plugin.ecommerce.table.status') %></th> - <th id=""><%= t('plugin.ecommerce.table.paid') %></th> - <th id=""><%= t('plugin.ecommerce.table.products') %></th> - <th id=""><%= t('plugin.ecommerce.table.amount') %></th> - <th id=""><%= t('plugin.ecommerce.table.received_time') %></th> - <th id=""><%= t('plugin.ecommerce.table.payment_method') %></th> - <th><%= t('camaleon_cms.admin.table.actions') %></th> + <th><%= cama_t('plugins.ecommerce.table.id') %></th> + <th><%= cama_t('plugins.ecommerce.table.customer') %></th> + <th><%= cama_t('plugins.ecommerce.table.status') %></th> + <th><%= cama_t('plugins.ecommerce.table.paid') %></th> + <th><%= cama_t('plugins.ecommerce.table.products') %></th> + <th><%= cama_t('plugins.ecommerce.table.amount') %></th> + <th><%= cama_t('plugins.ecommerce.table.created_at') %></th> + <th><%= cama_t('plugins.ecommerce.table.payment_method') %></th> + <th><%= cama_t('camaleon_cms.admin.table.actions') %></th> </tr> </thead> <tbody> <% @orders.each do |order| @@ -101,23 +92,23 @@ <% order.product_items.each do |item| %> <%= item.qty %> x <%= item.cache_the_title %> (<%= item.cache_the_price %>) <br> <% end %> </td> <td><%= order.cache_the_total %></td> - <td><%= order.received_at %></td> + <td><%= order.created_at %></td> <td><%= order.payment_method.name rescue "" %></td> <td> <%= link_to raw('<i class="fa fa-eye"></i>'), {action: :show, id: order.slug}, class: "btn btn-info btn-xs", title: "#{t('camaleon_cms.admin.button.preview')}" %> <%= link_to raw('<i class="fa fa-edit"></i>'), {action: :edit, id: order.slug}, class: "btn btn-default btn-xs", title: "#{t('camaleon_cms.admin.button.edit')}" %> - <%= link_to raw('<i class="fa fa-trash"></i>'), {action: :destroy, id: order.slug}, class: "btn btn-danger btn-xs", title: "#{t('camaleon_cms.admin.button.delete', default: 'Delete Order')}", method: :delete, 'data-confirm'=> t('plugin.ecommerce.table.confirm_delete', default: 'Are you sure to delete this order?') %> + <%= link_to raw('<i class="fa fa-trash"></i>'), {action: :destroy, id: order.slug}, class: "btn btn-danger btn-xs", title: "#{t('camaleon_cms.admin.button.delete', default: 'Delete Order')}", method: :delete, 'data-confirm'=> t('plugins.ecommerce.table.confirm_delete', default: 'Are you sure to delete this order?') %> <div class="btn-group"> <button class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="<%= t('camaleon_cms.admin.button.settings') %>"><i class="fa fa-cog"></i></button> <ul class="dropdown-menu pull-right" style="min-width: 50px;"> - <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_accepted', default: 'Mark as Accepted'), url_for(action: :mark_accepted, order_id: order.slug), class: 'btn btn-xs') if order.paid? %> - <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_shipped', default: 'Mark as Shipped'), url_for(action: :mark_shipped, order_id: order.slug), class: 'btn btn-xs mark_shipped_btn') if order.accepted? || order.paid? %> - <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_canceled', default: 'Mark as Canceled'), url_for(action: :mark_canceled, order_id: order.slug), class: 'btn btn-xs mark_canceled_btn', 'data-confirm_msg'=> t('plugin.ecommerce.table.confirm_mark_as_cancel', default: 'Are you sure to mark as Canceled?')) if order.bank_pending? || order.paid? %> - <%= content_tag :li, link_to(t('plugin.ecommerce.table.make_bank_confirmed', default: 'Mark as Paid'), url_for(action: :mark_bank_confirmed, order_id: order.slug), class: 'btn btn-xs', 'data-confirm'=> t('plugin.ecommerce.table.confirm_mark_as_paid', default: 'Are you sure to mark as Paid?')) if order.bank_pending? %> + <%= content_tag :li, link_to(t('plugins.ecommerce.table.make_accepted', default: 'Mark as Accepted'), url_for(action: :mark_accepted, order_id: order.slug), class: 'btn btn-xs') if order.paid? %> + <%= content_tag :li, link_to(t('plugins.ecommerce.table.make_shipped', default: 'Mark as Shipped'), url_for(action: :mark_shipped, order_id: order.slug), class: 'btn btn-xs mark_shipped_btn') if order.accepted? || order.paid? %> + <%= content_tag :li, link_to(t('plugins.ecommerce.table.make_canceled', default: 'Mark as Canceled'), url_for(action: :mark_canceled, order_id: order.slug), class: 'btn btn-xs mark_canceled_btn', 'data-confirm_msg'=> t('plugins.ecommerce.table.confirm_mark_as_cancel', default: 'Are you sure to mark as Canceled?')) if order.bank_pending? || order.on_delivery_pending? || order.paid? %> + <%= content_tag :li, link_to(t('plugins.ecommerce.table.make_bank_confirmed', default: 'Mark as Paid'), url_for(action: :mark_bank_confirmed, order_id: order.slug), class: 'btn btn-xs', 'data-confirm'=> t('plugins.ecommerce.table.confirm_mark_as_paid', default: 'Are you sure to mark as Paid?')) if order.bank_pending? || order.on_delivery_pending? %> </ul> </div> </td> </tr> <% end %> @@ -134,23 +125,22 @@ var link = $(this); e.preventDefault(); open_modal({title: link.text(), content: panel.find('#commerce_shipped_modal').html(), callback: function(modal){ modal.find('form').attr('action', link.attr('href')).validate(); }}); }); + panel.find('#ecommerce_adv_search_btn').click(function(e){ + var link = $(this); + e.preventDefault(); + open_modal({title: link.attr('title'), content: panel.find('#commerce_adv_search_modal').html(), callback: function(modal){ + modal.find('form').validate(); + }}); + }); + panel.find('.mark_canceled_btn').click(function(e){ var link = $(this); e.preventDefault(); open_modal({title: link.text(), content: panel.find('#commerce_cancel_modal').html(), callback: function(modal){ modal.find('form').attr('action', link.attr('href')).validate({submitHandler: function(){ return confirm(link.attr('data-confirm_msg')); }}); }}); - }); - - var cont = $('#orders-box-adv-search'); - var rnd = "input_" + Math.floor((Math.random() * 1000000) + 1); - cont.find('#adv-search > input').change(function () { - cont.find('form .' + rnd).val($(this).val()); - }).clone().attr('type', 'hidden').addClass(rnd).appendTo(cont.find('form')); - cont.find('#adv-search .btn-group > button').click(function () { - cont.find('form').submit(); }); }); </script>