LinkStack/blocks/telephone/form.blade.php

23 lines
1.1 KiB
PHP
Raw Normal View History

<?php use App\Models\Button; $button = Button::find($button_id); if(isset($button->name)){$buttonName = $button->name;}else{$buttonName = 0;} ?>
2023-06-16 20:53:33 +02:00
<select style="display:none" name="button" class="form-control"><option class="button button-default email" value="phone">{{__('messages.Phone')}}</option></select>
2023-06-16 20:53:33 +02:00
<label for='title' class='form-label'>{{__('messages.Custom Title')}}</label>
<input type='text' name='title' value='{{$link_title}}' class='form-control' />
2023-06-16 20:53:33 +02:00
<span class='small text-muted'>{{__('messages.Leave blank for default title')}}</span><br>
2023-06-16 20:53:33 +02:00
<label for='link' class='form-label'>{{__('messages.Telephone number')}}</label>
<input type='tel' name='link' value='{{str_replace("tel:", "", $link_url)}}' class='form-control' required />
2023-06-16 20:53:33 +02:00
<span class='small text-muted'>{{__('messages.Enter your telephone number')}}</span>
<script>
$(document).ready(function() {
$('form').on('submit', function(e) {
var linkInput = $(this).find('input[name="link"]');
var linkValue = linkInput.val();
if (!linkValue.toLowerCase().startsWith('tel:')) {
linkInput.val('tel:' + linkValue);
}
});
});
</script>