update userinformation and fetchitemmovement
This commit is contained in:
parent
a0d84272aa
commit
7e5f3e3b36
@ -104,9 +104,13 @@
|
|||||||
<strong>Latest Movement</strong>
|
<strong>Latest Movement</strong>
|
||||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||||
<!-- Movement Type -->
|
<!-- Movement Type -->
|
||||||
<h3 :class="movement.toOther === 'On Delivery' ? 'text-primary' : 'text-warning'"
|
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther !== 'On Delivery' && movement.action !== 'Assign',
|
||||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
'text-info': movement.action === 'Assign'}"
|
||||||
{{ movement.toOther === 'On Delivery' ? 'Receive' : 'Return' }}
|
class="flex-shrink-0 text-nowrap"
|
||||||
|
style="max-width:90px; min-width:90px;">
|
||||||
|
|
||||||
|
{{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
|
||||||
|
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<!-- Send Date -->
|
<!-- Send Date -->
|
||||||
@ -186,7 +190,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* <!-- 📌 Single View History Button --> *@
|
<!-- 📌 Single View History Button -->
|
||||||
<button class="btn btn-light w-100 text-left" v-on:click="toggleHistory(itemId)">
|
<button class="btn btn-light w-100 text-left" v-on:click="toggleHistory(itemId)">
|
||||||
<i :class="historyVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> View History
|
<i :class="historyVisible[itemId] ? 'fas fa-chevron-up' : 'fas fa-chevron-down'"></i> View History
|
||||||
</button>
|
</button>
|
||||||
@ -195,9 +199,13 @@
|
|||||||
<div v-for="(movement, i) in group.movements.slice(1)" :key="i" class="row mt-2">
|
<div v-for="(movement, i) in group.movements.slice(1)" :key="i" class="row mt-2">
|
||||||
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
<div class="col-md-12 d-flex flex-wrap align-items-center gap-3 p-2 border-bottom">
|
||||||
<!-- Movement Type -->
|
<!-- Movement Type -->
|
||||||
<h3 :class="movement.toOther === 'On Delivery' ? 'text-primary' : 'text-warning'"
|
<h3 :class="{'text-primary': movement.toOther === 'On Delivery', 'text-warning': movement.toOther !== 'On Delivery' && movement.action !== 'Assign',
|
||||||
class="flex-shrink-0 text-nowrap" style="max-width:90px; min-width:90px;">
|
'text-info': movement.action === 'Assign'}"
|
||||||
{{ movement.toOther === 'On Delivery' ? 'Receive' : 'Return' }}
|
class="flex-shrink-0 text-nowrap"
|
||||||
|
style="max-width:90px; min-width:90px;">
|
||||||
|
|
||||||
|
{{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
|
||||||
|
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<!-- Send Date -->
|
<!-- Send Date -->
|
||||||
@ -282,37 +290,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* <div class="modal fade" id="remarkModal" tabindex="-1" aria-labelledby="remarkModalLabel" aria-hidden="true"> *@
|
<div class="modal fade" id="remarkModal" tabindex="-1" aria-labelledby="remarkModalLabel" aria-hidden="true">
|
||||||
@* <div class="modal-dialog"> *@
|
<div class="modal-dialog">
|
||||||
@* <div class="modal-content"> *@
|
<div class="modal-content">
|
||||||
@* <div class="modal-header"> *@
|
<div class="modal-header">
|
||||||
@* <h5 class="modal-title" id="remarkModalLabel">Remark</h5> *@
|
<h5 class="modal-title" id="remarkModalLabel">Remark</h5>
|
||||||
@* <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> *@
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* <div class="modal-body" id="remarkContent"> *@
|
<div class="modal-body" id="remarkContent">
|
||||||
@* <!-- Remark Content Here --> *@
|
<!-- Remark Content Here -->
|
||||||
@* </div> *@
|
</div>
|
||||||
@* <div class="modal-footer"> *@
|
<div class="modal-footer">
|
||||||
@* <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> *@
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* <div class="modal fade" id="consignmentModal" tabindex="-1" aria-labelledby="consignmentModalLabel" aria-hidden="true"> *@
|
<div class="modal fade" id="consignmentModal" tabindex="-1" aria-labelledby="consignmentModalLabel" aria-hidden="true">
|
||||||
@* <div class="modal-dialog modal-xl"> *@
|
<div class="modal-dialog modal-xl">
|
||||||
@* <div class="modal-content"> *@
|
<div class="modal-content">
|
||||||
@* <div class="modal-header"> *@
|
<div class="modal-header">
|
||||||
@* <h5 class="modal-title" id="consignmentModalLabel">Consignment Note</h5> *@
|
<h5 class="modal-title" id="consignmentModalLabel">Consignment Note</h5>
|
||||||
@* <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> *@
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* <div class="modal-body text-center"> *@
|
<div class="modal-body text-center">
|
||||||
@* <img v-if="/\.(jpeg|jpg|png|gif)$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" class="img-fluid" alt="Consignment Note Image"> *@
|
<img v-if="/\.(jpeg|jpg|png|gif)$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" class="img-fluid" alt="Consignment Note Image">
|
||||||
@* <iframe v-else-if="/\.pdf$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" style="width:100%; height: 80vh;"></iframe> *@
|
<iframe v-else-if="/\.pdf$/i.test(consignmentNoteUrl)" :src="consignmentNoteUrl" style="width:100%; height: 80vh;"></iframe>
|
||||||
@* <a v-else class="btn btn-primary">There's no Folder or Picture</a> *@
|
<a v-else class="btn btn-primary">There's no Folder or Picture</a>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* </div> *@
|
</div>
|
||||||
@* </div> *@
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -338,36 +346,36 @@
|
|||||||
const app = Vue.createApp({
|
const app = Vue.createApp({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
companies: [
|
// companies: [
|
||||||
{
|
// {
|
||||||
companyId: 1,
|
// companyId: 1,
|
||||||
companyName: "PSTW",
|
// companyName: "PSTW",
|
||||||
departments: [{ departmentId: 1, departmentName: "Air" }, { departmentId: 2, departmentName: "Marine" }, { departmentId: 3, departmentName: "River" }]
|
// departments: [{ departmentId: 1, departmentName: "Air" }, { departmentId: 2, departmentName: "Marine" }, { departmentId: 3, departmentName: "River" }]
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
companyId: 2,
|
// companyId: 2,
|
||||||
companyName: "TES",
|
// companyName: "TES",
|
||||||
departments: [{ departmentId: 1, departmentName: "Air" }],
|
// departments: [{ departmentId: 1, departmentName: "Air" }],
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
company: "",
|
// company: "",
|
||||||
Dept: null,
|
// Dept: null,
|
||||||
teamTypes: ["Continuous", "Manual"],
|
// teamTypes: ["Continuous", "Manual"],
|
||||||
teamType: "",
|
// teamType: "",
|
||||||
productName: null,
|
// productName: null,
|
||||||
imageProduct: null,
|
// imageProduct: null,
|
||||||
productCategory: null,
|
// productCategory: null,
|
||||||
serialNumber: "",
|
// serialNumber: "",
|
||||||
quantity: 1,
|
// quantity: 1,
|
||||||
supplierName: null,
|
// supplierName: null,
|
||||||
purchaseDate: null,
|
// purchaseDate: null,
|
||||||
PO: null,
|
// PO: null,
|
||||||
currency: "MYR",
|
// currency: "MYR",
|
||||||
DefaultPrice: 0.01,
|
// DefaultPrice: 0.01,
|
||||||
currencyRate: 1,
|
// currencyRate: 1,
|
||||||
convertPrice: 0.01,
|
// convertPrice: 0.01,
|
||||||
DONo:null,
|
// DONo:null,
|
||||||
DODate: null,
|
// DODate: null,
|
||||||
warranty: 0,
|
warranty: 0,
|
||||||
EndWDate: null,
|
EndWDate: null,
|
||||||
invoiceNo: null,
|
invoiceNo: null,
|
||||||
@ -378,16 +386,16 @@
|
|||||||
stations: [],
|
stations: [],
|
||||||
stores: [],
|
stores: [],
|
||||||
users:[],
|
users:[],
|
||||||
suppliers: [
|
// suppliers: [
|
||||||
{
|
// {
|
||||||
supplierId: 1,
|
// supplierId: 1,
|
||||||
supplierName: "Pang",
|
// supplierName: "Pang",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
supplierId: 2,
|
// supplierId: 2,
|
||||||
supplierName: "Ms Kim",
|
// supplierName: "Ms Kim",
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
isModalOpen: false,
|
isModalOpen: false,
|
||||||
selectedProduct: "",
|
selectedProduct: "",
|
||||||
selectedSupplier: "",
|
selectedSupplier: "",
|
||||||
@ -395,15 +403,16 @@
|
|||||||
selectedDepartment: "",
|
selectedDepartment: "",
|
||||||
selectedTeamType: "",
|
selectedTeamType: "",
|
||||||
selectedtoStation: "",
|
selectedtoStation: "",
|
||||||
currencies: {},
|
consignmentNoteUrl: "",
|
||||||
|
// currencies: {},
|
||||||
showItemModal: false,
|
showItemModal: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
thisQRInfo: {
|
// thisQRInfo: {
|
||||||
uniqueID: null,
|
// uniqueID: null,
|
||||||
departmentName: null,
|
// departmentName: null,
|
||||||
serialNumber: null,
|
// serialNumber: null,
|
||||||
endWDate: null,
|
// endWDate: null,
|
||||||
},
|
// },
|
||||||
items: [],
|
items: [],
|
||||||
currentUser: null,
|
currentUser: null,
|
||||||
currentUserCompanyDept: null,
|
currentUserCompanyDept: null,
|
||||||
@ -450,7 +459,27 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
remark(remark) {
|
||||||
|
document.getElementById("remarkContent").innerText = remark || "No remark message provide.";
|
||||||
|
let modal = new bootstrap.Modal(document.getElementById("remarkModal"));
|
||||||
|
modal.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
consignmentNote(consignmentNote) {
|
||||||
|
if (!consignmentNote) {
|
||||||
|
this.consignmentNoteUrl = "No consignment note available.";
|
||||||
|
new bootstrap.Modal(document.getElementById('consignmentModal')).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pastikan URL betul
|
||||||
|
this.consignmentNoteUrl = consignmentNote;
|
||||||
|
|
||||||
|
// Tunggu Vue update sebelum buka modal
|
||||||
|
this.$nextTick(() => {
|
||||||
|
new bootstrap.Modal(document.getElementById('consignmentModal')).show();
|
||||||
|
});
|
||||||
|
},
|
||||||
initiateTable() {
|
initiateTable() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
@ -590,8 +619,12 @@
|
|||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
this.items = data.filter(item =>
|
this.items = data.filter(item =>
|
||||||
item.toUser === this.currentUser.id ||
|
item.toUser === this.currentUser.id ||
|
||||||
item.lastUser === this.currentUser.id
|
item.lastUser === this.currentUser.id ||
|
||||||
|
item.toStore === this.currentUser.store
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
console.log(this.items);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,14 +43,19 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
return NotFound(new { message = $"Unable to load user with ID '{_userManager.GetUserId(User)}'." });
|
return NotFound(new { message = $"Unable to load user with ID '{_userManager.GetUserId(User)}'." });
|
||||||
}
|
}
|
||||||
|
|
||||||
var userInfo = await _identityDbContext.Users.Include(u => u.Department).Select(u => new
|
var storeId = await _identityDbContext.InventoryMasters.Where(s => s.UserId == user.Id).Select(s => s.StoreId).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
var userInfo = await _identityDbContext.Users.Include(u => u.Department)
|
||||||
|
.Include(u => u.Store)
|
||||||
|
.Select(u => new
|
||||||
{
|
{
|
||||||
id = u.Id,
|
id = u.Id,
|
||||||
email = u.NormalizedEmail,
|
email = u.NormalizedEmail,
|
||||||
company = u.Department!.Company!.CompanyName,
|
company = u.Department!.Company!.CompanyName,
|
||||||
department = u.Department,
|
department = u.Department,
|
||||||
role = userRole,
|
role = userRole,
|
||||||
}).Where(u => u.id == user.Id).FirstOrDefaultAsync();
|
store = storeId != 0 ? storeId : (int?)null
|
||||||
|
}).Where(u => u.id == user.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (userInfo == null)
|
if (userInfo == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using PSTW_CentralSystem.Areas.Inventory.Models;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ namespace PSTW_CentralSystem.Models
|
|||||||
public int? departmentId { get; set; }
|
public int? departmentId { get; set; }
|
||||||
[ForeignKey("departmentId")]
|
[ForeignKey("departmentId")]
|
||||||
public virtual DepartmentModel? Department { get; set; }
|
public virtual DepartmentModel? Department { get; set; }
|
||||||
|
|
||||||
|
public virtual InventoryMasterModel? Store { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user