<?php
/*
Template Name: DHL WMS Integration
*/

get_header('new');
?>

<section class="section banner supply-chain-banner pb-5 no-lazy">
    <div class="container">
        <div class="row mt-xl-5 mt-lg-0">
            <div class="col-lg-6">
                <div class="text-cont mt-0">
                    <h1 class="banner-heading"><?php echo get_field('banner_heading'); ?></h1>
                    <p class="banner-content">
                        <?php echo get_field('banner_description'); ?>
                    </p>
					<?php $highlights = get_field('banner_highlights'); ?>
                    <ul>
                        <?php if ($highlights && is_array($highlights)) : ?>
                            <?php foreach ($highlights as $highlight) : ?>
                                <li>
                                    <img src="<?php echo get_template_directory_uri(); ?>/assets/img/apparel-inventory-management/tick.webp" alt="tick" class="img-fluid">
                                    <?php echo $highlight['item']; ?>
                                </li>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </ul>
                    <div class="banner-btns">
						<?php $cta_1 = get_field('banner_cta_1'); ?>
						 <?php if (!is_null($cta_1)) : ?>
                        <a href="<?php echo esc_url($cta_1['url']); ?>" class="primary animated-cta-btn <?php echo is_modal_link($cta_1['url']); ?>"><?php echo $cta_1['title']; ?></a>
						<?php endif; ?>
						<?php $cta_2 = get_field('banner_cta_2'); ?>
						<?php if (!is_null($cta_2)) : ?>
                        <a href="<?php echo esc_url($cta_2['url']); ?>" class="border-gradient-btn animated-btn <?php echo is_modal_link($cta_2['url']); ?>"><?php echo $cta_2['title']; ?>
                            <svg width="14" height="11" viewBox="0 0 14 11" fill="none" xmlns="http://www.w3.org/2000/svg">
                                <path d="M5.35816 0.0996094H7.95016L13.3502 5.49961L7.95016 10.8996H5.35816L9.82216 6.43561H0.660156V4.56361H9.82216L5.35816 0.0996094Z" fill="black"/>
                            </svg>
                        </a>
						<?php endif; ?>
                    </div>
                </div>
            </div>
            <div class="col-lg-6">
                <div class="img-cont">
					<?php
	$desktop_img_url = get_field('banner_image');
	$mobile_img_url  = get_field('banner_mobile_image');
?>
    <picture>
        <source class="no-lazy" media="(max-width: 767px)" srcset="<?php echo $mobile_img_url ? $mobile_img_url : $desktop_img_url ?>">
        <img src="<?php echo $desktop_img_url;?>" loading="eager" fetchpriority="high" decoding="async" width="636" height="490" class="img-fluid no-lazy" alt="<?php echo strip_tags(get_field('banner_heading')); ?>">
    </picture>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- Certifications section start -->
<?php get_template_part('templates-parts/pages/certificates');?>
<!-- Certifications section end -->


<!-- Benefits of DHL Integration Section Start -->
<section class="section benefits-dhl-integration bg-white pt-0">
  <div class="container">
    <div class="benefits-dhl-integration-wrapper">
      <div class="row">

        <div class="col-xl-8">
          <div class="workflow-left">

            <?php if ($title = get_field('benefits_of_dhl_integration_section_title')): ?>
              <h2 class="section-title text-center text-xl-start">
                <?php echo $title; ?>
              </h2>
            <?php endif; ?>

            <?php if ($desc = get_field('benefits_of_dhl_integration_section_text')): ?>
              <p class="section-content text-center text-xl-start mt-2 mt-lg-3">
                <?php echo $desc; ?>
              </p>
            <?php endif; ?>

            <?php if (have_rows('benefits_of_dhl_integration_cards_repeater')): ?>
              <div class="workflow-cards">
                <div class="row justify-content-center gy-3">

                  <?php while (have_rows('benefits_of_dhl_integration_cards_repeater')): the_row();
                    $icon  = get_sub_field('benefits_of_dhl_integration_card_icon'); // SVG/Text
                    $ctitle = get_sub_field('benefits_of_dhl_integration_card_title');
                    $ctext  = get_sub_field('benefits_of_dhl_integration_card_text');
                  ?>
                    <div class="col-md-6 col-lg-4">
                      <div class="workflow-card">

                        <?php if (!empty($icon)): ?>
                          <div class="workflow-icon">
                            <?php echo $icon; ?>
                          </div>
                        <?php endif; ?>

                        <?php if (!empty($ctitle)): ?>
                          <h3 class="workflow-card-title"><?php echo $ctitle; ?></h3>
                        <?php endif; ?>

                        <?php if (!empty($ctext)): ?>
                          <p class="workflow-card-desc"><?php echo $ctext; ?></p>
                        <?php endif; ?>

                      </div>
                    </div>
                  <?php endwhile; ?>

                </div>
              </div>
            <?php endif; ?>

            <?php if ($btn = get_field('benefits_of_dhl_integration_section_button')): ?>
              <div class="demo-btn-wrapper text-center text-xl-start mt-4 mt-lg-5">
                <a href="<?php echo esc_url($btn['url']); ?>" class="primary animated-cta-btn">
                  <?php echo $btn['title']; ?>
                </a>
              </div>
            <?php endif; ?>

          </div>
        </div>

        <div class="col-xl-4">
          <?php if ($img = get_field('benefits_of_dhl_integration_section_image')): ?>
            <div class="workflow-img d-none d-xl-block">
              <img src="<?php echo $img; ?>" loading="lazy" class="img-fluid" alt="<?php echo wp_strip_all_tags($title); ?>">
            </div>
          <?php endif; ?>
        </div>

      </div>
    </div>
  </div>
