Update Qr
This commit is contained in:
parent
ed04371e3c
commit
ce2a741450
@ -26,6 +26,8 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
public DateTime? approvalDate { get; set; }
|
||||
public int? RequestQuantity { get; set; }
|
||||
public string? Document { get; set; }
|
||||
public string? fromStoreItem { get; set; }
|
||||
public string? assignStoreItem { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
margin-left: auto !important; /* Push Complete/Incomplete to right */
|
||||
}
|
||||
</style>
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml")
|
||||
<div id="registerItem" class="row">
|
||||
<div class="row mb-3" >
|
||||
<h2 for="sortSelect" class="col-sm-1 col-form-h2" style="min-width:140px;">Sort by:</h2>
|
||||
|
||||
@ -638,18 +638,27 @@
|
||||
],
|
||||
responsive: true,
|
||||
drawCallback: function (settings) {
|
||||
// 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.uniqueID}`;
|
||||
const container = $(`#${containerId}`);
|
||||
container.empty();
|
||||
container.append(`${data.uniqueID}`);
|
||||
// console.log(container[0]);
|
||||
if (container) {
|
||||
// Generate QR code only if not already generated
|
||||
new QRCode(container[0], {
|
||||
setTimeout(() => {
|
||||
const api = this.api();
|
||||
api.rows().every(function () {
|
||||
const data = this.data();
|
||||
const containerId = `qr${data.uniqueID}`;
|
||||
const container = document.getElementById(containerId);
|
||||
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = "";
|
||||
container.append(data.uniqueID);
|
||||
|
||||
// Ensure qrString is valid before generating QR code
|
||||
if (!data.qrString) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate QR Code
|
||||
new QRCode(container, {
|
||||
text: data.qrString,
|
||||
width: 100,
|
||||
height: 100,
|
||||
@ -657,12 +666,9 @@
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.M
|
||||
});
|
||||
}
|
||||
// container.on('click', function() {
|
||||
// window.open(data.qrString, '_blank');
|
||||
// });
|
||||
});
|
||||
},
|
||||
});
|
||||
}, 100); // Small delay to ensure elements exist
|
||||
}
|
||||
})
|
||||
|
||||
// Attach click event listener to the delete buttons
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml")
|
||||
<div id="app">
|
||||
<div class="row card">
|
||||
<div class="card-header">
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
string userId = ViewBag.UserId;
|
||||
}
|
||||
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml")
|
||||
<div class="row">
|
||||
<div id="registerProduct" class="card m-1">
|
||||
<div class="row" v-if="addSection == true">
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml")
|
||||
<div id="registerStation">
|
||||
<form v-on:submit.prevent="addStation" data-aos="fade-right" id="registerStationForm" v-if="registerStationForm">
|
||||
<div class="container register" data-aos="fade-right">
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml")
|
||||
<div id="registerSupplier">
|
||||
<form v-on:submit.prevent="addSupplier" data-aos="fade-right" id="registerSupplierForm" v-if="registerSupplierForm">
|
||||
<div class="container register" data-aos="fade-right">
|
||||
|
||||
@ -969,6 +969,76 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
#endregion
|
||||
|
||||
#region ItemRequestAdmin
|
||||
|
||||
[HttpPost("AddRequestMaster")]
|
||||
public async Task<IActionResult> AddRequestMaster([FromBody] RequestModel request)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
try
|
||||
{
|
||||
var findUniqueCode = _centralDbContext.Products.FirstOrDefault(r => r.ProductId == request.ProductId);
|
||||
var findUniqueUser = _centralDbContext.Users.FirstOrDefault(r => r.Id == request.UserId);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Document))
|
||||
{
|
||||
|
||||
var bytes = Convert.FromBase64String(request.Document);
|
||||
string filePath = "";
|
||||
|
||||
var uniqueAbjad = new string(Enumerable.Range(0, 8).Select(_ => "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[new Random().Next(36)]).ToArray());
|
||||
|
||||
|
||||
if (IsImage(bytes))
|
||||
{
|
||||
filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/media/inventory/request", findUniqueUser.FullName + " " + findUniqueCode.ModelNo + "(" + uniqueAbjad + ") Request.jpg");
|
||||
request.Document = "/media/inventory/request/" + findUniqueUser.FullName + " " + findUniqueCode.ModelNo + "(" + uniqueAbjad + ") Request.jpg";
|
||||
}
|
||||
else if (IsPdf(bytes))
|
||||
{
|
||||
filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/media/inventory/request", findUniqueUser.FullName + " " + findUniqueCode.ModelNo + "_Request.pdf");
|
||||
request.Document = "/media/inventory/request/" + findUniqueUser.FullName + " " + findUniqueCode.ModelNo + "(" + uniqueAbjad + ") Request.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest("Unsupported file format.");
|
||||
}
|
||||
|
||||
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
|
||||
}
|
||||
|
||||
_centralDbContext.Requests.Add(request);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
|
||||
var updatedList = await _centralDbContext.Requests
|
||||
.Where(r => r.UserId == request.UserId)
|
||||
.ToListAsync();
|
||||
|
||||
return Json(updatedList.Select(i => new
|
||||
{
|
||||
i.ProductId,
|
||||
i.UserId,
|
||||
i.status,
|
||||
i.StationId,
|
||||
i.RequestQuantity,
|
||||
i.requestDate,
|
||||
i.ProductCategory,
|
||||
i.Document,
|
||||
i.approvalDate,
|
||||
i.remarkMasterInv,
|
||||
i.remarkUser,
|
||||
i.fromStoreItem,
|
||||
i.assignStoreItem,
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("ItemRequestList")]
|
||||
public async Task<IActionResult> ItemRequestList()
|
||||
{
|
||||
@ -991,6 +1061,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
i.approvalDate,
|
||||
i.remarkMasterInv,
|
||||
i.remarkUser,
|
||||
i.assignStoreItem,
|
||||
i.fromStoreItem,
|
||||
|
||||
}));
|
||||
|
||||
@ -1188,6 +1260,22 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
return Json(storeList);
|
||||
}
|
||||
|
||||
[HttpPost("StoreSpecificMasterList/{userId}")]
|
||||
public async Task<IActionResult> StoreSpecificMasterList(int userId)
|
||||
{
|
||||
var storeList = await _centralDbContext.InventoryMasters
|
||||
.Where(i => i.UserId == userId)
|
||||
.Select(i => i.StoreId) // Extract only StoreIds
|
||||
.Distinct() // Avoid duplicate queries
|
||||
.ToListAsync();
|
||||
|
||||
var storeSpecific = await _centralDbContext.Stores
|
||||
.Where(s => storeList.Contains(s.Id)) // Fetch all relevant stores at once
|
||||
.ToListAsync();
|
||||
|
||||
return Json(storeSpecific);
|
||||
}
|
||||
|
||||
#endregion Store
|
||||
|
||||
#region AllUser
|
||||
|
||||
1059
Migrations/20250310054721_UpdateTableRequest.Designer.cs
generated
Normal file
1059
Migrations/20250310054721_UpdateTableRequest.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
68
Migrations/20250310054721_UpdateTableRequest.cs
Normal file
68
Migrations/20250310054721_UpdateTableRequest.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateTableRequest : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "assignStoreItem",
|
||||
table: "request",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "fromStoreItem",
|
||||
table: "request",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "407727d8-2266-45f2-9b48-ef3a450f09c6", "AQAAAAIAAYagAAAAEDc91vi8/AJwNGigDpnzFh7Iplvlph0VGj9GfG1zI6tY/jM/4f3P0CWVQZ/0oetzVg==", "2faceaca-f491-455a-9f10-3f641a5a7e0d" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "8065f043-f8ed-4733-aa42-6ee6a1ebb636", "AQAAAAIAAYagAAAAEOmfi3vsFMnCUitXZqLgUaq5+Jqmigy8HrXwNqd8IELW2yvFQAMrfHLvJM5h0c+lfQ==", "46a8accc-305f-42e6-a4a2-376bfec07e84" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "assignStoreItem",
|
||||
table: "request");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "fromStoreItem",
|
||||
table: "request");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "d801514b-2c36-4df7-9bb5-1c7e351ed27e", "AQAAAAIAAYagAAAAEBSoDiGEYlobLgzVcffYwvTtm1WnXpqrBBT1yYP+kruV4OTtizW7Sel94qAfqUjGcw==", "6132b0af-6a7f-4f38-8959-d049ed486e8f" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "14f11e89-bb92-49dd-a8df-ec5b0d49df2d", "AQAAAAIAAYagAAAAEEvcS1SY+9pxZKH/P1l4TaodgW3SFSRfcZ+PnjB3MiMmEUSyYoo64AQtX0bOxFSX2g==", "6dca2498-5150-4369-9923-6f19a48258d4" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,6 +422,12 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Property<DateTime?>("approvalDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("assignStoreItem")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("fromStoreItem")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("remarkMasterInv")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
@ -754,16 +760,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "d801514b-2c36-4df7-9bb5-1c7e351ed27e",
|
||||
ConcurrencyStamp = "407727d8-2266-45f2-9b48-ef3a450f09c6",
|
||||
Email = "admin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "MAAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEBSoDiGEYlobLgzVcffYwvTtm1WnXpqrBBT1yYP+kruV4OTtizW7Sel94qAfqUjGcw==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEDc91vi8/AJwNGigDpnzFh7Iplvlph0VGj9GfG1zI6tY/jM/4f3P0CWVQZ/0oetzVg==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "6132b0af-6a7f-4f38-8959-d049ed486e8f",
|
||||
SecurityStamp = "2faceaca-f491-455a-9f10-3f641a5a7e0d",
|
||||
TwoFactorEnabled = false,
|
||||
UserInfoStatus = 1,
|
||||
UserName = "admin@pstw.com.my"
|
||||
@ -772,16 +778,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 2,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "14f11e89-bb92-49dd-a8df-ec5b0d49df2d",
|
||||
ConcurrencyStamp = "8065f043-f8ed-4733-aa42-6ee6a1ebb636",
|
||||
Email = "sysadmin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "SysAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEEvcS1SY+9pxZKH/P1l4TaodgW3SFSRfcZ+PnjB3MiMmEUSyYoo64AQtX0bOxFSX2g==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEOmfi3vsFMnCUitXZqLgUaq5+Jqmigy8HrXwNqd8IELW2yvFQAMrfHLvJM5h0c+lfQ==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "6dca2498-5150-4369-9923-6f19a48258d4",
|
||||
SecurityStamp = "46a8accc-305f-42e6-a4a2-376bfec07e84",
|
||||
TwoFactorEnabled = false,
|
||||
UserInfoStatus = 1,
|
||||
UserName = "sysadmin@pstw.com.my"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
//"DefaultConnection": "Server=localhost;uid=root;Password='';Database=web_interface;"
|
||||
//"DefaultConnection": "server=175.136.244.102;user id=root;password=tw_mysql_root;port=3306;database=web_interface"
|
||||
//"CentralConnnection": "Server=192.168.12.12;Port=3306;uid=installer;password='pstw_mysql_installer';database=pstw_cs;", //DB_dev Local connection
|
||||
"CentralConnnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_prod;" //DB_dev Public connection
|
||||
"CentralConnnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs;" //DB_dev Public connection
|
||||
//"InventoryConnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_inventory;" //DB_dev connection
|
||||
//"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=intern;password='intern_mysql_acct';database=web_interface;"//DB_dev connection
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user