<?php $__env->startSection('client_modals'); ?>
    <!-- edit client modal -->
    <div class="ui tiny modal" id="editClientModal">
        <div class="header"><?php echo e(trans('clients.modal.header.edit')); ?></div>
        <div class="scrolling content">
            <p><?php echo e(trans('clients.modal.instruction.edit')); ?></p>
            <form action="<?php echo e(action('ClientController@edit', array($client->id))); ?>" enctype="multipart/form-data" method="POST">
                <?php echo e(csrf_field()); ?>

                <div class="ui form">
                    <div class="two fields">
                        <div class="field required">
                            <label><?php echo e(trans('clients.input.label.first_name')); ?></label>
                            <input type="text" name="first_name" placeholder="<?php echo e(trans('clients.input.placeholder.first_name')); ?>" required value="<?php echo e(old('first_name') ?: $client->first_name); ?>"/>
                        </div>
                        <div class="field">
                            <label><?php echo e(trans('clients.input.label.last_name')); ?></label>
                            <input type="text" name="last_name" placeholder="<?php echo e(trans('clients.input.placeholder.last_name')); ?>" value="<?php echo e(old('last_name') ?: $client->last_name); ?>"/>
                        </div>
                    </div>
                    <div class="two fields">
                        <div class="field required">
                            <label><?php echo e(trans('clients.input.label.email')); ?></label>
                            <input type="email" name="email" placeholder="<?php echo e(trans('clients.input.placeholder.email')); ?>" required value="<?php echo e(old('email') ?: $client->email); ?>"/>
                        </div>
                        <div class="field">
                            <label><?php echo e(trans('clients.input.label.phone')); ?></label>
                            <input type="tel" placeholder="<?php echo e(trans('clients.input.placeholder.phone')); ?>" value="<?php echo e(old('phone') ?: $client->phone); ?>"/>
                        </div>
                    </div>
                    <div class="two fields">
                        <div class="field">
                            <label><?php echo e(trans('clients.input.label.birthday')); ?></label>
                            <input type="text" class="datepicker" name="birthday" placeholder="<?php echo e(trans('clients.input.placeholder.birthday')); ?>" value="<?php echo e(old('birthday') ?: $client->birthday); ?>"/>
                        </div>
                        <div class="field">
                            <label><?php echo e(trans('clients.input.label.address')); ?></label>
                            <input type="text" name="address" placeholder="<?php echo e(trans('clients.input.placeholder.address')); ?>" value="<?php echo e(old('address') ?: $client->address); ?>"/>
                        </div>
                    </div>
                    <div class="divider"></div>
                    <?php foreach($client->customFields as $custom_field): ?>
                    <input type="hidden" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][label]" value="<?php echo e($custom_field->label); ?>"/>
                    <input type="hidden" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][type]" value="<?php echo e($custom_field->type); ?>"/>
                    <input type="hidden" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][uuid]" value="<?php echo e($custom_field->uuid); ?>"/>
                        <?php if($custom_field->type === 'checkbox'): ?>
                    <div class="field<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <div class="ui checkbox">
                            <input type="checkbox"<?php echo e(isset($custom_field->value) ? ' checked' : ''); ?> name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]"<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>>
                            <label><?php echo e($custom_field->label); ?></label>
                        </div>
                    </div>
                        <?php elseif($custom_field->type === 'date'): ?>
                    <div class="field<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <label><?php echo e($custom_field->label); ?></label>
                        <input type="text" class="datepicker" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]""<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> value="<?php echo e($custom_field->value); ?>">
                    </div>
                        <?php elseif($custom_field->type === 'email'): ?>
                    <div class="field<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <label><?php echo e($custom_field->label); ?></label>
                        <input type="email" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]"<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> value="<?php echo e($custom_field->value); ?>">
                    </div>
                        <?php elseif($custom_field->type === 'hidden'): ?>
                    <input type="hidden" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]" value="<?php echo e($custom_field->value); ?>">
                        <?php elseif($custom_field->type === 'number'): ?>
                    <div class="field<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <label><?php echo e($custom_field->label); ?></label>
                        <input type="number" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]""<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> value="<?php echo e($custom_field->value); ?>">
                    </div>
                        <?php elseif($custom_field->type === 'select'): ?>
                            <?php foreach(json_decode($custom_field->value)->choices as $option): ?>
                    <input type="hidden" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value][choices][]" value="<?php echo e($option); ?>"/>
                            <?php endforeach; ?>
                            <?php if(count(json_decode($custom_field->value)->choices) > 2): ?>
                    <div class="field<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <label><?php echo e($custom_field->label); ?></label>
                        <select class="ui fluid search dropdown" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value][choice]">
                            <option value=""><?php echo e($custom_field->label); ?></option>
                                <?php foreach(json_decode($custom_field->value)->choices as $option): ?>
                            <option<?php echo e($option === json_decode($custom_field->value)->choice ? ' selected' : ''); ?> value="<?php echo e(trim($option)); ?>"><?php echo e(trim($option)); ?></option>
                                <?php endforeach; ?>
                        </select>
                    </div>
                            <?php else: ?>
                    <div class="inline fields<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <label><?php echo e($custom_field->label); ?></label>
                                <?php foreach(json_decode($custom_field->value)->choices as $option): ?>
                        <div class="field">
                            <div class="ui radio checkbox">
                                <input type="radio" name="custom_fields[C<?php echo e($company->id); ?>F<?php echo e($custom_field->id); ?>][value][choice]"<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> value="<?php echo e(trim($option)); ?>">
                                <label><?php echo e(trim($option)); ?></label>
                            </div>
                        </div>
                                <?php endforeach; ?>
                    </div>
                            <?php endif; ?>
                        <?php elseif($custom_field->type === 'tel'): ?>
                    <div class="field<?php echo e(isset($custom_field->required) ? ' required' : ''); ?>">
                        <label><?php echo e($custom_field->label); ?></label>
                        <input type="tel" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]"<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> value="<?php echo e($custom_field->default); ?>">
                    </div>
                        <?php elseif($custom_field->type === 'text'): ?>
                    <div class="field">
                        <label><?php echo e($custom_field->label); ?></label>
                        <input type="tel" name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]"<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> value="<?php echo e($custom_field->default); ?>">
                    </div>
                        <?php else: ?>
                    <div class="field">
                        <label><?php echo e($custom_field->label); ?></label>
                        <textarea name="custom_fields[C<?php echo e($client->company->id); ?>F<?php echo e($custom_field->id); ?>][value]"<?php echo e(isset($custom_field->required) ? ' required' : ''); ?> rows="2"><?php echo e($custom_field->default); ?></textarea>
                    </div>
                        <?php endif; ?>
                    <?php endforeach; ?>
                    <div class="field">
                        <label><?php echo e(trans('clients.input.label.profile_image')); ?></label>
                        <input type="file" accept="image/*" accept="image/*" data-allowed-file-extensions="bmp gif jpeg jpg png svg" class="file-upload" data-default-file="<?php echo e(asset('uploads3/images/users/' . $client->profile_image_filename)); ?>" name="profile_image"/>
                    </div>
                </div>
            </form>
        </div>
        <div class="actions">
            <div class="ui buttons">
                <button class="ui cancel button"><?php echo e(trans('clients.modal.button.cancel.edit')); ?></button>
                <div class="or" data-text="<?php echo e(trans('products.modal.button.or')); ?>"></div>
                <button class="ui positive primary button"><?php echo e(trans('clients.modal.button.confirm.edit')); ?></button>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('templates.clients.one', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>