</section>
<!-- Benefits of DHL Integration Section End -->


<!-- Dhl Integration Features Section Start -->
<section class="section dhl-integration-features bg-tertiary">
  <div class="container">

    <div class="text-cont">
      <?php if ($title = get_field('dhl_wms_ss_features_section_title')): ?>
        <h2 class="section-title text-center">
          <?php echo $title; ?>
        </h2>
      <?php endif; ?>

      <?php if ($text = get_field('dhl_wms_ss_features_section_text')): ?>
        <p class="section-content mt-2 mt-lg-3 text-center">
          <?php echo $text; ?>
        </p>
      <?php endif; ?>
    </div>

    <?php if (have_rows('dhl_wms_ss_features_section_cards')): ?>
      <div class="dhl-integration-features-wrapper">
        <div class="row gy-4">

          <?php while (have_rows('dhl_wms_ss_features_section_cards')): the_row();
            $icon  = get_sub_field('dhl_wms_ss_features_section_card_icon'); // SVG/Text
            $ctitle = get_sub_field('dhl_wms_ss_features_section_card_title');
            $cdesc  = get_sub_field('dhl_wms_ss_features_section_card_text');
          ?>
            <div class="col-lg-4 col-md-6">
              <div class="shipping-labels-card">

                <?php if (!empty($icon)): ?>
                  <div class="shipping-labels-icon-wrap">
                    <?php echo $icon; ?>
                  </div>
                <?php endif; ?>

                <?php if (!empty($ctitle)): ?>
                  <h3 class="shipping-labels-title"><?php echo $ctitle; ?></h3>
                <?php endif; ?>

                <?php if (!empty($cdesc)): ?>
                  <p class="shipping-labels-desc"><?php echo $cdesc; ?></p>
                <?php endif; ?>

              </div>
            </div>
          <?php endwhile; ?>

        </div>
      </div>
    <?php endif; ?>

    <?php if ($btn = get_field('dhl_wms_ss_features_section_button')): ?>
      <div class="demo-btn-wrapper text-center mt-4 mt-lg-5">
        <a href="<?php echo esc_url($btn['url']); ?>" class="primary animated-cta-btn">
          <?php echo $btn['title']; ?>
        </a>
      </div>
    <?php endif; ?>

  </div>
</section>
<!-- Dhl Integration Features Section End -->


