This commit is contained in:
arifhilmi007@gmail.com 2025-02-20 20:08:03 +08:00
parent d9e67e6139
commit 1e1b65dce6
11 changed files with 1387 additions and 568 deletions

View File

@ -15,6 +15,10 @@ namespace PSTW_CentralSystem.Areas.Inventory.Controllers
{
return View();
}
public ActionResult Qr()
{
return View();
}
[Authorize]
[HttpPost("/i/{id}")]

View File

@ -7,14 +7,21 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
{
[Key]
public int requestId { get; set; }
//public int DepartmentId { get; set; }
//[ForeignKey("DepartmentId")]
//public virtual ItemModel? Department { get; set; }
//[ForeignKey("ItemID")]
public int ProductId { get; set; }
[ForeignKey("ProductId")]
public virtual ProductModel? Product { get; set; }
public int StationId { get; set; }
[ForeignKey("StationId")]
public virtual StationModel? Station { get; set; }
public int UserId { get; set; }
[ForeignKey("UserId")]
public virtual UserModel? User { get; set; }
public string? remark { get; set; }
public string? status { get; set; }
public DateTime requestDate { get; set; }
public DateTime approvalDate { get; set; }
public int RequestQuantity { get; set; }
public byte[]? Document { get; set; }
}
}

View File

@ -1,26 +1,13 @@

