<!-- Inner content -->
<form method="post" enctype="multipart/form-data">

	<!-- Page header -->
    {include file="components/group-buttons.tpl" url="{$adminUrl}/clients?page={if isset($page)}{$page}{/if}{$buildQueryString}"}

    {capture name="breadcrumb"}
		<a href="{$adminUrl}/clients" class="breadcrumb-item">{$title}</a>
	    <span class="breadcrumb-item active">{general:add}</span>
    {/capture}

    {capture name="showBy"}{/capture}

    {include file="components/page-header.tpl" buttons=$smarty.capture.buttons breadcrumb=$smarty.capture.breadcrumb showBy=$smarty.capture.showBy}
	<!-- /page header -->

    <div class="content">
    
        <div class="row"> 
            <div class="col-md-12">
    
    		    <div class="card border shadow-sm">
			        <div class="card-header d-flex flex-wrap">
				        <h6 class="mb-0">{users:editProfile}</h6>
				        <div class="d-inline-flex ms-auto">
					        <a class="text-body" data-card-action="collapse"><i class="ph-caret-down"></i></a>
				        </div>
			        </div>
			        <div class="collapse show">
	                    <div class="card-body">

	                        <div class="form-group mb-3">
	                            <label class="form-label is-visible {if isset($errors.firstName)}text-danger{/if}">{users:general:firstName}</label>
	                            <input class="form-control" autocomplete="off" type="text" name="client[fullName]" value="{$user.fullName|default:""}" />
	                        </div>

		                    <div class="form-group mb-3">
	                            <label class="form-label">Адрес</label>
	                            <input class="form-control" autocomplete="off" type="text" name="client[address]" value="{$user.address|default:""}" />
	                        </div>

		                    <div class="form-group mb-3">
	                            <label class="form-label">Телеграм</label>
	                            <input class="form-control" autocomplete="off" type="text" name="client[telegram]" value="{$user.telegram|default:""}" />
	                        </div>


	                        <div class="form-group mb-3">
	                            <label class="form-label">{users:general:phone}</label>
	                            <input class="form-control phone" autocomplete="off" type="text" name="client[phone]" data-mask="{$config.phone_mask}" value="{$user.phone|default:""}" />
	                        </div>

	                        <div class="form-group mb-3">
	                            <label class="form-label is-visible {if isset($errors.email1) || isset($errors.email2) || isset($errors.email_correct)}text-danger{/if}">{users:general:email}</label>
	                            <input class="form-control" placeholder="your@email.com" autocomplete="off" type="email" name="client[email]" value="{$user.email|default:""}" />
	                        </div>

	                    </div>
			        </div>
    		    </div>
            </div>

	        <div class="col-md-12 text-center">
                {if isset($user.userId)}<input type="hidden" class="form-control" id="id" name="id" value="{$user.userId}">{/if}
                {$smarty.capture.buttons nofilter}
	        </div>

        </div>

    </div>

</form>

{* Подключаем filemanager *}
{include file='uploads_init.tpl'}

<script>
    $(document).ready(function () {

        {if isset($errors.site_user_not_found)} new Noty({ text: '{users:errors:10}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.login)}               new Noty({ text: '{users:errors:12}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.firstName)}           new Noty({ text: '{users:errors:4}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.lastName)}            new Noty({ text: '{users:errors:4}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.phone)}               new Noty({ text: '{users:errors:3}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.email1)}              new Noty({ text: '{users:errors:0}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.email2)}              new Noty({ text: '{users:errors:1}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.password)}            new Noty({ text: '{users:errors:2}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.address)}             new Noty({ text: '{users:errors:6}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.city)}                new Noty({ text: '{users:errors:7}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.postcode)}            new Noty({ text: '{users:errors:8}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.country)}             new Noty({ text: '{users:errors:9}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.not_saved)}           new Noty({ text: '{users:errors:11}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.login_correct)}       new Noty({ text: '{users:errors:13}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.email_correct)}       new Noty({ text: '{users:errors:16}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.phone_correct)}       new Noty({ text: '{users:errors:14}', type: 'error', timeout: 3000 }).show(); {/if}
        {if isset($errors.image_not_saved)}     new Noty({ text: '{users:errors:15}', type: 'error', timeout: 3000 }).show(); {/if}

        {if isset($messages.saved)}             new Noty({ text: '{users:messages:0}', type: 'success' }).show(); {/if}

    });

</script>
