mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
Ajout du plugin pour les numéros internationaux
This commit is contained in:
parent
f31c631eba
commit
95fb5cae0c
12 changed files with 730 additions and 54 deletions
|
@ -47,9 +47,9 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label>Numéro de téléphone du contact<span class="italic small-text text-danger"> - Vous devriez utiliser un numéro international (Ex. : +33612345678)</span></label>
|
||||
<div class="form-group input-group">
|
||||
<span class="input-group-addon"><span class="fa fa-phone"></span></span>
|
||||
<input name="phone" class="form-control" type="text" placeholder="Numéro du contact" pattern="(0|\+[1-9]{1,3}|\+1\-[0-9]{3})[1-9][0-9]{8}" required>
|
||||
<div class="form-group">
|
||||
<input name="" class="form-control" type="tel" id="phone-international-input">
|
||||
<input name="phone" type="hidden" id="phone-hidden-input" required>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-danger" href="<?php echo $this->generateUrl('contacts'); ?>">Annuler</a>
|
||||
|
@ -62,5 +62,23 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery('document').ready(function($)
|
||||
{
|
||||
jQuery('#phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
||||
jQuery('form').on('submit', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
jQuery('#phone-hidden-input').val(jQuery('#phone-international-input').intlTelInput("getNumber"));
|
||||
this.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$incs->footer();
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label>Numéro de téléphone du contact<span class="italic small-text text-danger"> - Vous devriez utiliser un numéro international (Ex. : +33612345678)</span></label>
|
||||
<div class="form-group input-group">
|
||||
<span class="input-group-addon"><span class="fa fa-phone"></span></span>
|
||||
<input name="contacts[<?php secho($contact['id']); ?>][phone]" class="form-control" type="text" placeholder="Numéro du contact" pattern="(0|\+[1-9]{1,3}|\+1\-[0-9]{3})[1-9][0-9]{8}" required value="<?php secho($contact['number']); ?>">
|
||||
<div class="form-group">
|
||||
<input name="" class="form-control phone-international-input" type="tel" contact-id="<?php secho($contact['id']); ?>" value="<?php secho($contact['number']); ?>">
|
||||
<input name="contacts[<?php secho($contact['id']); ?>][phone]" type="hidden" id="phone-hidden-input-<?php secho($contact['id']); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
@ -70,5 +70,27 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery('document').ready(function($)
|
||||
{
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
||||
jQuery('form').on('submit', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
jQuery('.phone-international-input').each(function(key, value)
|
||||
{
|
||||
jQuery('#phone-hidden-input-' + jQuery(this).attr('contact-id')).val(jQuery(this).intlTelInput("getNumber"));
|
||||
});
|
||||
|
||||
this.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$incs->footer();
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
<script src="<?php echo HTTP_PWD; ?>js/bootstrap-datetimepicker.min.js"></script>
|
||||
<script src="<?php echo HTTP_PWD; ?>js/locales/bootstrap-datetimepicker.fr.js"></script>
|
||||
<link href="<?php echo HTTP_PWD; ?>css/bootstrap-datetimepicker.min.css" rel="stylesheet">
|
||||
<!-- International Phone Number, JS and CSS -->
|
||||
<script src="<?php echo HTTP_PWD; ?>js/intlTelInput/intlTelInput.min.js"></script>
|
||||
<link href="<?php echo HTTP_PWD; ?>css/intlTelInput.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom JS -->
|
||||
<script src="<?php echo HTTP_PWD; ?>js/custom.js"></script>
|
||||
|
||||
|
|
|
@ -47,8 +47,15 @@
|
|||
<input name="date" class="form-control form-datetime" type="text" value="<?php secho($now); ?>" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Numéros cibles <span class="italic small-text text-danger"> - Vous devriez utiliser un numéro international (Ex. : +33612345678)</span></label>
|
||||
<input class="add-numbers form-control" name="numbers[]"/>
|
||||
<label>Numéros cibles</label>
|
||||
<div class="form-group scheduleds-number-group-container">
|
||||
<div class="form-group scheduleds-number-group">
|
||||
<input name="" class="form-control phone-international-input" type="tel" >
|
||||
<span class="remove-scheduleds-number fa fa-times"></span>
|
||||
<input name="numbers[]" type="hidden" class="phone-hidden-input">
|
||||
</div>
|
||||
<div class="add-number-button fa fa-plus-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Contacts cibles</label>
|
||||
|
@ -71,19 +78,6 @@
|
|||
<script>
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
jQuery('.form-datetime').datetimepicker(
|
||||
{
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
autoclose: true,
|
||||
minuteStep: 1,
|
||||
language: 'fr'
|
||||
});
|
||||
|
||||
jQuery('.add-numbers').each(function()
|
||||
{
|
||||
jQuery(this).magicSuggest();
|
||||
});
|
||||
|
||||
jQuery('.add-contacts').each(function()
|
||||
{
|
||||
jQuery(this).magicSuggest({
|
||||
|
@ -101,6 +95,59 @@
|
|||
displayField: 'name',
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
||||
jQuery('body').on('click', '.remove-scheduleds-number', function(e)
|
||||
{
|
||||
jQuery(this).parents('.scheduleds-number-group').remove();
|
||||
});
|
||||
|
||||
jQuery('body').on('click', '.add-number-button', function(e)
|
||||
{
|
||||
var newScheduledsNumberGroup = '' +
|
||||
'<div class="form-group scheduleds-number-group">' +
|
||||
'<input name="" class="form-control phone-international-input" type="tel" >' +
|
||||
'<span class="remove-scheduleds-number fa fa-times"></span>' +
|
||||
'<input name="numbers[]" type="hidden" class="phone-hidden-input">' +
|
||||
'</div>';
|
||||
|
||||
jQuery(this).before(newScheduledsNumberGroup);
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
jQuery('.form-datetime').datetimepicker(
|
||||
{
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
autoclose: true,
|
||||
minuteStep: 1,
|
||||
language: 'fr'
|
||||
});
|
||||
|
||||
|
||||
jQuery('form').on('submit', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
jQuery('.phone-international-input').each(function(key, value)
|
||||
{
|
||||
var container = jQuery(this).parents('.scheduleds-number-group');
|
||||
container.find('.phone-hidden-input').val(jQuery(this).intlTelInput("getNumber"));
|
||||
});
|
||||
|
||||
this.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
|
|
@ -41,27 +41,6 @@
|
|||
<?php
|
||||
foreach ($scheduleds as $scheduled)
|
||||
{
|
||||
$numbers = array();
|
||||
foreach ($scheduled['numbers'] as $number)
|
||||
{
|
||||
$numbers[] = $number['number'];
|
||||
}
|
||||
|
||||
$contacts = array();
|
||||
foreach ($scheduled['contacts'] as $contact)
|
||||
{
|
||||
$contacts[] = (int)$contact['id'];
|
||||
}
|
||||
|
||||
$groups = array();
|
||||
foreach ($scheduled['groups'] as $group)
|
||||
{
|
||||
$groups[] = (int)$group['id'];
|
||||
}
|
||||
|
||||
$numbers = json_encode($numbers);
|
||||
$contacts = json_encode($contacts);
|
||||
$groups = json_encode($groups);
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label>Texte du SMS</label>
|
||||
|
@ -72,16 +51,25 @@
|
|||
<input name="scheduleds[<?php secho($scheduled['id']); ?>][date]" class="form-control form-datetime" type="text" value="<?php secho($scheduled['at']); ?>" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Numéros cibles <span class="italic small-text text-danger"> - Vous devriez utiliser un numéro international (Ex. : +33612345678)</span></label>
|
||||
<input class="add-numbers form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][numbers][]" value="<?php secho($numbers); ?>"/>
|
||||
<label>Numéros cibles</label>
|
||||
<div class="form-group scheduleds-number-group-container" scheduled-id="<?php secho($scheduled['id']); ?>" >
|
||||
<?php foreach($scheduled['numbers'] as $number) { ?>
|
||||
<div class="form-group scheduleds-number-group">
|
||||
<input name="" class="form-control phone-international-input" type="tel" value="<?php secho($number); ?>">
|
||||
<span class="remove-scheduleds-number fa fa-times"></span>
|
||||
<input name="scheduleds[<?php secho($scheduled['id']); ?>][numbers][]" type="hidden" class="phone-hidden-input">
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="add-number-button fa fa-plus-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Contacts cibles</label>
|
||||
<input class="add-contacts form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][contacts][]" value="<?php secho($contacts); ?>" />
|
||||
<input class="add-contacts form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][contacts][]" value="<?php secho(json_encode($scheduled['contacts'])); ?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Groupes cibles</label>
|
||||
<input class="add-groups form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][groups][]" value="<?php secho($groups); ?>" />
|
||||
<input class="add-groups form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][groups][]" value="<?php secho(json_encode($scheduled['groups'])); ?>" />
|
||||
</div>
|
||||
<hr/>
|
||||
<?php
|
||||
|
@ -108,11 +96,6 @@
|
|||
language: 'fr'
|
||||
});
|
||||
|
||||
jQuery('.add-numbers').each(function()
|
||||
{
|
||||
jQuery(this).magicSuggest();
|
||||
});
|
||||
|
||||
jQuery('.add-contacts').each(function()
|
||||
{
|
||||
jQuery(this).magicSuggest({
|
||||
|
@ -130,6 +113,60 @@
|
|||
displayField: 'name',
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
||||
jQuery('body').on('click', '.remove-scheduleds-number', function(e)
|
||||
{
|
||||
jQuery(this).parents('.scheduleds-number-group').remove();
|
||||
});
|
||||
|
||||
jQuery('body').on('click', '.add-number-button', function(e)
|
||||
{
|
||||
var scheduledId = jQuery(this).parents('.scheduleds-number-group-container').attr('scheduled-id');
|
||||
var newScheduledsNumberGroup = '' +
|
||||
'<div class="form-group scheduleds-number-group">' +
|
||||
'<input name="" class="form-control phone-international-input" type="tel" >' +
|
||||
'<span class="remove-scheduleds-number fa fa-times"></span>' +
|
||||
'<input name="scheduleds[' + scheduledId + '][numbers][]" type="hidden" class="phone-hidden-input">' +
|
||||
'</div>';
|
||||
|
||||
jQuery(this).before(newScheduledsNumberGroup);
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
jQuery('.form-datetime').datetimepicker(
|
||||
{
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
autoclose: true,
|
||||
minuteStep: 1,
|
||||
language: 'fr'
|
||||
});
|
||||
|
||||
|
||||
jQuery('form').on('submit', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
jQuery('.phone-international-input').each(function(key, value)
|
||||
{
|
||||
var container = jQuery(this).parents('.scheduleds-number-group');
|
||||
container.find('.phone-hidden-input').val(jQuery(this).intlTelInput("getNumber"));
|
||||
});
|
||||
|
||||
this.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue