fix table in ui
This commit is contained in:
parent
e1cf4fc885
commit
00264dd2d2
@ -20,6 +20,7 @@
|
||||
<div id="registerItem" class="row">
|
||||
<div class="row card">
|
||||
<div class="card-header">
|
||||
<h2>Item Movement List</h2>
|
||||
@* <button id="addItemBtn" class="btn btn-success col-md-3 col-lg-3 m-1 col-12"><i class="fa fa-plus"></i> Add Item</button> *@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@ -286,63 +287,23 @@
|
||||
this.itemDatatable = $('#itemDatatable').DataTable({
|
||||
"data": this.items,
|
||||
"columns": [
|
||||
{
|
||||
"title": "Unique Id",
|
||||
"data": "id",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
// Assign a unique ID to the <td> element
|
||||
$(td).attr('id', `qr${cellData}`);
|
||||
},
|
||||
},
|
||||
{
|
||||
"title": "Print",
|
||||
"data": "item.itemId",
|
||||
"render": function (data, type, full, meta) {
|
||||
var printButton = `<button type="button" class="btn btn-success print-btn" data-id="${data}">Print</button>`;
|
||||
return printButton;
|
||||
},
|
||||
"className": "align-middle",
|
||||
},
|
||||
{
|
||||
"title": "To User",
|
||||
"data": "item.toUser",
|
||||
},
|
||||
{
|
||||
"title": "Last User",
|
||||
"data": "item.lastUser",
|
||||
},
|
||||
{
|
||||
"title": "Action",
|
||||
"data": "item.action",
|
||||
},
|
||||
{
|
||||
"title": "Latest Status",
|
||||
"data": "item.latestStatus",
|
||||
},
|
||||
{
|
||||
"title": "Quantity",
|
||||
"data": "item.quantity",
|
||||
},
|
||||
{
|
||||
"title": "To Station",
|
||||
"data": "item.toStation",
|
||||
},
|
||||
{
|
||||
"title": "To Store",
|
||||
"data": "item.toStore",
|
||||
},
|
||||
{
|
||||
"title": "To Other",
|
||||
"data": "item.toOther",
|
||||
},
|
||||
{
|
||||
"title": "Remark",
|
||||
"data": "item.remark",
|
||||
},
|
||||
{
|
||||
"title": "Note",
|
||||
"data": "item.consignmentNote",
|
||||
"render": function (data, type, full, meta) {
|
||||
{ title: "Unique Id", data: "id" },
|
||||
{ title: "Product Code", data: "uniqueID" },
|
||||
{ title: "From User", data: "toUserName" },
|
||||
{ title: "Last User", data: "lastUserName" },
|
||||
{ title: "From Station", data: "toStationName" },
|
||||
{ title: "Last Station", data: "lastStationName" },
|
||||
{ title: "From Store", data: "toStoreName" },
|
||||
{ title: "Last Store", data: "lastStoreName" },
|
||||
{ title: "Action", data: "action" },
|
||||
{ title: "Start Status", data: "toOther" },
|
||||
{ title: "Latest Status", data: "latestStatus" },
|
||||
{ title: "Qty", data: "quantity" },
|
||||
{ title: "Send Date", data: "sendDate" },
|
||||
{ title: "Receive Date", data: "receiveDate" },
|
||||
{ title: "Note",
|
||||
data: "consignmentNote",
|
||||
render: function (data, type, full, meta) {
|
||||
if (!data) {
|
||||
return "No Document";
|
||||
}
|
||||
@ -355,7 +316,8 @@
|
||||
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) {
|
||||
}
|
||||
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"
|
||||
@ -366,95 +328,41 @@
|
||||
return `<a href="${data}" target="_blank">Download File</a>`;
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
"title": "Send Date",
|
||||
"data": "item.date",
|
||||
},
|
||||
{
|
||||
"title": "Last User",
|
||||
"data": "item.lastUser",
|
||||
},
|
||||
{
|
||||
"title": "Last Store",
|
||||
"data": "item.lastStore",
|
||||
},
|
||||
{
|
||||
"title": "Last Station",
|
||||
"data": "item.lastStation",
|
||||
},
|
||||
{
|
||||
"title": "Latest Status",
|
||||
"data": "item.latestStatus",
|
||||
},
|
||||
{
|
||||
"title": "Receive Date",
|
||||
"data": "item.date",
|
||||
},
|
||||
{ title: "Remark", data: "remark" },
|
||||
{
|
||||
"title": "Completion",
|
||||
"data": "item.movementComplete",
|
||||
"data": "movementComplete",
|
||||
},
|
||||
|
||||
// {
|
||||
// "title": "Warranty Until",
|
||||
// "data": "warranty",
|
||||
// "render": function (data, type, full, meta) {
|
||||
// if (data > 0) { return full.endWDate }
|
||||
// else { return data }
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "title": "Location",
|
||||
// "data": "currentUser",
|
||||
// "render": function (data, type, full, meta) {
|
||||
// currentUser = data ?? null;
|
||||
// currentStore = full.currentStore ?? 'N/A';
|
||||
// currentStation = full.currentStation ?? 'N/A';
|
||||
// return `User: ${currentUser}<br>
|
||||
// Store: ${currentStore}<br>
|
||||
// Station: ${currentStation}`
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "title": "Delete",
|
||||
// "data": "itemID",
|
||||
// "render": function (data) {
|
||||
// var deleteButton = `<button type="button" class="btn btn-danger delete-btn" data-id="${data}">Delete</button>`;
|
||||
// return deleteButton;
|
||||
// },
|
||||
// "className": "align-middle",
|
||||
// }
|
||||
],
|
||||
responsive: true,
|
||||
drawCallback: function (settings) {
|
||||
// Generate QR codes after rows are rendered
|
||||
const api = this.api();
|
||||
api.rows().every(function () {
|
||||
const data = this.data();
|
||||
const containerId = `qr${data.id}`; //containerid is by increments from API
|
||||
const container = $(`#${containerId}`);
|
||||
// const api = this.api();
|
||||
// api.rows().every(function () {
|
||||
// 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}`);
|
||||
// container.empty();
|
||||
// container.append(`${data.item.itemId}`);
|
||||
|
||||
if (container.length) {
|
||||
// if (container.length) {
|
||||
|
||||
|
||||
new QRCode(container[0], {
|
||||
text: data.qrString,
|
||||
width: 100,
|
||||
height: 100,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.M,
|
||||
});
|
||||
}
|
||||
// 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');
|
||||
// });
|
||||
});
|
||||
// });
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -231,7 +231,6 @@
|
||||
"title": "User ID",
|
||||
"data": "userName",
|
||||
},
|
||||
|
||||
{
|
||||
"title": "Product Category",
|
||||
"data": "productCategory",
|
||||
@ -348,6 +347,10 @@
|
||||
"title": "Product Name",
|
||||
"data": "productName",
|
||||
},
|
||||
{
|
||||
"title": "User ID",
|
||||
"data": "userName",
|
||||
},
|
||||
{
|
||||
"title": "Product Category",
|
||||
"data": "productCategory",
|
||||
|
||||
@ -684,6 +684,7 @@ zx <div v-if="itemlateststatus == 'Faulty
|
||||
// }
|
||||
// );
|
||||
|
||||
|
||||
navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(() => {
|
||||
this.html5QrCodeScanner = new Html5QrcodeScanner("reader", config, false);
|
||||
|
||||
@ -550,7 +550,18 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
public async Task<IActionResult> ItemMovementList()
|
||||
{
|
||||
|
||||
var itemMovementList = await _centralDbContext.ItemMovements.Include(i => i.NextUser).ToListAsync();
|
||||
//var itemMovementList = await _centralDbContext.ItemMovements.Include(i => i.NextUser).Include(i => i.Item).ThenInclude(i => i.Product).ToListAsync();
|
||||
|
||||
var itemMovementList = await _centralDbContext.ItemMovements
|
||||
.Include(i => i.Item)
|
||||
.ThenInclude(i => i.Product)
|
||||
.Include(i => i.FromStore)
|
||||
.Include(i => i.FromStation)
|
||||
.Include(i => i.FromUser)
|
||||
.Include(i => i.NextStore)
|
||||
.Include(i => i.NextStation)
|
||||
.Include(i => i.NextUser)
|
||||
.ToListAsync();
|
||||
//var itemList = await _centralDbContext.Items.ToListAsync();
|
||||
|
||||
int itemrow = 0;
|
||||
@ -559,13 +570,55 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
id = itemrow++,
|
||||
item, // Includes all properties of the original item
|
||||
QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String
|
||||
userName = item.NextUser?.FullName
|
||||
ProductName = item.Item?.Product?.ProductName,
|
||||
toUserName = item.NextUser?.FullName,
|
||||
lastUserName = item.FromUser?.FullName
|
||||
}).ToList();
|
||||
//Console.WriteLine(Json(itemMovementList));
|
||||
|
||||
|
||||
//return Json(itemMovementList);
|
||||
return Json(itemMovementListWithQR);
|
||||
//return Json(itemMovementListWithQR);
|
||||
|
||||
return Json(itemMovementList.Select(i => new
|
||||
{
|
||||
i.Id,
|
||||
i.ItemId,
|
||||
i.ToStation,
|
||||
i.ToStore,
|
||||
i.ToUser,
|
||||
UniqueID = i.Item?.UniqueID,
|
||||
ProductName = i.Item?.Product?.ProductName,
|
||||
LastUserName = i.FromUser?.FullName,
|
||||
LastStoreName = i.FromStore?.StoreName,
|
||||
LastStationName = i.FromStation?.StationName,
|
||||
ToUserName = i.NextUser?.FullName,
|
||||
ToStoreName = i.NextStore?.StoreName,
|
||||
ToStationName = i.NextStation?.StationName,
|
||||
i.ToOther,
|
||||
i.sendDate,
|
||||
i.Action,
|
||||
i.Quantity,
|
||||
i.Remark,
|
||||
i.ConsignmentNote,
|
||||
i.Date,
|
||||
i.LastUser,
|
||||
i.LastStore,
|
||||
i.LastStation,
|
||||
i.LatestStatus,
|
||||
i.receiveDate,
|
||||
i.MovementComplete
|
||||
}));
|
||||
|
||||
//return Json(itemMovementList.Select(item => new
|
||||
//{
|
||||
// id = itemrow++,
|
||||
// item,
|
||||
// QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.ItemId}", // Generate QR String
|
||||
// ProductName = item.Item?.Product?.ProductName,
|
||||
// toUserName = item.NextUser?.FullName,
|
||||
// lastUserName = item.FromUser?.FullName
|
||||
//}));
|
||||
}
|
||||
|
||||
[HttpPost("AddItemMovement")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user