Update Item & Station
This commit is contained in:
parent
e5e1414826
commit
213fd2b460
@ -288,7 +288,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="DONo" class="col-sm-4">Enter DO Number:</label>
|
<label for="DONo" class="col-sm-4">Enter DO Number:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="text" id="DONo" name="DONo" class="form-control" v-model="DONo" placeholder="DO123456">
|
<input type="text" id="DONo" name="DONo" class="form-control" v-model="DONo" placeholder="DO123456" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -296,7 +296,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="DODate" class="col-sm-4">Enter DO Date:</label>
|
<label for="DODate" class="col-sm-4">Enter DO Date:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" v-model="DODate">
|
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" v-model="DODate" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -304,7 +304,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="warranty" class="col-sm-4">Enter Warranty (Months):</label>
|
<label for="warranty" class="col-sm-4">Enter Warranty (Months):</label>
|
||||||
<div class="col-sm-8">
|
<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">
|
<input type="number" id="warranty" name="warranty" class="form-control" placeholder="0 , 1 , 2 , 3, ..." step="1" min="0" v-on:input="calculateWarrantyEndDate()" v-model="warranty" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -320,7 +320,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="invoiceNo" class="col-sm-4">Invoice Number:</label>
|
<label for="invoiceNo" class="col-sm-4">Invoice Number:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="text" id="invoiceNo" name="invoiceNo" class="form-control" v-model="invoiceNo" placeholder="Invoice123456">
|
<input type="text" id="invoiceNo" name="invoiceNo" class="form-control" v-model="invoiceNo" placeholder="Invoice123456" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -328,7 +328,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="invoiceDate" class="col-sm-4">Invoice Date:</label>
|
<label for="invoiceDate" class="col-sm-4">Invoice Date:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" v-model="invoiceDate">
|
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" v-model="invoiceDate" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -401,12 +401,12 @@
|
|||||||
purchaseDate: null,
|
purchaseDate: null,
|
||||||
PO: null,
|
PO: null,
|
||||||
currency: "MYR",
|
currency: "MYR",
|
||||||
DefaultPrice: 0.01,
|
DefaultPrice: null,
|
||||||
currencyRate: 1,
|
currencyRate: 1,
|
||||||
convertPrice: 0.01,
|
convertPrice: 0.01,
|
||||||
DONo: null,
|
DONo: null,
|
||||||
DODate: null,
|
DODate: null,
|
||||||
warranty: 0,
|
warranty: null,
|
||||||
EndWDate: null,
|
EndWDate: null,
|
||||||
invoiceNo: null,
|
invoiceNo: null,
|
||||||
invoiceDate: null,
|
invoiceDate: null,
|
||||||
@ -473,6 +473,18 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async addItem() {
|
async addItem() {
|
||||||
|
|
||||||
|
// List of required fields
|
||||||
|
const requiredFields = ['DefaultPrice', 'DONo', 'DODate', 'warranty', 'invoiceNo', 'invoiceDate'];
|
||||||
|
|
||||||
|
// Loop through required fields and check if any are null or empty
|
||||||
|
for (let field of requiredFields) {
|
||||||
|
if (this[field] === null || this[field] === '') {
|
||||||
|
alert('Item Error', `Please fill in required fields: ${field}.`, 'warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.showProduct.category == "Disposable") {
|
if (this.showProduct.category == "Disposable") {
|
||||||
this.serialNumber = "";
|
this.serialNumber = "";
|
||||||
}
|
}
|
||||||
@ -489,9 +501,11 @@
|
|||||||
DefaultPrice: this.DefaultPrice,
|
DefaultPrice: this.DefaultPrice,
|
||||||
CurrencyRate: this.currencyRate,
|
CurrencyRate: this.currencyRate,
|
||||||
ConvertPrice: this.convertPrice,
|
ConvertPrice: this.convertPrice,
|
||||||
|
DONo: this.DONo,
|
||||||
DODate: this.DODate,
|
DODate: this.DODate,
|
||||||
Warranty: this.warranty,
|
Warranty: this.warranty,
|
||||||
EndWDate: this.EndWDate,
|
EndWDate: this.EndWDate,
|
||||||
|
InvoiceNo: this.invoiceNo,
|
||||||
InvoiceDate: this.invoiceDate,
|
InvoiceDate: this.invoiceDate,
|
||||||
CreatedByUserId: this.currentUser.id,
|
CreatedByUserId: this.currentUser.id,
|
||||||
TeamType: this.selectedTeamType,
|
TeamType: this.selectedTeamType,
|
||||||
@ -811,17 +825,19 @@
|
|||||||
this.purchaseDate = null;
|
this.purchaseDate = null;
|
||||||
this.PO = null;
|
this.PO = null;
|
||||||
this.currency = 'MYR';
|
this.currency = 'MYR';
|
||||||
this.DefaultPrice = 0.01;
|
this.DefaultPrice = null;
|
||||||
this.currencyRate = 1;
|
this.currencyRate = 1;
|
||||||
this.convertPrice = 0.01;
|
this.convertPrice = 0.01;
|
||||||
this.DODate = null;
|
this.DODate = null;
|
||||||
this.warranty = 0;
|
this.warranty = null;
|
||||||
|
this.DONo = null;
|
||||||
|
this.invoiceNo = null;
|
||||||
this.EndWDate = null;
|
this.EndWDate = null;
|
||||||
this.invoiceDate = null;
|
this.invoiceDate = null;
|
||||||
this.selectedProduct = '';
|
this.selectedProduct = '';
|
||||||
this.selectedSupplier = '';
|
this.selectedSupplier = '';
|
||||||
this.selectedCompany = this.currentUserCompanyDept.companyId;
|
// this.selectedCompany = this.currentUserCompanyDept.companyId;
|
||||||
this.selectedDepartment = '';
|
// this.selectedDepartment = '';
|
||||||
this.selectedTeamType = '';
|
this.selectedTeamType = '';
|
||||||
this.partNumber = null;
|
this.partNumber = null;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -27,11 +27,11 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-4 col-form-label">Station User PIC</label>
|
<label class="col-sm-4 col-form-label">Station User PIC</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="dropdown">
|
<div class="">
|
||||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedUserName" :disabled="currentUser != null" required v-on:change="updateDepartment()">
|
<select class="btn btn-primary form-select" v-model="selectedUserName" :disabled="currentUser != null" required v-on:change="updateDepartment()">
|
||||||
<option class="btn-light" value="" disabled selected>Select User</option>
|
<option class="btn-light" value="" disabled selected>Select User</option>
|
||||||
<option v-for="(technicianUser, index) in users" :key="index" :value="technicianUser.fullname">
|
<option class="btn-light" v-for="(technicianUser, index) in users" :key="index" :value="technicianUser.fullName">
|
||||||
{{ technicianUser.fullname }}
|
{{ technicianUser.fullName }}
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@ -113,12 +113,11 @@
|
|||||||
methods: {
|
methods: {
|
||||||
async fetchUsers() {
|
async fetchUsers() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/IdentityAPI/GetTechnicianUserInformation/`, {
|
const response = await fetch(`/InvMainAPI/UserList/`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
this.users = await response.json();
|
||||||
this.users = data.technicianUsers;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(`Failed to fetch user: ${response.statusText}`);
|
console.error(`Failed to fetch user: ${response.statusText}`);
|
||||||
@ -230,11 +229,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Station User PIC",
|
"title": "Station User PIC",
|
||||||
"data": "stationPicID",
|
"data": "fullName",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Department ID",
|
"title": "Department",
|
||||||
"data": "departmentId",
|
"data": "departmentName",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Delete",
|
"title": "Delete",
|
||||||
@ -250,7 +249,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Attach click event listener to the delete buttons
|
// Attach click event listener to the delete buttons
|
||||||
$('#stationDatatable tbody').on('click', '.delete-btn', function () {
|
$('#stationDatatable tbody').off('click', '.delete-btn').on('click', '.delete-btn', function () {
|
||||||
const stationId = $(this).data('id');
|
const stationId = $(this).data('id');
|
||||||
self.deleteStation(stationId);
|
self.deleteStation(stationId);
|
||||||
});
|
});
|
||||||
@ -259,7 +258,8 @@
|
|||||||
},
|
},
|
||||||
updateDepartment() {
|
updateDepartment() {
|
||||||
// Find the selected user by their full name
|
// Find the selected user by their full name
|
||||||
const selectedUser = this.users.find(user => user.fullname === this.selectedUserName);
|
const selectedUser = this.users.find(user => user.fullName === this.selectedUserName);
|
||||||
|
console.log(selectedUser);
|
||||||
if (selectedUser) {
|
if (selectedUser) {
|
||||||
this.stationUserPIC = selectedUser.id;
|
this.stationUserPIC = selectedUser.id;
|
||||||
this.departmentId = selectedUser.department.departmentId;
|
this.departmentId = selectedUser.department.departmentId;
|
||||||
|
|||||||
@ -70,44 +70,44 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("GetTechnicianUserInformation")]
|
//[HttpPost("GetTechnicianUserInformation")]
|
||||||
public async Task<IActionResult> GetTechnicianUserInformation()
|
//public async Task<IActionResult> GetTechnicianUserInformation()
|
||||||
{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
var users = await _identityDbContext.Users
|
// var users = await _identityDbContext.Users
|
||||||
.Include(u => u.Department)
|
// .Include(u => u.Department)
|
||||||
.ToListAsync(); // Retrieve all users with department info
|
// .ToListAsync(); // Retrieve all users with department info
|
||||||
|
|
||||||
var technicianUsers = new List<object>();
|
// var technicianUsers = new List<object>();
|
||||||
|
|
||||||
foreach (var user in users)
|
// foreach (var user in users)
|
||||||
{
|
// {
|
||||||
var roles = await _userManager.GetRolesAsync(user);
|
// var roles = await _userManager.GetRolesAsync(user);
|
||||||
if (roles.Contains("Technician"))
|
// if (roles.Contains("Technician"))
|
||||||
{
|
// {
|
||||||
technicianUsers.Add(new
|
// technicianUsers.Add(new
|
||||||
{
|
// {
|
||||||
id = user.Id,
|
// id = user.Id,
|
||||||
fullname = user.FullName,
|
// fullname = user.FullName,
|
||||||
department = user.Department
|
// department = user.Department
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!technicianUsers.Any())
|
// if (!technicianUsers.Any())
|
||||||
{
|
// {
|
||||||
return NotFound(new { message = "No technicians found" });
|
// return NotFound(new { message = "No technicians found" });
|
||||||
}
|
// }
|
||||||
|
|
||||||
return Ok(new { technicianUsers = technicianUsers });
|
// return Ok(new { technicianUsers = technicianUsers });
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
return StatusCode(500, new { message = $"An error occurred: {ex.Message}" });
|
// return StatusCode(500, new { message = $"An error occurred: {ex.Message}" });
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
//}
|
||||||
#endregion User
|
#endregion User
|
||||||
|
|
||||||
#region LDAP Login
|
#region LDAP Login
|
||||||
|
|||||||
@ -1231,8 +1231,17 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("StationList")]
|
[HttpPost("StationList")]
|
||||||
public async Task<IActionResult> StationList()
|
public async Task<IActionResult> StationList()
|
||||||
{
|
{
|
||||||
var stationList = await _centralDbContext.Stations.Include(i => i.StationPic).ToListAsync();
|
var stationList = await _centralDbContext.Stations.Include(i => i.StationPic).Include(i => i.Department).ToListAsync();
|
||||||
return Json(stationList);
|
|
||||||
|
return Json(stationList.Select(i => new
|
||||||
|
{
|
||||||
|
i.StationId,
|
||||||
|
i.StationPicID,
|
||||||
|
i.StationName,
|
||||||
|
i.DepartmentId,
|
||||||
|
i.StationPic?.FullName,
|
||||||
|
i.Department?.DepartmentName,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("AddStation")]
|
[HttpPost("AddStation")]
|
||||||
@ -1311,10 +1320,15 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("UserList")]
|
[HttpPost("UserList")]
|
||||||
public async Task<IActionResult> UserList()
|
public async Task<IActionResult> UserList()
|
||||||
{
|
{
|
||||||
var userList = await _centralDbContext.Users.ToListAsync();
|
|
||||||
return Json(userList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
var userList = await _centralDbContext.Users.Include(i => i.Department).ToListAsync();
|
||||||
|
return Json(userList.Select(i => new
|
||||||
|
{
|
||||||
|
i.Id,
|
||||||
|
i.FullName,
|
||||||
|
i.Department,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
#endregion AllUser
|
#endregion AllUser
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Privacy Policy";
|
ViewData["Title"] = "Privacy Policy";
|
||||||
}
|
}
|
||||||
<h1>@ViewData["Title"]</h1>
|
|
||||||
|
|
||||||
<p>Use this page to detail your site's privacy policy.</p>
|
<p>PSTW All right reserved 2025</p>
|
||||||
|
|||||||
@ -233,7 +233,7 @@
|
|||||||
<!-- Comment -->
|
<!-- Comment -->
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<partial name="_LoginPartial" />
|
<partial name="_LoginPartial" />
|
||||||
<li class="nav-item dropdown">
|
@* <li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle"
|
<a class="nav-link dropdown-toggle"
|
||||||
href="#"
|
href="#"
|
||||||
id="navbarDropdown"
|
id="navbarDropdown"
|
||||||
@ -250,14 +250,14 @@
|
|||||||
<a class="dropdown-item" href="#">Something else here</a>
|
<a class="dropdown-item" href="#">Something else here</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li> *@
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<!-- End Comment -->
|
<!-- End Comment -->
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<!-- Messages -->
|
<!-- Messages -->
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<li class="nav-item dropdown">
|
@* <li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle waves-effect waves-dark"
|
<a class="nav-link dropdown-toggle waves-effect waves-dark"
|
||||||
href="#"
|
href="#"
|
||||||
id="2"
|
id="2"
|
||||||
@ -348,7 +348,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li> *@
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
<!-- End Messages -->
|
<!-- End Messages -->
|
||||||
<!-- ============================================================== -->
|
<!-- ============================================================== -->
|
||||||
@ -375,14 +375,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-end user-dd animated"
|
<ul class="dropdown-menu dropdown-menu-end user-dd animated"
|
||||||
aria-labelledby="navbarDropdown">
|
aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="javascript:void(0)"><i class="mdi mdi-account me-1 ms-1"></i> My Profile</a>
|
@* <a class="dropdown-item" href="javascript:void(0)"><i class="mdi mdi-account me-1 ms-1"></i> My Profile</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0)"><i class="mdi mdi-wallet me-1 ms-1"></i> My Balance</a>
|
<a class="dropdown-item" href="javascript:void(0)"><i class="mdi mdi-wallet me-1 ms-1"></i> My Balance</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0)"><i class="mdi mdi-email me-1 ms-1"></i> Inbox</a>
|
<a class="dropdown-item" href="javascript:void(0)"><i class="mdi mdi-email me-1 ms-1"></i> Inbox</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="javascript:void(0)">
|
<a class="dropdown-item" href="javascript:void(0)">
|
||||||
<i class="mdi mdi-settings me-1 ms-1"></i> Account
|
<i class="mdi mdi-settings me-1 ms-1"></i> Account
|
||||||
Setting
|
Setting
|
||||||
</a>
|
</a> *@
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="javascript:void(0)"><i class="fa fa-power-off me-1 ms-1"></i> Logout</a>
|
<a class="dropdown-item" href="javascript:void(0)"><i class="fa fa-power-off me-1 ms-1"></i> Logout</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
//"DefaultConnection": "Server=localhost;uid=root;Password='';Database=web_interface;"
|
//"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"
|
//"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=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_prod;" //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
|
//"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
|
//"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=intern;password='intern_mysql_acct';database=web_interface;"//DB_dev connection
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user