<?php if (isset($component)) { $__componentOriginal12ec1490c7adb050b0fb8341a24e00fd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal12ec1490c7adb050b0fb8341a24e00fd = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'web_form::components.layouts.index','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('web_form::layouts'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> 
        <?php echo e($webForm->title); ?>

     <?php $__env->endSlot(); ?>

    <!-- Web Form -->
    <v-web-form>
        <div class="flex h-[100vh] items-center justify-center">
            <div class="flex flex-col items-center gap-5">
                <?php if (isset($component)) { $__componentOriginal4a49525578a0df1e8a557679efc6a610 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal4a49525578a0df1e8a557679efc6a610 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'web_form::components.spinner.index','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('web_form::spinner'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal4a49525578a0df1e8a557679efc6a610)): ?>
<?php $attributes = $__attributesOriginal4a49525578a0df1e8a557679efc6a610; ?>
<?php unset($__attributesOriginal4a49525578a0df1e8a557679efc6a610); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal4a49525578a0df1e8a557679efc6a610)): ?>
<?php $component = $__componentOriginal4a49525578a0df1e8a557679efc6a610; ?>
<?php unset($__componentOriginal4a49525578a0df1e8a557679efc6a610); ?>
<?php endif; ?>
            </div>
        </div>
    </v-web-form>

    <?php if (! $__env->hasRenderedOnce('ff8bdc2f-f3fc-488b-bb17-b15f60c35846')): $__env->markAsRenderedOnce('ff8bdc2f-f3fc-488b-bb17-b15f60c35846');
$__env->startPush('scripts'); ?>
        <script
            type="text/template"
            id="v-web-form-template"
        >
            <div
                class="flex h-[100vh] items-center justify-center"
                style="background-color: <?php echo e($webForm->background_color); ?>"
            >
                <div class="flex flex-col items-center gap-5">
                    <!-- Logo -->
                    <img
                        class="w-max"
                        src="<?php echo e(vite()->asset('images/logo.svg')); ?>"
                        alt="<?php echo e(config('app.name')); ?>"
                    />

                    <h1
                        class="text-2xl font-bold"
                        style="color: <?php echo e($webForm->form_title_color); ?> !important;"
                    >
                        <?php echo e($webForm->title); ?>

                    </h1>

                    <p class="mt-2 text-base text-gray-600"><?php echo e($webForm->description); ?></p>

                    <div
                        class="box-shadow flex min-w-[300px] flex-col rounded-lg border border-gray-200 bg-white p-4 dark:bg-gray-900"
                        style="background-color: <?php echo e($webForm->form_background_color); ?>"
                    >
                        <?php echo view_render_event('web_forms.web_forms.form_controls.before', ['webForm' => $webForm]); ?>


                        <!-- Webform Form -->
                        <?php if (isset($component)) { $__componentOriginale3e9f33b5c43607afa0afe0eafc2a673 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale3e9f33b5c43607afa0afe0eafc2a673 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'web_form::components.form.index','data' => ['vSlot' => '{ meta, values, errors, handleSubmit }','as' => 'div','ref' => 'modalForm']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('web_form::form'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['v-slot' => '{ meta, values, errors, handleSubmit }','as' => 'div','ref' => 'modalForm']); ?>
                            <form
                                @submit="handleSubmit($event, create)"
                                ref="webForm"
                            >
                                <?php echo $__env->make('web_form::settings.web-forms.controls', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                                <div class="flex justify-center">
                                    <?php if (isset($component)) { $__componentOriginal24469c3a45ef6d0b5f996552c497ce31 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal24469c3a45ef6d0b5f996552c497ce31 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'web_form::components.button.index','data' => ['class' => 'primary-button','title' => $webForm->submit_button_label,':loading' => 'isStoring',':disabled' => 'isStoring','style' => 'background-color: '.e($webForm->form_submit_button_color).' !important']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('web_form::button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'primary-button','title' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($webForm->submit_button_label),':loading' => 'isStoring',':disabled' => 'isStoring','style' => 'background-color: '.e($webForm->form_submit_button_color).' !important']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal24469c3a45ef6d0b5f996552c497ce31)): ?>
<?php $attributes = $__attributesOriginal24469c3a45ef6d0b5f996552c497ce31; ?>
<?php unset($__attributesOriginal24469c3a45ef6d0b5f996552c497ce31); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal24469c3a45ef6d0b5f996552c497ce31)): ?>
<?php $component = $__componentOriginal24469c3a45ef6d0b5f996552c497ce31; ?>
<?php unset($__componentOriginal24469c3a45ef6d0b5f996552c497ce31); ?>
<?php endif; ?>
                                </div>
                            </form>
                         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale3e9f33b5c43607afa0afe0eafc2a673)): ?>
