Add edit note line on an order

This commit is contained in:
Jean-Baptiste Bellet
2022-06-29 11:23:50 +02:00
parent 7fbe893927
commit 3f1099d968
6 changed files with 50 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ $(document).ready(function() {
$('a.edit-tracking').click(toggleTrackingEdit);
$('a.cancel-tracking').click(toggleTrackingEdit);
$('a.edit-note').click(toggleNoteEdit);
$('a.cancel-note').click(toggleNoteEdit);
handle_tracking_save = function(){
var link = $(this);
var shipment_number = link.data('shipment-number');

View File

@@ -145,6 +145,12 @@ toggleTrackingEdit = function(){
link.parents('tbody').find('tr.show-tracking').toggle();
}
toggleNoteEdit = function(){
var link = $(this);
link.parents('tbody').find('tr.edit-note').toggle();
link.parents('tbody').find('tr.show-note').toggle();
}
toggleMethodEdit = function(){
var link = $(this);
link.parents('tbody').find('tr.edit-method').toggle();

View File

@@ -6,6 +6,7 @@
= render 'spree/admin/orders/insufficient_stock_lines', insufficient_stock_lines: @order.insufficient_stock_lines
= render :partial => "spree/admin/orders/shipment", :collection => @order.shipments, :locals => { :order => order }
= render partial: "spree/admin/orders/note", locals: { order: @order }
= render :partial => "spree/admin/orders/_form/adjustments", :locals => { :adjustments => @order.line_item_adjustments, :title => t(".line_item_adjustments")}
= render :partial => "spree/admin/orders/_form/adjustments", :locals => { :adjustments => order_adjustments_for_display(@order), :title => t(".order_adjustments")}

View File

@@ -0,0 +1,22 @@
%table.index.edit-note-table
%tr.edit-note.hidden.total
%td{ :colspan => "5" }
%label
= t(".note_label")
= text_field_tag :note, @order.note
%td.actions
= link_to '', '', class: 'save-note icon_link icon-ok no-text with-tip', data: { action: 'save' }, title: I18n.t('actions.save')
= link_to '', '', class: 'cancel-note icon_link icon-cancel no-text with-tip', data: { action: 'cancel' }, title: I18n.t('actions.cancel')
%tr.show-note.total
%td{ :colspan => "5" }
- if order.note.present?
%strong
= t(".note_label")
= order.note
- else
= t(".no_note_present")
%td.actions
= link_to '', '', class: 'edit-note icon_link icon-edit no-text with-tip', data: { action: 'edit' }, title: Spree.t('edit')

View File

@@ -90,6 +90,18 @@ table.index td.actions {
text-align: left;
}
table.edit-note-table {
margin-top: -15px;
tr:first-child th, tr:first-child td {
border-top: none;
}
td.actions {
width: 15%;
}
}
.index-controls {
button {

View File

@@ -838,6 +838,9 @@ en:
variants_without_unit_value: "WARNING: Some variants do not have a unit value"
all: "All"
select_variant: "Select a variant"
note:
note_label: "Note:"
no_note_present: "No note provided."
enterprise:
select_outgoing_oc_products_from: Select outgoing OC products from
@@ -3782,6 +3785,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using
from: "From"
to: "Bill to"
shipping: "Shipping"
note:
note_label: "Note:"
no_note_present: "No note provided."
form:
distribution_fields:
title: "Distribution"