Plugin Directory

Changeset 3100924


Ignore:
Timestamp:
06/11/2024 06:38:10 AM (22 months ago)
Author:
outgrow
Message:

adding ecom type and invalid alert

Location:
outgrow/trunk/dashboard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • outgrow/trunk/dashboard/css/main-style.css

    r3062077 r3100924  
    362362  justify-content: center;
    363363}
    364 #calculator-list,#Calculator-list, #Assessment-list, #Recommendation-list, #Quiz-list, #Chatbot-list, #Giveaway-list, #Survey-list, #Form-list ,#Poll-list{
     364#calculator-list,#Calculator-list, #Assessment-list, #eCom-list, #Quiz-list, #Chatbot-list, #Giveaway-list, #Survey-list, #Form-list ,#Poll-list{
    365365  display: flex;
    366366  flex-wrap: wrap;
  • outgrow/trunk/dashboard/main-page.php

    r3062077 r3100924  
    1313    wp_enqueue_style('custom-styles', plugins_url('/css/main-style.css', __FILE__));
    1414   }
     15   function api_Warning($message) {
     16      // You can handle the warning message here, for example, logging it or displaying it on the page
     17      echo "API Warning: " . $message;
     18  }
    1519   add_action('wp_enqueue_scripts', 'enqueue_custom_styles');
    1620   // $is_login = is_user_looged_in() ? 1: 0;
     
    2125       // Get the API key from the form
    2226       $apiKey = sanitize_text_field($_POST['api-key']);
    23    
    2427       // API request
    2528       $headers = array(
     
    3134           );
    3235       // Live API request
    33        $request = Requests::get('https://api-calc.outgrow.co/api/v1/calculator?status=Live&type=All&sort=alpha_as', $headers, $options);
    34    
     36       $request = Requests::get('https://api-calc.outgrow.co/api/v1/calculator?status=Live&type=All&sort=alpha_as', $headers, $options); 
     37
    3538       // Process the API response as needed
     39       if (isset($request)) {
     40         echo "<script>alert('You do not have required permissions. Please contact Outgrow Support.'); window.location.reload();</script>";
     41           }
     42      else{
    3643       $res = json_decode($request->body);
    3744       $meta = $res->data;
    38    
    3945       // Count the number of elements in $meta
    4046       $calci_count = count($meta);   
     
    4248        if (isset($res->data)) {
    4349           $meta = $res->data;
    44    
    4550           // Count the number of elements in $meta
    4651           $calci_count = count($meta);   
    47    
    4852       } else {
    4953           $calci_count = 0;
     
    8387       } else {
    8488           // api_Warning("No API Found - Please add your API to view Calculators.");
    85            api_Warning("INVALID API");
    86        }} catch (Requests_Exception $e) {
     89           api_Warning("You do not have required permissions. Please contact Outgrow Support.");
     90       }}} catch (Requests_Exception $e) {
    8791           // Handle cURL timeout exception
    8892           echo "Warning: Invalid API - cURL request timed out.";
     
    167171               Assessments
    168172            </a>
    169             <a href="#" class="" onclick="showContent('Recommendation')">
     173            <a href="#" class="" onclick="showContent('eCom')">
    170174               <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
    171175                  <path d="M13.2493 2.37825C13.0852 2.18134 12.8797 2.02297 12.6476 1.91439C12.4154 1.80581 12.1621 1.74969 11.9058 1.75H2.4745L2.45 1.54525C2.39986 1.11966 2.19531 0.727261 1.87512 0.442445C1.55493 0.15763 1.14137 0.00019938 0.712833 0L0.583333 0C0.428624 0 0.280251 0.0614582 0.170854 0.170854C0.0614582 0.280251 0 0.428624 0 0.583333C0 0.738043 0.0614582 0.886416 0.170854 0.995812C0.280251 1.10521 0.428624 1.16667 0.583333 1.16667H0.712833C0.855711 1.16669 0.993613 1.21914 1.10038 1.31408C1.20715 1.40903 1.27537 1.53985 1.29208 1.68175L2.09475 8.50675C2.17808 9.21654 2.51911 9.87104 3.05311 10.346C3.58711 10.821 4.27692 11.0833 4.99158 11.0833H11.0833C11.238 11.0833 11.3864 11.0219 11.4958 10.9125C11.6052 10.8031 11.6667 10.6547 11.6667 10.5C11.6667 10.3453 11.6052 10.1969 11.4958 10.0875C11.3864 9.97812 11.238 9.91667 11.0833 9.91667H4.99158C4.63053 9.91565 4.27863 9.80299 3.98413 9.59412C3.68962 9.38525 3.46693 9.0904 3.34658 8.75H10.2999C10.9838 8.75004 11.6459 8.5098 12.1706 8.07126C12.6953 7.63271 13.0492 7.02374 13.1705 6.35075L13.6284 3.81092C13.6741 3.55892 13.6639 3.29996 13.5983 3.05237C13.5328 2.80479 13.4136 2.57465 13.2493 2.37825ZM12.4833 3.60383L12.0248 6.14367C11.952 6.54792 11.7393 6.91366 11.4239 7.17687C11.1086 7.44007 10.7107 7.58396 10.2999 7.58333H3.16108L2.61217 2.91667H11.9058C11.9915 2.91616 12.0763 2.93453 12.1541 2.97048C12.2318 3.00644 12.3008 3.05909 12.3559 3.12469C12.411 3.19029 12.451 3.26723 12.4731 3.35005C12.4951 3.43286 12.4986 3.51951 12.4833 3.60383Z" />
     
    231235            </div>
    232236         </div>
    233          <div id="Recommendation" class="hidden">
     237         <div id="eCom" class="hidden">
    234238            <h2 style=" margin-left: 12%;">Recommendations</h2>
    235239            <div class="outer-list">
    236                <div id="Recommendation-list">
     240               <div id="eCom-list">
    237241               </div>
    238242            </div>
Note: See TracChangeset for help on using the changeset viewer.