backoffice: display user infos in autocomplete (#49039)
This commit is contained in:
parent
ca2d3974a3
commit
45d974ca57
|
@ -157,7 +157,36 @@ $(function() {
|
|||
},
|
||||
url: '/api/users/'
|
||||
},
|
||||
placeholder: '-'
|
||||
placeholder: '-',
|
||||
templateResult: function (state) {
|
||||
console.log(state);
|
||||
if (!state.id) {
|
||||
return state.text;
|
||||
}
|
||||
var details = '';
|
||||
if (state.user_email) {
|
||||
details += ' ' + state.user_email;
|
||||
}
|
||||
if (state.user_var_phone) {
|
||||
details += ' 📞 ' + state.user_var_phone;
|
||||
}
|
||||
if (state.user_var_mobile) {
|
||||
details += ' 📱 ' + state.user_var_mobile;
|
||||
}
|
||||
if (state.user_var_address || state.user_var_zipcode || state.user_var_city) {
|
||||
details += ' 📨';
|
||||
}
|
||||
if (state.user_var_address) {
|
||||
details += ' ' + state.user_var_address;
|
||||
}
|
||||
if (state.user_var_zipcode) {
|
||||
details += ' ' + state.user_var_zipcode;
|
||||
}
|
||||
if (state.user_var_city) {
|
||||
details += ' ' + state.user_var_city;
|
||||
}
|
||||
return $('<span>' + state.text + '</span><br /><span>' + details + '</span>');
|
||||
}
|
||||
}
|
||||
if ($('div.submit-user-selection').length) {
|
||||
$('div.submit-user-selection select').select2(select2_options);
|
||||
|
|
Loading…
Reference in New Issue