File manager - Edit - /home/autoph/public_html/tasks/role_action2.php.tar
Back
home/autoph/public_html/connectv1/role_action2.php 0000644 00000274030 15025005643 0016275 0 ustar 00 <?php include('cfg/db.php'); // include('app/security/security.php'); // include('api/controllers/utility.php'); if(!isset($_SESSION['user']['id'])){ header('location:signin.php'); } // if(!(isset($_SESSION['user']['action_permissions']['4']['sub_6_1']) && // $_SESSION['user']['action_permissions']['4']['sub_6_1'])){ // // header('location:signin.php'); // } // $check_page = new CheckPage(); // $utility_class = new Utility(); // $check_page->start($db); $action = isset( $_REQUEST['q']) ? $_REQUEST['q'] : '' ; if(!$utility_class->isNotEmpty($action)){ header('location:role.php'); } $page_title = ""; $role_id = 0; if(trim($_REQUEST['q']) == 'new'){ header('location:role.php');//temporary $page_title = "Add Role"; }else{ $page_title = "Update Role"; $role_id = $db->escape($_REQUEST['q']); $company_name = $db -> select("SELECT name FROM `employee_role` WHERE status = 1 AND id = $role_id /*AND id <> 1*/"); if(!$utility_class->isNotEmpty($company_name)){ header('location:role.php'); } } $hasAccess = $db -> select("SELECT action_permissions FROM `employee_role_access` WHERE status = 1 AND employee_role_id = '$role_id'"); if($utility_class->isNotEmpty($hasAccess)){ $hasAccessArray = (json_decode($hasAccess,true)); }else{ $hasAccessArray = array(); } // print_r($hasAccessArray); // echo $hasAccessArray['dashboard_permission']['dashboard_view_page']; // exit; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $variable['site_name']; ?> | <?php echo $page_title; ?></title> <!-- Google Font: Source Sans Pro --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"> <!-- Font Awesome --> <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css"> <!-- Theme style --> <link rel="stylesheet" href="dist/css/adminlte.min.css"> <!-- overlayScrollbars --> <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css"> <!-- Default style --> <link rel="stylesheet" href="dist/css/default.css"> <!-- Toastr --> <link rel="stylesheet" href="plugins/toastr/toastr.min.css"> <link href="dist/img/<?php echo $variable['logo']; ?>" rel="icon" /> </head> <body class="hold-transition sidebar-mini text-sm layout-fixed"> <div class="wrapper"> <!-- INCLUDE HEADER --> <?php include('include/header.php'); ?> <?php include('include/sidebar.php'); ?> <!-- /.navbar --> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1><?php echo $page_title; ?></h1> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="home.php">Home</a></li> <li class="breadcrumb-item active"><?php echo $page_title; ?></li> </ol> </div> </div> </div><!-- /.container-fluid --> </section> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="row"> <!-- left column --> <div class="col-md"> <!-- general form elements --> <div class="card card-primary"> <div class="card-header"> <h3 class="card-title"><button class="btn btn-tool" title="Go to Vehicle table list" type="button" onclick="back()"><i class="fas fa-arrow-alt-circle-left fa-2x"></i></button> Update <?php echo $company_name; ?> Role </h3> </div><!-- /.card-header --> <div class="card-body"> <div class="row my-0 mx-0"> <div class="col-md-3 pl-0"> <!-- text input --> <div class="form-group"> <div class="form-group dropdown-input"> <input style="text-transform: uppercase;" type="text" value="<?php echo $company_name; ?>" name="role" id="role" class="form-control form-control-sm" placeholder="Role name" maxlength="30"> </div> <!--form-group dropdown--> </div> <!--form-group--> </div> </div> <!--row--> <div id="role-list" class="table-responsive"> <table id="role-table" class="table table-bordered table-sm"> <thead> <tr> <th class="">Feature</th> <th class="">Capabilities</th> </tr> </thead> <tbody> <!-- DASHBOARD PAGE --> <tr> <td>Dashboard</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="dashboard_permission" value="dashboard_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['dashboard_permission']['dashboard_view_page'])){ echo ($hasAccessArray['dashboard_permission']['dashboard_view_page'])? 'checked' : '' ; } ?> class="dashboard_access" id="dashboard_view_page" name="permissions[dashboard][]" value="view_page"> <span class="mb-0" for="dashboard_view_page"> View Page </span> </div> </td> </tr> <!-- DASHBOARD PAGE --> <tr> <th class="text-center" colspan="2" scope="colgroup">DATA MANAGEMENT</th> </tr> <!-- IMPORT PAGE --> <tr> <td>Import</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="import_permission" value="import_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['import_permission']['import_view_page'])){ echo ($hasAccessArray['import_permission']['import_view_page'])? 'checked' : '' ; } ?> class="import_access" id="import_view_page" name="permissions[import][]" value="view_page"> <span class="mb-0" for="import_view_page"> View Page </span> </div> </td> </tr> <!-- IMPORT PAGE --> <!-- CUSTOMER PAGE --> <tr> <td>Customer</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="customer_permission" value="customer_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['customer_permission']['customer_view_page'])){ echo ($hasAccessArray['customer_permission']['customer_view_page'])? 'checked' : '' ; } ?> class="customer_access" id="customer_view_page" name="permissions[customer][]" value="view_page"> <span class="mb-0" for="customer_view_page"> View Page </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['customer_permission']['customer_create'])){ echo ($hasAccessArray['customer_permission']['customer_create'])? 'checked' : '' ; } ?> class="customer_access" id="customer_create" name="permissions[customer][]" value="create"> <span class="mb-0" for="customer_create"> Create </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['customer_permission']['customer_edit'])){ echo ($hasAccessArray['customer_permission']['customer_edit'])? 'checked' : '' ; } ?> class="customer_access" id="customer_edit" name="permissions[customer][]" value="edit"> <span class="mb-0" for="customer_edit"> Edit </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['customer_permission']['customer_force_edit'])){ echo ($hasAccessArray['customer_permission']['customer_force_edit'])? 'checked' : '' ; } ?> class="customer_access" id="customer_force_edit" name="permissions[customer][]" value="force_edit"> <span class="mb-0" for="customer_force_edit"> Force Create/Edit Duplicate mobile & email </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['customer_permission']['customer_delete'])){ echo ($hasAccessArray['customer_permission']['customer_delete'])? 'checked' : '' ; } ?> class="customer_access" id="customer_delete" name="permissions[customer][]" value="delete"> <span class="mb-0" for="customer_delete"> Delete </span> </div> </td> </tr> <!-- CUSTOMER PAGE --> <!-- VEHICLE PAGE --> <tr> <td>Vehicle</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="vehicle_permission" value="vehicle_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['vehicle_permission']['vehicle_view_page'])){ echo ($hasAccessArray['vehicle_permission']['vehicle_view_page'])? 'checked' : '' ; } ?> class="vehicle_access" id="vehicle_view_page" name="permissions[vehicle][]" value="view_page"> <span class="mb-0" for="vehicle_view_page"> View Page </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['vehicle_permission']['vehicle_create'])){ echo ($hasAccessArray['vehicle_permission']['vehicle_create'])? 'checked' : '' ; } ?> class="vehicle_access" id="vehicle_create" name="permissions[vehicle][]" value="create"> <span class="mb-0" for="vehicle_create"> Create </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['vehicle_permission']['vehicle_edit'])){ echo ($hasAccessArray['vehicle_permission']['vehicle_edit'])? 'checked' : '' ; } ?> class="vehicle_access" id="vehicle_edit" name="permissions[vehicle][]" value="edit"> <span class="mb-0" for="vehicle_edit"> Edit </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['vehicle_permission']['vehicle_delete'])){ echo ($hasAccessArray['vehicle_permission']['vehicle_delete'])? 'checked' : '' ; } ?> class="vehicle_access" id="vehicle_delete" name="permissions[vehicle][]" value="delete"> <span class="mb-0" for="vehicle_delete"> Delete </span> </div> </td> </tr> <!-- VEHICLE PAGE --> <!-- SERVICE PAGE --> <tr> <td>Service</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="service_permission" value="service_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['service_permission']['service_view_page'])){ echo ($hasAccessArray['service_permission']['service_view_page'])? 'checked' : '' ; } ?> class="service_access" id="service_view_page" name="permissions[service][]" value="view_page"> <span class="mb-0" for="service_view_page"> View Page </span> </div> <div class="checkbox"> <input nodetype="parent" type="text" id="sub_2" value="sub_2" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_2']['sub_2_1'])){ echo ($hasAccessArray['sub_2']['sub_2_1'])? 'checked' : '' ; } ?> id="sub_2_1" value=""> <span class="mb-0" for="sub_2_1"> Create </span> </div> <div class="checkbox"> <input nodetype="child" type="text" id="sub_2" value="sub_2" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_2']['sub_2_2'])){ echo ($hasAccessArray['sub_2']['sub_2_2'])? 'checked' : '' ; } ?> id="sub_2_2" value=""> <span class="mb-0" for="sub_2_2"> Edit </span> </div> </td> </tr> <!-- SERVICE PAGE --> <!-- SALES PAGE --> <tr> <td>Sales</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="sales_permission" value="sales_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sales_permission']['sales_view_page'])){ echo ($hasAccessArray['sales_permission']['sales_view_page'])? 'checked' : '' ; } ?> class="sales_access" id="sales_view_page" name="permissions[sales][]" value="view_page"> <span class="mb-0" for="sales_view_page"> View Page </span> </div> </td> </tr> <!-- SALRES PAGE --> <tr> <td>Finance</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="2" value="2" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['2']['sub_42_1'])){ echo ($hasAccessArray['2']['sub_42_1'])? 'checked' : '' ; } ?> id="sub_42_1" value="view_page"> <span class="mb-0" for="sub_42_1"> View Page </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['2']['sub_42_2'])){ echo ($hasAccessArray['2']['sub_42_2'])? 'checked' : '' ; } ?> id="sub_42_2" value=""> <span class="mb-0" for="sub_42_2">Create</span> </div> </td> </tr> <tr> <td>Bank Database</td> <td> <div class="checkbox"> <!-- <input nodetype="parent" type="text" id="2" value="2" hidden> --> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['2']['sub_49_1'])){ echo ($hasAccessArray['2']['sub_49_1'])? 'checked' : '' ; } ?> id="sub_49_1" value="view_page"> <span class="mb-0" for="sub_49_1"> View Page </span> </div> </td> </tr> <tr> <td>Car Club Database</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="sub_52" value="sub_52" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_52']['sub_52_1'])){ echo ($hasAccessArray['sub_52']['sub_52_1'])? 'checked' : '' ; } ?> id="sub_52_1" value=""> <span class="mb-0" for="sub_52_1"> View Page </span> </div> <!-- <div class="checkbox"> <input nodetype="child" type="checkbox" <?php // if(isset($hasAccessArray['sub_52']['sub_52_5'])){ // echo ($hasAccessArray['sub_52']['sub_52_5'])? 'checked' : '' ; // } ?> id="sub_52_5" value=""> <span class="mb-0" for="sub_52_5"> Can Hold Commission </span> </div> --> </td> </tr> <tr> <th class="text-center" colspan="2" scope="colgroup">DATABASE COMPLIANCE</th> </tr> <!-- SC COMPLIANCE PAGE --> <tr> <td>Executive Report</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="sub_33" value="sub_33" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_33']['sub_33_1'])){ echo ($hasAccessArray['sub_33']['sub_33_1'])? 'checked' : '' ; } ?> id="sub_33_1" value=""> <span class="mb-0" for="sub_33_1"> View Page </span> </div> </td> </tr> <!-- SC COMPLIANCE PAGE --> <!-- SC COMPLIANCE PAGE --> <tr> <td>SC Compliance</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="sub_34" value="sub_34" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_34']['sub_34_1'])){ echo ($hasAccessArray['sub_34']['sub_34_1'])? 'checked' : '' ; } ?> id="sub_34_1" value=""> <span class="mb-0" for="sub_34_1"> View Page </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_34']['sub_34_5'])){ echo ($hasAccessArray['sub_34']['sub_34_5'])? 'checked' : '' ; } ?> id="sub_34_5" value=""> <span class="mb-0" for="sub_34_5"> Can Hold Commission </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_34']['sub_34_6'])){ echo ($hasAccessArray['sub_34']['sub_34_6'])? 'checked' : '' ; } ?> id="sub_34_6" value=""> <span class="mb-0" for="sub_34_6"> Can For Release Commission </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_34']['sub_34_7'])){ echo ($hasAccessArray['sub_34']['sub_34_7'])? 'checked' : '' ; } ?> id="sub_34_7" value=""> <span class="mb-0" for="sub_34_7"> Can Released Commission </span> </div> </td> </tr> <tr> <td>Compliance Status</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="sub_36" value="sub_36" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['sub_36']['sub_36_1'])){ echo ($hasAccessArray['sub_36']['sub_36_1'])? 'checked' : '' ; } ?> id="sub_36_1" value=""> <span class="mb-0" for="sub_36_1"> View Page </span> </div> </td> </tr> <!-- SC COMPLIANCE PAGE --> <tr> <th class="text-center" colspan="2" scope="colgroup">EMPLOYEES</th> </tr> <!-- SETTINGS PAGE --> <tr> <td>Employees</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="employee_permission" value="employee_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['employee_permission']['employee_view_page'])){ echo ($hasAccessArray['employee_permission']['employee_view_page'])? 'checked' : '' ; } ?> class="employee_access" id="employee_view_page" name="permissions[employee][]" value="view_page"> <span class="mb-0" for="employee_view_page"> View Page </span> </div> </td> </tr> <!-- SETTINGS PAGE --> <tr> <th class="text-center" colspan="2" scope="colgroup">SMS SERVICE</th> </tr> <!-- SC COMPLIANCE PAGE --> <tr> <td>Automated Services</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="6" value="6" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['6']['sub_29_1'])){ echo ($hasAccessArray['6']['sub_29_1'])? 'checked' : '' ; } ?> id="sub_29_1" value=""> <span class="mb-0" for="sub_29_1">View Page </span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['6']['sub_29_2'])){ echo ($hasAccessArray['6']['sub_29_2'])? 'checked' : '' ; } ?> id="sub_29_2" value=""> <span class="mb-0" for="sub_29_2">Mobile view unmasking </span> </div> </td> </tr> <tr> <td>Text Blast</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['6']['sub_30_1'])){ echo ($hasAccessArray['6']['sub_30_1'])? 'checked' : '' ; } ?> id="sub_30_1" value=""> <span class="mb-0" for="sub_30_1"> View Page </span> </div> </td> </tr> <tr> <td>For Approval (SMS Service)</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['6']['sub_37_1'])){ echo ($hasAccessArray['6']['sub_37_1'])? 'checked' : '' ; } ?> id="sub_37_1" value=""> <span class="mb-0" for="sub_37_1"> View Page </span> </div> </td> </tr> <!-- <tr> <td>On Going (SMS Service)</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php // if(isset($hasAccessArray['6']['sub_35_1'])){ // echo ($hasAccessArray['6']['sub_35_1'])? 'checked' : '' ; // } ?> id="sub_35_1" value=""> <span class="mb-0" for="sub_35_1"> View Page </span> </div> </td> </tr> --> <!-- SC COMPLIANCE PAGE --> <tr> <th class="text-center" colspan="2" scope="colgroup">REPORTS</th> </tr> <!-- REPORTS PAGE --> <tr> <td>Reports</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="reports_permission" value="reports_permission" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['reports_permission']['reports_create'])){ echo ($hasAccessArray['reports_permission']['reports_create'])? 'checked' : '' ; } ?> class="reports_access" id="reports_create" name="permissions[reports][]" value="create"> <span class="mb-0" for="reports_create"> Data Report Create </span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['reports_permission']['reports_approve'])){ echo ($hasAccessArray['reports_permission']['reports_approve'])? 'checked' : '' ; } ?> class="reports_access" id="reports_approve" name="permissions[reports][]" value="approve"> <span class="mb-0" for="reports_approve"> Data Report Approve </span> </div> <!-- <div class="checkbox"> <input nodetype="child" type="checkbox" <?php // if(isset($hasAccessArray['reports_permission']['sub_41_1'])){ // echo ($hasAccessArray['reports_permission']['sub_41_1'])? 'checked' : '' ; // } ?> class="reports_access" id="sub_41_1" name="permissions[reports][]" value="approve"> <span class="mb-0" for="sub_41_1"> Future Vehicles </span> </div> --> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['reports_permission']['sub_44_1'])){ echo ($hasAccessArray['reports_permission']['sub_44_1'])? 'checked' : '' ; } ?> class="reports_access" id="sub_44_1" name="permissions[reports][]" value="approve"> <span class="mb-0" for="sub_44_1"> Car Clubs </span> </div> <!-- <input nodetype="parent" type="text" id="5" value="5" hidden> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php // if(isset($hasAccessArray['5']['sub_41_1'])){ // echo ($hasAccessArray['5']['sub_41_1'])? 'checked' : '' ; // } ?> class="reports_access" id="sub_41_1" name="permissions[reports][]" value="approve"> <span class="mb-0" for="sub_41_1"> Future Vehicles </span> </div> --> <div class="checkbox"> <input nodetype="parent" type="text" id="5" value="5" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_41_1'])){ echo ($hasAccessArray['5']['sub_41_1'])? 'checked' : '' ; } ?> id="sub_41_1" value=""> <span class="mb-0" for="sub_41_1"> Future Vehicle </span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_41_2'])){ echo ($hasAccessArray['5']['sub_41_2'])? 'checked' : '' ; } ?> id="sub_41_2" value=""> <span class="mb-0" for="sub_41_2"> Future Vehicle (Generate Report)</span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_41_3'])){ echo ($hasAccessArray['5']['sub_41_3'])? 'checked' : '' ; } ?> id="sub_41_3" value=""> <span class="mb-0" for="sub_41_3"> Future Vehicle (Show/Hide Contact Info)</span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_41_4'])){ echo ($hasAccessArray['5']['sub_41_4'])? 'checked' : '' ; } ?> id="sub_41_4" value=""> <span class="mb-0" for="sub_41_4"> Future Vehicle (Groups Filter)</span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_41_5'])){ echo ($hasAccessArray['5']['sub_41_5'])? 'checked' : '' ; } ?> id="sub_41_5" value=""> <span class="mb-0" for="sub_41_5"> Future Vehicle (View Others Tagging)</span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_1'])){ echo ($hasAccessArray['5']['sub_38_1'])? 'checked' : '' ; } ?> id="sub_38_1" value=""> <span class="mb-0" for="sub_38_1"> SMS Reports </span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_2'])){ echo ($hasAccessArray['5']['sub_38_2'])? 'checked' : '' ; } ?> id="sub_38_2" value=""> <span class="mb-0" for="sub_38_2">BG generate report</span> </div> <div class="checkbox pl-4"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_3'])){ echo ($hasAccessArray['5']['sub_38_3'])? 'checked' : '' ; } ?> id="sub_38_3" value=""> <span class="mb-0" for="sub_38_3">BG mobile unmasking</span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_4'])){ echo ($hasAccessArray['5']['sub_38_4'])? 'checked' : '' ; } ?> id="sub_38_4" value=""> <span class="mb-0" for="sub_38_4">Insurance generate report</span> </div> <div class="checkbox pl-4"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_5'])){ echo ($hasAccessArray['5']['sub_38_5'])? 'checked' : '' ; } ?> id="sub_38_5" value=""> <span class="mb-0" for="sub_38_5">Insurance mobile unmasking</span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_6'])){ echo ($hasAccessArray['5']['sub_38_6'])? 'checked' : '' ; } ?> id="sub_38_6" value=""> <span class="mb-0" for="sub_38_6">TY generate report</span> </div> <div class="checkbox pl-4"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_38_7'])){ echo ($hasAccessArray['5']['sub_38_7'])? 'checked' : '' ; } ?> id="sub_38_7" value=""> <span class="mb-0" for="sub_38_7">TY mobile unmasking</span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_45_1'])){ echo ($hasAccessArray['5']['sub_45_1'])? 'checked' : '' ; } ?> id="sub_45_1" value=""> <span class="mb-0" for="sub_45_1"> Subscription </span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_45_2'])){ echo ($hasAccessArray['5']['sub_45_2'])? 'checked' : '' ; } ?> id="sub_45_2" value=""> <span class="mb-0" for="sub_45_2">Subscription generate report</span> </div> <div class="checkbox pl-4"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_45_3'])){ echo ($hasAccessArray['5']['sub_45_3'])? 'checked' : '' ; } ?> id="sub_45_3" value=""> <span class="mb-0" for="sub_45_3">Subscription contact unmasking</span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_46_1'])){ echo ($hasAccessArray['5']['sub_46_1'])? 'checked' : '' ; } ?> id="sub_46_1" value=""> <span class="mb-0" for="sub_46_1"> FNI Report </span> </div> <div class="checkbox pl-2"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_46_3'])){ echo ($hasAccessArray['5']['sub_46_3'])? 'checked' : '' ; } ?> id="sub_46_3" value=""> <span class="mb-0" for="sub_46_3">FNI Report (Generate pdf report)</span> </div> <div class="checkbox pl-4"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_46_2'])){ echo ($hasAccessArray['5']['sub_46_2'])? 'checked' : '' ; } ?> id="sub_46_2" value=""> <span class="mb-0" for="sub_46_2">FNI Report (Generate email and mobile)</span> </div> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['5']['sub_51_1'])){ echo ($hasAccessArray['5']['sub_51_1'])? 'checked' : '' ; } ?> id="sub_51_1" value=""> <span class="mb-0" for="sub_51_1"> Bank Report </span> </div> </td> </tr> <tr> <th class="text-center" colspan="2" scope="colgroup">CONFIGURATIONS</th> </tr> <!-- SETTINGS PAGE --> <tr> <td>Website</td> <td> <div class="checkbox"> <input nodetype="parent" type="text" id="4" value="4" hidden> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_7_1'])){ echo ($hasAccessArray['4']['sub_7_1'])? 'checked' : '' ; } ?> id="sub_7_1" value=""> <span class="mb-0" for="sub_7_1"> View Page </span> </div> </td> </tr> <tr> <td>Roles</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_6_1'])){ echo ($hasAccessArray['4']['sub_6_1'])? 'checked' : '' ; } ?> id="sub_6_1" value=""> <span class="mb-0" for="sub_6_1"> View Page </span> </div> </td> </tr> <tr> <td>Email</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_9_1'])){ echo ($hasAccessArray['4']['sub_9_1'])? 'checked' : '' ; } ?> id="sub_9_1" value=""> <span class="mb-0" for="sub_9_1"> View Page </span> </div> </td> </tr> <tr> <td>SMS API Setup</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_8_1'])){ echo ($hasAccessArray['4']['sub_8_1'])? 'checked' : '' ; } ?> id="sub_8_1" value=""> <span class="mb-0" for="sub_8_1"> View Page </span> </div> </td> </tr> <tr> <td>SMS Services</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_28_1'])){ echo ($hasAccessArray['4']['sub_28_1'])? 'checked' : '' ; } ?> id="sub_28_1" value=""> <span class="mb-0" for="sub_28_1"> View Page </span> </div> </td> </tr> <tr> <td>Report Approver</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_17_1'])){ echo ($hasAccessArray['4']['sub_17_1'])? 'checked' : '' ; } ?> id="sub_17_1" value=""> <span class="mb-0" for="sub_17_1"> View Page </span> </div> </td> </tr> <tr> <td>SMS Approval</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_32_1'])){ echo ($hasAccessArray['4']['sub_32_1'])? 'checked' : '' ; } ?> id="sub_32_1" value=""> <span class="mb-0" for="sub_32_1"> View Page </span> </div> </td> </tr> <tr> <td>DMS Fields</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_18_1'])){ echo ($hasAccessArray['4']['sub_18_1'])? 'checked' : '' ; } ?> id="sub_18_1" value=""> <span class="mb-0" for="sub_18_1"> View Page </span> </div> </td> </tr> <tr> <td>DMS Fields (New)</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_27_1'])){ echo ($hasAccessArray['4']['sub_27_1'])? 'checked' : '' ; } ?> id="sub_27_1" value=""> <span class="mb-0" for="sub_27_1"> View Page </span> </div> </td> </tr> <tr> <td>DMS Settings</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_24_1'])){ echo ($hasAccessArray['4']['sub_24_1'])? 'checked' : '' ; } ?> id="sub_24_1" value=""> <span class="mb-0" for="sub_24_1"> View Page </span> </div> </td> </tr> <tr> <td>Company & Dealer</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_19_1'])){ echo ($hasAccessArray['4']['sub_19_1'])? 'checked' : '' ; } ?> id="sub_19_1" value=""> <span class="mb-0" for="sub_19_1"> View Page </span> </div> </td> </tr> <tr> <td>Department / Position</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_21_1'])){ echo ($hasAccessArray['4']['sub_21_1'])? 'checked' : '' ; } ?> id="sub_21_1" value=""> <span class="mb-0" for="sub_21_1"> View Page </span> </div> </td> </tr> <tr> <td>Brand & Model</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_22_1'])){ echo ($hasAccessArray['4']['sub_22_1'])? 'checked' : '' ; } ?> id="sub_22_1" value=""> <span class="mb-0" for="sub_22_1"> View Page </span> </div> </td> </tr> <tr> <td>Affiliation Category</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_23_1'])){ echo ($hasAccessArray['4']['sub_23_1'])? 'checked' : '' ; } ?> id="sub_23_1" value=""> <span class="mb-0" for="sub_23_1"> View Page </span> </div> </td> </tr> <tr> <td>Nature of Business</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_25_1'])){ echo ($hasAccessArray['4']['sub_25_1'])? 'checked' : '' ; } ?> id="sub_25_1" value=""> <span class="mb-0" for="sub_25_1"> View Page </span> </div> </td> </tr> <tr> <td>Sales Group</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_26_1'])){ echo ($hasAccessArray['4']['sub_26_1'])? 'checked' : '' ; } ?> id="sub_26_1" value=""> <span class="mb-0" for="sub_26_1"> View Page </span> </div> </td> </tr> <tr> <td>System Settings</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_48_1'])){ echo ($hasAccessArray['4']['sub_48_1'])? 'checked' : '' ; } ?> id="sub_48_1" value=""> <span class="mb-0" for="sub_48_1"> View Page </span> </div> </td> </tr> <tr> <td>FNI Settings</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_47_1'])){ echo ($hasAccessArray['4']['sub_47_1'])? 'checked' : '' ; } ?> id="sub_47_1" value=""> <span class="mb-0" for="sub_47_1"> View Page </span> </div> </td> </tr> <tr> <td>Bank Settings</td> <td> <div class="checkbox"> <input nodetype="child" type="checkbox" <?php if(isset($hasAccessArray['4']['sub_50_1'])){ echo ($hasAccessArray['4']['sub_50_1'])? 'checked' : '' ; } ?> id="sub_50_1" value=""> <span class="mb-0" for="sub_50_1"> View Page </span> </div> </td> </tr> <!-- SETTINGS PAGE --> <!-- REPORTS PAGE --> </tbody> </table> </div> <!--employee-list--> <div class="col-12"> <!-- <span onclick="back()" href="#" class="btn btn-secondary">Back</span> --> <input type="submit" name="submit" id="submit" value="Save" class="btn btn-success float-right"> </div> </div><!-- /.card-body --> </div> </div><!-- /.col-md --> </div><!-- /.row --> </div><!-- /.container-fluid --> </section> <!-- /.content --> <!-- /.content-wrapper --> <!-- INSERT FOOTER --> </div><!-- ./cointent-wrapper --> <?php include('include/footer.php'); ?> <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Control sidebar content goes here --> </aside> <!-- /.control-sidebar --> </div><!-- ./wrapper --> <!-- jQuery --> <script src="plugins/jquery/jquery.min.js"></script> <!-- overlayScrollbars --> <script src="plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script> <!-- Bootstrap 4 --> <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- bs-custom-file-input --> <script src="plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script> <!-- AdminLTE App --> <script src="dist/js/adminlte.min.js"></script> <!-- Toastr --> <script src="plugins/toastr/toastr.min.js"></script> <!-- Navigation Highlight --> <script src="dist/js/main.js"></script> <script> $("#submit").click(function() { console.log(getAllData()); if (isEmpty($('#role').val())) { $('#role').focus(); // sweetAlertSimple('error', 'Oops...', 'Firstname can\'t be left blank') toastr.error('Role name can\'t be left blank') return; } return false; roleActionAccess(); }); function roleActionAccess() { var new_role_name = $('#role').val().trim(); // alert(getAllData()); $.ajax({ url: "api/role/role.php", method: "GET", dataType: 'json', data: { apiKey: '9808804351241327', name: new_role_name, role_id: <?php echo $role_id; ?>, role_access: getAllData() }, beforeSend: function() { toastr.remove(); toastr.info('Updating access role...') $('#submit').attr('disabled', true); }, success: function(result) { if (parseInt(result.status) === 1) { // sweetAlertSimple('success', 'Nice...', result.message); toastr.success(result.message) } else if (parseInt(result.status) === 0) { // sweetAlertSimple('error', 'Oops...', result.message); toastr.error(result.message) } $('#submit').attr('disabled', false); }, error: handleError }); } function handleError(xhr, status, error) { //hide loader // sweetAlertSimple('error', 'Oops...', 'Error has occurred, Try again...'); toastr.error('Error has occurred, Try again...') $('#submit').attr('disabled', false); // $('.customer-modal-overlay').hide(); } function getAllData() { var /* Create an object. */ obj = {}, /* Create a variable that references the current object (default → obj). */ ref = obj; /* Iterate over every input. */ $("#role-table :input").each(function() { /* Cache the id of the input. */ var id = this.id; /* Check whether the nodetype attribute is set to 'parent'. */ if (this.getAttribute("nodetype") == "parent") { /* Set a new object to the property and set ref to refer to it. */ ref = obj[id] = {}; } else { /* Set the value of the input to the referred object. */ if (this.getAttribute("nodetype") == "child") { // ref[id] = $(this).val(); ref[id] = $(this).is(':checked') } } }); /* Stringify the object and return it. */ return JSON.stringify(obj); } function isEmpty(string) { var flag = false; if (string == '') { flag = true; } else if (string == null) { flag = true; } else { if (string.trim() == '') { flag = true; } } return flag; } // $('input[type=checkbox]').change( // function() { // if (isEmpty($('#role').val())) { // $('#role').focus(); // // sweetAlertSimple('error', 'Oops...', 'Firstname can\'t be left blank') // toastr.error('Role name can\'t be left blank') // return; // } // roleActionAccess(); // }); function back() { window.history.back(); } $('#sub_46_1').on('click', function() { // fni report if (!$('#sub_46_1').is(':checked')) { if ($('#sub_46_2').is(':checked')) { $('#sub_46_2').prop('checked', false); } if ($('#sub_46_3').is(':checked')) { $('#sub_46_3').prop('checked', false); } } }) $('#sub_46_2').on('click', function() { // fni email and mobile if ($('#sub_46_2').is(':checked')) { $('#sub_46_3').prop('checked', true); } if (!$('#sub_46_1').is(':checked')) { $('#sub_46_1').prop('checked', true); } }) $('#sub_46_3').on('click', function() { // fni generate report if ($('#sub_46_2').is(':checked')) { $('#sub_46_2').prop('checked', false); } }) $('#sub_38_1').on('click', function() { // sms report if (!$('#sub_38_1').is(':checked')) { if ($('#sub_38_2').is(':checked')) { $('#sub_38_2').prop('checked', false); } if ($('#sub_38_3').is(':checked')) { $('#sub_38_3').prop('checked', false); } if ($('#sub_38_4').is(':checked')) { $('#sub_38_4').prop('checked', false); } if ($('#sub_38_5').is(':checked')) { $('#sub_38_5').prop('checked', false); } if ($('#sub_38_6').is(':checked')) { $('#sub_38_6').prop('checked', false); } if ($('#sub_38_7').is(':checked')) { $('#sub_38_7').prop('checked', false); } } }) $('#sub_38_2').on('click', function() { // bg generate report if ($('#sub_38_3').is(':checked')) { $('#sub_38_3').prop('checked', false); } if (!$('#sub_38_1').is(':checked')) { $('#sub_38_1').prop('checked', true); } }) $('#sub_38_3').on('click', function() { // bg mobile unmasking if ($('#sub_38_3').is(':checked')) { if (!$('#sub_38_2').is(':checked')) { $('#sub_38_2').prop('checked', true); } if (!$('#sub_38_1').is(':checked')) { $('#sub_38_1').prop('checked', true); } } }) $('#sub_38_4').on('click', function() { // ins generate report if ($('#sub_38_5').is(':checked')) { $('#sub_38_5').prop('checked', false); } if (!$('#sub_38_1').is(':checked')) { $('#sub_38_1').prop('checked', true); } }) $('#sub_38_5').on('click', function() { // ins mobile unmasking if ($('#sub_38_5').is(':checked')) { if (!$('#sub_38_4').is(':checked')) { $('#sub_38_4').prop('checked', true); } if (!$('#sub_38_1').is(':checked')) { $('#sub_38_1').prop('checked', true); } } }) $('#sub_38_6').on('click', function() { // ty generate report if ($('#sub_38_7').is(':checked')) { $('#sub_38_7').prop('checked', false); } if (!$('#sub_38_1').is(':checked')) { $('#sub_38_1').prop('checked', true); } }) $('#sub_38_7').on('click', function() { // ty mobile unmasking if ($('#sub_38_7').is(':checked')) { if (!$('#sub_38_6').is(':checked')) { $('#sub_38_6').prop('checked', true); } if (!$('#sub_38_1').is(':checked')) { $('#sub_38_1').prop('checked', true); } } }) $('#sub_45_1').on('click', function() { // subscription report if (!$('#sub_45_1').is(':checked')) { if ($('#sub_45_2').is(':checked')) { $('#sub_45_2').prop('checked', false); } if ($('#sub_45_3').is(':checked')) { $('#sub_45_3').prop('checked', false); } } }) $('#sub_45_2').on('click', function() { // subscription generate report if (!$('#sub_45_1').is(':checked')) { $('#sub_45_1').prop('checked', true); } if ($('#sub_45_3').is(':checked')) { $('#sub_45_3').prop('checked', false); } }) $('#sub_45_3').on('click', function() { // subscription contact unmasking if ($('#sub_45_3').is(':checked')) { if (!$('#sub_45_2').is(':checked')) { $('#sub_45_2').prop('checked', true); } if (!$('#sub_45_1').is(':checked')) { $('#sub_45_1').prop('checked', true); } } }) </script> <!-- Page specific script --> </body> </html>