EVOLUTION-NINJA
Edit File: conversation.php
<?php echo view('includes/header');?> <link href="<?php echo base_url('public/assets/admin_dashboard/css/jquery-ui.css');?>" rel="stylesheet"> <script src="<?php echo base_url('public/assets/js/jquery-ui.js');?>"></script> <section class="content-header"> <h1> Status Conversation </h1> </section> <!--- section 1 ----> <section class="content"> <div class="preview"> <div class="container-fluid"> <div class="row"> <div class="col-md-12" > <div class="form-group col-md-8"> <?php if(session()->get('admin_id') == '18') {?> <?php } else { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun(<?php echo $this->uri->segment(2)?>);">ADD Conversation</button> <?php } ?> </div> </div> </div> </div> </div> <div style="padding-top:15%;" class="modal fade" id="add_call_conversation" role="dialog"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Add Conversation</h4> </div> <div class="modal-body"> <form id="add_call_convo" class="form-inline add_conversation"> <div class="form-group col-md-offset-2 col-md-8"> <label>Conversation</label> <div> <textarea type="text" class="col-md-12 conversation" name="conversation" rows="3"></textarea> <input type="hidden" id="booking_id" name="booking_id" value="<?= esc(service('uri')->getSegment(2)) ?>"> </div> </div> <div class="form-group col-md-offset-2 col-md-8"> <label>Source</label> <div> <select type="text" class="col-md-12 source_type" name="source_type"> <option value="">Select</option> <option value="own">Own</option> <option value="loan">Loan</option> </select> </div> </div> <div class="form-group col-md-offset-2 col-md-8"> <label>Set Reminder</label> <div> <input type="text" class="form-control col-sm-12 rem_date date_picker" name="rem_date" max=""> </div> </div> <div class="form-group col-md-offset-2 col-md-8"> <label>Select Department</label> <div> <!--<select type="text" class="col-md-12 selected_department" name="selected_department"> <option value="">Select</option> <option value="self">Self</option> <option value="all">All</option> </select>--> <div class="form-check-inline"> <label class="form-check-label"> <input type="radio" class="form-check-input" value="self" name="selected_department" checked="">Self </label> </div> <div class="form-check-inline"> <label class="form-check-label"> <input type="radio" class="form-check-input" value="all" name="selected_department">All </label> </div> </div> </div> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 4----> </form> </div> </div> </div> </div> </br> <?php //print_r($project_details);?> <div class="row"> <div class="col-sm-4"> <strong>Project : <?php if($project_details){echo $project_details->project_name;}?></strong> </div> <div class="col-sm-2"> <strong>Site Number : <?php if($project_details){echo $project_details->site_number;}?></strong> </div> <div class="col-sm-6"> <strong>Client Name : <?php if($project_details){echo $project_details->customer_name;}?></strong> </div> </div> <br> <?php if(!empty($due_type_detail)) { foreach($due_type_detail as $due_detail) { ?> <div class="row"> <?php if($due_detail['due_type'] == "agree_due") { ?> <div class="col-sm-4"> <strong>Agreement Due Amount : <?php if(!empty($due_detail['agreement_amount'])){ if($due_detail['agreement_amount']){ echo $due_detail['agreement_amount'];} else { echo "0"; } }?></strong> </div> <div class="col-sm-4"> <strong>Agreement Due Date : <?php if(!empty($due_detail['agreement_date'])){ if($due_detail['agreement_date']){ echo $due_detail['agreement_date'];} else { echo ""; } }?></strong> </div> <?php } ?> <?php if($due_detail['due_type'] == "reg_due") { ?> <div class="col-sm-4"> <strong>Registration Due Amount : <?php if($due_detail){ if($due_detail['registration_due_amount']){ echo $due_detail['registration_due_amount'];} else { echo "0"; } }?></strong> </div> <div class="col-sm-4"> <strong>Registration Due Date : <?php if($due_detail){ if($due_detail['registration_due_date']){ echo $due_detail['registration_due_date'];} else { echo ""; } }?></strong> </div> <?php } ?> </div> <?php } } else { ?> <?php } ?> <hr> <?php $user_type_id = session()->get('user_type_id'); ?> <?php //print_r($detail); die();?> <?php foreach($detail as $row) { if(!empty($row['conversation'])) { ?> <div class="container"> <?php if($row['source_type'] == 'own') { if($user_type_id == 4 || $user_type_id == 5 || $user_type_id == 1) { ?> <div class="col-sm-4"> <strong> Conversation : </strong> <br><?php echo $row['conversation']; ?> </div> <div class="col-sm-4"> <?php echo strtoupper($row['username']);?>: <?php $dt = new DateTime($row['created_at']);echo $dt->format('d-m-Y');?> </div> <br><hr> <?php if($user_type_id == 4 || $user_type_id == 5 || $user_type_id == 1) { ?> <div class="container"> <div class="mesgs"> <div class="msg_history"> <?php if(!empty($row['reply'])) { foreach($row['reply'] as $value) { ?> <?php if(session()->get('admin_id') == $value->created_by){?> <div class="incoming_msg"> <div class="received_msg"> <div class="received_withd_msg"> <p><?php echo $value->reply; ?></p> <strong><?php echo strtoupper($value->username);?></strong> <span class="time_date"><?php $dt = new DateTime($value->created_at);echo $dt->format('d-m-Y'); ?> <?php if(session()->get('user_type_id') == 4 && session()->get('admin_id') == $value->created_by) { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun_delete_reply(<?php echo $value->id; ?>);" style="border: none; background: transparent;"> <span class="glyphicon glyphicon-trash"></span>Delete </button> <?php } else if(session()->get('user_type_id') == 5) { ?> <?php } else { ?> <?php } ?> </span> </div> </div> </div> <?php } else { ?> <div class="outgoing_msg"> <div class="sent_msg"> <p><?php echo $value->reply; ?></p> <strong><?php echo strtoupper($value->username);?></strong> <span class="time_date"><?php $dt = new DateTime($value->created_at);echo $dt->format('d-m-Y');?> <?php if(session()->get('user_type_id') == 4 && session()->get('admin_id') == $value->created_by) { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun_delete_reply(<?php echo $value->id; ?>);" style="border: none; background: transparent;"> <span class="glyphicon glyphicon-trash"></span>Delete </button> <?php } else if(session()->get('user_type_id') == 5) { ?> <?php } else { ?> <?php } ?> </span> </div> </div> <?php } } } else { }?> </div> <?php if(session()->get('admin_id') != '18') {?> <div class="type_msg"> <div class="input_msg_write"> <form id="reply" class="form-inline reply"> <input type="hidden" id="booking_id" name="booking_id" value="<?php echo $this->uri->segment(2); ?>"> <input type="text" class="user_reply" name="reply" placeholder="Reply Here" /> <button class="msg_send_btn reply_submit" type="button" conv_id="<?php echo $row['conv_id']; ?>"><i class="fa fa-paper-plane-o" aria-hidden="true"></i></button> </form> </div> </div> <?php } ?> </div> </div> <?php }?> <br> <?php } else { ?> <?php } } else if($row['source_type'] == 'loan') { if($user_type_id == 4 || $user_type_id == 5 || $user_type_id == 6 || $user_type_id == 1) {?> <div class="col-sm-4"> Conversation :<br> <?php echo $row['conversation']; ?> </div> <div class="col-sm-4"> <?php echo strtoupper($row['username']);?>: <?php $dt = new DateTime($row['created_at']);echo $dt->format('d-m-Y');?> </div> <br><hr> <?php if($user_type_id == 4 || $user_type_id == 5 || $user_type_id == 6 || $user_type_id == 1) { ?> <div class="container"> <div class="mesgs"> <div class="msg_history"> <?php if(!empty($row['reply'])) { foreach($row['reply'] as $value) { ?> <?php if(session()->get('admin_id') == $value->created_by){?> <div class="incoming_msg"> <div class="received_msg"> <div class="received_withd_msg"> <p><?php echo $value->reply; ?></p> <strong><?php echo strtoupper($value->username);?></strong> <span class="time_date"><?php $dt = new DateTime($value->created_at);echo $dt->format('d-m-Y'); ?> <?php if(session()->get('user_type_id') == 4 && session()->get('admin_id') == $value->created_by) { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun_delete_reply(<?php echo $value->id; ?>);" style="border: none; background: transparent;"> <span class="glyphicon glyphicon-trash"></span>Delete </button> <?php } else if(session()->get('user_type_id') == 5) { ?> <?php } else { ?> <?php } ?> </span> </div> </div> </div> <?php } else { ?> <div class="outgoing_msg"> <div class="sent_msg"> <p><?php echo $value->reply; ?></p> <strong><?php echo strtoupper($value->username);?></strong> <span class="time_date"><?php $dt = new DateTime($value->created_at);echo $dt->format('d-m-Y');?> <?php if(session()->get('user_type_id') == 4 && session()->get('admin_id') == $value->created_by) { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun_delete_reply(<?php echo $value->id; ?>);" style="border: none; background: transparent;"> <span class="glyphicon glyphicon-trash"></span>Delete </button> <?php } else if(session()->get('user_type_id') == 5) { ?> <?php } else { ?> <?php } ?> </span> </div> </div> <?php } } } else { }?> </div> <?php if(session()->get('admin_id') != '18') {?> <div class="type_msg"> <div class="input_msg_write"> <form id="reply" class="form-inline reply"> <input type="hidden" id="booking_id" name="booking_id" value="<?php echo $this->uri->segment(2); ?>"> <input type="text" class="user_reply" name="reply" placeholder="Reply Here" /> <button class="msg_send_btn reply_submit" type="button" conv_id="<?php echo $row['conv_id']; ?>"><i class="fa fa-paper-plane-o" aria-hidden="true"></i></button> </form> </div> </div> <?php } ?> </div> </div> <?php }?> <br> <?php } else { ?> <?php } } else { ?> <?php if($user_type_id == 4 || $user_type_id == 5 || $user_type_id == 1) { ?> <div class="col-sm-4"> <strong> Conversation : </strong> <br><?php echo $row['conversation']; ?> </div> <div class="col-sm-4"> <?php echo strtoupper($row['username']);?>: <?php $dt = new DateTime($row['created_at']);echo $dt->format('d-m-Y');?> </div> <br><hr> <?php if($user_type_id == 4 || $user_type_id == 5 || $user_type_id == 1) { ?> <div class="container"> <div class="mesgs"> <div class="msg_history"> <?php if(!empty($row['reply'])) { foreach($row['reply'] as $value) { ?> <?php if(session()->get('admin_id') == $value->created_by){?> <div class="incoming_msg"> <div class="received_msg"> <div class="received_withd_msg"> <p><?php echo $value->reply; ?></p> <strong><?php echo strtoupper($value->username);?></strong> <span class="time_date"><?php $dt = new DateTime($value->created_at);echo $dt->format('d-m-Y'); ?> <?php if(session()->get('user_type_id') == 4 && session()->get('admin_id') == $value->created_by) { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun_delete_reply(<?php echo $value->id; ?>);" style="border: none; background: transparent;"> <span class="glyphicon glyphicon-trash"></span>Delete </button> <?php } else if(session()->get('user_type_id') == 5) { ?> <?php } else { ?> <?php } ?> </span> </div> </div> </div> <?php } else { ?> <div class="outgoing_msg"> <div class="sent_msg"> <p><?php echo $value->reply; ?></p> <strong><?php echo strtoupper($value->username);?></strong> <span class="time_date"><?php $dt = new DateTime($value->created_at);echo $dt->format('d-m-Y');?> <?php if(session()->get('user_type_id') == 4 && session()->get('admin_id') == $value->created_by) { ?> <button type="button" class="btn btn-default btn-sm" onclick="fun_delete_reply(<?php echo $value->id; ?>);" style="border: none; background: transparent;"> <span class="glyphicon glyphicon-trash"></span>Delete </button> <?php } else if(session()->get('user_type_id') == 5) { ?> <?php } else { ?> <?php } ?> </span> </div> </div> <?php } } } else { }?> </div> <?php if(session()->get('admin_id') != '18') {?> <div class="type_msg"> <div class="input_msg_write"> <form id="reply" class="form-inline reply"> <input type="hidden" id="booking_id" name="booking_id" value="<?php echo $this->uri->segment(2); ?>"> <input type="text" class="user_reply" name="reply" placeholder="Reply Here" /> <button class="msg_send_btn reply_submit" type="button" conv_id="<?php echo $row['conv_id']; ?>"><i class="fa fa-paper-plane-o" aria-hidden="true"></i></button> </form> </div> </div> <?php } ?> </div> </div> <?php }?> <br> <?php } else { ?> <?php } ?> <?php } ?> </div> <?php } } ?> <div class="modal fade" id="reply_modal" role="dialog"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Reply</h4> </div> <div class="modal-body"> <form id="reply" class="form-inline reply"> <div class="form-group col-md-offset-2 col-md-8"> <label>Reply</label> <div> <textarea type="text" class="col-md-12 user_reply" id="users_reply" name="reply"></textarea> <input type="hidden" class="form-control col-sm-8 reminder_id" id="reminder_id" name="reminder_id" required="required"> </div> </div> <input type="hidden" id="booking_id" name="booking_id" value="<?= esc(service('uri')->getSegment(2)) ?>"> <!-- row 1----> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit" id="reply_submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 4----> </form> </div> <!-- <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Submit</button> </div> --> </div> </div> </div> </section> <script type="text/javascript"> $('.date_picker').datepicker({ changeMonth:true, changeYear:true, yearRange: "2000:c", //dateFormat: 'yy-mm-dd' dateFormat: 'dd-mm-yy' }); function fun_delete_convo(str) { var val = str; $.ajax({ type : 'post', url :"<?php echo site_url('gss/delete_conversation');?>", data : {'conversation_id':val}, async : false, success:function(data) { toastr["success"]('Deleted'); location.reload(); } }); } function fun_delete_reply(str) { var val = str; $.ajax({ type : 'post', url :"<?php echo site_url('gss/delete_reply');?>", data : {'reply_id':val}, async : false, success:function(data) { toastr["success"]('Deleted'); location.reload(); } }); } function fun(str) { $('#add_call_conversation').modal('show'); } $('#add_call_convo').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url :"<?php echo site_url('add-status-conversation');?>", data : formdata, contentType : false, processData : false, success:function(response) { toastr["success"]('Message Sent'); $('#add_call_conversation').modal('hide'); location.reload(); } }); }); /*function add_reply(str) { $('#reply_modal').modal('show'); $('#reply_submit').click(function(e){ e.preventDefault(); //alert(); var reply = $('.user_reply').val(); var booking_id = $('#booking_id').val(); var val = str; $.ajax({ type : 'post', url :"<?php //echo site_url('add-converstaion-reply');?>", data : {'conversation_id':val,'booking_id':booking_id,'reply':reply}, async : false, success:function(data) { toastr["success"]('Message Sent'); $('#reply_modal').modal('hide'); location.reload(); } }); }); }*/ $('.reply_submit').click(function(){ var conv_id = $(this).attr('conv_id'); var booking_id = $('#booking_id').val(); var conversation_id = conv_id; var reply = $(this).parent().find("input[name=reply]").val() if(reply == "") { toastr["error"]('Please type a message'); } else { $.ajax({ type : 'post', url :"<?php echo site_url('add-converstaion-reply');?>", data : {'conversation_id':conversation_id,'booking_id':booking_id,'reply':reply}, async : false, success:function(data) { toastr["success"]('Message Sent'); $('#reply_modal').modal('hide'); location.reload(); } }); } //var reply = $('.user_reply').val(); }); $('.date_picker').datepicker({ changeMonth:true, changeYear:true, yearRange: "2000:c", //dateFormat: 'yy-mm-dd' dateFormat: 'dd-mm-yy' }); </script> <style> .label_comment { background-color: white; color: blue; font-weight: bold; padding: 4px; text-transform: uppercase; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; } .label_reply{ background-color: white; color: black; font-weight: bold; padding: 4px; text-transform: uppercase; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; } </style> <style> img{ max-width:100%;} .inbox_msg { border: 1px solid #c4c4c4; clear: both; overflow: hidden; } .top_spac{ margin: 20px 0 0;} .chat_ib h5{ font-size:15px; color:#464646; margin:0 0 8px 0;} .chat_ib h5 span{ font-size:13px; float:right;} .chat_ib p{ font-size:14px; color:#989898; margin:auto} .chat_img { float: left; width: 11%; } .chat_ib { float: left; padding: 0 0 0 15px; width: 88%; } .chat_people{ overflow:hidden; clear:both;} .chat_list { border-bottom: 1px solid #c4c4c4; margin: 0; padding: 18px 16px 10px; } .inbox_chat { height: 550px; overflow-y: scroll;} .active_chat{ background:#ebebeb;} .incoming_msg_img { display: inline-block; width: 6%; } .received_msg { display: inline-block; padding: 0 0 0 10px; vertical-align: top; width: 92%; } .received_withd_msg p { background: #ebebeb none repeat scroll 0 0; border-radius: 3px; color: #646464; font-size: 14px; margin: 0; padding: 5px 10px 5px 12px; width: 100%; } .time_date { color: #747474; display: block; font-size: 12px; margin: 8px 0 0; } .received_withd_msg { width: 57%;} .mesgs { float: left; padding: 30px 15px 0 25px; width: 100%; } .sent_msg p { background: #05728f none repeat scroll 0 0; border-radius: 3px; font-size: 14px; margin: 0; color:#fff; padding: 5px 10px 5px 12px; width:100%; } .outgoing_msg{ overflow:hidden; margin:26px 0 26px;} .sent_msg { float: right; width: 46%; } .input_msg_write input { background: rgba(0, 0, 0, 0) none repeat scroll 0 0; border: medium none; color: #4c4c4c; font-size: 15px; min-height: 48px; width: 100%; } .type_msg {border-top: 1px solid #c4c4c4;position: relative;} .msg_send_btn { background: #05728f none repeat scroll 0 0; border: medium none; border-radius: 50%; color: #fff; cursor: pointer; font-size: 17px; height: 33px; position: absolute; right: 0; top: 11px; width: 33px; } .messaging { padding: 0 0 50px 0;} .msg_history { /*height: 516px;*/ overflow-y: auto; } </style> <?php echo view('includes/footer');?>