<?php $attributes = $__attributesOriginale3e9f33b5c43607afa0afe0eafc2a673; ?>
<?php unset($__attributesOriginale3e9f33b5c43607afa0afe0eafc2a673); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale3e9f33b5c43607afa0afe0eafc2a673)): ?>
<?php $component = $__componentOriginale3e9f33b5c43607afa0afe0eafc2a673; ?>
<?php unset($__componentOriginale3e9f33b5c43607afa0afe0eafc2a673); ?>
<?php endif; ?>

                        <?php echo view_render_event('web_forms.web_forms.form_controls.after', ['webForm' => $webForm]); ?>

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

        <script type="module">
            app.component('v-web-form', {
                template: '#v-web-form-template',

                data() {
                    return {
                        isStoring: false,
                    };
                },

                methods: {
                    create(params, { resetForm, setErrors }) {
                        this.isStoring = true;

                        const formData = new FormData(this.$refs.webForm);

                        let inputNames = Array.from(formData.keys());

                        inputNames = inputNames.reduce((acc, name) => {
                            const dotName = name.replace(/\[([^\]]+)\]/g, '.$1');

                            acc[dotName] = name;

                            return acc;
                        }, {});

                        this.$axios
                            .post('<?php echo e(route('admin.settings.web_forms.form_store', $webForm->id)); ?>', formData, {
                                headers: {
                                    'Content-Type': 'multipart/form-data',
                                },
                            })
                            .then(response => {
                                resetForm();

                                this.$refs.webForm.reset();

                                this.$emitter.emit('add-flash', { type: 'success', message: response.data.message });
                            })
                            .catch(error => {
                                if (error.response.data.redirect) {
                                    window.location.href = error.response.data.redirect;

                                    return;
                                }

                                if (! error.response.data.errors) {
                                    this.$emitter.emit('add-flash', { type: 'error', message: error.response.data.message });

                                    return;
                                }

                                const laravelErrors = error.response.data.errors || {};
                                const mappedErrors = {};

                                for (
                                    const [dotKey, messages]
                                    of Object.entries(laravelErrors)
                                ) {
                                    const inputName = inputNames[dotKey];

                                    if (
                                        inputName
                                        && messages.length
                                    ) {
                                        mappedErrors[inputName] = messages[0];
                                    }
                                }

                                setErrors(mappedErrors);
                            })
                            .finally(() => {
                                this.isStoring = false;
                            });
                    }
                }
            });
        </script>
    <?php $__env->stopPush(); endif; ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal12ec1490c7adb050b0fb8341a24e00fd)): ?>
<?php $attributes = $__attributesOriginal12ec1490c7adb050b0fb8341a24e00fd; ?>
<?php unset($__attributesOriginal12ec1490c7adb050b0fb8341a24e00fd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal12ec1490c7adb050b0fb8341a24e00fd)): ?>
<?php $component = $__componentOriginal12ec1490c7adb050b0fb8341a24e00fd; ?>
<?php unset($__componentOriginal12ec1490c7adb050b0fb8341a24e00fd); ?>
<?php endif; ?>
<?php /**PATH /var/www/html/packages/Webkul/WebForm/src/Resources/views/settings/web-forms/preview.blade.php ENDPATH**/ ?>