{extends file="config.tpl"}

{block name="content"}
<form method="POST" action="{$modulelink}&amp;page=text" autocomplete="off">
    <div class="row">
        <div class="col-md-12">
            <h2><i class="fas fa-file-invoice"></i> Text</h2>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <h4 class="mb-3">Notes</h4>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="notes_show">Show</label>
                    <select class="form-control" name="notes_show">
                        <option value="transactions"{if $config.notes_show eq 'transactions'} selected{/if}>After transactions</option>
                        <option value="before_transactions"{if $config.notes_show eq 'before_transactions'} selected{/if}>Before transactions</option>
                        <option value="first"{if $config.notes_show eq 'first'} selected{/if}>Position on first page</option>
                        <option value="last"{if $config.notes_show eq 'last'} selected{/if}>Position on last page</option>
                        <option value="never"{if $config.notes_show eq 'never'} selected{/if}>Never</option>
                    </select>
                </div>
                <div class="form-group col-md-6">
                    <label for="notes_title_show">Show title</label>
                    <select class="form-control" name="notes_title_show">
                        <option value="true"{if $config.notes_title_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.notes_title_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="notes_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="notes_position_x" value="{$config.notes_position_x}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <label for="notes_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="notes_position_y" value="{$config.notes_position_y}" required>
                        <span class="input-group-addon">mm</span>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6 col-lg-4">
                    <label for="notes_text_font_family">Font family</label>
                    <select name="notes_text_font_family" class="form-control">
                        {foreach $fonts as $fontFile => $fontName}
                            <option value="{$fontFile}"{if $config.notes_text_font_family eq $fontFile} selected{/if}>{$fontName}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="form-group col-md-6 col-lg-3">
                    <label for="notes_text_font_style">Style</label>
                    <select class="form-control" name="notes_text_font_style">
                        <option value=""{if $config.notes_text_font_style eq ''} selected{/if}>Plain</option>
                        <option value="B"{if $config.notes_text_font_style eq 'B'} selected{/if}>Bold</option>
                        <option value="I"{if $config.notes_text_font_style eq 'I'} selected{/if}>Italic</option>
                        <option value="U"{if $config.notes_text_font_style eq 'U'} selected{/if}>Underline</option>
                    </select>
                </div>
                <div class="form-group col-md-6 col-lg-3">
                    <label for="notes_text_font_size">Size</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="notes_text_font_size" value="{$config.notes_text_font_size}" required>
                        <span class="input-group-addon">pt</span>
                    </div>
                </div>
                <div class="form-group col-md-6 col-lg-2">
                    <label for="notes_text_font_color">Color</label>
                    <input type="color" class="form-control" name="notes_text_font_color" value="{$config.notes_text_font_color}">
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-6">
                    <label for="notes_additional_show">Show additional notes</label>
                    <select class="form-control" name="notes_additional_show">
                        <option value="prepend"{if $config.notes_additional_show eq 'prepend'} selected{/if}>Prepend</option>
                        <option value="append"{if $config.notes_additional_show eq 'append'} selected{/if}>Append</option>
                        <option value="replace"{if $config.notes_additional_show eq 'replace'} selected{/if}>Replace</option>
                        <option value="ignore"{if $config.notes_additional_show eq 'ignore'} selected{/if}>Ignore</option>
                    </select>
                </div>
                <div class="form-group col-md-12">
                    <label for="notes_additional_text">Additional notes</label>
                    <textarea class="form-control" rows="4" name="notes_additional_text">{$config.notes_additional_text}</textarea>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <h4 class="mb-3">Quote Proposal text</h4>
            <div class="row">
                <div class="form-group col-md-6 col-lg-4">
                    <label for="proposal_font_family">Font family</label>
                    <select name="proposal_font_family" class="form-control">
                        {foreach $fonts as $fontFile => $fontName}
                            <option value="{$fontFile}"{if $config.proposal_font_family eq $fontFile} selected{/if}>{$fontName}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="form-group col-md-6 col-lg-3">
                    <label for="proposal_font_style">Style</label>
                    <select class="form-control" name="proposal_font_style">
                        <option value=""{if $config.proposal_font_style eq ''} selected{/if}>Plain</option>
                        <option value="B"{if $config.proposal_font_style eq 'B'} selected{/if}>Bold</option>
                        <option value="I"{if $config.proposal_font_style eq 'I'} selected{/if}>Italic</option>
                        <option value="U"{if $config.proposal_font_style eq 'U'} selected{/if}>Underline</option>
                    </select>
                </div>
                <div class="form-group col-md-6 col-lg-3">
                    <label for="proposal_font_size">Size</label>
                    <div class="input-group">
                        <input type="number" pattern="\d+" class="form-control" name="proposal_font_size" value="{$config.proposal_font_size}" required>
                        <span class="input-group-addon">pt</span>
                    </div>
                </div>
                <div class="form-group col-md-6 col-lg-2">
                    <label for="proposal_font_color">Color</label>
                    <input type="color" class="form-control" name="proposal_font_color" value="{$config.proposal_font_color}">
                </div>
                <div class="form-group col-md-4">
                    <label for="quote_title_show">Show title</label>
                    <select class="form-control" name="quote_title_show">
                        <option value="true"{if $config.quote_title_show eq 'true'} selected{/if}>Yes</option>
                        <option value="false"{if $config.quote_title_show eq 'false'} selected{/if}>No</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <hr class="mb-4">
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <h4 class="mb-3">
                Invoice Text
            </h4>
            <div class="row">
                <div class="form-group col-md-3">
                    <label for="invoice_text_show">Show</label>
                    <select class="form-control" name="invoice_text_show">
                        <option value="before_title"{if $config.invoice_text_show eq 'before_title'} selected{/if}>Before invoice title</option>
                        <option value="after_title"{if $config.invoice_text_show eq 'after_title'} selected{/if}>After invoice title</option>
                        <option value="never"{if $config.invoice_text_show eq 'never'} selected{/if}>Never</option>
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="form-group col-md-12">
                    <label for="invoice_text">Text</label>
                    <textarea class="tinymce form-control" rows="4" name="invoice_text">{$config.invoice_text}</textarea>
                    {include file="editor.tpl"}
                </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}
