move some fonts to dir with 's' because some external developper is an incompetent motherfucker, update all intl number, because they also are motherfuckers

This commit is contained in:
osaajani 2019-11-10 16:53:47 +01:00
parent 3934dba4f9
commit 29cd7edd5d
13 changed files with 72 additions and 118 deletions

View file

@ -48,8 +48,7 @@
<div class="form-group">
<label>Numéro de téléphone du contact</label>
<div class="form-group">
<input name="number" class="form-control" type="tel" id="phone-international-input">
<input name="number" type="hidden" id="phone-hidden-input" required>
<input name="" class="form-control" type="tel" id="phone-international-input">
</div>
</div>
<a class="btn btn-danger" href="<?php echo \descartes\Router::url('Contact', 'list'); ?>">Annuler</a>
@ -67,18 +66,12 @@
{
var number_input = jQuery('#phone-international-input')[0];
var iti_number_input = window.intlTelInput(number_input, {
hiddenInput: 'number',
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
utilsScript: '<?php echo HTTP_PWD_JS; ?>/intlTelInput/utils.js'
});
jQuery('form').on('submit', function(e)
{
e.preventDefault();
jQuery('#phone-hidden-input').val(iti_number_input.getNumber())
this.submit();
});
});
</script>
<?php

View file

@ -51,7 +51,6 @@
<label>Numéro de téléphone du contact</label>
<div class="form-group">
<input name="" class="form-control phone-international-input" type="tel" contact-id="<?php $this->s($contact['id']); ?>" value="<?php $this->s($contact['number']); ?>">
<input name="contacts[<?php $this->s($contact['id']); ?>][number]" type="hidden" id="phone-hidden-input-<?php $this->s($contact['id']); ?>" required>
</div>
</div>
<hr/>
@ -72,19 +71,14 @@
jQuery('.phone-international-input').each(function()
{
var number_input = this;
var hidden_input_name = 'contacts[' + jQuery(number_input).attr('contact-id') + '][number]';
var iti_number_input = window.intlTelInput(number_input, {
hiddenInput: hidden_input_name,
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
utilsScript: '<?php echo HTTP_PWD_JS; ?>/intlTelInput/utils.js'
});
jQuery('form').on('submit', function(e)
{
e.preventDefault();
jQuery('#phone-hidden-input-' + jQuery(number_input).attr('contact-id')).val(iti_number_input.getNumber())
this.submit();
});
});
});
</script>

View file

