unclean SPARC
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<style>
|
||||
.support-issue-form {
|
||||
min-width: 50vw;
|
||||
min-height: 50vh;
|
||||
}
|
||||
.support-issue-form [name="body"] {
|
||||
min-height: 180px;
|
||||
}
|
||||
</style>
|
||||
<div class="support-issue-form">
|
||||
<label xsmall>Subject</label>
|
||||
<input eicinput type="text" name="title" data-path="" value="" class="required" placeholder="Please describe shortly your issue" />
|
||||
<label xsmall>Type of inquiry</label>
|
||||
<select eicselect name="typeofissue" tabindex="" data-path="" class="required" placeholder="Please select a category">
|
||||
<option value=""></option>
|
||||
<option value="question">I have a general question</option>
|
||||
<option value="accessRequest">I cannot connect to the platform</option>
|
||||
<option value="bug">I am facing a technical issue</option>
|
||||
</select>
|
||||
<label xsmall>Description</label>
|
||||
<textarea eictextarea name="body" data-path="article" class="required" placeholder="Please provide as many information as possible"></textarea>
|
||||
<select eicselect multiple editable name="attachments" data-type="ignore" placeholder="Click here to add a file" hint="You may not attach more than 5Mb of files"></select>
|
||||
</div>
|
||||
@@ -0,0 +1,61 @@
|
||||
class SupportIssueFormDialog extends EICDialogContent {
|
||||
|
||||
actions = [
|
||||
{
|
||||
label: 'Cancel',
|
||||
onclick: this.cancel.bind(this),
|
||||
severity: 'secondary',
|
||||
role: 'cancel'
|
||||
},
|
||||
{
|
||||
label: 'Send',
|
||||
onclick: this.send.bind(this),
|
||||
severity: 'primary',
|
||||
role: 'send',
|
||||
disabled: false
|
||||
}
|
||||
]
|
||||
|
||||
DOMContentLoaded(options) {
|
||||
|
||||
this.mode = options.mode || 'create';
|
||||
this.ticketId = options.ticketId || 0;
|
||||
|
||||
for(let model in options.models) this[model] = options.models[model];
|
||||
|
||||
this.components = ui.eicfy(this.el)
|
||||
this.form = new Form(this.el);
|
||||
this.attachments = this.components.find(item => item.el.name == 'attachments')
|
||||
this.attachments.activeEditor = BinaryFileContentSelector;
|
||||
}
|
||||
|
||||
send() {
|
||||
|
||||
if(this.form.validate()) {
|
||||
let payload = this.form.value;
|
||||
payload.article.attachments = this.attachments.selectedItems.map(item => { return { filename: item.label, "mime-type": item.type, data: item.content} })
|
||||
|
||||
let size = JSON.stringify(payload).length
|
||||
let limit = 1024 * 1024 * 5;
|
||||
|
||||
if(size < limit) {
|
||||
|
||||
this.tickets.create(payload)
|
||||
.then( this.success.bind(this));
|
||||
|
||||
} else {
|
||||
ui.growl.append('Your message is exceeding the allowed 5Mb size limit. Please consider removing files or reduce file size', 'danger')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success(payload) {
|
||||
|
||||
this.commit(payload)
|
||||
|
||||
ui.growl.append(`We'll do our best to respond to your message promptly.</br>
|
||||
Thank you for your interest and feedback, we look forward to help you out!`, 'success')
|
||||
}
|
||||
}
|
||||
|
||||
app.registerClass('SupportIssueFormDialog',SupportIssueFormDialog);
|
||||
Reference in New Issue
Block a user