kivitendo/js/kivi.EmailJournal.js @ 1e4f3be7
06118149 | Tamino Steinert | namespace('kivi.EmailJournal', function(ns) {
|
||
'use strict';
|
||||
ns.update_attachment_preview = function() {
|
||||
0245e662 | Tamino Steinert | let $form = $('#record_action_form');
|
||
06118149 | Tamino Steinert | |||
let data = $form.serializeArray();
|
||||
data.push({ name: 'action', value: 'EmailJournal/update_attachment_preview' });
|
||||
$.post("controller.pl", data, kivi.eval_json_result);
|
||||
}
|
||||
0245e662 | Tamino Steinert | |||
5e9f19cb | Tamino Steinert | ns.update_email_workflow_options = function() {
|
||
a7a69ac3 | Tamino Steinert | let customer_vendor = $('#customer_vendor_selection').val();
|
||
let record_action = $('#action_selection').val();
|
||||
5e9f19cb | Tamino Steinert | // Hide all div
|
||
['customer', 'vendor'].forEach(function(cv) {
|
||||
$(`#${cv}_div`).hide();
|
||||
['workflow_record', 'template_record', 'linking_record', 'new_record'].forEach(function(action) {
|
||||
$(`#${cv}_${action}_types_div`).hide();
|
||||
});
|
||||
});
|
||||
$('#new_record_div').hide();
|
||||
$('#template_record_div').hide();
|
||||
1c62fca1 | Tamino Steinert | $('#record_selection_div').hide();
|
||
a7a69ac3 | Tamino Steinert | |||
5e9f19cb | Tamino Steinert | // Enable needed div
|
||
$(`#${customer_vendor}_div`).show();
|
||||
$(`#${customer_vendor}_${record_action}_types_div`).show();
|
||||
if (record_action == 'new_record') {
|
||||
$('#new_record_div').show();
|
||||
$('#new_record_div').css('display','inline-block')
|
||||
0245e662 | Tamino Steinert | } else {
|
||
1c62fca1 | Tamino Steinert | $('#record_selection_div').show();
|
||
5e9f19cb | Tamino Steinert | kivi.EmailJournal.update_record_list();
|
||
0245e662 | Tamino Steinert | }
|
||
}
|
||||
e2836235 | Tamino Steinert | ns.update_record_list = function() {
|
||
let $form = $('#record_action_form');
|
||||
a7a69ac3 | Tamino Steinert | |||
e2836235 | Tamino Steinert | let data = $form.serializeArray();
|
||
data.push({ name: 'action', value: 'EmailJournal/update_record_list' });
|
||||
$.post("controller.pl", data, kivi.eval_json_result);
|
||||
a7a69ac3 | Tamino Steinert | }
|
||
0245e662 | Tamino Steinert | |||
1c62fca1 | Tamino Steinert | ns.apply_action_with_attachment = function(record_id, record_type) {
|
||
0245e662 | Tamino Steinert | let data = $('#record_action_form').serializeArray();
|
||
data.push({ name: 'action', value: 'EmailJournal/apply_record_action' });
|
||||
1c62fca1 | Tamino Steinert | data.push({ name: 'record_id', value: record_id });
|
||
data.push({ name: 'record_type', value: record_type });
|
||||
0245e662 | Tamino Steinert | |||
$.post("controller.pl", data, kivi.eval_json_result);
|
||||
}
|
||||
ea3ddb06 | Tamino Steinert | |||
7dcd4222 | Tamino Steinert | ns.ap_transaction_template_with_zugferd_import = function(record_id, record_type) {
|
||
817e6304 | Tamino Steinert | let data = $('#record_action_form').serializeArray();
|
||
7dcd4222 | Tamino Steinert | data.push({ name: 'action', value: 'EmailJournal/ap_transaction_template_with_zugferd_import' });
|
||
77a5beb7 | Tamino Steinert | data.push({ name: 'record_id', value: record_id });
|
||
data.push({ name: 'record_type', value: record_type });
|
||||
817e6304 | Tamino Steinert | $.post("controller.pl", data, kivi.eval_json_result);
|
||
}
|
||||
ea3ddb06 | Tamino Steinert | ns.toggle_obsolete = function(email_journal_id) {
|
||
let data = $('#record_action_form').serializeArray();
|
||||
data.push({ name: 'action', value: 'EmailJournal/toggle_obsolete' });
|
||||
data.push({ name: 'id', value: email_journal_id });
|
||||
$.post("controller.pl", data, kivi.eval_json_result);
|
||||
}
|
||||
0245e662 | Tamino Steinert | });
|