commentsUpload.blade.php 3.34 KB
<div class="layout-app"><!-- row-app -->
	<div class="row row-app">

		<div class="col-md-12">
			
			<div class="col-separator col-separator-first col-unscrollable box">
				<div class=innerAll>

					<div style='clear:both;margin:2% 0 0 1%;border: 2px solid #F5F5F5;padding:2%;border-radius: 5px;'>
						<center><h4>Message Announcement</center>

						<br>
						<select id='usrname' class=select2multi  multiple="" style="width: 30%;">
							<option value></option>
							<?php foreach($username as $userKey => $user){;echo "<option value='$userKey'>$user</option>";} ?>	
						</select>

						<textarea id='supvisor_msg' name='sup_recommend' style='width:40%;margin-left: 5%' maxlength=250 rows="5" placeholder="Type message here..."></textarea>

						<div class='container'>
							<button type="button" class="btn btn-warning" id='send' style=' margin: 15px 0 5px 770px;'>
								<span class="glyphicon glyphicon-send"></span> Send 
							</button>
						</div>

					</div>

					<script>
						function clientSelect()
						{
							doAjax("record?action=callclient","client="+$("#client_select").val(),"","ajax_dialer_list","singlefail","POST", function(retstr){
								var ccObj = JSON.parse(retstr.responseText);

								$('#clientcode_select').empty();
								$('#question_list').empty();

								$('#clientcode_select').append("<option value=''>Select</option>");

								for(var i in ccObj){
									$('#clientcode_select').append("<option value='"+ccObj[i]['clientcode']+"'>"+ccObj[i]['clientcode']+"</option>");
								}
							});
						}

						function clientCodeSelect()
						{
							doAjax("record?action=questionlist","clientcode="+$("#clientcode_select").val(),"","","","POST", function(retrstr){

								var quesObj = JSON.parse(retrstr.responseText);


								$('#question_list').empty();

								for(var i in quesObj){
									if(quesObj[i]['questions']&&quesObj[i]['questions']!='questions')
									{
										$('#question_list').append("<div class='panel panel-default'>"+quesObj[i]['questions']+"</div>");
									}
								}
							});

						}

						$('#save').click(function()
						{
							var sup_recommend = $('#sup_recommend').val();
							var clientcode = $('#clientcode_select').val();

							if(sup_recommend&&(clientcode!=null))
							{ 
								var postdata='clientcode='+clientcode;
								postdata+='&supvisor_recommends='+sup_recommend;

								doAjax('record?action=saverecommend',postdata,'createtaskdiv','ajaxMutex_recSaveData','singlethis','POST',function(retrstr){
									simpleNotification('Success','topRight',"Comments has been saved successfully!"); 
								});
							}
							else
							{
								alert('Please select proper details');
							}
						});

						$('#send').click(function()
						{
							var agents = $('#usrname').val();
							var message = $('#supvisor_msg').val();

							if(agents&&message)
							{
							var postdata='agents='+agents;
							postdata+='&message='+message;

							doAjax('SupervisorMessage',postdata,'','','singlethis','POST',function(retrstr){
								simpleNotification('Success','topRight',"Message sent successfully!"); 
								$("#usrname").select2("val", "Select...");
								$('#supvisor_msg').val('');
							});
							}
							else
							{
								alert("Please insert something");
							}
							
						});

					</script>

				</div>
			</div>
		</div>
	</div>
</div>