{extends file="config.tpl"}

{block name="content"}
<form method="POST" action="{$modulelink}&amp;page=invoice" autocomplete="off">
    <div class="row">
        <div class="col-md-12">
            <h2><i class="fas fa-file-invoice-dollar"></i> Invoice</h2>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <h4 class="mb-3">Items</h4>
            <div class="row">
                <div class="form-group col-md-4">
                    <label for="items_title_show">Show title</label>
                    <select class="form-control" name="items_title_show">
                        <option value="true"{if $config.items_title_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_title_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_table_header_show">Show headers</label>
                    <select class="form-control" name="items_table_header_show">
                        <option value="true"{if $config.items_table_header_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_table_header_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_table_numbers_show">Show item numbers</label>
                    <select class="form-control" name="items_table_numbers_show">
                        <option value="true"{if $config.items_table_numbers_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_table_numbers_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_table_qty_show">Show Quantity</label>
                    <select class="form-control" name="items_table_qty_show">
                        <option value="true"{if $config.items_table_qty_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_table_qty_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_firstline_bold">Bold first item lines</label>
                    <select class="form-control" name="items_firstline_bold">
                        <option value="true"{if $config.items_firstline_bold eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_firstline_bold eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_product_descriptions">Show product descriptions</label>
                    <select class="form-control" name="items_product_descriptions">
                        <option value="true"{if $config.items_product_descriptions eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_product_descriptions eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_strip_empty_customfields">Hide empty custom fields</label>
                    <select class="form-control" name="items_strip_empty_customfields">
                        <option value="true"{if $config.items_strip_empty_customfields eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.items_strip_empty_customfields eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-4">
                    <label for="items_number_width">Number width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="items_number_width" value="{$config.items_number_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_qty_width">Quantity width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="items_qty_width" value="{$config.items_qty_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_desc_width">Description width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="items_desc_width" value="{$config.items_desc_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_unit_width">Unit width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="items_unit_width" value="{$config.items_unit_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-4">
                    <label for="items_amount_width">Amount width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="items_amount_width" value="{$config.items_amount_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="alert alert-info" role="alert">
                        Please make sure that column widths add up to 100
                    </div>
                </div>
                <div class="col-md-8">
                    <label for="items_amount_width">Regular expression filter</label>
                    <div class="alert alert-warning" role="alert">
                        Anything that matches the configured regular expression will be filtered out of invoice and quote items. Only use if you know what you are doing.
                    </div>
                    <input type="text" class="form-control" name="items_filter" value="{$config.items_filter}">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <h4 class="mb-3">Summary</h4>
            <div class="row">
                <div class="form-group col-md-12">
                    <div class="radio">
                        <label>
                            <input type="radio" name="summary_show" value="items"{if $config.summary_show eq 'items'} checked{/if}>
                            Show after items
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="summary_show" value="position"{if $config.summary_show eq 'position'} checked{/if}>
                            Show at position
                        </label>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="summary_position_x">Position</label>
                    <div class="input-group">
                        <span class="input-group-addon">X</span>
                        <input type="number" step="0.1" pattern="\d+" class="form-control" name="summary_position_x" value="{$config.summary_position_x}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_position_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="summary_position_y" value="{$config.summary_position_y}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="summary_tax">Tax</label>
                    <select class="form-control" name="summary_tax">
                        <option value="auto"{if $config.summary_tax eq 'auto'} selected{/if}>Show when > 0%</option>
                        <option value="always"{if $config.summary_tax eq 'always'} selected{/if}>Always show</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_tax_show">Tax name</label>
                    <select class="form-control" name="summary_tax_show">
                        <option value="prefix"{if $config.summary_tax_show eq 'prefix'} selected{/if}>Show as prefix</option>
                        <option value="suffix"{if $config.summary_tax_show eq 'suffix'} selected{/if}>Show as suffix</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_subtotal_show">Subtotal</label>
                    <select class="form-control" name="summary_subtotal_show">
                        <option value="always"{if $config.summary_subtotal_show eq 'always'} selected{/if}>Always show</option>
                        <option value="auto"{if $config.summary_subtotal_show eq 'auto'} selected{/if}>Show when tax or credit present</option>
                        <option value="never"{if $config.summary_subtotal_show eq 'never'} selected{/if}>Never show</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_credit_show">Applied Credit</label>
                    <select class="form-control" name="summary_credit_show">
                        <option value="always"{if $config.summary_credit_show eq 'always'} selected{/if}>Always show</option>
                        <option value="auto"{if $config.summary_credit_show eq 'auto'} selected{/if}>Show when > 0</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_credit_remaining_show">Credit balance</label>
                    <select class="form-control" name="summary_credit_remaining_show">
                        <option value="always"{if $config.summary_credit_remaining_show eq 'always'} selected{/if}>Always show</option>
                        <option value="auto"{if $config.summary_credit_remaining_show eq 'auto'} selected{/if}>Show when > 0</option>
                        <option value="never"{if $config.summary_credit_remaining_show eq 'never'} selected{/if}>Never show</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_account_due_show">Account balance</label>
                    <select class="form-control" name="summary_account_due_show">
                        <option value="always"{if $config.summary_account_due_show eq 'always'} selected{/if}>Always show</option>
                        <option value="auto"{if $config.summary_account_due_show eq 'auto'} selected{/if}>Show when > 0</option>
                        <option value="never"{if $config.summary_account_due_show eq 'never'} selected{/if}>Never show</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="summary_transactions_show">Transactions</label>
                    <select class="form-control" name="summary_transactions_show">
                        <option value="always"{if $config.summary_transactions_show eq 'always'} selected{/if}>Always show</option>
                        <option value="auto"{if $config.summary_transactions_show eq 'auto'} selected{/if}>Auto</option>
                        <option value="never"{if $config.summary_transactions_show eq 'never'} selected{/if}>Never show</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <hr class="mb-4">
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <h4 class="mb-3">Transactions</h4>
            <div class="row">
                <div class="form-group col-md-4">
                    <label for="transactions_show">Show</label>
                    <select class="form-control" name="transactions_show">
                        <option value="always"{if $config.transactions_show eq 'always'} selected{/if}>Always</option>
                        <option value="auto"{if $config.transactions_show eq 'auto'} selected{/if}>Auto</option>
                        <option value="next"{if $config.transactions_show eq 'next'} selected{/if}>Auto (next page)</option>
                        <option value="never"{if $config.transactions_show eq 'never'} selected{/if}>Never</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="transactions_title_show">Show title</label>
                    <select class="form-control" name="transactions_title_show">
                        <option value="true"{if $config.transactions_title_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.transactions_title_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
                <div class="form-group col-md-4">
                    <label for="transactions_table_header_show">Show headers</label>
                    <select class="form-control" name="transactions_table_header_show">
                        <option value="true"{if $config.transactions_table_header_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.transactions_table_header_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="transactions_date_width">Date width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="transactions_date_width" value="{$config.transactions_date_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="transactions_gateway_width">Gateway width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="transactions_gateway_width" value="{$config.transactions_gateway_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="transactions_id_width">Transaction width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="transactions_id_width" value="{$config.transactions_id_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="transactions_amount_width">Amount width</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="transactions_amount_width" value="{$config.transactions_amount_width}" required>
                        <span class="input-group-addon">%</span>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="alert alert-info" role="alert">
                        Please make sure that column widths add up to 100
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <h4 class="mb-3">Transaction table headers</h4>
            <div class="row">
                <div class="form-group form-inline col-md-6">
                    <label for="table_alt_header_border_top">Border</label><br/>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="table_alt_header_border_top" value="1"{if $config.table_alt_header_border_top} checked{/if}>
                            Top
                        </label>
                    </div>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="table_alt_header_border_right" value="1"{if $config.table_alt_header_border_right} checked{/if}>
                            Right
                        </label>
                    </div>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="table_alt_header_border_bottom" value="1"{if $config.table_alt_header_border_bottom} checked{/if}>
                            Bottom
                        </label>
                    </div>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="table_alt_header_border_left" value="1"{if $config.table_alt_header_border_left} checked{/if}>
                            Left
                        </label>
                    </div>
                </div>
                <div class="form-group col-md-3">
                    <label for="table_alt_header_border_thickness">thickness</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="table_alt_header_border_thickness" value="{$config.table_alt_header_border_thickness}" required>
                        <span class="input-group-addon">px</span>
                    </div>
                </div>
                <div class="form-group col-md-3">
                    <label for="table_alt_header_border_color">color</label>
                    <input type="color" class="form-control" name="table_alt_header_border_color" value="{$config.table_alt_header_border_color}">
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="table_alt_header_font_family">Font family</label>
                    <select name="table_alt_header_font_family" class="form-control">
                        {foreach $fonts as $fontFile => $fontName}
                            <option value="{$fontFile}"{if $config.table_alt_header_font_family eq $fontFile} selected{/if}>{$fontName}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="form-group col-md-3">
                    <label for="table_alt_header_font_style">Style</label>
                    <select class="form-control" name="table_alt_header_font_style">
                        <option value=""{if $config.table_alt_header_font_style eq ''} selected{/if}>Plain</option>
                        <option value="B"{if $config.table_alt_header_font_style eq 'B'} selected{/if}>Bold</option>
                        <option value="I"{if $config.table_alt_header_font_style eq 'I'} selected{/if}>Italic</option>
                        <option value="U"{if $config.table_alt_header_font_style eq 'U'} selected{/if}>Underline</option>
                    </select>
                </div>
                <div class="form-group col-md-3">
                    <label for="table_alt_header_font_size">Size</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="table_alt_header_font_size" value="{$config.table_alt_header_font_size}" required>
                        <span class="input-group-addon">pt</span>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-3">
                    <label for="table_alt_header_draw">Color</label>
                    <input type="color" class="form-control" name="table_alt_header_draw" value="{$config.table_alt_header_draw}">
                </div>
                <div class="form-group col-md-3">
                    <label for="table_alt_header_fill">Background</label>
                    <input type="color" class="form-control" name="table_alt_header_fill" value="{$config.table_alt_header_fill}">
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <hr class="mb-4">
        </div>
    </div>

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

</form>
{/block}
