<?php $_shouldextend[1]=1; ?>

<?php $this->startSection('accountContent'); ?>
 <?php 
 $fields = [
 'fullname' => ['require' => true],
 'email' => ['require' => true],
 'phone' => ['require' => true, 'class' => 'phone-mask'],
 ];
 ?>

 <div x-data="{action: 'account/profile'}">
 <form x-data="form" x-bind="form" class="form">
 <div class="flex">
 <?php $__currentLoopData = $fields; $this->addLoop($__currentLoopData);$this->getFirstLoop();
 foreach($__currentLoopData as $key => $field): $loop = $this->incrementLoopIndices();  ?>
 <?php echo $this->runChild('form.input', [
 'name' => $key, 
 'lexPrefix' => 'account',
 'require' => $field['require'] ?? false,
 'class' => $field['class'] ?? '',
 'type' => $field['type'] ?? 'text',
 'value' => $user[$key] ?? '',
 ]); ?>
 <?php endforeach; $this->popLoop(); $loop = $this->getFirstLoop(); ?>

 <?php echo $this->runChild('form.password', [
 'name' => 'new_password', 
 'label' => 'account.new_password', 
 'require' => false, 
 'class' => ''
 ]); ?>
 </div>

 <div x-text="errors.message" :class="errors.message ? 'form__error form__error_bottom' : ''"></div>

 <div class="button">
 <button type="submit">зберегти</button>
 </div>
 </form>
 </div>
<?php $this->stopSection(); ?>

<?php if (isset($_shouldextend[1])) { echo $this->runChild('account.layout'); } ?>