|
[% USE HTML %][% USE L %][% USE LxERP %][%- USE P -%] [% USE T8 %]
|
|
|
|
<h1>[% FORM.title %]</h1>
|
|
|
|
[%- INCLUDE 'common/flash.html' %]
|
|
|
|
<div class="tabwidget" id="email_tabs">
|
|
<ul>
|
|
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
|
|
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=EmailJournal&object_id=[% HTML.url(SELF.entry.id) %]">[% 'Linked Records' | $T8 %]</a></li>
|
|
</ul>
|
|
|
|
[% PROCESS "email_journal/tabs/basic_data.html" %]
|
|
</div> <!-- /.tabwidget -->
|
|
|
|
[% SET attachments = SELF.entry.attachments_sorted %]
|
|
<h2>[% LxERP.t8("Attachments") %]</h2>
|
|
[% IF attachments.size %]
|
|
|
|
<table id="email_journal_details" class="email_journal_details">
|
|
<thead>
|
|
<tr>
|
|
<th>[% LxERP.t8("Attachment name") %]</th>
|
|
<th>[% LxERP.t8("MIME type") %]</th>
|
|
<th>[% LxERP.t8("Size") %]</th>
|
|
<th>[% LxERP.t8("Processed") %]</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH attachment = attachments %]
|
|
<tr class="listrow">
|
|
<td>[% L.link(SELF.url_for(action="download_attachment", id=attachment.id), attachment.name) %]</td>
|
|
<td>[% HTML.escape(attachment.mime_type) %]</td>
|
|
<td>[% HTML.escape(LxERP.format_amount(attachment.content.length, 0)) %]</td>
|
|
<td>[% HTML.escape(attachment.processed_as_bool_yn) %]</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
[% IF SELF.entry.status == 'imported' %]
|
|
<form method="post" action="controller.pl" id="record_action_form">
|
|
[% L.hidden_tag('email_journal_id', SELF.entry.id) %]
|
|
[% L.hidden_tag('back_to', back_to) %]
|
|
<h2>[% LxERP.t8("Email Journal Workflow") %]</h2>
|
|
|
|
<table> <tr>
|
|
<div style="display:flex">
|
|
<div>
|
|
[% L.select_tag('attachment_id',
|
|
attachments, value_key='id', title_key='name',
|
|
default = attachments.0.id,
|
|
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"),
|
|
'data-title'=LxERP.t8("Attachment"), class="wi-normal",
|
|
onchange='kivi.EmailJournal.update_attachment_preview();'
|
|
)
|
|
%]
|
|
</div>
|
|
|
|
<div>
|
|
[% L.select_tag('action_selection',
|
|
[
|
|
{value => "workflow_record", name => LxERP.t8("Create from Workflow")},
|
|
{value => "linking_record", name => LxERP.t8("Linking to Record")},
|
|
{value => "new_record", name => LxERP.t8("Create new")},
|
|
{value => "template_record", name => LxERP.t8("Create from Record Template")},
|
|
],
|
|
value_key='value', title_key='name',
|
|
class="wi-normal",
|
|
onchange='kivi.EmailJournal.update_email_workflow_options();'
|
|
) %]
|
|
</div>
|
|
|
|
<div>
|
|
[% L.select_tag('customer_vendor_selection',
|
|
[
|
|
{value => "customer", name => LxERP.t8("Sales")},
|
|
{value => "vendor", name => LxERP.t8("Purchase")},
|
|
],
|
|
default = CV_TYPE_FOUND,
|
|
value_key='value', title_key='name',
|
|
class="wi-verysmall",
|
|
onchange='kivi.EmailJournal.update_email_workflow_options();'
|
|
) %]
|
|
</div>
|
|
|
|
<div>
|
|
[% FOREACH customer_vendor = ['customer', 'vendor'] %]
|
|
<div id="[% customer_vendor _ "_workflow_record_types_div" %]"
|
|
style=[% IF customer_vendor == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %]
|
|
>
|
|
|
|
[%
|
|
SET options = [];
|
|
FOREACH record_info = RECORD_TYPES_WITH_INFO;
|
|
IF (record_info.customervendor == customer_vendor && record_info.can_workflow && !record_info.is_template);
|
|
options.push({value => record_info.record_type, name => record_info.text});
|
|
END;
|
|
END;
|
|
%]
|
|
[% L.select_tag(customer_vendor _ '_workflow_record_type_selection',
|
|
options,
|
|
value_key='value', title_key='name',
|
|
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"),
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
<div id="[% customer_vendor _ "_new_record_types_div" %]"
|
|
style="display:none"
|
|
>
|
|
[%
|
|
SET options = [];
|
|
FOREACH record_info = RECORD_TYPES_WITH_INFO;
|
|
IF (record_info.customervendor == customer_vendor && !record_info.workflow_needed && !record_info.is_template);
|
|
options.push({value => record_info.record_type, name => record_info.text});
|
|
END;
|
|
END;
|
|
%]
|
|
[% L.select_tag(customer_vendor _ '_new_record_type_selection',
|
|
options,
|
|
value_key='value', title_key='name',
|
|
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"),
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
<div id="[% customer_vendor _ "_linking_record_types_div" %]"
|
|
style="display:none"
|
|
>
|
|
[%
|
|
SET options = [];
|
|
FOREACH record_info = RECORD_TYPES_WITH_INFO;
|
|
IF (record_info.customervendor == customer_vendor && !record_info.is_template);
|
|
options.push({value => record_info.record_type, name => record_info.text});
|
|
END;
|
|
END;
|
|
%]
|
|
[% L.select_tag(customer_vendor _ '_linking_record_type_selection',
|
|
options,
|
|
value_key='value', title_key='name',
|
|
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"),
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
|
|
|
|
<div id="[% customer_vendor _ "_template_record_types_div" %]"
|
|
style="display:none"
|
|
>
|
|
[%
|
|
SET options = [];
|
|
FOREACH record_info = RECORD_TYPES_WITH_INFO;
|
|
IF (record_info.customervendor == customer_vendor && record_info.is_template);
|
|
options.push({value => record_info.record_type, name => record_info.text});
|
|
END;
|
|
END;
|
|
%]
|
|
[% L.select_tag(customer_vendor _ '_template_record_type_selection',
|
|
options,
|
|
value_key='value', title_key='name',
|
|
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"),
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
|
|
</tr> <tr>
|
|
<td>
|
|
<div id="record_selection_div">
|
|
<div style="display:flex">
|
|
[% FOREACH cv_option = [
|
|
['customer', 'Customer'],
|
|
['vendor', 'Vendor' ],
|
|
] %]
|
|
[% SET cv_type = cv_option.0 %]
|
|
[% SET cv_name = cv_option.1 %]
|
|
<div
|
|
id="[% cv_type _ "_div" %]"
|
|
style=[% IF cv_type == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %]
|
|
>
|
|
[% P.customer_vendor.picker(
|
|
cv_type _ "_id",
|
|
cv_type == 'customer' ? CUSTOMER : VENDOR,
|
|
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name)
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
[% END %]
|
|
|
|
<div id="record_number_div">
|
|
[% L.input_tag('record_number', '',
|
|
class="wi-normal", placeholder=LxERP.t8("Record number")
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
|
|
<div id="with_closed_div">
|
|
[% L.select_tag('with_closed',
|
|
[
|
|
{value => "1", name => LxERP.t8("With closed")},
|
|
{value => "0", name => LxERP.t8("Only open")},
|
|
],
|
|
default = 0, value_key='value', title_key='name',
|
|
onchange='kivi.EmailJournal.update_record_list();'
|
|
) %]
|
|
</div>
|
|
</div>
|
|
<!-- gets updated on $(document).ready -->
|
|
<div id="record_div">
|
|
<div id="record_toggle_closed"
|
|
class="record_toggle toggle_panel control-panel" style="display:block;">
|
|
<a href="#" onClick='javascript:$(".record_toggle").toggle()'
|
|
class="button toggle off neutral">
|
|
[% LxERP.t8('Show Records') %]
|
|
</a>
|
|
</div><!-- /.record_toggle -->
|
|
<div id="record_toggle_open"
|
|
class="record_toggle toggle_panel control-panel" style="display:none;">
|
|
<a href="#" onClick='javascript:$(".record_toggle").toggle()'
|
|
class="button toggle on neutral with-panel">
|
|
[% LxERP.t8('Hide Records') %]
|
|
</a>
|
|
<div class="toggle_panel_block">
|
|
<div id="record_list">[% LxERP.t8("Loading...") %]</div>
|
|
</div>
|
|
</div><!-- /.record_toggle -->
|
|
</div><!-- record_div -->
|
|
</div><!-- record_selection_div -->
|
|
<div id="new_record_div" class="input-panel" style="display:none;min-width:0;margin:0">
|
|
[% L.button_tag('kivi.EmailJournal.apply_action_with_attachment();',
|
|
LxERP.t8('Apply with Attachment')) %]
|
|
</div>
|
|
</td>
|
|
|
|
</tr> </table>
|
|
</form>
|
|
|
|
<!-- kivi.EmailJournal.update_attachment_preview -->
|
|
<div id="attachment_preview"></div>
|
|
[% END %]
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
kivi.EmailJournal.update_email_workflow_options();
|
|
kivi.EmailJournal.update_attachment_preview();
|
|
});
|
|
</script>
|