HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/limestate-admin/storage/framework/views/7cfbdeb846cc670f9cbd2c5d8b758065.php
<script>
    document.addEventListener('DOMContentLoaded', function () {
        function generateAddress() {
            const full_address = document.querySelector('[name="building[full_address]"]').value;
            const street_type_id = document.querySelector('[name="building[street_type_id]"]').value;
            const street_name = document.querySelector('[name="building[street_name]"]').value;
            const housing_number = document.querySelector('[name="building[housing_number]"]').value;
            const house_letter = document.querySelector('[name="building[house_letter]"]').value;

            const data = {
                full_address,
                street_type_id,
                street_name,
                housing_number,
                house_letter,
            };

            fetch('/api/generate-building-address', {
                method: 'POST',
                headers: {'Content-Type': 'application/json'},
                body: JSON.stringify(data)
            })
                .then(response => response.json())
                .then(data => {
                    document.getElementById('generated_address').value = data.address;
                });
        }

        // Поля, которые влияют на адрес
        const addressFields = [
            'full_address',
            'street_type_id',
            'street_name',
            'housing_number',
            'house_number',
            'house_letter',
        ];

        // Вешаем обработчики на все поля, влияющие на адрес
        addressFields.forEach(fieldName => {
            const field = document.querySelector('[name="building[' + fieldName + ']"]');
            if (field) {
                field.addEventListener('change', generateAddress);
                field.addEventListener('input', generateAddress); // Для мгновенного обновления
            }
        });
    });
</script>
<?php /**PATH /var/www/limestate-admin/resources/views/orchid/scripts/building_address_script.blade.php ENDPATH**/ ?>