This commit is contained in:
MOHD ARIFF 2025-01-13 16:20:41 +08:00
parent d1682750dc
commit 9324f61d05
4 changed files with 46 additions and 28 deletions

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
namespace PSTW_CentralSystem.Areas.Inventory.Models namespace PSTW_CentralSystem.Areas.Inventory.Models
{ {
@ -6,9 +7,13 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
{ {
[Key] [Key]
public int SupplierId { get; set; } public int SupplierId { get; set; }
public required string SupplierName { get; set; } public required string SupplierCompName { get; set; }
public required string SupplierGender { get; set; } public required string SupplierAddress { get; set; }
public required string SupplierEmail { get; set; } [AllowNull]
public required string SupplierPhoneNo { get; set; } public string? SupplierPIC { get; set; }
[AllowNull]
public string? SupplierEmail { get; set; }
[AllowNull]
public string? SupplierPhoneNo { get; set; }
} }
} }

View File

@ -568,6 +568,7 @@
var printButton = `<button type="button" class="btn btn-success print-btn" data-id="${data}">Print</button>`; var printButton = `<button type="button" class="btn btn-success print-btn" data-id="${data}">Print</button>`;
return printButton; return printButton;
}, },
"className": "align-middle",
}, },
{ {
"title": "Item Short Name", "title": "Item Short Name",
@ -627,11 +628,12 @@
}, },
{ {
"title": "Delete", "title": "Delete",
"data": "productId", "data": "itemID",
"render": function (data) { "render": function (data) {
var deleteButton = `<button type="button" class="btn btn-danger delete-btn" data-id="${data}">Delete</button>`; var deleteButton = `<button type="button" class="btn btn-danger delete-btn" data-id="${data}">Delete</button>`;
return deleteButton; return deleteButton;
}, },
"className": "align-middle",
} }
], ],
responsive: true, responsive: true,
@ -853,7 +855,7 @@
return; return;
} }
try { try {
const response = await fetch(`/InvMainAPI/DeleteProduct/${itemId}`, { const response = await fetch(`/InvMainAPI/DeleteItem/${itemId}`, {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -18,30 +18,35 @@
@* Supplier Name *@ @* Supplier Name *@
<div class="form-group row"> <div class="form-group row">
<label for="supplierName" class="col-sm-3">Supplier Name:</label> <label for="supplierCompName" class="col-sm-3">Supplier Company Name:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" id="supplierName" name="supplierName" class="form-control" required v-model="supplierName"> <input type="text" id="supplierCompName" name="supplierCompName" class="form-control" required v-model="supplierCompName">
</div> </div>
</div> </div>
@* Supplier Gender *@ @* Supplier Gender *@
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-3">Supplier Gender:</label> <label class="col-sm-3">Supplier Address:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<div class="dropdown"> <div class="dropdown">
<select class="btn btn-primary dropdown-toggle w-100" v-model="supplierGender" required data-toggle="dropdown" aria-expanded="false"> <textarea type="text" id="supplierAddress" name="supplierAddress" class="form-control" required v-model="supplierAddress"></textarea>
<option value="" selected>Select Gender</option>
<option v-for="(item, index) in gender" :key="index" :value="item">{{ item }}</option>
</select>
</div> </div>
</div> </div>
</div> </div>
@* Supplier PIC *@
<div class="form-group row">
<label class="col-sm-3">Supplier PIC:</label>
<div class="col-sm-9">
<input type="email" id="supplierPIC" name="supplierPIC" class="form-control" v-model="supplierPIC">
</div>
</div>
@* Supplier Email *@ @* Supplier Email *@
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-3">Supplier Email:</label> <label class="col-sm-3">Supplier Email:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="email" id="supplierName" name="supplierEmail" class="form-control" required v-model="supplierEmail"> <input type="email" id="supplierEmail" name="supplierEmail" class="form-control" v-model="supplierEmail">
</div> </div>
</div> </div>
@ -49,7 +54,7 @@
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-3">Supplier Phone Number:</label> <label class="col-sm-3">Supplier Phone Number:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="tel" id="supplierPhoneNo" name="supplierPhoneNo" class="form-control" required v-model="supplierPhoneNo"> <input type="tel" id="supplierPhoneNo" name="supplierPhoneNo" class="form-control" v-model="supplierPhoneNo">
</div> </div>
</div> </div>
@ -97,10 +102,11 @@
const app = Vue.createApp({ const app = Vue.createApp({
data() { data() {
return { return {
supplierName : null, supplierCompName : null,
supplierEmail : null, supplierEmail : null,
supplierGender : '', supplierAddress : null,
supplierPhoneNo : null, supplierPhoneNo : null,
supplierPIC : null,
suuppliers: null, suuppliers: null,
supplierDatatable: null, supplierDatatable: null,
gender: ["Male", "Female", "Helicopter"], gender: ["Male", "Female", "Helicopter"],
@ -145,15 +151,16 @@
$('#loadingModal').modal('show'); $('#loadingModal').modal('show');
// Create the payload // Create the payload
const formData = { const formData = {
supplierName: this.supplierName, supplierCompName: this.supplierCompName,
supplierAddress: this.supplierAddress,
supplierPIC: this.supplierPIC,
supplierEmail: this.supplierEmail, supplierEmail: this.supplierEmail,
supplierGender: this.supplierGender, supplierPhoneNo: this.supplierPhoneNo,
supplierPhoneNo: this.supplierPhoneNo
}; };
try { try {
// List of required fields // List of required fields
const requiredFields = ['supplierName', 'supplierEmail', 'supplierGender', 'supplierPhoneNo']; const requiredFields = ['supplierCompName', 'supplierAddress'];
// Loop through required fields and check if any are null or empty // Loop through required fields and check if any are null or empty
for (let field of requiredFields) { for (let field of requiredFields) {
@ -196,10 +203,11 @@
} }
}, },
resetForm() { resetForm() {
this.supplierName = null; this.supplierCompName = null;
this.supplierAddress = null;
this.supplierEmail = null; this.supplierEmail = null;
this.supplierGender = '';
this.supplierPhoneNo = null; this.supplierPhoneNo = null;
this.supplierPIC = null;
}, },
initiateTable() { initiateTable() {
self = this; self = this;
@ -207,12 +215,16 @@
"data": this.suppliers, "data": this.suppliers,
"columns": [ "columns": [
{ {
"title": "Supplier Name", "title": "Supplier Company Name",
"data": "supplierName", "data": "supplierCompName",
}, },
{ {
"title": "Supplier Gender", "title": "Supplier Address",
"data": "supplierGender", "data": "supplierAddress",
},
{
"title": "Company PIC",
"data": "supplierPIC",
}, },
{ {
"title": "Supplier Email", "title": "Supplier Email",

View File

@ -22,7 +22,6 @@
type="image/png" type="image/png"
sizes="16x16" sizes="16x16"
href="/assets/images/favicon.png" /> href="/assets/images/favicon.png" />
<a href="~/assets/fonts/ocraext.ttf">~/assets/fonts/ocraext.ttf</a>
<!-- Custom CSS --> <!-- Custom CSS -->