@{
ViewData["Title"] = "Item Request";
ViewData["Title"] = "Product Request";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
@@font-face {
font-family: 'OCR-A';
src: url('../assets/fonts/ocraext.ttf');
}
.QrPrintFont {
font-family: 'OCR-A', monospace;
}
.table td img {
display: block !important;
}
</style>
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
<div id="registerItem" class="row">
<div id="requestProduct" class="row">
<div class="row card">
<div class="card-header">
<button id="addItemBtn" class="btn btn-success col-md-3 col-lg-3 m-1 col-12"><i class="fa fa-plus"></i>&nbsp;Add Item</button>
<button id="addRequestBtn" class="btn btn-success col-md-3 col-lg-3 m-1 col-12"><i class="fa fa-plus"></i>&nbsp;Add Request</button>
</div>
<div class="card-body">
@* <div v-if="loading">
@ -28,78 +15,32 @@
<span class="visually-hidden">Loading...</span>
</div>
</div> *@
<table class="table table-bordered table-hover table-striped no-wrap" id="itemDatatable" style=" width:100%;border-style: solid; border-width: 1px"></table>
<table class="table table-bordered table-hover table-striped no-wrap" id="requestDatatable" style=" width:100%;border-style: solid; border-width: 1px"></table>
</div>
</div>
<div class="modal fade" id="QrItemModal" tabindex="-1" role="dialog" aria-labelledby="QrItemModalLabel" aria-hidden="true" data-bs-target="#staticBackdrop">
<div class="modal-dialog modal-dialog-centered modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="QrItemModalLabel"></h5>
<button type="button" class="closeModal btn-close" data-bs-dismiss="modal" aria-label="Close" v-on:click="showItemModal=false"></button>
</div>
<div class="modal-body d-flex justify-content-center align-items-center">
<div class="container" style="font-family: 'OCR A', monospace;">
<div class="row" ref="qrInfo" id="qrInfo">
<div class="col-5 text-center d-flex align-items-center justify-content-center">
<div class="row">
<div class="col-12 text-center">
<div id="QrContainer"></div>
<div class="col-12 text-center">
{{thisQRInfo.uniqueID}}
</div>
</div>
</div>
</div>
<div class="col-7 d-flex align-items-center justify-content-center">
<div class="text-center fs-4 text">
<div class="col-12 my-3">
{{thisQRInfo.departmentName}}
</div>
<div class="col-12 my-3">
{{thisQRInfo.productShortName}}
</div>
<div class="col-12 my-3">
{{thisQRInfo.serialNumber}}
</div>
<div class="col-12 my-3">
{{thisQRInfo.partNumber}}
</div>
</div>
</div>
</div>
<div class="row">
<button v-on:click="printQRInfo">Print QR Info</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="itemMovementModal" tabindex="-1" role="dialog" aria-labelledby="addItemModalLabel" aria-hidden="true">
<div class="modal fade" id="requestModal" tabindex="-1" role="dialog" aria-labelledby="addRequestModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addItemModalLabel">Add Item</h5>
<button type="button" class="closeModal" data-dismiss="modal" aria-label="Close" v-on:click="showItemModal=false">
<h5 class="modal-title" id="addRequestModalLabel">Add Request</h5>
<button type="button" class="closeModal" data-dismiss="modal" aria-label="Close" v-on:click="showRequestModal=false">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<form v-on:submit.prevent="addItem" data-aos="fade-right">
<form v-on:submit.prevent="addRequest" data-aos="fade-right">
<div class=" register" data-aos="fade-right">
<div class="row" data-aos="fade-right">
@*Right Side*@
<div class="col-md-12">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<h3 class="register-heading">ITEM MOVEMENT</h3>
<h3 class="register-heading">PRODUCT REQUEST</h3>
<div class="row register-form">
<div class="col-md-6">
<!-- Company Dropdown -->
<!-- Product Dropdown -->
<div class="form-group row">
<label class="col-sm-4 col-form-label">To Station</label>
<div class="col-sm-8">
@ -112,7 +53,7 @@
</div>
</div>
<!-- Quantity Dropdown -->
<div class="form-group row">
<label class="col-sm-4 col-form-label">To Store:</label>
<div class="col-sm-8">
@ -123,6 +64,7 @@
</div>
</div>
<!-- Station Dropdown -->
<div class="form-group row">
<label class="col-sm-4 col-form-label">To User:</label>
<div class="col-sm-8">
@ -133,6 +75,7 @@
</div>
</div>
<!-- Remark Dropdown -->
<div class="form-group row">
<label class="col-sm-4 col-form-label">Last User:</label>
<div class="col-sm-8">
@ -143,6 +86,7 @@
</div>
</div>
<!-- Document/Picture Dropdown -->
<div class="form-group row">
<label class="col-sm-4 col-form-label">Last Store:</label>
<div class="col-sm-8">
@ -153,272 +97,6 @@
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">Last Station:</label>
<div class="col-sm-8">
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedlastStation" :disabled="currentUserCompanyDept != null" required>
<option class="btn-light" value="" disabled selected>Select Station</option>
<option class="btn-light" v-for="(station, index) in stations" :key="index" :value="station.stationId">{{ station.stationName}}</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">To Other:</label>
<div class="col-sm-8">
<input type="text" id="toOther" name="toOther" v-model="toOther" class="form-control" required />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">Action:</label>
<div class="col-sm-8">
<input type="text" id="action" name="action" v-model="action" class="form-control" required />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">Quantity:</label>
<div class="col-sm-8">
<input type="number" id="quantity" name="quantity" v-model="quantity" class="form-control" required />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">To Other:</label>
<div class="col-sm-8">
<input type="text" id="toOther" name="toOther" v-model="toOther" class="form-control" required />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">To Other:</label>
<div class="col-sm-8">
<input type="text" id="toOther" name="toOther" v-model="toOther" class="form-control" required />
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">To Store:</label>
<div class="col-sm-8">
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedDepartment" :disabled="currentUserCompanyDept != null" required>
<option class="btn-light" value="" disabled selected>Select Store</option>
<option class="btn-light" v-for="(store, index) in stores" :key="index" :value="store.companyId">{{ store.storeName }}</option>
</select>
</div>
</div>
<!-- TeamType Dropdown -->
<div class="form-group row">
<label class="col-sm-4 col-form-label">Team:</label>
<div class="col-sm-8">
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedTeamType" required>
<option class="btn-light" value="" disabled selected>Select Team</option>
<option class="btn-light" v-for="(team, index) in teamTypes" :key="index" :value="team">{{ team }}</option>
</select>
</div>
</div>
@* Product Name Coding *@
<div class="form-group row">
<label class="col-sm-4 col-form-label">Product Name:</label>
<div class="col-sm-8">
<div class="dropdown">
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedProduct" required>
<option class="btn-light" value="" disabled selected>Select Product</option>
<option class="btn-light" v-for="(item, index) in products" :key="index" :value="item.productId">{{ item.productName + ' (' + item.modelNo + ')' }}</option>
</select>
</div>
</div>
</div>
@* Product Image Display *@
<div class="form-group row align-items-center">
<label for="imageProduct" class="col-sm-4 col-form-label">Product Image: </label>
<div class="col-sm-8">
<img v-if="showProduct.imageProduct" :src="showProduct.imageProduct" alt="Product Image" class="img-fluid" data-toggle="modal" data-target="#imageModal" />
<input type="hidden" id="imageProduct" name="imageProduct" v-model="showProduct">
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-labelledby="imageModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="imageModalLabel">Product Image</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<img :src="showProduct.imageProduct" alt="Product Image" class="img-fluid">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@* Product Category Coding *@
<div class="form-group row">
<label class="col-sm-4 col-form-label">Product Category:</label>
<div class="col-sm-8">
<input type="text" id="category" name="category" v-model="showProduct.category" class="form-control" readonly />
</div>
</div>
@* Part Number Coding *@
<div class="form-group row">
<label class="col-sm-4 col-form-label">Part Number:</label>
<div class="col-sm-8">
<input type="text" id="partNumber" name="partNumber" v-model="partNumber" class="form-control" required />
</div>
</div>
@* Serial Number and Quantity Coding *@
<div v-if="showSerialNumber">
<div class="form-group row align-items-center">
<div class="col-sm-4">
<label for="serialNumber">Serial Number: </label>
</div>
<div class="col-sm-8">
<input type="text" id="serialNumber" name="serialNumber" v-if="showSerialNumber" v-model="serialNumber" class="form-control" v-bind:required="showSerialNumber">
</div>
</div>
</div>
<div v-if="!showSerialNumber">
<div class="form-group row align-items-center">
<div class="col-sm-4">
<label for="quantity">Quantity: </label>
</div>
<div class="col-sm-8">
<input type="number" id="quantity" name="quantity" min="1" v-if="!showSerialNumber" v-model="quantity" class="form-control" v-bind:required="!showSerialNumber">
</div>
</div>
</div>
@* Supplier coding *@
<div class="form-group row align-items-center">
<label class="col-sm-4 col-form-label">Supplier: </label>
<div class="col-sm-8">
<div class="dropdown">
<select class="btn btn-primary dropdown-toggle col-md-10" data-toggle="dropdown" aria-expanded="false" v-model="selectedSupplier" required>
<option class="btn-light" value="" disabled selected>Select Supplier</option>
<option class="btn-light" v-for="(item, index) in suppliers">{{ item.supplierName }}</option>
</select>
</div>
</div>
</div>
@* Purchase Date coding *@
<div class="form-group row align-items-center">
<label for="purchaseDate" class="col-sm-4 col-form-label">Purchase Date: </label>
<div class="col-sm-8">
<input type="date" id="purchaseDate" name="purchaseDate" required v-model="purchaseDate" class="form-control">
</div>
</div>
@* PO coding *@
<div class="form-group row align-items-center">
<label for="PO" class="col-sm-4 col-form-label">Enter PO: </label>
<div class="col-sm-8">
<input type="text" id="PO" name="PO" required v-model="PO" placeholder="PO123456" class="form-control">
</div>
</div>
</div>
<div class="col-md-6">
@* Item Price in RM *@
<div class="form-group row">
<label for="DefaultPrice" class="col-sm-4">Default Item Price:</label>
<div class="col-sm-8">
<input type="number" id="DefaultPrice" name="DefaultPrice" class="form-control" placeholder="RM 00.00" step="0.01" min="0.01" v-on:input="convertCurrency()" required v-model="DefaultPrice">
</div>
</div>
@* Currency Selection *@
<div class="form-group row">
<label for="currency" class="col-sm-4">Select Currency:</label>
<div class="col-sm-8">
<select id="currency" name="currency" class="btn btn-primary form-control col-md-10" v-model="currency" v-on:change="convertCurrency()">
<option class="btn-light" value="" disabled selected>Select a currency</option>
<option class="btn-light" v-for="(name, code) in currencies" :key="code" :value="code">
{{ code }} - {{ name }}
</option>
</select>
</div>
</div>
@* Currency Rate *@
<div class="form-group row">
<label for="currencyRate" class="col-sm-4">Currency Rate(%):</label>
<div class="col-sm-8">
<input type="number" id="currencyRate" name="currencyRate" class="form-control" placeholder="0.01" step="0.01" min="1" v-on:input="convertCurrency()" required v-model="currencyRate">
</div>
</div>
@* Item Convert Price *@
<div class="form-group row">
<label for="convertPrice" class="col-sm-4">{{ currency ? 'Item Price (' + currency + ') : ' : 'Item Price : ' }}</label>
<div class="col-sm-8">
<input type="number" id="convertPrice" name="convertPrice" class="form-control" readonly v-model="convertPrice">
</div>
</div>
@* Delivery Order Number *@
<div class="form-group row">
<label for="DONo" class="col-sm-4">Enter DO Number:</label>
<div class="col-sm-8">
<input type="text" id="DONo" name="DONo" class="form-control" v-model="DONo" placeholder="DO123456">
</div>
</div>
@* Delivery Order Date *@
<div class="form-group row">
<label for="DODate" class="col-sm-4">Enter DO Date:</label>
<div class="col-sm-8">
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" v-model="DODate">
</div>
</div>
@* Warranty *@
<div class="form-group row">
<label for="warranty" class="col-sm-4">Enter Warranty (Months):</label>
<div class="col-sm-8">
<input type="number" id="warranty" name="warranty" class="form-control" placeholder="0 , 1 , 2 , 3, ..." step="1" min="0" v-on:input="calculateWarrantyEndDate()" required v-model="warranty">
</div>
</div>
@* Warranty End Date *@
<div class="form-group row">
<label for="EndWDate" class="col-sm-4">Warranty End:</label>
<div class="col-sm-8">
<input type="date" id="EndWDate" name="EndWDate" class="form-control" readonly v-model="EndWDate">
</div>
</div>
@* Invoice Number *@
<div class="form-group row">
<label for="invoiceNo" class="col-sm-4">Invoice Number:</label>
<div class="col-sm-8">
<input type="text" id="invoiceNo" name="invoiceNo" class="form-control" v-model="invoiceNo" placeholder="Invoice123456">
</div>
</div>
@* Invoice Date *@
<div class="form-group row">
<label for="invoiceDate" class="col-sm-4">Invoice Date:</label>
<div class="col-sm-8">
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" v-model="invoiceDate">
</div>
</div>
</div>
@* Submit and Reset Buttons *@
<div class="form-group row">
<div class="col-sm-8 offset-sm-3">
@ -446,12 +124,12 @@
}
<script>
$(function () {
app.mount('#registerItem');
app.mount('#requestProduct');
// Attach a click event listener to elements with the class 'btn-success'.
$('#addItemBtn').on('click', function () {
$('#addRequestBtn').on('click', function () {
// Show the modal with the ID 'addManufacturerModal'.
$('#itemMovementModal').modal('show');
$('#requestModal').modal('show');
});
$('.closeModal').on('click', function () {
// Show the modal with the ID 'addManufacturerModal'.
@ -461,99 +139,44 @@
const app = Vue.createApp({
data() {
return {
companies: [
{
companyId: 1,
companyName: "PSTW",
departments: [{ departmentId: 1, departmentName: "Air" }, { departmentId: 2, departmentName: "Marine" }, { departmentId: 3, departmentName: "River" }]
},
{
companyId: 2,
companyName: "TES",
departments: [{ departmentId: 1, departmentName: "Air" }],
},
],
company: "",
Dept: null,
teamTypes: ["Continuous", "Manual"],
teamType: "",
requestId : null,
userId : null,
stationId : null,
productId : null,
remark: "",
document: null,
quantity: 0,
status: "",
requestDate : null,
approvalDate : null,
selectedCategory: "",
productName: null,
imageProduct: null,
productCategory: null,
serialNumber: "",
quantity: 1,
supplierName: null,
purchaseDate: null,
PO: null,
currency: "MYR",
DefaultPrice: 0.01,
currencyRate: 1,
convertPrice: 0.01,
DONo:null,
DODate: null,
warranty: 0,
EndWDate: null,
invoiceNo: null,
invoiceDate: null,
partNumber: null,
products: [],
depts: [],
stations: [],
stores: [],
users:[],
suppliers: [
{
supplierId: 1,
supplierName: "Pang",
},
{
supplierId: 2,
supplierName: "Ms Kim",
},
],
isModalOpen: false,
selectedProduct: "",
selectedSupplier: "",
selectedCompany: "",
selectedDepartment: "",
selectedTeamType: "",
selectedtoStation: "",
currencies: {},
showItemModal: false,
selectedStation: "",
showRequestModal: false,
loading: false,
thisQRInfo: {
uniqueID: null,
departmentName: null,
serialNumber: null,
endWDate: null,
},
items: [],
request: [],
currentUser: null,
currentUserCompanyDept: null,
}
},
mounted() {
this.fetchRequest();
this.fetchUser();
this.fetchItem();
this.fetchCurrencyData();
this.fetchCompanies();
this.fetchProducts();
this.fetchSuppliers();
this.fetchStation();
this.fetchStore();
this.fetchUsers();
},
computed: {
filteredDepartments() {
if (!this.selectedCompany) {
return []; // No company selected, return empty list
}
const company = this.companies.find(c => c.companyId === this.selectedCompany);
// filteredDepartments() {
// if (!this.selectedCompany) {
// return []; No company selected, return empty list
// }
// const company = this.companies.find(c => c.companyId === this.selectedCompany);
// this.selectedDepartment = '';
return company ? company.departments : [];
},
// return company ? company.departments : [];
// },
showProduct() {
if (!this.selectedProduct) {
return []; // No company selected, return empty list
@ -561,57 +184,34 @@
const product = this.products.find(c => c.productId === this.selectedProduct);
return product ? product : {};
},
showSerialNumber() {
return this.showProduct.category === 'Asset' || this.showProduct.category === 'Part';
},
},
methods: {
async addItem() {
if (this.showProduct.category == "Disposable") {
this.serialNumber = "";
async addRequest() {
try {
const requiredFields = ['stationId', 'productId', 'quantity', 'productCategory'];
// Loop through required fields and check if any are null or empty
for (let field of requiredFields) {
if (this[field] === null || this[field] === '') {
alert('Request Error', `Please fill in required fields: ${field}.`, 'warning');
return; // Exit early if validation fails
}
const formData = {
CompanyId: this.selectedCompany,
DepartmentId: this.selectedDepartment,
ProductId: this.selectedProduct,
SerialNumber: this.serialNumber,
Quantity: this.quantity,
Supplier: this.selectedSupplier,
PurchaseDate: this.purchaseDate,
PONo: this.PO,
Currency: this.currency,
DefaultPrice: this.DefaultPrice,
CurrencyRate: this.currencyRate,
ConvertPrice: this.convertPrice,
DODate: this.DODate,
Warranty: this.warranty,
EndWDate: this.EndWDate,
InvoiceDate: this.invoiceDate,
CreatedByUserId: this.currentUser.id,
TeamType: this.selectedTeamType,
PartNumber: this.partNumber,
}
const requestData = {
ProductId: this.productId,
StationId: this.stationId,
UserId: this.userId,
RequestQuantitiy: this.quantity,
Document: this.document,
remark: this.remark,
status: this.status,
requestDate: this.requestDate,
approvalDate: this.approvalDate,
};
try {
// Additional specific checks
if (this.showSerialNumber) {
this.quantity = 0;
if (this.serialNumber === null || this.serialNumber === '') {
alert('Serial Number Error', 'Serial Number must be filled when selecting Item or Part.', 'warning');
return;
}
}
else {
this.serialNumber = null;
if (this.quantity === 0 || this.quantity === null || this.quantity === '') {
alert('quantity Error', 'Quantity is required when selecting Disposable.', 'warning');
return;
}
}
// Proceed to send the data to the API
const response = await fetch('/InvMainAPI/AddItem', {
const response = await fetch('/InvMainAPI/AddRequest', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -621,11 +221,11 @@
});
if (response.ok) {
// If the form submission was successful, display a success message
alert('Success!', 'Item form has been successfully submitted.', 'success');
const updatedItem = await response.json();
this.items.push(updatedItem);
alert('Success!', 'Request form has been successfully submitted.', 'success');
const requestItem = await response.json();
this.items.push(requestItem);
this.fetchItem();
this.fetchRequest();
// Reset the form
this.resetForm();
@ -644,7 +244,7 @@
initiateTable() {
self = this;
this.itemDatatable = $('#itemDatatable').DataTable({
this.requestDatatable = $('#requestDatatable').DataTable({
"data": this.items,
"columns": [
{
@ -680,58 +280,6 @@
"title": "Approval Date",
"data": "approvalDate",
},
// {
// "title": "Quantity",
// "data": "quantity",
// },
// {
// "title": "To Station",
// "data": "toStation",
// },
// {
// "title": "To Store",
// "data": "toStore",
// },
// {
// "title": "To Other",
// "data": "toOther",
// },
// {
// "title": "Remark",
// "data": "remark",
// },
// {
// "title": "Note",
// "data": "consignmentNote",
// },
// {
// "title": "Send Date",
// "data": "date",
// },
// {
// "title": "Last User",
// "data": "lastUser",
// },
// {
// "title": "Last Store",
// "data": "lastStore",
// },
// {
// "title": "Last Station",
// "data": "lastStation",
// },
// {
// "title": "Latest Status",
// "data": "latestStatus",
// },
// {
// "title": "Receive Date",
// "data": "date",
// },
// {
// "title": "Completion",
// "data": "movementComplete",
// },
{
"title": "Reject",
"data": "requestId",
@ -781,17 +329,17 @@
})
// Attach click event listener to the delete buttons
$('#itemDatatable tbody').on('click', '.reject-btn', function () {
$('#requestDatatable tbody').on('click', '.reject-btn', function () {
const itemId = $(this).data('id');
self.rejectRequest(itemId);
});
$('#itemDatatable tbody').on('click', '.approve-btn', function () {
$('#requestDatatable tbody').on('click', '.approve-btn', function () {
const itemId = $(this).data('id');
self.approveRequest(itemId);
});
$('#itemDatatable tbody').on('click', '.print-btn', function () {
$('#requestDatatable tbody').on('click', '.print-btn', function () {
const $button = $(this); // The clicked button
const $row = $button.closest('tr'); // The parent row of the button
const itemId = $button.data('id'); // Get the item ID from the button's data attribute
@ -817,7 +365,7 @@
this.loading = false;
},
async fetchItem() {
async fetchRequest() {
try {
// const token = localStorage.getItem('token'); // Get the token from localStorage
const response = await fetch('/InvMainAPI/ItemRequestList', {
@ -833,8 +381,8 @@
}
this.items = await response.json();
if (this.itemDatatable) {
this.itemDatatable.clear().destroy();
if (this.requestDatatable) {
this.requestDatatable.clear().destroy();
}
this.initiateTable();
}
@ -1039,8 +587,8 @@
//static update
const row = $(`.approve-btn[data-id="${itemId}"]`).closest('tr');
this.itemDatatable.row(row)
.data({ ...this.itemDatatable.row(row)
this.requestDatatable.row(row)
.data({ ...this.requestDatatable.row(row)
.data(), status: "Approved" })
.draw();
@ -1074,8 +622,8 @@
//static update
const row = $(`.approve-btn[data-id="${itemId}"]`).closest('tr');
this.itemDatatable.row(row)
.data({ ...this.itemDatatable.row(row)
this.requestDatatable.row(row)
.data({ ...this.requestDatatable.row(row)
.data(), status: "Rejected" })
.draw();

View File

@ -48,13 +48,25 @@
</a>
</div>
</div>
<div class="col-6 col-md-6 col-lg-3">
<div class="card card-hover">
<a asp-area="Inventory" asp-controller="InventoryMaster" asp-action="StationRegistration">
<div class="box bg-warning text-center">
<h1 class="font-light text-white">
<i class="mdi mdi-truck"></i>
</h1>
<h6 class="text-white">Station</h6>
</div>
</a>
</div>
</div>
<div class="col-6 col-md-6 col-lg-3">
<div class="card card-hover">
<a asp-area="Inventory" asp-controller="InventoryMaster" asp-action="ItemMovement">
<div class="box bg-success text-center">
<div class="box bg-cyan text-center">
<h1 class="font-light text-white">
<i class="mdi mdi-checkbox-multiple-blank-circle"></i>
<i class="mdi mdi-factory"></i>
</h1>
<h6 class="text-white">Item Movement</h6>
</div>
@ -65,11 +77,11 @@
<div class="col-6 col-md-6 col-lg-3">
<div class="card card-hover">
<a asp-area="Inventory" asp-controller="InventoryMaster" asp-action="ItemRequest">
<div class="box bg-success text-center">
<div class="box bg-info text-center">
<h1 class="font-light text-white">
<i class="mdi mdi-checkbox-multiple-blank-circle"></i>
<i class="mdi mdi-checkbox-multiple-blank"></i>
</h1>
<h6 class="text-white">Item Request</h6>
<h6 class="text-white">Product Request</h6>
</div>
</a>
</div>

View File

@ -11,6 +11,7 @@ using System.ComponentModel.Design;
using System.Data;
using System.Diagnostics;
using System.Reflection;
using static System.Collections.Specialized.BitVector32;
namespace PSTW_CentralSystem.Controllers.API.Inventory
{
@ -627,13 +628,67 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
#endregion ItemMovement
#region ItemRequest
#region ItemRequestUser
[HttpPost("AddRequest")]
public async Task<IActionResult> AddRequest([FromBody] RequestModel request, [FromQuery] int UserId)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
try
{
_centralDbContext.Requests.Add(request);
await _centralDbContext.SaveChangesAsync();
//ini akan paparkan user punya table sahaja.
var updatedList = await _centralDbContext.Requests.Where(r => r.UserId == UserId).ToListAsync();
return Json(updatedList);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet("ItemRequestListEachUser/{id}")]
public async Task<IActionResult> ItemRequestListEachUser(int UserId)
{
var itemRequestList = await _centralDbContext.Requests.Where(r => r.UserId == UserId).ToListAsync();
return Json(itemRequestList);
}
[HttpDelete("DeleteRequest/{id}")]
public async Task<IActionResult> DeleteRequest(int id)
{
var request = await _centralDbContext.Requests.FindAsync(id);
if (request == null)
{
return NotFound(new { success = false, message = "Request not found" });
}
_centralDbContext.Requests.Remove(request);
await _centralDbContext.SaveChangesAsync();
return Ok(new { success = true, message = "Request deleted successfully" });
}
#endregion
#region ItemRequestAdmin
[HttpGet("ItemRequestList")]
public async Task<IActionResult> ItemRequestList()
{
var itemRequestList = await _centralDbContext.Request.ToListAsync();
var itemRequestList = await _centralDbContext.Requests.ToListAsync();
return Json(itemRequestList);
}
@ -641,7 +696,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
[HttpPost("ApproveRequest/{id}")]
public async Task<IActionResult> ApproveRequest(int id)
{
var Request = await _centralDbContext.Request.FindAsync(id);
var Request = await _centralDbContext.Requests.FindAsync(id);
if (Request == null)
{
return NotFound(new { success = false, message = "Request not found" });
@ -657,7 +712,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
[HttpPost("RejectRequest/{id}")]
public async Task<IActionResult> RejectRequest(int id)
{
var Request = await _centralDbContext.Request.FindAsync(id);
var Request = await _centralDbContext.Requests.FindAsync(id);
if (Request == null)
{
return NotFound(new { success = false, message = "Request not found" });
@ -670,7 +725,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
return Ok(new { success = true, message="Request Rejected Successfully", data=Request });
}
#endregion ItemRequest
#endregion ItemRequestAdmin
#region ItemReport
@ -822,7 +877,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
#endregion Store
#region User
#region AllUser
[HttpPost("UserList")]
public async Task<IActionResult> UserList()
@ -832,6 +887,6 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
}
#endregion User
#endregion AllUser
}
}

View File

@ -91,7 +91,7 @@ namespace PSTW_CentralSystem.DBContext
public DbSet<DepartmentModel> Departments { get; set; }
public DbSet<ManufacturerModel> Manufacturers { get; set; }
public DbSet<ItemModel> Items { get; set; }
public DbSet<RequestModel> Request { get; set; }
public DbSet<RequestModel> Requests { get; set; }
public DbSet<ProductModel> Products { get; set; }
public DbSet<SupplierModel> Suppliers { get; set; }
public DbSet<InventoryMasterModel> InventoryMasters { get; set; }

View File

@ -0,0 +1,987 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSTW_CentralSystem.DBContext;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
[DbContext(typeof(CentralSystemContext))]
[Migration("20250220015910_UpdateDatabaseChanges")]
partial class UpdateDatabaseChanges
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
b.HasData(
new
{
UserId = 1,
RoleId = 1
},
new
{
UserId = 2,
RoleId = 2
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.InventoryMasterModel", b =>
{
b.Property<int>("StoreId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("StoreId");
b.HasIndex("UserId");
b.ToTable("InventoryMasters");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
{
b.Property<int>("ItemID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<float>("ConvertPrice")
.HasColumnType("float");
b.Property<int>("CreatedByUserId")
.HasColumnType("int");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("CurrencyRate")
.HasColumnType("float");
b.Property<DateTime?>("DODate")
.HasColumnType("datetime(6)");
b.Property<string>("DONo")
.HasColumnType("longtext");
b.Property<float>("DefaultPrice")
.HasColumnType("float");
b.Property<int>("DepartmentId")
.HasColumnType("int");
b.Property<DateTime>("EndWDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("InvoiceDate")
.HasColumnType("datetime(6)");
b.Property<string>("InvoiceNo")
.HasColumnType("longtext");
b.Property<int>("ItemStatus")
.HasColumnType("int")
.HasComment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;");
b.Property<int?>("MovementId")
.HasColumnType("int");
b.Property<string>("PONo")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("PartNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime(6)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("SerialNumber")
.HasColumnType("longtext");
b.Property<string>("Supplier")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("TeamType")
.HasColumnType("longtext");
b.Property<string>("UniqueID")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Warranty")
.HasColumnType("int");
b.HasKey("ItemID");
b.HasIndex("CompanyId");
b.HasIndex("CreatedByUserId");
b.HasIndex("DepartmentId");
b.HasIndex("MovementId")
.IsUnique();
b.HasIndex("ProductId");
b.ToTable("Items");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Action")
.HasColumnType("longtext")
.HasComment("Register, StockIn, Stock Out");
b.Property<string>("ConsignmentNote")
.HasColumnType("longtext");
b.Property<DateTime>("Date")
.HasColumnType("datetime(6)");
b.Property<int>("ItemId")
.HasColumnType("int");
b.Property<int?>("LastStation")
.HasColumnType("int");
b.Property<int?>("LastStore")
.HasColumnType("int");
b.Property<int?>("LastUser")
.HasColumnType("int");
b.Property<string>("LatestStatus")
.HasColumnType("longtext")
.HasComment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery");
b.Property<bool>("MovementComplete")
.HasColumnType("tinyint(1)");
b.Property<int?>("Quantity")
.HasColumnType("int");
b.Property<string>("Remark")
.HasColumnType("longtext");
b.Property<string>("ToOther")
.HasColumnType("longtext")
.HasComment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery");
b.Property<int?>("ToStation")
.HasColumnType("int");
b.Property<int?>("ToStore")
.HasColumnType("int");
b.Property<int?>("ToUser")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LastStation");
b.HasIndex("LastStore");
b.HasIndex("LastUser");
b.HasIndex("ToStation");
b.HasIndex("ToStore");
b.HasIndex("ToUser");
b.ToTable("ItemMovements");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b =>
{
b.Property<int>("ManufacturerId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
b.Property<string>("ManufacturerName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("ManufacturerId");
b.ToTable("Manufacturers");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.Property<int>("ProductId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
b.Property<string>("Category")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("ManufacturerId")
.HasColumnType("int");
b.Property<string>("ModelNo")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductShortName")
.IsRequired()
.HasColumnType("longtext");
b.Property<int?>("QuantityProduct")
.HasColumnType("int");
b.HasKey("ProductId");
b.HasIndex("ManufacturerId");
b.ToTable("Products");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.RequestModel", b =>
{
b.Property<int>("requestId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("requestId"));
b.Property<DateTime>("approvalDate")
.HasColumnType("datetime(6)");
b.Property<string>("remark")
.HasColumnType("longtext");
b.Property<DateTime>("requestDate")
.HasColumnType("datetime(6)");
b.Property<string>("status")
.HasColumnType("longtext");
b.HasKey("requestId");
b.ToTable("Request");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b =>
{
b.Property<int>("StationId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("StationId"));
b.Property<int>("DepartmentId")
.HasColumnType("int");
b.Property<string>("StationName")
.HasColumnType("longtext");
b.Property<int>("StationPicID")
.HasColumnType("int");
b.HasKey("StationId");
b.HasIndex("DepartmentId");
b.HasIndex("StationPicID");
b.ToTable("Stations");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("StoreName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("CompanyId");
b.ToTable("Stores");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
b.Property<string>("SupplierAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierCompName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierEmail")
.HasColumnType("longtext");
b.Property<string>("SupplierPIC")
.HasColumnType("longtext");
b.Property<string>("SupplierPhoneNo")
.HasColumnType("longtext");
b.HasKey("SupplierId");
b.ToTable("Suppliers");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
b.Property<string>("CompanyName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CompanyId");
b.ToTable("Companies");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
{
b.Property<int>("DepartmentId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("DepartmentCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("DepartmentName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("DepartmentId");
b.HasIndex("CompanyId");
b.ToTable("Departments");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = 1,
Description = "Can access all pages",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
},
new
{
Id = 2,
Description = "Can access some admin pages",
Name = "SystemAdmin",
NormalizedName = "SYSTEMADMIN"
},
new
{
Id = 3,
Description = "Can access operation pages",
Name = "Engineer",
NormalizedName = "ENGINEER"
},
new
{
Id = 4,
Description = "Can access data viewer pages",
Name = "Observer",
NormalizedName = "OBSERVER"
},
new
{
Id = 5,
Description = "Handle inventory module",
Name = "Inventory Master",
NormalizedName = "INVENTORY MASTER"
},
new
{
Id = 6,
Description = "Involve in inventory transaction",
Name = "Finance",
NormalizedName = "FINANCE"
});
});
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<int?>("UserInfoStatus")
.HasColumnType("int");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("departmentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.HasIndex("departmentId");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = 1,
AccessFailedCount = 0,
ConcurrencyStamp = "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==",
PhoneNumberConfirmed = false,
SecurityStamp = "79e606c8-032b-426b-8fb2-7727b93823eb",
TwoFactorEnabled = false,
UserInfoStatus = 1,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "8bf46c63-d7df-4ac5-bab2-fc15fe881302",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==",
PhoneNumberConfirmed = false,
SecurityStamp = "5ac5ec31-c25f-4a7a-8057-664ecdf76108",
TwoFactorEnabled = false,
UserInfoStatus = 1,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.InventoryMasterModel", b =>
{
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", "Store")
.WithMany()
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSTW_CentralSystem.Models.UserModel", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Store");
b.Navigation("User");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
{
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSTW_CentralSystem.Models.UserModel", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedByUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
.WithMany()
.HasForeignKey("DepartmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", "Movement")
.WithOne("Item")
.HasForeignKey("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", "MovementId");
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product")
.WithMany("Items")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
b.Navigation("CreatedBy");
b.Navigation("Department");
b.Navigation("Movement");
b.Navigation("Product");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b =>
{
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "FromStation")
.WithMany()
.HasForeignKey("LastStation");
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", "FromStore")
.WithMany()
.HasForeignKey("LastStore");
b.HasOne("PSTW_CentralSystem.Models.UserModel", "FromUser")
.WithMany()
.HasForeignKey("LastUser");
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "NextStation")
.WithMany()
.HasForeignKey("ToStation");
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", "NextStore")
.WithMany()
.HasForeignKey("ToStore");
b.HasOne("PSTW_CentralSystem.Models.UserModel", "NextUser")
.WithMany()
.HasForeignKey("ToUser");
b.Navigation("FromStation");
b.Navigation("FromStore");
b.Navigation("FromUser");
b.Navigation("NextStation");
b.Navigation("NextStore");
b.Navigation("NextUser");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
.WithMany()
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacturer");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b =>
{
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
.WithMany()
.HasForeignKey("DepartmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSTW_CentralSystem.Models.UserModel", "StationPic")
.WithMany()
.HasForeignKey("StationPicID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Department");
b.Navigation("StationPic");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", b =>
{
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
{
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
.WithMany("Departments")
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
{
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
.WithMany()
.HasForeignKey("departmentId");
b.Navigation("Department");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b =>
{
b.Navigation("Item");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
{
b.Navigation("Departments");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,179 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class UpdateDatabaseChanges : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "SupplierName",
table: "Suppliers",
newName: "SupplierCompName");
migrationBuilder.RenameColumn(
name: "SupplierGender",
table: "Suppliers",
newName: "SupplierAddress");
migrationBuilder.AlterColumn<string>(
name: "SupplierPhoneNo",
table: "Suppliers",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "SupplierEmail",
table: "Suppliers",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "SupplierPIC",
table: "Suppliers",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ProductShortName",
table: "Products",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PartNumber",
table: "Items",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Request",
columns: table => new
{
requestId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
remark = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
status = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
requestDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
approvalDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Request", x => x.requestId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c", "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==", "79e606c8-032b-426b-8fb2-7727b93823eb" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "8bf46c63-d7df-4ac5-bab2-fc15fe881302", "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==", "5ac5ec31-c25f-4a7a-8057-664ecdf76108" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Request");
migrationBuilder.DropColumn(
name: "SupplierPIC",
table: "Suppliers");
migrationBuilder.DropColumn(
name: "ProductShortName",
table: "Products");
migrationBuilder.DropColumn(
name: "PartNumber",
table: "Items");
migrationBuilder.RenameColumn(
name: "SupplierCompName",
table: "Suppliers",
newName: "SupplierName");
migrationBuilder.RenameColumn(
name: "SupplierAddress",
table: "Suppliers",
newName: "SupplierGender");
migrationBuilder.UpdateData(
table: "Suppliers",
keyColumn: "SupplierPhoneNo",
keyValue: null,
column: "SupplierPhoneNo",
value: "");
migrationBuilder.AlterColumn<string>(
name: "SupplierPhoneNo",
table: "Suppliers",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Suppliers",
keyColumn: "SupplierEmail",
keyValue: null,
column: "SupplierEmail",
value: "");
migrationBuilder.AlterColumn<string>(
name: "SupplierEmail",
table: "Suppliers",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "4c8e81ae-2e43-4f98-82a0-4d7c4aa6d011", "AQAAAAIAAYagAAAAEKr0d9Fe168hXvdX6+oJvbfo2QHFsp8i/EQjhLbkWRn/yvKImJa6XzZ5KJ6qohTE1w==", "2219ec34-d4a0-496b-a7d7-e6c5d7b2a222" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "bcc1500e-9ae2-4704-9997-dbe646d2fa7a", "AQAAAAIAAYagAAAAEE3CUAWzIeL592V5xPyAD5ciHe8OGtvbNHhU6UNafDMT/+0R77o6UCDj/K8wc0j0Xw==", "7c582e0d-8237-4605-8fec-449bbe78f6c9" });
}
}
}

View File

@ -208,6 +208,10 @@ namespace PSTW_CentralSystem.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("PartNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("ProductId")
.HasColumnType("int");
@ -367,6 +371,10 @@ namespace PSTW_CentralSystem.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductShortName")
.IsRequired()
.HasColumnType("longtext");
b.Property<int?>("QuantityProduct")
.HasColumnType("int");
@ -377,6 +385,31 @@ namespace PSTW_CentralSystem.Migrations
b.ToTable("Products");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.RequestModel", b =>
{
b.Property<int>("requestId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("requestId"));
b.Property<DateTime>("approvalDate")
.HasColumnType("datetime(6)");
b.Property<string>("remark")
.HasColumnType("longtext");
b.Property<DateTime>("requestDate")
.HasColumnType("datetime(6)");
b.Property<string>("status")
.HasColumnType("longtext");
b.HasKey("requestId");
b.ToTable("Request");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b =>
{
b.Property<int>("StationId")
@ -433,20 +466,21 @@ namespace PSTW_CentralSystem.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
b.Property<string>("SupplierAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierCompName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierEmail")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierGender")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierName")
.IsRequired()
b.Property<string>("SupplierPIC")
.HasColumnType("longtext");
b.Property<string>("SupplierPhoneNo")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierId");
@ -685,16 +719,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 1,
AccessFailedCount = 0,
ConcurrencyStamp = "4c8e81ae-2e43-4f98-82a0-4d7c4aa6d011",
ConcurrencyStamp = "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEKr0d9Fe168hXvdX6+oJvbfo2QHFsp8i/EQjhLbkWRn/yvKImJa6XzZ5KJ6qohTE1w==",
PasswordHash = "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==",
PhoneNumberConfirmed = false,
SecurityStamp = "2219ec34-d4a0-496b-a7d7-e6c5d7b2a222",
SecurityStamp = "79e606c8-032b-426b-8fb2-7727b93823eb",
TwoFactorEnabled = false,
UserInfoStatus = 1,
UserName = "admin@pstw.com.my"
@ -703,16 +737,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "bcc1500e-9ae2-4704-9997-dbe646d2fa7a",
ConcurrencyStamp = "8bf46c63-d7df-4ac5-bab2-fc15fe881302",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEE3CUAWzIeL592V5xPyAD5ciHe8OGtvbNHhU6UNafDMT/+0R77o6UCDj/K8wc0j0Xw==",
PasswordHash = "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==",
PhoneNumberConfirmed = false,
SecurityStamp = "7c582e0d-8237-4605-8fec-449bbe78f6c9",
SecurityStamp = "5ac5ec31-c25f-4a7a-8057-664ecdf76108",
TwoFactorEnabled = false,
UserInfoStatus = 1,
UserName = "sysadmin@pstw.com.my"

View File

@ -454,13 +454,6 @@
<i class="mdi mdi-view-dashboard"></i><span class="hide-menu">Item Registration</span>
</a>
</li>
<li class="sidebar-item">
<a class="sidebar-link waves-effect waves-dark sidebar-link"
asp-area="Inventory" asp-controller="InventoryMaster" asp-action="StationRegistration"
aria-expanded="false">
<i class="mdi mdi-view-dashboard"></i><span class="hide-menu">Station Registration</span>
</a>
</li>
</ul>
</li>
<li class="sidebar-item">

View File

@ -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;", //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
},