MbtPlanner

MbtPlanner

new MbtPlanner(id)

Source:
Parameters:
Name Type Description
id any

Unique identifier of a DOM element that will be used as placeholder for the planner

Members

CustomFormatter

Properties:
Name Type Description
CustomFormatter function

function that returns a string from a Task object. Default:

(task) => task.IRef + ": " + task.Code
Source:

CustomResourceFooter

Properties:
Name Type Description
CustomResourceFooter function

function that returns a string from a Resource object, and load aggregated value. Default:

(r, load) => r.Id.toString() + ": " + load.toFixed(2)
Source:

Resources

Properties:
Name Type Description
Resources array

an array of

{ Id: id, OutOfWorkDays: [], string XXXX-MM-DD ClosedIsoDays: [], int between 0 and 6. 7 is equivalent to 0 (sunday) }

Source:

Save

Properties:
Name Type Description
Save function

function that saves modified task completions. Default:

null
Source:

Methods

AppendClosedIsoDay(resourceIdnullable, daynon-null)

Append a closed day

Source:
Parameters:
Name Type Attributes Description
resourceId "*" | any <nullable>

an identifier of the resource. If "*" then you alter this.ClosedIsoDays.

day int

between 1 (Monday) to 7 (Sunday)

AppendOutOfWorkDay(resourceIdnullable, daynon-null)

Append an out of work day

Source:
Parameters:
Name Type Attributes Description
resourceId "*" | any <nullable>

an idnetifier of the resource. If "*" then you alter this.OutOfWorkDays.

day date | string

string may be a json serailized date or a "yyyy-mm-dd".

AppendTasks(tasks, codes)

Append a list of tasks to the planner and create the associated resources. there is no other way to append a resource to the planner.

Source:
Parameters:
Name Type Description
tasks array

an array of appendable task object.

{
  Id:         not null, unique identifier of the task. task silently ignored if not set
              if two tasks has the same id they will be considered as one.
  Code:       not null, task type identifier. task silently ignored if not set

  ResourceId: can be null, unique identifier of a resource
  Label:      can be null, default : "", not used but in CustomFormatter
  IRef:       can be null, default : "", case identifier
  DueDate:    can be null, date yyyy-MM-dd or json date
  Load:       can be null, float, default : 0, float the whole load (in day) for the task
                  => can be set by Code and this.DefaultLoads = [ {
                      Code : not null
                      Load : not null, float
                  }]
  Completion: can be null, default : 0, % of completion of the task,
                  => load to be planned = Load * ( 1 - Completion / 100),
  ExOrder:    can be null, int, default null

  OTask:      the original object, may be used by CustomFormatter
}
codes array

can be null. Default load for task code.

{
  Code:       not null
  Load:       not null, float
}

Draw(drawMinDate, mode)

Draw the planner in the DOM.

Source:
Parameters:
Name Type Description
drawMinDate date | string

the almost first date displayed. The first date displayed is always the first day of a week.

mode string

"html" or "html". Default: "html".

GetDeltas() → {array}

Source:
Returns:
Type:
array

Only altered tasks are returned. If the array is empty, then no task was altered.

{
  Id:                 identifier of the task
  InitialCompletion:  float, the initial value of the completion
  CompltetionDelta:   float, the variation of the completion
  InitialExOrder:     int, the initial value of the rank of the task.
  ExOrderDelta:       int, the variation of the rank.
}

Plan(direction, fromnullable)

Tasks are planned ordered by resource, then by ExOrder, then by due date.

Source:
Parameters:
Name Type Attributes Description
direction string

"forward" or "forward". Default: "forward"

from date | string <nullable>

The date used a the first planned day. Default: now() + 1 day

(async) QueryPlanAndDrawAsync(queryObject, successEval, businessSuccessEval, businessError, error)

Short for aysnc load task, then plan, then draw

await r.QueryPlanAndDrawAsync(
  {
    url: "/DeadLine/ForPlanner/",
    data: {
      id: $("#@plannedUserId").val().toString(),
      period: $("#@plannedPeriodId").val().toString()
    }
  },
  function (r) { return r.ExitCode !== undefined },
  function (r) { return r.ExitCode === 0; },
  function (r) { appendMessage("res", "Something is wrong: " + r.ExitCode.toString(), "warning"); },
  function () { appendMessage("res", "Something is wrong, but I don't know what!", "danger"); },
  function (p) {
    p.AppendOutOfWorkDay(51, "2019-01-02");
  }
);

A json return comprising a Data member as an array of appendable tasks is expected.

Source:
Parameters:
Name Type Description
queryObject function

a jquery object for an ajax request. Param is the return of the ajax call.

successEval function

a function to evaluate if the ajax call was successfull. Param is the return of the ajax call.

businessSuccessEval function

a function to evaluate if the call was successfull from the server point of view. Param is the return of the ajax call.

businessError function

a function to handle the business error. Param is the return of the ajax call.

error function

a function to handle the not recoverble errors. No Param.

beforePlan. function

A function to setup the planner before the call to Plan, but after the call to AppendTasks. Param: the planner, the return of the ajax call.

dataGetter. function

How to get the tasks from the response. Param: the return of the ajax call.

keepResources.

If true, does not clear Resources during planner reset. Default = false

ResetPlanner()

Reset the planner, that is set Tasks and Resources to empty arrays.

Source:

(async) ResetPlannerAsync()

Source:
See:
  • ResetPlanner

SetBackGroundColor(resourceIdnullable, colornon-null)

Set the the color of worked days for the resource.

Source:
Parameters:
Name Type Attributes Description
resourceId any <nullable>

an identifier of the resource. "*" is inefective ins this context.

color string

a color that will be set as background through a css style. Edit MbtPlanner.css for this.

SetSave(save)

Source:
See:
  • GetDeltas
Parameters:
Name Type Description
save function

a function taking the result of this.GetDeltas() as parameter. Awaited id save is async.