Sindbad~EG File Manager

Current Path : /home/numerotech/admin.numerotech.com/admin_app_v1/core/templates/admin_templates/
Upload File :
Current File : //home/numerotech/admin.numerotech.com/admin_app_v1/core/templates/admin_templates/edit_admin.html

{% extends "layout.html" %}
{% block title %}Edit Admin Access{% endblock %}
{% block header %}Edit Admin Access{% endblock %}
{% block content %}
<div class="container">
    <div class="row">
        <div class="col">
            <h3 class="text-center font-weight-bold">Edit User Access</h3>
        </div>
    </div>
    <form class="register_admin_form mt-4" id="register_admin_form" method="POST" enctype="multipart/form-data"  action="{{url_for('admin_access.PostEditAdmin',society_id=society_id,society_key=society_key)}}">
        <!-- <input type="text"  name="admin_access_id" id="admin_access_id" value="{{data1.admin_access_id or 0}}"> -->
        <div class="row">
            <div class="col text-center">
                {% for mesg in get_flashed_messages(category_filter=["successMsg"]) %}

                <div class="alert alert-success text-center alert-dismissible" id="successMessage" >
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <h4><img src="/static/images/right.png" alt="right" height="21" width="21">{{ mesg|safe }}</h4>
                </div>
                {% endfor %}
                {% for mesg in get_flashed_messages(category_filter=["errorMsg"]) %}
                
                <div class="alert alert-danger text-center alert-dismissible" id="successMessage" >
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <h4><img src="/static/images/wrong_img.png" alt="wrong"height="21" width="21">{{ mesg }}</h4>
                </div>
                
                {% endfor %}
            </div>
        </div>
        <div class="row justify-content-center form-group">
            <div class="col-lg-4 col-md-4 col-sm-12">
                <label class="text-dark ">Email Id<span class="text-danger">*</span></label>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-12">
                {% if admin_email: %}
                <input type="email" id="email_id" class="form-control float-left" name="email_id" disabled required placeholder="enter email id" value="{{admin_email or ''}}">
                {% else %}
                <input type="email" id="email_id" class="form-control float-left" name="email_id" required placeholder="enter email id" value="{{admin_email or ''}}">
                {% endif %}
            </div>
            <div class="col-lg-2 col-md-2 col-sm-12">
                {% if admin_email == None %}
                <input type="submit" class="btn btn-success" id="verify_email" name="btn_value" value="Verify Email">
                {% endif %}
            </div>
        </div>
    </form>
    <form class="edit_admin_form mt-4" id="edit_admin_form" method="POST" enctype="multipart/form-data"  action="{{url_for('admin_access.PostEditAdmin',society_id=society_id,society_key=society_key)}}">
        <input type="hidden" id="email_id" name="email_id" value="{{admin_email or ''}}">
        {% if data1.u_email: %}
        <div class="row justify-content-center form-group"> 
            <div class="col-lg-4 col-md-4 col-sm-12">
                <label class="text-dark">Admin Role<span class="text-danger">*</span></label>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-12">
                <input type="hidden" id="hidden_role_id" class="hidden_role_id" value="{{data1.admin_role_id or 0}}">
               <select id="role" class="form-control" name="role">
                <option value="">---select---</option>
                {% for r in admin_roles: %}
                {% if data1.admin_role_id == r.admin_role_id%}
                <option value="{{r.admin_role_id}}" selected>{{r.role}}</option>
                {% else %}
                <option value="{{r.admin_role_id}}">{{r.role}}</option>
                {% endif %}
                {% endfor %}
               </select>
            </div>
            <div class="col-lg-2 col-md-2 col-sm-12">

            </div>
        </div>
        <hr>
        {% endif %}
        {% if (data1.user_id or 0)|int > 0: %}
        <input type="hidden" id="user_id" name="user_id" value="{{data1.user_id}}">
        <div class="row text-center form-group">
            <div class="col-lg-3 col-md-3 col-sm-12">
                <span class="font-weight-bold">Name : </span><span id="d_full_name">{{data1.prefix or ''}}{{data1.full_name or ''}}</span>
                <input type="text" id="full_name" class="form-control" name="full_name" value="{{data1.full_name or ''}}">
            </div>
            <div class="col-lg-3 col-md-3 col-sm-12">
                <span class="font-weight-bold">Mobile : </span><span id="d_mobile">{{data1.mobile or ''}}</span>
                <input type="text" id="mobile" class="form-control" name="mobile" value="{{data1.mobile or ''}}">
            </div>
            <div class="col-lg-3 col-md-3 col-sm-12">
                <span class="font-weight-bold">Password : </span> <a  id="password" data-toggle="tooltip" data-placement="bottom" title="{{data1.password}}">{{password or ''}}</a>
                <input type="password" id="d_password" class="form-control" name="d_password" value="{{data1.password or ''}}">
            </div>
            <div class="col-lg-3 col-md-3 col-sm-12">
                <input type="button" class="btn btn-primary float-right" id="edit_btn" name="edit_btn" value="Edit" onclick="get_user_data()">
                <input type="submit" class="btn btn-warning text-dark float-right" id="update_btn" name="btn_value" value="Update">
            </div>
        </div>
            {% elif (admin_email or None) %}
            <hr>
            <div class="row form-group">
                <div class="col text-center">
                    <h3 class="text-danger font-weight-bold">Not Register, Please be Register here</h3>
                </div>
            </div>
            <div class="row align-items-center form-group">
                <div class="col-lg-5 col-md-5 col-sm-12">
                    <label>Name<span class="text-danger">*</span></label>
                    <input type="text" class="form-control" required placeholder="Enter your full name" id="user_name" name="user_name">
                </div>
                <div class="col-lg-5 col-md-5 col-sm-12">
                    <label>Password<span class="text-danger">*</span></label>
                    <input type="text" class="form-control pswrd" id="pswrd" required name="pswrd" placeholder="Enter your password" minlength="4" maxlength="6">
                    
                </div>
                <div class="col-lg-2 col-md-2 col-sm-12 mt-4">
                    <input type="submit" class="btn btn-danger form-control " id="add_btn" name="btn_value" value="Register">
                </div>
            </div>
        {% endif %}
        
        <hr>
        <div class="row form-group">
            <div class="col text-center">
                <a class="nav-link text-success font-weight-bold" href="#" id="fully_access" data-toggle="tooltip" data-placement="bottom" title="You have access for all the application">Full Accessed ?</a>
                <!-- <label class="text-success font-weight-bold" id="fully_access">Fully Accessed<span title="You have access for all the application">?</span></label> -->
            </div>
        </div>
        <div class="row justify-content-center form-group" id="application">
            <div class="col-lg-8 col-md-8 col-sm-12"> 
            <label id="chk_app_name-error" class="error" for="chk_app_name" style="display: inline-block;"></label>          
            <div class="mobile-responsive mt-4">
                <table class="table table-bordered bg-white">
                  <thead class="thead-dark text-white font-weight-bold text-center">
                      <tr>
                          <th scope="col">Sno</th>
                          <th scope="col">Active Application</th>
                          <th scope="col">Select</th>  
                      </tr>
                  </thead>
                  <tbody id="mail_data" class="text-center">
                    {% if data : %}
                    {% for app in data %}
                   
                    <tr>
                        <td data-label="Sno">{{loop.index }}</td>
                        <td data-label="Active Application">{{app.app_name}} {% if app.conf_name: %} - {{app.conf_name}} {% endif %}</td>
                        <td data-label="Select"><input type="checkbox" name="chk_app_name" id="app_name_{{app.app_type_id}}" class="app_name" value="{{app.access_key}}" {{ 'checked' if
                            app.admin_email == data1.u_email }}></td>
                    </tr>
                    {% endfor %}
                    {% else : %} 
                    <tr>
                        <td colspan="4"> <span style="color: red;" >Records does not exist.</span></td>
                    </tr>
            
                    {% endif %} 
                  </tbody>
                </table>
            </div>
            </div>
        </div>
        <div class="row form-group">
            <div class="col-lg-6 col-md-6 col-sm-12">
                <a href="{{url_for('admin_access.ViewAdmin',society_id=society_id,society_key=society_key)}}" class="btn btn-danger float-left">Back</a>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-12">
                <input type="submit" class="btn btn-primary float-right" name="btn_value" id="update" value="Add">
            </div>
        </div>
        <hr>
    </form>
