ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Customizing the calendar view

customization
erpnext
frappe

#1

Is there a way to Modify the event calendar or custom calendar view to achieve the following ?

  1. directly open the calendar in Week view by Default.
  2. Only show times of specific slots i,e 10 am -2 pm and 5pm - 7 pm and not other timings .
    3.A way to add buttons on Top of calendar view to link to other doctypes .
    4- Show name from multiple fields on the event name on calendar.

The actual objective is to create a view from where a user can see the appointments of the week from only available or working hours , create appointments and other documents like sales invoice etc , all from a single easy to use view

i will share my code if i manage to achieve this as i think many people can benefit from a single view like calendar or dashboard .

i would sincerely appreciate help or let me know if its already possible or someone has achieved something similar ,

It will be great even if anybody can guide me for this ,

Thanks


#2

Hi @kt2152,

Your first point is already available in v11:

As for the second it would be a good enhancement, but the hard part is to figure out a way to configure it easily for each user.


#3

@chdecultot Thank you ,
The calendar modifications are truely great! cheers to you sir ,

i have a few queries if you could help me ,

  1. I see currently the default view is on local-storage ,-- so is there a way to make it global for all users or atleast a specific user , so the default view will open same everywhere no matter from where .
    2.Is there a way to specifically assign weekends or working days --even programatically is fine - might need to change definitions on hide weekends button?

Regarding the showing specific times ,
For working hours can we define working hours in company master and give a button/checkbox along side show weekends to show only company working hours.

If its like the child table format like you suggested , it would be great – it will be easy s generally there are only fixed time for a company and only the company author needs to set it once.

thanks


#4

Hi @kt2152,

As you can see, the usage of localstorage is the result of a discussion with the Frappe team in order to make a feature simple to use and user dependent.
So, no there is no way, currently, to make it global.

The week-end show/hide functionality uses the standard fullcalendar API: https://fullcalendar.io/docs/weekends
I don’t think it is configurable.

Generally I think calendar usage is meant to be user-specific. That’s the reason why making a company calendar would not be flexible enough to match all use cases:
Two people in a company, or even in a department, might have different working hours, so your functionality may be useless to both of them.


#5

i see , yes i get your point.

How can i customize the calendar , to set my own min/max times on it say from a custom app?

as well as for point 3 , i can directly add the buttons as add_custom_button from the js file ?

thanks a lot for all your help.


#6

You can always create a ****_calendar.js file for each doctype and make some customizations using the fullcalendar API.

I invite you to check all similar files in ERPNext and to read the Fullcalendar API to see what possibilities you might have.

The “add_custom_button” function is available in the form layout, but I’m not sure you’ll be able to use it in the calendar view.