Merge pull request 'master' (#89) from master into dev

Reviewed-on: #89
This commit is contained in:
vincent.vo 2024-09-24 19:19:13 +10:00
commit 2c2d067e4c
3 changed files with 39 additions and 21 deletions

View File

@ -221,16 +221,29 @@ class TechnicalController extends Controller
'technicals.*.point' => 'required|integer|min:0|max:3', // Điểm trong khoảng [0-3]
]);
// Xóa hết các bản ghi hiện có của user trong bảng technical_users
TechnicalUser::where('user_id', $userInfo->id)->delete();
// Lấy danh sách technicals của user từ bảng TechnicalUser
$existingTechnicals = TechnicalUser::where('user_id', $userInfo->id)->get()->keyBy('technical_id');
// Duyệt qua mảng technicals và thêm mới dữ liệu
foreach ($validatedData['technicals'] as $technical) {
TechnicalUser::create([
'user_id' => $userInfo->id,
'technical_id' => $technical['technical_id'],
'point' => $technical['point']
]);
$existingTechnical = $existingTechnicals->get($technical['technical_id']);
// if ($technical['technical_id'] == 7) {
// dd($existingTechnical,$userInfo);
// }
if ($existingTechnical) {
// Nếu technical_id đã tồn tại và point khác, thì update
if ($existingTechnical->point !== $technical['point']) {
$existingTechnical->update([
'point' => $technical['point']
]);
}
} else {
// Nếu technical_id chưa tồn tại, tạo mới
TechnicalUser::create([
'user_id' => $userInfo->id,
'technical_id' => $technical['technical_id'],
'point' => $technical['point']
]);
}
}
return AbstractController::ResultSuccess('Technicals for user updated successfully.');

View File

@ -478,7 +478,9 @@ const SprintReview = () => {
criteriaSprint.length == 0 || loading ? { display: 'none' } : {}
}
>
Criteria for Sprint:
Criteria for Sprint: <Box fs={'italic'} fz={'sm'}>
<a href={`/test-report?projectID=${filter.projectID}&sprintID=${filter.sprintID}`} target='_blank'>Sprint test report</a>
</Box>
</Title>
<Box
style={{
@ -506,17 +508,17 @@ const SprintReview = () => {
>
<Table.Thead>
<Table.Tr bg="#228be66b" style={rowStyle}>
<Table.Th style={{ textAlign: 'center', width: '250px' }}>
<Table.Th style={{ textAlign: 'center', width: '15%' }}>
Criteria
</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '250px' }}>
<Table.Th style={{ textAlign: 'center', width: '25%' }}>
Expect Result
</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '250px' }}>
<Table.Th style={{ textAlign: 'center', width: '25%' }}>
Actual Result
</Table.Th>
<Table.Th style={{ textAlign: 'center' }}>Note</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '100px' }}>
<Table.Th style={{ textAlign: 'center', width: '30%' }}>Note</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '5%' }}>
Point
</Table.Th>
</Table.Tr>
@ -599,6 +601,7 @@ const SprintReview = () => {
value={finalPoint}
onChange={(value) => setFinalPoint(value ?? '')}
size="xs"
w={'40%'}
styles={() => ({
input: {
color: 'red',
@ -639,17 +642,17 @@ const SprintReview = () => {
>
<Table.Thead>
<Table.Tr bg="#228be66b" style={rowStyle}>
<Table.Th style={{ textAlign: 'center', width: '250px' }}>
<Table.Th style={{ textAlign: 'center', width: '15%' }}>
User
</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '250px' }}>
<Table.Th style={{ textAlign: 'center', width: '25%' }}>
Criteria
</Table.Th>
<Table.Th style={{ textAlign: 'center' }}>Note</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '250px' }}>
<Table.Th style={{ textAlign: 'center', width: '40%' }}>Note</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '15%' }}>
Created by
</Table.Th>
<Table.Th style={{ textAlign: 'center', width: '100px' }}>
<Table.Th style={{ textAlign: 'center', width: '5%' }}>
Point
</Table.Th>
</Table.Tr>

View File

@ -304,10 +304,11 @@ const StaffEvaluation = () => {
User:
</Text>
<Select
style={{ width: '50%' }}
style={{ width: '30%' }}
label={''}
placeholder="Select user"
maxLength={255}
size={'xs'}
required
data={listUsers.map((i: User) => ({
value: i.id.toString(),
@ -338,7 +339,6 @@ const StaffEvaluation = () => {
w="100%"
display={'flex'}
mt={15}
style={{ justifyContent: 'space-evenly' }}
>
<Box display={'flex'} mr={10}>
<Text
@ -353,6 +353,7 @@ const StaffEvaluation = () => {
<DateInput
placeholder="Select date"
clearable
size='xs'
required
label={''}
value={filter.fromDate ? new Date(filter.fromDate) : null}
@ -373,6 +374,7 @@ const StaffEvaluation = () => {
<DateInput
placeholder="Select date"
clearable
size='xs'
required
label={''}
value={filter.toDate ? new Date(filter.toDate) : null}