polisplexity.tech/resources/views/forms/submit-cz.blade.php

133 lines
6.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{-- resources/views/forms/submit-citizen.blade.php --}}
@extends('layouts.master')
@section('content')
<div class="container mt-5">
<div class="row">
<div class="col-md-8 offset-md-2">
<h1 class="mb-4">Join as a Citizen in Shaping Your City</h1>
<p class="lead">Your voice matters! Contribute your ideas, participate in projects, or learn more about making your city a better place.</p>
{{-- Why Citizens Matter Section --}}
<section class="my-5">
<h2>Your Impact as a Citizen</h2>
<p>Your engagement brings unique perspectives to urban development, helping to create inclusive, sustainable, and smart cities. Heres how you can make a difference:</p>
<ul>
<li><strong>Community Voice:</strong> Share your thoughts and ideas on urban projects, ensuring they meet community needs.</li>
<li><strong>Collaborative Participation:</strong> Engage in community-driven initiatives and collaborate with experts to bring positive changes.</li>
<li><strong>Educational Opportunities:</strong> Learn about urban planning, sustainability, and technology through Polisplexity's resources.</li>
</ul>
</section>
{{-- Citizen Engagement Form --}}
<section class="my-5">
<h2>Get Involved</h2>
<form id="Web3Form" action="{{ route('rfp.store') }}" method="POST" class="needs-validation" novalidate>
@csrf {{-- CSRF token for security --}}
@php
// Extract the last segment from the URL
$formLabelSegment = last(request()->segments());
@endphp
{{-- Hidden Field for Form Identifier/Label --}}
<input type="hidden" name="formLabel" value="{{ $formLabelSegment }}" id="formLabel">
{{-- Areas of Interest --}}
<div class="form-group mb-3">
<label for="interests" class="form-label">Areas of Interest:</label>
<select name="interests" id="interests" class="form-select" multiple required>
<option value="sustainable-development">Sustainable Development</option>
<option value="community-planning">Community Planning</option>
<option value="smart-technologies">Smart Technologies</option>
<option value="public-spaces">Public Spaces</option>
{{-- Additional areas of interest as needed --}}
</select>
<small class="form-text text-muted">Select one or more areas you're interested in.</small>
<div class="invalid-feedback">
Please select at least one area of interest.
</div>
</div>
{{-- Ideas or Contributions --}}
<div class="form-group mb-3">
<label for="ideas" class="form-label">Your Ideas or Contributions:</label>
<textarea name="ideas" id="ideas" class="form-control" rows="3" required></textarea>
<small class="form-text text-muted">Share any specific ideas or contributions you have in mind.</small>
<div class="invalid-feedback">
Please share your ideas or how you'd like to contribute.
</div>
</div>
{{-- Contact Information --}}
<fieldset class="mb-4">
<legend>Contact Information</legend>
{{-- Name --}}
<div class="form-group mb-3">
<label for="contactName" class="form-label">Your Name:</label>
<input type="text" name="contactName" id="contactName" class="form-control" required>
<div class="invalid-feedback">
Please enter your name.
</div>
</div>
{{-- Email --}}
<div class="form-group mb-3">
<label for="contactEmail" class="form-label">Your Email:</label>
<input type="email" name="contactEmail" id="contactEmail" class="form-control" required>
<div class="invalid-feedback">
Please enter a valid email address.
</div>
</div>
</fieldset>
{{-- Hidden Fields for Web3 Address and Signature --}}
<input type="hidden" name="web3Address" id="web3Address">
<input type="hidden" name="web3Signature" id="web3Signature">
{{-- Web3 Sign Checkbox --}}
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" value="" id="web3SignCheck">
<label class="form-check-label" for="web3SignCheck">
Check to Sign with Web3
</label>
<small class="form-text text-muted">Checking this will prompt you to sign the form with your Web3 wallet upon submission.</small>
</div>
<button type="submit" class="btn btn-primary">Get Involved</button>
</form>
</section>
{{-- Encouragement to Participate --}}
<section class="my-5">
<h2>Every Contribution Counts</h2>
<p>Your involvement is key to building a vibrant, collaborative community. Together, we can make our cities more livable, sustainable, and inclusive for everyone.</p>
</section>
</div>
</div>
</div>
<script>
document.getElementById('Web3Form').addEventListener('submit', async (e) => {
if (document.getElementById('web3SignCheck').checked) {
e.preventDefault(); // Prevent form from submitting immediately
const formDataJSON = serializeFormData(e.target); // Serialize form data
const signResult = await web3Sign(formDataJSON); // Sign serialized data
if (signResult && signResult.signature) {
// Populate the hidden fields with the address and signature
document.getElementById('web3Address').value = signResult.address;
document.getElementById('web3Signature').value = signResult.signature;
e.target.submit(); // Submit the form after populating the hidden fields
} else {
alert('Signing with Web3 failed or was cancelled. Please try again or submit without signing.');
}
}
});
</script>
@endsection