{include file="mobile/templates/index_top.tpl"}
<div class="pages navbar-through toolbar-through">
    <!-- Page, "data-page" contains page name -->
    <div data-page="view-line" class="page toolbar-fixed">
        <!-- Scrollable page content -->
        <div class="page-content pull-to-refresh-content messages-content">
            <!-- Default pull to refresh layer-->
            <div class="pull-to-refresh-layer">
                <div class="preloader"></div>
                <div class="pull-to-refresh-arrow"></div>
            </div>

            <input type="hidden" class="page_to_back" value="{if $rel_table}{$rel_table}{else}{$cur_table}{/if}"/>
            <input type="hidden" class="page_to_back_tr" value="{$cur_table}"/>
            <input type="hidden" class="back_url_64" value="{$base64_current_url}"/>
            <input type="hidden" class="page_to_real_page" value="{$page}"/>
            <input type="hidden" class="page_to_real_filter" value="{$filter_id}"/>
            <input type="hidden" class="page_to_real_status"
                   value="{if $archive}&archive{elseif $deleted}&deleted{/if}"/>

            <!-- View Block -->
            <div class="list-block view_block_class" id="view_block" {if $edit_mode}style="display:none"{/if}>
                <div class="m__record-view--rec-name"  id="table_return_link">
                    <a style="display: none;" href="fields.php?table={$table_id}{if $rel_table}&rel_table={$rel_table}&rel_line={$rel_line}&rel_field={$rel_field}{/if}
                        {if $filter_id}&filter={$filter_id}{/if}{if $page}&page={$page}{/if}">
                            {$name_table}
                            {if $archive} &nbsp;<i>({$lang.archive})</i>{/if}
                            {if $deleted} &nbsp;<i>({$lang.deleted})</i>{/if}
                    </a>
                    <p>{$head_text}</p>
                </div>
                <ul class="m_status-panel" table_id="{$table_id}" line_id="{$line_id}" style="{if !$informers and !$deleted and !$archive}display: none;{/if}">
                    {if $deleted}
                        <li class="m_status-panel__item m_deleted-record__informer">
                            <span>{$lang.Write} {$lang.deleted_g}</span>
                        </li>
                    {/if}

                    {if $archive}
                        <li class="m_status-panel__item m_archived-record__informer">
                            <span>{$lang.archived_record}</span>
                        </li>
                    {/if}

                    {if $informers}
                        {foreach from=$informers item=one_informer}
                            <li class="m_status-panel__item"
                                id="informer_{$table_id}_{$line_id}_{$one_informer.id}"
                                style="background-color:{if $one_informer.bg_color}{$one_informer.bg_color}{else}transparent{/if}; color:{if $one_informer.txt_color}{$one_informer.txt_color}{else}#000{/if};"
                                {if $one_informer.text|strlen > 120}title="{$one_informer.text}"{/if}>
                                <span>{$one_informer.text}</span>
                            </li>
                        {/foreach}
                    {/if}
                </ul>
                {assign var="ulOpened" value=false}
                {assign var="lastItemInArray" value={$show_grp_fld|@count}}
                {foreach from=$show_grp_fld key=i item=one_field}
                    {if $one_field.type=="fgroup" && !$one_field.hidden && !$one_field.hidden_read}
                        {if $ulOpened}
                            {$ulOpened=false}
                            </ul>
                        {/if}
                        <div class="m__f-group-header" id="group-field-{$one_field.id}"
                             style="{if !$foot}border-top: 1px solid #c8c7cc;{/if}"
                             onClick="hithere(this);">
                            <button type="button" class="expand_view-line_button">
                            <span>

                            </span>
                            <span style="transform: rotate(90deg) translate(-1px, 0px); display:none">

                            </span>
                            </button>
                            <span>
                                {$one_field.name_group}
                            </span>
                        </div>
                    {/if}
                    {if !$one_field.type=="fgroup" && !$one_field.hidden && !$one_field.hidden_read}
                        {if !$ulOpened}
                            {$ulOpened=true}
                            <ul closed=false class="m__f-group-list">
                        {/if}
                                <li>
                                    <div class="item-content">
                                        <div class="item-inner">
                                            <div class="item-title label">
                                                {$one_field.name_field}
                                            </div>
                                            <div class="item-input" value="{$one_field.input}"
                                                id="edit_{$one_field.id}"
                                                field-type="{$one_field.type_field}"
                                                data-default='{$one_field.default_value}'
                                                style="word-wrap: break-word;"
                                            >
                                                {if $one_field.type_field eq 1 or $one_field.type_field eq 10}
                                                    {if $one_field.display}
                                                      {$one_field.display}
                                                    {else}
                                                      {$one_field.display}
                                                    {/if}
                                                {elseif $one_field.type_field eq 5}
                                                    {if $one_field.display and $one_field.mult_value == 1}
                                                      {$one_field.display[$one_field.value.id].text}
                                                    {else}
                                                      {$one_field.display}
                                                    {/if}
                                                {else}
                                                    {$one_field.display}
                                                {/if}
                                            </div>
                                        </div>
                                    </div>
                                </li>
                    {/if}
                    {if $i == $lastItemInArray}
                        </ul>
                    {/if}
                {/foreach}
            </div>

            <!-- Edit Block -->
            <div id="edit_block" {if !$edit_mode}style="display:none"{/if} class="edit_block_class">
                <div class="m__record-view--rec-name">
                    <p>{$head_text} - {$lang.Edit2}</p>
                </div>
                <form enctype="multipart/form-data"
                      action="view_line2.php?table={$table_id}{if $rel_table}&rel_table={$rel_table}&rel_line={$rel_line}&rel_field={$rel_field}{/if}{if $all_filters_on}&all_filters_on{elseif $filter_id}&filter={$filter_id}{/if}{if $archive}&archive{/if}{if $deleted}&deleted{/if}{if $page}&page={$page}{/if}&line={$line_id}&csrf={$csrf}"
                      id="edit_form" method="POST" class="ajax-submit">
                    <div class="list-block">
                        {foreach from=$show_grp_fld item=one_field}
                            {if $one_field.type=="fgroup" || ($main_line and $one_field.id==$main_field) || (!$one_field.hidden and !$one_field.hidden_read)}
                                {if $one_field.type=="fgroup"}
                                    <div class="list-group main-field" field_id="{$one_field.id}">
                                {else}
                                    <div class="list-group" field_id="{$one_field.id}">
                                {/if}
                                    <ul>
                                        {if $one_field.type=="fgroup"}
                                            <li class="list-group-title group-name">{$one_field.name_group}</li>
                                        {elseif $main_line and $one_field.id==$main_field}
                                            <li>
                                                <div class="item-content">
                                                    <div class="item-inner">
                                                        <div class="item-title label">
                                                            {if $lang.conf.{$one_field.name_field}}{$lang.conf.{$one_field.name_field}}{else}{$one_field.name_field}{/if}
                                                            {if $one_field.main}<span style="color: #f00"
                                                                                      title="{$lang.required_field}">
                                                                    *</span>{/if}
                                                        </div>
                                                        <div class="item-input">

                                                        </div>
                                                    </div>
                                                </div>
                                            </li>
                                        {elseif !$one_field.hidden and !$one_field.hidden_read}
                                            <li {if $line_id=="array"}style="display: grid;grid-template-columns: 30px auto;"{/if}>
                                                {if $line_id=="array"}
                                                    <label class="item-content label-checkbox">
                                                        <input type="checkbox"
                                                               {if $one_field.write}name="edit[{$line_id}][{$one_field.id}]"{/if}/>
                                                        <div class="item-media">
                                                            <i class="icon icon-form-checkbox"></i>
                                                        </div>
                                                    </label>
                                                {/if}
                                                {if $one_field.type_field eq 5 and !$one_field.hidden_write}
                                                <a href="#"
                                                   class="item-link {if $one_field.type_field eq 5}m-cb-control-multi-link{/if}"
                                                   data-table-id="{$table_id}" data-filter-id="{$filter_id}"
                                                   data-line-id="{$line_id}" data-field-id="{$one_field.id}"
                                                   data-s-table-id="{$one_field.s_table_id}"
                                                   data-s-field-id="{$one_field.s_field_id}"
                                                   data-filter-value="{foreach from=$show_grp_fld item=temp_field}{if $one_field.parent_link_field==$temp_field.id}{if $temp_field['value']|is_array }{$temp_field['value']['raw']}{elseif $temp_field['value']!='{$lang.No_access}'}{$temp_field['value']}{/if}{/if}{/foreach}"
                                                   data-csrf="{$csrf}"
                                                   {if $one_field.parent_link_field}fixed-search-parent-field="{$one_field.parent_link_field}"{/if}
                                                   {if $one_field.child_link_field}fixed-search-child-field="{$one_field.child_link_field}"{/if}>
                                                    {/if}
                                                    <div class="item-content">
                                                        <div class="item-inner {if $one_field.type_field eq 5}ie_component_fuck{/if}">
                                                            <div class="item-title label {if $one_field.main}supamida{/if}">
                                                                {if $lang.conf.{$one_field.name_field}}{$lang.conf.{$one_field.name_field}}{else}{$one_field.name_field}{/if}
                                                                {if $one_field.main}<span style="color: #f00"
                                                                                          title="{$lang.required_field}">
                                                                        *</span>{/if}
                                                            </div>
                                                            <div class="item-input"
                                                                 style="{if $one_field.type_field eq 5}{/if}">

                                                                {if $one_field.type_field eq 1 or $one_field.type_field eq 2 or $one_field.type_field eq 8 or $one_field.type_field eq 10 or $one_field.type_field eq 12 or ($one_field.type_field eq 3 and !($one_field.mult_value))}     {* число | дата | номер | текст одностр. *}
                                                                    {if $one_field.Split_template_mask}
                                                                        {$one_field.Split_template_mask}
                                                                    {else}
                                                                        {if $one_field.hidden_write}
                                                                            {$one_field.display}
                                                                            <input type="hidden" class="valval" name="value[{$line_id}][{$one_field.id}]" id="value{$one_field.id}" value="{$one_field.display}">
                                                                        {else}
                                                                            {if $line_id!="array"}<input type="hidden"
                                                                                                        {if $one_field.write}name="edit[{$line_id}][{$one_field.id}]"{/if}
                                                                                                        value="1"/>{/if}
                                                                            <input type="{if $one_field.type_field eq 2 or $one_field.type_field eq 12}{if $one_field.type_value==1}datetime-local{else}date{/if}{else}text{/if}"
                                                                                {if $one_field.write}name="value[{$line_id}][{$one_field.id}]"{/if}
                                                                                id="value{$one_field.id}"
                                                                                value="{$one_field.value}"
                                                                                field-type="{$one_field.type_field}"
                                                                                data-default="{if $one_field.type_field eq 1}{if $one_field.dec_dig < 1}{$one_field.default_value}{else}{if $one_field.default_value eq 0}0,{section name=foo start=0 loop=$one_field.dec_dig}0{/section}{else}{$one_field.default_value}{/if}{/if}{else}{$one_field.default_value}{/if}"
                                                                                data-val-type="{if $one_field.type_field eq 1 or $one_field.type_field eq 10}{if $one_field.default_value}{$one_field.default_value}{else}{if $one_field.dec_dig < 1}0{else}0,{section name=foo start=0 loop=$one_field.dec_dig}0{/section}{/if}{/if}{/if}"
                                                                                class="valval {if $one_field.type_field eq 3}single_input{else}short_input{/if}{if $one_field.type_field eq 2 or $one_field.type_field eq 12}datepicker{/if}{if $one_field.action_yes}extra-ajax-field{/if}"
                                                                                    {if $line_id=='array'}onChange="document.getElementById('edit{$one_field.id}').checked=1"{/if}
                                                                                    {if $one_field.type_field eq 3 and !$one_field.mult_value and $one_field.template|count_characters gt 0}
                                                                                        onkeypress="return check_txt({$one_field.id},event)"
                                                                                        onClick="check_click({$one_field.id});"
                                                                                        onFocus="check_click({$one_field.id});"
                                                                                        onBlur="tmpl_clean_bg(this);
                                                                                        {if $one_field.type_field eq 1}setPlaceholder(this);{/if}"
                                                                                        onInput="recheck_txt({$one_field.id})"
                                                                                    {elseif $one_field.type_field eq 1}
                                                                                        onClick="checkClickOnNumberField(this,
                                                                                    {if $one_field.dec_dig < 1}
                                                                                        {$one_field.default_value}
                                                                                    {else}
                                                                                    {if $one_field.default_value eq 0}0,{section name=foo start=0 loop=$one_field.dec_dig}0{/section}{else}{$one_field.default_value}{/if}{/if});" onBlur="checkNewValueOfNumberField(this, '{if $one_field.dec_dig < 1}{$one_field.default_value}{else}{if $one_field.default_value eq 0}0,{section name=foo start=0 loop=$one_field.dec_dig}0{/section}{else}{$one_field.default_value}{/if}{/if}');"  onInput="recheck_txt({$one_field.id})"{/if}
                                                                                    >

                                                                            {if !$one_field.write}<input type="hidden"
                                                                                                        class="valval"
                                                                                                        name="value[{$line_id}][{$one_field.id}]"
                                                                                                        id="value{$one_field.id}"
                                                                                                        value="{$one_field.value}">{/if}
                                                                            {if $one_field.type_field eq 3 and !$one_field.mult_value and $one_field.template|count_characters gt 0}
                                                                                <div class="template_note input-hint">
                                                                                    <div id="templ_word{$one_field.id}"
                                                                                        style="display: none;"></div>
                                                                                    <div id="templ_note{$one_field.id}"
                                                                                        class="templ_tips"></div>
                                                                                </div>
                                                                                <input class="primary-textfield form-control" type="hidden" id="templ_tmp{$one_field.id}"
                                                                                    size="45 " value="{$one_field.template}">
                                                                                <div id="templ_err{$one_field.id}"
                                                                                    class="error_mess"></div>
                                                                                <div id="templ_rep{$one_field.id}"></div>
                                                                                <input class="form-control" type="hidden"
                                                                                    id="templ_fill_ok{$one_field.id}"
                                                                                    value="{if $one_field.input|count_characters gt 0}1{else}0{/if}">
                                                                            {/if}
                                                                        {/if}
                                                                    {/if}
                                                                {elseif $one_field.type_field eq 3 and $one_field.mult_value}     {* текст многостр. *}
                                                                    {if $one_field.hidden_write}
                                                                        {$one_field.display}
                                                                        <input type="hidden" class="valval" name="value[{$line_id}][{$one_field.id}]" id="value{$one_field.id}" value="{$one_field.display}">
                                                                    {else}
                                                                        {if $line_id!="array"}<input type="hidden"
                                                                                                    {if $one_field.write}name="edit[{$line_id}][{$one_field.id}]"{/if}
                                                                                                    value="1"/>
                                                                        {/if}
                                                                            <textarea
                                                                                    {if $one_field.write}name="value[{$line_id}][{$one_field.id}]"{/if}
                                                                                    id="value{$one_field.id}" rows="10"
                                                                                    cols="20" {if $line_id=='array'}onChange="document.getElementById('edit{$one_field.id}').checked=1"{/if}
                                                                                    class="valval {if $one_field.action_yes}extra-ajax-field{/if}">{$one_field.input}</textarea>
                                                                    {/if}
                                                                {elseif $one_field.type_field eq 4 or $one_field.type_field eq 7 or $one_field.type_field eq 11 or $one_field.type_field eq 13 or $one_field.type_field eq 14}     {* список | пользователь | группа *}
                                                                    {if !$one_field.mult_value}
                                                                        {if $one_field.hidden_write}
                                                                            {$one_field.display}
                                                                            <input type="hidden" class="valval" name="value[{$line_id}][{$one_field.id}]" id="value{$one_field.id}" value="{$one_field.display}">
                                                                        {else}
                                                                            <select class="valval"
                                                                                    {if $one_field.write}name="value[{$line_id}][{$one_field.id}]"{/if}
                                                                                    id="value{$one_field.id}" {if $line_id=='array'}onChange="document.getElementById('edit{$one_field.id}').checked=1"{/if}>{$one_field.input}</select>
                                                                            {if $line_id!="array"}<input type="hidden"
                                                                                                        name="edit[{$line_id}][{$one_field.id}]"
                                                                                                        value="1">{/if}
                                                                        {/if}
                                                                    {else}
                                                                        {if $one_field.hidden_write}
                                                                            {$one_field.display}
                                                                            {foreach from=$one_field.input item=one_value}
                                                                                <input class="valval" type="hidden" name="value[{$line_id}][{$one_field.id}][]" id="value{$one_field.id}" value="{$one_value.list_value}">
                                                                            {/foreach}
                                                                        {else}
                                                                            {if $line_id!="array"}<input type="hidden"
                                                                                                        name="edit[{$line_id}][{$one_field.id}]"
                                                                                                        value="1">{/if}

                                                                            <input type="hidden" id="value{$one_field.id}"
                                                                                value="{$one_field.value}">
                                                                            {foreach from=$one_field.input item=one_value}
                                                                            <input class="valval" type="checkbox"
                                                                                {if $one_field.write}name="value[{$line_id}][{$one_field.id}][]"{/if}
                                                                                value="{$one_value.list_value}"
                                                                                onClick="{if $line_id=='array'}document.getElementById('edit{$one_field.id}').checked=1;{/if} if (this.checked) document.getElementById('value{$one_field.id}').value++; else document.getElementById('value{$one_field.id}').value--; $('#value{$one_field.id}').change();" {if $one_value.checked}checked{/if} >
                                                                                <span {if !$one_field.write}style="color:#ACA899"{/if}>{$one_value.display_value}</span>
                                                                            <br>
                                                                            {if !$one_field.write and $one_value.checked}<input
                                                                                class="valval" type="hidden"
                                                                                name="value[{$line_id}][{$one_field.id}][]"
                                                                                id="value{$one_field.id}"
                                                                                value="{$one_value.list_value}">{/if}
                                                                            {/foreach}
                                                                        {/if}
                                                                    {/if}
                                                                {elseif $one_field.type_field eq 5}     {* связь *}
                                                                    {if $one_field.hidden_write}
                                                                        {$one_field.display_edit}
                                                                        <input type="hidden" class="valval" name="value[{$line_id}][{$one_field.id}]" id="value{$one_field.id}" value="{$one_field.display_edit}">
                                                                    {else}
                                                                        <span class="link_field_pretend_to_be_input">{$one_field.additional_img}<span class="link-field__main-value">{$one_field.display_edit}</span>{if $one_field.additional_info} ({$one_field.additional_info}){/if}</span>
                                                                        <input type="hidden"
                                                                            name="value[{$line_id}][{$one_field.id}]"
                                                                            ac_value="{if !$one_search.fix_search_mult}{foreach from=$set_cond item=cond}{if $cond.field==$one_search.id}{$cond.value_link}{/if}{/foreach}{/if}"
                                                                            id="value{$one_field.id}"
                                                                            class="valval value{$one_field.id} {if $one_field.action_yes}extra-ajax-field{/if}"
                                                                            value="{if $one_field['value']|is_array }{$one_field['value']['raw']}{else}{$one_field['value']}{/if}"
                                                                            onChange="{if $one_field.child_link_field}get_childos_filter({$one_field.child_link_field}, {$one_field.id});{/if}">
                                                                    {* {if $one_field.parent_link_field}
                                                                            <script>eval(get_childos_filter({$one_field.id}, {$one_field.parent_link_field}));</script>
                                                                        {/if} *}
                                                                        {if $line_id!="array"}<input type="hidden"
                                                                                                    name="edit[{$line_id}][{$one_field.id}]"
                                                                                                    value="1">{/if}
                                                                            {*
                                                                            <input type="text" id="edit_value{$one_field.id}" value="{$one_field.display_edit}" class="input_edit_line" {if $one_field.write}onfocus="last_focus=this; this.nextSibling.className='drop_down_icon_hover';$(this).addClass('input_edit_line_hover');" onblur="last_focus=0; if (this.nextSibling!=under_mouse_object) {ldelim}this.nextSibling.className='drop_down_icon'; $(this).removeClass('input_edit_line_hover');{rdelim}" onmouseover="this.nextSibling.className='drop_down_icon_hover';$(this).addClass('input_edit_line_hover');" onmouseout="if (this!=last_focus) {ldelim}this.nextSibling.className='drop_down_icon';$(this).removeClass('input_edit_line_hover');{rdelim}"{/if}><span
                                                                            {if $one_field.write}class="drop_down_icon" onmouseover="under_mouse_object=this;$(this.previousSibling).addClass('input_edit_line_hover');this.className='drop_down_icon_hover';" onmouseout="under_mouse_object=0; if (this.previousSibling!=last_focus) {ldelim}this.className='drop_down_icon'; $(this.previousSibling).removeClass('input_edit_line_hover');{rdelim}" onclick="{if $one_field.write}this.blur();this.previousSibling.focus();$(this.previousSibling).show_search();{/if}return false;" onmousedown="$(this.previousSibling).prevent_blur();return false;" onmouseup="$(this.previousSibling).enable_blur();" ondragstart="event.returnValue=!1;"{else}class="drop_down_icon_disabled"{/if}></span>
                                                                            {if $one_field.add_acc_link_value}
                                                                            <img src="images/green_plus.png" title="{$one_field.add_link_text}" class="add_link_img" onclick="add_link_block_show({$one_field.id})" onmouseover="this.src='images/green_plus_active.png'" onmouseout="this.src='images/green_plus.png'" style="width:1.3em; height:1.5em;">
                                                                            {/if}
                                                                            *}
                                                                    {/if}
                                                                {elseif $one_field.type_field eq 6}     {* файл *}
                                                                    {if $one_field.hidden_write}
                                                                        {$one_field.display}
                                                                    {else}
                                                                        {foreach from=$one_field.input item=file}
                                                                            <a href="open_file.php?table={$table_id}&field={$one_field.id}&line={$line_id}&file={$file.url}"
                                                                            onclick="location.href='open_file.php?table={$table_id}&field={$one_field.id}&line={$line_id}&file={$file.url}'; return false">{$file.name}</a>
                                                                        {if $one_field.write}<a href="" class="red_link"
                                                                                                onclick="delfile({$one_field.id},'{$file.js}'); return false;">{$lang.Delete}</a>{/if}
                                                                        <br>
                                                                        {/foreach}
                                                                            <input type=hidden class="valval"
                                                                                name="value[{$line_id}][{$one_field.id}]"
                                                                                id="value{$one_field.id}"
                                                                                value="{$one_field.value}">
                                                                        {if $one_field.write}
                                                                            <input type=hidden
                                                                                name="del_file[{$line_id}][{$one_field.id}]"
                                                                                id="del_file{$one_field.id}">
                                                                            <input type=file
                                                                                onchange="checkFileValue(this)"
                                                                                name="add_file[{$line_id}][{$one_field.id}][]"
                                                                                id="add_file{$one_field.id}" size="20"
                                                                                multiple="multiple">
                                                                            <input type=button onClick="addfile()"
                                                                                disabled
                                                                                value="{$lang.Add}" title="{$lang.Add_file}">
                                                                            {if $one_field.type_value}
                                                                            <br>{/if}{if $one_field.max_size}{$one_field.max_size} kB{/if} {foreach from=$one_field.file_types item=ext name=ft}{$ext}{if $smarty.foreach.ft.last}{else},{/if}{/foreach}
                                                                        {/if}
                                                                    {/if}
                                                                {elseif $one_field.type_field eq 9}     {* изображение *}
                                                                    {if $one_field.hidden_write}
                                                                        {$one_field.display}
                                                                    {else}
                                                                        {foreach from=$one_field.input item=file}
                                                                            <a href="open_file.php?field={$one_field.id}&line={$line_id}&file={$file.url}&is_show=1"
                                                                            onclick="location.href='open_file.php?field={$one_field.id}&line={$line_id}&file={$file.url}&is_show=1'; return false">
                                                                                <img src="cache/{$table_id}_{$one_field.id}_{$line_id}_{$file.file}.png">
                                                                            </a>
                                                                        {if $one_field.write}<a href="" class="red_link"
                                                                                                onclick="delfile({$one_field.id},'{$file.js}'); return false;">{$lang.Delete}</a>{/if}
                                                                        <br>
                                                                        {/foreach}
                                                                            <input type=hidden class="valval"
                                                                                name="value[{$line_id}][{$one_field.id}]"
                                                                                id="value{$one_field.id}"
                                                                                value="{$one_field.value}">
                                                                        {if $one_field.write}
                                                                        <input type=hidden
                                                                            name="del_file[{$line_id}][{$one_field.id}]"
                                                                            id="del_file{$one_field.id}"
                                                                            class="del_file{$one_field.id}">
                                                                        <input type=file
                                                                            name="add_file[{$line_id}][{$one_field.id}][]"
                                                                            id="add_file{$one_field.id}"
                                                                            class="add_file{$one_field.id}" size="20"
                                                                            multiple="multiple">
                                                                            <!--<input type=button onClick="addfile({$one_field.id})" value="{$lang.Add}" title="{$lang.Add_image}">
                                    {if $one_field.max_size}<br>{$one_field.max_size} kB{/if}-->
                                                                        {/if}
                                                                    {/if}
                                                                {/if}

                                                            </div>
                                                        </div>
                                                    </div>
                                                    {if $one_field.type_field eq 5}
                                                </a>
                                                {/if}
                                            </li>
                                        {/if}
                                    </ul>
                                </div>
                            {/if}
                        {/foreach}

                        {if $line_id=='array'}
                            <div class="list-group">
                                <ul>
                                    <li class="list-group-title">Системное</li>
                                    <li>
                                        <div class="item-content">
                                            <div class="item-inner">
                                                <div class="item-title label">{$lang.Update_tips}</div>
                                                <div class="item-input">
                                                    <input type="checkbox" name="update_tips">
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        {/if}
                    </div>

                    <input type="hidden" name="sel" value="save">
                    <input type="hidden" name="back_url" value="{$base64_back_url}">
                    <input type="hidden" name="subtable" id="subtable" value="{$cur_subtable}">
                    <input type="hidden" name="button_pressed" id="button_pressed" value="0">
                    <input type="hidden" name="edit_mode" id="edit_mode" value="0">
                    <input type="hidden" name="add_line" id="add_line" value="0">
                    <input type="hidden" name="del_line" id="del_line" value="0">
                    <input type="hidden" name="form_id" id="form_id" value="0">

                    <input type="hidden" name="form" id="form" value="">
                    <input type="hidden" name="form_type" id="form_type" value="">
                    <input type="hidden" name="op" id="op" value="">

                    <input type="hidden" name="main_table" id="main_table" class="main_table" value="{$main_table}">
                    <input type="hidden" name="main_line" id="main_line" class="main_line" value="{$main_line}">
                    <input type="hidden" name="main_field" id="main_field" class="main_field" value="{$main_field}">

                    <input type="hidden" name="csrf" value="{$csrf}">

                    <input type="submit" class="ajax-submit-button" style="display: none;"/>

                    <input type="hidden" class="valval" name="value[{$line_id}][{$rel_field}]" value="{$rel_line}"/>
                    <input type="hidden" name="edit[{$line_id}][{$rel_field}]" value="1"/>
                    <input type="hidden" name="edit_mode_save" class="edit_mode_save" value="false"/>
                </form>
                <div class="m-cb-dyn-script" style="display: none;"></div>
            </div>
            {if $all_subtables[0]['name_table']}
                <div class="m__record-view--sub-header">
                    {$lang.Subtables}
                </div>
                <div class="list-block media-list m-cb-subtables">
                    <ul>
                        {foreach from=$all_subtables item=one_subtable}
                        {if $one_subtable.vis}
                            <li class="list-group-title id_sub_{$one_subtable.table_id}" data-toggle="collapse"
                                data-target=".sub_{$one_subtable.id}">
                                {$one_subtable.name_table} <span class="badge">{$one_subtable.all_cnt_pages}</span>
                            </li>
                            <div class="collapse sub_{$one_subtable.id}">
                                {foreach from=$one_subtable.all_values item=one_line key=sub_line_id}
                                    <li>
                                        {counter start=0 skip=1 assign='num_val'}
                                        <a class="item-link item-content"
                                           href="view_line{$config.vlm}.php?table={$one_subtable.table_id}&line={$sub_line_id}&main_table={$table_id}&main_line={$line_id}&back_url={$base64_current_url}">
                                            <div class="item-inner">
                                                {foreach from=$one_line item=one_value}
                                                    {if $one_value.field_id eq 0}
                                                        {* Первое служебное поле *}
                                                        {counter assign='num_val'}
                                                    {elseif !$one_value.hidden_tbl && !$one_value.group_field && $one_value.type_field != 7}
                                                            {if $num_val == 1}
                                                                <div class="item-title-row">
                                                                    <div class="item-title" data-field-id="{$one_value.field_id}">
                                                                        {if $one_value.type_field == 6}
                                                                                <object>
                                                                                    {$one_value.mob_value}
                                                                                </object>
                                                                        {elseif $one_value.type_field == 5}
                                                                            {$one_value.mob_value}
                                                                        {else}
                                                                            {if $one_subtable.show_fields[$one_value.field_id].hyperlink == 1 and $one_value.mob_value}
                                                                            {* Для гиперссылок добавляем тег object, иначе верстка будет съезжать, т.к. пытаемся отобразить ссылку в ссылке *}
                                                                            <object>{$one_value.mob_value}</object>
                                                                            {else}
                                                                                {$one_value.mob_value|truncate:70:"...":true}
                                                                            {/if}
                                                                        {/if}
                                                                    </div>

                                                                    <div class="right-arrow-circle"></div>
                                                                </div>
                                                            {/if}
                                                            {if $num_val == 2}
                                                                <div class="item-row">
                                                                    <div class="item-subtitle" data-field-id="{$one_value.field_id}">
                                                                        {if $one_value.type_field == 6}
                                                                                <object>
                                                                                    {$one_value.mob_value}
                                                                                </object>
                                                                        {else}
                                                                            {if $one_subtable.show_fields[$one_value.field_id].hyperlink == 1 and $one_value.mob_value}
                                                                                {* Для гиперссылок добавляем тег object, иначе верстка будет съезжать, т.к. пытаемся отобразить ссылку в ссылке *}
                                                                                <object>{$one_value.mob_value}</object>
                                                                            {elseif $one_value.type_field == 5}
                                                                                {$one_value.mob_value}
                                                                            {else}
                                                                                {$one_value.mob_value|truncate:70:"...":true}
                                                                            {/if}
                                                                        {/if}
                                                                    </div>
                                                                </div>
                                                            {/if}
                                                            {if $num_val == 3}
                                                                <div class="item-row">
                                                                    <div class="item-subtitle" data-field-id="{$one_value.field_id}">
                                                                        {if $one_value.type_field == 6}
                                                                                <object>
                                                                                    {$one_value.mob_value}
                                                                                </object>
                                                                        {elseif $one_value.type_field == 5}
                                                                            {$one_value.mob_value}
                                                                        {else}
                                                                            {if $one_subtable.show_fields[$one_value.field_id].hyperlink == 1 and $one_value.mob_value}
                                                                                {* Для гиперссылок добавляем тег object, иначе верстка будет съезжать, т.к. пытаемся отобразить ссылку в ссылке *}
                                                                                <object>{$one_value.mob_value}</object>
                                                                            {else}
                                                                                {$one_value.mob_value|truncate:70:"...":true}
                                                                            {/if}
                                                                        {/if}
                                                                    </div>
                                                                </div>
                                                            {/if}
                                                        {counter assign='num_val'}
                                                    {/if}
                                                {/foreach}
                                            </div>
                                        </a>
                                    </li>
                                {/foreach}
                                <li class="m-subtable-pages">
                                    {foreach from=$one_subtable.pages item=one_page}
                                        {if $one_page eq $one_subtable.cur_page || $one_page eq '...'}
                                            <span class="m-subtable-pages__item" {if $one_page eq '...'} style="background: transparent; color: #000"{/if}>{$one_page}</span>
                                        {else}
                                            <a class="m-subtable-pages__item" href="view_line2.php?table={$table_id}{if $rel_table}&rel_table={$rel_table}&rel_line={$rel_line}&rel_field={$rel_field}{/if}{if $all_filters_on}&all_filters_on{elseif $filter_id}&filter={$filter_id}{/if}{if $archive}&archive{/if}{if $deleted}&deleted{/if}{if $page}&page={$page}{/if}&line={$subtbl_main_line}&subtable_page={$one_page}&sel_subtable={$one_subtable.id}#view_subtables">{$one_page}</a>
                                        {/if}
                                    {/foreach}
                                </li>
                                <li>
                                    {if $one_subtable.add}<a href="view_line2.php?table={$one_subtable.table_id}&rel_search{if $one_subtable.rel_table}&to_sub_tbl={$one_subtable.rel_table}&rel_table={$one_subtable.rel_table}&rel_line={$one_subtable.rel_line}&rel_field={$one_subtable.rel_field}{/if}{if $filter_id}&filter={$filter_id}{/if}{if $page}&page={$page}{/if}&line=new&back_url={$base64_current_url}"
                                                             class="item-link list-button external">
                                            Добавить</a>{/if}
                                </li>
                            </div>
                            {/if}
                        {/foreach}
                    </ul>
                </div>
            {/if}
            <br><br>
            {if  $line_id=='array'}
                <script>
                    $(function () {
                        $('.back_custom').removeClass('back');
                        $('.back_custom').attr('href', 'fields.php?table=' + $('.page').find(".page_to_back").val());
                    });
                </script>
            {/if}
{include file="mobile/templates/footer.tpl" set_bt=2}
