]]jkjjgdjffksdkdxdsghfghdfghfgdfsdsdfsdfsfdsbcxvxcbccwewqeqwewqskfgj
במ12[cxvbcxvbxcvbcxvcxvbcvxcvbsdfsdfsdfsdfsdfsdfxcvbxcvxbbxqwqewqewv;'
/
home
/
u506006416
/
domains
/
crystalmiracle.co.in
/
public_html
/
admin
/
Upload FileeE
HOME
<?php include("header.php"); $sel_obj= new config(); ?> <?php include("sidebar.php");?> <?php /*-------------- Delete Replied Msg -----------*/ if(isset($_GET['del_id']) and !empty($_GET['del_id'])) { $where = array( 'id' => $_GET["del_id"]); if($sel_obj->delete("emails", $where)) { echo "<script> swal({ title: 'Deleted Successfully', text: 'Redirecting...', icon: 'success', timer: 1000, buttons: false, }) </script>"; } echo '<script>window.location.href = "email_to_guest_users.php";</script>'; } /*----------------------------------------*/ ?> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdn.ckeditor.com/4.19.1/standard/ckeditor.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.js" ></script> <style> .note-editable{width: 100%; min-height:100px!important;} .chosen-container {width: 100%!important} .modal-dialog { max-width: 700px; margin: 0rem auto; } #loading-image{ position: fixed; margin: auto; top: 20%; z-index: 9999; text-align: center; flex-direction: column; display: flex; right: 0; left: 0; width: 200px; } </style> <div class="content-wrapper pb-5"> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h2 class="m-0 text-dark">Email For Guest Users</h2> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <!-- <li class="breadcrumb-item"><a class="btn btn-info" href="contact.php">Back</a></li> --> </ol> </div> </div> </div> </div> <!-- ------------------- Mail Templete ------------------ --> <section class="content card m-2" id="mail_temp_id" style="display: block;"> <h5 class="pt-2 mb-4">You can send email to multiple users by selecting a template</h5> <div id="loading-image" class="text-center" style="display: none;"> <img src="../assets/images/loader2.gif" class="img-fluid"> </div> <?php $query_mail=$db->select('mail_templete'); if(is_array($query_mail) || !empty($query_mail)) { $temp_no = 1; foreach($query_mail as $templete) { $mail_logo = $templete['logo']; $header_background = $templete['header_background']; $body_background = $templete['body_background']; $footer_background = $templete['footer_background']; $mail_subject = $templete['subject']; $mail_top_content = $templete['top_content']; $mail_middle_content = $templete['middle_content']; $mail_bottom_content = $templete['bottom_content']; $mail_footer = $templete['footer']; ?> <div class="mt-2"> <button class="btn btn-primary mb-4" title="Click to open mail box" data-toggle="collapse" data-target="#temp_id<?php echo $temp_no;?>">Select Email Template - <?php echo $temp_no;?> <i class="fa fa-arrow-circle-right"></i></button> </div> <div class="container-fluid pb-5 collapse card" id="temp_id<?php echo $temp_no;?>"> <form id="send_form<?php echo $temp_no;?>" class="form-horizontal" method="post" enctype="multipart/form-data"> <div class="container-fluid"> <div class="row"> <div class="col-md-6"> <div class="card card-primary card-tabs"> <div class="card-header p-2 pt-1"> Mail Templete - <?php echo $temp_no;?> </div> <div class="tab-content" id="custom-tabs-five-tabContent"> <div class="tab-pane fade active show" id="general"> <div class="card-body"> <div class="form-group row"> <input type="hidden" name="templete_id" value="<?php echo $templete['id']; ?>"> </div> <!-- ---------------- To Email ------------ --> <div class="form-group row"> <div class="col-12"> <label>Recipients</label> <div class="pl-4"> <label> <input type="radio" class="recipient" id="rec_1<?php echo $temp_no;?>" name="recipient" value="all_users" required>All Users </label> <br> <label> <input type="radio" class="recipient" id="rec_2<?php echo $temp_no;?>" name="recipient" value="selected_users">Selected Users </label> </div> </div> <div class="col-12" id="recipient_div<?php echo $temp_no;?>"> <label for="subject" class="col-form-label">Select Users to send email</label> <div id="output_email" class="output_email"></div> <select id="email_ids<?php echo $temp_no; ?>" data-placeholder="Choose user ..." name="email_ids[]" class="chosen-select form-control my_choosen email_ids" multiple> <option value="0">Select User </option> <?php $query=$sel_obj->select('guest_contact'); if(is_array($query) || !empty($query)) { foreach($query as $data): ?> <option value="<?php echo $data['email']; ?>"><?php echo $data['email']; ?></option> <?php endforeach; ?> <?php } ?> </select> </div> </div> <script> $(document).ready(function() { if ($("#rec_2<?php echo $temp_no;?>").is(':checked')) { $("#recipient_div<?php echo $temp_no;?>").show(); } else { $("#recipient_div<?php echo $temp_no;?>").hide(); } $("#rec_2<?php echo $temp_no;?>").click(function() { $("#recipient_div<?php echo $temp_no;?>").show(); }); $("#rec_1<?php echo $temp_no;?>").click(function() { $("#recipient_div<?php echo $temp_no;?>").hide(); }); }); </script> <!-- -------------------------------------- --> <div class="form-group row"> <div class="col-12"> <label for="subject" class="col-form-label">Subject</label> <textarea id="subject" name="subject" class="form-control" required><?php echo $mail_subject; ?></textarea> </div> </div> <div class="form-group row"> <div class="col-12"> <label for="topTextarea<?php echo $temp_no;?>" class="col-form-label">Top Content</label> <textarea id="topTextarea<?php echo $temp_no;?>" name="top_content"><?php echo $mail_top_content; ?></textarea> </div> </div> <div class="form-group row"> <div class="col-12"> <label for="subject" class="col-form-label">Select Products</label> <div id="output" class="output"></div> <select data-placeholder="Choose tags ..." name="product_ids[]" id="product_id<?php echo $temp_no;?>" class="chosen-select form-control my_choosen product_ids" multiple> <option value="">Select Products </option> <?php $query=$sel_obj->select('product'); if(is_array($query) || !empty($query)) { foreach($query as $data): ?> <option value="<?php echo $data['p_id']; ?>"><?php echo $data['p_name']; ?></option> <?php endforeach; ?> <?php } ?> </select> </div> </div> <div class="form-group row" style="display: none;"> <div class="col-12"> <label for="middleTextarea<?php echo $temp_no;?>" class="col-form-label">Middle Content</label> <textarea id="middleTextarea<?php echo $temp_no;?>" name="middle_content"><?php echo $mail_middle_content; ?></textarea> </div> </div> <div class="form-group row"> <div class="col-12"> <label for="bottomTextarea<?php echo $temp_no;?>" class="col-form-label">Bottom Content</label> <textarea id="bottomTextarea<?php echo $temp_no;?>" name="bottom_content"><?php echo $mail_bottom_content; ?></textarea> </div> </div> </div> </div> </div> </div> </div> <div class="col-md-6"> <?php if ($temp_no==1) { include("mail_templete_1.php"); } if ($temp_no==2) { include("mail_templete_2.php"); } if ($temp_no==3) { include("mail_templete_3.php"); } ?> <div class="card-footer"> <button type="button" id="send_email<?php echo $temp_no; ?>" name="send_mail" class="btn btn-primary">Send Mail</button> </div> </div> </div> <!-- /.row (main row) --> </div> <!-- /.container-fluid --> </form> </div> <script> document.getElementById('output').innerHTML = ''; $(".chosen-select").chosen(); /*---- Product Info ------*/ $(document).on("change", "#product_id<?php echo $temp_no;?>", function(){ var p_id = $(this).val(); $.ajax({ url: "ajax.php", type: "POST", data: { p_id: p_id }, success: function(response) { document.getElementById("output_email_message_middle<?php echo $temp_no;?>").innerHTML = response; document.getElementById("middleTextarea<?php echo $temp_no;?>").innerHTML = response; } }); }); </script> <script> $(document).ready(function(){ /*---- Top -------*/ var id_top = 'topTextarea<?php echo $temp_no;?>'; CKEDITOR.replace(id_top); CKEDITOR.instances[id_top].on('contentDom', function() { this.document.on('keyup', function(event){ var data = CKEDITOR.instances[id_top].getData(); //data=data.replace(/<[^>]*>?/gm, ''); $("#output_email_message_top<?php echo $temp_no;?>").html(data); }); }); /*-------- Bottom -------*/ var id_bottom = 'bottomTextarea<?php echo $temp_no;?>'; CKEDITOR.replace(id_bottom); CKEDITOR.instances[id_bottom].on('contentDom', function() { this.document.on('keyup', function(event){ var data = CKEDITOR.instances[id_bottom].getData(); //data=data.replace(/<[^>]*>?/gm, ''); $("#output_email_message_bottom<?php echo $temp_no;?>").html(data); }); }); /*--------------*/ }); </script> <script> $(document).ready(function(){ // $('#loading-image').show(); // $("#send_form<?php echo $temp_no; ?>").submit(function() { $("#send_email<?php echo $temp_no; ?>").on("click", function(){ // var data = $('#send_form').serialize(); $('#loading-image').show(); var email_ids = []; $("#email_ids<?php echo $temp_no; ?>").each(function () { email_ids.push($(this).val()); }); var product_ids = []; $("#product_id<?php echo $temp_no; ?>").each(function () { product_ids.push($(this).val()); }); var recipient = $(".recipient:checked").val(); var templete_id = $('input[name="templete_id"]').val(); var subject = $('textarea[name="subject"]').val(); var top_content = $('textarea[name="top_content"]').val(); var middle_content = $('textarea[name="middle_content"]').val(); var bottom_content = $('textarea[name="bottom_content"]').val(); // alert(email_ids); exit(); // console.log(email_ids); // data.push({name: 'tienn2t', value: 'love'}); $.ajax({ type: "POST", url: "ajax_sendGuestEmail.php", data: {email_ids:email_ids, product_ids:product_ids, templete_id:templete_id, subject:subject, top_content:top_content, middle_content:middle_content, bottom_content:bottom_content, recipient:recipient, send_mail:'send_mail'}, success: function(response) { // alert(response); // console.log(response); // exit(); if (response==1) { $('#loading-image').hide(); swal({ title: 'Message Sent Successfully', text: 'Redirecting...', icon: 'success', timer: 2000, buttons: false, }) .then(() => { location.reload(true); }) } }, error: function() { alert('error handing here'); } }); }); }); </script> <?php $temp_no++; } } ?> </section> <!-- -------------------------------------------- --> <!-- -------- Replied List ---------------- --> <section class="content"> <div class="container-fluid"> <div class="card card-primary card-tabs p-2"> <div class="card-header p-2 mb-2"> List of Sent Email </div> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>S.N.</th> <th>Subject</th> <th>Message</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody> <?php $query_repl=$sel_obj->select('emails'); $repl_count=0; if(is_array($query_repl) || !empty($query_repl)) { foreach ($query_repl as $data_repl ) { if($data_repl['user_type']=='guest'){ ?> <tr> <td><?php echo $repl_count+1;?></td> <td><?php echo $data_repl['subject']; ?></td> <td> <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#exampleModalLong<?php echo $repl_count;?>"> View Message </button> <!-- Modal --> <div class="modal fade" id="exampleModalLong<?php echo $repl_count;?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">Message Details</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <b>To</b> <div class="mb-4 p-1" style="border: 1px solid #c3c2c2"> <?php if ($data_repl['email_ids']!='' || !empty($data_repl['email_ids'])) { foreach (json_decode($data_repl['email_ids']) as $email_id) { ?> <span class="mr-2" style="border: 1px solid #c3c2c2; border-radius:4px; font-size: 12px;"><?php echo $email_id; ?></span> <?php } }else{ ?> <span class="mr-2" style="border: 1px solid #c3c2c2; border-radius:4px; font-size: 12px;">All Users</span> <?php } ?> <?php //echo "<pre>"; print_r($data_repl);?> </div> <b>Message Body</b> <?php $templete_id = $data_repl['templete_id']; $con_temp="`id`="."'$templete_id'"; $query_temp=$sel_obj->display_rcd('mail_templete',$con_temp); if(is_array($query_temp) || !empty($query_temp)) { foreach ($query_temp as $get_template) { } } $temp_no = $get_template['id']; $mail_logo = $get_template['logo']; $header_background = $get_template['header_background']; $body_background = $get_template['body_background']; $footer_background = $get_template['footer_background']; $mail_subject = $data_repl['subject']; $mail_top_content = $data_repl['top_content']; $mail_middle_content = $data_repl['middle_content']; $mail_bottom_content = $data_repl['bottom_content']; $mail_footer = $get_template['footer']; ?> <?php if ($temp_no==1) { include("mail_templete_1.php"); } if ($temp_no==2) { include("mail_templete_2.php"); } if ($temp_no==3) { include("mail_templete_3.php"); } ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> </td> <td><?php echo $data_repl['created_at']; ?></td> <td> <a href="email_to_guest_users.php?del_id=<?php echo $data_repl['id']; ?>" class="btn btn-danger btn-xs" onclick="return confirm('Are you sure to delete?')"><i class="fa fa-trash"></i></a> </td> </tr> <?php $repl_count++; } } } ?> </tbody> </table> </div> </div> </section> <!-- -------------------------------------------- --> <!-- /.content --> </div> <!-- /.content-wrapper --> <?php include("footer.php");?> <script> window.setTimeout(function() { $(".alert").fadeTo(1000, 0).slideUp(100, function(){ $(this).remove(); }); }, 1000); </script> <!-- <script> $(document).ready(function () { $("#reply_btn").click(function () { $("#mail_temp_id").toggle('slow'); }); }); </script> -->