<!-- Page Heading -->





          <h1 class="h3 mb-2 text-gray-800">Template Email Register</h1>





          <!-- <p class="mb-4">DataTables is a third party plugin that is used to generate the demo table below. For more information about DataTables, please visit the <a target="_blank" href="https://datatables.net">official DataTables documentation</a>.</p> -->











          <!-- DataTales Example -->

















          <div class="card shadow mb-4">





            <div class="card-header py-3 bg-primary">





              <h6 class="m-0 font-weight-bold text-light">Admin</h6>





            </div>





            <div class="card-body">





              <div class="row">





                <div class="col-md-12">





                  <form id="form_adm_reg">





                    <input type="hidden" id="id_template_email" name="id_template_email">





                    <div class="form-group">





                      <label>Subject</label>





                      <input type="text" id="sjk_adm_reg" class="form-control" name="sjk_adm_reg"/>





                    </div>





                    <div class="form-group">





                      <label>Message</label>





                      <textarea id="msg_adm_reg" class="form-control" name="msg_adm_reg"></textarea>





                      <small class="form-text text-muted">





                        Keterangan Variable :<br>





                        <div class="row">





                          <div class="col-sm-6">





                            %username% = Nama user yang mendaftar,<br>





                            %unit_misioner% = Unit Misioner user yang mendaftar,<br>





                            %email% = Email user yang mendaftar,<br>





                          </div>





                          <div class="col-sm-6">





                            %created_at% = User Mandaftar pada tanggal dan waktu,<br>





                            <!--%link_terima% = Link untuk menerima user,<br>-->





                            <!--%link_tolak% = Link Untuk menolak user<br>-->





                          </div>





                        </div>





                      </small>





                    </div>





                  </form>





                  <div class="btn-group float-right" role="group" aria-label="Basic example">





                    <a href="javascript:void(0)" class="btn btn-info btn-sm" id="test_adm_reg"><i class="fas fa-vial"></i> Test</a>





                    <a href="javascript:void(0)" class="btn btn-primary btn-sm" id="update_adm_reg"><i class="fas fa-edit"></i>Update Templalte</a>





                  </div>





                </div>





              </div>





            </div>





          </div>





          <div class="card shadow mb-4">





            <div class="card-header py-3 bg-success">





              <h6 class="m-0 font-weight-bold text-light">User</h6>





            </div>





            <div class="card-body">





              <div class="row">





                <div class="col-md-12">





                  <h5>SignUp User</h5>





                  <form id="form_user_reg">





                    <input type="hidden" id="id_template_email_user" name="id_template_email_user">





                    <div class="form-group">





                      <label>Subject</label>





                      <input type="text" id="sjk_user_reg" class="form-control" name="sjk_user_reg"/>





                    </div>





                    <div class="form-group">





                      <label>Message</label>





                      <textarea id="msg_user_reg" class="form-control" name="msg_user_reg"></textarea>





                    </div>





                  </form>





                  <div class="btn-group float-right" role="group" aria-label="Basic example">





                    <a href="javascript:void(0)" class="btn btn-info btn-sm" id="test_user_reg"><i class="fas fa-vial"></i> Test</a>





                    <a href="javascript:void(0)" class="btn btn-primary btn-sm" id="update_user_reg"><i class="fas fa-edit"></i> Update Template</a>





                  </div>





                </div>





              </div>





              <hr/>





              <!-- Terima User--->





              <div class="row">





                <div class="col-md-12">





                  <h5>Accept User</h5>





                  <form id="form_user_reg_acc">





                    <input type="hidden" id="id_template_email_user_acc" name="id_template_email_user_acc">





                    <div class="form-group">





                      <label>Subject</label>





                      <input type="text" id="sjk_user_reg_acc" class="form-control" name="sjk_user_reg_acc"/>





                    </div>





                    <div class="form-group">





                      <label>Message</label>





                      <textarea id="msg_user_reg_acc" class="form-control" name="msg_user_reg_acc"></textarea>





                      <small class="form-text text-muted">





                        Keterangan Variable: <br>





                        %login% = Link untuk mengarahkan user ke halaman login 





                      </small>





                    </div>





                  </form>





                  <div class="btn-group float-right" role="group" aria-label="Basic example">





                    <a href="javascript:void(0)" class="btn btn-info btn-sm" id="test_user_reg_acc"><i class="fas fa-vial"></i> Test</a>





                    <a href="javascript:void(0)" class="btn btn-primary btn-sm" id="update_user_reg_acc"><i class="fas fa-edit"></i> Update Template</a>





                  </div>





                </div>





              </div>





              <!-- End Terima User--->





              <hr>





              <!-- Terima User--->





              <div class="row">





                <div class="col-md-12">





                  <h5>Reject User</h5>





                  <form id="form_user_reg_rjk">





                    <input type="hidden" id="id_template_email_user_rjk" name="id_template_email_user_rjk">





                    <div class="form-group">





                      <label>Subject</label>





                      <input type="text" id="sjk_user_reg_rjk" class="form-control" name="sjk_user_reg_rjk"/>





                    </div>





                    <div class="form-group">





                      <label>Message</label>





                      <textarea id="msg_user_reg_rjk" class="form-control" name="msg_user_reg_rjk"></textarea>





                    </div>





                  </form>





                  <div class="btn-group float-right" role="group" aria-label="Basic example">





                    <a href="javascript:void(0)" class="btn btn-info btn-sm" id="test_user_reg_rjk"><i class="fas fa-vial"></i> Test</a>





                    <a href="javascript:void(0)" class="btn btn-primary btn-sm" id="update_user_reg_rjk"><i class="fas fa-edit"></i> Update Template</a>





                  </div>





                </div>





              </div>





              <!-- End Terima User--->





            </div>





          </div>





