unclean SPARC
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<style>
|
||||
.soe-feedback.form {
|
||||
min-width: 60vw;
|
||||
}
|
||||
.soe-feedback.form label {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<div class="soe-feedback form">
|
||||
|
||||
<div>
|
||||
<label xsmall>Funding source</label>
|
||||
<select eicselect name="fundingSource" data-path="" multiple class="required" placeholder="Please select funding source(s)">
|
||||
${app.meta.toOptions(app.meta.getCollection('soe-fundings'), null, true).map(o => o.outerHTML).join('')}
|
||||
</select>
|
||||
<input eicinput name="fundingSourceOther" data-path="" type="text" class="" value="" placeholder="please specify source" />
|
||||
</div>
|
||||
<div class="cols-3">
|
||||
<div>
|
||||
<label xsmall>Start date of financial support</label>
|
||||
<input eicinput name="cutoffDate" data-path="" type="date" value="" class="required" placeholder="" />
|
||||
</div>
|
||||
<div>
|
||||
<label xsmall>Funding amount</label>
|
||||
<input eicinput name="fundingAmount" data-path="" data-type="number" min="0" type="currency" value="" placeholder="Leave blank if no funding applies" />
|
||||
</div>
|
||||
<div>
|
||||
<label xsmall>Duration (in month) of the financial support</label>
|
||||
<input eicinput name="duration" data-path="" data-type="number" min="0" type="number" value="" class="required" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label xsmall>Additional Details</label>
|
||||
<ul bulleted xsmall>
|
||||
<li>Name and status of the support scheme/programme (e.g. open, closed, continuously open), overall call budget</li>
|
||||
<li>Co-funding rate (e.g. lower or the same as Horizon Europe)</li>
|
||||
<li>Use of GBER Article 25a (applicable state aid rules for projects awarded Seal of Excellence)</li>
|
||||
<li>Do you support the investment component of the project</li>
|
||||
</ul>
|
||||
<textarea eictextarea name="additionalDetails" data-path="" class="" placeholder="(optional)"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label xsmall>Is this SoE a success story?</label>
|
||||
<ul bulleted xsmall>
|
||||
<li>Do you consider the project to have a high innovative potential or technological impact</li>
|
||||
<li>Project attracts additional investments (e.g. private VC, winner of an innovation prize or other grant/subsidy)</li>
|
||||
</ul>
|
||||
<div class="cols-3">
|
||||
<select eicselect name="successStory" data-path="" class="required" data-type="boolean" placeholder="" >
|
||||
<option value=""></option>
|
||||
<option value="true">yes</option>
|
||||
<option value="false">no</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<textarea eictextarea name="successStoryDetails" data-path="" class="required" placeholder="Explain why"></textarea>
|
||||
</div>
|
||||
<div eicalert danger class="confirmation">
|
||||
<input eiccheckbox type="checkbox" name="confirmDelete" data-type="ignore" label="Yes, I want to remove this feedback" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,151 @@
|
||||
class SoeFeedbackFormDialog extends EICDialogContent {
|
||||
|
||||
actions = [
|
||||
{
|
||||
label: 'Cancel',
|
||||
onclick: this.cancel.bind(this),
|
||||
severity: 'secondary',
|
||||
role: 'cancel'
|
||||
},
|
||||
{
|
||||
label: 'Delete',
|
||||
onclick: this.delete.bind(this),
|
||||
severity: 'danger',
|
||||
role: 'delete',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
label: 'Send',
|
||||
onclick: this.send.bind(this),
|
||||
severity: 'primary',
|
||||
role: 'send',
|
||||
disabled: false
|
||||
}
|
||||
]
|
||||
|
||||
// meta item ID for 'Other source'
|
||||
ALT_SOURCE_ID = 'dTVTpQG-KRzej86IwE0v7TA';
|
||||
|
||||
constructor(options) { super(options); }
|
||||
|
||||
DOMContentLoaded(options) {
|
||||
|
||||
this.pic = options.pic;
|
||||
this.number = options.number;
|
||||
this.id = options.id;
|
||||
this.mode = options.mode || 'create';
|
||||
|
||||
for(let model in options.models) this[model] = options.models[model];
|
||||
|
||||
this.components = ui.eicfy(this.el);
|
||||
|
||||
this.source = this.components.find(o => o.el.name == 'fundingSource')
|
||||
this.source.el.addEventListener('change', this.onSourceChange.bind(this))
|
||||
this.sourceExtra = this.components.find(o => o.el.name == 'fundingSourceOther')
|
||||
ui.hide(this.sourceExtra.el)
|
||||
this.scheme = this.components.find(o => o.el.name == 'cutoffDate')
|
||||
this.amount = this.components.find(o => o.el.name == 'fundingAmount')
|
||||
this.details = this.components.find(o => o.el.name == 'additionalDetails')
|
||||
this.duration = this.components.find(o => o.el.name == 'duration')
|
||||
this.successStory = this.components.find(o => o.el.name == 'successStory')
|
||||
this.successStory.el.addEventListener('change', this.onSuccessStoryChange.bind(this))
|
||||
this.successStoryDetails = this.components.find(o => o.el.name == 'successStoryDetails')
|
||||
ui.hide(this.successStoryDetails.container)
|
||||
this.successStoryDetails.el.classList.remove('required')
|
||||
|
||||
this.confirmDelete = this.components.find(component => component.el.name == 'confirmDelete');
|
||||
this.confirmation = this.find('.confirmation');
|
||||
ui.hide(this.confirmation);
|
||||
|
||||
this.form = new Form(this.find('.soe-feedback.form'));
|
||||
}
|
||||
|
||||
DOMContentFocused() {
|
||||
|
||||
this.actions.find(o => o.role == 'delete').button.hide();
|
||||
|
||||
if(this.mode == 'edit') {
|
||||
this.fill(this.soe.getFeedback(this.id));
|
||||
} else {
|
||||
if(!this.soe.hasPrivilege('create')) {
|
||||
this.actions.find(o => o.role == 'send').button.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fill(feedback) {
|
||||
this.source.value = feedback.fundingSource
|
||||
this.sourceExtra.value = feedback.fundingSourceOther
|
||||
this.scheme.value = feedback.cutoffDate
|
||||
this.amount.value = feedback.fundingAmount
|
||||
this.details.value = feedback.additionalDetails
|
||||
this.duration.value = feedback.duration
|
||||
this.successStory.value = feedback.successStory
|
||||
this.successStoryDetails.value = feedback.successStoryDetails
|
||||
|
||||
if(this.soe.hasPrivilege('delete')) {
|
||||
this.actions.find(o => o.role == 'delete').button.show();
|
||||
}
|
||||
|
||||
if(!this.soe.hasPrivilege('update')) {
|
||||
this.actions.find(o => o.role == 'send').button.hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onSourceChange(event) {
|
||||
if(this.source.value.includes(this.ALT_SOURCE_ID)) {
|
||||
ui.show(this.sourceExtra.el)
|
||||
} else {
|
||||
this.sourceExtra.value = '';
|
||||
ui.hide(this.sourceExtra.el)
|
||||
}
|
||||
}
|
||||
|
||||
onSuccessStoryChange(event) {
|
||||
if(this.successStory.value == 'true') {
|
||||
ui.show(this.successStoryDetails.container)
|
||||
this.successStoryDetails.el.classList.add('required')
|
||||
} else {
|
||||
ui.hide(this.successStoryDetails.container)
|
||||
this.successStoryDetails.el.classList.remove('required')
|
||||
}
|
||||
}
|
||||
|
||||
send() {
|
||||
ui.hide(this.confirmation);
|
||||
|
||||
if(this.form.validate()) {
|
||||
switch(this.mode) {
|
||||
case 'create':
|
||||
this.actions.find(o => o.role == 'send').button.loading = true;
|
||||
this.actions.find(o => o.role == 'cancel').button.disabled = true;
|
||||
this.soe.create(this.pic, this.number, this.form.value)
|
||||
.then( payload => this.commit(true) )
|
||||
break;
|
||||
case 'edit':
|
||||
this.actions.find(o => o.role == 'send').button.loading = true;
|
||||
this.actions.find(o => o.role == 'delete').button.disabled = true;
|
||||
this.actions.find(o => o.role == 'cancel').button.disabled = true;
|
||||
this.soe.update(this.pic, this.number, this.id, this.form.value)
|
||||
.then( payload => this.commit(true) )
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
delete() {
|
||||
ui.show(this.confirmation);
|
||||
|
||||
if(this.confirmDelete.el.checked) {
|
||||
this.actions.find(o => o.role == 'send').button.disabled = true;
|
||||
this.actions.find(o => o.role == 'delete').button.loading = true;
|
||||
this.actions.find(o => o.role == 'cancel').button.disabled = true;
|
||||
this.soe.delete( this.pic, this.number, this.id )
|
||||
.then( payload => this.commit(true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.registerClass('SoeFeedbackFormDialog', SoeFeedbackFormDialog);
|
||||
@@ -0,0 +1,6 @@
|
||||
<style>
|
||||
.soe-feedback.history { min-width: 60vw; }
|
||||
</style>
|
||||
<div class="soe-feedback history">
|
||||
<div eicdatagrid></div>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
class SoeFeedbackHistoryDialog extends EICDialogContent {
|
||||
|
||||
actions = [
|
||||
{
|
||||
label: 'Cancel',
|
||||
onclick: this.cancel.bind(this),
|
||||
severity: 'secondary',
|
||||
role: 'cancel'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
constructor(options) { super(options); }
|
||||
|
||||
DOMContentLoaded(options) {
|
||||
|
||||
this.id = options.id;
|
||||
|
||||
for(let model in options.models) this[model] = options.models[model];
|
||||
|
||||
this.components = ui.eicfy(this.el);
|
||||
|
||||
console.log('', this.soe.getFeedback(this.id))
|
||||
let list = new DataGrid(this.find('[eicdatagrid]'), {
|
||||
headers: [
|
||||
{ label:'Date', type: 'dateTime'},
|
||||
{ label:'Action'},
|
||||
{ label:'User'},
|
||||
]
|
||||
})
|
||||
|
||||
for(let item of this.soe.getFeedback(this.id).statusHistory) {
|
||||
list.addRow(0, [
|
||||
item.dateTime,
|
||||
item.value,
|
||||
item.author
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fill() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.registerClass('SoeFeedbackHistoryDialog', SoeFeedbackHistoryDialog);
|
||||
Reference in New Issue
Block a user