<!-- Dhl Integration How It Works Section Start -->
<section class="section dhl-shipping-integration-works bg-white">
  <div class="container">

    <div class="row justify-content-between">
      <div class="col-lg-6 col-xl-6">
        <div class="text-cont">
          <h2 class="section-title text-center text-lg-start">
            <?php echo get_field('dhl_shipping_integration_for_wms_section_title'); ?>
          </h2>
        </div>
      </div>

      <div class="col-lg-6 col-xl-5">
        <div class="text-cont">
          <p class="section-content text-center text-lg-start">
            <?php echo get_field('dhl_shipping_integration_for_wms_section_text'); ?>
          </p>
        </div>
      </div>
    </div>

    <div class="dhl-shipping-accordion-wrapper">
      <div class="row align-items-center">

        <!-- Left Image -->
        <div class="col-lg-6 order-xl-1 order-lg-1 order-md-2 order-sm-2 order-2">
          <div class="img-content">
            <?php
              $first_image = '';
              $rows = get_field('dhl_shipping_integration_for_wms_section_tabs');

              if (!empty($rows) && !empty($rows[0]['dhl_shipping_integration_for_wms_section_tab_image'])) {
                // Image is URL string
                $first_image = $rows[0]['dhl_shipping_integration_for_wms_section_tab_image'];
              }
            ?>
            <img
              id="dhl-tab-image"
              src="<?php echo esc_url($first_image); ?>"
              alt="idea-generation"
              class="img-fluid"
              loading="lazy"
            >
          </div>
        </div>

        <!-- Accordion -->
        <div class="col-lg-6 order-xl-2 order-lg-2 order-md-1 order-sm-1 order-1">
          <div class="accordion" id="accordionExample2">

            <?php if (have_rows('dhl_shipping_integration_for_wms_section_tabs')) :
              $i = 1;
              while (have_rows('dhl_shipping_integration_for_wms_section_tabs')) : the_row();

                $tab_title = get_sub_field('dhl_shipping_integration_for_wms_section_tab_title');
                $tab_text  = get_sub_field('dhl_shipping_integration_for_wms_section_tab_text');
                $tab_image = get_sub_field('dhl_shipping_integration_for_wms_section_tab_image'); // URL string

                $heading_id  = 'heading' . $i;
                $collapse_id = 'collapse' . $i;
                $is_first = ($i === 1);
            ?>

              <div class="accordion-item">
                <h2 class="accordion-header" id="<?php echo esc_attr($heading_id); ?>">
                  <button
                    class="accordion-button <?php echo $is_first ? '' : 'collapsed'; ?>"
                    type="button"
                    data-bs-toggle="collapse"
                    data-bs-target="#<?php echo esc_attr($collapse_id); ?>"
                    aria-expanded="<?php echo $is_first ? 'true' : 'false'; ?>"
                    aria-controls="<?php echo esc_attr($collapse_id); ?>"
                    data-img="<?php echo esc_url($tab_image); ?>"
                  >
                    <?php echo $tab_title; ?>
                  </button>
                </h2>

                <div
                  id="<?php echo esc_attr($collapse_id); ?>"
                  class="accordion-collapse collapse <?php echo $is_first ? 'show' : ''; ?>"
                  aria-labelledby="<?php echo esc_attr($heading_id); ?>"
                  data-bs-parent="#accordionExample2"
                >
                  <div class="accordion-body">
                    <p><?php echo $tab_text; ?></p>
                  </div>
                </div>
              </div>

            <?php
              $i++;
              endwhile;
            endif; ?>

          </div>
        </div>

      </div>
    </div>

    <?php
    $button = get_field('dhl_shipping_integration_for_wms_section_button');
    if ($button) : ?>
      <div class="demo-btn-wrapper text-center mt-4 mt-lg-5">
        <a href="<?php echo esc_url($button['url']); ?>" class="primary animated-cta-btn">
          <?php echo $button['title']; ?>
        </a>
      </div>
    <?php endif; ?>

  </div>
</section>
<!-- Dhl Integration How It Works Section End -->


<section class="section dashboard-access-cta dhl-shipping-cta">
    <div class="container">
        <div class="box">
            <div class="row gy-3 gy-lg-0 align-items-center justify-content-between">
                <div class="col-lg-6 col-xl-5">
                    <div class="text-cont">
                        <?php echo get_field('dashboard_access_cta_text');?>
                        <a href="<?php echo get_field('dashboard_access_cta_button_url');?>" class="accent-btn animated-cta-btn"><?php echo get_field('dashboard_access_cta_button_text');?></a>
                    </div>
                </div>
                <div class="col-lg-6 col-xl-6">
                    <div class="img-cont">
                        <img src="<?php echo get_field('dashboard_access_cta_image');?>" alt="cta" class="img-fluid">
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


