<div ng-form="crmMailingSubform">
  <div class="crm-block crm-form-block crmMailing">

    <div crm-mailing-block-summary crm-mailing="mailing"></div>
    <div crm-mailing-block-mailing crm-mailing="mailing"></div>

    <div crm-ui-tab-set>
      <div crm-ui-tab id="tab-html" crm-title="ts('HTML')">
        <div crm-mailing-body-html crm-mailing="mailing"></div>
      </div>
      <div crm-ui-tab id="tab-text" crm-title="ts('Plain Text')">
        <div crm-mailing-body-text crm-mailing="mailing"></div>
      </div>
      <span ng-model="placeholder" crm-ui-validate="mailing.body_html || mailing.body_text"></span>
      <div crm-ui-tab id="tab-attachment" crm-title="ts('Attachments')">
        <div crm-attachments="attachments"></div>
      </div>
      <div crm-ui-tab id="tab-header" crm-title="ts('Header and Footer')">
        <div crm-mailing-block-header-footer crm-mailing="mailing"></div>
      </div>
      <div crm-ui-tab id="tab-pub" crm-title="ts('Publication')">
        <div crm-mailing-block-publication crm-mailing="mailing"></div>
      </div>
      <div crm-ui-tab id="tab-response" crm-title="ts('Responses')">
        <div crm-mailing-block-responses crm-mailing="mailing"></div>
      </div>
      <div crm-ui-tab id="tab-tracking" crm-title="ts('Tracking')">
        <div crm-mailing-block-tracking crm-mailing="mailing"></div>
      </div>
    </div>

    <div crm-ui-accordion="{title: ts('Preview')}">
      <div crm-mailing-block-preview crm-mailing="mailing" on-preview="previewMailing(mailing, preview.mode)" on-send="sendTest(mailing, attachments, preview.recipient)"></div>
    </div>

    <div crm-ui-accordion="{title: ts('Schedule')}">
      <div crm-mailing-block-schedule crm-mailing="mailing"></div>
    </div>

    <button crm-icon="fa-paper-plane" ng-disabled="block.check() || crmMailingSubform.$invalid" ng-click="submit()">{{ts('Submit Mailing')}}</button>
    <button crm-icon="fa-floppy-o" ng-disabled="block.check()" ng-click="save().then(leave)">{{ts('Save Draft')}}</button>
    <button
      crm-icon="fa-trash"
      ng-show="checkPerm('delete in CiviMail')"
      ng-disabled="block.check()"
      crm-confirm="{title:ts('Delete Draft'), message:ts('Are you sure you want to permanently delete this mailing?')}"
      on-yes="delete()">{{ts('Delete Draft')}}</button>
  </div>
</div>