@ -40,11 +40,11 @@
<form action="<?php echo \descartes\Router::url('Scheduled', 'create', ['csrf' => $_SESSION['csrf']]);?>" method="POST">
<div class="form-group">
<label>Texte du SMS</label>
<textarea name="content" class="form-control" required></textarea>
<textarea name="text" class="form-control" required></textarea>
</div>
<div class="form-group">
<label>Date d'envoi du SMS</label>
<input name="date" class="form-control form-datetime" type="text" value="<?php $this->s($now); ?>" readonly>
<input name="at" class="form-control form-datetime" type="text" value="<?php $this->s($now); ?>" readonly>
</div>
<div class="form-group">
<label>Numéros cibles</label>
@ -52,7 +52,6 @@
<div class="form-group scheduleds-number-groupe">
<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>
@ -123,16 +122,19 @@
//intlTelInput
jQuery('body').on('click', '.add-number-button', function(e)
{
{
var random_id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
var newScheduledsNumberGroupe = '' +
'<div class="form-group scheduleds-number-groupe">' +
'<input name="" class="form-control phone-international-input" type="tel" >' +
'<input name="" class="form-control phone-international-input" type="tel" id="' + random_id + '">' +
'<span class="remove-scheduleds-number fa fa-times"></span>' +
'<input name="numbers[]" type="hidden" class="phone-hidden-input">' +
'</div>';
var number_input = jQuery(this).before(newScheduledsNumberGroupe);
jQuery(this).before(newScheduledsNumberGroupe);
var number_input = jQuery('#' + random_id)[0];
var iti_number_input = window.intlTelInput(number_input, {
hiddenInput: 'numbers[]',
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
@ -147,6 +149,7 @@
var number_input = jQuery('.phone-international-input')[0];
var iti_number_input = window.intlTelInput(number_input, {
hiddenInput: 'numbers[]',
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
@ -157,19 +160,6 @@
'number_input': number_input,
'iti_number_input': iti_number_input,
});
jQuery('form').on('submit', function(e)
{
e.preventDefault();
for (i = 0; i < number_inputs.length; i++)
{
var container = jQuery(number_inputs[i].number_input).parents('.scheduleds-number-groupe');
container.find('.phone-hidden-input').val(number_inputs[i][iti_number_input].getNumber());
}
this.submit();
});
});
</script>
<?php

View file

@ -41,20 +41,19 @@
<?php foreach ($scheduleds as $scheduled) { ?>
<div class="form-group">
<label>Texte du SMS</label>
<textarea name="scheduleds[<?php $this->s($scheduled['id']); ?>][content]" class="form-control" required><?php $this->s($scheduled['content'], true); ?></textarea>
<textarea name="scheduleds[<?php $this->s($scheduled['id']); ?>][text]" class="form-control" required><?php $this->s($scheduled['text'], true); ?></textarea>
</div>
<div class="form-group">
<label>Date d'envoi du SMS</label>
<input name="scheduleds[<?php $this->s($scheduled['id']); ?>][date]" class="form-control form-datetime" type="text" value="<?php $this->s($scheduled['at']); ?>" readonly>
<input name="scheduleds[<?php $this->s($scheduled['id']); ?>][at]" class="form-control form-datetime" type="text" value="<?php $this->s($scheduled['at']); ?>" readonly>
</div>
<div class="form-group">
<label>Numéros cibles</label>
<div class="form-group scheduleds-number-groupe-container" scheduled-id="<?php $this->s($scheduled['id']); ?>" >
<?php foreach ($scheduled['numbers'] as $number) { ?>
<div class="form-group scheduleds-number-groupe">
<input name="" class="form-control phone-international-input" type="tel" value="<?php $this->s($number); ?>">
<input name="" class="form-control phone-international-input" type="tel" value="<?php $this->s($number); ?>" scheduled-id="<?php $this->s($scheduled['id']); ?>">
<span class="remove-scheduleds-number fa fa-times"></span>
<input name="scheduleds[<?php $this->s($scheduled['id']); ?>][numbers][]" type="hidden" class="phone-hidden-input">
</div>
<?php } ?>
<div class="add-number-button fa fa-plus-circle"></div>
@ -66,7 +65,7 @@
</div>
<div class="form-group">
<label>Groupes cibles</label>
<input class="add-groupes form-control" name="scheduleds[<?php $this->s($scheduled['id']); ?>][groupes][]" value="<?php $this->s(json_encode($scheduled['groupes'])); ?>" />
<input class="add-groupes form-control" name="scheduleds[<?php $this->s($scheduled['id']); ?>][groups][]" value="<?php $this->s(json_encode($scheduled['groups'])); ?>" />
</div>
<?php if (RASPISMS_SETTINGS_SMS_FLASH) { ?>
<div class="form-group">
@ -117,60 +116,49 @@
displayField: 'name',
});
});
jQuery('.phone-international-input').intlTelInput({
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
});
jQuery('body').on('click', '.remove-scheduleds-number', function(e)
jQuery('body').on('click', '.remove-scheduleds-number', function(e)
{
jQuery(this).parents('.scheduleds-number-groupe').remove();
});
jQuery('.phone-international-input').each(function ()
{
var hidden_input_name = 'scheduleds[' + jQuery(this).attr('scheduled-id') + '][numbers][]';
window.intlTelInput(this, {
hiddenInput: hidden_input_name,
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
utilsScript: '<?php echo HTTP_PWD_JS; ?>/intlTelInput/utils.js'
});
});
jQuery('body').on('click', '.add-number-button', function(e)
{
{
var random_id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
var scheduledId = jQuery(this).parents('.scheduleds-number-groupe-container').attr('scheduled-id');
var newScheduledsNumberGroupe = '' +
'<div class="form-group scheduleds-number-groupe">' +
'<input name="" class="form-control phone-international-input" type="tel" >' +
'<input name="" class="form-control phone-international-input" type="tel" scheduled-id="' + scheduledId + '" id="' + random_id + '">' +
'<span class="remove-scheduleds-number fa fa-times"></span>' +
'<input name="scheduleds[' + scheduledId + '][numbers][]" type="hidden" class="phone-hidden-input">' +
'</div>';
jQuery(this).before(newScheduledsNumberGroupe);
jQuery('.phone-international-input').intlTelInput({
var hidden_input_name = 'scheduleds[' + scheduledId + '][numbers][]';
var phone_input = jQuery('#' + random_id)[0];
window.intlTelInput(phone_input, {
hiddenInput: hidden_input_name,
defaultCountry: '<?php $this->s(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
nationalMode: true,
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
utilsScript: '<?php echo HTTP_PWD_JS; ?>/intlTelInput/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-groupe');
container.find('.phone-hidden-input').val(jQuery(this).intlTelInput("getNumber"));
});
this.submit();
});
});
</script>
<?php

View file

@ -53,7 +53,7 @@
<tr>
<td><?php $this->s($scheduled['id']); ?></td>
<td><?php $this->s($scheduled['at']); ?></td>
<td><?php $this->s($scheduled['content']); ?></td>
<td><?php $this->s($scheduled['text']); ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($scheduled['id']); ?>"></td>
</tr>
<?php } ?>