<script>
    $(document).on("click", ".package_change_without_cost", function() {

        let client_id = $(this).data('clientid');

        $.ajax({
            type: 'get',
            url: '<?php echo e(route('getClientDetailsForPackageChange')); ?>',
            data: {
                client_id: client_id
            },
            success: function(result) {
                $('#package_change_without_cost_client_id').val(result.client.id);
                $('#package_change_without_cost_client_name').val(result.client.clientsinfo
                    .clients_name);
                $('#package_change_without_cost_package').empty();
                $('#package_change_without_cost_package').append(
                    '<option value="">Select Package</option>');

                if (result.client.pop.subreseller == 'yes') {
                    let client_packages = result.client.sub_package_id;
                    $.each(result.packages, function(key, value) {
                        if (client_packages == value.id) {
                            $('#package_change_without_cost_package').append(
                                '<option value="' + value.id + '" selected>' + value
                                .name + '</option>');
                        } else {

                            $('#package_change_without_cost_package').append(
                                '<option value="' + value.id + '">' + value.name +
                                '</option>');
                        }
                    });
                } else {
                    let client_packages = result.client.package_id;
                    $.each(result.packages, function(key, value) {
                        if (client_packages == value.id) {
                            $('#package_change_without_cost_package').append(
                                '<option value="' + value.id + '" selected>' + value
                                .package_name + '</option>');
                        } else {

                            $('#package_change_without_cost_package').append(
                                '<option value="' + value.id + '">' + value
                                .package_name + '</option>');
                        }
                    });
                }
            }
        });
    });
</script>
<?php /**PATH /var/www/html/satkania/radius-circle/resources/views/clients/JsFile/PackageChangeExceptcost.blade.php ENDPATH**/ ?>