height: 40px;
line-height:40px;
text-align:center;
+ border-radius: 2px;
margin:3px;
margin-top:10px;
margin-right:10px;
box-sizing: border-box;
width: 80%;
}
+.pos .popup.popup-selection .message {
+ margin-top: 0;
+}
.pos .popup.popup-selection .selection {
overflow-y: auto;
- max-height: 270px;
+ max-height: 305px;
+ font-size: 16px;
+ margin: 0 -10px;
+ width: auto;
+ line-height: 50px;
+ border-top: dashed 1px rgb(215,215,215);
}
-.pos .popup.popup-selection .selection .button {
- float: none;
- display: block;
+.pos .popup.popup-selection .selection-item {
width: auto;
- margin: 8px;
+ background: rgb(230,230,230);
+ cursor: pointer;
+ text-align: left;
+ padding: 0px 16px;
+}
+.pos .popup.popup-selection .selection-item:nth-child(even) {
+ background: rgb(247,247,247);
}
/* ********* The Webkit Scrollbar ********* */
}
});
- this.$('.button.item').click(function(){
+ this.$('.selection-item').click(function(){
self.pos_widget.screen_selector.close_popup();
if (options.confirm) {
var item = self.list[parseInt($(this).data('item-index'))];
init: function(parent, options){
var options = options || {};
this._super(parent,options);
- this.mode = options.mode || 'cashier';
},
set_user_mode: function(mode){
this.mode = mode;
- this.refresh();
- },
- refresh: function(){
this.renderElement();
},
- get_name: function(){
- var user;
- if(this.mode === 'cashier'){
- user = this.pos.cashier || this.pos.user;
- }else{
- user = this.pos.get_order().get_client() || this.pos.user;
+ renderElement: function(){
+ var self = this;
+ this._super();
+
+ this.$el.click(function(){
+ self.click_username();
+ });
+ },
+ click_username: function(){
+ var self = this;
+
+ var list = [];
+ for (var i = 0; i < this.pos.users.length; i++) {
+ list.push({
+ 'label':this.pos.users[i].name,
+ 'item': this.pos.users[i],
+ });
}
+
+ this.pos_widget.screen_selector.show_popup('selection',{
+ 'message': _t('Change Cashier'),
+ list: list,
+ confirm: function(cashier){
+ this.pos.cashier = cashier;
+ self.renderElement();
+ },
+ });
+
+ },
+ get_name: function(){
+ var user = this.pos.cashier || this.pos.user;
if(user){
return user.name;
}else{
<div class="modal-dialog">
<div class="popup popup-selection">
<p class="message"><t t-esc=" widget.message || 'Confirm ?' " /></p>
- <div class='selection'>
+ <div class='selection scrollable-y touch-scrollable'>
<t t-foreach="widget.list || []" t-as="item">
- <div class='button item' t-att-data-item-index='item_index'>
+ <div class='selection-item' t-att-data-item-index='item_index'>
<t t-esc='item.label'/>
</div>
</t>