浏览代码

appointment table added share link

Liontix 1 年之前
父节点
当前提交
1a5dc46fd0
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 3 0
      public/html/appointments.html
  2. 8 1
      public/javascripts/appointments.js

+ 3 - 0
public/html/appointments.html

@@ -18,6 +18,7 @@
             <th>Due Date</th>
             <th>Place</th>
             <th>Time Span</th>
+            <th>Share</th>
             <th>Participants</th>
             <th>Edit</th>
             <th>Delete</th>
@@ -27,6 +28,8 @@
         <!-- Data will be inserted here via JavaScript -->
         </tbody>
     </table>
+    <!-- TODO implement redirect -->
+    <button id="add-appointment">Add Appointment</button>
 </div>
 </body>
 </html>

+ 8 - 1
public/javascripts/appointments.js

@@ -26,15 +26,19 @@ function renderAppointments(data) {
         const placeCell = document.createElement('td');
         const dueDateCell = document.createElement('td');
         const timeSpanCell = document.createElement('td');
+        const shareCell = document.createElement('td');
         const participantCell = document.createElement('td');
         const editCell = document.createElement('td');
         const deleteCell = document.createElement('td');
+        const shareATag = document.createElement('a');
         const participantATag = document.createElement('a');
         const editATag = document.createElement('a');
         const deleteButton = document.createElement('button');
         participantATag.href = `/html/bookings.html?appointment=${appointment._id}`;
         participantATag.innerText = 'participants';
-        editATag.href = `/html/appointscreator.html?appointment=${appointment._id}`;
+        editATag.href = `/html/appointmentscreator.html?appointment=${appointment._id}`;
+        shareATag.href = `/html/schedule.html?appointment=${appointment._id}`;
+        shareATag.innerText = 'share';
         editATag.innerText = 'edit';
         deleteButton.onclick = async () => {
             if (last_clicked !== appointment._id) {
@@ -46,6 +50,8 @@ function renderAppointments(data) {
             await deleteAppointment(appointment._id);
         }
         deleteButton.innerText = 'delete';
+
+        shareCell.appendChild(shareATag);
         participantCell.appendChild(participantATag);
         editCell.appendChild(editATag);
         deleteCell.appendChild(deleteButton);
@@ -64,6 +70,7 @@ function renderAppointments(data) {
         row.appendChild(dueDateCell);
         row.appendChild(placeCell);
         row.appendChild(timeSpanCell);
+        row.appendChild(shareCell);
         row.appendChild(participantCell);
         row.appendChild(editCell);
         row.appendChild(deleteCell);