CalendarBundle icon indicating copy to clipboard operation
CalendarBundle copied to clipboard

fc_load_events

Open mathildegrimal opened this issue 5 years ago • 10 comments

Hello ! I'm using your bundle in a Symfony project, but in the back end part (with easy admin). When I was using it in the front, it was working perfectly, but now I think there is a problem to load the events as the script JS is calling the path 'fc_load_events", do you have an idea to fix this ? The calendar is displayed but not the events. thank you by advance

mathildegrimal avatar Apr 12 '21 17:04 mathildegrimal

Hi do you have a reproducer?

tattali avatar Apr 12 '21 19:04 tattali

Hi, No, I'm sorry. I am a student in web development and not yet learned to use it.

mathildegrimal avatar Apr 13 '21 07:04 mathildegrimal

Hi, I can't help you if you don't show me the code.

tattali avatar Apr 15 '21 08:04 tattali

If I put my project on my GitHub, so I can show you the code, will this help ?

mathildegrimal avatar Apr 15 '21 12:04 mathildegrimal

Yes if you want. You can create a public repository else a private repository and share it with me tattali. I will look at your problem as soon as I have a moment.

tattali avatar Apr 15 '21 12:04 tattali

Thank you very much, I don't want to waste your time ! Most of all because to test you'll have to recreate the database and migrations... create an account, set it with ["ROLE_ADMIN"], create some bookings... Maybe I will take too much time I don't want to bother you.

You'll see in the booking controller that there are two routes, one that is working (booking/calendar) with the calendar on the front end. The other (booking/calendarAdmin) that shows the calendar in the admin part, but this one generates this error

16c452 | POST | xhr | 404 | {{ path('fc_load_events') }} | 218ms

It can't fetch the events in the database...

Thank you for your help

mathildegrimal avatar Apr 15 '21 13:04 mathildegrimal

Hi I didn't install the project but I'm not sure that your templates/bundle/EasyAdminBundle/layout.html.twig is related to templates/bundle/EasyAdminBundle/page/calendar.html.twig

tattali avatar Apr 16 '21 10:04 tattali

you are right ! I deleted the layout because it is useless. First I was having trouble to display the calendar in the admin part, so I tried many things, but at last I managed including the scripts directly in the DashboardController, in the function configureAssets() Do you think that the problem is related to this ?

mathildegrimal avatar Apr 16 '21 10:04 mathildegrimal

why not put it directly in your template? But a 404 error is probably because the url fc_load_events is wrong. {{ path('fc_load_events') }} is twig language and not JS. So this is not possible Screenshot 2021-04-16 at 15 10 26

Check here the data-events-url to pass var from twig to js

tattali avatar Apr 16 '21 13:04 tattali

Thank you so much !!!!!!!! it works, and most of all I understand the mistake so thank you again !

mathildegrimal avatar Apr 16 '21 13:04 mathildegrimal