Update phone to use name instead of number and update sended to use phone id instead of origin

This commit is contained in:
osaajani 2020-03-31 01:19:21 +02:00
parent 62c7f69395
commit d5be760843
12 changed files with 91 additions and 93 deletions

View file

@ -39,12 +39,12 @@
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Phone', 'create', ['csrf' => $_SESSION['csrf']]);?>" method="POST">
<div class="form-group">
<label>Numéro de téléphone</label>
<label>Nom du téléphone</label>
<p class="italic small help">
Le numéro de téléphone qui enverra et recevra les messages.
Le nom du téléphone qui enverra et recevra les messages.
</p>
<div class="form-group">
<input required="required" name="" class="form-control" type="tel" id="phone-international-input" placeholder="Numéro de téléphone à utiliser.">
<input required="required" name="name" class="form-control" placeholder="Nom du téléphone">
</div>
</div>
<div class="form-group">
@ -126,15 +126,6 @@
{
change_adapter();
});
var number_input = jQuery('#phone-international-input')[0];
var iti_number_input = window.intlTelInput(number_input, {
hiddenInput: 'number',
defaultCountry: '<?php $this->s($_SESSION['user']['settings']['default_phone_country']); ?>',
preferredCountries: <?php $this->s(json_encode(explode(',', $_SESSION['user']['settings']['preferred_phone_country'])), false, false); ?>,
nationalMode: true,
utilsScript: '<?php echo HTTP_PWD_JS; ?>/intlTelInput/utils.js'
});
});
</script>
<?php

View file

@ -42,7 +42,7 @@
<table class="table table-bordered table-hover table-striped" id="table-phones">
<thead>
<tr>
<th>Numéro</th>
<th>Nom</th>
<th>Adaptateur</th>
<th style="width:5%;">Sélectionner</th>
</tr>
@ -50,7 +50,7 @@
<tbody>
<?php foreach ($phones as $phone) { ?>
<tr>
<td><?php $this->s(\controllers\internals\Tool::phone_format($phone['number'])); ?></td>
<td><?php $this->s(\controllers\internals\Tool::phone_format($phone['name'])); ?></td>
<td><?php $this->s($phone['adapter']); ?></td>
<td><input type="checkbox" value="<?php $this->s($phone['id']); ?>" name="ids[]"></td>
</tr>

View file

@ -115,7 +115,7 @@
<select name="id_phone" class="form-control">
<option value="">N'importe lequel</option>
<?php foreach ($phones as $phone) { ?>
<option value="<?php $this->s($phone['id']); ?>"><?php $this->s($phone['number']); ?></option>
<option value="<?php $this->s($phone['id']); ?>"><?php $this->s($phone['name']); ?></option>
<?php } ?>
</select>
</div>

View file

@ -122,7 +122,7 @@
<select name="scheduleds[<?php $this->s($scheduled['id']); ?>][id_phone]" class="form-control">
<option <?php echo ($scheduled['id_phone'] ? '' : 'selected="selected"'); ?> value="">N'importe lequel</option>
<?php foreach ($phones as $phone) { ?>
<option <?php echo ($scheduled['id_phone'] == $phone['id'] ? 'selected="selected"' : '' ); ?> value="<?php $this->s($phone['id']); ?>"><?php $this->s($phone['number']); ?></option>
<option <?php echo ($scheduled['id_phone'] == $phone['id'] ? 'selected="selected"' : '' ); ?> value="<?php $this->s($phone['id']); ?>"><?php $this->s($phone['name']); ?></option>
<?php } ?>
</select>
</div>

View file

@ -55,7 +55,7 @@
<tbody>
<?php foreach ($sendeds as $sended) { ?>
<tr>
<td class="no-wrap"><?php echo(\controllers\internals\Tool::phone_link($sended['origin'])); ?></td>
<td class="no-wrap"><?php $this->s($sended['phone_name'] ?? 'Inconnu'); ?></td>
<td class="no-wrap"><?php echo(\controllers\internals\Tool::phone_link($sended['destination'])); ?></td>
<td><?php $this->s($sended['text']); ?></td>
<td><?php $this->s($sended['at']); ?></td>