Revision 1c62fca1
Von Tamino Steinert vor 12 Monaten hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
9 | 9 |
use SL::DB::EmailJournal; |
10 | 10 |
use SL::DB::EmailJournalAttachment; |
11 | 11 |
use SL::Presenter::EmailJournal; |
12 |
use SL::Presenter::Tag qw(html_tag div_tag radio_button_tag);
|
|
12 |
use SL::Presenter::Tag qw(html_tag div_tag button_tag); |
|
13 | 13 |
use SL::Helper::Flash; |
14 | 14 |
use SL::Locale::String qw(t8); |
15 | 15 |
|
... | ... | |
103 | 103 |
my $class = $RECORD_TYPES_INFO{$_}->{class}; |
104 | 104 |
map { $_ => "SL::DB::Manager::$class" } @{ $RECORD_TYPES_INFO{$_}->{types} } |
105 | 105 |
} keys %RECORD_TYPES_INFO; |
106 |
my @ALL_RECORD_TYPES = map { @{ $RECORD_TYPES_INFO{$_}->{types} } } keys %RECORD_TYPES_INFO; |
|
106 |
my @ALL_RECORD_TYPES = |
|
107 |
map { @{ $RECORD_TYPES_INFO{$_}->{types} } } keys %RECORD_TYPES_INFO; |
|
107 | 108 |
my %RECORD_TYPE_TO_NR_KEY = |
108 | 109 |
map { |
109 | 110 |
my $model = $RECORD_TYPE_TO_MODEL{$_}; |
... | ... | |
329 | 330 |
my $customer_vendor = $::form->{customer_vendor_selection}; |
330 | 331 |
my $customer_vendor_id = $::form->{"${customer_vendor}_id"}; |
331 | 332 |
my $action = $::form->{action_selection}; |
332 |
my $record_type_id = $::form->{"record_type_id"}; |
|
333 |
die t8("No record is selected.") unless $record_type_id || $action eq 'create_new'; |
|
333 |
my $record_id = $::form->{"record_id"}; |
|
334 |
my $record_type = $::form->{"record_type"}; |
|
335 |
$record_type ||= $::form->{"${customer_vendor}_record_type_selection"}; |
|
334 | 336 |
|
337 |
die t8("No record is selected.") unless $record_id || $action eq 'create_new'; |
|
338 |
die t8("No record type is selected.") unless $record_type; |
|
335 | 339 |
die "no 'email_journal_id' was given" unless $email_journal_id; |
336 | 340 |
die "no 'customer_vendor_selection' was given" unless $customer_vendor; |
337 | 341 |
die "no 'action_selection' was given" unless $action; |
338 | 342 |
|
339 |
my ($record_type, $record_id) = split(/-/, $record_type_id); |
|
340 |
|
|
341 | 343 |
if ($action eq 'linking') { |
342 | 344 |
return $self->link_and_add_attachment_to_record({ |
343 |
email_journal_id => $email_journal_id,
|
|
344 |
attachment_id => $attachment_id,
|
|
345 |
record_type => $record_type,
|
|
346 |
record_id => $record_id,
|
|
345 |
email_journal_id => $email_journal_id, |
|
346 |
attachment_id => $attachment_id, |
|
347 |
record_type => $record_type, |
|
348 |
record_id => $record_id, |
|
347 | 349 |
}); |
348 | 350 |
} |
349 | 351 |
|
... | ... | |
404 | 406 |
with_closed => $with_closed, |
405 | 407 |
); |
406 | 408 |
|
407 |
unless (@records) { |
|
408 |
$self->js->replaceWith('#record_list', div_tag( |
|
409 |
html_tag('h3', t8('No records found.')), |
|
410 |
id => 'record_list', |
|
411 |
))->render(); |
|
412 |
return; |
|
409 |
my $new_list; |
|
410 |
if (@records) { |
|
411 |
$new_list = join('', map { |
|
412 |
button_tag( |
|
413 |
"kivi.EmailJournal.apply_action_with_attachment('${\$_->id}', '${\$_->record_type}');", |
|
414 |
$_->displayable_name, |
|
415 |
class => "record_button", |
|
416 |
); |
|
417 |
} @records); |
|
418 |
} else { |
|
419 |
$new_list = html_tag('h3', t8('No records found.')); |
|
413 | 420 |
} |
414 |
|
|
415 | 421 |
my $new_div = div_tag( |
416 |
join('', map { |
|
417 |
div_tag( |
|
418 |
radio_button_tag('record_type_id', |
|
419 |
value => $_->record_type . "-" . $_->id, label => $_->displayable_name, |
|
420 |
class => "record_radio", label_class => "record_radio", |
|
421 |
), |
|
422 |
id => "record_$_->{id}", |
|
423 |
) |
|
424 |
} @records), |
|
422 |
$new_list, |
|
425 | 423 |
id => 'record_list', |
426 | 424 |
); |
427 | 425 |
|
428 |
$self->js->replaceWith('#record_list', $new_div)->render(); |
|
426 |
|
|
427 |
$self->js->replaceWith('#record_list', $new_div); |
|
428 |
$self->js->hide('#record_toggle_closed') if scalar @records < 20; |
|
429 |
$self->js->show('#record_toggle_open') if scalar @records < 20; |
|
430 |
$self->js->render(); |
|
429 | 431 |
} |
430 | 432 |
|
431 | 433 |
# |
... | ... | |
443 | 445 |
sub link_and_add_attachment_to_record { |
444 | 446 |
my ($self, $params) = @_; |
445 | 447 |
|
446 |
my $email_journal_id = $params->{email_journal_id};
|
|
447 |
my $attachment_id = $params->{attachment_id};
|
|
448 |
my $record_type = $params->{record_type};
|
|
449 |
my $record_id = $params->{record_id};
|
|
448 |
my $email_journal_id = $params->{email_journal_id}; |
|
449 |
my $attachment_id = $params->{attachment_id}; |
|
450 |
my $record_type = $params->{record_type}; |
|
451 |
my $record_id = $params->{record_id}; |
|
450 | 452 |
|
451 | 453 |
my $record_type_model = $RECORD_TYPE_TO_MODEL{$record_type}; |
452 | 454 |
my $record = $record_type_model->new(id => $record_id)->load; |
... | ... | |
459 | 461 |
|
460 | 462 |
$email_journal->link_to_record($record); |
461 | 463 |
|
462 |
return $self->js->flash('info', $::locale->text('Linked e-mail and attachment to ') . $record->displayable_name)->render(); |
|
464 |
$self->js->flash('info', |
|
465 |
$::locale->text('Linked e-mail and attachment to ') . $record->displayable_name |
|
466 |
)->render(); |
|
463 | 467 |
} |
464 | 468 |
|
465 | 469 |
sub find_customer_vendor_from_email { |
... | ... | |
501 | 505 |
return $customer_vendor; |
502 | 506 |
} |
503 | 507 |
|
504 |
sub find_customer_from_email { |
|
505 |
my ($self, $email_journal) = @_; |
|
506 |
my $email_address = $email_journal->from; |
|
507 |
|
|
508 |
my $customer = SL::DB::Manager::Customer->get_first( |
|
509 |
where => [ |
|
510 |
or => [ |
|
511 |
email => $email_address, |
|
512 |
cc => $email_address, |
|
513 |
bcc => $email_address, |
|
514 |
'contacts.cp_email' => $email_address, |
|
515 |
'contacts.cp_privatemail' => $email_address, |
|
516 |
'shipto.shiptoemail' => $email_address, |
|
517 |
], |
|
518 |
], |
|
519 |
with_objects => [ 'contacts', 'shipto' ], |
|
520 |
); |
|
521 |
|
|
522 |
return $customer; |
|
523 |
} |
|
524 |
|
|
525 | 508 |
sub add_js { |
526 | 509 |
$::request->{layout}->use_javascript("${_}.js") for qw( |
527 | 510 |
kivi.EmailJournal |
css/design40/email_journal.css | ||
---|---|---|
1 | 1 |
/* E-Mail-Journal */ |
2 |
input.record_radio { |
|
3 |
visibility:hidden; |
|
4 |
position:absolute; |
|
5 |
float: left; |
|
6 |
} |
|
7 |
label.record_radio { |
|
8 |
cursor: pointer; |
|
9 |
float: left; |
|
10 |
overflow: hidden; |
|
11 |
width: 200px; |
|
12 |
padding: 5px; |
|
13 |
margin: 5px; |
|
14 |
border-radius: 5px; |
|
15 |
border: 1px solid; |
|
16 |
text-align: center; |
|
17 |
} |
|
18 |
input.record_radio:checked + label { |
|
2 |
input.record_button { |
|
3 |
color: var(--color-dark); |
|
19 | 4 |
background-color: var(--color-lighter); |
5 |
width: 200px; |
|
6 |
padding: 5px; |
|
7 |
margin: 5px; |
|
8 |
float: left; |
|
20 | 9 |
} |
js/kivi.EmailJournal.js | ||
---|---|---|
3 | 3 |
|
4 | 4 |
ns.update_attachment_preview = function() { |
5 | 5 |
let $form = $('#record_action_form'); |
6 |
if ($form == undefined) { return; } |
|
7 | 6 |
|
8 | 7 |
let data = $form.serializeArray(); |
9 | 8 |
data.push({ name: 'action', value: 'EmailJournal/update_attachment_preview' }); |
... | ... | |
32 | 31 |
ns.update_action_selection = function() { |
33 | 32 |
let record_action = $('#action_selection').val(); |
34 | 33 |
|
35 |
$('#record_div').hide(); |
|
36 |
$('#no_record_div').hide();
|
|
34 |
$('#record_selection_div').hide();
|
|
35 |
$('#create_new_div').hide();
|
|
37 | 36 |
|
38 | 37 |
if (record_action == 'create_new') { |
39 |
$('#no_record_div').show(); |
|
38 |
$('#create_new_div').show(); |
|
39 |
$('#create_new_div').css('display','inline-block') |
|
40 | 40 |
} else { |
41 |
$('#record_div').show(); |
|
41 |
$('#record_selection_div').show();
|
|
42 | 42 |
} |
43 | 43 |
} |
44 | 44 |
|
... | ... | |
51 | 51 |
$.post("controller.pl", data, kivi.eval_json_result); |
52 | 52 |
} |
53 | 53 |
|
54 |
ns.apply_action_with_attachment = function() { |
|
54 |
ns.apply_action_with_attachment = function(record_id, record_type) {
|
|
55 | 55 |
let data = $('#record_action_form').serializeArray(); |
56 | 56 |
data.push({ name: 'action', value: 'EmailJournal/apply_record_action' }); |
57 |
data.push({ name: 'record_id', value: record_id }); |
|
58 |
data.push({ name: 'record_type', value: record_type }); |
|
57 | 59 |
|
58 | 60 |
$.post("controller.pl", data, kivi.eval_json_result); |
59 | 61 |
} |
60 | 62 |
}); |
61 |
|
|
62 |
$(function() { |
|
63 |
kivi.EmailJournal.update_attachment_preview(); |
|
64 |
}); |
templates/design40_webpages/email_journal/show.html | ||
---|---|---|
6 | 6 |
|
7 | 7 |
<h1>[% FORM.title %]</h1> |
8 | 8 |
|
9 |
<form> |
|
10 |
|
|
9 | 11 |
[% INCLUDE 'common/flash.html' %] |
10 | 12 |
|
11 |
<form> |
|
12 |
<div class="tabwidget" id="email_tabs"> |
|
13 |
<ul> |
|
14 |
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li> |
|
15 |
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=EmailJournal&object_id=[% HTML.url(SELF.entry.id) %]">[% 'Linked Records' | $T8 %]</a></li> |
|
16 |
</ul> |
|
17 |
|
|
18 |
[% PROCESS "email_journal/tabs/basic_data.html" %] |
|
19 |
</div> <!-- /.tabwidget --> |
|
13 |
<div class="tabwidget" id="email_tabs"> |
|
14 |
<ul> |
|
15 |
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li> |
|
16 |
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=EmailJournal&object_id=[% HTML.url(SELF.entry.id) %]">[% 'Linked Records' | $T8 %]</a></li> |
|
17 |
</ul> |
|
18 |
|
|
19 |
[% PROCESS "email_journal/tabs/basic_data.html" %] |
|
20 |
</div> <!-- /.tabwidget --> |
|
20 | 21 |
</form> |
21 | 22 |
|
22 | 23 |
<div class="wrapper" id="wrapper-0"> |
23 | 24 |
|
24 | 25 |
[% SET attachments = SELF.entry.attachments_sorted %] |
25 | 26 |
|
26 |
<div class="wrapper input-panel" style="vertical-align:top;" id="wrapper-2"> |
|
27 |
|
|
28 | 27 |
[% IF attachments.size %] |
29 |
<table id="email_journal_details" class="tbl-list"> |
|
30 |
<caption>[% 'Attachments' | $T8 %]</caption> |
|
31 |
<thead> |
|
32 |
<tr> |
|
33 |
<th>[% 'Attachment name' | $T8 %]</th> |
|
34 |
<th>[% 'MIME type' | $T8 %]</th> |
|
35 |
<th>[% 'Size' | $T8 %]</th> |
|
36 |
</tr> |
|
37 |
</thead> |
|
38 |
<tbody> |
|
39 |
[% FOREACH attachment = attachments %] |
|
40 |
<tr> |
|
41 |
<td>[% L.link(SELF.url_for(action="download_attachment", id=attachment.id), attachment.name) %]</td> |
|
42 |
<td>[% HTML.escape(attachment.mime_type) %]</td> |
|
43 |
<td>[% HTML.escape(LxERP.format_amount(attachment.content.length, 0)) %]</td> |
|
44 |
</tr> |
|
45 |
[% END %] |
|
46 |
</tbody> |
|
47 |
</table> |
|
28 |
<div class="wrapper input-panel"> |
|
29 |
<table id="email_journal_details" class="tbl-list"> |
|
30 |
<caption>[% 'Attachments' | $T8 %]</caption> |
|
31 |
<thead> |
|
32 |
<tr> |
|
33 |
<th>[% 'Attachment name' | $T8 %]</th> |
|
34 |
<th>[% 'MIME type' | $T8 %]</th> |
|
35 |
<th>[% 'Size' | $T8 %]</th> |
|
36 |
</tr> |
|
37 |
</thead> |
|
38 |
<tbody> |
|
39 |
[% FOREACH attachment = attachments %] |
|
40 |
<tr> |
|
41 |
<td>[% L.link(SELF.url_for(action="download_attachment", id=attachment.id), attachment.name) %]</td> |
|
42 |
<td>[% HTML.escape(attachment.mime_type) %]</td> |
|
43 |
<td>[% HTML.escape(LxERP.format_amount(attachment.content.length, 0)) %]</td> |
|
44 |
</tr> |
|
45 |
[% END %] |
|
46 |
</tbody> |
|
47 |
</table> |
|
48 |
</div> |
|
48 | 49 |
[% END %] |
49 | 50 |
|
50 | 51 |
[% IF SELF.entry.status == 'imported' || SELF.entry.status == 'record_imported' %] |
51 |
<form method="post" action="controller.pl" id="record_action_form"> |
|
52 |
[% L.hidden_tag('email_journal_id', SELF.entry.id) %] |
|
53 |
|
|
54 |
<div id="action_div" class="input-panel"> |
|
55 |
|
|
56 |
<div class="col"> |
|
57 |
[% L.select_tag('attachment_id', |
|
58 |
attachments, value_key='id', title_key='name', |
|
59 |
default = attachments.0.id, |
|
60 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
61 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
62 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
63 |
) |
|
64 |
%] |
|
65 |
</div> |
|
66 |
|
|
67 |
<div id="customer_vendor_div" class="col"> |
|
68 |
[% L.select_tag('customer_vendor_selection', |
|
69 |
[ |
|
70 |
{value => "customer", name => LxERP.t8("Sales")}, |
|
71 |
{value => "vendor", name => LxERP.t8("Purchase")}, |
|
72 |
], |
|
73 |
default = CV_TYPE_FOUND, |
|
74 |
value_key='value', title_key='name', |
|
75 |
class="wi-verysmall", |
|
76 |
onchange='kivi.EmailJournal.update_customer_vendor_selection();' |
|
77 |
) %] |
|
78 |
</div> |
|
79 |
[% FOREACH cv_option = [ |
|
80 |
['customer', 'Customer', 1], |
|
81 |
['vendor', 'Vendor', 0], |
|
82 |
] %] |
|
83 |
[% SET cv_type = cv_option.0 %] |
|
84 |
[% SET cv_name = cv_option.1 %] |
|
85 |
[% SET cv_is_cusotmer = cv_option.2 %] |
|
86 |
<div |
|
87 |
id="[% cv_type _ "_div" %]" class="col" |
|
88 |
style=[% IF cv_type == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %] |
|
89 |
> |
|
90 |
[% P.customer_vendor.picker( |
|
91 |
cv_type _ "_id", |
|
92 |
CUSTOMER_VENDOR.is_customer == cv_is_cusotmer ? CUSTOMER_VENDOR : undef, |
|
93 |
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name) |
|
94 |
onchange='kivi.EmailJournal.update_record_list();' |
|
95 |
) %] |
|
96 |
</div> |
|
97 |
[% END %] |
|
98 |
|
|
99 |
<div id="action_div" class="col"> |
|
100 |
[% L.select_tag('action_selection', |
|
101 |
[ |
|
102 |
{value => "workflow", name => LxERP.t8("Create from Workflow")}, |
|
103 |
{value => "linking", name => LxERP.t8("Linking to Record")}, |
|
104 |
{value => "create_new", name => LxERP.t8("Create new")}, |
|
105 |
], |
|
106 |
value_key='value', title_key='name', |
|
107 |
class="wi-normal", |
|
108 |
onchange='kivi.EmailJournal.update_action_selection();' |
|
109 |
) %] |
|
110 |
</div> |
|
111 |
|
|
112 |
[% FOREACH customer_vendor = ['customer', 'vendor'] %] |
|
113 |
<div id="[% customer_vendor _ "_record_types_div" %]" class="col" |
|
114 |
style=[% IF customer_vendor == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %] |
|
115 |
> |
|
52 |
<div class="wrapper input-panel control-panel" style="display:block"> |
|
53 |
<form method="post" action="controller.pl" id="record_action_form"> |
|
54 |
[% L.hidden_tag('email_journal_id', SELF.entry.id) %] |
|
55 |
<h2>[% LxERP.t8("Email-Workflow") %]</h2> |
|
56 |
|
|
57 |
<div id="action_div"><div class="input-panel" style="margin:0"> |
|
58 |
|
|
59 |
<div class="col"> |
|
60 |
[% L.select_tag('attachment_id', |
|
61 |
attachments, value_key='id', title_key='name', |
|
62 |
default = attachments.0.id, |
|
63 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
64 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
65 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
66 |
) |
|
67 |
%] |
|
68 |
</div> |
|
116 | 69 |
|
117 |
[% |
|
118 |
SET options = []; |
|
119 |
FOREACH record_info = RECORD_TYPES_WITH_INFO; |
|
120 |
IF (record_info.customervendor == customer_vendor); |
|
121 |
options.push({value => record_info.record_type, name => record_info.text}); |
|
122 |
END; |
|
123 |
END; |
|
124 |
%] |
|
125 |
[% L.select_tag(customer_vendor _ '_record_type_selection', |
|
126 |
options, |
|
127 |
value_key='value', title_key='name', |
|
128 |
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"), |
|
129 |
class="wi-normal", |
|
130 |
onchange='kivi.EmailJournal.update_record_list();' |
|
131 |
) %] |
|
132 |
</div> |
|
133 |
[% END %] |
|
134 |
<div id="record_number_div" class="col"> |
|
135 |
[% L.input_tag('record_number', '', |
|
136 |
class="wi-normal", placeholder=LxERP.t8("Record number") |
|
137 |
onchange='kivi.EmailJournal.update_record_list();' |
|
70 |
<div id="action_div" class="col"> |
|
71 |
[% L.select_tag('action_selection', |
|
72 |
[ |
|
73 |
{value => "workflow", name => LxERP.t8("Create from Workflow")}, |
|
74 |
{value => "linking", name => LxERP.t8("Linking to Record")}, |
|
75 |
{value => "create_new", name => LxERP.t8("Create new")}, |
|
76 |
], |
|
77 |
value_key='value', title_key='name', |
|
78 |
class="wi-normal", |
|
79 |
onchange='kivi.EmailJournal.update_action_selection();' |
|
138 | 80 |
) %] |
139 |
</div> |
|
81 |
</div>
|
|
140 | 82 |
|
141 |
<div id="with_closed_div" class="col">
|
|
142 |
[% L.select_tag('with_closed',
|
|
83 |
<div id="customer_vendor_div" class="col">
|
|
84 |
[% L.select_tag('customer_vendor_selection',
|
|
143 | 85 |
[ |
144 |
{value => "1", name => LxERP.t8("With closed")},
|
|
145 |
{value => "0", name => LxERP.t8("Only open")},
|
|
86 |
{value => "customer", name => LxERP.t8("Sales")},
|
|
87 |
{value => "vendor", name => LxERP.t8("Purchase")},
|
|
146 | 88 |
], |
147 |
default = 0, value_key='value', title_key='name', |
|
148 |
class="wi-small", |
|
149 |
onchange='kivi.EmailJournal.update_record_list();' |
|
89 |
default = CV_TYPE_FOUND, |
|
90 |
value_key='value', title_key='name', |
|
91 |
class="wi-verysmall", |
|
92 |
onchange='kivi.EmailJournal.update_customer_vendor_selection();' |
|
150 | 93 |
) %] |
151 |
</div> |
|
94 |
</div>
|
|
152 | 95 |
|
96 |
[% FOREACH customer_vendor = ['customer', 'vendor'] %] |
|
97 |
<div id="[% customer_vendor _ "_record_types_div" %]" class="col" |
|
98 |
style=[% IF customer_vendor == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %] |
|
99 |
> |
|
100 |
|
|
101 |
[% |
|
102 |
SET options = []; |
|
103 |
FOREACH record_info = RECORD_TYPES_WITH_INFO; |
|
104 |
IF (record_info.customervendor == customer_vendor); |
|
105 |
options.push({value => record_info.record_type, name => record_info.text}); |
|
106 |
END; |
|
107 |
END; |
|
108 |
%] |
|
109 |
[% L.select_tag(customer_vendor _ '_record_type_selection', |
|
110 |
options, |
|
111 |
value_key='value', title_key='name', |
|
112 |
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"), |
|
113 |
onchange='kivi.EmailJournal.update_record_list();' |
|
114 |
) %] |
|
115 |
</div> |
|
116 |
[% END %] |
|
117 |
</div></div> <!-- action_div --> |
|
118 |
|
|
119 |
<div id="record_selection_div"> |
|
120 |
<div id="filter_div"><div class="input-panel" style="margin:0"> |
|
121 |
[% FOREACH cv_option = [ |
|
122 |
['customer', 'Customer', 1], |
|
123 |
['vendor', 'Vendor', 0], |
|
124 |
] %] |
|
125 |
[% SET cv_type = cv_option.0 %] |
|
126 |
[% SET cv_name = cv_option.1 %] |
|
127 |
[% SET cv_is_cusotmer = cv_option.2 %] |
|
128 |
<div |
|
129 |
id="[% cv_type _ "_div" %]" class="col" |
|
130 |
style=[% IF cv_type == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %] |
|
131 |
> |
|
132 |
[% P.customer_vendor.picker( |
|
133 |
cv_type _ "_id", |
|
134 |
CUSTOMER_VENDOR.is_customer == cv_is_cusotmer ? CUSTOMER_VENDOR : undef, |
|
135 |
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name) |
|
136 |
onchange='kivi.EmailJournal.update_record_list();' |
|
137 |
) %] |
|
138 |
</div> |
|
139 |
[% END %] |
|
153 | 140 |
|
154 |
<div class="col"> |
|
155 |
[% L.button_tag('kivi.EmailJournal.apply_action_with_attachment();', LxERP.t8('Apply with Attachment')) %] |
|
156 |
</div> |
|
157 |
</div> <!-- action_div --> |
|
141 |
<div id="record_number_div" class="col"> |
|
142 |
[% L.input_tag('record_number', '', |
|
143 |
class="wi-normal", placeholder=LxERP.t8("Record number") |
|
144 |
onchange='kivi.EmailJournal.update_record_list();' |
|
145 |
) %] |
|
146 |
</div> |
|
147 |
|
|
148 |
<div id="with_closed_div" class="col"> |
|
149 |
[% L.select_tag('with_closed', |
|
150 |
[ |
|
151 |
{value => "1", name => LxERP.t8("With closed")}, |
|
152 |
{value => "0", name => LxERP.t8("Only open")}, |
|
153 |
], |
|
154 |
default = 0, value_key='value', title_key='name', |
|
155 |
class="wi-small", |
|
156 |
onchange='kivi.EmailJournal.update_record_list();' |
|
157 |
) %] |
|
158 |
</div> |
|
159 |
</div></div> <!-- filter_div --> |
|
158 | 160 |
|
159 |
[% BLOCK panel_1 %] |
|
160 | 161 |
<div id="record_div"> |
161 |
<div id="record_list"> |
|
162 |
[% FOREACH record = RECORDS %] |
|
163 |
<div id="record_[% record.id %]"> |
|
164 |
[% L.radio_button_tag('record_type_id', class="record_radio", |
|
165 |
value=record.record_type _ '-' _ record.id, |
|
166 |
label_class="record_radio", label=record.displayable_name) %] |
|
162 |
[% SET show_records = (RECORDS.size < 20); |
|
163 |
IF show_records; |
|
164 |
SET display_toggle_off = 'style="display:none;"' ; |
|
165 |
SET display_toggle_on = 'style="display:block;"' ; |
|
166 |
ELSE ; |
|
167 |
SET display_toggle_off = 'style="display:block;"' ; |
|
168 |
SET display_toggle_on = 'style="display:none;"' ; |
|
169 |
END ; |
|
170 |
%] |
|
171 |
<div id="record_toggle_closed" |
|
172 |
class="record_toggle toggle_panel control-panel" [% display_toggle_off %]> |
|
173 |
<a href="#" onClick='javascript:$(".record_toggle").toggle()' |
|
174 |
class="button toggle off neutral"> |
|
175 |
[% LxERP.t8('Show Records') %] |
|
176 |
</a> |
|
177 |
</div><!-- /.record_toggle --> |
|
178 |
|
|
179 |
<div id="record_toggle_open" |
|
180 |
class="record_toggle toggle_panel control-panel" [% display_toggle_on %]> |
|
181 |
<a href="#" onClick='javascript:$(".record_toggle").toggle()' |
|
182 |
class="button toggle on neutral with-panel"> |
|
183 |
[% LxERP.t8('Hide Records') %] |
|
184 |
</a> |
|
185 |
<div class="toggle_panel_block"> |
|
186 |
<div id="record_list"> |
|
187 |
[% FOREACH record = RECORDS %] |
|
188 |
[% L.button_tag( |
|
189 |
'kivi.EmailJournal.apply_action_with_attachment("' |
|
190 |
_ record.id _ '", "' _ record.record_type |
|
191 |
_ '");', |
|
192 |
record.displayable_name, |
|
193 |
class="record_button" |
|
194 |
) %] |
|
195 |
[% END %] |
|
196 |
[% IF RECORDS.size == 0 %] |
|
197 |
<h3> [% LxERP.t8("No records found.") %] </h3> |
|
198 |
[% END %] |
|
199 |
</div> |
|
167 | 200 |
</div> |
168 |
[% END %] |
|
169 |
[% IF RECORDS.size == 0 %] |
|
170 |
<div id="no_record_div"> |
|
171 |
<h3> [% LxERP.t8("No records found.") %] </h3> |
|
172 |
</div> |
|
173 |
[% END %] |
|
174 |
</div> |
|
175 |
</div> |
|
176 |
<div id="no_record_div" class="col" style="display:none"> |
|
177 |
<h3> [% LxERP.t8("No record needed.") %] </h3> |
|
201 |
</div><!-- /.record_toggle --> |
|
202 |
</div><!-- record_div --> |
|
203 |
</div><!-- record_selection_div --> |
|
204 |
<div id="create_new_div" class="input-panel" style="display:none;min-width:0;margin:0"> |
|
205 |
[% L.button_tag('kivi.EmailJournal.apply_action_with_attachment();', |
|
206 |
LxERP.t8('Apply with Attachment')) %] |
|
178 | 207 |
</div> |
179 |
[% END %] |
|
180 |
[% SET display_status = (RECORDS.size > 20 ? 'closed' : 'open'); |
|
181 |
INCLUDE 'common/toggle_panel.html' |
|
182 |
block_name='panel_1' |
|
183 |
button_closed = LxERP.t8('Show Records') |
|
184 |
button_open = LxERP.t8('Hide Records') |
|
185 |
; |
|
186 |
%] |
|
187 |
</form> |
|
188 | 208 |
|
189 |
<!-- kivi.EmailJournal.update_attachment_preview --> |
|
190 |
<div id="attachment_preview"></div> |
|
209 |
</form> |
|
210 |
|
|
211 |
<!-- kivi.EmailJournal.update_attachment_preview --> |
|
212 |
<div class="wrapper" style="overflow:auto"><div id="attachment_preview"></div></div> |
|
213 |
|
|
214 |
</div> |
|
191 | 215 |
[% END %] |
192 |
</div> <!-- wrapper-2 --> |
|
193 | 216 |
|
194 | 217 |
</div> <!-- wrapper-0 --> |
218 |
|
|
219 |
<script type="text/javascript"> |
|
220 |
$(document).ready(function() { |
|
221 |
kivi.EmailJournal.update_action_selection(); |
|
222 |
kivi.EmailJournal.update_customer_vendor_selection(); |
|
223 |
kivi.EmailJournal.update_record_list(); |
|
224 |
kivi.EmailJournal.update_attachment_preview(); |
|
225 |
}); |
|
226 |
</script> |
Auch abrufbar als: Unified diff
EmailJournal: Workflow: Auswahl von Beleg optimiert