Start contact
This commit is contained in:
parent
ccfc69baca
commit
50c7e4298c
|
@ -257,3 +257,20 @@ footer
|
|||
{
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
|
||||
/* CONTACT */
|
||||
#contact-datas-container input
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#contact-datas-container .contact-data-name
|
||||
{
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
#contact-datas-container .contact-data-value
|
||||
{
|
||||
width: 50%;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS scheduled
|
|||
origin VARCHAR(25) DEFAULT NULL,
|
||||
at DATETIME NOT NULL,
|
||||
text VARCHAR(1000) NOT NULL,
|
||||
condition VARCHAR(1000) DEFAULT NULL,
|
||||
flash BOOLEAN NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
PRIMARY KEY (id)
|
||||
|
@ -60,13 +61,14 @@ CREATE TABLE IF NOT EXISTS sended
|
|||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS contact
|
||||
(
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
id_user INT NOT NULL,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
number VARCHAR(20) NOT NULL,
|
||||
datas TEXT DEFAULT NULL,
|
||||
CHECK (JSON_VALID(datas)),
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
UNIQUE (id_user, name)
|
||||
|
|
|
@ -51,6 +51,20 @@
|
|||
<input name="" class="form-control" type="tel" id="phone-international-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Données du contact</label>
|
||||
<p class="italic small" id="description-datas">
|
||||
Les données d'un contact vous permettent de l'enrichir afin de pouvoir accéder à ces données au sein d'un message via <a href="#">l'utilisation de templates.</a><br/>
|
||||
Laissez vide si vous ne souhaitez pas renseigner d'informations supplémentaires pour le contact.
|
||||
</p>
|
||||
<div id="contact-datas-container">
|
||||
<div class="form-group">
|
||||
<input name="" class="form-control contact-data-name" type="text" placeholder="Nom de la donnée">
|
||||
:
|
||||
<input name="" class="form-control contact-data-value" type="text" placeholder="Valeur de la donnée">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-danger" href="<?php echo \descartes\Router::url('Contact', 'list'); ?>">Annuler</a>
|
||||
<input type="submit" class="btn btn-success" value="Enregistrer le contact" />
|
||||
</form>
|
||||
|
@ -72,6 +86,43 @@
|
|||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD_JS; ?>/intlTelInput/utils.js'
|
||||
});
|
||||
|
||||
|
||||
jQuery('#contact-datas-container').on('input', '.contact-data-value', function (e)
|
||||
{
|
||||
var focus_input = this;
|
||||
|
||||
jQuery('#contact-datas-container .form-group').each(function (e)
|
||||
{
|
||||
var current_input_name = jQuery(this).find('.contact-data-name');
|
||||
var current_input_value = jQuery(this).find('.contact-data-value');
|
||||
|
||||
if (current_input_value.is(focus_input))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jQuery(current_input_name).val() !== '' || jQuery(current_input_value).val() !== '')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
jQuery(this).remove();
|
||||
});
|
||||
|
||||
if (jQuery(focus_input).val() === '')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var template = '' +
|
||||
'<div class="form-group">' +
|
||||
'<input name="" class="form-control contact-data-name" type="text" placeholder="Nom de la donnée">' +
|
||||
' : ' +
|
||||
'<input name="" class="form-control contact-data-value" type="text" placeholder="Valeur de la donnée">' +
|
||||
'</div>';
|
||||
jQuery('#contact-datas-container').append(template);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue