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.Diagnostics.CodeAnalysis;
namespace PSTW_CentralSystem.Areas.Inventory.Models
{
@ -6,9 +7,13 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
{
[Key]
public int SupplierId { get; set; }
public required string SupplierName { get; set; }
public required string SupplierGender { get; set; }
public required string SupplierEmail { get; set; }
public required string SupplierPhoneNo { get; set; }
public required string SupplierCompName { get; set; }
public required string SupplierAddress { get; set; }
[AllowNull]
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>`;
return printButton;
},
"className": "align-middle",
},
{
"title": "Item Short Name",
@ -627,11 +628,12 @@
},
{
"title": "Delete",
"data": "productId",
"data": "itemID",
"render": function (data) {
var deleteButton = `<button type="button" class="btn btn-danger delete-btn" data-id="${data}">Delete</button>`;
return deleteButton;
},
"className": "align-middle",
}
],
responsive: true,
@ -853,7 +855,7 @@
return;
}
try {
const response = await fetch(`/InvMainAPI/DeleteProduct/${itemId}`, {
const response = await fetch(`/InvMainAPI/DeleteItem/${itemId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',

View File

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

View File

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