<form action="{{ route('admin.media.update', $SocialMedia->id) }}" method="POST" enctype="multipart/form-data">
    @csrf
    <div class="form-group">
        <label for="social_media_name">@lang('Social Media Name')</label>
        <input type="text" class="form-control" name="social_media_name"
            value="{{ old('social_media_name', $SocialMedia->social_media_name) }}" required>
    </div>
    <div class="form-group">
        <label for="social_media_link">@lang('Social Media Link')</label>
        <input type="text" class="form-control" name="social_media_link"
            value="{{ old('social_media_link', $SocialMedia->social_media_link) }}" required>
    </div>
    <div class="image-upload">
        <div class="thumb">
            <div class="avatar-preview">
                <div class="profilePicPreview"
                    style="background-image: url({{ $SocialMedia && $SocialMedia->social_media_icon ? getImage(getFilePath('withdrawMethod') . '/' . $SocialMedia->social_media_icon, getFileSize('withdrawMethod')) : null }}) ">
                    <button type="button" class="remove-image"><i
                            class="fa fa-times"></i></button>
                </div>
            </div>
            <div class="avatar-edit">
                <input type="file" class="profilePicUpload" name="social_media_icon"
                    id="profilePicUpload1" accept=".png, .jpg, .jpeg"
                    onchange="document.getElementById('profilePicUpload1').click()">
                <label for="profilePicUpload1" class="bg--success">@lang('Upload Image')</label>
                <small class="mt-2  ">@lang('Supported files'): <b>@lang('jpeg'),
                        @lang('jpg').</b> @lang('Image will be resized into 400x600px') </small>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="status">@lang('Status')</label>
        <select name="status" id="status" class="form-control">
            <option value="{{ Status::ENABLE }}" {{ $SocialMedia->status == Status::ENABLE ? 'selected' : '' }}>
                @lang('Active')</option>
            <option value="{{ Status::DISABLE }}" {{ $SocialMedia->status == Status::DISABLE ? 'selected' : '' }}>
                @lang('Deactive')</option>
        </select>
    </div>
    <div class="form-group">
        @if (!$SocialMedia->id)
            <button type="submit" class="btn btn-primary">@lang('Create')</button>
        @else
            <button type="submit" class="btn btn-primary">@lang('Update')</button>
        @endif
    </div>
</form>



{{-- <script>
    $(function() {
        $('#referedPerson').select2({
            data: @if ($SocialMedia->user_id)
                [{
                    id: {{ $SocialMedia->user_id }},
                    text: "{{ $SocialMedia->user->username }}"
                }]
            @else
                []
            @endif ,
            ajax: {
                url: '{{ route('admin.users.referedPerson.suggestions') }}',
                type: 'get',
                dataType: 'json',
                delay: 250,
                data: function(params) {
                    return {
                        search: params.term
                    };
                },
                processResults: function(data) {
                    return {
                        results: data
                    };
                },
                cache: true
            },
            dropdownParent: $('#SocialMediaModal'), // Add this line to point to the modal
            placeholder: 'Search for a user',
            minimumInputLength: 2,
            templateResult: function(data) {
                if (data.loading) return data.text;
                return data.text;
            },
            templateSelection: function(data) {
                return data.text;
            }
        });
    });
</script> --}}
