DatePicker Customization

Hey all!

Our company is fulfilling Sales Orders in-house; we are leveraging the recent additions with Delivery Trips and Delivery Stops. (We are also hoping to integrate our tools into ERPNext as well!)

One issue we have is routing orders onto the right delivery days. ERPNext currently has no support for delivery schedules per geographical zoning. We have built this functionality, but we have run into one problem: how could we change the DatePickers on Delivery Date DocFields to show delivery schedule and availability?

We have made a new DocType named “Delivery Zone”. This keeps track of the geographical region and schedule. This also will track max quantities (X amount of Delivery Trips can be sent to a region with Y amount of stock). We were able to validate a given date; but there is currently no feedback to the user on what days are already available.

If changing the DatePicker is not possible, what would be a better solution? We don’t really know how to add a new tool to the top bar (or even a floating action button) and feel it is not the best way.

Any ideas? Any help would be appreciated!

What library is used for the Datepicker? I have had an extremely difficult time trying to find any sort of documentation on what is used. The interface looks almost synonymous to either jQuery UI or Bootstrap Datepicker.

Both libraries implement beforeShowDay functions, but the datepicker used in Frappe completely ignores this option.

Looks like it’s a pseudo-custom jQuery plugin…with 0 documentation

After peeking around, it is indeed a different package than expected. However, all the docs are here:
http://t1m0n.name/air-datepicker/docs/

In my case, I need to now do the following:

field.datepicker.update('onRenderCell', myOnRenderCellFunction);
// 'field' is in cur_frm.fields

Update: Keep in mind that one needs to call this after the input has been clicked. The datepicker is built when the user clicks the field.

1 Like