Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <reference path="./typings/jquery.d.ts" />
- /// <reference path="shiftType.ts" />
- class Schedule {
- private shiftTypes:shiftType[] = [];
- getShiftTypes(showBox:boolean = true) {
- let self = this;
- let url = Routing.generate('shift_types', {'_locale': locale});
- $.ajax({
- url: url,
- type: "GET",
- success: function (response) {
- /*
- * response.json = [{function_id:'12', isActive:true}, {function_id:'88', isActive:true}];
- */
- for(let st of response.json) {
- self._addShiftType(st);
- }
- }
- });
- }
- /**
- * Updates day box with function color and tooltip
- * @param $td
- */
- private updateBox() {
- console.log ( this.shiftTypes );
- //iterate through all available shiftTypes
- for (let f of this.shiftTypes) {
- /*
- * tutaj mam problem, ponieważ f.functionId zwraca undefined...
- * natomiast f.function_id zwraca dane....
- */
- console.info(f.functionId);
- }
- }
- private _addShiftType(type: shiftType ) {
- this.shiftTypes.push(type);
- }
- }
- /// <reference path="./typings/jquery.d.ts" />
- /// <reference path="/web/assets/vendors/moment/moment.d.ts" />
- class shiftType {
- private function_id:string;
- set functionId(functionId:string) {
- this.function_id = functionId;
- }
- get functionId():string {
- return this.function_id;
- }
- get shiftStart():moment {
- return moment(this._shiftType.shift_start, 'HH:mm');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement