fix itemmovementmaster
update qrmaster
This commit is contained in:
parent
0f2b065c66
commit
ca46776473
@ -407,24 +407,24 @@
|
||||
// Generate QR codes after rows are rendered
|
||||
const api = this.api();
|
||||
api.rows().every(function () {
|
||||
const data = this.data(); // Row data
|
||||
const containerId = `qr${data.id}`;
|
||||
|
||||
const data = this.data();
|
||||
const containerId = `qr${data.id}`; //containerid is by increments from API
|
||||
const container = $(`#${containerId}`);
|
||||
|
||||
container.empty();
|
||||
container.append(`${data.item.itemId}`);
|
||||
|
||||
// console.log(container[0]);
|
||||
if (container) {
|
||||
// Generate QR code only if not already generated
|
||||
new QRCode(container[0], {
|
||||
text: data.qrString,
|
||||
width: 100,
|
||||
height: 100,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.M
|
||||
});
|
||||
if (container.length) {
|
||||
|
||||
|
||||
new QRCode(container[0], {
|
||||
text: data.qrString,
|
||||
width: 100,
|
||||
height: 100,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.M,
|
||||
});
|
||||
}
|
||||
// container.on('click', function() {
|
||||
// window.open(data.qrString, '_blank');
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="row card">
|
||||
<div class="card-header">
|
||||
<h2>Item Request</h2>
|
||||
<h2>Complete Request</h2>
|
||||
@* <button id="addRequestBtn" class="btn btn-success col-md-3 col-lg-3 m-1 col-12"><i class="fa fa-plus"></i> Add Request</button> *@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@ -240,6 +240,31 @@
|
||||
{
|
||||
"title": "Document/Picture",
|
||||
"data": "document",
|
||||
"render": function (data, type, full, meta) {
|
||||
if (!data) {
|
||||
return "No Document";
|
||||
}
|
||||
|
||||
// Check if the document is an image based on file extension
|
||||
var isImage = /\.(jpeg|jpg|png|gif)$/i.test(data);
|
||||
var isPdf = /\.pdf$/i.test(data);
|
||||
|
||||
if (isImage) {
|
||||
return `<a href="${data}" target="_blank" data-lightbox="image-1">
|
||||
<img src="${data}" alt="Image" class="img-thumbnail" style="width: 100px; height: 100px;" />
|
||||
</a>`;
|
||||
}
|
||||
else if (isPdf) {
|
||||
return `<a href="${data}" target="_blank">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/8/87/PDF_file_icon.svg"
|
||||
alt="PDF Document" class="img-thumbnail"
|
||||
style="width: 50px; height: 50px;" />
|
||||
<br>View PDF
|
||||
</a>`;
|
||||
} else {
|
||||
return `<a href="${data}" target="_blank">Download File</a>`;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"title": "User Remark",
|
||||
@ -331,6 +356,31 @@
|
||||
{
|
||||
"title": "Document/Picture",
|
||||
"data": "document",
|
||||
"render": function (data, type, full, meta) {
|
||||
if (!data) {
|
||||
return "No Document";
|
||||
}
|
||||
|
||||
// Check if the document is an image based on file extension
|
||||
var isImage = /\.(jpeg|jpg|png|gif)$/i.test(data);
|
||||
var isPdf = /\.pdf$/i.test(data);
|
||||
|
||||
if (isImage) {
|
||||
return `<a href="${data}" target="_blank" data-lightbox="image-1">
|
||||
<img src="${data}" alt="Image" class="img-thumbnail" style="width: 100px; height: 100px;" />
|
||||
</a>`;
|
||||
}
|
||||
else if (isPdf) {
|
||||
return `<a href="${data}" target="_blank">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/8/87/PDF_file_icon.svg"
|
||||
alt="PDF Document" class="img-thumbnail"
|
||||
style="width: 50px; height: 50px;" />
|
||||
<br>View PDF
|
||||
</a>`;
|
||||
} else {
|
||||
return `<a href="${data}" target="_blank">Download File</a>`;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"title": "User Remark",
|
||||
@ -361,7 +411,6 @@
|
||||
// data-remark="${row.remark || ''}">
|
||||
// Reject
|
||||
// </button>`;
|
||||
|
||||
// },
|
||||
// "className": "align-middle",
|
||||
// },
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Azure.Core;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -643,7 +644,6 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
[HttpPost("AddItemMovement")]
|
||||
public async Task<IActionResult> AddItemMovement([FromBody] ItemMovementModel itemmovement)
|
||||
//public async Task<IActionResult> AddItemMovement()
|
||||
{
|
||||
|
||||
|
||||
@ -655,6 +655,32 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(itemmovement.ConsignmentNote))
|
||||
{
|
||||
var bytes = Convert.FromBase64String(itemmovement.ConsignmentNote);
|
||||
string filePath = "";
|
||||
|
||||
string uniqueName = $"{itemmovement.ItemId}_{Guid.NewGuid()}";
|
||||
|
||||
if (IsImage(bytes))
|
||||
{
|
||||
filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/media/inventory/itemmovement", uniqueName + itemmovement.ItemId + "_Request.jpg");
|
||||
itemmovement.ConsignmentNote = "/media/inventory/itemmovement/" + uniqueName + itemmovement.ItemId + "_Request.jpg";
|
||||
}
|
||||
else if (IsPdf(bytes))
|
||||
{
|
||||
filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/media/inventory/itemmovement", uniqueName + itemmovement.ItemId + "_Request.pdf");
|
||||
itemmovement.ConsignmentNote = "/media/inventory/itemmovement/" + uniqueName + itemmovement.ItemId + "_Request.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest("Unsupported file format.");
|
||||
}
|
||||
|
||||
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
|
||||
}
|
||||
|
||||
_centralDbContext.ItemMovements.Add(itemmovement);
|
||||
|
||||
await _centralDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
wwwroot/Media/Inventory/request/sequence diagram.png
Normal file
BIN
wwwroot/Media/Inventory/request/sequence diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Loading…
Reference in New Issue
Block a user