-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from velrest/link-buildings
Link buildings
- Loading branch information
Showing
56 changed files
with
1,498 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<UkModal @visible={{@visible}} @on-hide={{@close}} as |Modal|> | ||
<Modal.header> | ||
<h2 class="uk-modal-title"> | ||
{{t "ember-gwr.components.linkBuildingModal.linkBuilding"}} | ||
</h2> | ||
</Modal.header> | ||
<Modal.body> | ||
{{#let | ||
(component | ||
"project-form/field" | ||
project=this.buildingWork | ||
translationBase="ember-gwr.buildingWork" | ||
) as |Field| | ||
}} | ||
<Field | ||
@attr="constructionWorkDone" | ||
@inputType="select" | ||
@noPlaceholder={{true}} | ||
@options={{this.kindOfWorkOptions}} | ||
/> | ||
<Field @attr="energeticRestauration" @inputType="checkbox" /> | ||
<Field @attr="renovationHeatingsystem" @inputType="checkbox" /> | ||
<Field @attr="innerConversionRenovation" @inputType="checkbox" /> | ||
<Field @attr="conversion" @inputType="checkbox" /> | ||
<Field @attr="extensionHeighteningHeated" @inputType="checkbox" /> | ||
<Field @attr="extensionHeighteningNotHeated" @inputType="checkbox" /> | ||
<Field @attr="thermicSolarFacility" @inputType="checkbox" /> | ||
<Field @attr="photovoltaicSolarFacility" @inputType="checkbox" /> | ||
<Field @attr="otherWorks" @inputType="checkbox" /> | ||
{{/let}} | ||
</Modal.body> | ||
<Modal.footer class="uk-flex uk-flex-between"> | ||
<UkButton {{on "click" @close}}> | ||
{{t "ember-gwr.components.linkBuildingModal.cancel"}} | ||
</UkButton> | ||
<UkButton | ||
@color="primary" | ||
@loading={{@isLoading}} | ||
{{on "click" (fn @linkAction this.buildingWork)}} | ||
> | ||
{{t "ember-gwr.components.linkBuildingModal.linkBuilding"}} | ||
</UkButton> | ||
</Modal.footer> | ||
</UkModal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Component from "@glimmer/component"; | ||
import { tracked } from "@glimmer/tracking"; | ||
import { kindOfWorkOptions } from "ember-ebau-gwr/models/options"; | ||
|
||
export default class LinkBuildingModalComponent extends Component { | ||
@tracked buildingWork = { | ||
constructionWorkDone: kindOfWorkOptions[0], | ||
energeticRestauration: false, | ||
renovationHeatingsystem: false, | ||
innerConversionRenovation: false, | ||
conversion: false, | ||
extensionHeighteningHeated: false, | ||
extensionHeighteningNotHeated: false, | ||
thermicSolarFacility: false, | ||
photovoltaicSolarFacility: false, | ||
otherWorks: false, | ||
}; | ||
kindOfWorkOptions = kindOfWorkOptions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{{#let (t (concat "ember-gwr.models." @modelName)) as |modelName|}} | ||
<table class="uk-table uk-table-divider uk-table-hover uk-table-middle"> | ||
<thead> | ||
<tr> | ||
<th colspan="3"> | ||
{{t | ||
"ember-gwr.components.linkedModels.linkedEntries" | ||
modelName=modelName | ||
}} | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each @models as |model|}} | ||
<tr> | ||
{{#if hasBlock}} | ||
{{yield model}} | ||
{{else}} | ||
<td class="uk-table-shrink"> | ||
<LinkTo | ||
@route={{concat @modelName ".form"}} | ||
@model={{get model @idAttr}} | ||
class="uk-link" | ||
> | ||
{{get model @idAttr}} | ||
</LinkTo> | ||
</td> | ||
<td> | ||
{{get model @descriptionAttr}} | ||
</td> | ||
{{/if}} | ||
{{#unless @noDeleteButton}} | ||
<td class="uk-table-shrink"> | ||
<button | ||
type="button" | ||
class="uk-icon-button" | ||
uk-icon="trash" | ||
uk-tooltip={{t "ember-gwr.components.linkedModels.removeLink"}} | ||
{{on "click" (fn @removeLink model)}} | ||
> | ||
</button> | ||
</td> | ||
{{/unless}} | ||
</tr> | ||
{{else}} | ||
<tr> | ||
<td colspan="3"> | ||
{{t | ||
"ember-gwr.components.linkedModels.noLinkedEntries" | ||
modelName=modelName | ||
}} | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
<tfoot> | ||
<tr> | ||
<td colspan="99" class="uk-text-center"> | ||
<LinkTo | ||
@route={{or @searchRoute (concat "search-" @modelName)}} | ||
@models={{or @searchModels (array)}} | ||
> | ||
{{t | ||
"ember-gwr.components.linkedModels.linkEntry" | ||
modelName=modelName | ||
}} | ||
</LinkTo> | ||
{{t "ember-gwr.components.linkedModels.or"}} | ||
<LinkTo | ||
@route={{or @newRoute (concat @modelName ".new")}} | ||
@models={{or @newModels (array)}} | ||
> | ||
{{t | ||
"ember-gwr.components.linkedModels.createEntry" | ||
modelName=modelName | ||
}} | ||
</LinkTo> | ||
</td> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
{{/let}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<LinkedModels | ||
@models={{@projects}} | ||
@modelName="project" | ||
@removeLink={{@removeProject}} | ||
@noDeleteButton={{true}} as |project| | ||
> | ||
<td | ||
class={{ | ||
concat | ||
"uk-table-shrink " | ||
(if (eq @activeProject project.EPROID) "uk-text-bold") | ||
}} | ||
> | ||
<LinkTo @route="project.form" @model={{project.EPROID}} class="uk-link"> | ||
{{project.EPROID}} | ||
</LinkTo> | ||
</td> | ||
<td class={{if (eq @activeProject project.EPROID) "uk-text-bold"}}> | ||
{{project.constructionProjectDescription}} | ||
</td> | ||
<td class="uk-table-shrink"> | ||
{{#if (eq @activeProject project.EPROID)}} | ||
<button | ||
type="button" | ||
class="uk-icon-button" | ||
uk-icon="trash" | ||
uk-tooltip={{t "ember-gwr.components.linkedModels.removeLink"}} | ||
{{on "click" @removeProject}} | ||
> | ||
</button> | ||
{{/if}} | ||
</td> | ||
</LinkedModels> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="uk-width-1"> | ||
<input | ||
type="checkbox" | ||
class="uk-checkbox" | ||
name={{@attr}} | ||
required={{@required}} | ||
checked={{@value}} | ||
...attributes | ||
{{on "input" this.update}} | ||
/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { action } from "@ember/object"; | ||
import Component from "@glimmer/component"; | ||
|
||
export default class ProjectFormCheckboxComponent extends Component { | ||
@action | ||
update(event) { | ||
this.args.update(event.target.checked); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.