</div>
{% endblock %}
{% block script %}
<script>
   $("#update_btn").hide();
    $("#full_name").hide();
    $("#mobile").hide();
    $("#d_password").hide();
    function get_user_data(){
        // alert(user_id);
        $("#update_btn").show();
        $("#full_name").show();
        $("#mobile").show();
        $("#d_password").show();
        $("#edit_btn").hide();
        $("#d_full_name").hide();
        $("#d_mobile").hide();
        $("#password").hide();

    }
    var admin_role_id = $("#hidden_role_id").val();
    if (admin_role_id==1){
        $("#fully_access").hide();
        $("#application").show();   
    }
    else if(admin_role_id==2){
        $("#fully_access").show();
        $("#application").hide();  
    }
    else if (admin_role_id==3){
        $("#fully_access").hide();
        $("#application").show();   
    }
    else{
        $("#fully_access").hide();
        $("#application").hide();
    }

    // $(function () {
    // $('[data-toggle="tooltip"]').tooltip()
    // });
    $("#fully_access").tooltip();
    $("#password").tooltip();

    // var pswrd = $("#pswrd").val();
    // $("#pswrd").hover(function() {
    //     $(this).css('cursor','pointer').attr('title', pswrd);
    // }, function() {
    //     $(this).css('cursor','auto');
    // });

    $("#role").on('change', function () {
    var role_id = $("option:selected").val();
    // alert(role_id);
    
    if (role_id==2){
        $('#fully_access').show();
        $("#application").hide();
    }
    else if(role_id==1){
        $("#application").show();
        $('#fully_access').hide();
    }
    else if(role_id==3){
        $("#application").show();
        $('#fully_access').hide();
    }
    else{
        $('#fully_access').hide();
        $("#application").hide();
    }
   });

//    $("input[type='checkbox'][name='chk_app_name']").change(function() {
//     if ($("input[type='checkbox'][name='chk_app_name']:checked").length){
//         $(this).valid()
//     }
//    })

   $("#update").click(function() {
    
          validate_edit_form();
          
    })
    
    function validate_edit_form()
    { 

          $("#edit_admin_form").validate({
            
                 
              rules : {
                role : {
                            required : true,
                       },
                chk_app_name: {
                    required : true,
                },
              },
              messages : {
                role : "Please select role" 
              },
              highlight: function(element) {
                  $(element).parent().addClass('error')
              },
          
              unhighlight: function(element) {
                  $(element).parent().removeClass('error')
              },
      
              submitHandler: function(form) {
                  form.submit();
              }
          })
                 
      }
</script>
{% endblock%}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists