literyz-js/demo-project.html
2024-08-08 12:13:28 +01:00

178 lines
4.2 KiB
HTML

<!doctype html>
<html lang="en-GB">
<head>
<meta charset="UTF-8" />
<meta http-equiv="content-type" content="text/html" charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="keyword" content="" />
<script src="dist/extensions.js"></script>
<!-- <script src="build/ryzproj.min.js"></script> -->
<script src="dist/project.js"></script>
<!-- <script src="project/task-grid.js"></script> -->
<!-- <script src="project/gantt-chart.js"></script> -->
<link href="demo-project.css" rel="stylesheet" />
<title></title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 10pt;
padding: 10px;
}
.row {
/* display: flex; */
}
.row:after {
content: "";
display: table;
clear: both;
}
.column {
/* flex: 50%; */
float: left;
/* width: 50%; */
}
</style>
</head>
<body>
<div class="row">
<div class="column" id="taskGrid1" style="width:800px">
</div>
<div class="column" style="padding-left: 3px; width: calc(100% - 800px - 3px);">
<!-- <div style="width:100%; height: 100%; overflow: scroll;"> -->
<div id="ganttChart1"></div>
<!-- </div> -->
</div>
</div>
<script>
Document.ready(async function() {
var project1 = new LiteRyzJS.Project({ Name: "New Project 1" });
var taskGrid1 = null;
var ganttChart1 = null;
project1.AddTask({
ID: 1,
Name: "Task A",
StartDelay: 0,
Duration: Math.randomN(0, 28),
PredecessorTaskID: null,
IsCollated: false,
CollatedTaskID: null
});
project1.AddTask({
ID: 2,
Name: "Task B",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: 1,
IsCollated: false,
CollatedTaskID: null
});
project1.AddTask({
ID: 5,
Name: "Task B1",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: 2,
IsCollated: true,
CollatedTaskID: null
});
project1.AddTask({
ID: 6,
Name: "Task B11",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: null,
IsCollated: false,
CollatedTaskID: 5
});
project1.AddTask({
ID: 7,
Name: "Task B12",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: null,
IsCollated: false,
CollatedTaskID: 5,
Progress: 50
});
project1.AddTask({
ID: 8,
Name: "Task E",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: null,
IsCollated: true,
CollatedTaskID: null
});
project1.AddTask({
ID: 9,
Name: "Task E1",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: null,
IsCollated: false,
CollatedTaskID: 8
});
project1.AddTask({
ID: 3,
Name: "Task C",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: 8,
IsCollated: false,
CollatedTaskID: null
});
project1.AddTask({
ID: 4,
Name: "Task D",
StartDelay: Math.randomN(0, 5),
Duration: Math.randomN(0, 28),
PredecessorTaskID: 3,
IsCollated: false,
CollatedTaskID: null
});
project1.Invalidate();
console.log(new Date(project1.StartDate).toLocaleDateString() + " - " + new Date(project1.FinishDate).toLocaleDateString() + " [" + project1.Duration + "]");
const taskData = project1.ExportTasks();
console.log(project1.Tasks);
console.log(taskData);
if (taskGrid1 == null) taskGrid1 = new LiteRyzJS.ProjectTaskGrid(document.getElementById("taskGrid1"));
taskGrid1.Render(taskData);
if (ganttChart1 == null) ganttChart1 = new LiteRyzJS.GanttChart(document.getElementById("ganttChart1"), {});
ganttChart1.Load(project1);
});
</script>
</body>
</html>