@extends('layouts.customer') @section('title', 'Subscription Form: ' . $form->name) @section('page-title', 'Subscription Form: ' . $form->name) @section('content')

{{ $form->name }}

{{ ucfirst($form->type) }} Form

Type
{{ ucfirst($form->type) }}
Public Title
{{ $form->title ?: '-' }}
Status
{{ $form->is_active ? 'Active' : 'Inactive' }}
Submissions
{{ number_format($form->submissions_count) }}
Form Slug
{{ $form->slug }}
@if($form->type === 'embedded')

Copy and paste this code into your website to embed the subscription form:

<iframe src="{{ url('/subscribe/' . $form->slug) }}" width="100%" height="400" frameborder="0"></iframe>
@endif @if($form->type === 'popup')

Copy and paste this code into your website. Clicking the button will open the form as a popup.

<button type="button" data-mailpurse-popup="{{ $form->slug }}">Subscribe</button> <script> (function(){ var slug = {{ Illuminate\Support\Js::from($form->slug) }}; var iframeSrcBase = {{ Illuminate\Support\Js::from(url('/subscribe/' . $form->slug)) }}; var iframeSrc = iframeSrcBase + (iframeSrcBase.indexOf('?') === -1 ? '?embed=1' : '&embed=1'); function ensureStyles(){ if (document.getElementById('mailpurse-popup-styles')) return; var style = document.createElement('style'); style.id = 'mailpurse-popup-styles'; style.textContent = "#mailpurse-popup-overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:999999;display:flex;align-items:center;justify-content:center;padding:24px}#mailpurse-popup-modal{width:min(520px,92vw);height:min(420px,92vh);background:#fff;border-radius:14px;overflow:hidden;box-shadow:0 25px 60px rgba(0,0,0,.35);position:relative}#mailpurse-popup-close{position:absolute;top:10px;right:10px;width:34px;height:34px;border-radius:10px;border:0;background:rgba(0,0,0,.06);cursor:pointer;font-size:18px;line-height:34px;z-index:1}#mailpurse-popup-iframe{width:100%;height:100%;border:0}"; document.head.appendChild(style); } function closePopup(){ var overlay = document.getElementById('mailpurse-popup-overlay'); if (overlay) overlay.remove(); } function openPopup(triggerEl){ ensureStyles(); closePopup(); var width = triggerEl && triggerEl.getAttribute ? triggerEl.getAttribute('data-mailpurse-popup-width') : null; var height = triggerEl && triggerEl.getAttribute ? triggerEl.getAttribute('data-mailpurse-popup-height') : null; var overlay = document.createElement('div'); overlay.id = 'mailpurse-popup-overlay'; overlay.addEventListener('click', function(e){ if (e.target === overlay) closePopup(); }); var modal = document.createElement('div'); modal.id = 'mailpurse-popup-modal'; if (width) { modal.style.width = width + 'px'; modal.style.maxWidth = '92vw'; } if (height) { modal.style.height = height + 'px'; modal.style.maxHeight = '92vh'; } var closeBtn = document.createElement('button'); closeBtn.id = 'mailpurse-popup-close'; closeBtn.type = 'button'; closeBtn.innerHTML = '&times;'; closeBtn.addEventListener('click', closePopup); var iframe = document.createElement('iframe'); iframe.id = 'mailpurse-popup-iframe'; iframe.src = iframeSrc; iframe.setAttribute('loading', 'lazy'); iframe.setAttribute('title', 'Subscribe'); modal.appendChild(closeBtn); modal.appendChild(iframe); overlay.appendChild(modal); document.body.appendChild(overlay); } document.addEventListener('click', function(e){ var el = e.target && e.target.closest ? e.target.closest('[data-mailpurse-popup="' + slug + '"]') : null; if (!el) return; e.preventDefault(); openPopup(el); }); })(); </script>
@endif @if($form->type === 'api')

Use this endpoint to subscribe users via API:

POST {{ url('/subscribe/' . $form->slug . '/api') }}
Content-Type: application/json

{
  "email": "user@example.com",
  "first_name": "John",
  "last_name": "Doe"
}
@endif @if($form->description)

{{ $form->description }}

@endif
@push('scripts') @endpush @endsection