This commit is contained in:
Naz 2025-03-26 16:41:41 +08:00
parent aa316b94ae
commit 9e3539caa6
5 changed files with 172 additions and 14 deletions

View File

@ -1,6 +1,41 @@
namespace PSTW_CentralSystem.Areas.OTcalculate.Models using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using PSTW_CentralSystem.Areas.Inventory.Models;
using PSTW_CentralSystem.Models;
namespace PSTW_CentralSystem.Areas.OTcalculate.Models
{ {
public class OtRegisterModel public class OtRegisterModel
{ {
[Key]
public int OvertimeId { get; set; }
[Required]
public DateTime OtDate { get; set; }
[Required]
public DateTime OfficeFrom { get; set; }
[Required]
public DateTime OfficeTo { get; set; }
public int OfficeBreak { get; set; }
public DateTime OutsideFrom { get; set; }
public DateTime OutsideTo { get; set; }
public int OutsideBreak { get; set; }
public int StationId { get; set; }
[ForeignKey("StationId")]
public virtual StationModel? Stations { get; set; }
public string? OtDescription { get; set; }
public string? OtDays { get; set; }
public byte[]? PDF { get; set; }
public int UserId { get; set; }
[ForeignKey("UserId")]
public virtual UserModel? Users { get; set; }
} }
} }

View File

@ -5,18 +5,128 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<div id="app"> <div id="app" class="container mt-4 d-flex justify-content-center">
<div class="container mt-3"> <div class="card shadow-sm" style="width: 1100px;">
<div class="card m-1 shadow-sm"> <div class="card-body">
<div class="card-body col-md-6"> <div class="row">
<div class="card p-2 mb-2"> @* Left Section *@
<label>Date:</label> <div class="col-md-7">
<div class="mb-3">
<label class="form-label">Date</label>
<input type="date" class="form-control" v-model="selectedDate"> <input type="date" class="form-control" v-model="selectedDate">
<div class="d-flex align-items-center gap-2"> </div>
<h4>OFFICE HOURS</h4>
</div> <h6 class="fw-bold">OFFICE HOURS</h6>
</div> <div class="row mb-3">
<div class="col-4">
<label>From</label>
<input type="time" class="form-control" v-model="officeFrom">
</div>
<div class="col-4">
<label>To</label>
<input type="time" class="form-control" v-model="officeTo">
</div>
<div class="col-4">
<label>Break Hours</label>
<input type="time" class="form-control" v-model="officeBreak">
</div>
</div>
<h6 class="fw-bold text-danger">OUTSIDE OFFICE HOURS</h6>
<div class="row mb-2">
<div class="col-4">
<label>From</label>
<input type="time" class="form-control" v-model="outsideFrom">
</div>
<div class="col-4">
<label>To</label>
<input type="time" class="form-control" v-model="outsideTo">
</div>
<div class="col-4">
<label>Break Hours</label>
<input type="time" class="form-control" v-model="outsideBreak">
</div>
</div>
<div class="mb-3">
<label for="airstationDropdown">Air Station</label>
<select id="airstationDropdown" class="form-control" v-model="selectedAirStation">
<option v-for="airstation in airstationList" :key="airstation.airstationId" :value="airstation.airstationId">
{{ airstation.airstationName }}
</option>
</select>
</div>
<div class="mb-3">
<label>Work Brief Description</label>
<textarea class="form-control" v-model="otDescription"></textarea>
</div>
</div>
@* Right Section *@
<div class="col-md-5">
<label>Day</label>
<div class="form-check">
<input class="form-check-input" type="radio" v-model="selectedDayType" value="Weekday">
<label class="form-check-label">Weekday</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" v-model="selectedDayType" value="Weekend">
<label class="form-check-label">Weekend</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" v-model="selectedDayType" value="Public Holiday">
<label class="form-check-label">Public Holiday</label>
</div>
<div class="mb-3 mt-3">
<label>Upload File:</label>
<input type="file" class="form-control" v-on:change="handleFileUpload">
<small class="text-danger">*upload pdf file only</small>
</div>
<div class="mb-3 d-flex flex-column align-items-center">
<label>Total OT Hours</label>
<input type="text" class="form-control text-center" v-model="totalOTHours" style="width: 200px;" readonly>
</div>
<div class="mb-3 d-flex flex-column align-items-center">
<label>Total Break Hours</label>
<input type="text" class="form-control text-center" v-model="totalBreakHours" style="width: 200px;" readonly>
</div>
</div>
</div>
<div class="d-flex justify-content-end mt-3">
<button class="btn btn-danger" v-on:click="clearForm">Clear</button>
<button class="btn btn-success ms-3" v-on:click="addOvertime">Save</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@section Scripts {
<script>
const app = Vue.createApp({
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
}
});
app.mount('#app');
</script>
}