<section class="section sophisticated-dhl-business bg-tertiary">
    <div class="container">

        <div class="text-cont">
            <h2 class="section-title text-center">
                <?php echo get_field('dhl_integration_for_outstanding_business_section_title'); ?>
            </h2>

            <p class="section-content text-center mt-2 mt-lg-3">
                <?php echo get_field('dhl_integration_for_outstanding_business_section_text'); ?>
            </p>
        </div>

        <div class="row">

            <!-- LEFT: Tabs -->
            <div class="col-lg-5">
                <div class="tabs-panel">
                    <div class="tabs-nav-wrap">
                        <ul class="nav nav-pills flex-column" id="dhlSmartTabs" role="tablist">

                            <?php if (have_rows('dhl_integration_for_outstanding_business_section_tabs')) :
                                $i = 1;
                                while (have_rows('dhl_integration_for_outstanding_business_section_tabs')) : the_row();

                                    $tab_title = get_sub_field('dhl_integration_for_outstanding_business_section_tab_title');
                                    $num = str_pad($i, 2, '0', STR_PAD_LEFT);
                            ?>

                                <li class="nav-item" role="presentation">
                                    <button class="nav-link <?php echo ($i == 1) ? 'active' : ''; ?>"
                                        id="tab-<?php echo $num; ?>"
                                        data-bs-toggle="pill"
                                        data-bs-target="#pane-<?php echo $num; ?>"
                                        type="button"
                                        role="tab">
                                        <span class="tab-num"><?php echo $num; ?></span>
                                        <span class="tab-title"><?php echo $tab_title; ?></span>
                                    </button>
                                </li>

                            <?php 
                                $i++;
                                endwhile;
                            endif; 
                            ?>

                        </ul>
                    </div>
                </div>
            </div>

            <!-- RIGHT: Content -->
            <div class="col-lg-7">
                <div class="tabs-content-panel">
                    <div class="tab-content" id="dhlSmartTabsContent">

                        <?php if (have_rows('dhl_integration_for_outstanding_business_section_tabs')) :
                            $i = 1;
                            while (have_rows('dhl_integration_for_outstanding_business_section_tabs')) : the_row();

                                $tab_text = get_sub_field('dhl_integration_for_outstanding_business_section_tab_text');
                                $tab_btn  = get_sub_field('dhl_integration_for_outstanding_business_section_tab_button');
                                $num = str_pad($i, 2, '0', STR_PAD_LEFT);
                        ?>

                            <div class="tab-pane fade <?php echo ($i == 1) ? 'show active' : ''; ?>"
                                id="pane-<?php echo $num; ?>"
                                role="tabpanel">

                                <p class="tabs-desc">
                                    <?php echo $tab_text; ?>
                                </p>

                                <?php if ($tab_btn) : ?>
                                    <div class="demo-btn-wrapper text-start mt-4 mt-lg-5">
                                        <a href="<?php echo esc_url($tab_btn['url']); ?>"
                                           class="primary animated-cta-btn">
                                            <?php echo $tab_btn['title']; ?>
                                        </a>
                                    </div>
                                <?php endif; ?>

                            </div>

                        <?php 
                            $i++;
                            endwhile;
                        endif; 
                        ?>

                    </div>
                </div>
            </div>

        </div>
    </div>
</section>

<!-- CTA start -->
<?php $ctas = [
    'class' => 'fedex-integration-cta pt-3 pt-lg-5',
    'heading_class' => 'cta-title',
    'para_class' => 'cta-description',
    'col_left_class' => 'col-lg-6',
    'col_right_class' => 'col-lg-6',
	'button_class' => 'accent-btn',
	
]; 
get_template_part('templates-parts/pages/3pl-client-portal-cta',null,$ctas);?>
<!-- CTA end -->


