<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Buyer Available Dashboard</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <style>
        body {
            background-color: #f8f9fa;
            font-family: 'Segoe UI', sans-serif;
            padding: 2rem;
        }

        .card {
            border: none;
            border-radius: 1rem;
            box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.05);
        }

        h1 {
            margin-bottom: 2rem;
        }
    </style>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap');

        * {
            font-family: "Ubuntu", sans-serif;
            font-weight: 400;
            font-style: normal;
        }

        .rejected {
            color: red;
        }
    </style>
</head>
<?php
$us_states = [
    'AL' => 'Alabama',
    'AK' => 'Alaska',
    'AZ' => 'Arizona',
    'AR' => 'Arkansas',
    'CA' => 'California',
    'CO' => 'Colorado',
    'CT' => 'Connecticut',
    'DE' => 'Delaware',
    'FL' => 'Florida',
    'GA' => 'Georgia',
    'HI' => 'Hawaii',
    'ID' => 'Idaho',
    'IL' => 'Illinois',
    'IN' => 'Indiana',
    'IA' => 'Iowa',
    'KS' => 'Kansas',
    'KY' => 'Kentucky',
    'LA' => 'Louisiana',
    'ME' => 'Maine',
    'MD' => 'Maryland',
    'MA' => 'Massachusetts',
    'MI' => 'Michigan',
    'MN' => 'Minnesota',
    'MS' => 'Mississippi',
    'MO' => 'Missouri',
    'MT' => 'Montana',
    'NE' => 'Nebraska',
    'NV' => 'Nevada',
    'NH' => 'New Hampshire',
    'NJ' => 'New Jersey',
    'NM' => 'New Mexico',
    'NY' => 'New York',
    'NC' => 'North Carolina',
    'ND' => 'North Dakota',
    'OH' => 'Ohio',
    'OK' => 'Oklahoma',
    'OR' => 'Oregon',
    'PA' => 'Pennsylvania',
    'RI' => 'Rhode Island',
    'SC' => 'South Carolina',
    'SD' => 'South Dakota',
    'TN' => 'Tennessee',
    'TX' => 'Texas',
    'UT' => 'Utah',
    'VT' => 'Vermont',
    'VA' => 'Virginia',
    'WA' => 'Washington',
    'WV' => 'West Virginia',
    'WI' => 'Wisconsin',
    'WY' => 'Wyoming'
]; ?>

