<div class="row">
    <div class="col-md-8"
    x-data="{ enableStep2: <?php echo e(getVendorSettings('facebook_app_id') ? 1 : 0); ?>, enableStep3: <?php echo e(getVendorSettings('whatsapp_access_token') ? 1 : 0); ?> }"
    x-cloak>
    <!-- Page Heading -->
    <h1>
        <?= __tr('WhatsApp Cloud API Setup') ?>
    </h1>
    <div class="accordion" id="whatsAppSetupSettingsBlock">
        <fieldset class="lw-fieldset mb-3"
            x-data="{openForUpdate:false,fbAppIdExists:<?php echo e(getVendorSettings('facebook_app_id') ? 1 : 0); ?>}">
            <legend data-toggle="collapse" data-target="#lwFacebookAppSettings" aria-expanded="true"
                aria-controls="lwFacebookAppSettings"><?php echo __tr('Step 1 : Facebook Developer Account & Facebook App'); ?> <small class="text-muted"><?php echo e(__tr('Click to expand/collapse')); ?></small>
            </legend>
            <div class="collapse <?php echo e(getVendorSettings('facebook_app_id') ? '' : 'show'); ?>" id="lwFacebookAppSettings"
                data-parent="#whatsAppSetupSettingsBlock">
                <!-- whatsapp cloud api setup form -->
                <form id="lwWhatsAppFacebookAppForm" class="lw-ajax-form lw-form"
                    name="whatsapp_setup_facebook_app_form" method="post"
                    action="<?= route('vendor.settings.write.update') ?>">
                    <input type="hidden" name="pageType" value="whatsapp_cloud_api_setup">
                    <!-- set hidden input field with form type -->
                    <input type="hidden" name="form_type" value="whatsapp_setup_facebook_app_form" />
                    <a href="https://developers.facebook.com/docs/whatsapp/cloud-api/get-started#set-up-developer-assets" target="_blank" 
                        class="float-right"><?php echo __tr('Help & More Information'); ?> <i
                            class="fas fa-external-link-alt"></i></a>
                    <p>
                        <?php echo __tr('To get started you should have __facebookApp__, you mostly need to select Business as
                        type of your app.', [
                        '__facebookApp__' => '<strong>' . __tr('Facebook App') . '</strong>',
                        ],
                        ); ?>

                    <div>
                        <a target="_blank" href="https://developers.facebook.com/apps/" class="btn btn-dark"><?php echo e(__tr('Create or Select Facebook App')); ?>

                            <i class="fas fa-external-link-alt"></i></a>
                    </div>
                    </p>
                    <p>
                        <?php echo e(__tr('Once you have the Facebook app, add your App ID below')); ?>

                    </p>
                    <div>
                        <div x-show="!fbAppIdExists">
                            <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['type' => 'text','id' => 'lwFacebookAppId','dataFormGroupClass' => 'col-md-12 col-lg-4','label' => __tr('Facebook App ID'),'name' => 'facebook_app_id','placeholder' => ''.e(getVendorSettings('facebook_app_id') ? __tr('App ID exists, add new to update') : __tr('Your Facebook App ID')).'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'text','id' => 'lwFacebookAppId','data-form-group-class' => 'col-md-12 col-lg-4','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Facebook App ID')),'name' => 'facebook_app_id','placeholder' => ''.e(getVendorSettings('facebook_app_id') ? __tr('App ID exists, add new to update') : __tr('Your Facebook App ID')).'']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                            <div class="form-group mt-3">
                                <!-- Update Button -->
                                <button type="submit" class="btn btn-primary btn-user lw-btn-block-mobile">
                                    <?= __tr('Save') ?>
                                </button>
                                <!-- /Update Button -->
                            </div>
                        </div>
                        <button x-show="fbAppIdExists" @click.prevent="fbAppIdExists = !fbAppIdExists,openForUpdate=true" type="button" class="btn btn-warning"><?php echo e(__tr('Click Here to Update')); ?></button>
                    </div>
                </form>
                <!-- / whatsapp cloud api setup form -->
            </div>
            <div class="badge badge-success py-1 mt-2" x-show="fbAppIdExists"><i class="fa fa-2x fa-check-square"></i>
                <span class="lw-configured-badge"><?php echo e(__tr('Configured')); ?></span></div>
            <div class="badge badge-danger py-1 mt-2" x-show="!fbAppIdExists && !openForUpdate"><i
                    class="fas fa-exclamation-circle fa-2x"></i> <span class="lw-configured-badge"><?php echo e(__tr('Not
                    Configured')); ?></span></div>
        </fieldset>

        <fieldset class="lw-fieldset my-4"
            x-data="{openForUpdate:false,whatsAppSettings:<?php echo e((getVendorSettings('whatsapp_access_token') and !getVendorSettings('whatsapp_access_token_expired')) ? 1 : 0); ?>}">
            <legend data-toggle="collapse" data-target="#lwWhatsAppSettingsBlock" aria-expanded="false"
                aria-controls="lwWhatsAppSettingsBlock"><?php echo __tr('Step 2: WhatsApp Integration Setup'); ?> <small
                    class="text-muted"><?php echo e(__tr('Click to expand/collapse')); ?></small></legend>
            <div class="collapse" :class="(!enableStep2) ? 'lw-disabled-block-content' : ''"
                id="lwWhatsAppSettingsBlock" data-parent="#whatsAppSetupSettingsBlock">
                <p><?php echo e(__tr('Once you created your app you now need to choose WhatsApp from list click on the setup as
                    shown in the below screenshot')); ?>

                <div class="col-12 col-md-3 col-xl-2">
                    <img class="img-fluid" src="https://i.imgur.com/aeDwghR.png"
                        alt="<?php echo e(__tr('WhatsApp Integration')); ?>">
                </div>
                </p>
                <p>
                    <?php echo e(__tr('You may need to select or setup Meta Business Account, once done go to API setup from
                    sidebar
                    under the WhatsApp menu item as shown in the below screenshot')); ?>

                <div class="col-12 col-md-3 col-xl-2">
                    <img class="img-fluid" src="https://i.imgur.com/G4fMiT9.png" alt="<?php echo e(__tr('WhatsApp API Setup')); ?>">
                </div>
                </p>
                <div>
                    <!-- whatsapp cloud api setup form -->
                    <form x-show="!whatsAppSettings" id="lwWhatsAppSetupBusinessForm" class="lw-ajax-form lw-form"
                        name="whatsapp_setup_business_form" method="post"
                        action="<?= route('vendor.settings.write.update') ?>">
                        <input type="hidden" name="pageType" value="whatsapp_cloud_api_setup">
                        <!-- set hidden input field with form type -->
                        <input type="hidden" name="form_type" value="whatsapp_setup_business_form" />
                        <div>
                            <div class="float-right">
                                <a target="_blank" href="https://developers.facebook.com/docs/whatsapp/business-management-api/get-started#1--acquire-an-access-token-using-a-system-user-or-facebook-login"
                                    class=""><?php echo __tr('Help & More Information'); ?> <i
                                        class="fas fa-external-link-alt"></i></a> | <a target="_blank"
                                    href="https://www.cloudperitus.com/blog/whatsapp-cloud-api-integration-generating-permanent-access-token"
                                    class=""><?php echo __tr('External Help'); ?> <i class="fas fa-external-link-alt"></i></a>
                            </div>
                            
                            <?php if(getVendorSettings('whatsapp_access_token_expired')): ?>
                            <div class="alert alert-white border-danger text-danger my-3">
                                <?php echo e(__tr('Your token seems to be expired, Generate new token, prefer creating permanent token')); ?>

                            </div>
                            <?php endif; ?>
                            <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['placeholder' => ''.e(getVendorSettings('whatsapp_access_token') ? __tr('Token exists, add new to update') : __tr('Your Access Token')).'','type' => 'text','id' => 'lwAccessToken','dataFormGroupClass' => 'col-md-12 col-lg-8','label' => __tr('Access Token'),'name' => 'whatsapp_access_token','helpText' => __tr(
                            'You can either use Temporary access token or Permanent Access token, as the Temporary token expires in 24 hours its strongly recommended that you should create Permanent token.',
                        )]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['placeholder' => ''.e(getVendorSettings('whatsapp_access_token') ? __tr('Token exists, add new to update') : __tr('Your Access Token')).'','type' => 'text','id' => 'lwAccessToken','data-form-group-class' => 'col-md-12 col-lg-8','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Access Token')),'name' => 'whatsapp_access_token','helpText' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr(
                            'You can either use Temporary access token or Permanent Access token, as the Temporary token expires in 24 hours its strongly recommended that you should create Permanent token.',
                        ))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                            
                        </div>
                        <div class="alert alert-info mt-4 ">
                            <?php echo e(__tr('You can find following on API Setup page')); ?>

                        </div>
                        <div class="col-md-12 col-lg-4">
                            
                            <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['placeholder' => ''.e(getVendorSettings('whatsapp_business_account_id') ? __tr('ID exists, add new to update') : __tr('Your Business Account ID')).'','type' => 'text','id' => 'lwBusinessAccountId','dataFormGroupClass' => '','label' => __tr('WhatsApp Business Account ID'),'name' => 'whatsapp_business_account_id']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['placeholder' => ''.e(getVendorSettings('whatsapp_business_account_id') ? __tr('ID exists, add new to update') : __tr('Your Business Account ID')).'','type' => 'text','id' => 'lwBusinessAccountId','data-form-group-class' => '','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('WhatsApp Business Account ID')),'name' => 'whatsapp_business_account_id']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                            
                        </div>
                        <div class="col-md-12 col-lg-4">
                            
                            <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['placeholder' => ''.e(getVendorSettings('current_phone_number_number') ? __tr('Number exists, add new to update') : __tr('Your WhatsApp From Phone Number')).'','type' => 'text','id' => 'lwFromPhoneNumber','dataFormGroupClass' => '','label' => __tr('WhatsApp From Phone Number'),'name' => 'current_phone_number_number']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['placeholder' => ''.e(getVendorSettings('current_phone_number_number') ? __tr('Number exists, add new to update') : __tr('Your WhatsApp From Phone Number')).'','type' => 'text','id' => 'lwFromPhoneNumber','data-form-group-class' => '','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('WhatsApp From Phone Number')),'name' => 'current_phone_number_number']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                            
                        </div>
                        <div class="col-md-12 col-lg-4">
                            
                            <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['placeholder' => ''.e(getVendorSettings('current_phone_number_id') ? __tr('ID exists, add new to update') : __tr('Your WhatsApp From Phone Number')).'','type' => 'text','id' => 'lwFromPhoneNumberId','dataFormGroupClass' => '','label' => __tr('From Phone Number ID'),'name' => 'current_phone_number_id']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['placeholder' => ''.e(getVendorSettings('current_phone_number_id') ? __tr('ID exists, add new to update') : __tr('Your WhatsApp From Phone Number')).'','type' => 'text','id' => 'lwFromPhoneNumberId','data-form-group-class' => '','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('From Phone Number ID')),'name' => 'current_phone_number_id']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                            
                        </div>
                        <div class="form-group mt-3">
                            <!-- Update Button -->
                            <button type="submit" class="btn btn-primary btn-user lw-btn-block-mobile">
                                <?= __tr('Save') ?>
                            </button>
                            <!-- /Update Button -->
                        </div>
                    </form>
                    <button x-show="whatsAppSettings"
                        @click.prevent="whatsAppSettings = !whatsAppSettings, openForUpdate = true" type="button"
                        class="btn btn-warning"><?php echo e(__tr('Click here to Update')); ?></button>
                </div>
            </div>
            <div class="badge badge-success py-1 mt-2" x-show="whatsAppSettings"><i
                    class="fa fa-2x fa-check-square"></i> <span class="lw-configured-badge"><?php echo e(__tr('Configured')); ?></span></div>
            <div class="badge badge-danger py-1 mt-2" x-show="!whatsAppSettings && !openForUpdate"><i
                    class="fas fa-exclamation-circle fa-2x"></i> <span class="lw-configured-badge"><?php echo e(__tr('Not
                    Configured')); ?></span></div>
        </fieldset>
        <fieldset class="lw-fieldset mb-3"
            x-data="{isWebhookVerified: <?php echo e(getVendorSettings('webhook_verified_at') ? 1 : 0); ?>}">
            <legend data-toggle="collapse" data-target="#lwWhatsAppWebhookSettings" aria-expanded="false"
                aria-controls="lwWhatsAppWebhookSettings"><?php echo __tr('Step 3 : Setup Webhook'); ?> <small
                    class="text-muted"><?php echo e(__tr('Click to expand/collapse')); ?></small></legend>
            <div class="collapse" :class="(!enableStep3) ? 'lw-disabled-block-content' : ''"
                id="lwWhatsAppWebhookSettings" data-parent="#whatsAppSetupSettingsBlock">
                <!-- whatsapp cloud api setup form -->
                <form id="lwWhatsAppWebhookSetup" class="lw-ajax-form lw-form" name="whatsapp_setup_webhook"
                    method="post" action="<?= route('vendor.settings.write.update') ?>">
                    <input type="hidden" name="pageType" value="whatsapp_cloud_api_setup">
                    <!-- set hidden input field with form type -->
                    <input type="hidden" name="form_type" value="whatsapp_setup_webhook" />
                    <a target="_blank"
                        href="https://developers.facebook.com/docs/whatsapp/cloud-api/get-started#set-up-developer-assets"
                        class="float-right"><?php echo __tr('Help & More Information'); ?> <i
                            class="fas fa-external-link-alt"></i></a>
                    <p>
                        <?php echo __tr('Now its time to setup Webhook so the WhatsApp Cloud API can send notification of the
                        events'); ?>

                    <div>
                        <a target="_blank"
                            href="https://developers.facebook.com/apps/<?php echo e(getVendorSettings('facebook_app_id')); ?>/whatsapp-business/wa-settings"
                            class="btn btn-dark"><?php echo e(__tr('Setup Webhook')); ?> <i
                                class="fas fa-external-link-alt"></i></a>
                        <div class="text-warning my-3"><strong><?php echo e(__tr('Important!')); ?></strong>
                            <?php echo e(__tr('Select Messages from Webhook Fields')); ?></div>
                    </div>
                    </p>
                    <div class="form-group col-md-12 col-lg-10">
                        <label for="lwWhatsAppWebhook"><?php echo e(__tr('WhatsApp Webhook')); ?></label>
                        <div class="input-group">
                            <input type="text" class="form-control" readonly id="lwWhatsAppWebhook" value="<?php echo e(getViaSharedUrl(route('vendor.whatsapp_webhook', [
                                'vendorUid' => getVendorUid(),
                            ]))); ?>">
                            <div class="input-group-append">
                                <button class="btn btn-outline-light" type="button"
                                    onclick="lwCopyToClipboard('lwWhatsAppWebhook')">
                                    <?= __tr('Copy') ?>
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="form-group col-md-12 col-lg-10">
                        <label for="lwWhatsAppWebhookVerifyToken"><?php echo e(__tr('WhatsApp Webhook Verify Token')); ?></label>
                        <div class="input-group">
                            <input type="text" class="form-control" readonly id="lwWhatsAppWebhookVerifyToken"
                                value="<?php echo e(sha1(getVendorUid())); ?>">
                            <div class="input-group-append">
                                <button class="btn btn-outline-light" type="button"
                                    onclick="lwCopyToClipboard('lwWhatsAppWebhookVerifyToken')">
                                    <?= __tr('Copy') ?>
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
                <!-- / whatsapp cloud api setup form -->
            </div>
            <div class="badge badge-success py-1 mt-2" x-show="isWebhookVerified"><i
                    class="fa fa-2x fa-check-square"></i> <span class="lw-configured-badge"><?php echo e(__tr('Verified')); ?></span></div>
            <div class="badge badge-danger py-1 mt-2" x-show="!isWebhookVerified"><i
                    class="fas fa-exclamation-circle fa-2x"></i> <span class="lw-configured-badge"><?php echo e(__tr('Not Verified')); ?></span></div>
        </fieldset>
        <fieldset class="lw-fieldset mb-3"
            x-data="{openForUpdate:false,testContactExists: <?php echo e(getVendorSettings('test_recipient_contact') ? 1 : 0); ?>}">
            <legend data-toggle="collapse" data-target="#lwWhatsAppTestContactBlock" aria-expanded="false"
                aria-controls="lwWhatsAppTestContactBlock"><?php echo __tr('Step 4 : Test Contact for Campaign'); ?> <small
                    class="text-muted"><?php echo e(__tr('Click to expand/collapse')); ?></small></legend>
            <div class="collapse" :class="(!enableStep3) ? 'lw-disabled-block-content' : ''"
                id="lwWhatsAppTestContactBlock" data-parent="#whatsAppSetupSettingsBlock">
                <!-- whatsapp cloud api setup form -->
                <form id="lwWhatsAppTestContact" class="lw-ajax-form lw-form" name="whatsapp_setup_test_contact"
                    method="post" action="<?= route('vendor.settings.write.update') ?>">
                    <input type="hidden" name="pageType" value="whatsapp_cloud_api_setup">
                    <!-- set hidden input field with form type -->
                    <input type="hidden" name="form_type" value="whatsapp_setup_test_contact" />
                    <div class="row">
                        <div class="col-12">
                            <div class="alert alert-light">
                                <?php echo e(__tr('It will be used for campaign, if there is no contact add it from the contacts
                                list
                                then choose test contact here.')); ?>

                                <a href="<?php echo e(route('vendor.contact.read.list_view')); ?>"
                                    class="btn btn-sm btn-secondary"><?php echo e(__tr('Go to Manage Contacts')); ?></a>
                            </div>
                        </div>
                        <div class="col-md-12 col-lg-4">
                            <?php if (isset($component)) { $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.lw.input-field','data' => ['type' => 'selectize','dataFormGroupClass' => '','name' => 'test_recipient_contact','label' => __tr('Choose Test Contact'),'dataSelected' => ''.e(getVendorSettings('test_recipient_contact')).'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('lw.input-field'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'selectize','data-form-group-class' => '','name' => 'test_recipient_contact','label' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(__tr('Choose Test Contact')),'data-selected' => ''.e(getVendorSettings('test_recipient_contact')).'']); ?>
                                 <?php $__env->slot('selectOptions', null, []); ?> 
                                    <?php if(isset($configurationData['contactsListData'])): ?>
                                    <?php $__currentLoopData = $configurationData['contactsListData']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contact): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($contact['_uid']); ?>"><?php echo e($contact['full_name']); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                 <?php $__env->endSlot(); ?>
                             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $attributes = $__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__attributesOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69)): ?>
<?php $component = $__componentOriginalc48421d24039f3f08f3bb9a3b9254b69; ?>
<?php unset($__componentOriginalc48421d24039f3f08f3bb9a3b9254b69); ?>
<?php endif; ?>
                        </div>
                    </div>
                    <div class="form-group mt-3">
                        <!-- Update Button -->
                        <button type="submit" class="btn btn-primary btn-user lw-btn-block-mobile">
                            <?= __tr('Save') ?>
                        </button>
                        <!-- /Update Button -->
                    </div>
                </form>
            </div>
            <div class="badge badge-success py-1 mt-2" x-show="testContactExists"><i
                    class="fa fa-2x fa-check-square"></i> <span class="lw-configured-badge"><?php echo e(__tr('Configured')); ?></span></div>
            <div class="badge badge-danger py-1 mt-2" x-show="!testContactExists"><i
                    class="fas fa-exclamation-circle fa-2x"></i> <span class="lw-configured-badge"><?php echo e(__tr('Not Configured')); ?></span></div>
        </fieldset>
        <fieldset class="lw-fieldset mb-3">
            <legend data-toggle="collapse" data-target="#lwManageTemplates" aria-expanded="false"
                aria-controls="lwManageTemplates"><?php echo __tr('Step 5 : Manage or Sync Templates'); ?> <small
                    class="text-muted"><?php echo e(__tr('Click to expand/collapse')); ?></small></legend>
            <div class="collapse" id="lwManageTemplates" data-parent="#whatsAppSetupSettingsBlock"
                :class="(!enableStep3) ? 'lw-disabled-block-content' : ''">
                <?php echo e(__tr('In order to send template message you should have created and approved templates for WhatsApp Business if you have already created the templates you can Sync it or click on Manage templates to create.')); ?>

                <div class="my-3">
                    <a class="lw-btn btn btn-primary lw-ajax-link-action" data-method="post"
                        href="<?php echo e(route('vendor.whatsapp_service.templates.write.sync')); ?>"> <?php echo e(__tr('Sync WhatsApp Templates')); ?></a>
                    <a class="lw-btn btn btn-default" target="_blank"
                        href="https://business.facebook.com/wa/manage/message-templates/?waba_id=<?php echo e(getVendorSettings('whatsapp_business_account_id')); ?>">
                        <?php echo e(__tr('Manage Templates')); ?> <i class="fa fa-link"></i></a>
                </div>
            </div>
        </fieldset>
    </div>
</div>
<div class="col-md-4">
   <fieldset x-data="initializedWhatsAppData">
    <legend><?php echo e(__tr('WhatsApp Business Health Status')); ?></legend>
   <dl>
    <dt><?php echo e(__tr('WhatsApp Business ID')); ?></dt>
    <dd x-text="healthStatusData?.whatsapp_business_account_id"></dd>
    <dt><?php echo e(__tr('Status as at')); ?></dt>
    <dd x-text="healthStatusData?.health_status_updated_at_formatted"></dd>
    <dt><?php echo e(__tr('Overall Health')); ?></dt>
    <dd x-text="healthStatusData?.health_data?.health_status.can_send_message"></dd>
        <template x-for="healthEntity in healthStatusData?.health_data?.health_status.entities">
            <fieldset>
                <legend> <span x-text="healthEntity.entity_type"></span> - <span x-text="healthEntity.id"></span></legend>
            <dl>
                <dt><?php echo e(__tr('Can Send Message')); ?></dt>
                <dd x-text="healthEntity.can_send_message"></dd>
                <template x-for="errorItem in healthEntity.errors">
                    <dl>
                    <dt><?php echo e(__tr('Error Description')); ?></dt>
                    <dd class="text-danger" x-text="errorItem.error_description"></dd>
                    <dt><?php echo e(__tr('Possible Solution')); ?></dt>
                    <dd class="text-success" x-text="errorItem.possible_solution"></dd>
                </dl>
                </template>
            </dl>
        </fieldset>
        </template>
   </dl>
   <a href="<?php echo e(route('vendor.whatsapp.health.status')); ?>" class="btn btn-primary lw-ajax-link-action <?php echo e(!getVendorSettings('whatsapp_access_token') ? 'disabled' : ''); ?>" data-method="post"><?php echo e(__tr('Refresh Status')); ?></a>
   </fieldset>
</div>
</div>
<script>
    (function() {
       'use strict';
       <?php if(getVendorSettings('whatsapp_business_account_id')): ?>
        document.addEventListener('alpine:init', () => {
            Alpine.data('initializedWhatsAppData', () => ({
                healthStatusData: <?php echo json_encode(getVendorSettings('whatsapp_health_status_data'), 15, 512) ?>[<?php echo e(getVendorSettings('whatsapp_business_account_id')); ?>]
            }));
       <?php else: ?>
       document.addEventListener('alpine:init', () => {
        Alpine.data('initializedWhatsAppData', () => ({
            healthStatusData: []
        }));
       <?php endif; ?>
   });
})();
</script><?php /**PATH C:\xampp\htdocs\zap\resources\views/vendors/settings/whatsapp-cloud-api-setup.blade.php ENDPATH**/ ?>