<!-- Dhl Integration Comparison Table START -->
<section class="section dhl-compare-table bg-tertiary">
    <div class="container">
        <div class="text-cont">
            <h2 class="section-title text-center">
                <?php echo get_field('dhl_express_warehouse_integration_table_section_title'); ?>
            </h2>

            <p class="section-content text-center">
                <?php echo get_field('dhl_express_warehouse_integration_table_section_text'); ?>
            </p>
        </div>

        <div class="table-responsive">
            <table class="table align-middle ms-integ-provider-table">

                <?php if (have_rows('dhl_express_warehouse_integration_table_section_table')) : ?>
                    <?php $rowIndex = 0; ?>

                    <?php while (have_rows('dhl_express_warehouse_integration_table_section_table')) : the_row(); ?>
                        <?php if (have_rows('dhl_express_warehouse_integration_table_section_table_row')) : ?>
                            
                            <?php if ($rowIndex == 0) : ?>
                                <thead>
                                    <tr>
                                        <?php while (have_rows('dhl_express_warehouse_integration_table_section_table_row')) : the_row();
                                            $cell_text  = get_sub_field('dhl_express_warehouse_integration_table_section_table_td_text');
                                            $cell_image = get_sub_field('dhl_express_warehouse_integration_table_section_table_td_image');

                                            // image url (simple)
                                            $img_url = '';
                                            if ($cell_image) {
                                                $img_url = is_array($cell_image) ? $cell_image['url'] : $cell_image;
                                            }
                                        ?>
                                            <th>
                                                <?php if ($img_url) : ?>
                                                    <img src="<?php echo $img_url; ?>" class="img-fluid w-100" loading="lazy" alt="">
                                                <?php else : ?>
                                                    <?php echo $cell_text; ?>
                                                <?php endif; ?>
                                            </th>
                                        <?php endwhile; ?>
                                    </tr>
                                </thead>
                                <tbody>

                            <?php else : ?>
                                <tr>
                                    <?php while (have_rows('dhl_express_warehouse_integration_table_section_table_row')) : the_row();
                                        $cell_text  = get_sub_field('dhl_express_warehouse_integration_table_section_table_td_text');
                                        $cell_image = get_sub_field('dhl_express_warehouse_integration_table_section_table_td_image');

                                        $img_url = '';
                                        if ($cell_image) {
                                            $img_url = is_array($cell_image) ? $cell_image['url'] : $cell_image;
                                        }
                                    ?>
                                        <td>
                                            <?php if ($img_url) : ?>
                                                <img src="<?php echo $img_url; ?>" class="img-fluid" loading="lazy" alt="">
                                            <?php else : ?>
                                                <?php echo $cell_text; ?>
                                            <?php endif; ?>
                                        </td>
                                    <?php endwhile; ?>
                                </tr>
                            <?php endif; ?>

                            <?php $rowIndex++; ?>

                        <?php endif; ?>
                    <?php endwhile; ?>

                    </tbody>
                <?php endif; ?>

            </table>
        </div>

        <?php
        $button  = get_field('dhl_express_warehouse_integration_table_section_button'); 
        if ($button) : ?>
            <div class="demo-btn-wrapper text-center mt-4 mt-lg-5">
                <a href="<?php echo $button['url']; ?>" class="primary animated-cta-btn">
                    <?php echo $button['title']; ?>
                </a>
            </div>
        <?php endif; ?>

    </div>
</section>
<!-- Dhl Integration Comparison Table End -->

<!-- pricing section start -->
<?php 
$pricing = [
    'class' => 'supply-chain-pricing-cards pt-5',
    'category' => 'home',
    'headingcon' => 'h2',
];
get_template_part('templates-parts/pages/pricing',null,$pricing)?>
<!-- pricing section end -->


<!-- case studies start -->
<?php 
$portfolio = ['class' => 'bg-white'];
get_template_part('templates-parts/pages/case-studies',null,$portfolio);?>
<!-- case studies end -->


<?php
    $args = [
        'category' => 'dhl-wms-integration',
        'class'    => 'bg-white'
    ];
    get_template_part('templates-parts/pages/faqs-new', null, $args);
?>


<?php
get_footer();
?>


<script>
    $('.about-our-product-slider').owlCarousel({
        loop:false,
        margin:10,
        nav:false,
        dots: false,
        responsive:{
            0:{
                items:1
            },
            600:{
                loop:true,
                items:3
            },
            1000:{
                items:5
            }
        }
    });
    $('.real-feedback-slider').owlCarousel({
        loop:false,
        margin:40,
        nav:false,
        dots:false,
        dotsData:true,
        responsive:{
            0:{
                items:1
            },
            768:{
                items:2,
                margin:20
            },
            1000:{
                items:2
            }
        }
    });
    
</script>

<script>
    jQuery(document).ready(function($) {
        $('.dhl-shipping-integration-works .accordion-button').on('click', function () {
            var newImg = $(this).data('img');
            $('.dhl-shipping-integration-works .img-content img').attr('src', newImg);
        });
    });
</script>