@layout('admin/master')
@section('content')
<section class="main-content">
<div class="row">
  <div class="col-sm-12">
    @if(hasErrorFor('errors'))
    @!component('admin.flash-errors', {errors: getErrorFor('errors')})
    @endif
    @if(hasErrorFor('error'))
    @!component('admin.flash-error', error = getErrorFor('error') )
    @endif
    @if(flashMessage('success'))
    @!component('admin.flash-success', success = flashMessage('success') )
    @endif
    <div class="card">
      <div class="card-header card-default">
        Edit Mail Template
      </div>
      <div class="card-body">
        <form action="{{ route('email_management.update') }}" method="POST">
          {{ csrfField() }}
          <input type="hidden" name="slug" value="{{ record.slug }}">
          <div class="form-group">
            <label>Email wildcard </label>
            <input value="{{ record.wildcard }}" type="text" name="subject" disabled="disabled">
          </div>
          <div class="form-group">
            <label>Email Subject</label>
            <input value="{{ record.subject }}" type="text" name="subject">
          </div>
          <div class="form-group">
            <label>Email body</label>
            <textarea required class="form-control" name="body" id="editor" cols="30"
                      rows="10">{{ record.body }}</textarea>
          </div>
          <div class="form-group">
            <div class="buttons">
              <button class="btn btn-primary">Update</button>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
@include('admin.footer')
</section>
@section('scripts')
{{ script('//cdn.ckeditor.com/4.18.0/standard/ckeditor.js') }}
<script>
CKEDITOR.replace('editor', {
  toolbar: [
    { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ '-', 'Save', 'NewPage', 'ExportPdf', 'Preview', 'Print', '-', 'Templates' ] },
    { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
    { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] },
    { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }
  ]
});
</script>
@endsection
@endsection
