Plugin Directory

Changeset 3397765


Ignore:
Timestamp:
11/18/2025 06:10:37 AM (8 weeks ago)
Author:
aarsiv
Message:

New Version UI release

Location:
a2z-fedex-shipping
Files:
63 added
3 edited

Legend:

Unmodified
Added
Removed
  • a2z-fedex-shipping/trunk/a2zfedex_basic.php

    r3351656 r3397765  
    44 * Plugin URI: https://myshipi.com/
    55 * Description: Realtime Shipping Rates, shipping labels.
    6  * Version: 5.0.10
     6 * Version: 5.1.0
    77 * Author: Shipi
    88 * Author URI: https://myshipi.com/
     
    31203120                if ($this->hpos_enabled) {
    31213121                    $hpos_prod_data = wc_get_product($product_data['product_id']);
    3122                     $saved_cc = $hpos_prod_data->get_meta("hits_fedex_cc");
    3123                     $saved_desc = $hpos_prod_data->get_meta("hits_fedex_label_dec");
     3122                    $saved_cc = $hpos_prod_data ? $hpos_prod_data->get_meta("hits_fedex_cc") : '';
     3123                    $saved_desc = $hpos_prod_data ? $hpos_prod_data->get_meta("hits_fedex_label_dec") : '';
    31243124                } else {
    31253125                    $saved_cc = get_post_meta( $product_data['product_id'], 'hits_fedex_cc', true);
  • a2z-fedex-shipping/trunk/controllors/views/hitshippo_fedex_settings_view.php

    r3348466 r3397765  
    33    exit; // Exit if accessed directly.
    44}
     5wp_enqueue_style( 'a2z-select2-css', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css' );
     6wp_enqueue_script( 'a2z-select2-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js', array( 'jquery' ) );
    57wp_enqueue_script("jquery");
    68$error = $success =  '';
     
    356358$general_settings = get_option('hitshippo_fedex_main_settings');
    357359$general_settings = empty($general_settings) ? array() : $general_settings;
     360if (!isset($general_settings['hitshippo_fedex_carrier'])) {
     361    $general_settings['hitshippo_fedex_carrier'] = array(
     362        'PRIORITY_OVERNIGHT'                 => 'yes',
     363        'FEDEX_GROUND'                       => 'yes',
     364        'STANDARD_OVERNIGHT'                 => 'yes',
     365        'INTERNATIONAL_ECONOMY'              => 'yes',
     366        'INTERNATIONAL_GROUND'               => 'yes',
     367        'INTERNATIONAL_PRIORITY'             => 'yes',
     368    );
     369}
    358370$boxes = array(array(
    359371    'name'       => 'Sample BOX',
     
    589601    }
    590602
    591     #multistepsform {
    592         width: 80%;
    593         margin: 50px auto;
     603    body {
     604        background-color: #f5f5f5;
     605    }
     606
     607    .onboarding-container {
     608        max-width: 1200px;
     609        margin: 30px auto;
     610        padding: 20px;
     611        background-color: #f5f5f5;
     612    }
     613
     614    .onboarding-header {
    594615        text-align: center;
    595         position: relative;
    596     }
    597 
    598     #multistepsform fieldset {
    599         background: white;
    600         text-align: left;
    601         border: 0 none;
    602         border-radius: 5px;
    603         <?php if (!$initial_setup) { ?>
    604         box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
    605         <?php } ?>
    606         padding: 20px 30px;
    607         box-sizing: border-box;
    608         position: relative;
    609     }
    610 
    611     <?php if (!$initial_setup) { ?>
    612     #multistepsform fieldset:not(:first-of-type) {
    613         display: none;
    614     }
    615     <?php } ?>
    616 
    617     #multistepsform input[type=text],
    618     #multistepsform input[type=password],
    619     #multistepsform input[type=number],
    620     #multistepsform input[type=email],
    621     #multistepsform textarea {
    622         padding: 5px;
    623         width: 95%;
    624     }
    625 
    626     #multistepsform input:focus,
    627     #multistepsform textarea:focus {
    628         border-color: #679b9b;
    629         outline: none;
    630         color: #637373;
    631     }
    632 
    633     #multistepsform .action-button {
    634         width: 100px;
    635         background: #ff9a76;
     616        margin-bottom: 40px;
     617    }
     618
     619    .onboarding-header h1 {
     620        font-size: 28px;
    636621        font-weight: bold;
    637         color: #fff;
    638         transition: 150ms;
    639         border: 0 none;
    640         float: right;
    641         border-radius: 1px;
    642         cursor: pointer;
    643         padding: 10px 5px;
    644         margin: 10px 5px;
    645     }
    646 
    647     #multistepsform .action-button:hover,
    648     #multistepsform .action-button:focus {
    649         box-shadow: 0 0 0 2px #f08a5d, 0 0 0 3px #ff976;
    650         color: #fff;
    651     }
    652 
    653     #multistepsform .fs-title {
    654         font-size: 15px;
    655         text-transform: uppercase;
    656622        color: #2c3e50;
    657623        margin-bottom: 10px;
    658624    }
    659625
    660     #multistepsform .fs-subtitle {
    661         font-weight: normal;
    662         font-size: 13px;
     626    .onboarding-header p {
     627        font-size: 14px;
     628        color: #666;
     629        margin: 0;
     630    }
     631
     632    .setup-guide-section {
     633        margin-bottom: 30px;
     634    }
     635
     636    .setup-guide-header {
     637        display: flex;
     638        justify-content: space-between;
     639        align-items: center;
     640        margin-bottom: 20px;
     641    }
     642
     643    .setup-guide-header h2 {
     644        font-size: 18px;
     645        font-weight: 600;
     646        color: #2c3e50;
     647        margin: 0;
     648    }
     649
     650    .setup-guide-header .progress-text {
     651        font-size: 14px;
     652        color: #666;
     653    }
     654
     655    .setup-guide-description {
     656        font-size: 14px;
    663657        color: #666;
    664658        margin-bottom: 20px;
    665659    }
    666660
    667     #multistepsform #progressbar {
    668         margin-bottom: 30px;
     661    .onboarding-card {
     662        background: white;
     663        border-radius: 8px;
     664        margin-bottom: 15px;
     665        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    669666        overflow: hidden;
    670         counter-reset: step;
    671     }
    672 
    673     #multistepsform #progressbar li {
    674         list-style-type: none;
    675         color: #FF6600;
    676         text-transform: uppercase;
    677         font-size: 9px;
    678         width: 16.5%;
    679         float: left;
     667        transition: all 0.3s ease;
     668        border: 1px solid #e0e0e0;
     669    }
     670
     671    .onboarding-card:hover {
     672        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
     673    }
     674
     675    .card-header {
     676        padding: 20px;
     677        cursor: pointer;
     678        display: flex;
     679        align-items: center;
     680        justify-content: space-between;
     681        background: white;
     682        border: none;
     683        width: 100%;
     684        text-align: left;
     685    }
     686
     687    .card-header:hover {
     688        background: #f9f9f9;
     689    }
     690
     691    .card-header-left {
     692        display: flex;
     693        align-items: center;
     694        gap: 15px;
     695    }
     696
     697    .card-circle {
     698        width: 24px;
     699        height: 24px;
     700        border-radius: 50%;
     701        background: #e0e0e0;
     702        display: flex;
     703        align-items: center;
     704        justify-content: center;
     705        flex-shrink: 0;
     706        font-size: 12px;
     707        font-weight: 500;
     708        color: #666;
     709    }
     710
     711    .card-circle.active {
     712        background: #10a152;
     713        color: white;
     714        font-weight: bold;
     715    }
     716
     717    .card-title {
     718        font-size: 16px;
     719        font-weight: 600;
     720        color: #2c3e50;
     721        margin: 0;
     722    }
     723
     724    .card-arrow {
     725        width: 20px;
     726        height: 20px;
     727        transition: transform 0.3s ease;
     728    }
     729
     730    .card-arrow.expanded {
     731        transform: rotate(180deg);
     732    }
     733
     734    .card-content {
     735        padding: 0 20px;
     736        max-height: 0;
     737        overflow: hidden;
     738        transition: max-height 0.3s ease, padding 0.3s ease;
     739    }
     740
     741    .card-content.expanded {
     742        max-height: 5000px;
     743        padding: 20px;
     744    }
     745
     746    .onboarding-form {
     747        background: white;
     748        border-radius: 8px;
     749        padding: 30px;
     750    }
     751
     752    .onboarding-form input[type=text],
     753    .onboarding-form input[type=password],
     754    .onboarding-form input[type=number],
     755    .onboarding-form input[type=email],
     756    .onboarding-form textarea,
     757    .onboarding-form select {
     758        padding: 8px 12px;
     759        width: 100%;
     760        border: 1px solid #ddd;
     761        border-radius: 4px;
     762        font-size: 14px;
     763        box-sizing: border-box;
     764    }
     765
     766    .onboarding-form input:focus,
     767    .onboarding-form textarea:focus,
     768    .onboarding-form select:focus {
     769        border-color: #10a152;
     770        outline: none;
     771        box-shadow: 0 0 0 2px rgba(77, 20, 140, 0.1);
     772    }
     773
     774    .onboarding-form table {
     775        width: 100%;
     776        margin-bottom: 20px;
     777    }
     778
     779    .onboarding-form table td {
     780        padding: 10px;
     781        vertical-align: top;
     782    }
     783
     784    .onboarding-form .action-button {
     785        background: #10a152;
     786        color: white;
     787        border: none;
     788        padding: 12px 24px;
     789        border-radius: 4px;
     790        font-weight: 600;
     791        cursor: pointer;
     792        font-size: 14px;
     793        transition: background 0.3s ease;
     794        margin: 10px 5px;
     795    }
     796
     797    .onboarding-form .action-button:hover {
     798        background: #3a0f6b;
     799    }
     800
     801    .onboarding-form .action-button.save_changes {
     802        background: #0ba156;
     803    }
     804
     805    .onboarding-form .action-button.save_changes:hover {
     806        background: #089247;
     807    }
     808
     809    .onboarding-form .action-button.next-button {
     810        background: #089247;
     811    }
     812
     813    .fedex-logo {
     814        text-align: center;
     815        margin: 20px 0;
     816    }
     817
     818    .fedex-logo img {
     819        width: 150px;
     820        height: auto;
     821    }
     822
     823    .success-message {
     824        background: #0ba156;
     825        color: white;
     826        padding: 20px;
     827        border-radius: 8px;
     828        margin-bottom: 20px;
     829        text-align: center;
     830    }
     831
     832    .error-message {
     833        background: #e74c3c;
     834        color: white;
     835        padding: 20px;
     836        border-radius: 8px;
     837        margin-bottom: 20px;
     838        text-align: center;
     839    }
     840
     841    .checkbox-group {
     842        display: flex;
     843        flex-wrap: wrap;
     844        gap: 15px;
     845        margin: 15px 0;
     846    }
     847
     848    .checkbox-group label {
     849        display: flex;
     850        align-items: center;
     851        gap: 8px;
     852        font-size: 14px;
     853        color: #666;
     854    }
     855
     856    .section-title {
     857        font-size: 18px;
     858        font-weight: 600;
     859        color: #2c3e50;
     860        margin: 20px 0 15px 0;
     861        padding-bottom: 10px;
     862        border-bottom: 2px solid #e0e0e0;
     863    }
     864
     865    hr {
     866        border: none;
     867        border-top: 1px solid #e0e0e0;
     868        margin: 20px 0;
     869    }
     870    .setup-guide-description-updated {
     871        font-size: 16px;
     872        font-weight: 600;
     873        color: #2c3e50;
     874        margin-bottom: 20px;
     875    }
     876    .support-text {
     877        font-size: 16px;
     878        color: #2c3e50;
     879        margin-bottom: 20px;
     880    }
     881
     882    .support-text a {
     883        color: #10a152;
     884        text-decoration: none;
     885        font-weight: 600;
     886    }
     887
     888    .radio-card-group {
     889        display: flex;
     890        gap: 15px;
     891        margin-bottom: 20px;
     892    }
     893
     894    .radio-card {
     895        flex: 1;
     896        padding: 20px;
     897        border: 1px solid #ddd;
     898        border-radius: 8px;
     899        cursor: pointer;
     900        transition: all 0.3s ease;
    680901        position: relative;
    681902    }
    682903
    683     #multistepsform #progressbar li:before {
    684         content: counter(step);
    685         counter-increment: step;
    686         width: 20px;
    687         line-height: 20px;
    688         display: block;
    689         font-size: 10px;
    690         color: #fff;
    691         background: #FF6600;
    692         border-radius: 3px;
    693         margin: 0 auto 5px auto;
    694     }
    695 
    696     #multistepsform #progressbar li:after {
    697         content: "";
    698         width: 100%;
    699         height: 2px;
    700         background: #FF6600;
     904    .radio-card:hover {
     905        border-color: #10a152;
     906    }
     907
     908    .radio-card.selected {
     909        border-color: #10a152;
     910        background-color: #f8f5fb;
     911        box-shadow: 0 0 0 2px rgba(77, 20, 140, 0.2);
     912    }
     913
     914    .radio-card input[type="radio"] {
    701915        position: absolute;
    702         left: -50%;
    703         top: 9px;
    704         z-index: -1;
    705     }
    706 
    707     #multistepsform #progressbar li:first-child:after {
    708         content: none;
    709     }
    710 
    711     #multistepsform #progressbar li.active {
    712         color: #4D148C;
    713     }
    714 
    715     #multistepsform #progressbar li.active:before,
    716     #multistepsform #progressbar li.active:after {
    717         background: #4D148C;
    718         color: white;
    719     }
    720 
    721     .setting {
    722         cursor: pointer;
    723         border: 0px;
    724         padding: 10px 5px;
    725         margin: 10px 5px;
    726         background-color: #ff9a76 !important;
     916        opacity: 0;
     917        width: 0;
     918        height: 0;
     919    }
     920
     921    .radio-card-title {
     922        font-weight: 600;
     923        color: #2c3e50;
     924    }
     925
     926    .shipi-success-message {
     927        background: #f8f5fb;
     928        padding: 30px;
     929        border-radius: 8px;
     930        text-align: center;
     931        margin-bottom: 20px;
     932    }
     933
     934    .shipi-success-message h2 {
     935        font-size: 24px;
    727936        font-weight: bold;
    728         color: #ffffff !important;
    729         border-radius: 3px;
     937        color: #2c3e50;
     938        margin-top: 10px;
     939        margin-bottom: 10px;
     940    }
     941
     942    .shipi-success-message p {
     943        font-size: 16px;
     944        color: #666;
     945        margin-bottom: 20px;
     946    }
     947
     948    .shipi-success-message h3 {
     949        font-size: 18px;
     950        font-weight: 600;
     951        color: #2c3e50;
     952        margin-top: 20px;
    730953    }
    731954</style>
    732 <div style="text-align:center;margin-top:20px;"><img src="<?php echo plugin_dir_url(__FILE__); ?>fedex.png" style="width:150px;"></div>
    733 
    734 <?php if($success != ''){
    735     echo '<fieldset>
    736     <center><h2 class="fs-title" style="background: #0ba156;padding: 20px;color: white;">'. $success .'</h2>
    737     </center>';
    738 }?>
    739     <!-- multistep form -->
    740     <form id="multistepsform" method="post">
    741         <?php if (!$initial_setup) { ?>
    742         <!-- progressbar -->
    743         <ul id="progressbar">
    744             <li class="active">Integration</li>
    745             <li>Setup</li>
    746             <li>Packing</li>
    747             <li>Rates</li>
    748             <li>Shipping Label</li>
    749             <li>Shipi</li>
    750         </ul>
    751         <?php } ?>
    752         <?php if ($error == '') {
    753 
    754         ?>
    755             <!-- fieldsets -->
    756             <fieldset>
    757                 <center>
    758                     <h2 class="fs-title">FedEx Account Information</h2>
    759 
    760                     <table style="padding-left:10px;padding-right:10px;">
    761                         <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_test" <?php echo (isset($general_settings['hitshippo_fedex_test']) && $general_settings['hitshippo_fedex_test'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable Test Mode.</small></span></td>
    762                         <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_rates" <?php echo (isset($general_settings['hitshippo_fedex_rates']) && $general_settings['hitshippo_fedex_rates'] == 'yes') || ($initial_setup) ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable Live Shipping Rates.</small></span></td>
    763                         <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_shippo_label_gen" <?php echo (isset($general_settings['hitshippo_fedex_shippo_label_gen']) && $general_settings['hitshippo_fedex_shippo_label_gen'] == 'yes') || ($initial_setup) ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Create Label automatically.</small></span></td>
    764                         <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_developer_rate" <?php echo (isset($general_settings['hitshippo_fedex_developer_rate']) && $general_settings['hitshippo_fedex_developer_rate'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable Debug Mode.</small></span></td>
    765                         <td style="display: none;"><input type="text" name="hitshippo_fedex_last_mode" value="<?php echo (isset($general_settings['hitshippo_fedex_test'])) ? $general_settings['hitshippo_fedex_test'] : ''; ?>"></td>
     955<div class="onboarding-container">
     956    <div class="fedex-logo">
     957        <img src="<?php echo plugin_dir_url(__FILE__); ?>fedex.png" alt="FedEx">
     958    </div>
     959
     960    <div class="onboarding-header">
     961        <h1>FedEx Shipping Configuration</h1>
     962        <p>Here's your personalized guide to get started and streamline your shipping process.</p>
     963    </div>
     964
     965    <?php if($success != ''){
     966        echo '<div class="success-message">'. $success .'</div>';
     967    }?>
     968
     969    <?php if($error != ''){
     970        echo '<div class="error-message">'. $error .'</div>';
     971    }?>
     972
     973        <div style="text-align: center; margin-bottom: 20px;">
     974
     975            <p class="support-text">If you get stuck or need any help, feel free to <a href="https://app.myshipi.com/support/" target="_blank">contact us</a> and we will set it up for you.</p>
     976
     977        </div>  <div class="setup-guide-section">
     978        <div class="setup-guide-header">
     979            <h2>Setup guide</h2>
     980        </div>
     981        <p class="setup-guide-description setup-guide-description-updated">Use this personalised guide to get started</p>
     982    </div>
     983
     984    <form id="onboarding-form" class="onboarding-form" method="post">
     985        <?php if ($error == '') { ?>
     986
     987        <!-- Card 1: Connect Shipi -->
     988        <div class="onboarding-card active" id="card-1">
     989            <button type="button" class="card-header" onclick="toggleCard(1)">
     990                <div class="card-header-left">
     991                    <div class="card-circle active">1</div>
     992                    <h3 class="card-title">Connect with Shipi</h3>
     993                </div>
     994                <svg class="card-arrow expanded" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
     995                    <path d="M5 7.5L10 12.5L15 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     996                </svg>
     997            </button>
     998            <div class="card-content expanded">
     999                <p style="margin-bottom: 20px; color: #555; text-align: center; font-size: 16px; font-style: italic;">Shipi performs all the operations in its own server. So it won't affect your page speed or server usage.</p>
     1000                    <table class="with_shipo_acc" style="width:100%;text-align:center;display: none; margin-top: 20px;">
     1001                        <tr>
     1002                            <td style="width: 50%;padding:10px;">
     1003                                <?php _e('Enter Integration Key', 'hitshippo_fedex') ?><font style="color:red;">*</font><br>
     1004                                <input type="text" style="width:330px;" class="intergration" id="shipo_intergration" name="hitshippo_fedex_shippo_int_key" value="<?php echo (isset($general_settings['hitshippo_fedex_shippo_int_key'])) ? $general_settings['hitshippo_fedex_shippo_int_key'] : ''; ?>">
     1005                            </td>
     1006                        </tr>
    7661007                    </table>
    767                 </center>
     1008                    <div class="checkbox-group without_shipo_accc" style="margin-top: 20px; display: none;">
     1009                        <label><input type="checkbox" name="hitshippo_fedex_track_audit" <?php echo (isset($general_settings['hitshippo_fedex_track_audit']) && $general_settings['hitshippo_fedex_track_audit'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"> Track shipments everyday & Update the order status</label>
     1010                        <label><input type="checkbox" name="hitshippo_fedex_daily_report" <?php echo (isset($general_settings['hitshippo_fedex_daily_report']) && $general_settings['hitshippo_fedex_daily_report'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"> Daily Report</label>
     1011                        <label><input type="checkbox" name="hitshippo_fedex_monthly_report" <?php echo (isset($general_settings['hitshippo_fedex_monthly_report']) && $general_settings['hitshippo_fedex_monthly_report'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"> Monthly Report</label>
     1012                    </div>
     1013                    <div class="without_shipo_acc" style="width:100%;text-align:center; margin-top: 20px;">
     1014                        <style>
     1015                            /* Styles from user example */
     1016                            .shipi-container {
     1017                                background: #fff;
     1018                                padding: 40px;
     1019                                box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
     1020                                border-radius: 12px;
     1021                                width: 550px;
     1022                                text-align: center;
     1023                                margin: auto; /* Center it */
     1024                            }
     1025                            .shipi-container h2 img {
     1026                                max-width: 100px;
     1027                            }
     1028                            .shipi-container p {
     1029                                color: #555;
     1030                            }
     1031                            .shipi-input {
     1032                                width: 90%;
     1033                                padding: 14px;
     1034                                margin: 12px 0;
     1035                                border: 1px solid #ccc;
     1036                                border-radius: 6px;
     1037                            }
     1038                            .shipi-button {
     1039                                width: 100%;
     1040                                background: #28a745;
     1041                                color: white;
     1042                                padding: 14px;
     1043                                border: none;
     1044                                border-radius: 6px;
     1045                                cursor: pointer;
     1046                                font-weight: bold;
     1047                                font-size: 16px;
     1048                                margin-top: 10px;
     1049                            }
     1050                            .shipi-button:hover {
     1051                                background: #218838;
     1052                            }
     1053                            .message-success {
     1054                                color: green !important;
     1055                                font-weight: bold;
     1056                            }
     1057                            .message-error {
     1058                                color: red !important;
     1059                                font-weight: bold;
     1060                            }
     1061                            .shipi-links {
     1062                                margin-top: 20px;
     1063                            }
     1064                            .shipi-links a {
     1065                                text-decoration: none;
     1066                                color: #007bff;
     1067                                display: block;
     1068                                margin: 5px 0;
     1069                            }
     1070                            .support-note {
     1071                                margin-top: 15px;
     1072                                padding: 12px;
     1073                                background: #fff8e5;
     1074                                border: 1px solid #ffe5b5;
     1075                                border-radius: 6px;
     1076                                color: #a66a00;
     1077                                font-size: 14px;
     1078                                text-align: center;
     1079                            }
     1080                        </style>
     1081                        <div class="shipi-container">
     1082                            <h2><img src="<?php echo 'https://app.myshipi.com/assets/img/logos/shipi_100px.png'; ?>" alt="Shipi Logo"></h2>
     1083                            <p>Please Enter the below details.</p>
     1084                            <div id="shipi-message"></div>
     1085                            <div id="shipi-connect-form">
     1086                                <input class="shipi-input" type="email" name="shipi_connection_username" placeholder="Email Address" required value="<?php echo (isset($general_settings['hitshippo_fedex_shipo_signup'])) ? esc_attr($general_settings['hitshippo_fedex_shipo_signup']) : ''; ?>" />
     1087                                <input class="shipi-input" type="password" name="shipi_connection_password" placeholder="Password" required />
     1088                                <p>If you already have an account with Shipi, it will connect. Otherwise, it will create a new user and connect the site.</p>
     1089                                <button class="shipi-button" type="button">Connect or Create Account</button>
     1090                            </div>
     1091                            <div class="support-note">
     1092                                If you need any help or you are stuck on this place, <a href="https://calendar.app.google/aVfnftudzdtZwDVT9" target="_blank" rel="noopener noreferrer"><b>Contact us</b></a>
     1093                                and we will set it up for you.
     1094                            </div>
     1095                            <div class="shipi-links">
     1096                                <a href="https://calendar.app.google/aVfnftudzdtZwDVT9" target="_blank" rel="noopener noreferrer"> Book Meeting with Us</a>
     1097                                <a href="https://app.myshipi.com/support/" target="_blank" rel="noopener noreferrer"> Create Support Ticket</a>
     1098                            </div>
     1099                        </div>
     1100                    </div>
     1101                    <div class="with_shipo_key">
     1102                    <div style="margin-bottom: 20px; display: none;">
     1103                        <label style="display: block; margin-bottom: 10px;">
     1104                            <input type="checkbox" id='intergration_ckeck_box' style="margin-right: 8px;"> Edit integration key
     1105                        </label>
     1106                        <input style="width:100%; max-width: 400px; text-align:center; pointer-events:none;" required type="text" id="intergration" name="hitshippo_fedex_shippo_int_key" placeholder="" value="<?php echo (isset($general_settings['hitshippo_fedex_shippo_int_key'])) ? $general_settings['hitshippo_fedex_shippo_int_key'] : ''; ?>">
     1107                    </div>
     1108                    <div class="shipi-success-message">
     1109                        <span style="font-size: 48px;">🎉</span>
     1110                        <h2>Site Linked Successfully!</h2>
     1111                        <p>It's great to have you here. Make your customers happier by reacting faster and handling their service requests in a timely manner, meaning higher store reviews and more revenue.</p>
     1112                        <h3>Configure your FedEx account below</h3>
     1113                    </div>
     1114                    </div>
     1115            </div>
     1116        </div>
     1117
     1118        <!-- Card 2: FedEx Account Information -->
     1119        <div class="onboarding-card active" id="card-2">
     1120            <button type="button" class="card-header" onclick="toggleCard(2)">
     1121                <div class="card-header-left">
     1122                    <div class="card-circle active">2</div>
     1123                    <h3 class="card-title">FedEx Account Information</h3>
     1124                </div>
     1125                <svg class="card-arrow expanded" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
     1126                    <path d="M5 7.5L10 12.5L15 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     1127                </svg>
     1128            </button>
     1129            <div class="card-content expanded">
     1130                <div class="checkbox-group">
     1131                    <label><input type="checkbox" name="hitshippo_fedex_test" <?php echo (isset($general_settings['hitshippo_fedex_test']) && $general_settings['hitshippo_fedex_test'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"> Enable Test Mode</label>
     1132                    <label><input type="checkbox" name="hitshippo_fedex_rates" <?php echo (isset($general_settings['hitshippo_fedex_rates']) && $general_settings['hitshippo_fedex_rates'] == 'yes') || ($initial_setup) ? 'checked="true"' : ''; ?> value="yes"> Enable Live Shipping Rates</label>
     1133                    <label><input type="checkbox" name="hitshippo_fedex_shippo_label_gen" <?php echo (isset($general_settings['hitshippo_fedex_shippo_label_gen']) && $general_settings['hitshippo_fedex_shippo_label_gen'] == 'yes') || ($initial_setup) ? 'checked="true"' : ''; ?> value="yes"> Create Label automatically</label>
     1134                    <label><input type="checkbox" name="hitshippo_fedex_developer_rate" <?php echo (isset($general_settings['hitshippo_fedex_developer_rate']) && $general_settings['hitshippo_fedex_developer_rate'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"> Enable Debug Mode</label>
     1135                </div>
     1136                <input type="hidden" name="hitshippo_fedex_last_mode" value="<?php echo (isset($general_settings['hitshippo_fedex_test'])) ? $general_settings['hitshippo_fedex_test'] : ''; ?>">
    7681137                <table style="width:100%;">
    7691138                    <tr>
     
    8221191                            <input type="text" id= "hitshippo_fedex_rest_acc_no" name="hitshippo_fedex_rest_acc_no" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_acc_no'])) ? $general_settings['hitshippo_fedex_rest_acc_no'] : ''; ?>">
    8231192                        </td>
    824                     </tr>
    825                     <tr class="REST_auth">
    826                         <td style=" width: 50%;padding:10px;">
    827                             <?php _e('API key', 'hitshippo_fedex') ?><font style="color:red;">*</font>
    828                             <input type="text" id="hitshippo_fedex_rest_api_key" name="hitshippo_fedex_rest_api_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_api_key'])) ? $general_settings['hitshippo_fedex_rest_api_key'] : ''; ?>">
    829                             <a href="https://knowledgebase.myshipi.com/blogs/how-to-get-fedex-api-key-and-api-secret" target="_blank" style="color: #0ba156;">How to Get these details and permissions required?</a>
    830                         </td>
    831                         <td style="padding:10px;">
    832                             <?php _e('Secret key', 'hitshippo_fedex') ?><font style="color:red;">*</font>
    833                             <input type="text" id= "hitshippo_fedex_rest_secret_key" name="hitshippo_fedex_rest_secret_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_secret_key'])) ? $general_settings['hitshippo_fedex_rest_secret_key'] : ''; ?>">
    834                         </td>
    835                     </tr>
    836                     <tr class="REST_auth">
    837                         <td style=" width: 50%;padding:10px;">
    838                             <?php _e('Tracking API key', 'hitshippo_fedex') ?>
    839                             <input type="text" id="hitshippo_fedex_rest_tracking_api_key" name="hitshippo_fedex_rest_tracking_api_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_tracking_api_key'])) ? $general_settings['hitshippo_fedex_rest_tracking_api_key'] : ''; ?>">
    840                             <a href="https://knowledgebase.myshipi.com/blogs/why-fedex-tracking-needs-different-api-details" target="_blank" style="color: #0ba156;">Why Tracking Needs Different API Details in FedEx?</a>
    841                         </td>
    842                         <td style="padding:10px;">
    843                             <?php _e('Tracking Secret key', 'hitshippo_fedex') ?>
    844                             <input type="text" id= "hitshippo_fedex_rest_tracking_secret_key" name="hitshippo_fedex_rest_tracking_secret_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_tracking_secret_key'])) ? $general_settings['hitshippo_fedex_rest_tracking_secret_key'] : ''; ?>">
    845                         </td>
    846                     </tr>
    847                     <tr>
    8481193                        <td style="padding:10px;">
    8491194                            <?php _e('Weight Unit', 'hitshippo_fedex') ?><font style="color:red;">*</font><br>
     
    8531198                            </select>
    8541199                        </td>
     1200                    </tr>
     1201                    <tr class="REST_auth">
     1202                        <td style=" width: 50%;padding:10px;">
     1203                            <?php _e('API key', 'hitshippo_fedex') ?><font style="color:red;">*</font>
     1204                            <input type="text" id="hitshippo_fedex_rest_api_key" name="hitshippo_fedex_rest_api_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_api_key'])) ? $general_settings['hitshippo_fedex_rest_api_key'] : ''; ?>">
     1205                            <a href="https://knowledgebase.myshipi.com/blogs/how-to-get-fedex-api-key-and-api-secret" target="_blank" style="color: #0ba156;">How to Get these details and permissions required?</a>
     1206                        </td>
     1207                        <td style="padding:10px;">
     1208                            <?php _e('Secret key', 'hitshippo_fedex') ?><font style="color:red;">*</font>
     1209                            <input type="text" id= "hitshippo_fedex_rest_secret_key" name="hitshippo_fedex_rest_secret_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_secret_key'])) ? $general_settings['hitshippo_fedex_rest_secret_key'] : ''; ?>">
     1210                        </td>
     1211                    </tr>
     1212                    <tr class="REST_auth">
     1213                        <td style=" width: 50%;padding:10px;">
     1214                            <?php _e('Tracking API key', 'hitshippo_fedex') ?>
     1215                            <input type="text" id="hitshippo_fedex_rest_tracking_api_key" name="hitshippo_fedex_rest_tracking_api_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_tracking_api_key'])) ? $general_settings['hitshippo_fedex_rest_tracking_api_key'] : ''; ?>">
     1216                            <a href="https://knowledgebase.myshipi.com/blogs/why-fedex-tracking-needs-different-api-details" target="_blank" style="color: #0ba156;">Why Tracking Needs Different API Details in FedEx?</a>
     1217                        </td>
     1218                        <td style="padding:10px;">
     1219                            <?php _e('Tracking Secret key', 'hitshippo_fedex') ?>
     1220                            <input type="text" id= "hitshippo_fedex_rest_tracking_secret_key" name="hitshippo_fedex_rest_tracking_secret_key" value="<?php echo (isset($general_settings['hitshippo_fedex_rest_tracking_secret_key'])) ? $general_settings['hitshippo_fedex_rest_tracking_secret_key'] : ''; ?>">
     1221                        </td>
     1222                    </tr>
     1223                    <tr>
    8551224                        <td style="padding:10px;">
    8561225                            <?php _e('Change FedEx currency', 'hitshippo_fedex') ?><font style="color:red;">*</font><br>
     
    9041273                </table>
    9051274                <?php if (isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] != '') {
    906                     echo '<input type="submit" name="save" class="action-button save_changes" style="width:auto;float:left;" value="Save Changes" />';
    907                 }
    908 
    909                 ?>
    910                 <?php if (!$initial_setup) { ?>
    911                 <input type="button" name="next" class="next action-button" value="Next" />
    912                 <?php } ?>
    913             </fieldset>
    914             <fieldset>
    915                 <center>
    916                     <h2 class="fs-title">Shipping Address Information</h2>
    917                 </center>
     1275                    echo '<input type="submit" name="save" class="action-button save_changes" value="Save Changes" />';
     1276                    echo '<button type="button" style="float:right;" class="action-button next-button" onclick="toggleCard(3); return false;">Next</button>';
     1277                } ?>
     1278            </div>
     1279        </div>
     1280
     1281        <!-- Card 3: Shipping Address Information -->
     1282        <div class="onboarding-card" id="card-3">
     1283            <button type="button" class="card-header" onclick="toggleCard(3)">
     1284                <div class="card-header-left">
     1285                    <div class="card-circle">3</div>
     1286                    <h3 class="card-title">Shipping Address Information</h3>
     1287                </div>
     1288                <svg class="card-arrow" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
     1289                    <path d="M5 7.5L10 12.5L15 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     1290                </svg>
     1291            </button>
     1292            <div class="card-content">
    9181293
    9191294                <table style="width:100%;">
     
    10221397                </table>
    10231398                <?php if (isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] != '') {
    1024                     echo '<input type="submit" name="save" class="action-button save_changes" style="width:auto;float:left;" value="Save Changes" />';
    1025                 }
    1026 
    1027                 ?>
    1028                 <?php if (!$initial_setup) { ?>
    1029                 <input type="button" name="next" class="next action-button " value="Next" />
    1030                 <input type="button" name="previous" class="previous action-button" value="Previous" />
    1031                 <?php } ?>
    1032             </fieldset>
    1033             <fieldset <?php echo ($initial_setup) ? 'style="display:none"' : ''?>>
    1034                 <center>
    1035                     <h2 class="fs-title">Choose Packing ALGORITHM</h2>
    1036                 </center><br />
     1399                    echo '<input type="submit" name="save" class="action-button save_changes" value="Save Changes" />';
     1400                    echo '<button type="button" style="float:right;" class="action-button next-button" onclick="toggleCard(4); return false;">Next</button>';
     1401                } ?>
     1402            </div>
     1403        </div>
     1404
     1405        <!-- Card 4: Packing Algorithm -->
     1406        <div class="onboarding-card" id="card-4" <?php echo ($initial_setup) ? 'style="display:none"' : ''?>>
     1407            <button type="button" class="card-header" onclick="toggleCard(4)">
     1408                <div class="card-header-left">
     1409                    <div class="card-circle">4</div>
     1410                    <h3 class="card-title">Choose Packing Algorithm</h3>
     1411                </div>
     1412                <svg class="card-arrow" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
     1413                    <path d="M5 7.5L10 12.5L15 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     1414                </svg>
     1415            </button>
     1416            <div class="card-content">
    10371417                <table style="width:100%">
    10381418
     
    11291509
    11301510                <?php if (isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] != '') {
    1131                     echo '<input type="submit" name="save" class="action-button save_changes" style="width:auto;float:left;" value="Save Changes" />';
    1132                 }
    1133 
    1134                 ?>
    1135                 <?php if (!$initial_setup) { ?>
    1136                 <input type="button" name="next" class="next action-button" value="Next" />
    1137                 <input type="button" name="previous" class="previous action-button" value="Previous" />
    1138                 <?php } ?>
    1139             </fieldset>
    1140             <fieldset>
    1141                 <center>
    1142                     <h2 class="fs-title">Rates</h2><br />
     1511                    echo '<input type="submit" name="save" class="action-button save_changes" value="Save Changes" />';
     1512                    echo '<button type="button" style="float:right;" class="action-button next-button" onclick="toggleCard(5); return false;">Next</button>';
     1513                } ?>
     1514            </div>
     1515        </div>
     1516
     1517        <!-- Card 5: Rates -->
     1518        <div class="onboarding-card" id="card-5">
     1519            <button type="button" class="card-header" onclick="toggleCard(5)">
     1520                <div class="card-header-left">
     1521                    <div class="card-circle">5</div>
     1522                    <h3 class="card-title">Rates</h3>
     1523                </div>
     1524                <svg class="card-arrow" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
     1525                    <path d="M5 7.5L10 12.5L15 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     1526                </svg>
     1527            </button>
     1528            <div class="card-content">
    11431529                    <table style="padding-left:10px;padding-right:10px;">
    11441530                        <tr>
    11451531                            <td colspan="3" style=" text-align: center;">
    1146                                 <span style="float:left;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_one_rates" <?php echo (isset($general_settings['hitshippo_fedex_one_rates']) && $general_settings['hitshippo_fedex_one_rates'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable ONE rate.</small></span>
    1147                                 <span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_account_rates" <?php echo (isset($general_settings['hitshippo_fedex_account_rates']) && $general_settings['hitshippo_fedex_account_rates'] == 'yes') || ($initial_setup) ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Fetch FedEx account rates.</small></span>
    1148                                 <span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_send_pack_as_ship" <?php echo (isset($general_settings['hitshippo_fedex_send_pack_as_ship']) && $general_settings['hitshippo_fedex_send_pack_as_ship'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Send Fedex pack type as same as shipping label settings.</small></span>
     1532                                <span style="text-align: center;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_one_rates" <?php echo (isset($general_settings['hitshippo_fedex_one_rates']) && $general_settings['hitshippo_fedex_one_rates'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable ONE rate.</small></span>
     1533                                <span style="text-align: center;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_account_rates" <?php echo (isset($general_settings['hitshippo_fedex_account_rates']) && $general_settings['hitshippo_fedex_account_rates'] == 'yes') || ($initial_setup) ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Fetch FedEx account rates.</small></span>
     1534                                <span style="text-align: center;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_send_pack_as_ship" <?php echo (isset($general_settings['hitshippo_fedex_send_pack_as_ship']) && $general_settings['hitshippo_fedex_send_pack_as_ship'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Send Fedex pack type as same as shipping label settings.</small></span>
    11491535                            </td>
    11501536                        </tr>
     
    11601546                    </table>
    11611547                </center>
    1162                 <center>
    1163                     <h2 class="fs-title">Shipping Services & Price adjustment</h2>
    1164                 </center>
    1165                 <table style="width:100%;">
    1166 
    1167                     <tr>
    1168                         <td>
    1169                             <h3 style="font-size: 1.10em;"><?php _e('Carriers', 'hitshippo_fedex') ?></h3>
    1170                         </td>
    1171                         <td>
    1172                             <h3 style="font-size: 1.10em;"><?php _e('Alternate Name for Carrier', 'hitshippo_fedex') ?></h3>
    1173                         </td>
    1174 
    1175                     </tr>
    1176                     <?php foreach ($_carriers as $key => $value) {
    1177                         if ($key == 'INTERNATIONAL_ECONOMY') {
    1178                             echo ' <tr><td colspan="4" style="padding:10px;"><hr></td></tr><tr ><td colspan="4" style="text-align:center;"><div style="padding:10px;border:1px solid gray;"><b><u>INTERNATIONAL SERVICES</u><br>
    1179                                     These all are the services provided by FedEx to ship internationally.<br>
    1180 
    1181                                 </b></div></td></tr> <tr><td colspan="4" style="padding:10px;"><hr></td></tr>';
    1182                         } else if ($key == "FIRST_OVERNIGHT") {
    1183                             echo ' <tr><td colspan="4" style="padding:10px;"><hr></td></tr><tr ><td colspan="4" style="text-align:center;"><div style="padding:10px;border:1px solid gray;"><b><u>DOMESTIC SERVICES</u><br>
    1184                                         These all are the services provided by Fedex to ship domestic.<br>
    1185                                     </b></div>
    1186                                     </td></tr> <tr><td colspan="4" style="padding:10px;"><hr></td></tr>';
    1187                         } else if ($key == 'FEDEX_CARGO_AIRPORT_TO_AIRPORT') {
    1188                             echo ' <tr><td colspan="4" style="padding:10px;"><hr></td></tr><tr ><td colspan="4" style="text-align:center;"><b><u>OTHER SPECIAL SERVICES</u><br>
    1189 
    1190                                     </b>
    1191                                     </td></tr> <tr><td colspan="4" style="padding:10px;"><hr></td></tr>';
    1192                         }
    1193                         $ser_to_enable = ["FIRST_OVERNIGHT", "PRIORITY_OVERNIGHT", "STANDARD_OVERNIGHT", "FEDEX_GROUND", "FEDEX_EXPRESS_SAVER", "INTERNATIONAL_ECONOMY", "INTERNATIONAL_FIRST", "INTERNATIONAL_GROUND", "INTERNATIONAL_PRIORITY", "FEDEX_INTERNATIONAL_PRIORITY"];
    1194                         echo '  <tr>
    1195                                         <td>
    1196                                         <input type="checkbox" value="yes" name="hitshippo_fedex_carrier[' . $key . ']" ' . ((isset($general_settings['hitshippo_fedex_carrier'][$key]) && $general_settings['hitshippo_fedex_carrier'][$key] == 'yes') || ($initial_setup && in_array($key, $ser_to_enable)) ? 'checked="true"' : '') . ' > <small>' . $value . ' - [ ' . $key . ' ]</small>
    1197                                         </td>
    1198                                         <td>
    1199                                             <input type="text" name="hitshippo_fedex_carrier_name[' . $key . ']" value="' . ((isset($general_settings['hitshippo_fedex_carrier_name'][$key])) ? $general_settings['hitshippo_fedex_carrier_name'][$key] : '') . '">
    1200                                         </td>
     1548                <h2 class="section-title">Shipping Services & Price adjustment</h2>
     1549               
     1550                <!-- Single dropdown for selecting services to enable -->
     1551                <div style="margin-bottom: 30px;">
     1552                    <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
     1553                        <label style="font-weight: 600; margin: 0;">
     1554                            <?php _e('Select Service to Enable', 'hitshippo_fedex') ?>
     1555                        </label>
     1556                        <div id="service-counts" style="font-size: 14px; color: #666;">
     1557                            <span id="enabled-count">0</span> Enabled | <span id="disabled-count">0</span> Disabled
     1558                        </div>
     1559                    </div>
     1560                    <div style="display: flex; gap: 10px; align-items: flex-start; position: relative;">
     1561                        <div style="flex: 1;">
     1562                            <select id="disabled_services_select" name="disabled_services_select[]" class="wc-enhanced-select" multiple="multiple" style="width: 100%;" data-placeholder="<?php _e('Search and select services...', 'hitshippo_fedex') ?>">
     1563                                <?php
     1564                                $ser_to_enable = ["FIRST_OVERNIGHT", "PRIORITY_OVERNIGHT", "STANDARD_OVERNIGHT", "FEDEX_GROUND", "FEDEX_EXPRESS_SAVER", "INTERNATIONAL_ECONOMY", "INTERNATIONAL_FIRST", "INTERNATIONAL_GROUND", "INTERNATIONAL_PRIORITY", "FEDEX_INTERNATIONAL_PRIORITY"];
     1565                                foreach ($_carriers as $key => $value) {
     1566                                    $is_enabled = (isset($general_settings['hitshippo_fedex_carrier'][$key]) && $general_settings['hitshippo_fedex_carrier'][$key] == 'yes') || ($initial_setup && in_array($key, $ser_to_enable));
     1567                                    if (!$is_enabled) {
     1568                                        echo '<option value="' . esc_attr($key) . '">' . esc_html($value) . ' - [' . esc_html($key) . ']</option>';
     1569                                    }
     1570                                }
     1571                                ?>
     1572                            </select>
     1573
     1574                        </div>
     1575                        <div style="position: relative;">
     1576                            <button type="button" id="add-selected-service" class="action-button" style="white-space: nowrap; margin: 0;">Enable Selected</button>
     1577                            <div id="service-success-message" style="position: absolute; left: 100%; top: 0; margin-left: 10px; display: none; background: #0ba156; color: white; padding: 12px 20px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 1000; max-width: 400px; font-size: 14px; line-height: 1.5; white-space: normal;">
     1578                                <strong style="display: block; margin-bottom: 5px;">✓ Service Enabled!</strong>
     1579                                <span id="success-message-text"></span> is now enabled and available in the table below to add more configuration.
     1580                            </div>
     1581                        </div>
     1582                    </div>
     1583                    <p style="margin-top: 10px; color: #666; font-size: 13px;">
     1584                        <small>Select a service from the dropdown and click "Enable Service" to add it to the enabled services table below.</small>
     1585                    </p>
     1586                </div>
     1587
     1588                <!-- Table for enabled services only -->
     1589                <div style="margin-top: 30px;">
     1590                    <h3 style="font-size: 1.10em; margin-bottom: 15px;"><?php _e('Enabled Services', 'hitshippo_fedex') ?></h3>
     1591                    <table id="enabled_services_table" style="width:100%; border-collapse: collapse;">
     1592                        <thead>
     1593                            <tr style="background: #f5f5f5;">
     1594                                <th style="padding: 10px; text-align: left; border: 1px solid #ddd;">
     1595                                    <?php _e('Carrier', 'hitshippo_fedex') ?>
     1596                                </th>
     1597                                <th style="padding: 10px; text-align: left; border: 1px solid #ddd;">
     1598                                    <?php _e('Alternate Name for Carrier', 'hitshippo_fedex') ?>
     1599                                </th>
     1600                                <th style="padding: 10px; text-align: center; border: 1px solid #ddd; width: 100px;">
     1601                                    <?php _e('Action', 'hitshippo_fedex') ?>
     1602                                </th>
     1603                            </tr>
     1604                        </thead>
     1605                        <tbody id="enabled_services_tbody">
     1606                            <?php
     1607                            $section_displayed = array('DOMESTIC' => false, 'INTERNATIONAL' => false, 'SPECIAL' => false);
     1608                            foreach ($_carriers as $key => $value) {
     1609                                $is_enabled = (isset($general_settings['hitshippo_fedex_carrier'][$key]) && $general_settings['hitshippo_fedex_carrier'][$key] == 'yes') || ($initial_setup && in_array($key, $ser_to_enable));
     1610                               
     1611                                if ($is_enabled) {
     1612                                    // Show section headers
     1613                                    if ($key == 'FIRST_OVERNIGHT' && !$section_displayed['DOMESTIC']) {
     1614                                        echo '<tr><td colspan="3" style="padding:15px; background: #f9f9f9; border: 1px solid #ddd;"><strong>DOMESTIC SERVICES</strong><br><small style="color: #666;">These all are the services provided by FedEx to ship domestic.</small></td></tr>';
     1615                                        $section_displayed['DOMESTIC'] = true;
     1616                                    }
     1617                                    if ($key == 'INTERNATIONAL_ECONOMY' && !$section_displayed['INTERNATIONAL']) {
     1618                                        echo '<tr><td colspan="3" style="padding:15px; background: #f9f9f9; border: 1px solid #ddd;"><strong>INTERNATIONAL SERVICES</strong><br><small style="color: #666;">These all are the services provided by FedEx to ship internationally.</small></td></tr>';
     1619                                        $section_displayed['INTERNATIONAL'] = true;
     1620                                    }
     1621                                    if ($key == 'FEDEX_CARGO_AIRPORT_TO_AIRPORT' && !$section_displayed['SPECIAL']) {
     1622                                        echo '<tr><td colspan="3" style="padding:15px; background: #f9f9f9; border: 1px solid #ddd;"><strong>OTHER SPECIAL SERVICES</strong></td></tr>';
     1623                                        $section_displayed['SPECIAL'] = true;
     1624                                    }
     1625                                   
     1626                                    echo '<tr class="enabled-service-row" data-service-key="' . $key . '">
     1627                                            <td style="padding: 10px; border: 1px solid #ddd;">
     1628                                                <input type="hidden" name="hitshippo_fedex_carrier[' . $key . ']" value="yes">
     1629                                                <small>' . $value . ' - [' . $key . ']</small>
     1630                                            </td>
     1631                                            <td style="padding: 10px; border: 1px solid #ddd;">
     1632                                                <input type="text" name="hitshippo_fedex_carrier_name[' . $key . ']" value="' . ((isset($general_settings['hitshippo_fedex_carrier_name'][$key])) ? htmlspecialchars($general_settings['hitshippo_fedex_carrier_name'][$key]) : '') . '" style="width: 100%; padding: 5px;">
     1633                                            </td>
     1634                                            <td style="padding: 10px; border: 1px solid #ddd; text-align: center;">
     1635                                                <button type="button" class="button button-small remove-service" data-service-key="' . $key . '" data-service-name="' . htmlspecialchars($value) . '">Remove</button>
     1636                                            </td>
    12011637                                        </tr>';
    1202                     } ?>
    1203                     <tr>
    1204                         <td colspan="4" style="padding:10px;">
    1205                             <hr>
    1206                         </td>
    1207                     </tr>
    1208                 </table>
     1638                                }
     1639                            }
     1640                            ?>
     1641                        </tbody>
     1642                    </table>
     1643                    <p id="no-services-message" style="display: none; padding: 20px; text-align: center; color: #666; background: #f9f9f9; border: 1px solid #ddd; margin-top: 10px;">
     1644                        No services enabled. Please select services from the dropdown above.
     1645                    </p>
     1646                </div>
    12091647                <?php if (isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] != '') {
    1210                     echo '<input type="submit" name="save" class="action-button save_changes" style="width:auto;float:left;" value="Save Changes" />';
    1211                 }
    1212 
    1213                 ?>
    1214                 <?php if (!$initial_setup) { ?>
    1215                 <input type="button" name="next" class="next action-button" value="Next" />
    1216                 <input type="button" name="previous" class="previous action-button" value="Previous" />
    1217                 <?php } ?>
    1218 
    1219             </fieldset>
    1220             <fieldset>
    1221                 <center>
    1222                     <h2 class="fs-title">Configure Shipping Label</h2><br />
     1648                    echo '<input type="submit" name="save" class="action-button save_changes" value="Save Changes" />';
     1649                    echo '<button type="button" style="float:right;" class="action-button next-button" onclick="toggleCard(6); return false;">Next</button>';
     1650                } ?>
     1651            </div>
     1652        </div>
     1653
     1654        <!-- Card 6: Configure Shipping Label -->
     1655        <div class="onboarding-card" id="card-6">
     1656            <button type="button" class="card-header" onclick="toggleCard(6)">
     1657                <div class="card-header-left">
     1658                    <div class="card-circle">6</div>
     1659                    <h3 class="card-title">Configure Shipping Label</h3>
     1660                </div>
     1661                <svg class="card-arrow" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
     1662                    <path d="M5 7.5L10 12.5L15 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
     1663                </svg>
     1664            </button>
     1665            <div class="card-content">
    12231666                    <table style="padding-left:10px;padding-right:10px;">
    12241667                        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_cod" <?php echo (isset($general_settings['hitshippo_fedex_cod']) && $general_settings['hitshippo_fedex_cod'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Cash on Delivery.</small></span></td>
    1225                         <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_etd" <?php echo (isset($general_settings['hitshippo_fedex_etd']) && $general_settings['hitshippo_fedex_etd'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable Electronic Trade Document International(ETD). (To Upload Documents Contact shipi to automate)</small></span></td>
     1668                        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_etd" <?php echo (isset($general_settings['hitshippo_fedex_etd']) && $general_settings['hitshippo_fedex_etd'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Enable Electronic Trade Document International(ETD). (To Upload Documents Contact shipi to automate)</small></span></td>
    12261669
    12271670                    </table>
     
    13861829                        </td>
    13871830                        <td style=" width: 50%;padding:10px;">
     1831                            <?php _e('Shipment Content', 'hitshippo_fedex') ?>
     1832                            <input type="text" name="hitshippo_fedex_shipment_content" placeholder="" value="<?php echo (isset($general_settings['hitshippo_fedex_shipment_content'])) ? $general_settings['hitshippo_fedex_shipment_content'] : ''; ?>">
     1833                        </td>
     1834                        <td style=" width: 50%;padding:10px;">
    13881835                            <!-- <?php _e('Letter Head Image URL (.png Only supported)', 'hitshippo_fedex') ?>
    13891836                            <input type="text" name="hitshippo_fedex_inv_letterhead" placeholder="" value="<?php echo (isset($general_settings['hitshippo_fedex_inv_letterhead'])) ? $general_settings['hitshippo_fedex_inv_letterhead'] : ''; ?>"><br> -->
    1390                         </td>
    1391                         <td style=" width: 50%;padding:10px;">
    1392                             <?php _e('Shipment Content', 'hitshippo_fedex') ?>
    1393                             <input type="text" name="hitshippo_fedex_shipment_content" placeholder="" value="<?php echo (isset($general_settings['hitshippo_fedex_shipment_content'])) ? $general_settings['hitshippo_fedex_shipment_content'] : ''; ?>">
    13941837                        </td>
    13951838                    </tr>
     
    14531896
    14541897                <?php if (isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] != '') {
    1455                     echo '<input type="submit" name="save" class="action-button save_changes" style="width:auto;float:left;" value="Save Changes" />';
    1456                 }
    1457 
    1458                 ?>
    1459                 <?php if (!$initial_setup) { ?>
    1460                 <input type="button" name="next" class="next action-button" value="Next" />
    1461                 <input type="button" name="previous" class="previous action-button" value="Previous" />
    1462                 <?php } ?>
    1463 
    1464             </fieldset>
    1465         <?php }
    1466         ?>
    1467         <fieldset>
    1468             <center>
    1469                 <h2 class="fs-title">LINK Shipi</h2><br>
    1470                 <h3 class="fs-subtitle">Shipi performs all the operations in its own server. So it won't affect your page speed or server usage.</h3>
    1471                 <?php
    1472                 if (!isset($general_settings['hitshippo_fedex_shippo_int_key']) || empty($general_settings['hitshippo_fedex_shippo_int_key'])) {
    1473                 ?>
    1474                     <input type="radio" name="shipo_link_type" id="WITHOUT" value="WITHOUT" checked>I don't have Shipi account  &nbsp; &nbsp; &nbsp;
    1475                     <input type="radio" name="shipo_link_type" id="WITH" value="WITH">I have Shipi integration key
    1476 <br><hr>
    1477         <table class="with_shipo_acc" style="width:100%;text-align:center;display: none;">
    1478         <tr>
    1479             <td style="width: 50%;padding:10px;">
    1480                 <?php _e('Enter Intergation Key', 'hitshippo_fedex') ?><font style="color:red;">*</font><br>
    1481                
    1482                 <input type="text" style="width:330px;" class="intergration" id="shipo_intergration"  name="hitshippo_fedex_shippo_int_key" value="">
    1483             </td>
    1484         </tr>
    1485     </table>
    1486                     <br>
    1487                     <table class ="without_shipo_acc" style="padding-left:10px;padding-right:10px;">
    1488                         <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_track_audit" <?php echo (isset($general_settings['hitshippo_fedex_track_audit']) && $general_settings['hitshippo_fedex_track_audit'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Track shipments everyday & Update the order status </small></span></td>
    1489                         <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_daily_report" <?php echo (isset($general_settings['hitshippo_fedex_daily_report']) && $general_settings['hitshippo_fedex_daily_report'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Daily Report</small></span></td>
    1490                         <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hitshippo_fedex_monthly_report" <?php echo (isset($general_settings['hitshippo_fedex_monthly_report']) && $general_settings['hitshippo_fedex_monthly_report'] == 'yes') ? 'checked="true"' : ''; ?> value="yes"><small style="color:gray"> Monthly Report</small></span></td>
    1491                     </table>
    1492             </center>
    1493             <table class="without_shipo_acc" style="width:100%;text-align:center;">
    1494                 <tr>
    1495                     <td style="padding:10px;">
    1496                        
    1497                     </td>
    1498                 </tr>
    1499 
    1500                 <tr>
    1501                     <td style=" width: 50%;padding:10px;">
    1502                         <?php _e('Email address to signup / check the registered email.', 'hitshippo_fedex') ?><font style="color:red;">*</font><br>
    1503                         <input type="email" id="shipo_mail" style="width:330px;" placeholder="Enter email address" name="hitshippo_fedex_shipo_signup" placeholder="" value="<?php echo (isset($general_settings['hitshippo_fedex_shipo_signup'])) ? $general_settings['hitshippo_fedex_shipo_signup'] : ''; ?>">
    1504                     </td>
    1505 
    1506                 </tr>
    1507                 <tr>
    1508                     <td style=" width: 50%;padding:10px;">
    1509                         <?php _e('password.', 'hitshippo_fedex') ?><font style="color:red;">*</font><br>
    1510                         <input type="password" id="shipo_password" style="width:330px;" placeholder="Enter password" name="hitshippo_fedex_shipo_password" placeholder="" value="">
    1511                     </td>
    1512 
    1513                 </tr>
    1514 
    1515                 <tr>
    1516                     <td style="padding:10px;">
    1517                         <hr>
    1518                     </td>
    1519                 </tr>
    1520 
    1521             </table>
    1522 
    1523         <?php } else {
    1524         ?>
    1525             <tr>
    1526                 <td style="padding:10px;">
    1527                     <?php _e('Shipi Intergation Key', 'hitshippo_fedex') ?><br><br>
    1528                 </td>
    1529             </tr>
    1530             <tr>
    1531                 <td><span style="padding-right:10px; text-align:center;"><input type="checkbox" id='intergration_ckeck_box'><small style="color:gray">Edit intergration key</small></span></td>
    1532             </tr>
    1533             <tr>
    1534                 <td>
    1535                     <input style="width:24%; text-align:center; pointer-events:none;" required type="text" id="intergration" name="hitshippo_fedex_shippo_int_key" placeholder="" value="<?php echo (isset($general_settings['hitshippo_fedex_shippo_int_key'])) ? $general_settings['hitshippo_fedex_shippo_int_key'] : ''; ?>">
    1536                 </td>
    1537             </tr>
    1538             <p style="font-size:14px;line-height:24px;">
    1539                 Site Linked Successfully. <br><br>
    1540                 It's great to have you here. Your account has been linked successfully with Shipi. <br><br>
    1541                 Make your customers happier by reacting faster and handling their service requests in a timely manner, meaning higher store reviews and more revenue.</p>
    1542         <?php
    1543                     echo '</center>';
    1544                 }
    1545         ?>
    1546         <?php echo '<center>' . $error . '</center>'; ?>
    1547 
    1548         <?php if (!isset($general_settings['hitshippo_fedex_shippo_int_key']) || empty($general_settings['hitshippo_fedex_shippo_int_key'])) {
    1549         ?>
    1550             <input type="submit" name="save" class="action-button save_changes" style="width:auto;" value="SAVE & START" />
    1551         <?php   } else {    ?>
    1552             <input type="submit" name="save" class="action-button save_changes" style="width:auto;" value="Save Changes" />
    1553         <?php   }   ?>
    1554         <?php
    1555         if (!$initial_setup) {
    1556         if (empty($error)) {
    1557         ?> 
    1558         <input type="button" name="previous" class="previous action-button" value="Previous" />
    1559         <?php }else{ ?>
    1560             <input type="button" name="previous" class="previous action-button" value="Previous" onclick=" location.reload();" />
    1561             <?php  }}?>
    1562         </fieldset>
     1898                    echo '<input type="submit" name="save" class="action-button save_changes" value="Save Changes" />';
     1899                } ?>
     1900            </div>
     1901        </div>
     1902
     1903        <?php } ?>
    15631904    </form>
    15641905    <center><a href="https://app.myshipi.com/support" target="_blank" style="width:auto;margin-right :20px;" class="button button-primary">Trouble in configuration? / not working? Email us.</a>
    15651906<a href="https://calendar.app.google/aVfnftudzdtZwDVT9" target="_blank" style="width:auto;" class="button button-primary">Looking for demo ? Book your slot with our expert</a></center>
     1907</div>
    15661908
    15671909
    15681910    <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> -->
    15691911    <script type="text/javascript">
    1570         var current_fs, next_fs, previous_fs;
    1571         var left, opacity, scale;
    1572         var animating;
    1573         jQuery(".next").click(function() {
    1574             if (animating) return false;
    1575             animating = true;
    1576 
    1577             current_fs = jQuery(this).parent();
    1578             next_fs = jQuery(this).parent().next();
    1579             jQuery("#progressbar li").eq(jQuery("fieldset").index(next_fs)).addClass("active");
    1580             next_fs.show();
    1581             document.body.scrollTop = 0; // For Safari
    1582             document.documentElement.scrollTop = 0;
    1583             current_fs.animate({
    1584                 opacity: 0
    1585             }, {
    1586                 step: function(now, mx) {
    1587                     scale = 1 - (1 - now) * 0.2;
    1588                     left = now * 50 + "%";
    1589                     opacity = 1 - now;
    1590                     current_fs.css({
    1591                         transform: "scale(" + scale + ")"
    1592                     });
    1593                     next_fs.css({
    1594                         left: left,
    1595                         opacity: opacity
    1596                     });
    1597                 },
    1598                 duration: 0,
    1599                 complete: function() {
    1600                     current_fs.hide();
    1601                     animating = false;
    1602                 },
    1603                 //easing: "easeInOutBack"
    1604             });
    1605         });
    1606 
    1607         jQuery(".previous").click(function() {
    1608             if (animating) return false;
    1609             animating = true;
    1610 
    1611             current_fs = jQuery(this).parent();
    1612             previous_fs = jQuery(this).parent().prev();
    1613             jQuery("#progressbar li")
    1614                 .eq(jQuery("fieldset").index(current_fs))
    1615                 .removeClass("active");
    1616 
    1617             previous_fs.show();
    1618             current_fs.animate({
    1619                 opacity: 0
    1620             }, {
    1621                 step: function(now, mx) {
    1622                     scale = 0.8 + (1 - now) * 0.2;
    1623                     left = (1 - now) * 50 + "%";
    1624                     opacity = 1 - now;
    1625                     current_fs.css({
    1626                         left: left
    1627                     });
    1628                     previous_fs.css({
    1629                         transform: "scale(" + scale + ")",
    1630                         opacity: opacity
    1631                     });
    1632                 },
    1633                 duration: 0,
    1634                 complete: function() {
    1635                     current_fs.hide();
    1636                     animating = false;
    1637                 },
    1638                 //easing: "easeInOutBack"
    1639             });
    1640         });
    1641 
    1642         jQuery(".submit").click(function() {
    1643             return false;
    1644         });
     1912        // Toggle card accordion functionality
     1913        function toggleCard(cardNumber) {
     1914            var card = jQuery('#card-' + cardNumber);
     1915            var content = card.find('.card-content');
     1916            var arrow = card.find('.card-arrow');
     1917            var circle = card.find('.card-circle');
     1918           
     1919            if (content.hasClass('expanded')) {
     1920                // Collapse
     1921                content.removeClass('expanded');
     1922                arrow.removeClass('expanded');
     1923                card.removeClass('active');
     1924                circle.removeClass('active');
     1925            } else {
     1926                // Expand
     1927                content.addClass('expanded');
     1928                arrow.addClass('expanded');
     1929                card.addClass('active');
     1930                circle.addClass('active');
     1931            }
     1932           
     1933            // Scroll to card
     1934            jQuery('html, body').animate({
     1935                scrollTop: card.offset().top - 100
     1936            }, 300);
     1937           
     1938        }
     1939       
     1940       
    16451941        jQuery(document).ready(function() {
     1942
     1943            var integration_key = '<?php echo isset($general_settings['hitshippo_fedex_shippo_int_key']) ? $general_settings['hitshippo_fedex_shippo_int_key'] : ''; ?>';
    16461944           
     1945            jQuery('.without_shipo_acc').hide();
     1946            jQuery('.with_shipo_key').hide();
     1947
     1948            function show_connection_form() {
     1949                jQuery('.without_shipo_acc').show();
     1950            }
     1951
     1952            if (integration_key) {
     1953                jQuery.ajax({
     1954                    url: 'https://app.myshipi.com/embed/check_key.php',
     1955                    type: 'POST',
     1956                    data: {
     1957                        site_url: '<?php echo site_url(); ?>',
     1958                        key: integration_key
     1959                    },
     1960                    dataType: 'json',
     1961                    success: function(response) {
     1962                        if (response.status != 'success') {
     1963                            show_connection_form();
     1964                        }else{
     1965                            jQuery('.with_shipo_key').show();
     1966                        }
     1967                    },
     1968                    error: function(jqXHR, textStatus, errorThrown) {
     1969                        console.log(jqXHR);
     1970                        console.log(textStatus);
     1971                        console.log(errorThrown);
     1972                        alert('An error occurred while checking the key. Check the browser console for more details.');
     1973                        show_connection_form();
     1974                    }
     1975                });
     1976            } else {
     1977                show_connection_form();
     1978            }
     1979
     1980            // Initialize progress         
    16471981            var fedex_curr = '<?php echo $general_settings['hitshippo_fedex_currency']; ?>';
    16481982            var woo_curr = '<?php echo $general_settings['hitshippo_fedex_woo_currency']; ?>';
     
    16682002                }
    16692003            });
    1670             if ('#checkAll') {
    1671                 jQuery('#checkAll').on('click', function() {
    1672                     jQuery('.fedex_service').each(function() {
    1673                         this.checked = true;
    1674                     });
    1675                 });
    1676             }
    1677             if ('#uncheckAll') {
    1678                 jQuery('#uncheckAll').on('click', function() {
    1679                     jQuery('.fedex_service').each(function() {
    1680                         this.checked = false;
    1681                     });
    1682                 });
    1683             }
     2004
     2005
     2006
    16842007
    16852008            if (fedex_curr != null && fedex_curr == woo_curr) {
     
    17642087            }
    17652088
    1766 
     2089            // Services management for Rates section
     2090            // Store all carrier data
     2091            var allCarriers = <?php echo json_encode($_carriers); ?>;
     2092           
     2093            // Initialize WooCommerce enhanced select (Select2/SelectWoo)
     2094            function initEnhancedSelect() {
     2095                var selectElement = jQuery('#disabled_services_select');
     2096                if (!selectElement.length) return;
     2097
     2098                var options = {
     2099                    placeholder: selectElement.data('placeholder') || 'Search and select services...',
     2100                    width: '100%',
     2101                    closeOnSelect: false
     2102                };
     2103
     2104                var initSelect = function() {
     2105                    try {
     2106                        if (typeof jQuery.fn.selectWoo !== 'undefined') {
     2107                            selectElement.selectWoo(options);
     2108                        } else if (typeof jQuery.fn.select2 !== 'undefined') {
     2109                            selectElement.select2(options);
     2110                        }
     2111                    } catch (e) {
     2112                        console.error("Error initializing selectWoo/select2:", e);
     2113                    }
     2114                };
     2115
     2116                // Destroy if already initialized to apply new settings
     2117                if (selectElement.data('select2') || selectElement.data('selectWoo')) {
     2118                    if (typeof selectElement.selectWoo === 'function') {
     2119                        selectElement.selectWoo('destroy');
     2120                    }
     2121                    if (typeof selectElement.select2 === 'function') {
     2122                        selectElement.select2('destroy');
     2123                    }
     2124                }
     2125               
     2126                initSelect();
     2127
     2128
     2129            }
     2130           
     2131            // Function to reinitialize when card is expanded
     2132            function checkAndInitSelect() {
     2133                var card5 = jQuery('#card-5');
     2134                if (card5.length && card5.find('.card-content').hasClass('expanded')) {
     2135                    // Card is visible, try to initialize
     2136                    setTimeout(initEnhancedSelect, 200);
     2137                }
     2138            }
     2139           
     2140            // Try to trigger WooCommerce's automatic initialization
     2141            jQuery('body').trigger('wc-enhanced-select-init');
     2142           
     2143            // Initialize when document is ready
     2144            jQuery(document).ready(function() {
     2145                setTimeout(initEnhancedSelect, 100);
     2146            });
     2147           
     2148            // Also initialize when card 5 is expanded
     2149            jQuery(document).on('click', '#card-5 .card-header', function() {
     2150                setTimeout(initEnhancedSelect, 300);
     2151            });
     2152           
     2153            // Try again after a longer delay if still not initialized
     2154            setTimeout(function() {
     2155                var selectElement = jQuery('#disabled_services_select');
     2156                if (selectElement.length && !selectElement.data('select2') && !selectElement.data('selectWoo')) {
     2157                    initEnhancedSelect();
     2158                }
     2159            }, 1500);
     2160           
     2161            // Update service counts
     2162            function updateServiceCounts() {
     2163                var enabledCount = jQuery('#enabled_services_tbody .enabled-service-row').length;
     2164                var disabledCount = jQuery('#disabled_services_select option').length;
     2165               
     2166                jQuery('#enabled-count').text(enabledCount);
     2167                jQuery('#disabled-count').text(disabledCount);
     2168            }
     2169           
     2170            // Show success message
     2171            function showSuccessMessage(serviceName) {
     2172                var messageBox = jQuery('#service-success-message');
     2173                var messageText = jQuery('#success-message-text');
     2174               
     2175                messageText.text(serviceName);
     2176                messageBox.fadeIn(300);
     2177               
     2178                // Hide after 5 seconds
     2179                setTimeout(function() {
     2180                    messageBox.fadeOut(300);
     2181                }, 5000);
     2182            }
     2183           
     2184            // Check if table has services and show/hide message
     2185            function updateNoServicesMessage() {
     2186                var hasServices = jQuery('#enabled_services_tbody .enabled-service-row').length > 0;
     2187                if (hasServices) {
     2188                    jQuery('#no-services-message').hide();
     2189                    jQuery('#enabled_services_table').show();
     2190                } else {
     2191                    jQuery('#no-services-message').show();
     2192                    jQuery('#enabled_services_table').hide();
     2193                }
     2194            }
     2195           
     2196            // Initialize
     2197            updateNoServicesMessage();
     2198            updateServiceCounts();
     2199           
     2200            // Function to add selected service
     2201            function addSelectedService() {
     2202                var selectElement = jQuery('#disabled_services_select');
     2203               
     2204                // Ensure Select2 is initialized
     2205                if (!selectElement.data('select2') && !selectElement.data('selectWoo')) {
     2206                    initEnhancedSelect();
     2207                }
     2208               
     2209                var selectedServices = selectElement.val();
     2210               
     2211                if (selectedServices && selectedServices.length > 0) {
     2212                    var serviceNames = [];
     2213                    selectedServices.forEach(function(selectedService) {
     2214                        var selectedOption = selectElement.find('option[value="' + selectedService + '"]');
     2215                        serviceNames.push(selectedOption.text());
     2216                        addServiceToTable(selectedService);
     2217                        selectedOption.remove();
     2218                    });
     2219                   
     2220                    selectElement.val(null).trigger('change');
     2221                   
     2222                    updateServiceCounts();
     2223                   
     2224                    showSuccessMessage(serviceNames.join(', '));
     2225                   
     2226                } else {
     2227                    alert('Please select one or more services from the dropdown.');
     2228                }
     2229            }
     2230           
     2231            // Handle adding service from dropdown via button
     2232            jQuery('#add-selected-service').on('click', function() {
     2233                addSelectedService();
     2234            });
     2235
     2236
     2237           
     2238            // Allow Enter key to enable service when dropdown is focused
     2239            jQuery('#disabled_services_select').on('keydown', function(e) {
     2240                if (e.key === 'Enter' || e.keyCode === 13) {
     2241                    e.preventDefault();
     2242                    addSelectedService();
     2243                }
     2244            });
     2245           
     2246            // Add service to table
     2247            function addServiceToTable(serviceKey) {
     2248                // Check if already in table
     2249                if (jQuery('#enabled_services_tbody tr[data-service-key="' + serviceKey + '"]').length > 0) {
     2250                    return;
     2251                }
     2252               
     2253                var serviceName = allCarriers[serviceKey];
     2254                if (!serviceName) return;
     2255               
     2256                var tbody = jQuery('#enabled_services_tbody');
     2257                var sectionHeader = '';
     2258                var insertPosition = null;
     2259               
     2260                // Determine section based on service key
     2261                var isDomestic = ['FIRST_OVERNIGHT', 'PRIORITY_OVERNIGHT', 'STANDARD_OVERNIGHT', 'FEDEX_2_DAY_AM', 'FEDEX_2_DAY', 'SAME_DAY', 'SAME_DAY_CITY', 'SAME_DAY_METRO_AFTERNOON', 'SAME_DAY_METRO_MORNING', 'SAME_DAY_METRO_RUSH', 'FEDEX_EXPRESS_SAVER', 'GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'FEDEX_1_DAY_FREIGHT', 'FEDEX_2_DAY_FREIGHT', 'FEDEX_3_DAY_FREIGHT', 'SMART_POST', 'FEDEX_FIRST_FREIGHT', 'FEDEX_FREIGHT_ECONOMY', 'FEDEX_FREIGHT_PRIORITY', 'FEDEX_DISTANCE_DEFERRED', 'FEDEX_NEXT_DAY_EARLY_MORNING', 'FEDEX_NEXT_DAY_MID_MORNING', 'FEDEX_NEXT_DAY_AFTERNOON', 'FEDEX_NEXT_DAY_END_OF_DAY', 'FEDEX_NEXT_DAY_FREIGHT', 'FEDEX_REGIONAL_ECONOMY', 'FEDEX_REGIONAL_ECONOMY_DIST', 'FEDEX_REGIONAL_FIRST', 'FEDEX_REGIONAL_GROUND', 'FEDEX_REGIONAL_PRIORITY', 'FEDEX_REGIONAL_PRIORITY_DIST', 'FEDEX_REGIONAL_PRIORITY_EXPRESS', 'FEDEX_REGIONAL_PRIORITY_EXPRESS_DIST', 'FEDEX_REGIONAL_PRIORITY_PLUS', 'FEDEX_REGIONAL_PRIORITY_PLUS_DIST', 'FEDEX_REGIONAL_ECONOMY_FREIGHT', 'FEDEX_REGIONAL_PRIORITY_FREIGHT'].indexOf(serviceKey) !== -1;
     2262               
     2263                var isInternational = ['INTERNATIONAL_ECONOMY', 'INTERNATIONAL_ECONOMY_DISTRIBUTION', 'INTERNATIONAL_FIRST', 'INTERNATIONAL_GROUND', 'INTERNATIONAL_PRIORITY', 'INTERNATIONAL_PRIORITY_DISTRIBUTION', 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', 'INTERNATIONAL_PRIORITY_EXPRESS', 'FEDEX_INTERNATIONAL_PRIORITY_PLUS', 'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS', 'FEDEX_INTERNATIONAL_PRIORITY', 'FEDEX_INTERNATIONAL_CONNECT_PLUS', 'INTERNATIONAL_DISTRIBUTION_FREIGHT', 'FEDEX_CARGO_INTERNATIONAL_EXPRESS_FREIGHT', 'FEDEX_CARGO_INTERNATIONAL_PREMIUM', 'INTERNATIONAL_ECONOMY_FREIGHT', 'INTERNATIONAL_PRIORITY_FREIGHT'].indexOf(serviceKey) !== -1;
     2264               
     2265                // Check if section header exists, if not create it
     2266                if (isDomestic && tbody.find('tr:contains("DOMESTIC SERVICES")').length == 0) {
     2267                    sectionHeader = '<tr class="section-header"><td colspan="3" style="padding:15px; background: #f9f9f9; border: 1px solid #ddd;"><strong>DOMESTIC SERVICES</strong><br><small style="color: #666;">These all are the services provided by FedEx to ship domestic.</small></td></tr>';
     2268                } else if (isInternational && tbody.find('tr:contains("INTERNATIONAL SERVICES")').length == 0) {
     2269                    sectionHeader = '<tr class="section-header"><td colspan="3" style="padding:15px; background: #f9f9f9; border: 1px solid #ddd;"><strong>INTERNATIONAL SERVICES</strong><br><small style="color: #666;">These all are the services provided by FedEx to ship internationally.</small></td></tr>';
     2270                } else if (!isDomestic && !isInternational && tbody.find('tr:contains("OTHER SPECIAL SERVICES")').length == 0) {
     2271                    sectionHeader = '<tr class="section-header"><td colspan="3" style="padding:15px; background: #f9f9f9; border: 1px solid #ddd;"><strong>OTHER SPECIAL SERVICES</strong></td></tr>';
     2272                }
     2273               
     2274                // Create row
     2275                var row = '<tr class="enabled-service-row" data-service-key="' + serviceKey + '">' +
     2276                    '<td style="padding: 10px; border: 1px solid #ddd;">' +
     2277                    '<input type="hidden" name="hitshippo_fedex_carrier[' + serviceKey + ']" value="yes">' +
     2278                    '<small>' + serviceName + ' - [' + serviceKey + ']</small>' +
     2279                    '</td>' +
     2280                    '<td style="padding: 10px; border: 1px solid #ddd;">' +
     2281                    '<input type="text" name="hitshippo_fedex_carrier_name[' + serviceKey + ']" value="" style="width: 100%; padding: 5px;">' +
     2282                    '</td>' +
     2283                    '<td style="padding: 10px; border: 1px solid #ddd; text-align: center;">' +
     2284                    '<button type="button" class="button button-small remove-service" data-service-key="' + serviceKey + '" data-service-name="' + serviceName + '">Remove</button>' +
     2285                    '</td>' +
     2286                    '</tr>';
     2287               
     2288                // Find where to insert
     2289                if (sectionHeader) {
     2290                    // Insert section header and row at the beginning or after appropriate section
     2291                    if (isDomestic) {
     2292                        tbody.prepend(sectionHeader + row);
     2293                    } else if (isInternational) {
     2294                        var domesticSection = tbody.find('tr:contains("DOMESTIC SERVICES")');
     2295                        if (domesticSection.length > 0) {
     2296                            domesticSection.closest('tr').after(sectionHeader + row);
     2297                        } else {
     2298                            tbody.prepend(sectionHeader + row);
     2299                        }
     2300                    } else {
     2301                        // Special services go at the end
     2302                        tbody.append(sectionHeader + row);
     2303                    }
     2304                } else {
     2305                    // Find the appropriate section to add to
     2306                    if (isDomestic) {
     2307                        var domesticRows = tbody.find('tr.enabled-service-row').filter(function() {
     2308                            var key = jQuery(this).data('service-key');
     2309                            return ['FIRST_OVERNIGHT', 'PRIORITY_OVERNIGHT', 'STANDARD_OVERNIGHT', 'FEDEX_2_DAY_AM', 'FEDEX_2_DAY', 'SAME_DAY', 'SAME_DAY_CITY', 'SAME_DAY_METRO_AFTERNOON', 'SAME_DAY_METRO_MORNING', 'SAME_DAY_METRO_RUSH', 'FEDEX_EXPRESS_SAVER', 'GROUND_HOME_DELIVERY', 'FEDEX_GROUND', 'FEDEX_1_DAY_FREIGHT', 'FEDEX_2_DAY_FREIGHT', 'FEDEX_3_DAY_FREIGHT', 'SMART_POST', 'FEDEX_FIRST_FREIGHT', 'FEDEX_FREIGHT_ECONOMY', 'FEDEX_FREIGHT_PRIORITY', 'FEDEX_DISTANCE_DEFERRED', 'FEDEX_NEXT_DAY_EARLY_MORNING', 'FEDEX_NEXT_DAY_MID_MORNING', 'FEDEX_NEXT_DAY_AFTERNOON', 'FEDEX_NEXT_DAY_END_OF_DAY', 'FEDEX_NEXT_DAY_FREIGHT', 'FEDEX_REGIONAL_ECONOMY', 'FEDEX_REGIONAL_ECONOMY_DIST', 'FEDEX_REGIONAL_FIRST', 'FEDEX_REGIONAL_GROUND', 'FEDEX_REGIONAL_PRIORITY', 'FEDEX_REGIONAL_PRIORITY_DIST', 'FEDEX_REGIONAL_PRIORITY_EXPRESS', 'FEDEX_REGIONAL_PRIORITY_EXPRESS_DIST', 'FEDEX_REGIONAL_PRIORITY_PLUS', 'FEDEX_REGIONAL_PRIORITY_PLUS_DIST', 'FEDEX_REGIONAL_ECONOMY_FREIGHT', 'FEDEX_REGIONAL_PRIORITY_FREIGHT'].indexOf(key) !== -1;
     2310                        });
     2311                        if (domesticRows.length > 0) {
     2312                            domesticRows.last().after(row);
     2313                        } else {
     2314                            tbody.find('tr:contains("DOMESTIC SERVICES")').after(row);
     2315                        }
     2316                    } else if (isInternational) {
     2317                        var intlRows = tbody.find('tr.enabled-service-row').filter(function() {
     2318                            var key = jQuery(this).data('service-key');
     2319                            return ['INTERNATIONAL_ECONOMY', 'INTERNATIONAL_ECONOMY_DISTRIBUTION', 'INTERNATIONAL_FIRST', 'INTERNATIONAL_GROUND', 'INTERNATIONAL_PRIORITY', 'INTERNATIONAL_PRIORITY_DISTRIBUTION', 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', 'INTERNATIONAL_PRIORITY_EXPRESS', 'FEDEX_INTERNATIONAL_PRIORITY_PLUS', 'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS', 'FEDEX_INTERNATIONAL_PRIORITY', 'FEDEX_INTERNATIONAL_CONNECT_PLUS', 'INTERNATIONAL_DISTRIBUTION_FREIGHT', 'FEDEX_CARGO_INTERNATIONAL_EXPRESS_FREIGHT', 'FEDEX_CARGO_INTERNATIONAL_PREMIUM', 'INTERNATIONAL_ECONOMY_FREIGHT', 'INTERNATIONAL_PRIORITY_FREIGHT'].indexOf(key) !== -1;
     2320                        });
     2321                        if (intlRows.length > 0) {
     2322                            intlRows.last().after(row);
     2323                        } else {
     2324                            tbody.find('tr:contains("INTERNATIONAL SERVICES")').after(row);
     2325                        }
     2326                    } else {
     2327                        tbody.append(row);
     2328                    }
     2329                }
     2330               
     2331                updateNoServicesMessage();
     2332                updateServiceCounts();
     2333            }
     2334           
     2335            // Handle removing services from table
     2336            jQuery(document).on('click', '.remove-service', function() {
     2337                var serviceKey = jQuery(this).data('service-key');
     2338                var serviceName = jQuery(this).data('service-name');
     2339                var selectElement = jQuery('#disabled_services_select');
     2340               
     2341                // Remove from table
     2342                jQuery(this).closest('tr').remove();
     2343               
     2344                // Add back to dropdown
     2345                var option = jQuery('<option></option>').attr('value', serviceKey).text(serviceName + ' - [' + serviceKey + ']');
     2346                selectElement.append(option);
     2347               
     2348                // Sort dropdown options alphabetically
     2349                var options = selectElement.find('option');
     2350                options.sort(function(a, b) {
     2351                    return jQuery(a).text() > jQuery(b).text() ? 1 : -1;
     2352                });
     2353                selectElement.empty().append(options);
     2354               
     2355                // Update Select2/SelectWoo if initialized
     2356                if (selectElement.data('select2') || selectElement.data('selectWoo')) {
     2357                    selectElement.trigger('change.select2').trigger('change.selectWoo');
     2358                } else {
     2359                    // If not initialized, try to initialize it
     2360                    initEnhancedSelect();
     2361                }
     2362               
     2363                // Update counts and messages
     2364                updateServiceCounts();
     2365                updateNoServicesMessage();
     2366            });
     2367           
     2368            // Initial check
     2369
     2370            jQuery('#shipi-connect-form .shipi-button').on('click', function(e) {
     2371                e.preventDefault();
     2372                var button = jQuery(this);
     2373                var formContainer = jQuery('#shipi-connect-form');
     2374                var messageDiv = jQuery('#shipi-message');
     2375                messageDiv.html('').removeClass('message-success message-error');
     2376
     2377                var data = {
     2378                    action: 'shipi_connect_ajax',
     2379                    shipi_connection_username: formContainer.find('input[name="shipi_connection_username"]').val(),
     2380                    shipi_connection_password: formContainer.find('input[name="shipi_connection_password"]').val()
     2381                };
     2382
     2383                jQuery.ajax({
     2384                    type: 'POST',
     2385                    url: '<?php echo plugin_dir_url( __FILE__ ) . '../shipi_ajax_handler.php'; ?>',
     2386                    data: data,
     2387                    dataType: 'json',
     2388                    beforeSend: function() {
     2389                        button.prop('disabled', true).text('Connecting...');
     2390                        messageDiv.html('<p>Connecting to Shipi...</p>').removeClass('message-success message-error');
     2391                    },
     2392                    success: function(response) {
     2393                        if (response.status === 'success') {
     2394                            messageDiv.html('<p class="message-success">' + response.message + '</p>');
     2395                            setTimeout(function() {
     2396                                location.reload();
     2397                            }, 2000);
     2398                        } else {
     2399                            messageDiv.html('<p class="message-error">' + response.message + '</p>');
     2400                            button.prop('disabled', false).text('Connect or Create Account');
     2401                        }
     2402                    },
     2403                    error: function(jqXHR, textStatus, errorThrown) {
     2404                        console.log(jqXHR);
     2405                        console.log(textStatus);
     2406                        console.log(errorThrown);
     2407                        messageDiv.html('<p class="message-error">An unexpected error occurred during the AJAX request. Check the browser console for more details.</p>');
     2408                        button.prop('disabled', false).text('Connect or Create Account');
     2409                    }
     2410                });
     2411            });
    17672412        });
    17682413
     
    18962541               
    18972542        });
    1898            jQuery(document).ready(function() {
    1899             jQuery("input[name='shipo_link_type']").change(function() {
    1900             if (jQuery(this).val() == "WITHOUT") {
    1901                 jQuery(".without_shipo_acc").show();
    1902                 jQuery(".with_shipo_acc").hide();
    1903             } else if (jQuery(this).val() == "WITH") {
    1904                 jQuery(".without_shipo_acc").hide();
    1905                 jQuery(".with_shipo_acc").show();
    1906             }
    1907         });
    1908     });
     2543
    19092544    jQuery(document).ready(function(){
    19102545        jQuery.getJSON('<?php echo plugin_dir_url( __FILE__ ); ?>/data/countries.json', function(countryData){
     
    19562591</script>
    19572592<!--End of Tawk.to Script-->
     2593<script type="text/javascript">
     2594jQuery(document).ready(function($) {
     2595    function initializeMultiSelect() {
     2596        if ($.fn.select2) {
     2597            var selectElement = $('#disabled_services_select');
     2598
     2599            // Destroy previous instance if it exists to ensure clean initialization
     2600            if (selectElement.hasClass('select2-hidden-accessible')) {
     2601                selectElement.select2('destroy');
     2602            }
     2603
     2604            selectElement.select2({
     2605                placeholder: "Click to search and select services...",
     2606                width: '100%',
     2607                closeOnSelect: false
     2608            });
     2609
     2610            selectElement.on('select2:open', function () {
     2611                setTimeout(function() {
     2612                    if ($('.select2-dropdown .select-all-buttons').length === 0) {
     2613                        $('.select2-dropdown').prepend(
     2614
     2615                        );
     2616                    }
     2617                }, 50);
     2618            });
     2619        } else {
     2620            console.error("Select2 is not loaded, retrying...");
     2621            setTimeout(initializeMultiSelect, 500); // Retry if select2 is not loaded
     2622        }
     2623    }
     2624
     2625    // Delegated handlers for the new buttons
     2626   
     2627
     2628    // Initial attempt to initialize
     2629    initializeMultiSelect();
     2630
     2631    // Re-initialize when the containing card is clicked/expanded
     2632    $(document).on('click', '#card-5 .card-header', function() {
     2633        setTimeout(initializeMultiSelect, 300);
     2634    });
     2635});
     2636</script>
  • a2z-fedex-shipping/trunk/readme.txt

    r3351656 r3397765  
    55Tested up to: 6.8
    66Requires PHP: 5.6
    7 Stable tag: 5.0.10
     7Stable tag: 5.1.0
    88License: GPLv3 or later License
    99URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    159159
    160160== Changelog ==
     161= 5.1.0 =
     162    > Config page redesigned and bug fixes.
    161163= 5.0.10 =
    162164    > [Bug Fix] Virtual product issue is fixed.
Note: See TracChangeset for help on using the changeset viewer.