Assitant improved

This commit is contained in:
Juan 2018-05-17 10:52:27 +02:00
parent 65791be9d5
commit f5f0904d85
16 changed files with 171 additions and 127 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.405.95) stable; urgency=low hedera-web (1.405.96) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -41,8 +41,7 @@ Hedera.Checkout = new Class ({
}, },
disableButtons: function(disable) { disableButtons: function(disable) {
this.$('confirm-delivery').disabled = disable; this.$('assistant-bar').disabled = disable;
this.$('confirm-pickup').disabled = disable;
}, },
onConfirmClick: function() { onConfirmClick: function() {

View File

@ -6,13 +6,12 @@
} }
.checkout .bar .checkout .bar
{ {
padding: .2em;
margin-bottom: 1em; margin-bottom: 1em;
} }
.checkout .form .checkout .form
{ {
max-width: 40em; max-width: 40em;
padding: 4em; padding: 4em 2em;
} }
/* Step */ /* Step */

View File

@ -71,11 +71,14 @@
</div> </div>
<div id="form" class="checkout"> <div id="form" class="checkout">
<div class="box bar"> <div class="box bar">
<htk-assistant-bar assistant="assistant"/> <htk-assistant-bar
id="assistant-bar"
assistant="assistant"/>
</div> </div>
<div class="box"> <div class="box">
<div class="form"> <div class="form">
<htk-assistant id="assistant"> <htk-assistant id="assistant"
endFunc="onConfirmClick">
<htk-step <htk-step
name="method" name="method"
validate-func="methodValidate"> validate-func="methodValidate">
@ -86,12 +89,16 @@
param="method" param="method"
on-changed="onMethodChange"/> on-changed="onMethodChange"/>
<div> <div>
<htk-radio radio-group="rg-method" value="AGENCY"/> <label>
<label><t>Receive the order</t></label> <htk-radio radio-group="rg-method" value="AGENCY"/>
<t>Receive the order</t>
</label>
</div> </div>
<div> <div>
<htk-radio radio-group="rg-method" value="PICKUP"/> <label>
<label><t>PickupInStore</t></label> <htk-radio radio-group="rg-method" value="PICKUP"/>
<t>PickupInStore</t>
</label>
</div> </div>
</div> </div>
</htk-step> </htk-step>
@ -182,9 +189,6 @@
<t>Agency</t> <t>Agency</t>
<htk-text form="agency-combo" column="description"/> <htk-text form="agency-combo" column="description"/>
</p> </p>
<button id="confirm-delivery" class="thin" on-click="onConfirmClick">
<t>Confirm</t>
</button>
<div class="clear"/> <div class="clear"/>
</div> </div>
</htk-step> </htk-step>
@ -200,9 +204,6 @@
<t>Warehouse</t> <t>Warehouse</t>
<htk-text form="warehouse-combo" column="description"/> <htk-text form="warehouse-combo" column="description"/>
</p> </p>
<button id="confirm-pickup" class="thin" on-click="onConfirmClick">
<t>Confirm</t>
</button>
<div class="clear"/> <div class="clear"/>
</div> </div>
</htk-step> </htk-step>

View File

