diff --git a/html/peopleitem.html b/html/peopleitem.html
new file mode 100644
index 0000000..08acd48
--- /dev/null
+++ b/html/peopleitem.html
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/js/bts_timesheet.js b/js/bts_timesheet.js
index d91cc4f..f9d6872 100644
--- a/js/bts_timesheet.js
+++ b/js/bts_timesheet.js
@@ -1,16 +1,59 @@
(function ($) {
$(function () {
class People{
- function constructor(selector){
-
+ constructor(selector, data){
+ this.selector = selector;
+ this.data = $(selector).data();
+ this.template = '#people_template';
+ this.sample_people = {
+ login: '01515b52-6936-46b2-a000-9ad4cd7a5b50',
+ firstname: "first",
+ lastname: "last",
+ phone: '041122221',
+ email: 'abc@gmail.com',
+ pay: 0,
+ hour: 12,
+ OT: 3,
+ petrol: 50,
+ rating: 3,
+ };
+ this.load_data(this.data);
+ }
+
+ load_data(data){
+ var template = $(this.template).html();
+ var html = Mustache.render(template, data);
+ $(selector).html(html);
+ //save it
+ $(selector).data(data);
}
}//end of class People
+ function bts_people_html(data){
+ var template = $('#people_template').html();
+ var html = Mustache.render(template, data);
+ var head = '
';
+ r = head + html + '
' ;
+ return r;
+ }
+
+ for (var i=1; i<100; i++){
+ var sample_people = {
+ login: '01515b52-6936-46b2-a000-9ad4cd7a5b50' +i,
+ firstname: "first"+i,
+ lastname: "last",
+ phone: '041122221' +i,
+ email: 'abc@gmail.com' + i,
+ wages: 0,
+ hour: i,
+ OT: 3,
+ petrol: 50 +i,
+ rating: 3,
+ };
+ var html = bts_people_html(sample_people);
+ jQuery('div.stafflist').append(html);
+ }
- var sample_people{
- firstname: "first",
- lastname: "last"
- }
});
})(jQuery);
diff --git a/js/mustache.min.js b/js/mustache.min.js
new file mode 100644
index 0000000..7ad4c00
--- /dev/null
+++ b/js/mustache.min.js
@@ -0,0 +1 @@
+(function defineMustache(global,factory){if(typeof exports==="object"&&exports&&typeof exports.nodeName!=="string"){factory(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],factory)}else{global.Mustache={};factory(global.Mustache)}})(this,function mustacheFactory(mustache){var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function typeStr(obj){return isArray(obj)?"array":typeof obj}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}function primitiveHasOwnProperty(primitive,propName){return primitive!=null&&typeof primitive!=="object"&&primitive.hasOwnProperty&&primitive.hasOwnProperty(propName)}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile==="string")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error("Invalid tags: "+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===""};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,intermediateValue,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){intermediateValue=context.view;names=name.split(".");index=0;while(intermediateValue!=null&&index")value=this.renderPartial(token,context,partials,tags);else if(symbol==="&")value=this.unescapedValue(token,context);else if(symbol==="name")value=this.escapedValue(token,context);else if(symbol==="text")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;jxero->sync_users($arguments['mininterval']);
return;
}
+
+
+ public function bts_people_item($attr){
+ return $this->template('people_template', 'peopleitem.html');
+ }
+
+ //generate template based on html file
+ private function template($id, $file)
+ {
+ $text = '';
+ return $text;
+ }
}
$bb = new AcareOffice();