define([
  'jquery',
  'jquery/ui'
], function($) {
  'use strict';

  //creating jquery widget
  $.widget('filoblu.pickupinstore_confirm', {

    _create: function() {
      this._super();

      var options = this.options;

      this.element.on('click', function(e) {
        e.preventDefault();
        var param = options.params;
        $.ajax({
          showLoader: true,
          url: options.baseUrl + "storelocator/pickupinstore/confirmaction",
          data: param,
          type: "POST",
          cache: true,
          dataType: 'json'
        }).done(function(data) {
          if (data && data.message) {
            $(".pickupinstore-confirm-container .block-title").html(data.message);
            $(".pickupinstore-confirm-container .actions-toolbar").hide();
          }
        });

      });
    }
  });

  return $.filoblu.pickupinstore_confirm;
});
