Added lazy loading to intern updates
This commit is contained in:
parent
9d9d6b5373
commit
c321106d6f
@ -3548,8 +3548,20 @@ customElements.define('sm-select', class extends HTMLElement {
|
|||||||
this.setAttribute('value', val)
|
this.setAttribute('value', val)
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset(fire = true) {
|
||||||
|
if (this.availableOptions[0]) {
|
||||||
|
const firstElement = this.availableOptions[0];
|
||||||
|
if (this.previousOption) {
|
||||||
|
this.previousOption.classList.remove('check-selected')
|
||||||
|
}
|
||||||
|
firstElement.classList.add('check-selected')
|
||||||
|
this.value = firstElement.getAttribute('value')
|
||||||
|
this.selectedOptionText.textContent = firstElement.textContent
|
||||||
|
this.previousOption = firstElement;
|
||||||
|
if (fire) {
|
||||||
|
this.fireEvent()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
@ -3657,16 +3669,7 @@ customElements.define('sm-select', class extends HTMLElement {
|
|||||||
let slot = this.shadowRoot.querySelector('slot')
|
let slot = this.shadowRoot.querySelector('slot')
|
||||||
slot.addEventListener('slotchange', e => {
|
slot.addEventListener('slotchange', e => {
|
||||||
this.availableOptions = slot.assignedElements()
|
this.availableOptions = slot.assignedElements()
|
||||||
if (this.availableOptions[0]) {
|
this.reset(false)
|
||||||
let firstElement = this.availableOptions[0];
|
|
||||||
this.previousOption = firstElement;
|
|
||||||
firstElement.classList.add('check-selected')
|
|
||||||
this.value = firstElement.getAttribute('value')
|
|
||||||
this.selectedOptionText.textContent = firstElement.textContent
|
|
||||||
this.availableOptions.forEach((element) => {
|
|
||||||
element.setAttribute('tabindex', "0");
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.addEventListener('click', this.handleClick)
|
this.addEventListener('click', this.handleClick)
|
||||||
this.addEventListener('keydown', this.handleKeydown)
|
this.addEventListener('keydown', this.handleKeydown)
|
||||||
@ -3704,13 +3707,13 @@ smOption.innerHTML = `
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.option{
|
.option{
|
||||||
display: -webkit-box;
|
display: grid;
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
-ms-flex-align: center;
|
-ms-flex-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
|
gap: 0.5rem;
|
||||||
|
grid-template-columns: max-content minmax(0, 1fr);
|
||||||
padding: 0.8rem 1.2rem;
|
padding: 0.8rem 1.2rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
@ -3725,7 +3728,6 @@ smOption.innerHTML = `
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
height: 1.2rem;
|
height: 1.2rem;
|
||||||
width: 1.2rem;
|
width: 1.2rem;
|
||||||
margin-right: 0.5rem;
|
|
||||||
fill: rgba(var(--text-color), 0.8);
|
fill: rgba(var(--text-color), 0.8);
|
||||||
}
|
}
|
||||||
:host(:focus) .option .icon{
|
:host(:focus) .option .icon{
|
||||||
@ -3757,5 +3759,6 @@ customElements.define('sm-option', class extends HTMLElement {
|
|||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this.setAttribute('role', 'option')
|
this.setAttribute('role', 'option')
|
||||||
|
this.setAttribute('tabindex', '0')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
75
css/main.css
75
css/main.css
@ -645,45 +645,27 @@ ul {
|
|||||||
margin-left: 0.2rem;
|
margin-left: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
position: relative;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.request-card {
|
.request-card {
|
||||||
display: flex;
|
display: grid;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
align-items: left;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-bottom: 1px solid rgba(var(--text-color), 0.1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-card p {
|
|
||||||
margin-top: 0;
|
|
||||||
width: 100%;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.request-card b {
|
.request-card b {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
.request-card sm-button {
|
||||||
.request-card button {
|
--padding: 0.5rem 0.8rem;
|
||||||
padding: 0.2rem 0.6rem 0.2rem 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-card button:first-of-type {
|
.request-card__description {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reject-app {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
margin-right: 0.5rem;
|
||||||
|
|
||||||
.request-card:last-of-type {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#intern_updates .container-header {
|
#intern_updates .container-header {
|
||||||
@ -707,13 +689,6 @@ ul {
|
|||||||
border-bottom: 0.2rem solid var(--accent-color);
|
border-bottom: 0.2rem solid var(--accent-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#requests_container {
|
|
||||||
display: flex;
|
|
||||||
max-height: 80vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
#updates_page sm-select {
|
#updates_page sm-select {
|
||||||
--max-height: 50vh;
|
--max-height: 50vh;
|
||||||
}
|
}
|
||||||
@ -737,6 +712,7 @@ ul {
|
|||||||
.update__topic {
|
.update__topic {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -978,13 +954,6 @@ ul {
|
|||||||
display: inline-flexbox;
|
display: inline-flexbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
.appear-on-scroll-up {
|
|
||||||
position: fixed !important;
|
|
||||||
top: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 4rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#loading_page {
|
#loading_page {
|
||||||
display: grid;
|
display: grid;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -1062,17 +1031,8 @@ ul {
|
|||||||
border: 1px solid rgba(var(--text-color), 0.06);
|
border: 1px solid rgba(var(--text-color), 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.center {
|
|
||||||
position: relative;
|
|
||||||
display: grid;
|
|
||||||
place-content: center;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#show_all,
|
|
||||||
#project_explorer {
|
#project_explorer {
|
||||||
margin: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#admin_page {
|
#admin_page {
|
||||||
@ -1189,6 +1149,14 @@ ul {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
#admin_page__left .empty-state {
|
||||||
|
padding: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#update_filters_wrapper {
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 640px) {
|
@media only screen and (min-width: 640px) {
|
||||||
.hide-on-desktop {
|
.hide-on-desktop {
|
||||||
@ -1321,7 +1289,6 @@ ul {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#update_filters_wrapper {
|
#update_filters_wrapper {
|
||||||
gap: 1.5rem;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
align-content: flex-start;
|
align-content: flex-start;
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -666,46 +666,28 @@ ul {
|
|||||||
margin-left: 0.2rem;
|
margin-left: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
position: relative;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.request-card {
|
.request-card {
|
||||||
display: flex;
|
display: grid;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
align-items: left;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-bottom: 1px solid rgba(var(--text-color), 0.1);
|
b {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
sm-button{
|
||||||
|
--padding: 0.5rem 0.8rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-card p {
|
.request-card__description{
|
||||||
margin-top: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
.reject-app{
|
||||||
.request-card b {
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.request-card button {
|
|
||||||
padding: 0.2rem 0.6rem 0.2rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.request-card button:first-of-type {
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-card:last-of-type {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#intern_updates{
|
#intern_updates{
|
||||||
.container-header {
|
.container-header {
|
||||||
@ -730,13 +712,6 @@ ul {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#requests_container {
|
|
||||||
display: flex;
|
|
||||||
max-height: 80vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
#updates_page{
|
#updates_page{
|
||||||
sm-select{
|
sm-select{
|
||||||
--max-height: 50vh;
|
--max-height: 50vh;
|
||||||
@ -763,6 +738,7 @@ ul {
|
|||||||
.update__topic {
|
.update__topic {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,13 +986,6 @@ ul {
|
|||||||
display: inline-flexbox;
|
display: inline-flexbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
.appear-on-scroll-up {
|
|
||||||
position: fixed !important;
|
|
||||||
top: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 4rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#loading_page {
|
#loading_page {
|
||||||
display: grid;
|
display: grid;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -1094,17 +1063,8 @@ ul {
|
|||||||
border: 1px solid rgba(var(--text-color), 0.06);
|
border: 1px solid rgba(var(--text-color), 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.center {
|
|
||||||
position: relative;
|
|
||||||
display: grid;
|
|
||||||
place-content: center;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#show_all,
|
|
||||||
#project_explorer {
|
#project_explorer {
|
||||||
margin: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#admin_page {
|
#admin_page {
|
||||||
@ -1225,6 +1185,13 @@ ul {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
.empty-state{
|
||||||
|
padding: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#update_filters_wrapper{
|
||||||
|
gap: 1.5rem;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -1365,7 +1332,6 @@ ul {
|
|||||||
grid-template-columns: minmax(0, 1fr) 20rem;
|
grid-template-columns: minmax(0, 1fr) 20rem;
|
||||||
}
|
}
|
||||||
#update_filters_wrapper{
|
#update_filters_wrapper{
|
||||||
gap: 1.5rem;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
align-content: flex-start;
|
align-content: flex-start;
|
||||||
|
|||||||
182
new.html
182
new.html
@ -202,10 +202,6 @@
|
|||||||
Sign out
|
Sign out
|
||||||
</sm-button>
|
</sm-button>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
|
||||||
<h3>About</h3>
|
|
||||||
<h5>Version 8.2.5</h5>
|
|
||||||
</section>
|
|
||||||
</section>
|
</section>
|
||||||
<section id="admin_page" class="page hide-completely">
|
<section id="admin_page" class="page hide-completely">
|
||||||
<header id="admin_page__header">
|
<header id="admin_page__header">
|
||||||
@ -249,7 +245,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="interns" class="list-container"></div>
|
<div id="interns" class="list-container"></div>
|
||||||
</section>
|
</section>
|
||||||
<div id="requests_container" class="list-container"></div>
|
<section>
|
||||||
|
<ul id="requests_list" class="list-container observe-empty-state"></ul>
|
||||||
|
<h4 class="empty-state">No pending requests</h4>
|
||||||
|
</section>
|
||||||
</sm-tab-panels>
|
</sm-tab-panels>
|
||||||
</section>
|
</section>
|
||||||
<div id="project_editing_panel" class="inner-page container-card">
|
<div id="project_editing_panel" class="inner-page container-card">
|
||||||
@ -311,6 +310,7 @@
|
|||||||
<h5 class="uppercase">By Intern</h5>
|
<h5 class="uppercase">By Intern</h5>
|
||||||
<sm-select id="updates_page__intern_selector"></sm-select>
|
<sm-select id="updates_page__intern_selector"></sm-select>
|
||||||
</div>
|
</div>
|
||||||
|
<sm-button onclick="clearFilter()">Clear</sm-button>
|
||||||
</section>
|
</section>
|
||||||
<section id="updates_wrapper">
|
<section id="updates_wrapper">
|
||||||
<ul id="all_updates_list" class="grid gap-1 observe-empty-state"></ul>
|
<ul id="all_updates_list" class="grid gap-1 observe-empty-state"></ul>
|
||||||
@ -10305,7 +10305,7 @@
|
|||||||
textContent: projectName
|
textContent: projectName
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
taskCard: function (currentProject, currentBranch, taskNo) {
|
taskCard(currentProject, currentBranch, taskNo) {
|
||||||
const card = getRef('timeline_task_card').content.cloneNode(true),
|
const card = getRef('timeline_task_card').content.cloneNode(true),
|
||||||
assignedInterns = RIBC.getAssignedInterns(currentProject, currentBranch, taskNo),
|
assignedInterns = RIBC.getAssignedInterns(currentProject, currentBranch, taskNo),
|
||||||
frag = document.createDocumentFragment();
|
frag = document.createDocumentFragment();
|
||||||
@ -10430,27 +10430,31 @@
|
|||||||
mapItems.push(card, card.id, branchContainer.id, mapBody.id)
|
mapItems.push(card, card.id, branchContainer.id, mapBody.id)
|
||||||
return mapItems;
|
return mapItems;
|
||||||
},
|
},
|
||||||
requestCard: function (floId, projectCode, branch, taskNo) {
|
requestCard(floId, projectCode, branch, taskNo) {
|
||||||
let card = document.createElement('div'), name;
|
let name;
|
||||||
card.classList.add('request-card')
|
|
||||||
name = floId;
|
name = floId;
|
||||||
if (getInternDetails(floId).length !== 0)
|
if (getInternDetails(floId).length !== 0)
|
||||||
name = getInternDetails(floId)[0].split(':')[1];
|
name = getInternDetails(floId)[0].split(':')[1];
|
||||||
card.innerHTML = `<p>
|
return createElement('li', {
|
||||||
<b class="capitalize">${name}</b> applied for
|
className: 'request-card',
|
||||||
<b class="capitalize">${RIBC.getTaskDetails(projectCode, branch, taskNo).taskTitle}</b> from
|
innerHTML: `<p class="request-card__description">
|
||||||
<b class="capitalize">${branch}</b> of
|
<b class="capitalize">${name}</b> applied for
|
||||||
<b class="capitalize">${RIBC.getProjectDetails(projectCode).projectName}</b>
|
<b class="capitalize">${RIBC.getTaskDetails(projectCode, branch, taskNo).taskTitle}</b> from
|
||||||
</p>
|
<b class="capitalize">${branch}</b> of
|
||||||
<button class="hover reject-app">
|
<b class="capitalize">${RIBC.getProjectDetails(projectCode).projectName}</b>
|
||||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></svg>
|
</p>
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<sm-button class="reject-app">
|
||||||
|
<svg class="icon button__icon--left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></svg>
|
||||||
Reject
|
Reject
|
||||||
</button>
|
</sm-button>
|
||||||
<button class="hover accept-app" data-flo-id="${floId}" data-project-code="${projectCode}" data-branch="${branch}" data-task-no="${taskNo}">
|
<sm-button class="accept-app button__icon--left" data-flo-id="${floId}" data-project-code="${projectCode}" data-branch="${branch}" data-task-no="${taskNo}">
|
||||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z"/></svg>
|
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z"/></svg>
|
||||||
Accept
|
Accept
|
||||||
</button>`;
|
</sm-button>
|
||||||
return card;
|
</div>
|
||||||
|
`
|
||||||
|
})
|
||||||
},
|
},
|
||||||
internTaskCard(taskObj) {
|
internTaskCard(taskObj) {
|
||||||
const { uniqueId, projectId, projectName, projectBranch, task } = taskObj
|
const { uniqueId, projectId, projectName, projectBranch, task } = taskObj
|
||||||
@ -10499,7 +10503,7 @@
|
|||||||
return internInfo;
|
return internInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
let i = currentProgress = projectIndex = 0, prevProject = '', allInternsList = [], newInternList = [], lastState,
|
let i = 0, allInternsList = [], newInternList = [],
|
||||||
frag = document.createDocumentFragment(), watchList = [], currentIntern, dashboardProject, currentTaskId,
|
frag = document.createDocumentFragment(), watchList = [], currentIntern, dashboardProject, currentTaskId,
|
||||||
typeOfUser = 'general';
|
typeOfUser = 'general';
|
||||||
|
|
||||||
@ -10508,14 +10512,14 @@
|
|||||||
let internName = getRef('intern_name_field').value.trim(),
|
let internName = getRef('intern_name_field').value.trim(),
|
||||||
internFLOID = getRef('intern_flo_id_field').value.trim();
|
internFLOID = getRef('intern_flo_id_field').value.trim();
|
||||||
if (RIBC.manage.addIntern(internFLOID, internName)) {
|
if (RIBC.manage.addIntern(internFLOID, internName)) {
|
||||||
document.getElementById('interns').append(render.internCard(internName, internFLOID, '1', 'interns'))
|
getRef('interns').append(render.internCard(internName, internFLOID, '1', 'interns'))
|
||||||
hidePopup();
|
hidePopup();
|
||||||
notify(`${internName} added as an intern.`, 'success')
|
notify(`${internName} added as an intern.`, 'success')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function addProjectToList() {
|
function addProjectToList() {
|
||||||
let projectName = document.getElementById('project_name_field').value.trim(),
|
let projectName = getRef('project_name_field').value.trim(),
|
||||||
projectDescription = document.getElementById('project_description_field').value.trim();
|
projectDescription = getRef('project_description_field').value.trim();
|
||||||
if (!projectName) {
|
if (!projectName) {
|
||||||
notify('Project name is important!', 'error')
|
notify('Project name is important!', 'error')
|
||||||
return
|
return
|
||||||
@ -10811,24 +10815,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderInternUpdates(updates) {
|
|
||||||
getRef('all_updates_list').innerHTML = ``;
|
|
||||||
if(!updates){
|
|
||||||
updates = RIBC.getInternUpdates();
|
|
||||||
}
|
|
||||||
updates.forEach((entry) => {
|
|
||||||
const { floID, time, update: { topic, description } } = entry
|
|
||||||
const updateObj = {
|
|
||||||
internName: getInternDetails(floID)[0].split(':')[1],
|
|
||||||
time: parseInt(time),
|
|
||||||
topic,
|
|
||||||
description
|
|
||||||
}
|
|
||||||
frag.append(render.updateCard(updateObj))
|
|
||||||
})
|
|
||||||
getRef('all_updates_list').append(frag)
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderProjectSelectorOptions() {
|
function renderProjectSelectorOptions() {
|
||||||
// Render All the projects inside updates page
|
// Render All the projects inside updates page
|
||||||
getRef('updates_page__project_selector').innerHTML = ``;
|
getRef('updates_page__project_selector').innerHTML = ``;
|
||||||
@ -10889,28 +10875,77 @@
|
|||||||
return fuse.search(floId).map(v => v.item)
|
return fuse.search(floId).map(v => v.item)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function renderCorrectUpdates() {
|
let updateStartIndex = 0
|
||||||
|
let updateEndIndex = 0
|
||||||
|
const intersectionObserver = new IntersectionObserver((entries, observer) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if(entry.isIntersecting){
|
||||||
|
observer.disconnect()
|
||||||
|
renderFilteredUpdates({lazyLoad: true})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},{
|
||||||
|
threshold: 0.3
|
||||||
|
})
|
||||||
|
function renderInternUpdates(options = {}) {
|
||||||
|
let {updates, lazyLoad = false} = options
|
||||||
|
if(!updates){
|
||||||
|
updates = RIBC.getInternUpdates();
|
||||||
|
}
|
||||||
|
if(lazyLoad){
|
||||||
|
updateStartIndex = updateEndIndex
|
||||||
|
updateEndIndex = updates.length > updateEndIndex + 10 ? updateEndIndex + 10 : updates.length
|
||||||
|
}else{
|
||||||
|
intersectionObserver.disconnect()
|
||||||
|
getRef('all_updates_list').innerHTML = ``;
|
||||||
|
updateStartIndex = 0
|
||||||
|
updateEndIndex = updates.length > 10 ? 10 : updates.length
|
||||||
|
}
|
||||||
|
for (let index = updateStartIndex; index < updateEndIndex; index++) {
|
||||||
|
const element = updates[index];
|
||||||
|
const { floID, time, update: { topic, description } } = element
|
||||||
|
const updateObj = {
|
||||||
|
internName: getInternDetails(floID)[0].split(':')[1],
|
||||||
|
time: parseInt(time),
|
||||||
|
topic,
|
||||||
|
description
|
||||||
|
}
|
||||||
|
frag.append(render.updateCard(updateObj))
|
||||||
|
}
|
||||||
|
getRef('all_updates_list').append(frag)
|
||||||
|
if(getRef('all_updates_list').lastElementChild){
|
||||||
|
intersectionObserver.observe(getRef('all_updates_list').lastElementChild)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function renderFilteredUpdates(options = {}) {
|
||||||
|
const {lazyLoad = false} = options
|
||||||
const selectedProject = getRef('updates_page__project_selector').value
|
const selectedProject = getRef('updates_page__project_selector').value
|
||||||
const selectedintern = getRef('updates_page__intern_selector').value
|
const selectedintern = getRef('updates_page__intern_selector').value
|
||||||
if(selectedProject === 'all' && selectedintern === 'all'){
|
if(selectedProject === 'all' && selectedintern === 'all'){
|
||||||
renderInternUpdates()
|
renderInternUpdates({lazyLoad})
|
||||||
}else if(selectedProject !== 'all' && selectedintern === 'all'){
|
}else if(selectedProject !== 'all' && selectedintern === 'all'){
|
||||||
const projectName = RIBC.getProjectDetails(selectedProject).projectName
|
const projectName = RIBC.getProjectDetails(selectedProject).projectName
|
||||||
const matchedUpdates = await getUpdatesByProject(projectName)
|
const matchedUpdates = await getUpdatesByProject(projectName)
|
||||||
renderInternUpdates(matchedUpdates)
|
renderInternUpdates({updates: matchedUpdates, lazyLoad})
|
||||||
}else if(selectedProject === 'all' && selectedintern !== 'all'){
|
}else if(selectedProject === 'all' && selectedintern !== 'all'){
|
||||||
const matchedUpdates = await getUpdatesByIntern(selectedintern)
|
const matchedUpdates = await getUpdatesByIntern(selectedintern)
|
||||||
renderInternUpdates(matchedUpdates)
|
renderInternUpdates({updates: matchedUpdates, lazyLoad})
|
||||||
}else{
|
}else{
|
||||||
const projectName = RIBC.getProjectDetails(selectedProject).projectName
|
const projectName = RIBC.getProjectDetails(selectedProject).projectName
|
||||||
let matchedUpdates = await getUpdatesByProject(projectName)
|
let matchedUpdates = await getUpdatesByProject(projectName)
|
||||||
matchedUpdates = await getUpdatesByIntern(selectedintern, matchedUpdates)
|
matchedUpdates = await getUpdatesByIntern(selectedintern, matchedUpdates)
|
||||||
renderInternUpdates(matchedUpdates)
|
renderInternUpdates({updates: matchedUpdates, lazyLoad})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getRef('updates_page__project_selector').addEventListener('change', renderCorrectUpdates)
|
function clearFilter(){
|
||||||
getRef('updates_page__intern_selector').addEventListener('change', renderCorrectUpdates)
|
getRef('updates_page__project_selector').reset()
|
||||||
|
getRef('updates_page__intern_selector').reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
getRef('updates_page__project_selector').addEventListener('change', renderFilteredUpdates)
|
||||||
|
getRef('updates_page__intern_selector').addEventListener('change', renderFilteredUpdates)
|
||||||
|
|
||||||
|
|
||||||
function watchThisProject(thisBtn) {
|
function watchThisProject(thisBtn) {
|
||||||
@ -11146,43 +11181,48 @@
|
|||||||
// admin view
|
// admin view
|
||||||
if (floGlobals.subAdmins.includes(myFloID)) {
|
if (floGlobals.subAdmins.includes(myFloID)) {
|
||||||
typeOfUser = 'admin'
|
typeOfUser = 'admin'
|
||||||
|
getRef('requests_list').innerHTML = ''
|
||||||
RIBC.manage.getTaskRequests().forEach((app) => {
|
RIBC.manage.getTaskRequests().forEach((app) => {
|
||||||
try {
|
try {
|
||||||
if (!Array.isArray(RIBC.getAssignedInterns(app.projectCode, app.branch, app.task)) && typeof RIBC.getTaskDetails(app.projectCode, app.branch, app.task) !== 'undefined')
|
if (!Array.isArray(RIBC.getAssignedInterns(app.projectCode, app.branch, app.task)) && typeof RIBC.getTaskDetails(app.projectCode, app.branch, app.task) !== 'undefined')
|
||||||
frag.appendChild(render.requestCard(app.floID, app.projectCode, app.branch, app.task))
|
frag.append(render.requestCard(app.floID, app.projectCode, app.branch, app.task))
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getRef('requests_container').appendChild(frag)
|
getRef('requests_list').append(frag)
|
||||||
if (getRef('requests_container').children.length === 0)
|
getRef('requests_list').addEventListener('click', (e) => {
|
||||||
getRef('requests_container').innerHTML = '<h4 class="padding">Nothing to see here.</h4>'
|
function removeRequest(requestCard){
|
||||||
getRef('requests_container').addEventListener('click', (e) => {
|
requestCard.animate([
|
||||||
|
{
|
||||||
|
transform: 'translateX(0)',
|
||||||
|
opacity: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
transform: 'translateX(-100%)',
|
||||||
|
opacity: 0
|
||||||
|
},
|
||||||
|
], {
|
||||||
|
duration: 300,
|
||||||
|
easing: 'ease'
|
||||||
|
}).onfinish = () => {
|
||||||
|
requestCard.remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
if (e.target.closest('.accept-app')) {
|
if (e.target.closest('.accept-app')) {
|
||||||
let btn = e.target.closest('.accept-app'),
|
let btn = e.target.closest('.accept-app'),
|
||||||
parent = e.target.closest('.request-card');
|
requestCard = e.target.closest('.request-card');
|
||||||
if (RIBC.manage.assignInternToTask(btn.dataset.floId, btn.dataset.projectCode, btn.dataset.branch, btn.dataset.taskNo)) {
|
if (RIBC.manage.assignInternToTask(btn.dataset.floId, btn.dataset.projectCode, btn.dataset.branch, btn.dataset.taskNo)) {
|
||||||
notify('Intern assinged.', 'success')
|
notify('Intern assinged.', 'success')
|
||||||
parent.classList.add('slide-left')
|
removeRequest(requestCard)
|
||||||
setTimeout(() => {
|
|
||||||
parent.remove()
|
|
||||||
}, 600)
|
|
||||||
if (getRef('requests_container').children.length === 0)
|
|
||||||
getRef('requests_container').innerHTML = '<h4 class="padding">Nothing to see here.</h4>'
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
notify('Intern already assinged.', 'error')
|
notify('Intern already assinged.', 'error')
|
||||||
}
|
}
|
||||||
}
|
}else if (e.target.closest('.reject-app')) {
|
||||||
if (e.target.closest('.reject-app')) {
|
let requestCard = e.target.closest('.request-card');
|
||||||
let parent = e.target.closest('.request-card');
|
removeRequest(requestCard)
|
||||||
parent.classList.add('slide-left')
|
|
||||||
setTimeout(() => {
|
|
||||||
parent.remove()
|
|
||||||
}, 400)
|
|
||||||
if (getRef('requests_container').children.length === 0)
|
|
||||||
getRef('requests_container').innerHTML = '<h4 class="padding">Nothing to see here.</h4>'
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user