{$default_all_attachments = ConfigHelper::checkConfig('documents.default_all_attachments')} {css} {js}
{tab_container id="customerdocuments" label="Customer Documents"} {tab_header content_id="docpanel"} {tab_header_cell icon="lms-ui-icon-document"} {trans("Customer Documents")} ({t a=$limit}last $a documents{/t}) {/tab_header_cell} {tab_header_cell} {trans("New Document")} {icon name="next" class="fa-fw"} {trans("All Documents")} {icon name="next" class="fa-fw"} {/tab_header_cell} {/tab_header} {tab_contents id="docpanel"} {tab_table} {if $documents}
{trans("Number:")}
{trans("Creation date")} / {trans("Confirmation date")}:
{trans("Created by")} / {trans("Confirmed by")}:
{trans("Type:")}
{trans("Title:")}
{trans("Description:")}
{trans("Period:")}
 
{/if} {foreach $documents as $doc} {if empty($doc.attachments)} {$doc.attachments = array()} {/if} {$docattach = reset($doc.attachments)} {capture assign="url"}?m=documentview&id={$doc.docid}{if $default_all_attachments}&attachments=1{elseif $doc.attachments|size == 1}&attachmentid={$docattach.id}{/if}{/capture}
{number number=$doc.number template=$doc.template customerid=$customerinfo.id time=$doc.cdate}
{$doc.cdate|date_format:"Y-m-d H:i"}{if $doc.sdate} / {$doc.sdate|date_format:"Y-m-d H:i"}{/if}
{$doc.username|escape} {if $doc.cuserid} / {$doc.cusername|escape}{/if} {if $doc.closed == $smarty.const.DOC_CLOSED_AFTER_CUSTOMER_SMS} {if !$doc.cuserid} {icon name="sms" tip="customer has accepted document via sms"} {/if} {elseif $doc.closed == $smarty.const.DOC_CLOSED_AFTER_CUSTOMER_SCAN} {icon name="sign" tip="attached document scans with customer signature"} {/if}
{assign var=type value=$doc.type}{$_DOCTYPES.$type}
{$doc.title|truncate:40:"…":true}
{if $doc.description} {$doc.description|escape|replace:"\n":'
'} {else} – {/if}
{if $doc.fromdate}{trans("from")} {$doc.fromdate|date_format:"Y-m-d"}{/if} {if $doc.todate}{trans("to")} {$doc.todate|date_format:"Y-m-d"}{/if} {if empty($doc.closed) && ($doc.fromdate || $doc.todate) && !empty($doc.dynamicperiod)}{trans("(dynamic)")}{/if}
{if $customerinfo.senddocuments} {textformat assign="tip" wrap=5000} {if $doc.senddate}{trans("Send document again")}
{t a=$doc.senddate|date_format:"Y-m-d H:i"}(already sent on $a){/t}{else}{trans("Document send")}{/if} {/textformat} {button type="link" class="send-doc" icon="{if $doc.senddate}mailsent{else}mail{/if}" href="?m=documentsend&id={$doc.docid}" tip=$tip} {/if} {assign var=type value=$doc.type} {button type="link" icon="save" href="?m=documentview&id={$doc.docid}&save=1" tip="Save"} {if ! $doc.closed && ($docrights.$type.rights & $smarty.const.DOCRIGHT_CONFIRM)} {button type="link" icon="confirm" href="?m=documentedit&id={$doc.docid}&action=confirm" tip="Confirm"} {/if} {if $doc.closed && !$doc.archived && ($docrights.$type.rights & $smarty.const.DOCRIGHT_ARCHIVE)} {button type="link" href="?m=documentedit&id={$doc.docid}&action=archive" class="archive-doc" icon="archive" tip="Archive"} {/if} {if ($docrights.$type.rights & $smarty.const.DOCRIGHT_DELETE)} {button type="link" class="delete-doc" href="?m=documentdel&id={$doc.docid}" icon="delete" onclick=$onclick tip="Remove document"} {/if} {if ($docrights.$type.rights & $smarty.const.DOCRIGHT_EDIT)} {button type="link" icon="edit" href="?m=documentedit&id={$doc.docid}" tip="Edit"} {/if} {if is_array($doc.attachments)} {if $docattach.type == 1 || count($doc.attachments) == 1} {documentview id="global-{$doc.docid}-{$docattach.id}" type=$docattach.contenttype doctype=$type name=$docattach.filename url=$url external=true text="" } {/if} {if count($doc.attachments) > 1 || !$docattach.type < 1} {/if} {/if}
{foreachelse}
{trans("That customer hasn't got any documents.")}
{/foreach} {/tab_table} {if !empty($documents) && count($documents)} {tab_button_panel} {tab_buttons} {button id="send-documents" icon="mail" label="Send documents" data_send_documents="{$customerinfo.senddocuments}"} {button id="confirm-docs" icon="confirm" label="Confirm"} {button id="archive-docs" icon="archive" label="Archive"} {button id="delete-docs" icon="delete" label="Delete"} {/tab_buttons} {tab_buttons} {/tab_buttons} {/tab_button_panel} {tab_button_panel} {tab_buttons} {button id="print-docs" icon="print" label="Print"}
{/tab_buttons} {/tab_button_panel} {/if} {/tab_contents} {/tab_container}