diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig
index 9537d684..92cf89b1 100644
--- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig
@@ -192,9 +192,21 @@
-
-
-
+
+
+
+
+
+
+
@@ -482,24 +494,50 @@
sendbtn();
});
+ function formatState (opt) {
+ if (!opt.id) {
+ return opt.text.toUpperCase();
+ }
+
+ var optimage = $(opt.element).attr('data-image');
+ console.log(optimage)
+ if(!optimage){
+ return opt.text.toUpperCase();
+ } else {
+ var $opt = $(
+ '
' + opt.text + ''
+ );
+ return $opt;
+ }
+ };
+
+ $("#checkalldestinataires").click(function(){
+ if($("#checkalldestinataires").is(':checked') ){
+ $("#destinataires > option").prop("selected","selected");
+ $("#destinataires").trigger("change");
+ }else{
+ $("#destinataires > option").removeAttr("selected");
+ $("#destinataires").trigger("change");
+ }
+ });
+
function sendbtn() {
var data = CKEDITOR.instances["chat_message"].getData();
if($("#sendbymail").bootstrapSwitch('state')) {
CKEDITOR.instances["chat_messagemail"].setData(data);
$("#mailsuject").val("{{app.session.get('appname')}} = Notification {{ group.label }}");
- $("#mailto").val("");
- $("#listtoavatar").html("");
-
- {% for user in group.users %}
- {%if(user.user!=app.user)%}
- $("#mailto").val($("#mailto").val()+";{{user.user.email}}");
- $("#listtoavatar").append($("
"));
- {%endif%}
- {% endfor %}
$("#sendbtnmail").show();
$("#sendbtnmailreply").hide();
$('#mymodal-sendmail').modal('show');
+ $("#checkalldestinataires").prop( "checked", false );
+ $("#destinataires > option").removeAttr("selected");
+ $("#destinataires").trigger("change");
+ $('#destinataires').select2({
+ templateResult: formatState,
+ templateSelection: formatState,
+ sorter: data => data.sort((a, b) => a.text.localeCompare(b.text)),
+ });
}
else {
if(data) {
@@ -538,12 +576,15 @@
function sendbtnmail() {
var data = CKEDITOR.instances["chat_messagemail"].getData();
var subject=$("#mailsuject").val();
- var mailto=$("#mailto").val();
+ var destinataires=$("#destinataires").val();
+
+ if(data&&subject&&!(jQuery.isEmptyObject(destinataires))) {
- if(data&&subject&&mailto) {
try {
// Flager que l'envoit c'est fait
tosendmail=false;
+ mailto=destinataires.join(';');
+ mailto=";"+mailto;
$("#sendbtnmail").html("Envoyer");
$("#sendbtnmail").removeClass("btn-danger");
$("#sendbtnmail").css('cursor','auto');
@@ -581,13 +622,15 @@
function sendbtnmailreply() {
var data = CKEDITOR.instances["chat_messagemail"].getData();
var subject=$("#mailsuject").val();
- var mailto=$("#mailto").val();
+ var destinataires=$("#destinataires").val();
- if(data&&subject&&mailto) {
+ if(data&&subject&&!(jQuery.isEmptyObject(destinataires))) {
try {
// Flager que l'envoit c'est fait
tosendmail=false;
+ mailto=destinataires.join(';');
+ mailto=";"+mailto;
$("#sendbtnmailreply").html("Envoyer");
$("#sendbtnmailreply").removeClass("btn-danger");
$("#sendbtnmailreply").css('cursor','auto');
@@ -681,21 +724,19 @@
$(document).on('click', '.btnreplymessagemail', function(){
CKEDITOR.instances["chat_messagemail"].setData("");
$("#mailsuject").val("{{app.session.get('appname')}} = Notification {{ group.label }}");
- $("#mailto").val("");
- $("#listtoavatar").html("");
-
- {% for user in group.users %}
- {%if(user.user!=app.user)%}
- $("#mailto").val($("#mailto").val()+";{{user.user.email}}");
- $("#listtoavatar").append($("
"));
- {%endif%}
- {% endfor %}
$("#sendbtnmail").hide();
$("#sendbtnmailreply").show();
$("#sendbtnmailreply").data("id",$(this).data("id"));
-
$('#mymodal-sendmail').modal('show');
+ $("#checkalldestinataires").prop( "checked", false );
+ $("#destinataires > option").removeAttr("selected");
+ $("#destinataires").trigger("change");
+ $('#destinataires').select2({
+ templateResult: formatState,
+ templateSelection: formatState,
+ sorter: data => data.sort((a, b) => a.text.localeCompare(b.text)),
+ });
});
@@ -734,12 +775,6 @@
}
- $(document).on('click', '#listtoavatar img', function(){
- var mail = ";"+$(this).data("mail");
- $("#mailto").val($("#mailto").val().replace(mail, ""));
- $(this).remove();
- });
-
function recuplastmsg() {
console.log("recuplastmsg");
@@ -827,7 +862,7 @@
if(!$("#online"+userid).length) {
html = "
";
html+= "";
- html+= ""+userlastname+" "+userfirstname+"";
+ html+= "
"+userlastname+" "+userfirstname+"";
html+= "";
$("#useronline").append(html);
}