mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Precommit
This commit is contained in:
@@ -1,28 +1,32 @@
|
||||
odoo.define('pms.ListController', function(require) {
|
||||
'use strict';
|
||||
/*
|
||||
* Pms
|
||||
* GNU Public License
|
||||
* Alexandre Díaz <dev@redneboa.es>
|
||||
*/
|
||||
odoo.define("pms.ListController", function(require) {
|
||||
"use strict";
|
||||
/*
|
||||
* Pms
|
||||
* GNU Public License
|
||||
* Alexandre Díaz <dev@redneboa.es>
|
||||
*/
|
||||
|
||||
var ListController = require('web.ListController');
|
||||
var Core = require('web.core');
|
||||
var ListController = require("web.ListController");
|
||||
var Core = require("web.core");
|
||||
|
||||
var _t = Core._t;
|
||||
|
||||
ListController.include({
|
||||
|
||||
renderButtons: function () {
|
||||
this._super.apply(this, arguments); // Sets this.$buttons
|
||||
var self = this;
|
||||
if (this.modelName === 'pms.reservation') {
|
||||
this.$buttons.append("<button class='btn btn-sm oe_open_reservation_wizard oe_highlight' type='button'>"+_t('Open Wizard')+"</button>");
|
||||
this.$buttons.find('.oe_open_reservation_wizard').on('click', function(){
|
||||
self.do_action('pms.open_wizard_reservations');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var _t = Core._t;
|
||||
|
||||
ListController.include({
|
||||
renderButtons: function() {
|
||||
this._super.apply(this, arguments); // Sets this.$buttons
|
||||
var self = this;
|
||||
if (this.modelName === "pms.reservation") {
|
||||
this.$buttons.append(
|
||||
"<button class='btn btn-sm oe_open_reservation_wizard oe_highlight' type='button'>" +
|
||||
_t("Open Wizard") +
|
||||
"</button>"
|
||||
);
|
||||
this.$buttons
|
||||
.find(".oe_open_reservation_wizard")
|
||||
.on("click", function() {
|
||||
self.do_action("pms.open_wizard_reservations");
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,61 +1,77 @@
|
||||
odoo.define('pms.SwitchPmsMenu', function(require) {
|
||||
"use strict";
|
||||
odoo.define("pms.SwitchPmsMenu", function(require) {
|
||||
"use strict";
|
||||
|
||||
var config = require('web.config');
|
||||
var core = require('web.core');
|
||||
var session = require('web.session');
|
||||
var SystrayMenu = require('web.SystrayMenu');
|
||||
var Widget = require('web.Widget');
|
||||
var config = require("web.config");
|
||||
var core = require("web.core");
|
||||
var session = require("web.session");
|
||||
var SystrayMenu = require("web.SystrayMenu");
|
||||
var Widget = require("web.Widget");
|
||||
|
||||
var _t = core._t;
|
||||
var _t = core._t;
|
||||
|
||||
var SwitchPmsMenu = Widget.extend({
|
||||
template: 'pms.SwitchPmsMenu',
|
||||
willStart: function() {
|
||||
this.isMobile = config.device.isMobile;
|
||||
if (!session.user_pms) {
|
||||
return $.Deferred().reject();
|
||||
}
|
||||
return this._super();
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
this.$el.on('click', '.dropdown-menu li a[data-menu]', _.debounce(function(ev) {
|
||||
ev.preventDefault();
|
||||
var pms_property_id = $(ev.currentTarget).data('property-id');
|
||||
self._rpc({
|
||||
model: 'res.users',
|
||||
method: 'write',
|
||||
args: [[session.uid], {'pms_property_id': pms_property_id}],
|
||||
})
|
||||
.then(function() {
|
||||
location.reload();
|
||||
});
|
||||
}, 1500, true));
|
||||
|
||||
var properties_list = '';
|
||||
if (this.isMobile) {
|
||||
propertiess_list = '<li class="bg-info">' + _t('Tap on the list to change property') + '</li>';
|
||||
}
|
||||
else {
|
||||
self.$('.oe_topbar_name').text(session.user_properties.current_property[1]);
|
||||
}
|
||||
_.each(session.user_properties.allowed_propierties, function(property) {
|
||||
var a = '';
|
||||
if (property[0] === session.user_properties.current_property[0]) {
|
||||
a = '<i class="fa fa-check mr8"></i>';
|
||||
} else {
|
||||
a = '<span class="mr24"/>';
|
||||
var SwitchPmsMenu = Widget.extend({
|
||||
template: "pms.SwitchPmsMenu",
|
||||
willStart: function() {
|
||||
this.isMobile = config.device.isMobile;
|
||||
if (!session.user_pms) {
|
||||
return $.Deferred().reject();
|
||||
}
|
||||
properties_list += '<li><a href="#" data-menu="property" data-property-id="' + property[0] + '">' + a + property[1] + '</a></li>';
|
||||
});
|
||||
self.$('.dropdown-menu').html(properties_list);
|
||||
return this._super();
|
||||
},
|
||||
});
|
||||
|
||||
SystrayMenu.Items.push(SwitchPmsMenu);
|
||||
|
||||
return SwitchPmsMenu;
|
||||
|
||||
return this._super();
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
this.$el.on(
|
||||
"click",
|
||||
".dropdown-menu li a[data-menu]",
|
||||
_.debounce(
|
||||
function(ev) {
|
||||
ev.preventDefault();
|
||||
var pms_property_id = $(ev.currentTarget).data("property-id");
|
||||
self._rpc({
|
||||
model: "res.users",
|
||||
method: "write",
|
||||
args: [[session.uid], {pms_property_id: pms_property_id}],
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
1500,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
var properties_list = "";
|
||||
if (this.isMobile) {
|
||||
propertiess_list =
|
||||
'<li class="bg-info">' +
|
||||
_t("Tap on the list to change property") +
|
||||
"</li>";
|
||||
} else {
|
||||
self.$(".oe_topbar_name").text(
|
||||
session.user_properties.current_property[1]
|
||||
);
|
||||
}
|
||||
_.each(session.user_properties.allowed_propierties, function(property) {
|
||||
var a = "";
|
||||
if (property[0] === session.user_properties.current_property[0]) {
|
||||
a = '<i class="fa fa-check mr8"></i>';
|
||||
} else {
|
||||
a = '<span class="mr24"/>';
|
||||
}
|
||||
properties_list +=
|
||||
'<li><a href="#" data-menu="property" data-property-id="' +
|
||||
property[0] +
|
||||
'">' +
|
||||
a +
|
||||
property[1] +
|
||||
"</a></li>";
|
||||
});
|
||||
self.$(".dropdown-menu").html(properties_list);
|
||||
return this._super();
|
||||
},
|
||||
});
|
||||
|
||||
SystrayMenu.Items.push(SwitchPmsMenu);
|
||||
|
||||
return SwitchPmsMenu;
|
||||
});
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<template>
|
||||
|
||||
<t t-name="pms.SwitchPmsMenu">
|
||||
<li class="o_switch_company_menu">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#">
|
||||
<span t-attf-class="#{widget.isMobile ? 'fa fa-building-o' : 'oe_topbar_name'}"/> <span class="caret"/>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu"/>
|
||||
</li>
|
||||
</t>
|
||||
|
||||
<t t-name="pms.SwitchPmsMenu">
|
||||
<li class="o_switch_company_menu">
|
||||
<a
|
||||
class="dropdown-toggle"
|
||||
data-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
href="#"
|
||||
>
|
||||
<span
|
||||
t-attf-class="#{widget.isMobile ? 'fa fa-building-o' : 'oe_topbar_name'}"
|
||||
/>
|
||||
<span class="caret" />
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu" />
|
||||
</li>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user