changed most style
bzr revid: nicolas.vanhoren@openerp.com-20120906135745-pgmzrv94jvv3imuq
This commit is contained in:
parent
8d0669461f
commit
bebed68373
|
@ -1,32 +1,27 @@
|
|||
.oe_attendance_status{
|
||||
height:14px;
|
||||
width:100px;
|
||||
background-color:white;
|
||||
padding: 5px 10px 7px;
|
||||
margin:3px;
|
||||
-webkit-border-radius:4px;
|
||||
|
||||
.openerp .oe_attendance_status {
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
display: inline-block;
|
||||
}
|
||||
.oe_attendance_present{
|
||||
.openerp .oe_attendance_signin {
|
||||
float:left;
|
||||
text-shadow: grey 0px 1px 0px;
|
||||
color:green;
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
background: url(/hr_attendance/static/src/img/emp-in32.png);
|
||||
cursor: pointer;
|
||||
}
|
||||
.oe_attendance_absent{
|
||||
float:right;
|
||||
text-shadow: grey 0px 1px 0px;
|
||||
color:red;
|
||||
}
|
||||
.oe_attendance_slider{
|
||||
cursor:pointer;
|
||||
width: 60px;
|
||||
background-color: gray;
|
||||
position: relative;
|
||||
top: -4px;
|
||||
left: -8px;
|
||||
height: 24px;
|
||||
-webkit-border-radius:4px;
|
||||
}
|
||||
.oe_attendance_text{
|
||||
visibility:hidden;
|
||||
.openerp .oe_attendance_status.oe_attendance_signed .oe_attendance_signin {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.openerp .oe_attendance_signout {
|
||||
float:right;
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
background: url(/hr_attendance/static/src/img/emp-out32.png);
|
||||
cursor: pointer;
|
||||
}
|
||||
.openerp .oe_attendance_status.oe_attendance_nosigned .oe_attendance_signout {
|
||||
display: none;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 756 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 930 B |
|
@ -7,61 +7,44 @@ openerp.hr_attendance = function (instance) {
|
|||
instance.hr_attendance.AttendanceSlider = instance.web.Widget.extend({
|
||||
template: 'AttendanceSlider',
|
||||
init: function (parent) {
|
||||
this.titles = {
|
||||
'present': _t("Present"),
|
||||
'absent': _t("Absent")
|
||||
}
|
||||
this._super(parent);
|
||||
this.session = parent.session;
|
||||
this.parent_element = parent.$el;
|
||||
},
|
||||
start: function () {
|
||||
this.$oe_attendance_slider = this.$el.find(".oe_attendance_slider");
|
||||
this.$oe_attendance_slider.click(this.do_update_attendance);
|
||||
start: function() {
|
||||
var self = this;
|
||||
this.on("change:signed_in", this, function() {
|
||||
this.$el.toggleClass("oe_attendance_nosigned", ! this.get("signed_in"));
|
||||
this.$el.toggleClass("oe_attendance_signed", this.get("signed_in"));
|
||||
});
|
||||
this.$(".oe_attendance_signin").click(function() {
|
||||
self.do_update_attendance();
|
||||
});
|
||||
this.$(".oe_attendance_signout").click(function() {
|
||||
self.do_update_attendance();
|
||||
});
|
||||
return this.check_attendance();
|
||||
},
|
||||
do_update_attendance: function () {
|
||||
var self = this;
|
||||
if (!self.employee)
|
||||
return;
|
||||
var hr_employee = new instance.web.DataSet(self, 'hr.employee');
|
||||
hr_employee.call('attendance_action_change', [
|
||||
[self.employee.id]
|
||||
]).done(function (result) {
|
||||
if (!result) return;
|
||||
if (self.employee.state == 'present')
|
||||
self.employee.state = 'absent';
|
||||
else
|
||||
self.employee.state = 'present';
|
||||
self.do_slide(self.employee.state);
|
||||
self.set({"signed_in": ! self.get("signed_in")});
|
||||
});
|
||||
},
|
||||
do_slide: function (attendance_state) {
|
||||
if (attendance_state == 'present') {
|
||||
this.$oe_attendance_slider.attr("title", _t("Sign Out"));
|
||||
this.$oe_attendance_slider.animate({
|
||||
"left": "48px"
|
||||
}, "slow");
|
||||
} else {
|
||||
this.$oe_attendance_slider.attr("title", _t("Sign In"));
|
||||
this.$oe_attendance_slider.animate({
|
||||
"left": "-8px"
|
||||
}, "slow");
|
||||
}
|
||||
|
||||
},
|
||||
check_attendance: function () {
|
||||
var self = this;
|
||||
self.employee = false;
|
||||
this.$el.find(".oe_attendance_status").hide();
|
||||
this.$el.hide();
|
||||
var employee = new instance.web.DataSetSearch(self, 'hr.employee', self.session.user_context, [
|
||||
['user_id', '=', self.session.uid]
|
||||
]);
|
||||
return employee.read_slice(['id', 'name', 'state']).pipe(function (res) {
|
||||
if (_.isEmpty(res))
|
||||
return;
|
||||
self.$el.find(".oe_attendance_status").show();
|
||||
self.$el.show();
|
||||
self.employee = res[0];
|
||||
self.do_slide(self.employee.state);
|
||||
self.set({"signed_in": self.employee.state !== "absent"});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -76,7 +59,6 @@ openerp.hr_attendance = function (instance) {
|
|||
self.attendanceslider = new instance.hr_attendance.AttendanceSlider(self);
|
||||
|
||||
self.attendanceslider.prependTo(instance.webclient.$('.oe_systray'));
|
||||
self.attendanceslider.check_attendance();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
<template>
|
||||
|
||||
<t t-name="AttendanceSlider">
|
||||
<li>
|
||||
<div class="oe_attendance_status">
|
||||
<div class="oe_attendance_present"><t t-esc="widget.titles.present"/></div>
|
||||
<div class="oe_attendance_absent"><t t-esc="widget.titles.absent"/></div>
|
||||
<div class="oe_attendance_slider"><span class="oe_attendance_text">slider</span></div>
|
||||
</div>
|
||||
</li>
|
||||
</t>
|
||||
<div class="oe_attendance_status oe_attendance_nosigned">
|
||||
<div class="oe_attendance_signin"></div>
|
||||
<div class="oe_attendance_signout"></div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue