Change REport and Correct Docker file to add THSarabunFont to Docker Image
This commit is contained in:
parent
302ee1dd3b
commit
55a83a43ec
17 changed files with 1982 additions and 7 deletions
|
|
@ -61,7 +61,12 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Report\Recruit\" />
|
<None Update="Report\Recruit\rptCertificate1.trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Report\Recruit\rptCertificate2.trdp">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,12 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
|
||||||
[HttpGet("certificate/{id:length(36)}/{examId}")]
|
[HttpGet("certificate/{type:int}/{id:length(36)}/{examId}")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public async Task<ActionResult<ResponseObject>> GetPeriodByIdAsync(Guid id, string examId)
|
public async Task<ActionResult<ResponseObject>> GetPeriodByIdAsync(Guid id, string examId,int type)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -80,12 +80,13 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
Year = p.RecruitImport.Year,
|
Year = p.RecruitImport.Year,
|
||||||
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||||
ExamResult = sr == null ? "" : sr.ExamStatus,
|
ExamResult = sr == null ? "" : sr.ExamStatus,
|
||||||
EndDate = DateTime.Now.ToThaiShortDate2()
|
EndDate = DateTime.Now.ToThaiFullDate3(), // must replace from database
|
||||||
|
AuthName = "นายณัฐพงศ์ ดิษยบุตร",
|
||||||
|
AuthPosition = "หัวหน้าสำนักงาน ก.ก."
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", "rptCertificate.trdp");
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptCertificate{type}.trdp");
|
||||||
ReportPackager reportPackager = new ReportPackager();
|
ReportPackager reportPackager = new ReportPackager();
|
||||||
Telerik.Reporting.Report report = null;
|
Telerik.Reporting.Report report = null;
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
|
|
|
||||||
14
Dockerfile
14
Dockerfile
|
|
@ -8,7 +8,7 @@ EXPOSE 443
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY Components ./Components
|
COPY Components ./Components
|
||||||
COPY ["nuget.config", "."]
|
COPY nuget.config .
|
||||||
COPY ["BMA.EHR.Report.Service.csproj", "."]
|
COPY ["BMA.EHR.Report.Service.csproj", "."]
|
||||||
RUN dotnet restore "./BMA.EHR.Report.Service.csproj"
|
RUN dotnet restore "./BMA.EHR.Report.Service.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
@ -19,6 +19,18 @@ FROM build AS publish
|
||||||
RUN dotnet publish "BMA.EHR.Report.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
RUN dotnet publish "BMA.EHR.Report.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get -y install fontconfig && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev
|
||||||
|
COPY ./Fonts/THSarabunIT.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunITBold.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunITItalic.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunITBoldItalic.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunNew.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunNewBold.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunNewItalic.ttf /usr/share/fonts/truetype/
|
||||||
|
COPY ./Fonts/THSarabunNewBoldItalic.ttf /usr/share/fonts/truetype/
|
||||||
|
RUN fc-cache -f -v
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
ENTRYPOINT ["dotnet", "BMA.EHR.Report.Service.dll"]
|
ENTRYPOINT ["dotnet", "BMA.EHR.Report.Service.dll"]
|
||||||
BIN
Fonts/THSarabunIT.ttf
Normal file
BIN
Fonts/THSarabunIT.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunITBold.ttf
Normal file
BIN
Fonts/THSarabunITBold.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunITBoldItalic.ttf
Normal file
BIN
Fonts/THSarabunITBoldItalic.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunITItalic.ttf
Normal file
BIN
Fonts/THSarabunITItalic.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunNew.ttf
Normal file
BIN
Fonts/THSarabunNew.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunNewBold.ttf
Normal file
BIN
Fonts/THSarabunNewBold.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunNewBoldItalic.ttf
Normal file
BIN
Fonts/THSarabunNewBoldItalic.ttf
Normal file
Binary file not shown.
BIN
Fonts/THSarabunNewItalic.ttf
Normal file
BIN
Fonts/THSarabunNewItalic.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
Report/Recruit/rptCertificate1.trdp
Normal file
BIN
Report/Recruit/rptCertificate1.trdp
Normal file
Binary file not shown.
BIN
Report/Recruit/rptCertificate2.trdp
Normal file
BIN
Report/Recruit/rptCertificate2.trdp
Normal file
Binary file not shown.
184
wwwroot/index.html
Normal file
184
wwwroot/index.html
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
~ and other contributors as indicated by the @author tags.
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="./keycloak.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button onclick="keycloak.login()">Login</button>
|
||||||
|
<button onclick="keycloak.login({ action: 'UPDATE_PASSWORD' })">Update Password</button>
|
||||||
|
<button onclick="keycloak.logout()">Logout</button>
|
||||||
|
<button onclick="keycloak.register()">Register</button>
|
||||||
|
<button onclick="keycloak.accountManagement()">Account</button>
|
||||||
|
<button onclick="refreshToken(9999)">Refresh Token</button>
|
||||||
|
<button onclick="refreshToken(30)">Refresh Token (if <30s validity)</button>
|
||||||
|
<button onclick="loadProfile()">Get Profile</button>
|
||||||
|
<button onclick="updateProfile()">Update profile</button>
|
||||||
|
<button onclick="loadUserInfo()">Get User Info</button>
|
||||||
|
<button onclick="output(keycloak.tokenParsed)">Show Token</button>
|
||||||
|
<button onclick="output(keycloak.refreshTokenParsed)">Show Refresh Token</button>
|
||||||
|
<button onclick="output(keycloak.idTokenParsed)">Show ID Token</button>
|
||||||
|
<button onclick="showExpires()">Show Expires</button>
|
||||||
|
<button onclick="output(keycloak)">Show Details</button>
|
||||||
|
<button onclick="output(keycloak.createLoginUrl())">Show Login URL</button>
|
||||||
|
<button onclick="output(keycloak.createLogoutUrl())">Show Logout URL</button>
|
||||||
|
<button onclick="output(keycloak.createRegisterUrl())">Show Register URL</button>
|
||||||
|
<button onclick="output(keycloak.createAccountUrl())">Show Account URL</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Result</h2>
|
||||||
|
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="output"></pre>
|
||||||
|
|
||||||
|
<h2>Events</h2>
|
||||||
|
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="events"></pre>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function loadProfile() {
|
||||||
|
keycloak.loadUserProfile().success(function(profile) {
|
||||||
|
output(profile);
|
||||||
|
}).error(function() {
|
||||||
|
output('Failed to load profile');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateProfile() {
|
||||||
|
var url = keycloak.createAccountUrl().split('?')[0];
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
req.open('POST', url, true);
|
||||||
|
req.setRequestHeader('Accept', 'application/json');
|
||||||
|
req.setRequestHeader('Content-Type', 'application/json');
|
||||||
|
req.setRequestHeader('Authorization', 'bearer ' + keycloak.token);
|
||||||
|
|
||||||
|
req.onreadystatechange = function () {
|
||||||
|
if (req.readyState == 4) {
|
||||||
|
if (req.status == 200) {
|
||||||
|
output('Success');
|
||||||
|
} else {
|
||||||
|
output('Failed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
req.send('{"email":"myemail@foo.bar","firstName":"test","lastName":"bar"}');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadUserInfo() {
|
||||||
|
keycloak.loadUserInfo().success(function(userInfo) {
|
||||||
|
output(userInfo);
|
||||||
|
}).error(function() {
|
||||||
|
output('Failed to load user info');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshToken(minValidity) {
|
||||||
|
keycloak.updateToken(minValidity).then(function(refreshed) {
|
||||||
|
if (refreshed) {
|
||||||
|
output(keycloak.tokenParsed);
|
||||||
|
} else {
|
||||||
|
output('Token not refreshed, valid for ' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
|
||||||
|
}
|
||||||
|
}).catch(function() {
|
||||||
|
output('Failed to refresh token');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showExpires() {
|
||||||
|
if (!keycloak.tokenParsed) {
|
||||||
|
output("Not authenticated");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var o = 'Token Expires:\t\t' + new Date((keycloak.tokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||||
|
o += 'Token Expires in:\t' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds\n';
|
||||||
|
|
||||||
|
if (keycloak.refreshTokenParsed) {
|
||||||
|
o += 'Refresh Token Expires:\t' + new Date((keycloak.refreshTokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||||
|
o += 'Refresh Expires in:\t' + Math.round(keycloak.refreshTokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds';
|
||||||
|
}
|
||||||
|
|
||||||
|
output(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
function output(data) {
|
||||||
|
if (typeof data === 'object') {
|
||||||
|
data = JSON.stringify(data, null, ' ');
|
||||||
|
}
|
||||||
|
document.getElementById('output').innerHTML = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function event(event) {
|
||||||
|
var e = document.getElementById('events').innerHTML;
|
||||||
|
document.getElementById('events').innerHTML = new Date().toLocaleString() + "\t" + event + "\n" + e;
|
||||||
|
}
|
||||||
|
|
||||||
|
var keycloak = Keycloak();
|
||||||
|
|
||||||
|
keycloak.onAuthSuccess = function () {
|
||||||
|
event('Auth Success');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthError = function (errorData) {
|
||||||
|
event("Auth Error: " + JSON.stringify(errorData) );
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthRefreshSuccess = function () {
|
||||||
|
event('Auth Refresh Success');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthRefreshError = function () {
|
||||||
|
event('Auth Refresh Error');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthLogout = function () {
|
||||||
|
event('Auth Logout');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onTokenExpired = function () {
|
||||||
|
event('Access token expired.');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onActionUpdate = function (status) {
|
||||||
|
switch (status) {
|
||||||
|
case 'success':
|
||||||
|
event('Action completed successfully'); break;
|
||||||
|
case 'cancelled':
|
||||||
|
event('Action cancelled by user'); break;
|
||||||
|
case 'error':
|
||||||
|
event('Action failed'); break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Flow can be changed to 'implicit' or 'hybrid', but then client must enable implicit flow in admin console too
|
||||||
|
var initOptions = {
|
||||||
|
responseMode: 'fragment',
|
||||||
|
flow: 'standard'
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.init(initOptions).then(function(authenticated) {
|
||||||
|
output('Init Success (' + (authenticated ? 'Authenticated' : 'Not Authenticated') + ')');
|
||||||
|
}).catch(function() {
|
||||||
|
output('Init Error');
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1766
wwwroot/keycloak.js
Normal file
1766
wwwroot/keycloak.js
Normal file
File diff suppressed because one or more lines are too long
7
wwwroot/keycloak.json
Normal file
7
wwwroot/keycloak.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"realm": "bma-ehr",
|
||||||
|
"auth-server-url": "https://identity.frappet.com",
|
||||||
|
"ssl-required": "external",
|
||||||
|
"resource": "bma-ehr",
|
||||||
|
"public-client": true
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue