HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/ivs.kaunokolegija.lt/laravel/txt_modals.blade.php
/companies Socialinia partneriai
 @include('layouts.form_modal', ['fieldsLink' => 'admin.companies.company-fields', 'compName' => 'Company', 'route' => route('admin.companies.store'), 'title' => trans('global.add'), 'useModal' => true])
 
<button id="openCompanyModal" class="btn btn-primary">
    Open Company Fields Modal
</button>

/contact-people Kontaktiniai asmenys
@if ($useModal)
@include('layouts.form_modal', ['fieldsLink' => 'admin.contactPeople.contact-people-fields', 'compName' => 'ContactPeople', 'route' => route('admin.contact-people.store'), 'title' => trans('global.add'), 'useModal' => false])

<button id="openContactPeopleModal" data-select-id="contactpersons" type="button" class="btn btn-outline-primary ms-2">
    <i class="fa fa-plus"></i>
</button>
@endif

/coop-agreements Bendradarbiavimo sutartys
@include('layouts.form_modal', ['fieldsLink' => 'admin.coopAgreements.contact-coop-agreements-fields', 'compName' => 'CoopAgreements', 'route' => route('admin.coop-agreements.store'), 'title' => trans('global.add'), 'useModal' => false])

<button id="openCoopAgreementsModal" data-select-id="contactpersons" type="button" class="btn btn-outline-primary ms-2">
    <i class="fa fa-plus"></i>
</button>




DROPZONE CASES:

modal kuris kvieciamas is naujo initializuoti dropzone
<script>
    // Disable autoDiscover so Dropzone won't automatically initialize elements
 

    $(document).ready(function() {
        // Initialize Dropzone manually for the element with ID "attachments-dropzone"
        var uploadedAttachmentsMap = {};

        // Initialize the Dropzone
        var myDropzone = new Dropzone("#attachments-dropzone", {
            url: '{{ route('admin.coop-agreements.storeMedia') }}',
            maxFilesize: 20, // MB
            addRemoveLinks: true,
            headers: {
                'X-CSRF-TOKEN': "{{ csrf_token() }}"
            },
            params: {
                size: 20
            },
            success: function(file, response) {
                $('form').append('<input type="hidden" name="attachments[]" value="' + response.name + '">');
                uploadedAttachmentsMap[file.name] = response.name;
            },
            removedfile: function(file) {
                file.previewElement.remove();
                var name = '';
                if (typeof file.file_name !== 'undefined') {
                    name = file.file_name;
                } else {
                    name = uploadedAttachmentsMap[file.name];
                }
                $('form').find('input[name="attachments[]"][value="' + name + '"]').remove();
            },
            init: function() {
                @if(isset($coopAgreement) && $coopAgreement->attachments)
                    var files = {!! json_encode($coopAgreement->attachments) !!};
                    for (var i in files) {
                        var file = files[i];
                        this.options.addedfile.call(this, file);
                        file.previewElement.classList.add('dz-complete');
                        $('form').append('<input type="hidden" name="attachments[]" value="' + file.file_name + '">');
                    }
                @endif
            },
            error: function(file, response) {
                var message = $.type(response) === 'string' ? response : response.errors.file;
                file.previewElement.classList.add('dz-error');
                var nodes = file.previewElement.querySelectorAll('[data-dz-errormessage]');
                for (var node of nodes) {
                    node.textContent = message;
                }
            }
        });
    });
</script>
O INDEX KURIAME KVIECIAMAS IÅ JUNGTI AUTO InitializavimÄ…:
Dropzone.autoDiscover = false;


//PABAIGTI MODALS:
Companies -> /admin/companies
contact-people contact-person /admin/contact-people