Skip to content

Commit

Permalink
Dev to Main sync (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
prakashchoudhary07 authored Oct 25, 2023
1 parent ccd6302 commit 046c2d1
Show file tree
Hide file tree
Showing 10 changed files with 913 additions and 11 deletions.
21 changes: 15 additions & 6 deletions app/components/task/holder.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@
<div class='task-card__status-update-container'>

{{#if this.extensionFormOpened}}
<Task::ExtensionForm
@task={{@task}}
@closeForm={{this.closeExtensionForm}}
@title='Form for extension Request'
@closeModel={{this.closeExtensionModel}}
/>
{{#if @dev}}
<Task::MultipleExtensionForm
@task={{@task}}
@closeForm={{this.closeExtensionForm}}
@title='Extension Details'
@closeModel={{this.closeExtensionModel}}
/>
{{else}}
<Task::ExtensionForm
@task={{@task}}
@closeForm={{this.closeExtensionForm}}
@title='Form for extension Request'
@closeModel={{this.closeExtensionModel}}
/>
{{/if}}
{{/if}}

{{#if (not-eq this.status this.TASK_KEYS.VERIFIED)}}
Expand Down
1 change: 1 addition & 0 deletions app/components/task/holder.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class TasksHolderComponent extends Component {
@tracked status = this.args.task.status;
@tracked extensionFormOpened = false;
@tracked isLoading = false;
queryParams = ['dev'];

TASK_KEYS = TASK_KEYS;
availabletaskStatusList = TASK_STATUS_LIST;
Expand Down
35 changes: 35 additions & 0 deletions app/components/task/latest-extension-info.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class='latest-extension-info__content' data-test-extension-info-content>
<table class="latest-table">
<tbody class="latest-table">
<tr>
<th>Request : </th>
<td>{{#if (eq this.extension.requestNumber undefined)}}
#1
{{else}}
#{{this.extension.requestNumber}}
{{/if}}
</td>
</tr>
<tr>
<th >Reason : </th>
<td>{{this.extension.reason}}</td>
</tr>
<tr>
<th>Title : </th>
<td>{{this.extension.title}}</td>
</tr>
<tr>
<th>Old Ends On : </th>
<td>{{this.oldEndsOn}}</td>
</tr>
<tr>
<th>New Ends On : </th>
<td>{{this.newEndsOn}}</td>
</tr>
<tr>
<th>Status : </th>
<td>{{this.extension.status}}</td>
</tr>
</tbody>
</table>
</div>
11 changes: 11 additions & 0 deletions app/components/task/latest-extension-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Component from '@glimmer/component';

export default class LatestExtensionInfoComponent extends Component {
extension = this.args.extension;
newEndsOn = this.localTime(this.extension.newEndsOn);
oldEndsOn = this.localTime(this.extension.oldEndsOn);

localTime(time) {
return new Date(time * 1000).toLocaleString();
}
}
143 changes: 143 additions & 0 deletions app/components/task/multiple-extension-form.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<div class='extension-form__container-parent'>
<div
role='button'
id='create'
class='extension-form__container-back'
data-test-extension-form-container-back
{{on 'click' @closeModel}}
></div>
<div class='extension-form__container-main'>
<h2 data-test-title>
{{#if this.createExtensionRequest}}
Extension Request Form
{{else}}
Extension Details
{{/if}}
</h2>
{{#if this.createExtensionRequest}}
<div class='extension-form__content' data-test-extension-from-content>
<form {{on 'submit' this.submitExtensionRequest}}>
<label for='reason'>Reason</label>
<textarea
required
type='text-box'
id='reason'
name='reason'
data-test-extension-form-reason-input
></textarea>
<p>Old ETA - {{this.oldETA}}</p>
<label for='newEndsOn'>New ETA</label>
<input
required
type='datetime-local'
id='newEndsOn'
name='newEndsOn'
{{on 'change' this.changeExtensionRequestETA}}
data-test-extension-form-newEndsOn-input
/>
<label for='title'>Title</label>
<textarea
required
type='text-box'
id='title'
name='title'
data-test-extension-form-title-input
></textarea>
<div class='error-container' id='error'>
<span
class='error-placeholder'
data-test-extension-from-error
></span>
</div>
<div class='buttons' id='form'>
<button
class='multiple-extension-form__container-close'
data-test-extension-form-container-close
type='button'
{{on 'click' @closeForm}}
>
Cancel
</button>

<button
class='multiple-extension-form__create-button primary-button-style'
disabled={{this.isSubmitButtonDisabled}}
type='submit'
>Submit</button>
</div>
</form>
</div>
{{else}}
<div class='extension-form__content' data-test-extension-from-content>
{{#if this.extensionData.value}}
<div class='extension-form__content-wrapper'>
{{#each this.extensionData.value as |extension|}}
<Task::LatestExtensionInfo @extension={{extension}} />
{{#if extension.reviewedBy}}
<p data-reviewed-log>Your request was
{{#if
(eq extension.status 'APPROVED')
}}approved{{else}}denied{{/if}}
by
{{extension.reviewedBy}}
{{convertDate (array extension.timestamp) end_date=0}}.
</p>
{{/if}}
{{/each}}
</div>

<div class='buttons' id='detail'>
<button
class='multiple-extension-form__container-close'
data-test-extension-form-container-close
type='button'
{{on 'click' @closeForm}}
>
Close
</button>

{{#if
(or
(eq this.previousExtensionStatus 'APPROVED')
(eq this.previousExtensionStatus 'DENIED')
)
}}
<button
class='multiple-extension-form__open-button primary-button-style'
data-test-create-another-extension
type='button'
{{on 'click' this.createNewExtensionRequest}}
>
Request Extension
</button>
{{/if}}
</div>
{{else if this.extensionData.isLoading}}
<div class='task-card__loader-container'>
<Spinner />
</div>
{{else if this.extensionData.error}}
<h4>{{this.extensionData.error}}</h4>
<div class='buttons' id='create'>
<button
class='multiple-extension-form__container-close'
data-test-extension-form-container-close
type='button'
{{on 'click' @closeForm}}
>
Close
</button>
<button
class='multiple-extension-form__open-button primary-button-style'
data-test-create-extension-button
type='button'
{{on 'click' this.createNewExtensionRequest}}
>
Request Extension
</button>
</div>
{{/if}}
</div>
{{/if}}
</div>
</div>
Loading

0 comments on commit 046c2d1

Please sign in to comment.