lbbc1117 / TimeSheet

A jQuery plugin for time planning
Apache License 2.0
15 stars 9 forks source link

Splitting the hours #5

Open R0B3RDV opened 4 years ago

R0B3RDV commented 4 years ago

Hi,

I see that this project at the moment is not very active, but i am having a question, and some of the comments are in Chinees (I think) so i don't understand that quite... sorry .

Is there an (easy) way to adjust the script instead of keeping count of whole hours, doing the same but then for periods like 30 min. so 00:00-00:30 , 00:30-01:00;

I have tried, but the calendar is ok, and the output too, but the remarks are still in the original style...

Could you be so kind to please give me an hint to fix this?

Best regards. Robert

ma0dubois commented 4 years ago

Hi,

do you want something like that ? image

R0B3RDV commented 4 years ago

Yes exactly. I am looking for something like this for ages... :)

R0B3RDV commented 4 years ago

@ma0dubois may I ask how you create this ?

Best regards, Robert

ma0dubois commented 3 years ago

@R0B3RDV

This is the js script for render this sheet:

<script>
        const timesheetDimension = [7,96];
        const hourstyle          = "border-left-color: #505050;border-left: groove;";
        const fifteenminutes     = "color: lightgray; font-size: xx-small;";
        const timesheetHourList  = [
            {name:"00",title:"00:00-00:15", style:hourstyle},{name:"15",title:"00:15-00:30", style:fifteenminutes},{name:"30",title:"00:30-00:45", style:fifteenminutes},{name:"45",title:"00:45-01:00", style:fifteenminutes},
            {name:"01",title:"01:00-01:15", style:hourstyle},{name:"15",title:"01:15-01:30", style:fifteenminutes},{name:"30",title:"01:30-01:45", style:fifteenminutes},{name:"45",title:"01:45-02:00", style:fifteenminutes},
            {name:"02",title:"02:00-02:15", style:hourstyle},{name:"15",title:"02:15-02:30", style:fifteenminutes},{name:"30",title:"02:30-02:45", style:fifteenminutes},{name:"45",title:"02:45-03:00", style:fifteenminutes},
            {name:"03",title:"03:00-03:15", style:hourstyle},{name:"15",title:"03:15-03:30", style:fifteenminutes},{name:"30",title:"03:30-03:45", style:fifteenminutes},{name:"45",title:"03:45-04:00", style:fifteenminutes},
            {name:"04",title:"04:00-04:15", style:hourstyle},{name:"15",title:"04:15-04:30", style:fifteenminutes},{name:"30",title:"04:30-04:45", style:fifteenminutes},{name:"45",title:"04:45-05:00", style:fifteenminutes},
            {name:"05",title:"05:00-05:15", style:hourstyle},{name:"15",title:"05:15-05:30", style:fifteenminutes},{name:"30",title:"05:30-05:45", style:fifteenminutes},{name:"45",title:"05:45-06:00", style:fifteenminutes},
            {name:"06",title:"06:00-06:15", style:hourstyle},{name:"15",title:"06:15-06:30", style:fifteenminutes},{name:"30",title:"06:30-06:45", style:fifteenminutes},{name:"45",title:"06:45-07:00", style:fifteenminutes},
            {name:"07",title:"07:00-07:15", style:hourstyle},{name:"15",title:"07:15-07:30", style:fifteenminutes},{name:"30",title:"07:30-07:45", style:fifteenminutes},{name:"45",title:"07:45-08:00", style:fifteenminutes},
            {name:"08",title:"08:00-08:15", style:hourstyle},{name:"15",title:"08:15-08:30", style:fifteenminutes},{name:"30",title:"08:30-08:45", style:fifteenminutes},{name:"45",title:"08:45-09:00", style:fifteenminutes},
            {name:"09",title:"09:00-09:15", style:hourstyle},{name:"15",title:"09:15-09:30", style:fifteenminutes},{name:"30",title:"09:30-09:45", style:fifteenminutes},{name:"45",title:"09:45-10:00", style:fifteenminutes},
            {name:"10",title:"10:00-10:15", style:hourstyle},{name:"15",title:"10:15-10:30", style:fifteenminutes},{name:"30",title:"10:30-10:45", style:fifteenminutes},{name:"45",title:"10:45-11:00", style:fifteenminutes},
            {name:"11",title:"11:00-11:15", style:hourstyle},{name:"15",title:"11:15-11:30", style:fifteenminutes},{name:"30",title:"11:30-11:45", style:fifteenminutes},{name:"45",title:"11:45-12:00", style:fifteenminutes},
            {name:"12",title:"12:00-12:15", style:hourstyle},{name:"15",title:"12:15-12:30", style:fifteenminutes},{name:"30",title:"12:30-12:45", style:fifteenminutes},{name:"45",title:"12:45-13:00", style:fifteenminutes},
            {name:"13",title:"13:00-13:15", style:hourstyle},{name:"15",title:"13:15-13:30", style:fifteenminutes},{name:"30",title:"13:30-13:45", style:fifteenminutes},{name:"45",title:"13:45-14:00", style:fifteenminutes},
            {name:"14",title:"14:00-14:15", style:hourstyle},{name:"15",title:"14:15-14:30", style:fifteenminutes},{name:"30",title:"14:30-14:45", style:fifteenminutes},{name:"45",title:"14:45-15:00", style:fifteenminutes},
            {name:"15",title:"15:00-15:15", style:hourstyle},{name:"15",title:"15:15-15:30", style:fifteenminutes},{name:"30",title:"15:30-15:45", style:fifteenminutes},{name:"45",title:"15:45-16:00", style:fifteenminutes},
            {name:"16",title:"16:00-16:15", style:hourstyle},{name:"15",title:"16:15-16:30", style:fifteenminutes},{name:"30",title:"16:30-16:45", style:fifteenminutes},{name:"45",title:"16:45-17:00", style:fifteenminutes},
            {name:"17",title:"17:00-17:15", style:hourstyle},{name:"15",title:"17:15-17:30", style:fifteenminutes},{name:"30",title:"17:30-17:45", style:fifteenminutes},{name:"45",title:"17:45-18:00", style:fifteenminutes},
            {name:"18",title:"18:00-18:15", style:hourstyle},{name:"15",title:"18:15-18:30", style:fifteenminutes},{name:"30",title:"18:30-18:45", style:fifteenminutes},{name:"45",title:"18:45-19:00", style:fifteenminutes},
            {name:"19",title:"19:00-19:15", style:hourstyle},{name:"15",title:"19:15-19:30", style:fifteenminutes},{name:"30",title:"19:30-19:45", style:fifteenminutes},{name:"45",title:"19:45-20:00", style:fifteenminutes},
            {name:"20",title:"20:00-20:15", style:hourstyle},{name:"15",title:"20:15-20:30", style:fifteenminutes},{name:"30",title:"20:30-20:45", style:fifteenminutes},{name:"45",title:"20:45-21:00", style:fifteenminutes},
            {name:"21",title:"21:00-21:15", style:hourstyle},{name:"15",title:"21:15-21:30", style:fifteenminutes},{name:"30",title:"21:30-21:45", style:fifteenminutes},{name:"45",title:"21:45-22:00", style:fifteenminutes},
            {name:"22",title:"22:00-22:15", style:hourstyle},{name:"15",title:"22:15-22:30", style:fifteenminutes},{name:"30",title:"22:30-22:45", style:fifteenminutes},{name:"45",title:"22:45-23:00", style:fifteenminutes},
            {name:"23",title:"23:00-23:15", style:hourstyle},{name:"15",title:"23:15-23:30", style:fifteenminutes},{name:"30",title:"23:30-23:45", style:fifteenminutes},{name:"45",title:"23:45-00:00", style:fifteenminutes}
        ];
        const timesheetDayList = [
            {name:"Monday"},{name:"Tuesday"},{name:"Wednesday"},{name:"Thursday"},{name:"Friday"},{name:"Saturday"},{name:"Sunday"}
        ];
        var timesheetData = [
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
        ];
    </script>

And inside the official js script (timeSheet.js), on line 337, i've updated the line like that. from: curCell = '<td class="TimeSheet-cell '+(row===sheetOption.data.dimensions[0]-1?'bottomMost ':' ')+(col===sheetOption.data.dimensions[1]?'rightMost':'')+'" data-row="'+row+'" data-col="'+(col-1)+'"></td>'; to: curCell = '<td class="TimeSheet-cell '+(row===sheetOption.data.dimensions[0]-1?'bottomMost ':' ')+(col===sheetOption.data.dimensions[1]?'rightMost':'')+'" data-row="'+row+'" data-col="'+(col-1)+'" style="'+(sheetOption.data.colHead[col-1].style ? sheetOption.data.colHead[col-1].style : '')+'"></td>';

R0B3RDV commented 3 years ago

Hi,

Thank you for all your help so far! i've managed to get a working example, but now as you can see in the screenshot, the times are not right?

image

I think its something very small but my javascript and jquery is not my best expertise :( , i hope you could help me with this?

Thank you in advance and best regards, Robert