View File

@ -32,6 +32,8 @@ namespace PSTW_CentralSystem.Controllers.API
_centralDbContext = centralDbContext; _centralDbContext = centralDbContext;
_userManager = userManager; _userManager = userManager;
} }
#region Settings
[HttpGet("GetUpdateDates")] [HttpGet("GetUpdateDates")]
public IActionResult GetUpdateDates() public IActionResult GetUpdateDates()
{ {
@ -54,6 +56,7 @@ namespace PSTW_CentralSystem.Controllers.API
return BadRequest(ex.Message); return BadRequest(ex.Message);
} }
} }
#endregion
#region Rate #region Rate
[HttpPost("UpdateRates")] [HttpPost("UpdateRates")]
@ -74,6 +77,7 @@ namespace PSTW_CentralSystem.Controllers.API
if (existingRate != null) if (existingRate != null)
{ {
existingRate.RateValue = rate.RateValue; existingRate.RateValue = rate.RateValue;
existingRate.LastUpdated = DateTime.Now;
_centralDbContext.Rates.Update(existingRate); _centralDbContext.Rates.Update(existingRate);
} }
else else
@ -81,7 +85,8 @@ namespace PSTW_CentralSystem.Controllers.API
_centralDbContext.Rates.Add(new RateModel _centralDbContext.Rates.Add(new RateModel
{ {
UserId = rate.UserId, UserId = rate.UserId,
RateValue = rate.RateValue RateValue = rate.RateValue,
LastUpdated = DateTime.Now
}); });
} }
} }
@ -176,6 +181,7 @@ namespace PSTW_CentralSystem.Controllers.API
if (existingCalendar != null) if (existingCalendar != null)
{ {
existingCalendar.HolidayName = calendar.HolidayName; existingCalendar.HolidayName = calendar.HolidayName;
existingCalendar.LastUpdated = DateTime.Now;
_centralDbContext.Holidays.Update(existingCalendar); _centralDbContext.Holidays.Update(existingCalendar);
} }
else else
@ -184,7 +190,8 @@ namespace PSTW_CentralSystem.Controllers.API
{ {
HolidayName = calendar.HolidayName, HolidayName = calendar.HolidayName,
HolidayDate = calendar.HolidayDate, HolidayDate = calendar.HolidayDate,
StateId = calendar.StateId StateId = calendar.StateId,
LastUpdated = DateTime.Now
}); });
} }
} }
@ -352,5 +359,10 @@ namespace PSTW_CentralSystem.Controllers.API
#endregion #endregion
#region OtRegister
#endregion
} }
} }

View File

@ -103,5 +103,6 @@ namespace PSTW_CentralSystem.DBContext
public DbSet<CalendarModel> Holidays { get; set; } public DbSet<CalendarModel> Holidays { get; set; }
public DbSet<StateModel> States { get; set; } public DbSet<StateModel> States { get; set; }
public DbSet<WeekendModel> Weekends { get; set; } public DbSet<WeekendModel> Weekends { get; set; }
public DbSet<OtRegisterModel> Otregisters { get; set; }
} }
} }

View File

@ -524,7 +524,7 @@
<a class="sidebar-link has-arrow waves-effect waves-dark" <a class="sidebar-link has-arrow waves-effect waves-dark"
href="javascript:void(0)" href="javascript:void(0)"
aria-expanded="false"> aria-expanded="false">
<i class="mdi mdi-receipt"></i><span class="hide-menu">Overtime</span> <i class="mdi mdi-receipt"></i><span class="hide-menu">User Overtime</span>
</a> </a>
<ul aria-expanded="false" class="collapse first-level"> <ul aria-expanded="false" class="collapse first-level">
<li class="sidebar-item"> <li class="sidebar-item">