{extends file="config.tpl"}

{block name="content"}
<form method="POST" action="{$modulelink}&amp;page=details" autocomplete="off">
    <div class="row">
        <div class="col-md-12">
            <h2><i class="fas fa-file-invoice"></i> Details box</h2>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <h4 class="mb-3">Fields</h4>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="details_font_family">Font family</label>
                    <select name="details_font_family" class="form-control">
                        {foreach $fonts as $fontFile => $fontName}
                            <option value="{$fontFile}"{if $config.details_font_family eq $fontFile} selected{/if}>{$fontName}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="form-group col-md-3">
                    <label for="details_font_size">Size</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="details_font_size" value="{$config.details_font_size}" required>
                        <span class="input-group-addon">pt</span>
                    </div>
                </div>
                <div class="form-group col-md-3">
                    <label for="details_font_color">Color</label>
                    <input type="color" class="form-control" name="details_font_color" value="{$config.details_font_color}">
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <table class="table">
                        <tr>
                            <td style="vertical-align: bottom;">Line</td>
                            <td style="vertical-align: bottom;">Show</td>
                            <td style="vertical-align: bottom; writing-mode: vertical-lr;">Plain</td>
                            <td style="vertical-align: bottom; writing-mode: vertical-lr;"><strong>Bold</strong></td>
                            <td style="vertical-align: bottom; writing-mode: vertical-lr;"><em>Italic</em></td>
                            <td style="vertical-align: bottom; writing-mode: vertical-lr;"><span style="text-decoration: underline;">Underline</span></td>
                        </tr>
                        <tr>
                            <th>Invoice/Quote nr.</th>
                            <td>
                                <select class="form-control" name="details_title_show">
                                    <option value="first"{if $config.details_title_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_title_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_title_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_title_font_style" value=""{if $config.details_title_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_title_font_style" value="B"{if $config.details_title_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_title_font_style" value="I"{if $config.details_title_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_title_font_style" value="U"{if $config.details_title_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Date created</th>
                            <td>
                                <select class="form-control" name="details_created_show">
                                    <option value="first"{if $config.details_created_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_created_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_created_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_created_font_style" value=""{if $config.details_created_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_created_font_style" value="B"{if $config.details_created_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_created_font_style" value="I"{if $config.details_created_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_created_font_style" value="U"{if $config.details_created_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Due date</th>
                            <td>
                                <select class="form-control" name="details_due_show">
                                    <option value="first"{if $config.details_due_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_due_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_due_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_due_font_style" value=""{if $config.details_due_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_due_font_style" value="B"{if $config.details_due_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_due_font_style" value="I"{if $config.details_due_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_due_font_style" value="U"{if $config.details_due_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Payment date</th>
                            <td>
                                <select class="form-control" name="details_payment_show">
                                    <option value="first"{if $config.details_payment_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_payment_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_payment_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_payment_font_style" value=""{if $config.details_payment_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_payment_font_style" value="B"{if $config.details_payment_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_payment_font_style" value="I"{if $config.details_payment_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_payment_font_style" value="U"{if $config.details_payment_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Payment method</th>
                            <td>
                                <select class="form-control" name="details_paymethod_show">
                                    <option value="first"{if $config.details_paymethod_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_paymethod_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_paymethod_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_paymethod_font_style" value=""{if $config.details_paymethod_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_paymethod_font_style" value="B"{if $config.details_paymethod_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_paymethod_font_style" value="I"{if $config.details_paymethod_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_paymethod_font_style" value="U"{if $config.details_paymethod_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Client number</th>
                            <td>
                                <select class="form-control" name="details_client_show">
                                    <option value="first"{if $config.details_client_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_client_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_client_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_client_font_style" value=""{if $config.details_client_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_client_font_style" value="B"{if $config.details_client_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_client_font_style" value="I"{if $config.details_client_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_client_font_style" value="U"{if $config.details_client_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Client VAT</th>
                            <td>
                                <select class="form-control" name="details_vat_show">
                                    <option value="first"{if $config.details_vat_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_vat_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_vat_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_vat_font_style" value=""{if $config.details_vat_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_vat_font_style" value="B"{if $config.details_vat_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_vat_font_style" value="I"{if $config.details_vat_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_vat_font_style" value="U"{if $config.details_vat_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Custom fields</th>
                            <td>
                                <select class="form-control" name="details_custom_show">
                                    <option value="first"{if $config.details_custom_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_custom_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_custom_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_custom_font_style" value=""{if $config.details_custom_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_custom_font_style" value="B"{if $config.details_custom_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_custom_font_style" value="I"{if $config.details_custom_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_custom_font_style" value="U"{if $config.details_custom_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                        <tr>
                            <th>Date generated</th>
                            <td>
                                <select class="form-control" name="details_generated_show">
                                    <option value="first"{if $config.details_generated_show eq 'first'} selected{/if}>First page</option>
                                    <option value="all"{if $config.details_generated_show eq 'all'} selected{/if}>All pages</option>
                                    <option value="none"{if $config.details_generated_show eq 'none'} selected{/if}>None</option>
                                </select>
                            </td>
                            <td><input type="radio" name="details_generated_font_style" value=""{if $config.details_generated_font_style eq ''} checked{/if}/></td>
                            <td><input type="radio" name="details_generated_font_style" value="B"{if $config.details_generated_font_style eq 'B'} checked{/if}/></td>
                            <td><input type="radio" name="details_generated_font_style" value="I"{if $config.details_generated_font_style eq 'I'} checked{/if}/></td>
                            <td><input type="radio" name="details_generated_font_style" value="U"{if $config.details_generated_font_style eq 'U'} checked{/if}/></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="details_align">Alignment</label>
                    <div class="radio">
                        <label>
                            <input type="radio" name="details_align" value="l"{if $config.details_align eq 'l'} checked{/if}>
                            Left
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="details_align" value="lr"{if $config.details_align eq 'lr'} checked{/if}>
                            Labels left, values right
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="details_align" value="r"{if $config.details_align eq 'r'} checked{/if}>
                            Right
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="details_align" value="rl"{if $config.details_align eq 'rl'} checked{/if}>
                            Labels right, values left
                        </label>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="details_align">Style</label>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="details_colon" value="1"{if $config.details_colon} checked{/if}>
                            Add ':' suffix to labels
                        </label>
                        <label>
                            <input type="checkbox" name="details_hash" value="1"{if $config.details_hash} checked{/if}>
                            Add '#' suffix to number labels
                        </label>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="details_position_1_x">Position pg. 1</label>
                    <div class="input-group">
                        <span class="input-group-addon">X</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="details_position_1_x" value="{$config.details_position_1_x}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="details_position_1_y">&nbsp;</label>
                    <div class="input-group">
                        <span class="input-group-addon">Y</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="details_position_1_y" value="{$config.details_position_1_y}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="details_position_2_x">Position pg. 2+</label>
                    <div class="input-group">
                        <span class="input-group-addon">X</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="details_position_2_x" value="{$config.details_position_2_x}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="details_position_2_y">&nbsp;</label>
                    <div class="input-group">
                        <span class="input-group-addon">Y</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="details_position_2_y" value="{$config.details_position_2_y}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <h4 class="mb-3">Page numbers</h4>
            <div class="row">
                <div class="form-group col-md-6">
                    <div class="radio">
                        <label>
                            <input type="radio" name="pages_show" value="details"{if $config.pages_show eq 'details'} checked{/if}>
                            Show below details box
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="pages_show" value="position"{if $config.pages_show eq 'position'} checked{/if}>
                            Show at position X,Y
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="pages_show" value="center"{if $config.pages_show eq 'center'} checked{/if}>
                            Show horizontally centered at position Y
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="pages_show" value="none"{if $config.pages_show eq 'none'} checked{/if}>
                            Don't show
                        </label>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="fold_marks">Label</label><br/>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="pages_label" value="1"{if $config.pages_label} checked{/if}>
                            Show label
                        </label>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6 col-lg-4">
                    <label for="pages_font_family">Font family</label>
                    <select name="pages_font_family" class="form-control">
                        {foreach $fonts as $fontFile => $fontName}
                            <option value="{$fontFile}"{if $config.pages_font_family eq $fontFile} selected{/if}>{$fontName}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="form-group col-md-6 col-lg-3">
                    <label for="pages_font_style">Style</label>
                    <select class="form-control" name="pages_font_style">
                        <option value=""{if $config.pages_font_style eq ''} selected{/if}>Plain</option>
                        <option value="B"{if $config.pages_font_style eq 'B'} selected{/if}>Bold</option>
                        <option value="I"{if $config.pages_font_style eq 'I'} selected{/if}>Italic</option>
                        <option value="U"{if $config.pages_font_style eq 'U'} selected{/if}>Underline</option>
                    </select>
                </div>
                <div class="form-group col-md-6 col-lg-3">
                    <label for="pages_font_size">Size</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="pages_font_size" value="{$config.pages_font_size}" required>
                        <span class="input-group-addon">pt</span>
                    </div>
                </div>
                <div class="form-group col-md-6 col-lg-2">
                    <label for="pages_font_color">Color</label>
                    <input type="color" class="form-control" name="pages_font_color" value="{$config.pages_font_color}">
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="pages_position_1_x">Position pg. 1</label>
                    <div class="input-group">
                        <span class="input-group-addon">X</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="pages_position_1_x" value="{$config.pages_position_1_x}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="pages_position_1_y">&nbsp;</label>
                    <div class="input-group">
                        <span class="input-group-addon">Y</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="pages_position_1_y" value="{$config.pages_position_1_y}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="pages_position_2_x">Position pg. 2+</label>
                    <div class="input-group">
                        <span class="input-group-addon">X</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="pages_position_2_x" value="{$config.pages_position_2_x}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="pages_position_2_y">&nbsp;</label>
                    <div class="input-group">
                        <span class="input-group-addon">Y</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="pages_position_2_y" value="{$config.pages_position_2_y}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <hr class="mb-4">
        </div>
    </div>

    <div class="btn-group" role="group" aria-label="...">
        <button class="btn btn-primary"><i class="fas fa-save"></i> Save</button>
    </div>

</form>
{/block}
