/*
	Author: Paulo Arcegono
	Filename: datePicker.js
	Description: DatePicker initiator
	Dependencies: jquery bootstrap4
	How to use: 
		1. Just add js-datePicker class to input type=text

	for more info:Documentation page (https://gijgo.com/datepicker/configuration)
*/

;(function($) {
    'use strict'

    B2C.datePicker = {
        init: function(option) {
            this._default = {
                target: '.js-datePicker'
            }

            this._option = $.extend({}, this._default, option)
            if (!$(this._option.target).length) return
            this.domCache()
            this.eventHandler()
        },

        domCache: function() {
            this.$jsDatePicker = $(this._option.target)
        },

        eventHandler: function() {
            //let self = B2C.datePicker
            this.$jsDatePicker.datepicker({
                //choose what library to use
                uiLibrary: 'bootstrap4',
                //Date format
                format: 'dd-mm-yy',
                //icon change
                icons: {
                    rightIcon:
                        '<i class="material-icons"><img src="../public/images/icons/date-icon.png" style="position: absolute;"/></i>'
                }
                //Minimum Date
                //minDate:
                //Maximum Date
                //maxDate
            })
        }
    }
    B2C.datePicker.init()
})(jQuery)
