Add delete note feature

This commit is contained in:
binarygit
2022-07-09 13:21:25 +05:45
parent 2f550725e3
commit dc31ebebb1
2 changed files with 19 additions and 1 deletions

View File

@@ -79,6 +79,23 @@ $(document).ready(function() {
});
}
handle_note_delete = function(){
var link = $(this);
var note = ''
var url = Spree.url( Spree.routes.orders_api + "/" + order_number);
$.ajax({
type: "PUT",
url: url,
data: { note: note }
}).done(function( msg ) {
window.location.reload();
}).error(function( msg ) {
console.log(msg);
});
}
$('[data-hook=admin_order_edit_form] a.save-tracking').click(handle_tracking_save);
$('[data-hook=admin_order_edit_form] a.save-note').click(handle_note_save);
$('[data-hook=admin_order_edit_form] a.delete-note').click(handle_note_delete);
});

View File

@@ -3,7 +3,7 @@
%td{ colspan: "5", data: { controller: "input-char-count" }, style: "position: relative;" }
%label
= t(".note_label")
= text_field_tag :note, @order.note, { maxLength: 280, data: { "input-char-count-target": "input" } }
= text_field_tag :note, @order.note, { maxLength: 280, data: { "input-char-count-target": "input" } }
%span.edit-note-count{ data: { "input-char-count-target": "count" }, style: "position: absolute; right: 7px; top: 7px; font-size: 11px;" }
%td.actions
@@ -21,3 +21,4 @@
%td.actions
= link_to '', '', class: 'edit-note icon_link icon-edit no-text with-tip', data: { action: 'edit' }, title: Spree.t('edit')
= link_to '', '', class: 'delete-note icon_link icon-trash no-text with-tip', data: { action: 'delete' }, title: Spree.t('delete')