odoo.define('etourism_directory.form_widgets', function (require) {
"use strict";

var ajax = require('web.ajax');
var core = require('web.core');
var crash_manager = require('web.crash_manager');
var data = require('web.data');
var datepicker = require('web.datepicker');
var dom_utils = require('web.dom_utils');
var Priority = require('web.Priority');
var ProgressBar = require('web.ProgressBar');
var Dialog = require('web.Dialog');
var common = require('web.form_common');
var formats = require('web.formats');
var framework = require('web.framework');
var Model = require('web.DataModel');
var pyeval = require('web.pyeval');
var session = require('web.session');
var utils = require('web.utils');

var _t = core._t;
var QWeb = core.qweb;


/**
    This widget is intended to be used on stat button boolean fields.
    It is a read-only field that will display a simple string "<label of value>".
*/
var FieldBooleanButton2 = common.AbstractField.extend({
    className: 'o_stat_info',
    init: function() {
        this._super.apply(this, arguments);
        switch (this.options["terminology"]) {
            case "active":
                this.string_true = _t("Active");
                this.hover_true = _t("Deactivate");
                this.string_false = _t("Inactive");
                this.hover_false = _t("Activate");
                break;
            case "archive":
                this.string_true = _t("Active");
                this.hover_true = _t("Archive");
                this.string_false = _t("Archived");
                this.hover_false = _t("Unarchive");
                break;
            case "is_legal":
                this.string_true = _t("Legal");
                this.hover_true = _t("Tornar Ilegal");
                this.string_false = _t("Ilegal");
                this.hover_false = _t("Tornar Legal");
                break;
            default:
                var terms = typeof this.options["terminology"] === 'string' ? {} : this.options["terminology"];
                this.string_true = _t(terms.string_true || "On");
                this.hover_true = _t(terms.hover_true || terms.string_false || "Switch Off");
                this.string_false = _t(terms.string_false || "Off");
                this.hover_false = _t(terms.hover_false || terms.string_true || "Switch On");
        }
    },
    render_value: function() {
        this._super();
        this.$el.html(QWeb.render("BooleanButton", {widget: this}));
    },
    is_false: function() {
        return false;
    },
});

/**
 * Registry of form fields, called by :js:`instance.web.FormView`.
 *
 * All referenced classes must implement FieldInterface. Those represent the classes whose instances
 * will substitute to the <field> tags as defined in OpenERP's views.
 */
core.form_widget_registry
    .add('boolean_button2', FieldBooleanButton2);


});
