mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-30 05:16:28 +02:00
affiche plus d'informations sur les contacts dans les champs de recherche
This commit is contained in:
parent
8b188ec670
commit
0accc714c7
4 changed files with 88 additions and 1 deletions
|
@ -62,15 +62,36 @@
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function()
|
jQuery(document).ready(function()
|
||||||
{
|
{
|
||||||
|
<?php
|
||||||
|
if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) {
|
||||||
|
$magicSuggestRenderer = "(data['contacts_infos.civility']!=null ? (data['contacts_infos.civility']==1 ? 'M. ' : 'Mme ') : '')";
|
||||||
|
$magicSuggestRenderer .= " + data['contacts.name']";
|
||||||
|
$magicSuggestRenderer .= " + (data['contacts_infos.birthday']!=null ? ' (' + age(data['contacts_infos.birthday']) + ' ans)' : '')";
|
||||||
|
} else {
|
||||||
|
$magicSuggestRenderer = "data['name']";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
// Affiche plus d'infos que le nom du contact si on est en mode infos contacts
|
||||||
jQuery('.add-contacts').each(function()
|
jQuery('.add-contacts').each(function()
|
||||||
{
|
{
|
||||||
jQuery(this).magicSuggest({
|
jQuery(this).magicSuggest({
|
||||||
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
||||||
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
||||||
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
||||||
name: 'contacts[]'
|
name: 'contacts[]',
|
||||||
|
allowFreeEntries: false, // évite que l'utilisateur ne saisisse autre chose qu'un contact de la liste
|
||||||
|
renderer: function(data) {
|
||||||
|
return <?php echo $magicSuggestRenderer; ?>;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function age(birthday)
|
||||||
|
{
|
||||||
|
birthday = new Date(birthday);
|
||||||
|
return new Number((new Date().getTime() - birthday.getTime()) / 31536000000).toFixed(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -77,14 +77,36 @@
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function()
|
jQuery(document).ready(function()
|
||||||
{
|
{
|
||||||
|
<?php
|
||||||
|
if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) {
|
||||||
|
$magicSuggestRenderer = "(data['contacts_infos.civility']!=null ? (data['contacts_infos.civility']==1 ? 'M. ' : 'Mme ') : '')";
|
||||||
|
$magicSuggestRenderer .= " + data['contacts.name']";
|
||||||
|
$magicSuggestRenderer .= " + (data['contacts_infos.birthday']!=null ? ' (' + age(data['contacts_infos.birthday']) + ' ans)' : '')";
|
||||||
|
} else {
|
||||||
|
$magicSuggestRenderer = "data['name']";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
// Affiche plus d'infos que le nom du contact si on est en mode infos contacts
|
||||||
jQuery('.add-contacts').each(function()
|
jQuery('.add-contacts').each(function()
|
||||||
{
|
{
|
||||||
jQuery(this).magicSuggest({
|
jQuery(this).magicSuggest({
|
||||||
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
||||||
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
||||||
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
||||||
|
name: 'contacts[]',
|
||||||
|
allowFreeEntries: false, // évite que l'utilisateur ne saisisse autre chose qu'un contact de la liste
|
||||||
|
renderer: function(data) {
|
||||||
|
return <?php echo $magicSuggestRenderer; ?>;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function age(birthday)
|
||||||
|
{
|
||||||
|
birthday = new Date(birthday);
|
||||||
|
return new Number((new Date().getTime() - birthday.getTime()) / 31536000000).toFixed(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -87,15 +87,37 @@
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function()
|
jQuery(document).ready(function()
|
||||||
{
|
{
|
||||||
|
<?php
|
||||||
|
if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) {
|
||||||
|
$magicSuggestRenderer = "(data['contacts_infos.civility']!=null ? (data['contacts_infos.civility']==1 ? 'M. ' : 'Mme ') : '')";
|
||||||
|
$magicSuggestRenderer .= " + data['contacts.name']";
|
||||||
|
$magicSuggestRenderer .= " + (data['contacts_infos.birthday']!=null ? ' (' + age(data['contacts_infos.birthday']) + ' ans)' : '')";
|
||||||
|
} else {
|
||||||
|
$magicSuggestRenderer = "data['name']";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
// Affiche plus d'infos que le nom du contact si on est en mode infos contacts
|
||||||
jQuery('.add-contacts').each(function()
|
jQuery('.add-contacts').each(function()
|
||||||
{
|
{
|
||||||
jQuery(this).magicSuggest({
|
jQuery(this).magicSuggest({
|
||||||
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
||||||
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
||||||
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
||||||
|
name: 'contacts[]',
|
||||||
|
allowFreeEntries: false, // évite que l'utilisateur ne saisisse autre chose qu'un contact de la liste
|
||||||
|
renderer: function(data) {
|
||||||
|
return <?php echo $magicSuggestRenderer; ?>;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function age(birthday)
|
||||||
|
{
|
||||||
|
birthday = new Date(birthday);
|
||||||
|
return new Number((new Date().getTime() - birthday.getTime()) / 31536000000).toFixed(0);
|
||||||
|
}
|
||||||
|
|
||||||
jQuery('.add-groups').each(function()
|
jQuery('.add-groups').each(function()
|
||||||
{
|
{
|
||||||
jQuery(this).magicSuggest({
|
jQuery(this).magicSuggest({
|
||||||
|
|
|
@ -105,15 +105,37 @@
|
||||||
language: 'fr'
|
language: 'fr'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) {
|
||||||
|
$magicSuggestRenderer = "(data['contacts_infos.civility']!=null ? (data['contacts_infos.civility']==1 ? 'M. ' : 'Mme ') : '')";
|
||||||
|
$magicSuggestRenderer .= " + data['contacts.name']";
|
||||||
|
$magicSuggestRenderer .= " + (data['contacts_infos.birthday']!=null ? ' (' + age(data['contacts_infos.birthday']) + ' ans)' : '')";
|
||||||
|
} else {
|
||||||
|
$magicSuggestRenderer = "data['name']";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
// Affiche plus d'infos que le nom du contact si on est en mode infos contacts
|
||||||
jQuery('.add-contacts').each(function()
|
jQuery('.add-contacts').each(function()
|
||||||
{
|
{
|
||||||
jQuery(this).magicSuggest({
|
jQuery(this).magicSuggest({
|
||||||
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
data: '<?php echo $this->generateUrl('contacts', 'jsonGetContacts'); ?>',
|
||||||
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
valueField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>id',
|
||||||
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
displayField: '<?php echo RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS ? 'contacts.' : ''; ?>name',
|
||||||
|
name: 'contacts[]',
|
||||||
|
allowFreeEntries: false, // évite que l'utilisateur ne saisisse autre chose qu'un contact de la liste
|
||||||
|
renderer: function(data) {
|
||||||
|
return <?php echo $magicSuggestRenderer; ?>;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function age(birthday)
|
||||||
|
{
|
||||||
|
birthday = new Date(birthday);
|
||||||
|
return new Number((new Date().getTime() - birthday.getTime()) / 31536000000).toFixed(0);
|
||||||
|
}
|
||||||
|
|
||||||
jQuery('.add-groups').each(function()
|
jQuery('.add-groups').each(function()
|
||||||
{
|
{
|
||||||
jQuery(this).magicSuggest({
|
jQuery(this).magicSuggest({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue