<?php $__env->startSection('page_title', __('voyager::generic.' . (isset($dataTypeContent->id) ? 'edit' : 'add')) . ' ' . $dataType->getTranslatedAttribute('display_name_singular')); ?>

<?php $__env->startSection('css'); ?>
<meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_header'); ?>
<h1 class="page-title">
    <i class="<?php echo e($dataType->icon); ?>"></i>
    <?php echo e(__('voyager::generic.' . (isset($dataTypeContent->id) ? 'edit' : 'add')) . ' ' . $dataType->getTranslatedAttribute('display_name_singular')); ?>

</h1>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="page-content container-fluid">
    <form class="form-edit-add" role="form"
        action="<?php if(!is_null($dataTypeContent->getKey())): ?><?php echo e(route('voyager.' . $dataType->slug . '.update', $dataTypeContent->getKey())); ?><?php else: ?><?php echo e(route('voyager.' . $dataType->slug . '.store')); ?><?php endif; ?>"
        method="POST" enctype="multipart/form-data" autocomplete="off">
        <!-- PUT Method if we are editing -->
        <?php if(isset($dataTypeContent->id)): ?>
            <?php echo e(method_field("PUT")); ?>

        <?php endif; ?>
        <?php echo e(csrf_field()); ?>


        <div class="row">
            <div class="col-md-8">
                <div class="panel panel-bordered">
                    <?php if(count($errors) > 0): ?>
                        <div class="alert alert-danger">
                            <ul>
                                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <li><?php echo e($error); ?></li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    <?php endif; ?>

                    <div class="panel-body">
                        <!-- Existing Fields -->
                        <div class="form-group">
                            <label for="name"><?php echo e(__('voyager::generic.name')); ?></label>
                            <input type="text" class="form-control" id="name" name="name"
                                placeholder="<?php echo e(__('voyager::generic.name')); ?>"
                                value="<?php echo e(old('name', $dataTypeContent->name ?? '')); ?>">
                        </div>

                        <div class="form-group">
                            <label for="email"><?php echo e(__('voyager::generic.email')); ?></label>
                            <input type="email" class="form-control" id="email" name="email"
                                placeholder="<?php echo e(__('voyager::generic.email')); ?>"
                                value="<?php echo e(old('email', $dataTypeContent->email ?? '')); ?>">
                        </div>

                        <div class="form-group">
                            <label for="password"><?php echo e(__('voyager::generic.password')); ?></label>
                            <?php if(isset($dataTypeContent->password)): ?>
                                <br>
                                <small><?php echo e(__('voyager::profile.password_hint')); ?></small>
                            <?php endif; ?>
                            <input type="password" class="form-control" id="password" name="password" value=""
                                autocomplete="new-password">
                        </div>

                        <!-- Additional Fields -->
                        <div class="form-group">
                            <label for="recipes_scans_count">Recipes Scans Count</label>
                            <input type="number" class="form-control" id="recipes_scans_count"
                                name="recipes_scans_count"
                                value="<?php echo e(old('recipes_scans_count', $dataTypeContent->recipes_scans_count ?? 0)); ?>">
                        </div>

                        <div class="form-group">
                            <label for="recipes_refresh_count">Recipes Refresh Count</label>
                            <input type="number" class="form-control" id="recipes_refresh_count"
                                name="recipes_refresh_count"
                                value="<?php echo e(old('recipes_refresh_count', $dataTypeContent->recipes_refresh_count ?? 0)); ?>">
                        </div>

                        <div class="form-group">
                            <label for="premium">Premium</label>
                            <select class="form-control" id="premium" name="premium">
                                <option value="0" <?php echo e(old('premium', $dataTypeContent->premium ?? '0') == '0' ? 'selected' : ''); ?>>No</option>
                                <option value="1" <?php echo e(old('premium', $dataTypeContent->premium ?? '0') == '1' ? 'selected' : ''); ?>>Yes</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label for="accepted_terms">Accepted Terms</label>
                            <select class="form-control" id="accepted_terms" name="accepted_terms">
                                <option value="0" <?php echo e(old('accepted_terms', $dataTypeContent->accepted_terms ?? '0') == '0' ? 'selected' : ''); ?>>No</option>
                                <option value="1" <?php echo e(old('accepted_terms', $dataTypeContent->accepted_terms ?? '0') == '1' ? 'selected' : ''); ?>>Yes</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label for="expired_at">Subscription Ends At                            </label>
                            <input type="datetime-local" class="form-control" id="subscription_ends_at" name="subscription_ends_at"
                                value="<?php echo e(old('subscription_ends_at', (isset($dataTypeContent->subscription_ends_at) && $dataTypeContent->subscription_ends_at instanceof \Carbon\Carbon) ? $dataTypeContent->subscription_ends_at->format('Y-m-d\TH:i') : $dataTypeContent->subscription_ends_at)); ?>">
                        </div>


                        <div class="form-group">
                            <label for="customer_id">Customer Id</label>
                            <input type="text" class="form-control" id="customer_id" name="customer_id"
                                value="<?php echo e(old('customer_id', $dataTypeContent->customer_id ?? '')); ?>">
                        </div>

                        <div class="form-group">
                            <label for="subscription_id">Subscription Id</label>
                            <input type="text" class="form-control" id="subscription_id" name="subscription_id"
                                value="<?php echo e(old('subscription_id', $dataTypeContent->subscription_id ?? '')); ?>">
                        </div>

                        <div class="form-group">
                            <label for="subscription_status">Subscription Status</label>
                            <input type="text" class="form-control" id="subscription_status" name="subscription_status"
                                value="<?php echo e(old('subscription_status', $dataTypeContent->subscription_status ?? '')); ?>">
                        </div>

                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('editRoles', $dataTypeContent)): ?>
                                                <div class="form-group">
                                                    <label for="default_role"><?php echo e(__('voyager::profile.role_default')); ?></label>
                                                    <?php
                                                        $dataTypeRows = $dataType->{(isset($dataTypeContent->id) ? 'editRows' : 'addRows')};

                                                        $row = $dataTypeRows->where('field', 'user_belongsto_role_relationship')->first();
                                                        $options = $row->details;
                                                    ?>
                                                    <?php echo $__env->make('voyager::formfields.relationship', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                                </div>
                                                <!-- <div class="form-group">
                                                                                    <label for="additional_roles"><?php echo e(__('voyager::profile.roles_additional')); ?></label>
                                                                                    <?php
                                                                                        $row     = $dataTypeRows->where('field', 'user_belongstomany_role_relationship')->first();
                                                                                        $options = $row->details;
                                                                                    ?>
                                                                                    <?php echo $__env->make('voyager::formfields.relationship', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                                                                </div> -->
                        <?php endif; ?>

                        <?php
                            $selected_locale = $dataTypeContent->locale ?? config('app.locale', 'en');
                        ?>
                        <div class="form-group">
                            <label for="locale"><?php echo e(__('voyager::generic.locale')); ?></label>
                            <select class="form-control select2" id="locale" name="locale">
                                <?php $__currentLoopData = Voyager::getLocales(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $locale): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($locale); ?>" <?php echo e(($locale == $selected_locale ? 'selected' : '')); ?>>
                                        <?php echo e($locale); ?>

                                    </option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="panel panel panel-bordered panel-warning">
                    <div class="panel-body">
                        <div class="form-group">
                            <?php if(isset($dataTypeContent->avatar)): ?>
                                <img src="<?php echo e(filter_var($dataTypeContent->avatar, FILTER_VALIDATE_URL) ? $dataTypeContent->avatar : Voyager::image($dataTypeContent->avatar)); ?>"
                                    style="width:200px; height:auto; clear:both; display:block; padding:2px; border:1px solid #ddd; margin-bottom:10px;" />
                            <?php endif; ?>
                            <input type="file" data-name="avatar" name="avatar">
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <button type="submit" class="btn btn-primary pull-right save">
            <?php echo e(__('voyager::generic.save')); ?>

        </button>
    </form>
    <div style="display:none">
        <input type="hidden" id="upload_url" value="<?php echo e(route('voyager.upload')); ?>">
        <input type="hidden" id="upload_type_slug" value="<?php echo e($dataType->slug); ?>">
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>
<script>
    $('document').ready(function () {
        $('.toggleswitch').bootstrapToggle();
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('voyager::master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/hisham/Code/samy/dishify server/resources/views/vendor/voyager/users/edit-add.blade.php ENDPATH**/ ?>