<body>

    <div class="container">
        <h1 class="text-center">
            Buyer Availabe Stats <br>
            <small style="font-size: 35%;">Every color change means the value has been updated</small>
        </h1>

        <div class="row g-4 mb-4">
            <div class="col-md-4 ">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">AW</h5>
                        <strong id="buyer_aw">-</strong>
                    </div>
                </div>
            </div>
            <div class="col-md-4 hide d-none">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">ASB</h5>
                        <strong id="buyer_asb">-</strong>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">ASB ON
                            <div style="clear: both;">
                                <select name="asbon_state" id="asbon_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['asbon_state']) && $_GET['asbon_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>


                                <input type="text" name="asbon_phone" id="asbon_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['asbon_phone']) ? $_GET['asbon_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="ASBONfetchStatus(); return false;">Check</a>
                                <input type="number" name="asbon_zipcode" id="asbon_zipcode"
                                    class="form-control hide d-none" placeholder="Zip Code"
                                    value="<?= isset($_GET['asbon_zipcode']) ? $_GET['asbon_zipcode'] : '' ?>"
                                    style="max-width: 30%; float: left;">
                            </div>
                        </h5>
                        <div id="buyer_asb_on" style="clear: both;">-</div>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">PMPL1
                            <div style="clear: both;">
                                <select name="asbon_state" id="PMPL_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['PMPL_state']) && $_GET['PMPL_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>


                                <input type="text" name="PMPL_phone" id="PMPL_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['PMPL_phone']) ? $_GET['PMPL_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="PMPLfetchStatus(); return false;">Check</a>
                            </div>
                        </h5>
                        <div id="buyers_available_server_pmpl" style="clear: both;">-</div>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">M1
                            <div style="clear: both;">
                                <select name="asbon_state" id="M1_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['M1_state']) && $_GET['PMPL_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>


                                <input type="text" name="M1_phone" id="M1_phone" class="form-control"
                                    placeholder="Phone" value="<?= isset($_GET['M1_phone']) ? $_GET['M1_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="M1fetchStatus(); return false;">Check</a>
                            </div>
                        </h5>
                        <div id="buyers_available_server_m1" style="clear: both;">-</div>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">Auren Health 1 (B)
                            <div style="clear: both;">
                                <select name="auren_state" id="auren2_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['auren2_state']) && $_GET['auren2_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>

                                <input type="text" name="auren2_phone" id="auren2_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['auren2_phone']) ? $_GET['auren2_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="AurenFetchStatus2(); return false;">Check</a>
                                <input type="number" name="auren2_phone" id="auren2_phone"
                                    class="form-control hide d-none" placeholder="Zip Code"
                                    value="<?= isset($_GET['auren2_phone']) ? $_GET['auren2_phone'] : '' ?>"
                                    style="max-width: 30%; float: left;">
                            </div>
                        </h5>
                        <div id="buyers_available_server_auren2" style="clear: both;">-</div>
                    </div>
                </div>
            </div>


            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">Auren 2 (AV)
                            <div style="clear: both;">
                                <select name="auren_state" id="auren3_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['auren3_state']) && $_GET['auren3_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>

                                <input type="text" name="auren3_phone" id="auren3_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['auren3_phone']) ? $_GET['auren3_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="AurenFetchStatus3(); return false;">Check</a>
                                <input type="number" name="auren3_zip" id="auren3_zip" class="form-control hide d-none"
                                    placeholder="Zip Code"
                                    value="<?= isset($_GET['auren3_zip']) ? $_GET['auren3_zip'] : '' ?>"
                                    style="max-width: 30%; float: left;">
                            </div>
                        </h5>
                        <div id="buyers_available_server_auren3" style="clear: both;">-</div>
                    </div>
                </div>
            </div>


            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">Auren Health
                            <div style="clear: both;">
                                <select name="auren_state" id="auren_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['auren_state']) && $_GET['auren_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>

                                <input type="text" name="auren_phone" id="auren_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['auren_phone']) ? $_GET['auren_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="AurenFetchStatus(); return false;">Check</a>
                                <input type="number" name="auren_phone" id="auren_phone"
                                    class="form-control hide d-none" placeholder="Zip Code"
                                    value="<?= isset($_GET['auren_phone']) ? $_GET['auren_phone'] : '' ?>"
                                    style="max-width: 30%; float: left;">
                            </div>
                        </h5>
                        <div id="buyers_available_server_auren" style="clear: both;">-</div>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">OCN
                            <div style="clear: both;">

                                <input type="text" name="ocn_phone" id="ocn_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['ocn_phone']) ? $_GET['ocn_phone'] : '' ?>"
                                    style="max-width: 70%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="OCNFetchStatus(); return false;">Check</a>
                            </div>
                        </h5>
                        <div id="buyers_available_server_ocn" style="clear: both;">-</div>
                    </div>
                </div>
            </div>


            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">CBenifits
                            <div style="clear: both;">
                                <select name="auren4_state" id="auren4_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['auren4_state']) && $_GET['auren4_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>

                                <input type="text" name="auren4_phone" id="auren4_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['auren4_phone']) ? $_GET['auren4_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="AurenFetchStatus4(); return false;">Check</a>
                                <input type="number" name="auren4_zip" id="auren4_zip" class="form-control hide d-none"
                                    placeholder="Zip Code"
                                    value="<?= isset($_GET['auren4_zip']) ? $_GET['auren4_zip'] : '' ?>"
                                    style="max-width: 30%; float: left;">
                            </div>
                        </h5>
                        <div id="buyers_available_server_auren4" style="clear: both;">-</div>
                    </div>
                </div>
            </div>


            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">PM-CPA
                            <div style="clear: both;">

                                <input type="text" name="pmcpa_phone" id="pmcpa_phone" class="form-control"
                                    placeholder="Phone"
                                    value="<?= isset($_GET['pmcpa_phone']) ? $_GET['pmcpa_phone'] : '' ?>"
                                    style="max-width: 70%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="PMCPAFetchStatus(); return false;">Check</a>
                            </div>
                        </h5>
                        <div id="buyers_available_server_pmcpa" style="clear: both;">-</div>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">MM
                            <div style="clear: both;">
                                <select name="mm_state" id="mm_state" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['mm_state']) && $_GET['mm_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>

                                <input type="text" name="mm_phone" id="mm_phone" class="form-control"
                                    placeholder="Phone" value="<?= isset($_GET['mm_phone']) ? $_GET['mm_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">

                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="MMFetchStatus(); return false;">Check</a>

                            </div>
                        </h5>
                        <div id="buyers_available_server_mm" style="clear: both;">-</div>
                    </div>
                </div>
            </div>


            <div class="col-md-4">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">PCB
                            <div style="clear: both;">
                                <select name="pcb_state" id="pcb_state" class="form-control"
                                    style="max-width: 100%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                        <option value="<?= $abbr ?>"
                                            <?= (isset($_GET['pcb_state']) && $_GET['pcb_state'] == $abbr) ? 'selected' : '' ?>>
                                            <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>


                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="PCBFetchStatus(); return false;">Check</a>

                            </div>
                        </h5>
                        <div id="buyers_available_server_pcb" style="clear: both;">-</div>
                    </div>
                </div>
            </div>


            <!-- <div class="form-group col-md-4 hide d-none">
                <div class="card bg-light">
                    <div class="card-body text-center">
                        <h5 class="card-title">
                            ASB-State Agent
                            <div style="clear: both;">
                                <select name="buyer_asb_state_value" id="buyer_asb_state_value" class="form-control"
                                    style="max-width: 30%; float: left;">
                                    <option value="">State</option>
                                    <?php foreach ($us_states as $abbr => $name): ?>
                                    <option value="<?= $abbr ?>"
                                        <?= (isset($_GET['state']) && $_GET['state'] == $abbr) ? 'selected' : '' ?>>
                                        <?= $name ?></option>
                                    <?php endforeach; ?>
                                </select>

                                <input type="text" name="buyer_asb_state_phone" id="buyer_asb_state_phone"
                                    class="form-control" placeholder="Phone"
                                    value="<?= isset($_GET['buyer_asb_state_phone']) ? $_GET['buyer_asb_state_phone'] : '' ?>"
                                    style="max-width: 48%; float: left;">
                                <a href="#" class="btn btn-primary"
                                    style="max-width: 30%; float: left; margin-left: 10px;"
                                    onclick="ASBStateFetchStatus(); return false;">Check</a>
                            </div>
                        </h5>
                        <strong id="buyer_asb_state" style="clear: both;">-</strong>
                    </div>
                </div>
            </div>
            <div class="col-md-4 hide d-none">
                <div class="card bg-light">
                    <div class="card-body text-center" style="min-height: 145px;">
                        <h5 class="card-title">AUREN
                            <select name="buyer_auren_state" id="buyer_auren_state" class="form-control">
                                <option value="">Please Select State for Availability</option>
                                <?php foreach ($us_states as $abbr => $name): ?>
                                <option value="<?= $abbr ?>"
                                    <?= (isset($_GET['buyer_auren_state']) && $_GET['buyer_auren_state'] == $abbr) ? 'selected' : '' ?>>
                                    <?= $name ?></option>
                                <?php endforeach; ?>
                            </select>
                        </h5>
                        <div id="buyer_auren"></div>
                    </div>
                </div>
            </div> -->
        </div>




    </div>

    <div class="row g-4">


    </div>
    </div>

    <script>
        function getRandomColor() {
            const letters = '0123456789ABCDEF';
            let color = '#';
            for (let i = 0; i < 6; i++) {
                color += letters[Math.floor(Math.random() * 16)];
            }
            return color;
        }

        function fetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#state").val();
            asbon_state = $("select#asbon_state").val();
            asbon_zipcode = $("input#asbon_zipcode").val();
            buyer_auren_state = $("select#buyer_auren_state").val();

            $.ajax({
                url: 'buyers_available_server.php?buyer_auren_state=' + buyer_auren_state + '&state=' + state +
                    '&asbon_state=' + asbon_state + '&asbon_zipcode=' + asbon_zipcode,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    $('#buyer_aw').text(response.buyer_aw).css('color', getRandomColor());
                    $('#buyer_asb').text(response.buyer_asb).css('color', getRandomColor());
                    $('#buyer_asb_on').text(response.buyer_asb_on).css('color', getRandomColor());
                    // $('#buyer_asb_test').text(response.buyer_asb_test).css('color', getRandomColor());
                    //////////////////////////////////////////////
                    // $('#buyer_asb_state').html(response.buyer_asb_state);
                    // $('#buyer_asb_state p').each(function() {
                    //     $(this).css('color', getRandomColor());
                    // });
                    //////////////////////////////////////////////
                    $('#buyer_auren').html(response.buyer_auren);
                    $('#buyer_auren th').each(function() {
                        $(this).css('color', getRandomColor());
                    });
                    setTimeout(function() {
                        fetchStatus();
                    }, 2000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        fetchStatus();

        function OCNFetchStatus() {
            // return false;
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            ocn_phone = $("input#ocn_phone").val();

            $.ajax({
                url: 'buyers_available_server_ocn.php?ocn_phone=' + ocn_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    $('#buyers_available_server_ocn').text(response.ocn_msg).css('color',
                        getRandomColor());
                    // setTimeout(function() {
                    //     //ASBONfetchStatus();
                    // }, 20 * 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function PMCPAFetchStatus() {
            // return false;
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            pmcpa_phone = $("input#pmcpa_phone").val();

            $.ajax({
                url: 'buyers_available_server_pmcpa.php?pmcpa_phone=' + pmcpa_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    $('#buyers_available_server_pmcpa').text(response.msg).css('color',
                        getRandomColor());
                    // setTimeout(function() {
                    //     //ASBONfetchStatus();
                    // }, 20 * 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function CBFetchStatus() {
            // return false;
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            cb_phone = $("input#cb_phone").val();

            $.ajax({
                url: 'buyers_available_server_cb.php?cb_phone=' + cb_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    $('#buyers_available_server_ocn').text(response.ocn_msg).css('color',
                        getRandomColor());
                    // setTimeout(function() {
                    //     //ASBONfetchStatus();
                    // }, 20 * 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function ASBONfetchStatus() {
            // return false;
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#state").val();
            asbon_state = $("select#asbon_state").val();
            asbon_zipcode = $("input#asbon_zipcode").val();
            asbon_phone = $("input#asbon_phone").val();
            buyer_auren_state = $("select#buyer_auren_state").val();

            $.ajax({
                url: 'buyers_available_server_abs_on.php?buyer_auren_state=' + buyer_auren_state + '&state=' +
                    state + '&asbon_state=' + asbon_state + '&asbon_zipcode=' + asbon_zipcode + '&asbon_phone=' +
                    asbon_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    // $('#buyer_aw').text(response.buyer_aw).css('color', getRandomColor());
                    // $('#buyer_asb').text(response.buyer_asb).css('color', getRandomColor());
                    $('#buyer_asb_on').text(response.buyer_asb_on).css('color', getRandomColor());
                    // $('#buyer_asb_test').text(response.buyer_asb_test).css('color', getRandomColor());
                    //////////////////////////////////////////////
                    // $('#buyer_asb_state').html(response.buyer_asb_state);
                    // $('#buyer_asb_state p').each(function() {
                    //     $(this).css('color', getRandomColor());
                    // });
                    //////////////////////////////////////////////
                    // $('#buyer_auren').html(response.buyer_auren);
                    // $('#buyer_auren th').each(function() {
                    //     $(this).css('color', getRandomColor());
                    // });
                    setTimeout(function() {
                        //ASBONfetchStatus();
                    }, 20 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function ASBStateFetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#buyer_asb_state_value").val();
            buyer_asb_state_phone = $("input#buyer_asb_state_phone").val();
            asbon_state = $("select#asbon_state").val();
            asbon_zipcode = $("input#asbon_zipcode").val();
            buyer_auren_state = $("select#buyer_auren_state").val();

            $.ajax({
                url: 'buyers_available_server.php?buyer_auren_state=' + buyer_auren_state + '&state=' + state +
                    '&asbon_state=' + asbon_state + '&asbon_zipcode=' + asbon_zipcode + '&buyer_asb_state_phone=' +
                    buyer_asb_state_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    $('#buyer_aw').text(response.buyer_aw).css('color', getRandomColor());
                    $('#buyer_asb').text(response.buyer_asb).css('color', getRandomColor());
                    $('#buyer_asb_on').text(response.buyer_asb_on).css('color', getRandomColor());
                    // $('#buyer_asb_test').text(response.buyer_asb_test).css('color', getRandomColor());
                    //////////////////////////////////////////////
                    $('#buyer_asb_state').html(response.buyer_asb_state);
                    $('#buyer_asb_state p').each(function() {
                        $(this).css('color', getRandomColor());
                    });
                    //////////////////////////////////////////////
                    $('#buyer_auren').html(response.buyer_auren);
                    $('#buyer_auren th').each(function() {
                        $(this).css('color', getRandomColor());
                    });
                    setTimeout(function() {
                        ASBStateFetchStatus();
                    }, 3 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function AurenFetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#state").val();
            auren_state = $("select#auren_state").val();
            auren_zipcode = $("input#aauren_zipcode").val();
            auren_phone = $("input#auren_phone").val();
            buyer_auren_state = $("select#buyer_auren_state").val();

            $.ajax({
                url: 'buyers_available_server_auren.php?buyer_auren_state=' + buyer_auren_state + '&state=' +
                    state + '&auren_state=' + auren_state + '&auren_zipcode=' + auren_zipcode + '&auren_phone=' +
                    auren_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_auren').html(response.buyers_available_server_auren);
                    $('#buyers_available_server_auren').css('color', getRandomColor());

                    setTimeout(function() {
                        //ASBONfetchStatus();
                    }, 20 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function AurenFetchStatus2() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#state").val();
            auren_state = $("select#auren2_state").val();
            auren_zipcode = $("input#aauren2_zipcode").val();
            auren_phone = $("input#auren2_phone").val();
            buyer_auren_state = $("select#buyer_auren2_state").val();

            $.ajax({
                url: 'buyers_available_server_auren_2.php?buyer_auren_state=' + buyer_auren_state + '&state=' +
                    state + '&auren_state=' + auren_state + '&auren_zipcode=' + auren_zipcode + '&auren_phone=' +
                    auren_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_auren2').html(response.buyers_available_server_auren);
                    $('#buyers_available_server_auren2').css('color', getRandomColor());

                    setTimeout(function() {
                        //ASBONfetchStatus();
                    }, 20 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function AurenFetchStatus3() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#state").val();
            auren_state = $("select#auren3_state").val();
            auren_zipcode = $("input#aauren3_zipcode").val();
            auren_phone = $("input#auren3_phone").val();
            buyer_auren_state = $("select#buyer_auren3_state").val();

            $.ajax({
                url: 'buyers_available_server_auren_3.php?buyer_auren_state=' + buyer_auren_state + '&state=' +
                    state + '&auren_state=' + auren_state + '&auren_zipcode=' + auren_zipcode + '&auren_phone=' +
                    auren_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_auren3').html(response.buyers_available_server_auren);
                    $('#buyers_available_server_auren3').css('color', getRandomColor());

                    setTimeout(function() {
                        //ASBONfetchStatus();
                    }, 20 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function AurenFetchStatus4() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            state = $("select#state").val();
            auren_state = $("select#auren4_state").val();
            auren_zipcode = $("input#aauren4_zipcode").val();
            auren_phone = $("input#auren4_phone").val();
            buyer_auren_state = $("select#buyer_auren4_state").val();

            $.ajax({
                url: 'buyers_available_server_auren_4.php?buyer_auren_state=' + buyer_auren_state + '&state=' +
                    state + '&auren_state=' + auren_state + '&auren_zipcode=' + auren_zipcode + '&auren_phone=' +
                    auren_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_auren4').html(response.buyers_available_server_auren);
                    $('#buyers_available_server_auren4').css('color', getRandomColor());

                    setTimeout(function() {
                        //ASBONfetchStatus();
                    }, 20 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function PMPLfetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            PMPL_state = $("select#PMPL_state").val();
            PMPL_phone = $("input#PMPL_phone").val();
            $.ajax({
                url: 'buyers_available_server_pmpl.php?PMPL_state=' + PMPL_state + '&PMPL_phone=' + PMPL_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_pmpl').html(response.buyers_available_server_pmpl);
                    //$('#buyers_available_server_pmpl').css('color', getRandomColor());

                    setTimeout(function() {
                        //ASBONfetchStatus();
                    }, 20 * 1000);
                    // setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function M1fetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            PMPL_state = $("select#M1_state").val();
            PMPL_phone = $("input#M1_phone").val();
            $.ajax({
                url: 'buyers_available_server_m1.php?M1_state=' + M1_state + '&M1_phone=' + M1_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_m1').html(response.buyers_available_server_m1);
                    //$('#buyers_available_server_m1').css('color', getRandomColor());

                    setTimeout(function() {
                        //M1fetchStatus();
                    }, 20 * 1000);
                    //setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function MMFetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            mm_state = $("select#mm_state").val();
            mm_phone = $("input#mm_phone").val();
            $.ajax({
                url: 'buyers_available_server_mm.php?state=' + mm_state + '&phone=' + mm_phone,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_mm').html(response.buyers_available_server_mm);
                    $('#buyers_available_server_mm').css('color', getRandomColor());

                    setTimeout(function() {
                        //M1fetchStatus();
                    }, 20 * 1000);
                    //setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }

        function PCBFetchStatus() {
            ///$('#buyer_aw').html('<div style="">Checking...</div>');
            pcb_state = $("select#pcb_state").val();
            $.ajax({
                url: 'buyers_available_server_pcb.php?state=' + pcb_state,
                method: 'GET',
                dataType: 'json',
                async: true,
                beforeSend: function() {
                    //$('#buyer_aw').html('<div style="">&nbsp;</div>');
                },
                success: function(response) {
                    //////////////////////////////////////////////
                    $('#buyers_available_server_pcb').html(response.buyers_available_server_pcb);
                    $('#buyers_available_server_pcb').css('color', getRandomColor());

                    setTimeout(function() {
                        //M1fetchStatus();
                    }, 20 * 1000);
                    //setInterval(fetchStatus, 1000);
                },
                error: function() {
                    $('#live-status').text('Error').removeClass().addClass('badge bg-danger');
                }
            });
        }
    </script>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>