Revision 7589c136
Von Tamino Steinert vor etwa 2 Monaten hinzugefügt
js/kivi.Order.js | ||
---|---|---|
682 | 682 |
return true; |
683 | 683 |
}; |
684 | 684 |
|
685 |
ns.show_periodic_invoice_items_config_dialog = function(clicked) { |
|
686 |
if ($('#type').val() !== 'sales_order') return; |
|
687 |
|
|
688 |
let second_row = $(clicked).parents("tbody").first(); |
|
689 |
let first_row = $(second_row).parents("tbody").first(); |
|
690 |
|
|
691 |
let data = { |
|
692 |
type: $('#type').val(), |
|
693 |
id: $('#id').val(), |
|
694 |
item_id: $(first_row).find('[name="orderitem_ids[+]"]').val(), |
|
695 |
}; |
|
696 |
for (const value_key of [ |
|
697 |
'periodicity', 'terminated', 'start_date_as_date', 'end_date_as_date', |
|
698 |
'extend_automatically_by' |
|
699 |
]) { |
|
700 |
data[`periodic_invoice_items_config.${value_key}`] = |
|
701 |
$(second_row).find(`[name="order.orderitems[].periodic_invoice_items_config.${value_key}"]`).first().val(); |
|
702 |
} |
|
703 |
|
|
704 |
kivi.popup_dialog({ |
|
705 |
url: 'controller.pl?action=Order/show_periodic_invoice_items_config_dialog', |
|
706 |
data: data, |
|
707 |
id: 'periodic_invoice_items_config_dialog', |
|
708 |
load: kivi.reinit_widgets, |
|
709 |
dialog: { |
|
710 |
title: kivi.t8('Edit the configuration for periodic invoice item'), |
|
711 |
width: 800, |
|
712 |
height: 650 |
|
713 |
} |
|
714 |
}); |
|
715 |
return true; |
|
716 |
}; |
|
717 |
|
|
718 |
ns.assign_periodic_invoice_items_config = function(item_id) { |
|
719 |
let row = $(`#item_${item_id}`).parents("tbody").first(); |
|
720 |
let dialog = $('#periodic_invoice_items_config_dialog'); |
|
721 |
|
|
722 |
for (const value_key of [ |
|
723 |
'periodicity', 'terminated', 'start_date_as_date', 'end_date_as_date', |
|
724 |
'extend_automatically_by' |
|
725 |
]) { |
|
726 |
$(row).find(`[name="order.orderitems[].periodic_invoice_items_config.${value_key}"]`).first().val( |
|
727 |
$(dialog).find(`#periodic_invoice_items_config_${value_key}`).val() |
|
728 |
); |
|
729 |
} |
|
730 |
|
|
731 |
kivi.submit_ajax_form("controller.pl", '#periodic_invoice_items_config_from', |
|
732 |
{ |
|
733 |
action: 'Order/update_periodic_invoice_items_config_button', |
|
734 |
type: $('#type').val(), |
|
735 |
id: $('#id').val(), |
|
736 |
item_id: item_id, |
|
737 |
} |
|
738 |
); |
|
739 |
|
|
740 |
dialog.dialog('close'); |
|
741 |
return 1; |
|
742 |
} |
|
743 |
|
|
744 |
ns.delete_periodic_invoice_items_config = function(item_id) { |
|
745 |
let row = $(`#item_${item_id}`).parents("tbody").first(); |
|
746 |
let dialog = $('#periodic_invoice_items_config_dialog'); |
|
747 |
|
|
748 |
for (const value_key of [ |
|
749 |
'periodicity', 'terminated', 'start_date_as_date', 'end_date_as_date', |
|
750 |
'extend_automatically_by' |
|
751 |
]) { |
|
752 |
$(row).find(`[name="order.orderitems[].periodic_invoice_items_config.${value_key}"]`).first().val(null); |
|
753 |
} |
|
754 |
|
|
755 |
let data = []; |
|
756 |
data.push({name: 'action', value: 'Order/update_periodic_invoice_items_config_button'}); |
|
757 |
data.push({name: 'type', value: $('#type').val()}); |
|
758 |
data.push({name: 'id', value: $('#id').val()}); |
|
759 |
data.push({name: 'item_id', value: item_id}); |
|
760 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
761 |
|
|
762 |
dialog.dialog('close'); |
|
763 |
return 1; |
|
764 |
} |
|
765 |
|
|
685 | 766 |
ns.close_periodic_invoices_config_dialog = function() { |
686 | 767 |
$('#jq_periodic_invoices_config_dialog').dialog('close'); |
687 | 768 |
}; |
Auch abrufbar als: Unified diff
S:C:Order: Positionskonfiguration für Wied. Rech. bearbeiten können