<?php 

function send_bulk_email_cb() {
  global $post_meta;
  global $app;
  add_page_javascript('app/assets/js/page-scripts/submit.js');
  $ref = get_upload_ref("email-att");
  $exclude = $temp = ["software_engineer"];
  foreach ($temp as $key => $value) {
    $exclude[] = "All ".get_role_name($value)."(s)";
  }
	?>
  <div class="row">
  	<div class="col-md-9">
      <div class="box box-primary">
        <div class="box-header with-border">
          <h3 class="box-title">Compose New Message</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
          <form id="send-bulk-email-form" method="post" action="contents/plugins/messaging/ajax.php" data-clearform=1 data-callback="refreshPage">
          <?php 
            do_action("add_sms_list_to_form", ["id" => "receivers", "exclude" => $exclude]);
            dynamic_select(['label' => 'More Emails <small>Seperate with semi-colons</small>', 'id' => 'emails', 'name' => 'email[]'], ['type' => 'email_address', 'status' => 'active', 'user_id' => $app->user_meta['id']], ';', 'contact', 'contact', array(), 'contacts');
            input(['label' => 'Subject', 'id' => 'subject']); 
            textarea(['label' => 'Message', 'id' => 'msg', 'rows' => 8], true);
            submit_btn('send_bulk_email', 'Send <i class="fa fa-location-arrow"></i>');
           ?>
          </form>
        </div>
      </div>
      <!-- /. box -->
    </div>
    <div class="col-md-3">
      <h3 class="box-title">Attachments</h3>
      <?php 
        do_action('drag_n_drop_uploader', [
          'max_files' => 5,
          'ref' => $ref,
          'msg' => "<img width='30px' src='contents/plugins/messaging/images/attachment.png'><br/><small>Drop Files Here to Attach</small>",
          'max_size' => 10,
          'accepts' => 'image/*, audio/mpeg, audio/mpg, audio/mpeg3, audio/mp3, video/mp4, application/excel, application/msexcel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, application/x-zip, application/zip, application/x-zip-compressed, application/s-compressed, multipart/x-zip, application/pdf'
        ]);
       ?>
    </div>
  </div>
	<?php
}