forked from TFcis/NTOJ
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request TFcis#81 from tobiichi3227/feat/misc
feat/misc
- Loading branch information
Showing
23 changed files
with
289 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
<link | ||
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" | ||
rel="stylesheet" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" /> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" | ||
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,83 @@ | ||
{% extends '../manage.html' %} | ||
{% block head %} | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@eonasdan/[email protected]/dist/css/tempus-dominus.min.css" crossorigin="anonymous"> | ||
|
||
<style> | ||
.svg-inline--fa { | ||
display: var(--fa-display, inline-block); | ||
height: 1em; | ||
} | ||
</style> | ||
|
||
<script type="text/javascript"> | ||
function init() { | ||
var start_date_picker = null; | ||
var end_date_picker = null; | ||
$.getScript('https://cdn.jsdelivr.net/npm/@eonasdan/[email protected]/dist/js/tempus-dominus.min.js', () => { | ||
const options = { | ||
display: { | ||
calendarWeeks: true, | ||
}, | ||
|
||
localization: { | ||
locale: 'zh-tw', | ||
format: 'yyyy/MM/dd HH:mm', | ||
}, | ||
}; | ||
start_date_picker = new tempusDominus.TempusDominus(document.getElementById('datepickerStart'), options); | ||
end_date_picker = new tempusDominus.TempusDominus(document.getElementById('datepickerEnd'), options); | ||
}); | ||
|
||
let j_form = $("#form"); | ||
let re = /[^0-9,\ ]/; | ||
|
||
j_form.find("#add").on('click', (event) => { | ||
let start_time = null, end_time = null; | ||
let name = j_form.find("#name").val(); | ||
let status = j_form.find("#status").val(); | ||
let start = j_form.find("#start").val(); | ||
let end = j_form.find("#end").val(); | ||
let pro_list = j_form.find("#pro_list").val(); | ||
let acct_list = j_form.find("#acct_list").val(); | ||
|
||
if (start != '' && start != '-1') { | ||
start = new Date(start + ' +0000').toISOString(); | ||
} else if (start == '-1') { | ||
start = new Date('1970/01/01 00:00 +0000').toISOString(); | ||
start_time = start_date_picker.viewDate; | ||
if (start_time == '') { | ||
index.show_notify_dialog("開始時間不可為空", index.DIALOG_TYPE.warning); | ||
return; | ||
} | ||
|
||
if (end != '' && end != '-1') { | ||
end = new Date(end + ' +0000').toISOString(); | ||
} else if (end == '-1') { | ||
end = new Date('2100/01/01 00:00 +0000').toISOString(); | ||
end_time = end_date_picker.viewDate; | ||
if (end_time == '') { | ||
index.show_notify_dialog("結束時間不可為空", index.DIALOG_TYPE.warning); | ||
return; | ||
} | ||
|
||
if (start_time >= end_time) { | ||
index.show_notify_dialog("結束時間必須大於開始時間", index.DIALOG_TYPE.warning); | ||
return; | ||
} | ||
|
||
if (re.test(pro_list)) { | ||
alert("Problem List錯誤,請輸入數字、逗號與空白設定,範例:1, 2, 3"); | ||
index.show_notify_dialog("Problem List錯誤,請輸入數字、逗號與空白設定,範例:1, 2, 3", index.DIALOG_TYPE.warning); | ||
return; | ||
} | ||
|
||
if (re.test(acct_list)) { | ||
alert("Account List錯誤,請輸入數字、逗號與空白設定,範例:1, 2, 3"); | ||
index.show_notify_dialog("Account List錯誤,請輸入數字、逗號與空白設定,範例:1, 2, 3", index.DIALOG_TYPE.warning); | ||
return; | ||
} | ||
|
||
$.post('/oj/be/manage/board/add', { | ||
reqtype: 'add', | ||
name: name, | ||
status: status, | ||
start: start, | ||
end: end, | ||
start: start_time.toISOString(), | ||
end: end_time.toISOString(), | ||
pro_list: pro_list, | ||
acct_list: acct_list, | ||
}, function(res) { | ||
if (res[0] == 'E') { | ||
|
||
} else { | ||
index.go("/oj/manage/board/") | ||
index.go("/oj/manage/board/"); | ||
} | ||
}); | ||
}); | ||
|
@@ -76,11 +105,21 @@ | |
</div> | ||
|
||
<div class="mb-1"> | ||
<label for="#start" class="form-label">Start</label> | ||
<input type="text" class="form-control" id="start" placeholder="[Year / Month / Day Hour : Minute]"> | ||
<label for="#datepickerStartInput" class="form-label">Start Time</label> | ||
<div id="datepickerStart" class="input-group"> | ||
<input id="datepickerStartInput" type="text" class="form-control"> | ||
<span class="input-group-text" data-td-target="#datepickerStart" data-td-toggle="datepickerStart"> | ||
<svg class="svg-inline--fa fa-calendar" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="calendar" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"></path></svg><!-- <span class="fa-solid fa-calendar"></span> Font Awesome fontawesome.com --> | ||
</span> | ||
</div> | ||
|
||
<label for="#end" class="form-label">End</label> | ||
<input type="text" class="form-control" id="end" placeholder="[Year / Month / Day Hour : Minute]"> | ||
<label for="#datepickerEnd" class="form-label">End Time</label> | ||
<div id="datepickerEnd" class="input-group"> | ||
<input id="datepickerEndInput" type="text" class="form-control"> | ||
<span class="input-group-text" data-td-target="#datepickerEnd" data-td-toggle="datepickerEnd"> | ||
<svg class="svg-inline--fa fa-calendar" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="calendar" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"></path></svg><!-- <span class="fa-solid fa-calendar"></span> Font Awesome fontawesome.com --> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="mb-1"> | ||
|
Oops, something went wrong.