Commit 2c941372 by Azhan Hannan

log pia #166 -> SCENARIO: -KEY IN DAYS -CLICK BUTTON ‘SAVE’ -KEY IN HOURS pada…

log pia #166 -> SCENARIO: -KEY IN DAYS -CLICK BUTTON ‘SAVE’ -KEY IN HOURS pada days yg telah diisi -CLICK BUTTON ‘SAVE’
parent 2a2b8aad
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
</table> </table>
<button class="ui blue button" type="submit">Save</button> <button class="ui blue button" type="submit">Save</button>
<button class="ui green button" type="button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiProject') }} ';">Back</button> <button class="ui green button" type="button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiProject') }} ';">Baasack</button>
</form> </form>
</div> </div>
...@@ -132,10 +132,15 @@ ...@@ -132,10 +132,15 @@
} }
totdays = document.getElementById('totaldays'); totdays = document.getElementById('totaldays');
if (isNaN(totdays)) {
totdays = 0;
}
totdays.value = totaldays; totdays.value = totaldays;
tothours = document.getElementById('totalhours'); tothours = document.getElementById('totalhours');
if (isNaN(tothours)) {
tothours = 0;
}
tothours.value = totaldays * 8; tothours.value = totaldays * 8;
} }
...@@ -161,20 +166,24 @@ ...@@ -161,20 +166,24 @@
if (isNaN(currhours)) { if (isNaN(currhours)) {
currhours = 0; currhours = 0;
} }
totalhours += currhours; totalhours += currhours;
} }
} }
tothours = document.getElementById('totalhours'); tothours = document.getElementById('totalhours');
if (isNaN(tothours)) {
tothours = 0;
}
tothours.value = totalhours; tothours.value = totalhours;
totdays = document.getElementById('totaldays'); totdays = document.getElementById('totaldays');
if (isNaN(totdays)) {
totdays = 0;
}
totdays.value = totalhours/8; totdays.value = totalhours/8;
} }
</script> </script>
@endpush @endpush
\ No newline at end of file
...@@ -318,8 +318,13 @@ class MaintenanceController extends Controller ...@@ -318,8 +318,13 @@ class MaintenanceController extends Controller
->first(); ->first();
if ($datas) if ($datas)
{ {
if ($value == 'NaN') {
$datas->pm_days = 0;
$datas->pm_hours = 0;
} else {
$datas->pm_days = $value; $datas->pm_days = $value;
$datas->pm_hours = $value*8; $datas->pm_hours = $value*8;
}
$datas->updated_by = $staffid; $datas->updated_by = $staffid;
$datas->save(); $datas->save();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment