@extends('layouts.app')

@section('content')
<div class="container">
    <h2>{{ $formTemplate->name }}</h2>

    <form>
        <div id="rendered-form"></div>
    </form>
</div>
@endsection

@section('scripts')
    <script src="https://cdn.jsdelivr.net/npm/jquery"></script>
    <script src="https://cdn.jsdelivr.net/npm/form-render/dist/form-render.min.js"></script>
    <script>
        const formData = {!! json_encode($formTemplate->schema) !!};
        $('#rendered-form').formRender({ formData });
    </script>
@endsection
