update "Assign" dropdown

This commit is contained in:
Naz 2026-02-04 16:14:07 +08:00
parent 495bc9b3ae
commit adef552b79
10 changed files with 355 additions and 34 deletions

View File

@ -617,6 +617,18 @@
"title": "Part Number",
"data": "partNumber",
},
{
"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": "Category",
"data": "category",
@ -659,18 +671,6 @@
return data ? new Date(data).toLocaleString() : ''; // Format date for display
}
},
{
"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": "Edit",
"data": "itemID",

View File

@ -1073,16 +1073,15 @@
this.maxQuantity = null;
}
console.log('last store' + this.thisItem.lastStore);
this.itemlateststatus = this.thisItem.latestStatus ? this.thisItem.latestStatus : this.thisItem.toOther;
this.itemassignedtouser = (this.thisItem.toUser === this.currentUser.id || this.thisItem.lastUser === this.currentUser.id) && this.thisItem.lastStore === this.currentUser.store ? true : false;
console.log(this.thisItem.lastStore);
console.log(this.thisItem.lastStore == this.currentUser.store ? true : false);
console.log(this.thisItem.toUser == this.currentUser.id ? true : false);
console.log(this.thisItem.lastUser == this.currentUser.id ? true : false);
console.log(((this.thisItem.toUser == this.currentUser.id) || (this.thisItem.lastUser == this.currentUser.id)) ? true : false);
console.log('currentuser store' + this.currentUser.store);
this.itemassignedtouser = (
(this.thisItem.toStore === this.currentUser.store || this.thisItem.lastStore === this.currentUser.store)
&& this.currentUser.store != null
);
// Debugging logs to help you verify in the browser console
console.log('Item Store ID:', this.thisItem.toStore);
console.log('User Master Store ID:', this.currentUser.store);
console.log('Is User Authorized Master for this item?', this.itemassignedtouser);
} else {
// If the response is not OK (e.g., 404 Not Found)

View File

@ -15,21 +15,25 @@
<div class="card-body">
<div v-if="reportData">
<div class="row justify-content-center">
<div class="col-3">
<div class="row col-10">
<div class="col-4">
<div class="row col-11">
<div class="d-flex justify-content-between align-items-center">
<h4>Department</h4>
<multiselect v-model="selectedDepartment" :options="compDeptList" :multiple="true" group-values="departments" group-label="companyName"
:group-select="true" placeholder="Seach Department" track-by="departmentId" label="departmentName">
</multiselect>
</div>
</div>
<div class="col-3">
<div class="row col-10">
</div>
<div class="col-4">
<div class="row col-11">
<div class="d-flex justify-content-between align-items-center">
<h4>Category</h4>
<multiselect v-model="selectedCategory" :options="categoryList" :multiple="true" placeholder="Seach Category">
</multiselect>
</div>
</div>
</div>
<div class="col-4">
<div class="row col-11">
<div class="d-flex justify-content-between align-items-center">

View File

@ -11,10 +11,11 @@ using PSTW_CentralSystem.DBContext;
using PSTW_CentralSystem.Models;
using System.ComponentModel.Design;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Reflection;
using System.Security.Claims;
using static System.Collections.Specialized.BitVector32;
using System.Data.SqlClient;
namespace PSTW_CentralSystem.Controllers.API.Inventory
{
@ -1513,8 +1514,31 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
[HttpGet("ItemRequestList")]
public async Task<IActionResult> ItemRequestList()
{
// 1. Get the current logged-in User's ID (this comes as a string from Claims)
var userIdString = User.FindFirstValue(ClaimTypes.NameIdentifier);
// 2. Parse the string to an int
if (!int.TryParse(userIdString, out int currentUserId))
{
return Unauthorized("Invalid User ID format.");
}
// 3. Now the comparison will work because both are 'int'
var masterUser = await _centralDbContext.Users
.FirstOrDefaultAsync(u => u.Id == currentUserId);
if (masterUser == null) return Unauthorized();
var masterDeptId = masterUser.departmentId;
// 4. Fetch requests where the Requester belongs to the same department
var itemRequestList = await _centralDbContext.Requests
.Include(i => i.Product)
.Include(i => i.User)
.Include(i => i.Station)
.Where(i => i.User.departmentId == masterDeptId)
.ToListAsync();
var itemRequestList = await _centralDbContext.Requests.Include(i => i.Product).Include(i => i.User).Include(i => i.Station).ToListAsync();
return Json(itemRequestList.Select(i => new
{
i.requestID,
@ -1534,10 +1558,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
i.remarkMasterInv,
i.remarkUser,
i.assignStoreItem,
i.fromStoreItem,
i.fromStoreItem
}));
}
[HttpPost("ApproveRequest/{id}")]

View File

@ -0,0 +1,74 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
1 0 obj
<<
/F1 2 0 R /F2 3 0 R
>>
endobj
2 0 obj
<<
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
>>
endobj
3 0 obj
<<
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
>>
endobj
4 0 obj
<<
/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
5 0 obj
<<
/PageMode /UseNone /Pages 7 0 R /Type /Catalog
>>
endobj
6 0 obj
<<
/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
>>
endobj
7 0 obj
<<
/Count 1 /Kids [ 4 0 R ] /Type /Pages
>>
endobj
8 0 obj
<<
/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
>>
stream
Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
endobj
xref
0 9
0000000000 65535 f
0000000073 00000 n
0000000114 00000 n
0000000221 00000 n
0000000333 00000 n
0000000536 00000 n
0000000604 00000 n
0000000887 00000 n
0000000946 00000 n
trailer
<<
/ID
[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
/Info 6 0 R
/Root 5 0 R
/Size 9
>>
startxref
1196
%%EOF

View File

@ -0,0 +1,74 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
1 0 obj
<<
/F1 2 0 R /F2 3 0 R
>>
endobj
2 0 obj
<<
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
>>
endobj
3 0 obj
<<
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
>>
endobj
4 0 obj
<<
/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
5 0 obj
<<
/PageMode /UseNone /Pages 7 0 R /Type /Catalog
>>
endobj
6 0 obj
<<
/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
>>
endobj
7 0 obj
<<
/Count 1 /Kids [ 4 0 R ] /Type /Pages
>>
endobj
8 0 obj
<<
/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
>>
stream
Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
endobj
xref
0 9
0000000000 65535 f
0000000073 00000 n
0000000114 00000 n
0000000221 00000 n
0000000333 00000 n
0000000536 00000 n
0000000604 00000 n
0000000887 00000 n
0000000946 00000 n
trailer
<<
/ID
[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
/Info 6 0 R
/Root 5 0 R
/Size 9
>>
startxref
1196
%%EOF

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,74 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
1 0 obj
<<
/F1 2 0 R /F2 3 0 R
>>
endobj
2 0 obj
<<
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
>>
endobj
3 0 obj
<<
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
>>
endobj
4 0 obj
<<
/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
5 0 obj
<<
/PageMode /UseNone /Pages 7 0 R /Type /Catalog
>>
endobj
6 0 obj
<<
/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
>>
endobj
7 0 obj
<<
/Count 1 /Kids [ 4 0 R ] /Type /Pages
>>
endobj
8 0 obj
<<
/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
>>
stream
Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
endobj
xref
0 9
0000000000 65535 f
0000000073 00000 n
0000000114 00000 n
0000000221 00000 n
0000000333 00000 n
0000000536 00000 n
0000000604 00000 n
0000000887 00000 n
0000000946 00000 n
trailer
<<
/ID
[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
/Info 6 0 R
/Root 5 0 R
/Size 9
>>
startxref
1196
%%EOF

View File

@ -0,0 +1,74 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
1 0 obj
<<
/F1 2 0 R /F2 3 0 R
>>
endobj
2 0 obj
<<
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
>>
endobj
3 0 obj
<<
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
>>
endobj
4 0 obj
<<
/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
5 0 obj
<<
/PageMode /UseNone /Pages 7 0 R /Type /Catalog
>>
endobj
6 0 obj
<<
/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
>>
endobj
7 0 obj
<<
/Count 1 /Kids [ 4 0 R ] /Type /Pages
>>
endobj
8 0 obj
<<
/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
>>
stream
Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
endobj
xref
0 9
0000000000 65535 f
0000000073 00000 n
0000000114 00000 n
0000000221 00000 n
0000000333 00000 n
0000000536 00000 n
0000000604 00000 n
0000000887 00000 n
0000000946 00000 n
trailer
<<
/ID
[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
/Info 6 0 R
/Root 5 0 R
/Size 9
>>
startxref
1196
%%EOF