<?php $__env->startSection('content'); ?>

    <!-- You are: (shop domain name) -->
    <p>You are: <?php echo e($shopDomain ?? Auth::user()->name); ?></p>
    
     <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <h1>Amipi Products Page</h1>
    <button id="create-page-btn">Create product list Page</button>
    
    <button id="delete-page-btn">Delete product list Pages</button>
    
    <div id="response"></div>
    
    <script>
       var userId = "<?php echo e(Auth::user()->id); ?>";
        $(document).ready(function() {
            $('#create-page-btn').click(function() {
                // Create the data object, including the user ID
                var data = {
                    user_id: userId
                };
    
                $.ajax({
                    url: '<?php echo e(route('create-page')); ?>',  // URL for the controller method
                    type: 'POST',
                    data: data,  // Send the data as part of the request
                    success: function(response) {
                        $('#response').html('<pre>' + JSON.stringify(response, null, 2) + '</pre>');
                    },
                    error: function(xhr) {
                        $('#response').html('<pre>' + xhr.responseText + '</pre>');
                    }
                });
            });
        });
        
         // Delete Page Button Click Event
        $('#delete-page-btn').click(function() {
            var data = { user_id: userId };

            $.ajax({
                // url: '<?php echo e(route('create-page')); ?>',
                url: '<?php echo e(route('deletepr-page')); ?>',  // Route for the delete-page method
                type: 'POST',
                data: data,
                success: function(response) {
                    $('#response').html('<pre>' + JSON.stringify(response, null, 2) + '</pre>');
                },
                error: function(xhr) {
                    $('#response').html('<pre>' + xhr.responseText + '</pre>');
                }
            });
        });
    // });
    
    </script>
    
    
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    <?php echo \Illuminate\View\Factory::parentPlaceholder('scripts'); ?>

    <script>
        actions.TitleBar.create(app, { title: 'Welcome' });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('shopify-app::layouts.default', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/amipiinc/diamondapp.mydiamondsearch.com/diamond_products/resources/views/welcome.blade.php ENDPATH**/ ?>