Skip to content

Commit

Permalink
full summery report partially completed
Browse files Browse the repository at this point in the history
  • Loading branch information
YujithIsura committed Jul 4, 2020
1 parent 2426e53 commit 5797638
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 0 deletions.
135 changes: 135 additions & 0 deletions templates/incidents/complaints/full_summary_report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
const config = require("../../../config");
const baseURL = config("BASE_URL");

module.exports = data => {
const options = {
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
hour12: false
};
const today = new Intl.DateTimeFormat("en-LK", options).format(new Date());

return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="${baseURL}/css/bootstrap.min.css" >
<title>Daily Summary For Media</title>
<style>
@page {
size: auto;
}
td,
th {
border-color: black !important;
}
th {
border-bottom: none !important;
}
input {
border: 0;
border-bottom: 1px solid black;
border-style: dotted;
background: none;
width: 62%;
margin-top: 5px;
text-align: center;
}
.bold {
font-weight: bold;
}
.document-border {
padding: 2px;
padding-left: 5px;
padding-right: 5px;
}
body {
font-family: serif;
}
.table tbody td {
padding: 0.05em;
vertical-align: middle;
text-align: center;
}
</style>
</head>
<body class="document-border">
<div class="container">
<div class="row">
<div class="col-12">
<table class="table table-bordered">
<thead class="tblhead">
<tr scope="col-12" class="text-center">
<th colspan="18">
පාර්ලිමේන්තු මැතිවරණය 2020 - මැතිවරණ පැමිණිලි වාර්තාව
</th>
</tr>
<tr scope="col-12" class="text-center">
<th rowspan="2" cope="col-1">අනු අංකය</th>
<th rowspan="2" cope="col-1">පැමිණිලි අංකය</th>
<th colspan="4" scope="col-2">පැමිණිල්ල ලද ආකාරය</th>
<th rowspan="2" scope="col-1">පැමිණිල්ල ලද දිනය</th>
<th rowspan="2" scope="col-1">පැමිණිලිකරු</th>
<th rowspan="2" scope="col-1">සිද්දිය සිදුවූ ස්ථානය/ අදාළ පොලිස් බල ප්‍රදේශය</th>
<th rowspan="2" scope="col-1">සාරාංශගත පැමිණිල්ල</th>
<th colspan="3" scope="col-1">පැමිණිලි වර්ගය හා අංකය *</th>
<th colspan="3" scope="col-1">පැමිණිල්ලේ ස්වබාවය</th>
<th rowspan="2" scope="col-1">පැමිණිල්ල යොමු කල පාර්ශවයන්</th>
<th rowspan="2" scope="col-1">ප්‍රගතිය</th>
</tr>
<tr scope="col-12" class="text-center">
<th scope="col-2">Ltr</th>
<th scope="col-1">Tel</th>
<th scope="col-1">Fax</th>
<th scope="col-1">e-mail</th>
<th scope="col-1">ප්‍ර. ක්‍රියා</th>
<th scope="col-2">මැ. නී. උ</th>
<th scope="col-1">වෙනත්</th>
<th scope="col-1">සුළු</th>
<th scope="col-1">සාමාන්‍ය</th>
<th scope="col-1">බරපතල</th>
</tr>
</thead>
<tbody>
${generateRows(data.complaintsPast24hours)}
</tbody>
</table>
</div>
</div>
</table>
</div>
</div>
</body>
</html>
`;
};

function generateRows(rowData) {
var i = 1;
return `<tr>
<td>${i++}</td>
<td>${rowData.national.disputes}</td>
<td>${rowData.national.disputes}</td>
<td>${rowData.national.disputes}</td>
<td>${rowData.national.violationOfLaws}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.amount}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.amount}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.amount}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.amount}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.amount}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.others}</td>
<td>${rowData.national.amount}</td>
</tr>`;
}
141 changes: 141 additions & 0 deletions templates/incidents/complaints/full_summary_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
### Sample JSON for populating the report

Use the following JSON as request body to populate report.

```JSON
{
"file": {
"template": "incidents/complaints/daily_summary_report.js",
"incidents": [
{
"refId": "EC/EDR/PE20/JAF/0002",
"channel": "Letter",
"created_date": "2020/06/15",
"reporter": "adasdasdad",
"location": "fsdfdfdsf - Jaffna",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/JAF/0003",
"channel": "Email",
"created_date": "2020/06/15",
"reporter": "sdfasdfd",
"location": "Jaffna",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/JAF/0003",
"channel": "Letter",
"created_date": "2020/06/15",
"reporter": "asdfsdf",
"location": "Jaffna",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/HAM/0004",
"channel": "Letter",
"created_date": "2020/06/21",
"reporter": "Cleement",
"location": "Hambantota",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/GAM/0005",
"channel": "Email",
"created_date": "2020/06/22",
"reporter": "adadadadadass",
"location": "Gampaha",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/KAN/0006",
"channel": "Email",
"created_date": "2020/06/25",
"reporter": "",
"location": "Kandy",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/GAM/0007",
"channel": "Letter",
"created_date": "2020/06/25",
"reporter": "",
"location": "Gampaha",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/GAM/0008",
"channel": "Fax",
"created_date": "2020/06/25",
"reporter": "",
"location": "Gampaha",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/KAN/0009",
"channel": "Letter",
"created_date": "2020/06/25",
"reporter": "",
"location": "Kandy",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/GAM/0010",
"channel": "Letter",
"created_date": "2020/06/26",
"reporter": "",
"location": "Gampaha",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/JAF/0011",
"channel": "Letter",
"created_date": "2020/06/26",
"reporter": "",
"location": "Jaffna",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/HAM/0014",
"channel": "Letter",
"created_date": "2020/07/01",
"reporter": "sfsdfdfdf",
"location": "Hambantota",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/KEG/0012",
"channel": "Letter",
"created_date": "2020/07/01",
"reporter": "sdfafasdf",
"location": "Kegalle",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/JAF/0013",
"channel": "Letter",
"created_date": "2020/07/01",
"reporter": "",
"location": "Jaffna",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/KIL/0015",
"channel": "Letter",
"created_date": "2020/07/01",
"reporter": "asdfasdf",
"location": "Kilinochchi",
"summery" : "shkdfksjdhf kjshdfk"
},
{
"refId": "EC/EDR/PE20/GAM/0016",
"channel": "Letter",
"created_date": "2020/07/01",
"reporter": "",
"location": "Gampaha",
"summery" : "shkdfksjdhf kjshdfk"
}
]
}
}
```

0 comments on commit 5797638

Please sign in to comment.