jquery - Calculate the number of appointments in a timeslot -
jquery - Calculate the number of appointments in a timeslot -
i have set of doctors. each 1 has specialty (dentist, general, psychiatrist, etc.) each specialty has predefined session (appointment) time allotted, example:
dentist - appointment time: 30min general ph - appointment time: 30min psychiatrist - appointment time: 45mineach doc sets schedule, eg.:
psychiatrist - mon 08:00 12:30 dentist - tuesday 14:00 20:00 etc.i'm using jquery , 2 (2) bstimepicker fields assign timeslot each doctor http://jdewit.github.io/bootstrap-timepicker/
is there way calculate (using jquery or momentjs lib) (round)number of appointments doc able attend during timeslot assigned?
thanks lot in advance
edit, updated
try
var apps = []; var meds = { "psych": { "schedule": 4.5, "appointment_length" : function() {return this.schedule * 4}, "appointment_slots" : function() {return this.appointment_length() / 3} }, "dentist": { "schedule": 6, "appointment_length" : function() {return this.schedule * 2}, "appointment_slots" : function() {return this.appointment_length() / 2} } }; $.each(meds, function (index, value) { apps.push([index, math.round(value.appointment_slots())]); meds.appointments = apps.slice(0, 2); }); console.log(meds);
jsfiddle http://jsfiddle.net/guest271314/sdxlh/
jquery algorithm math time momentjs
Comments
Post a Comment