<script type="text/javascript">





$(document).ready(function(){





    





    var base_url = "<?=base_url()?>";





    var kode_user = "<?=$this->session->userdata("kode_user")?>";





    $('#msg_adm_reg').summernote({placeholder: 'Silahkan isi disini',





            tabsize: 2,





            height: 150,





            dialogsInBody: true,





            toolbar: [





                ['style', ['bold', 'italic', 'underline', 'clear']],





                ['font', ['strikethrough', 'superscript', 'subscript']],





                ['fontsize', ['fontsize']],





                ['color', ['color']],





                ['para', ['ul', 'ol', 'paragraph','style']],





                ['height', ['height']]





            ]





    });





    $('#msg_user_reg').summernote({placeholder: 'Silahkan isi disini',





            tabsize: 2,





            height: 150,





            dialogsInBody: true,





            toolbar: [





                ['style', ['bold', 'italic', 'underline', 'clear']],





                ['font', ['strikethrough', 'superscript', 'subscript']],





                ['fontsize', ['fontsize']],





                ['color', ['color']],





                ['para', ['ul', 'ol', 'paragraph','style']],





                ['height', ['height']]





            ]





    });





    $('#msg_user_reg_acc').summernote({placeholder: 'Silahkan isi disini',





            tabsize: 2,





            height: 150,





            dialogsInBody: true,





            toolbar: [





                ['style', ['bold', 'italic', 'underline', 'clear']],





                ['font', ['strikethrough', 'superscript', 'subscript']],





                ['fontsize', ['fontsize']],





                ['color', ['color']],





                ['para', ['ul', 'ol', 'paragraph','style']],





                ['height', ['height']]





            ]





    });





    $('#msg_user_reg_rjk').summernote({placeholder: 'Silahkan isi disini',





            tabsize: 2,





            height: 150,





            dialogsInBody: true,





            toolbar: [





                ['style', ['bold', 'italic', 'underline', 'clear']],





                ['font', ['strikethrough', 'superscript', 'subscript']],





                ['fontsize', ['fontsize']],





                ['color', ['color']],





                ['para', ['ul', 'ol', 'paragraph','style']],





                ['height', ['height']]





            ]





    });











    template_email = function(){





      $.ajax({ 





              url: base_url + 'template_email/ambil_header_footer',





              type: "post",





              data:{},





              dataType: "json",





              async : 'false',





              success: function(response){





                $('#id_template_email').val(response.id_template_email);





                $('#id_template_email_user').val(response.id_template_email);





                $('#id_template_email_user_acc').val(response.id_template_email);





                $('#id_template_email_user_rjk').val(response.id_template_email);











                $('#sjk_adm_reg').val(response.sjk_adm_reg);





                $('#msg_adm_reg').summernote('code', response.msg_adm_reg);





                $('#sjk_user_reg').val(response.sjk_user_reg);





                $('#msg_user_reg').summernote('code', response.msg_user_reg);  





                $('#sjk_user_reg_acc').val(response.sjk_user_reg_acc);





                $('#msg_user_reg_acc').summernote('code', response.msg_user_reg_acc);  





                $('#sjk_user_reg_rjk').val(response.sjk_user_reg_rjk);





                $('#msg_user_reg_rjk').summernote('code', response.msg_user_reg_rjk);  





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





      })





    }





    template_email();





    $("#update_adm_reg").click(function(){





      var form_data = new FormData($('#form_adm_reg')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Meng-Update Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/update_adm_reg',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Meng-Update Template", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    });





    $("#test_adm_reg").click(function(){





      var form_data = new FormData($('#form_adm_reg')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Mengetes Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/test_adm_reg',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Mengetes Template", "success");





                }else{





                  Command: toastr["warning"]("Anda Gagal Mengetes Template, ", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    })





    $("#update_user_reg").click(function(){





      var form_data = new FormData($('#form_user_reg')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Meng-Update Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/update_user_reg',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Meng-Update Template", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    });





    $("#test_user_reg").click(function(){





      var form_data = new FormData($('#form_user_reg')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Mengetes Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/test_user_reg',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Mengetes Template", "success");





                }else{





                  Command: toastr["warning"]("Anda Gagal Mengetes Template, ", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    })





    $("#update_user_reg_acc").click(function(){





      var form_data = new FormData($('#form_user_reg_acc')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Meng-Update Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/update_user_reg_acc',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Mengetes Template", "success");





                }else{





                  Command: toastr["warning"]("Anda Gagal Mengetes Template, ", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    });





    $("#test_user_reg_acc").click(function(){





      var form_data = new FormData($('#form_user_reg_acc')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Mengetes Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/test_user_reg_acc',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Mengetes Template", "success");





                }else{





                  Command: toastr["warning"]("Anda Gagal Mengetes Template, ", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    });





    $("#update_user_reg_rjk").click(function(){





      var form_data = new FormData($('#form_user_reg_rjk')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Meng-Update Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/update_user_reg_rjk',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Meng-Update Template", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    });





    $("#test_user_reg_rjk").click(function(){





      var form_data = new FormData($('#form_user_reg_rjk')[0]);





      bootbox.confirm("Apakah Anda Yakin Akan Mengetes Template?", function(result){ 





          if (result==true) {





            





            $.ajax({ 





              url: base_url + 'template_email/test_user_reg_rjk',





              type            : "POST",





                dataType        : 'json',





                mimeType        : 'multipart/form-data',





                data            : form_data,





                contentType     : false,





                cache           : false,





                processData     : false,





              success: function(response){





                // alert(JSON.stringify(response))





                if (response == true) {





                  Command: toastr["success"]("Anda Berhasil Mengetes Template", "success");





                }else{





                  Command: toastr["warning"]("Anda Gagal Mengetes Template, ", "success");





                }





              },





              error: function(jqXHR, textStatus, errorThrown) {





                $('#loading').modal('show');





                Command: toastr["error"](errorThrown, "Error");





              },





              beforeSend: function () {





                $('#loading').modal('show');





              },





              complete: function () {





                $('#loading').modal('hide');





              }





            })





          }





      })





    });





  });





</script>