@ -12,7 +12,7 @@
sodipodi:docname="go-next.svg" sodipodi:docname="go-next.svg"
height="16" height="16"
id="svg7384" id="svg7384"
inkscape:version="0.48.5 r10040" inkscape:version="0.92.3 (2405546, 2018-03-11)"
version="1.1" version="1.1"
width="16"> width="16">
<metadata <metadata
@ -33,7 +33,7 @@
bordercolor="#666666" bordercolor="#666666"
borderopacity="1" borderopacity="1"
inkscape:current-layer="layer12" inkscape:current-layer="layer12"
inkscape:cx="4.372549" inkscape:cx="8"
inkscape:cy="8" inkscape:cy="8"
gridtolerance="10" gridtolerance="10"
inkscape:guide-bbox="true" inkscape:guide-bbox="true"
@ -55,21 +55,21 @@
inkscape:snap-nodes="true" inkscape:snap-nodes="true"
inkscape:snap-others="false" inkscape:snap-others="false"
inkscape:snap-to-guides="true" inkscape:snap-to-guides="true"
inkscape:window-height="1014" inkscape:window-height="1013"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-x="1920" inkscape:window-x="1920"
inkscape:window-y="27" inkscape:window-y="30"
inkscape:zoom="51"> inkscape:zoom="51.0625">
<inkscape:grid <inkscape:grid
empspacing="2" empspacing="2"
enabled="true" enabled="true"
id="grid4866" id="grid4866"
originx="120px" originx="120"
originy="530px" originy="530"
snapvisiblegridlinesonly="true" snapvisiblegridlinesonly="true"
spacingx="1px" spacingx="1"
spacingy="1px" spacingy="1"
type="xygrid" type="xygrid"
visible="true" /> visible="true" />
<inkscape:grid <inkscape:grid
@ -80,11 +80,11 @@
enabled="true" enabled="true"
id="grid5968" id="grid5968"
opacity="0.1254902" opacity="0.1254902"
originx="120px" originx="120"
originy="530px" originy="530"
snapvisiblegridlinesonly="true" snapvisiblegridlinesonly="true"
spacingx="0.5px" spacingx="0.5"
spacingy="0.5px" spacingy="0.5"
type="xygrid" type="xygrid"
visible="true" /> visible="true" />
</sodipodi:namedview> </sodipodi:namedview>
@ -146,6 +146,6 @@
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
d="m 126.10829,749.02355 a 0.99672214,0.99672214 0 0 0 -0.49831,1.71294 l 4.26678,4.26679 -4.26678,4.26679 a 1.013034,1.013034 0 1 0 1.43264,1.43265 l 4.98311,-4.98312 0.68518,-0.71632 -0.68518,-0.71632 -4.98311,-4.98311 a 0.99672214,0.99672214 0 0 0 -0.93433,-0.2803 z" d="m 126.10829,749.02355 a 0.99672214,0.99672214 0 0 0 -0.49831,1.71294 l 4.26678,4.26679 -4.26678,4.26679 a 1.013034,1.013034 0 1 0 1.43264,1.43265 l 4.98311,-4.98312 0.68518,-0.71632 -0.68518,-0.71632 -4.98311,-4.98311 a 0.99672214,0.99672214 0 0 0 -0.93433,-0.2803 z"
id="path8334" id="path8334"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#666666;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /> style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:Sans;-inkscape-font-specification:Sans;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#666666;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:accumulate" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -12,7 +12,7 @@
sodipodi:docname="go-previous.svg" sodipodi:docname="go-previous.svg"
height="16" height="16"
id="svg7384" id="svg7384"
inkscape:version="0.91 r13725" inkscape:version="0.92.3 (2405546, 2018-03-11)"
version="1.1" version="1.1"
width="16"> width="16">
<metadata <metadata
@ -33,8 +33,8 @@
bordercolor="#666666" bordercolor="#666666"
borderopacity="1" borderopacity="1"
inkscape:current-layer="layer12" inkscape:current-layer="layer12"
inkscape:cx="4.5742092" inkscape:cx="8"
inkscape:cy="7.9610706" inkscape:cy="8"
gridtolerance="10" gridtolerance="10"
inkscape:guide-bbox="true" inkscape:guide-bbox="true"
guidetolerance="10" guidetolerance="10"
@ -55,21 +55,21 @@
inkscape:snap-nodes="true" inkscape:snap-nodes="true"
inkscape:snap-others="false" inkscape:snap-others="false"
inkscape:snap-to-guides="true" inkscape:snap-to-guides="true"
inkscape:window-height="1014" inkscape:window-height="1013"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-x="1920" inkscape:window-x="1920"
inkscape:window-y="27" inkscape:window-y="30"
inkscape:zoom="51.375"> inkscape:zoom="51.0625">
<inkscape:grid <inkscape:grid
empspacing="2" empspacing="2"
enabled="true" enabled="true"
id="grid4866" id="grid4866"
originx="141px" originx="141"
originy="530px" originy="530"
snapvisiblegridlinesonly="true" snapvisiblegridlinesonly="true"
spacingx="1px" spacingx="1"
spacingy="1px" spacingy="1"
type="xygrid" type="xygrid"
visible="true" /> visible="true" />
<inkscape:grid <inkscape:grid
@ -80,11 +80,11 @@
enabled="true" enabled="true"
id="grid5968" id="grid5968"
opacity="0.1254902" opacity="0.1254902"
originx="141px" originx="141"
originy="530px" originy="530"
snapvisiblegridlinesonly="true" snapvisiblegridlinesonly="true"
spacingx="0.5px" spacingx="0.5"
spacingy="0.5px" spacingy="0.5"
type="xygrid" type="xygrid"
visible="true" /> visible="true" />
</sodipodi:namedview> </sodipodi:namedview>

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -18,36 +18,67 @@ module.exports = new Class({
get: function() { get: function() {
return this._assistant; return this._assistant;
} }
},
disabled: {
type: Boolean,
set: function(x) {
this._disabled = x;
this._previousButton.disabled = x;
this._nextButton.disabled = x;
this._endButton.disabled = x;
},
get: function() {
return this._disabled;
}
} }
}, },
_assistant: null, _assistant: null,
_stepIndex: -1, _stepIndex: -1,
_disabled: false,
render: function() { render: function() {
var bar = this.createRoot('div'); var bar = this.createRoot('div');
bar.className = 'htk-assistant-bar'; bar.className = 'htk-assistant-bar';
var previousButton = this.createElement('img'); var previousButton = this.createElement('button');
previousButton.src = 'image/icon/light/go-previous.svg';
previousButton.className = 'previous'; previousButton.className = 'previous';
previousButton.title = _('Previous'); previousButton.title = _('Previous');
previousButton.addEventListener('click', this.movePrevious.bind(this)); previousButton.addEventListener('click', this.movePrevious.bind(this));
bar.appendChild(previousButton); bar.appendChild(previousButton);
var img = this.createElement('img');
img.src = 'image/icon/light/go-previous.svg';
previousButton.appendChild(img);
var steps = this.createElement('div'); var steps = this.createElement('div');
steps.className = 'steps';
bar.appendChild(steps); bar.appendChild(steps);
var nextButton = this.createElement('img'); var nextButton = this.createElement('button');
nextButton.src = 'image/icon/light/go-next.svg';
nextButton.className = 'next'; nextButton.className = 'next';
nextButton.title = _('Next'); nextButton.title = _('Next');
nextButton.addEventListener('click', this.moveNext.bind(this)); nextButton.addEventListener('click', this.moveNext.bind(this));
bar.appendChild(nextButton); bar.appendChild(nextButton);
var img = this.createElement('img');
img.src = 'image/icon/light/go-next.svg';
nextButton.appendChild(img);
var endButton = this.createElement('button');
endButton.className = 'end';
endButton.title = _('Confirm');
endButton.addEventListener('click', this.end.bind(this));
bar.appendChild(endButton);
var img = this.createElement('img');
img.src = 'image/icon/light/ok.svg';
endButton.appendChild(img);
this._steps = steps; this._steps = steps;
this._previousButton = previousButton; this._previousButton = previousButton;
this._nextButton = nextButton; this._nextButton = nextButton;
this._endButton = endButton;
}, },
movePrevious: function() { movePrevious: function() {
@ -60,6 +91,11 @@ module.exports = new Class({
this._assistant.moveNext(); this._assistant.moveNext();
}, },
end: function() {
if (this._assistant)
this._assistant.end();
},
setStep: function(stepIndex) { setStep: function(stepIndex) {
if (this._assistant) if (this._assistant)
this._assistant.setStep(stepIndex); this._assistant.setStep(stepIndex);
@ -70,10 +106,9 @@ module.exports = new Class({
var steps = this._steps; var steps = this._steps;
Vn.Node.removeChilds(steps); Vn.Node.removeChilds(steps);
steps.style.width = (stepCount * 1.7) + 'em';
for (var i = 0; i < stepCount; i++) { for (var i = 0; i < stepCount; i++) {
var img = this.createElement('img'); var img = this.createElement('div');
img.src = 'image/step.svg'; img.src = 'image/step.svg';
img.addEventListener('click', this.setStep.bind(this, i)); img.addEventListener('click', this.setStep.bind(this, i));
steps.appendChild(img); steps.appendChild(img);
@ -87,21 +122,26 @@ module.exports = new Class({
var stepCount = childs ? childs.length : 0; var stepCount = childs ? childs.length : 0;
var stepIndex = this._assistant ? this._assistant.step : -1; var stepIndex = this._assistant ? this._assistant.step : -1;
if (this._stepIndex != -1) if (this._stepIndex != -1) {
childs[this._stepIndex].src = 'image/step.svg'; childs[this._stepIndex].src = 'image/step.svg';
childs[this._stepIndex].className = '';
}
if (stepIndex >= stepCount) if (stepIndex >= stepCount)
return; return;
this._stepIndex = stepIndex; this._stepIndex = stepIndex;
if (stepIndex != -1) if (stepIndex != -1) {
childs[stepIndex].src = 'image/step-cur.svg'; childs[stepIndex].src = 'image/step-cur.svg';
childs[this._stepIndex].className = 'selected';
}
var visibility = stepIndex <= 0 ? 'hidden' : 'visible'; var visibility = stepIndex > 0 ? 'visible' : 'hidden';
this._previousButton.style.visibility = visibility; this._previousButton.style.visibility = visibility;
var visibility = stepIndex >= stepCount - 1 ? 'hidden' : 'visible'; var isEnd = stepIndex >= stepCount - 1;
this._nextButton.style.visibility = visibility; this._nextButton.style.display = isEnd ? 'none' : 'block';
this._endButton.style.display = isEnd ? 'block' : 'none';
} }
}); });

View File

@ -64,20 +64,20 @@ module.exports = new Class({
*/ */
stepFunc: { stepFunc: {
type: Function, type: Function,
set: function(x) { value: null
this._stepFunc = x; },
this.setStep(this._stepIndex); /**
}, * Function to call on every step change.
get: function() { */
return this._stepFunc; endFunc: {
} type: Function,
value: null
}, },
}, },
_stepNode: null, _stepNode: null,
_stepIndex: 0, _stepIndex: 0,
_stepName: null, _stepName: null,
_stepFunc: null,
steps: {}, steps: {},
initialize: function(props) { initialize: function(props) {
@ -133,6 +133,9 @@ module.exports = new Class({
this.currentStep = step; this.currentStep = step;
step.show(); step.show();
this.signalEmit('step-change', stepIndex); this.signalEmit('step-change', stepIndex);
if (this.stepFunc)
this.stepFunc(step);
}, },
/** /**
@ -147,5 +150,13 @@ module.exports = new Class({
*/ */
moveNext: function() { moveNext: function() {
this.setStep(this._stepIndex + 1); this.setStep(this._stepIndex + 1);
},
/**
* Ends the assistant. If defined, the stepFunc will be called.
*/
end: function() {
if (this.endFunc)
this.endFunc();
} }
}); });

View File

@ -24,5 +24,6 @@ ImageAdded: Imatge afegida correctament
Close: Tancar Close: Tancar
Previous: Anterior Previous: Anterior
Next: Següent Next: Següent
Confirm: Confirmar
Search: Cercar Search: Cercar
Search...: Cercar... Search...: Cercar...

View File

@ -24,5 +24,6 @@ ImageAdded: Image added successfully
Close: Close Close: Close
Previous: Previous Previous: Previous
Next: Next Next: Next
Confirm: Confirm
Search: Search Search: Search
Search...: Search... Search...: Search...

View File

@ -24,5 +24,6 @@ ImageAdded: Imagen añadida correctamente
Close: Cerrar Close: Cerrar
Previous: Anterior Previous: Anterior
Next: Siguiente Next: Siguiente
Confirm: Confirmar
Search: Buscar Search: Buscar
Search...: Buscar... Search...: Buscar...

View File

@ -24,5 +24,6 @@ ImageAdded: Image ajoutée correctement
Close: Croche Close: Croche
Previous: Précédent Previous: Précédent
Next: Suivant Next: Suivant
Confirm: Confirmer
Search: Recherche Search: Recherche
Search...: Recherche... Search...: Recherche...

View File

@ -1,28 +0,0 @@
'True': 'True'
'False': 'False'
'Null': 'Null'
ChangeDate: Change date
Sort: Sort
At: at
Of: of
OfThe: of the
Remove: Remove
Loading: Loading
Loading...: Loading...
ReallyDelete: Are you sure you want to delete the line?
YouMustBeLoggedIn: You must be a registered user
EmptyList: Empty list
NoData: No data
ErrorLoadingData: Error
Error: Error
Image: Image
File: File
FileName: File name
UpdateImage: Add or update an image
UploadFile: Upload file
ImageAdded: Image added successfully
Close: Close
Previous: Previous
Next: Next
Search: хайх
Search...: хайх...

View File

@ -24,5 +24,6 @@ ImageAdded: Imagen adicionada corretamente
Close: Fechar Close: Fechar
Previous: Anterior Previous: Anterior
Next: Seguinte Next: Seguinte
Confirm: Confirmar
Search: Procurar Search: Procurar
Search...: Procurar... Search...: Procurar...

View File

@ -519,45 +519,62 @@ td.cell-image .htk-image
.htk-assistant-bar .htk-assistant-bar
{ {
margin: 0.5em auto;
max-width: 30em;
position: relative; position: relative;
padding: .8em;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
} }
.htk-assistant-bar img .htk-assistant-bar > button
{ {
border-radius: 50%;
padding: 0;
margin: 0;
}
.htk-assistant-bar > .end
{
display: none;
}
.htk-assistant-bar > button > img
{
display: block;
width: 1.8em;
padding: .5em;
}
.htk-assistant-bar > .steps
{
display: flex;
align-items: center;
}
.htk-assistant-bar > .steps > div {
background-color: #AAA;
width: .5em;
height: .5em;
cursor: pointer;
border-radius: 50%;
margin: .5em;
transition-property: width, height;
transition-duration: 100ms;
transition-timing-function: ease-in-out;
}
.htk-assistant-bar > .steps > div.selected {
background-color: #666;
width: 1em;
height: 1em;
}
.htk-assistant-bar > .steps > div:hover {
opacity: .7;
}
.htk-assistant-bar > .steps > img
{
width: 1.3em;
margin: 0 .2em;
cursor: pointer; cursor: pointer;
} }
.htk-assistant-bar > img .htk-assistant-bar > .steps > img:hover
{
position: absolute;
width: 1.8em;
top: 0;
padding: 0.3em;
border-radius: 0.1em;
}
.htk-assistant-bar > img:hover
{
background-color: rgba(1,1,1,0.1);
}
.htk-assistant-bar > img.previous
{
left: 0;
}
.htk-assistant-bar > img.next
{
right: 0;
}
.htk-assistant-bar > div
{
margin: 0 auto;
padding-top: 0.2em;
}
.htk-assistant-bar > div > img
{
padding: 0.3em 0.2em;
width: 1.3em;
}
.htk-assistant-bar > div > img:hover
{ {
opacity: .7; opacity: .7;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "1.405.95", "version": "1.405.96",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {