small changes
This commit is contained in:
@@ -13,13 +13,14 @@ export const actions: Actions = {
|
||||
const data = await request.formData();
|
||||
const name = String(data.get('name') ?? '').trim();
|
||||
const dog = String(data.get('dog') ?? '').trim();
|
||||
const phone = String(data.get('phone') ?? '').trim();
|
||||
const message = String(data.get('message') ?? '').trim();
|
||||
|
||||
if (!name || !message) {
|
||||
return fail(400, { error: 'Compila almeno nome e messaggio.', name, dog, message });
|
||||
if (!name || !phone || !message) {
|
||||
return fail(400, { error: 'Compila nome, telefono e messaggio.', name, dog, phone, message });
|
||||
}
|
||||
|
||||
const entry = addSubmission({ name, dog, message, ip: getClientAddress() });
|
||||
const entry = addSubmission({ name, dog, phone, message, ip: getClientAddress() });
|
||||
addNotification({
|
||||
type: 'submission',
|
||||
title: 'Nuova richiesta dal form',
|
||||
|
||||
+37
-21
@@ -17,6 +17,11 @@
|
||||
if (form?.success) submitted = true;
|
||||
});
|
||||
|
||||
const phoneDigits = $derived((c['contact.phone_value'] ?? '').replace(/\D/g, ''));
|
||||
const telHref = $derived(phoneDigits ? `tel:+${phoneDigits}` : '#');
|
||||
const waHref = $derived(phoneDigits ? `https://wa.me/${phoneDigits}` : '#');
|
||||
const mailHref = $derived(`mailto:${c['contact.email_value'] ?? ''}`);
|
||||
|
||||
onMount(() => {
|
||||
const onScroll = () => {
|
||||
scrolled = window.scrollY > 20;
|
||||
@@ -312,6 +317,10 @@
|
||||
<label for="cf-dog">{c['contact.label_dog']}</label>
|
||||
<input id="cf-dog" name="dog" type="text" placeholder={c['contact.placeholder_dog']} />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cf-phone">{c['contact.label_phone']}</label>
|
||||
<input id="cf-phone" name="phone" type="tel" placeholder={c['contact.placeholder_phone']} required />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cf-msg">{c['contact.label_msg']}</label>
|
||||
<textarea id="cf-msg" name="message" placeholder={c['contact.placeholder_msg']} required></textarea>
|
||||
@@ -330,26 +339,31 @@
|
||||
</div>
|
||||
<div class="contact-info-side">
|
||||
<h3>{c['contact.info_title']}</h3>
|
||||
<div class="contact-item">
|
||||
<div class="contact-icon"><span class="material-symbols-outlined" aria-hidden="true">call</span></div>
|
||||
<div>
|
||||
<p class="contact-item-label">{c['contact.phone_label']}</p>
|
||||
<p class="contact-item-value">{c['contact.phone_value']}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-item">
|
||||
<div class="contact-icon"><span class="material-symbols-outlined" aria-hidden="true">mail</span></div>
|
||||
<div>
|
||||
<p class="contact-item-label">{c['contact.email_label']}</p>
|
||||
<p class="contact-item-value">{c['contact.email_value']}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-item">
|
||||
<div class="contact-icon"><span class="material-symbols-outlined" aria-hidden="true">forum</span></div>
|
||||
<div>
|
||||
<p class="contact-item-label">{c['contact.wa_label']}</p>
|
||||
<p class="contact-item-value">{c['contact.wa_value']}</p>
|
||||
</div>
|
||||
<div class="contact-items">
|
||||
<a class="contact-item" href={telHref}>
|
||||
<div class="contact-icon"><span class="material-symbols-outlined" aria-hidden="true">call</span></div>
|
||||
<div class="contact-item-text">
|
||||
<p class="contact-item-label">{c['contact.phone_label']}</p>
|
||||
<p class="contact-item-value">{c['contact.phone_value']}</p>
|
||||
</div>
|
||||
<span class="contact-item-chev material-symbols-outlined" aria-hidden="true">arrow_forward</span>
|
||||
</a>
|
||||
<a class="contact-item" href={mailHref}>
|
||||
<div class="contact-icon"><span class="material-symbols-outlined" aria-hidden="true">mail</span></div>
|
||||
<div class="contact-item-text">
|
||||
<p class="contact-item-label">{c['contact.email_label']}</p>
|
||||
<p class="contact-item-value">{c['contact.email_value']}</p>
|
||||
</div>
|
||||
<span class="contact-item-chev material-symbols-outlined" aria-hidden="true">arrow_forward</span>
|
||||
</a>
|
||||
<a class="contact-item" href={waHref} target="_blank" rel="noopener noreferrer">
|
||||
<div class="contact-icon"><span class="material-symbols-outlined" aria-hidden="true">forum</span></div>
|
||||
<div class="contact-item-text">
|
||||
<p class="contact-item-label">{c['contact.wa_label']}</p>
|
||||
<p class="contact-item-value">{c['contact.wa_value']}</p>
|
||||
</div>
|
||||
<span class="contact-item-chev material-symbols-outlined" aria-hidden="true">arrow_forward</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="contact-map"><div id="map-container"></div></div>
|
||||
</div>
|
||||
@@ -391,7 +405,9 @@
|
||||
<p>{c['footer.copyright']}</p>
|
||||
<div class="powered-by">
|
||||
<span>{c['footer.powered']}</span>
|
||||
<img src={img.cima_logo.src} alt={img.cima_logo.alt} />
|
||||
<a href="https://cimaprogetti.it" target="_blank" rel="noopener noreferrer">
|
||||
<img src={img.cima_logo.src} alt={img.cima_logo.alt} />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -192,7 +192,13 @@
|
||||
<span class="score-chip {scoreClass('geo', a.geoScore)}">GEO {a.geoScore}</span>
|
||||
</div>
|
||||
</header>
|
||||
{#if slot.kind === 'multiline'}
|
||||
{#if slot.id === 'footer.powered'}
|
||||
<select name="slot:{slot.id}" bind:value={values[slot.id]}>
|
||||
<option value="Powered by">Powered by</option>
|
||||
<option value="Built by">Built by</option>
|
||||
<option value="In collab with">In collab with</option>
|
||||
</select>
|
||||
{:else if slot.kind === 'multiline'}
|
||||
<textarea name="slot:{slot.id}" bind:value={values[slot.id]} rows="3"></textarea>
|
||||
{:else}
|
||||
<input name="slot:{slot.id}" type="text" bind:value={values[slot.id]} />
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<time>{fmt(s.createdAt)}</time>
|
||||
<span class="name">{s.name}</span>
|
||||
{#if s.dog}<span class="dog">Cane: {s.dog}</span>{/if}
|
||||
{#if s.phone}<a class="phone" href="tel:{s.phone}">{s.phone}</a>{/if}
|
||||
</header>
|
||||
<div class="msg">{s.message}</div>
|
||||
<div class="meta">
|
||||
|
||||
Reference in New Issue
Block a user