0
1
Fork 0

Merge branch 'test'

This commit is contained in:
Juan Ferrer 2022-11-10 21:57:43 +01:00
commit d4a7f41600
408 changed files with 13178 additions and 27673 deletions

2
debian/changelog vendored
View File

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

1
debian/source.lintian-overrides vendored Normal file
View File

@ -0,0 +1 @@
hedera-web: package-contains-npm-ignore-file

View File

@ -1,41 +1,40 @@
Hedera.AddressList = new Class
({
Hedera.AddressList = new Class({
Extends: Hedera.Form
,activate: function ()
{
this.$('user-model').setInfo ('c', 'myClient', 'hedera');
this.$('addresses').setInfo ('a', 'myAddress', 'hedera');
,activate: function() {
this.$.userModel.setInfo('c', 'myClient', 'hedera');
this.$.addresses.setInfo('a', 'myAddress', 'hedera');
}
,onAddAddressClick: function ()
{
this.hash.set ({
,onAddAddressClick: function() {
this.hash.setAll({
form: 'account/address',
address: 0
});
}
,onReturnClick: function ()
{
,onReturnClick: function() {
window.history.back();
}
,onRemoveAddressClick: function (button, form)
{
if (confirm (_('AreYouSureDeleteAddress')))
{
form.set ('isActive', false);
form.refresh ();
,onSetDefaultClick: function(event, addressId) {
if (event.defaultPrevented) return;
this.$.defaultAddress.value = addressId;
Htk.Toast.showMessage(_('DefaultAddressModified'));
}
,onRemoveAddressClick: function(form) {
if (confirm(_('AreYouSureDeleteAddress'))) {
form.set('isActive', false);
form.refresh();
}
}
,onEditAddressClick: function (button, form)
{
this.hash.set ({
,onEditAddressClick: function(id) {
this.hash.setAll({
form: 'account/address',
address: form.get ('id')
address: id
});
}
});

View File

@ -1,7 +1,8 @@
Addresses: Direccions
Addresses: Adreces
Return: Tornar
AddAddress: Afegir adreça
SetAsDefault: Establir com per defecte
RemoveAddress: Esborrar direcció
EditAddress: Modificar direcció
AreYouSureDeleteAddress: Estàs segur de que vols eliminar la direcció?
DefaultAddressModified: Adreça per defecte modificada

View File

@ -5,3 +5,4 @@ SetAsDefault: Set as default
RemoveAddress: Remove address
EditAddress: Edit address
AreYouSureDeleteAddress: Are you sure you want to delete the address?
DefaultAddressModified: Default address modified

View File

@ -5,3 +5,4 @@ SetAsDefault: Establecer como predeterminada
RemoveAddress: Borrar dirección
EditAddress: Modificar dirección
AreYouSureDeleteAddress: ¿Estás seguro de que quieres borrar la dirección?
DefaultAddressModified: Dirección por defecto modificada

View File

@ -5,3 +5,4 @@ SetAsDefault: Définir par défaut
RemoveAddress: Supprimer l'adresse
EditAddress: Changement d'adresse
AreYouSureDeleteAddress: Souhaitez-vous vraiment supprier l'adresse?
DefaultAddressModified: Adresse par défaut modifiée

View File

@ -5,3 +5,4 @@ SetAsDefault: Selecionar como pre-determinado
RemoveAddress: Eliminar Morada
EditAddress: Modificar Morada
AreYouSureDeleteAddress: Tens certeza que queres eliminar esta morada?
DefaultAddressModified: Endereço padrão modificado

View File

@ -1,48 +1,4 @@
.address-list
{
padding: 1em;
}
.address-list .box
{
max-width: 30em;
}
.address-list .form
{
margin: 0 auto;
max-width: 25em;
padding: 2em;
}
.address
{
padding: 1em;
border-bottom: 1px solid #DDD;
}
.address p
{
margin: 0.2em 0;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.address p.important
{
font-size: 1.2em;
}
.address .actions
{
float: right;
}
.address .actions > .htk-button
{
margin: 0;
}
.address .actions > *
{
display: inline-block;
vertical-align: middle;
}
.address .actions > input
{
margin: .6em;
.address-list .htk-list .side {
padding-right: 16px;
}

View File

@ -2,20 +2,16 @@
<vn-group>
<db-form id="user-form">
<db-model property="model" id="user-model" updatable="true">
<custom>
SELECT id, defaultAddressFk
FROM myClient c
</custom>
</db-model>
</db-form>
<db-model id="addresses" updatable="true">
<custom>
SELECT a.id, a.nickname, p.name province, a.postalCode,
a.city, a.street, a.isActive
FROM myAddress a
LEFT JOIN vn.province p ON p.id = a.provinceFk
WHERE a.isActive
</custom>
</db-model>
</vn-group>
<div id="title">
@ -25,47 +21,48 @@
<htk-bar-button
icon="add"
tip="_AddAddress"
on-click="onAddAddressClick"/>
on-click="this.onAddAddressClick()"/>
</div>
<div id="form" class="address-list">
<div class="box">
<div class="box vn-w-sm">
<htk-radio-group
id="default-address"
column="defaultAddressFk"
form="user-form"/>
<htk-repeater model="addresses" form-id="iter">
<htk-repeater model="addresses" form-id="address" class="htk-list">
<custom>
<div class="address">
<div class="actions">
<div class="item clickable" on-click="this.onSetDefaultClick($event, address.id)">
<div class="side">
<htk-radio
form="iter"
column="id"
radio-group="default-address"
tip="_SetAsDefault"/>
<htk-button
form="iter"
column="id"
tip="_RemoveAddress"
icon="delete"
on-click="onRemoveAddressClick"/>
<htk-button
form="iter"
column="id"
tip="_EditAddress"
icon="edit"
on-click="onEditAddressClick"/>
val="{{address.id}}"
tip="_SetAsDefault"
name="test"/>
</div>
<div class="content">
<p class="important">
<htk-text form="iter" column="nickname"/>
{{address.nickname}}
</p>
<p>
<htk-text form="iter" column="street"/>
{{address.street}}
</p>
<p>
<htk-text form="iter" column="postalCode"/>,
<htk-text form="iter" column="city"/>
{{address.postalCode}}, {{address.city}}
</p>
</div>
<div
class="actions"
on-click="$event.preventDefault()">
<htk-button
icon="delete"
tip="_RemoveAddress"
on-click="this.onRemoveAddressClick($iter)"/>
<htk-button
icon="edit"
tip="_EditAddress"
on-click="this.onEditAddressClick(address.id)"/>
</div>
</div>
</custom>
</htk-repeater>
</div>

View File

@ -3,26 +3,18 @@ Hedera.Address = new Class({
Extends: Hedera.Form,
activate: function() {
this.$('model').setInfo('a', 'myAddress', 'hedera', ['id'], 'id');
this.$('model').setDefault('clientFk', 'a',
this.$.model.setInfo('a', 'myAddress', 'hedera', ['id'], 'id');
this.$.model.setDefault('clientFk', 'a',
new Sql.Function({schema: 'account', name: 'myUser_getId'}));
},
onStatusChange: function(form) {
if (form.ready && this.$('address').value == 0)
form.insertRow();
onStatusChange: function() {
if (this.$.iter.ready && this.hash.$.address == 0)
this.$.iter.insertRow();
},
onOperationsDone: function() {
Htk.Toast.showMessage(_('AddressChangedSuccessfully'));
this.onReturnClick();
},
onAcceptClick: function() {
this.$('iter').performOperations();
},
onReturnClick: function() {
window.history.back();
window.history.back()
}
});

View File

@ -1,16 +0,0 @@
.address
{
padding: 1em;
}
.address .box
{
max-width: 30em;
padding: 2em;
}
.address .form
{
margin: 0 auto;
max-width: 25em;
}

View File

@ -1,68 +1,69 @@
<vn>
<vn-group>
<vn-param id="address"/>
<vn-hash-param key="address" param="address"/>
<db-form id="iter" on-status-changed="onStatusChange">
<vn-lot-query id="params">
<vn-spec name="address" type="Number"/>
</vn-lot-query>
<db-form id="iter" on-status-changed="this.onStatusChange()">
<db-model
id="model"
property="model"
updatable="true"
mode="ON_DEMAND"
on-operations-done="onOperationsDone">
lot="params"
on-operations-done="this.onOperationsDone()">
SELECT a.id, a.street, a.nickname, a.city,
a.postalCode, a.provinceFk, p.countryFk
FROM myAddress a
LEFT JOIN vn.province p ON p.id = a.provinceFk
WHERE a.id = #address
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
</custom>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div id="title">
<h1><t>AddEditAddress</t></h1>
<h1><t>Configuration</t></h1>
</div>
<div id="actions">
<htk-bar-button
icon="ok"
tip="_Accept"
on-click="onAcceptClick"/>
<htk-bar-button
icon="close"
tip="_Return"
on-click="onReturnClick"/>
on-click="window.history.back()"/>
<htk-bar-button
icon="check"
tip="_Accept"
on-click="iter.performOperations()"/>
</div>
<div id="form" class="address">
<div class="box">
<div class="form">
<div class="form box vn-w-sm vn-pa-lg">
<h5 class="vn-mb-md">
<t>AddEditAddress</t>
</h5>
<div class="form-group">
<label><t>Name</t></label>
<htk-entry column="nickname" form="iter"/>
<htk-entry
placeholder="_Name"
form="iter" column="nickname"/>
</div>
<div class="form-group">
<label><t>Address</t></label>
<htk-entry column="street" form="iter"/>
<htk-entry
placeholder="_Address"
form="iter" column="street"/>
</div>
<div class="form-group">
<label><t>City</t></label>
<htk-entry column="city" form="iter"/>
<htk-entry
placeholder="_City"
form="iter" column="city"/>
</div>
<div class="form-group">
<label><t>ZipCode</t></label>
<htk-entry column="postalCode" form="iter"/>
<htk-entry
placeholder="_ZipCode"
form="iter" column="postalCode"/>
</div>
<div class="form-group">
<label><t>Country</t></label>
<htk-combo>
<db-param
<htk-combo
placeholder="_Country"
form="iter" column="countryFk"
id="country"
property="param"
form="iter"
column="countryFk"
one-way="true"/>
one-way="true"
one-time="true">
<db-model property="model">
SELECT id, country FROM vn.country
ORDER BY country
@ -70,21 +71,17 @@
</htk-combo>
</div>
<div class="form-group">
<label><t>Province</t></label>
<htk-combo column="provinceFk" form="iter">
<db-model property="model">
<htk-combo
placeholder="_Province"
column="provinceFk"
form="iter">
<db-model property="model" lot="country">
SELECT id, name FROM vn.province
WHERE countryFk = #country
WHERE countryFk = #id
ORDER BY name
<sql-batch property="batch">
<custom>
<item name="country" param="country"/>
</custom>
</sql-batch>
</db-model>
</htk-combo>
</div>
</div>
</div>
</div>
</vn>

View File

@ -3,45 +3,45 @@ Hedera.Conf = new Class({
Extends: Hedera.Form
,activate: function() {
this.$('user-model').setInfo('c', 'myClient', 'hedera');
this.$('user-model').setInfo('u', 'myUser', 'account');
this.$.userModel.setInfo('c', 'myClient', 'hedera');
this.$.userModel.setInfo('u', 'myUser', 'account');
if (this.hash.get('verificationToken'))
if (this.hash.$.verificationToken)
this.onPassChangeClick();
}
,onPassChangeClick: function() {
this.$('old-password').value = '';
this.$('new-password').value = '';
this.$('repeat-password').value = '';
this.$.oldPassword.value = '';
this.$.newPassword.value = '';
this.$.repeatPassword.value = '';
var verificationToken = this.hash.get('verificationToken');
this.$('old-password').style.display = verificationToken ? 'none' : 'block';
this.$('change-password').show();
var verificationToken = this.hash.$.verificationToken;
this.$.oldPassword.style.display = verificationToken ? 'none' : 'block';
this.$.changePassword.show();
if (verificationToken)
this.$('new-password').focus();
this.$.newPassword.focus();
else
this.$('old-password').focus();
this.$.oldPassword.focus();
}
,onPassModifyClick: function() {
try {
var oldPassword = this.$('old-password').value;
var newPassword = this.$('new-password').value;
var repeatedPassword = this.$('repeat-password').value;
var oldPassword = this.$.oldPassword.value;
var newPassword = this.$.newPassword.value;
var repeatedPassword = this.$.repeatPassword.value;
if (newPassword == '' && repeatedPassword == '')
throw new Error(_('Passwords empty'));
if (newPassword !== repeatedPassword)
throw new Error(_('Passwords doesn\'t match'));
var verificationToken = this.hash.get('verificationToken');
var verificationToken = this.hash.$.verificationToken;
var params = {newPassword: newPassword};
if (verificationToken) {
params.verificationToken = verificationToken;
this.conn.send('core/restore-password', params,
this.conn.send('user/restore-password', params,
this._onPassChange.bind(this));
} else {
let userId = this.gui.user.id;
@ -58,26 +58,22 @@ Hedera.Conf = new Class({
,_onPassChange: function(json, error) {
if (!error) {
this.$('change-password').hide();
this.$.changePassword.hide();
this.hash.unset('verificationToken');
Htk.Toast.showMessage(_('Password changed!'));
this.$('user-form').refresh();
this.$.userForm.refresh();
} else {
Htk.Toast.showError(error.message);
if (this.hash.get('verificationToken'))
this.$('new-password').select();
if (this.hash.$.verificationToken)
this.$.newPassword.select();
else
this.$('old-password').select();
this.$.oldPassword.select();
}
}
,onPassInfoClick: function() {
this.$('password-info').show();
}
,onAddressesClick: function() {
this.hash.set({form: 'account/address-list'});
this.$.passwordInfo.show();
}
});

View File

@ -1,4 +1,5 @@
Configuration: Configuració
Personal information: Dades personals
Username: Nom d'usuari
Password: Contrasenya
Email: Correu electrònic
@ -9,7 +10,7 @@ Receive invoices by email: Rebre factures per correu electrònic
Old password: Contrasenya antiga
New password: Nova contrasenya
Repeat password: Repetir contrasenya
Info: Info
Requirements: Requisits
Modify: Modificar
Password requirements: Requisits de contrasenya
characters long: caràcters de longitud

View File

@ -1,4 +1,5 @@
Configuration: Configuration
Personal information: Personal information
Username: Username
Password: Password
Email: Email
@ -9,7 +10,7 @@ Receive invoices by email: Receive invoices by email
Old password: Old password
New password: New password
Repeat password: Repeat password
Info: Info
Requirements: Requirements
Modify: Modify
Password requirements: Password requirements
characters long: characters long

View File

@ -1,4 +1,5 @@
Configuration: Configuración
Personal information: Datos personales
Username: Nombre de usuario
Password: Contraseña
Email: Correo electrónico
@ -9,7 +10,7 @@ Receive invoices by email: Recibir facturas por correo electrónico
Old password: Contaseña antigua
New password: Nueva contraseña
Repeat password: Repetir contraseña
Info: Info
Requirements: Requisitos
Modify: Modificar
Password requirements: Requisitos de constraseña
characters long: carácteres de longitud

View File

@ -1,4 +1,5 @@
Configuration: Configuration
Personal information: Informations personnelles
Username: Utilisateur
Password: Mot de passe
Email: Courriel
@ -9,7 +10,7 @@ Receive invoices by email: Recevoir des factures par e-mail
Old password: Ancien mot de passe
New password: Nouveau mot de passe
Repeat password: Répéter le mot de passe
Info: Info
Requirements: Exigences
Modify: Modifier
Password requirements: Mot de passe exigences
characters long: Longs caractères

View File

@ -1,4 +1,5 @@
Configuration: Configuração
Personal information: Dados pessoais
Username: Nome de usuario
Password: Palavra-Passe
Email: E-Mail
@ -9,7 +10,7 @@ Receive invoices by email: Receber facturas por e-mail
Old password: Palavra-Passe antiga
New password: Nova Palavra-Passe
Repeat password: Repetir Palavra-Passe
Info: Info
Requirements: Requisitos
Modify: Modificar
Password requirements: Requisitos de Palavra-Passe
characters long: caracteres

View File

@ -1,33 +1,4 @@
.conf
{
padding: 1em;
}
.conf .box
{
max-width: 30em;
padding: 2em;
}
.conf .form
{
margin: 0 auto;
max-width: 25em;
}
.conf .form-group input[type=password]
{
margin-bottom: 0.5em;
}
.pass-change
{
max-width: 15em;
}
.pass-info
{
width: 15em;
}
.pass-info ul
{
.pass-info ul {
list-style-type: none;
}

View File

@ -1,22 +1,18 @@
<vn>
<vn-group>
<db-form id="password-form">
<db-form v-model="passwordForm">
<db-model property="model">
<custom>
SELECT length, nAlpha, nUpper, nDigits, nPunct
FROM account.userPassword
</custom>
</db-model>
</db-form>
<db-form id="user-form">
<db-model property="model" id="user-model" updatable="true">
<custom>
SELECT u.id, u.name, u.email, u.nickname,
u.lang, c.isToBeMailed, c.id clientFk
FROM account.myUser u
LEFT JOIN myClient c
ON u.id = c.id
</custom>
</db-model>
</db-form>
</vn-group>
@ -27,30 +23,42 @@
<htk-bar-button
icon="place"
tip="_Addresses"
on-click="onAddressesClick"/>
on-click="hash.setAll({form: 'account/address-list'})"/>
<htk-bar-button
icon="preferences"
icon="lock_reset"
tip="_Change password"
on-click="onPassChangeClick"/>
on-click="this.onPassChangeClick()"/>
</div>
<div id="form" class="conf">
<div class="box">
<div class="form">
<div class="form box vn-w-sm vn-pa-lg">
<h5 class="vn-mb-md">
<t>Personal information</t>
</h5>
<div class="form-group">
<label for="user-name"><t>Username</t></label>
<htk-text form="user-form" column="name"/>
<htk-entry
placeholder="_Username"
disabled="true"
form="user-form"
column="name"/>
</div>
<div class="form-group">
<label for="email"><t>Email</t></label>
<htk-entry form="user-form" column="email"></htk-entry>
<htk-entry
placeholder="_Email"
form="user-form"
column="email">
</htk-entry>
</div>
<div class="form-group">
<label for="nickname"><t>Display name</t></label>
<htk-entry form="user-form" column="nickname"/>
<htk-entry
placeholder="_Display name"
form="user-form"
column="nickname"/>
</div>
<div class="form-group">
<label for="lang"><t>Language</t></label>
<htk-combo form="user-form" column="lang">
<htk-combo
placeholder="_Language"
form="user-form"
column="lang">
<db-model property="model">
<custom>
SELECT code, name FROM language WHERE isActive
@ -59,17 +67,21 @@
</htk-combo>
</div>
<div class="form-group">
<label for="mail"><t>Receive invoices by email</t></label>
<label>
<htk-check form="user-form" column="isToBeMailed"/>
</div>
<t>Receive invoices by email</t>
</label>
</div>
</div>
</div>
<htk-popup
id="change-password"
modal="true">
<div property="child-node" class="htk-dialog pass-change">
<div>
<div property="child-node" class="htk-dialog vn-w-xs vn-pa-lg">
<div class="form">
<h5 class="vn-mb-md">
<t>Change password</t>
</h5>
<input
id="old-password"
type="password"
@ -84,11 +96,11 @@
placeholder="_Repeat password"/>
</div>
<div class="button-bar">
<button class="thin" on-click="onPassModifyClick">
<button class="thin" on-click="this.onPassModifyClick()">
<t>Modify</t>
</button>
<button class="thin" on-click="onPassInfoClick">
<t>Info</t>
<button class="thin" on-click="this.onPassInfoClick()">
<t>Requirements</t>
</button>
<div class="clear"/>
</div>
@ -97,30 +109,25 @@
<htk-popup
id="password-info"
modal="true">
<div property="child-node" class="htk-dialog pass-info">
<h3>
<div property="child-node" class="htk-dialog pass-info vn-w-xs vn-pa-lg">
<h5 class="vn-mb-md">
<t>Password requirements</t>
</h3>
</h5>
<ul>
<li>
<htk-text form="password-form" column="length"/>
<t>characters long</t>
{{passwordForm.length}} <t>characters long</t>
</li>
<li>
<htk-text form="password-form" column="nAlpha"/>
<t>alphabetic characters</t>
{{passwordForm.nAlpha}} <t>alphabetic characters</t>
</li>
<li>
<htk-text form="password-form" column="nUpper"/>
<t>capital letters</t>
{{passwordForm.nUpper}} <t>capital letters</t>
</li>
<li>
<htk-text form="password-form" column="nDigits"/>
<t>digits</t>
{{passwordForm.nDigits}} <t>digits</t>
</li>
<li>
<htk-text form="password-form" column="nPunct"/>
<t>symbols</t>
{{passwordForm.nPunct}} <t>symbols</t>
</li>
</ul>
</div>

View File

@ -1,6 +1,5 @@
Hedera.AccessLog = new Class
({
Hedera.AccessLog = new Class({
Extends: Hedera.Form
});

View File

@ -1,36 +1,12 @@
.access-log
{
padding: 1em;
}
.access-log .box
{
max-width: 25em;
margin: 0 auto;
}
.access-log .form
{
padding: 2em;
}
.access-log .form > p
{
.access-log .form > p {
font-size: 1.2em;
margin: .1em 0;
}
/* List */
.access-log .list
{
margin-top: 1em;
}
.access-log .item
{
display: block;
padding: 1em;
border-bottom: 1px solid #DDD;
}
.access-log .item > p
{
margin: .1em 0;
.access-log .htk-list {
margin-top: 16px;
}

View File

@ -1,18 +1,12 @@
<vn>
<vn-group>
<vn-param id="user"/>
<vn-hash-param key="user" param="user"/>
<db-form id="user-form">
<db-model property="model">
<custom>
SELECT Id_Cliente, Cliente, Telefono, movil
FROM vn2008.Clientes WHERE Id_Cliente = #user
</custom>
<sql-batch property="batch">
<custom>
<item name="user" param="user"/>
</custom>
</sql-batch>
<db-form v-model="user">
<db-model property="model" lot="hash">
SELECT u.id, u.name user, u.nickname, u.email, c.phone, r.name role
FROM account.user u
JOIN account.role r ON r.id = u.role
LEFT JOIN vn.client c ON c.id = u.id
WHERE u.id = #user
</db-model>
</db-form>
</vn-group>
@ -20,27 +14,17 @@
<h1><t>AccessLog</t></h1>
</div>
<div id="form" class="access-log">
<div class="box">
<div class="box vn-w-xs vn-pa-lg">
<div class="form">
<p>
<htk-text form="user-form" column="Id_Cliente"/>
</p>
<p>
<htk-text form="user-form" column="Cliente"/>
</p>
<p>
<htk-text form="user-form" column="Telefono"/>
</p>
<p>
<htk-text form="user-form" column="movil"/>
</p>
<h4>{{user.nickname}}</h4>
<p>#{{user.id}} - {{user.user}}</p>
<p>{{user.role}}</p>
<p>{{user.email}}</p>
<p>{{user.phone}}</p>
</div>
</div>
<div class="list box">
<div>
<htk-repeater form-id="iter">
<db-model property="model">
<custom>
<htk-repeater form-id="iter" class="box vn-w-xs htk-list vn-mt-md">
<db-model property="model" lot="hash">
SELECT u.stamp, a.platform, a.browser, a.version, a.javascript, a.cookies
FROM visitUser u
JOIN visitAccess c ON c.id = u.accessFk
@ -48,27 +32,19 @@
WHERE u.userFk = #user
ORDER BY u.stamp DESC
LIMIT 8
</custom>
<sql-batch property="batch">
<custom>
<item name="user" param="user"/>
</custom>
</sql-batch>
</db-model>
<custom>
<div class="item">
<div class="content">
<p>
<htk-text form="iter" column="stamp" format="_%a, %e %b %Y at %T"/>
{{Vn.Value.format(iter.stamp, _('%a, %e %b %Y at %T'))}}
</p>
<p>
<htk-text form="iter" column="platform"/> -
<htk-text form="iter" column="browser"/>
<htk-text form="iter" column="version"/>
{{iter.platform}} - {{iter.browser}} {{iter.version}}
</p>
</div>
</div>
</custom>
</htk-repeater>
</div>
</div>
</div>
</vn>

View File

@ -4,38 +4,28 @@ Hedera.Connections = new Class({
,_timeoutId: null
,onModelStatusChange: function(model) {
if (!model.ready)
,onModelStatusChange: function() {
if (!this.$.sessions.ready)
return;
if (this._timeoutId)
clearTimeout(this._timeoutId);
this._timeoutId = setTimeout(this.onRefreshClick.bind(this), 60000);
this._timeoutId = setTimeout(
() => this.$.sessions.refresh(), 60000);
}
,deactivate: function() {
clearTimeout(this._timeoutId);
}
,onRefreshClick: function() {
this.$('sessions').refresh();
}
,onAccessLogClick: function(button, form) {
this.hash.set({
form: 'admin/access-log'
,user: form.get('userId')
});
}
,onChangeUserClick: function(button, form) {
this.gui.supplantUser(form.get('user'),
,onChangeUserClick: function(userName) {
this.gui.supplantUser(userName,
this._onUserSupplant.bind(this));
}
,_onUserSupplant: function() {
this.hash.set({form: 'ecomerce/orders'});
this.hash.setAll({form: 'ecomerce/orders'});
}
,sessionsFunc: function() {

View File

@ -1,44 +1,6 @@
.connections
{
padding: 1em;
}
.connections .box
{
max-width: 25em;
margin: 0 auto;
}
.action-bar .connections-sum
{
.action-bar .connections-sum {
padding: .4em;
margin-top: .9em;
margin-right: .5em;
background-color: #1e88e5;
border-radius: 0.1em;
box-shadow: 0 0 0.4em #666;
border-radius: .1em;
}
/* List */
.connections .item
{
display: block;
padding: 1em;
border-bottom: 1px solid #DDD;
}
.connections .item > button
{
float: right;
margin: 0;
}
.connections .item > p
{
margin: .1em 0;
}
.connections .item > p.important
{
font-size: 1.2em;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}

View File

@ -6,7 +6,7 @@
<htk-bar-button
icon="refresh"
tip="_Refresh"
on-click="onRefreshClick"/>
on-click="sessions.refresh()"/>
<div class="connections-sum">
<htk-text>
<db-calc-sum
@ -18,10 +18,11 @@
</div>
</div>
<div id="form" class="connections">
<div class="box">
<htk-repeater form-id="iter">
<db-model property="model" id="sessions" on-status-changed="onModelStatusChange">
<custom>
<htk-repeater form-id="iter" class="box htk-list vn-w-xs">
<db-model
property="model"
id="sessions"
on-status-changed="this.onModelStatusChange()">
SELECT vu.userFk userId, vu.stamp, u.nickname, s.lastUpdate,
a.platform, a.browser, a.version, u.name user
FROM userSession s
@ -31,37 +32,32 @@
JOIN visit v ON v.id = a.visitFk
JOIN account.user u ON u.id = vu.userFk
ORDER BY lastUpdate DESC
</custom>
</db-model>
<custom>
<div class="item">
<htk-button
form="iter"
column="id"
tip="_Supplant user"
icon="incognito"
on-click="onChangeUserClick"/>
<htk-button
form="iter"
column="id"
tip="_Access log"
icon="gnome"
on-click="onAccessLogClick"/>
<a class="item"
href="{{`#!form=admin/access-log&amp;user=${iter.userId}`}}"
title="_Access log">
<div class="content">
<p class="important">
<htk-text form="iter" column="nickname"/>
{{iter.nickname}}
</p>
<p>
<htk-text form="iter" column="stamp" format="%a, %T"/> -
<htk-text form="iter" column="lastUpdate" format="%T"/>
{{Vn.Value.format(iter.stamp, '%a, %T')}} -
{{Vn.Value.format(iter.lastUpdate, '%T')}}
</p>
<p>
<htk-text form="iter" column="platform"/> -
<htk-text form="iter" column="browser"/>
<htk-text form="iter" column="version"/>
{{iter.platform}} - {{iter.browser}} {{iter.version}}
</p>
</div>
<div class="actions"
on-click="$event.preventDefault()">
<htk-button
tip="_Supplant user"
icon="supervisor_account"
on-click="this.onChangeUserClick(iter.user)"/>
</div>
</a>
</custom>
</htk-repeater>
</div>
</div>
</vn>

View File

@ -3,6 +3,6 @@ Hedera.Items = new Class({
Extends: Hedera.Form,
activate: function() {
this.$('items').setInfo('i', 'item', 'vn', ['id']);
this.$.items.setInfo('i', 'item', 'vn', ['id']);
}
});

View File

@ -1,41 +1,6 @@
.items
{
padding: 1em;
}
.items .box
{
max-width: 25em;
margin: 0 auto;
}
/* Row */
.items .row
{
padding: 1em;
border-bottom: 1px solid #DDD;
.items .item .photo {
border-radius: 10px;
height: 80px;
width: 80px;
}
.items .row > .photo
{
margin-right: 1em;
float: left;
border-radius: 3%;
height: 5.5em;
width: 5.5em;
}
.items .row > p
{
margin: .1em 0;
margin-left: 5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Topbar */
.action-bar .htk-search-entry
{
margin: .8em .6em;
}

View File

@ -1,18 +1,16 @@
<vn>
<vn-group>
<vn-param id="filter"/>
<vn-hash-param key="filter" param="filter"/>
</vn-group>
<div id="title">
<h1><t>Items</t></h1>
</div>
<div id="actions">
<htk-search-entry param="filter"/>
<htk-search-entry form="hash" column="search"/>
</div>
<div id="form" class="items">
<div class="rows box">
<htk-repeater form-id="iter" empty-message="_Enter a search term">
<db-model property="model" id="items">
<htk-repeater
class="htk-list rows box vn-w-xs"
form-id="iter"
empty-message="_Enter a search term">
<db-model property="model" id="items" lot="hash">
SELECT i.id, i.longName, i.size, i.category,
i.value5, i.value6, i.value7,
i.image, im.updated
@ -20,19 +18,15 @@
LEFT JOIN image im
ON im.collectionFk = 'catalog'
AND im.name = i.image
WHERE i.longName LIKE CONCAT('%', #filter, '%')
OR i.id = #filter
WHERE i.longName LIKE CONCAT('%', #search, '%')
OR i.id = #search
ORDER BY i.longName LIMIT 50
<sql-batch property="batch">
<custom>
<item name="filter" param="filter"/>
</custom>
</sql-batch>
</db-model>
<custom>
<div class="row">
<div class="item">
<div class="side vn-mr-md">
<htk-image
form="iter"
form="$iter"
column="image"
stamp-column="updated"
class="photo"
@ -41,24 +35,23 @@
full-dir="1600x900"
editable="true"
conn="conn"/>
<p class="concept">
<htk-text form="iter" column="longName"/>
</div>
<div class="content">
<p class="important">
{{iter.longName}}
</p>
<p class="tags">
<htk-text form="iter" column="value5"/>
<htk-text form="iter" column="value6"/>
<htk-text form="iter" column="value7"/>
{{iter.value5}} {{iter.value6}} {{iter.value7}}
</p>
<p>
#<htk-text form="iter" column="id"/>
{{iter.id}}
</p>
<p>
<htk-text form="iter" column="image"/>
{{iter.image}}
</p>
<div class="clear"/>
</div>
</div>
</custom>
</htk-repeater>
</div>
</div>
</vn>

View File

@ -1,11 +1,5 @@
Hedera.Links = new Class
({
Hedera.Links = new Class({
Extends: Hedera.Form
,repeaterFunc: function (res, form)
{
res.$('link').href = form.get ('link');
}
});

View File

@ -1,38 +1,50 @@
.cpanel
{
padding: 1em;
.cpanel .items > div {
max-width: 900px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 16px;
margin: 0 auto;
}
.cpanel .box
{
max-width: 30em;
.cpanel .item {
display: flex;
flex-direction: column;
align-items: center;
margin: 0;
width: 140px;
padding: 15px;
text-align: center;
transition: background-color 250ms ease-out;
}
/* Items */
.cpanel .item
{
display: block;
padding: 1em;
border-bottom: 1px solid #DDD;
}
.cpanel .item:hover
{
.cpanel .item:hover {
background-color: rgba(1, 1, 1, 0.05);
}
.cpanel .item > .htk-image
{
.cpanel .item > .htk-image {
display: flex;
justify-content: center;
align-items: center;
margin: 0;
margin-right: 1em;
float: left;
max-height: 2.8em;
max-width: 2.8em;
height: 80px;
}
.cpanel .item > p
{
.cpanel .item > .htk-image > img {
max-height: 60px;
max-width: 60px;
padding: 0;
}
.cpanel .item > h6 {
flex: none;
margin: .1em 0;
font-size: .9rem;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.cpanel .item > p.important
{
font-size: 1.2em;
.cpanel .item > .text-secondary {
flex: none;
margin: 0;
font-size: .8rem;
height: 40px;
overflow: hidden;
}

View File

@ -3,8 +3,7 @@
<h1><t>ControlPanel</t></h1>
</div>
<div id="form" class="cpanel">
<div class="box">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<htk-repeater form-id="iter" class="items">
<db-model property="model">
<custom>
SELECT image, name, description, link FROM link
@ -12,21 +11,21 @@
</custom>
</db-model>
<custom>
<a id="link" class="item" target="_blank">
<a class="item box"
href="{{iter.link}}"
target="_blank">
<htk-image
form="iter"
column="image"
value="{{iter.image}}"
directory="link"
subdir="full"/>
<p class="important">
<htk-text form="iter" column="name"/>
</p>
<p>
<htk-text form="iter" column="description"/>
<h6>
{{iter.name}}
</h6>
<p class="text-secondary">
{{iter.description}}
</p>
</a>
</custom>
</htk-repeater>
</div>
</div>
</vn>

View File

@ -6,8 +6,7 @@ var Status = {
,UPLOADED : 3
};
Hedera.Photos = new Class
({
Hedera.Photos = new Class({
Extends: Hedera.Form
,filesData: []
,uploadCount: 0
@ -16,7 +15,7 @@ Hedera.Photos = new Class
,isUploading: false
,activate: function() {
this.$('schema').value = 'catalog';
this.$.schema.value = 'catalog';
}
,addFiles: function(files) {
@ -54,23 +53,24 @@ Hedera.Photos = new Class
statusNode.className = 'status';
li.appendChild(statusNode);
var button = new Htk.Button({
tip: 'Remove',
icon: 'delete'
});
button.on('click', this.onFileRemove, this);
li.appendChild(button.node);
var fileData = {
li: li,
file: file,
name: name,
statusNode: statusNode
};
this.filesData.push(fileData);
button.value = fileData;
this.$('file-list').appendChild(li);
var button = new Htk.Button({
tip: 'Remove',
icon: 'delete'
});
button.node.addEventListener('click',
() => this.onFileRemove(fileData));
li.appendChild(button.node);
this.filesData.push(fileData);
this.$.fileList.appendChild(li);
this.setImageStatus(fileData, Status.NONE, 'add', _('Pending upload'));
}
@ -83,7 +83,7 @@ Hedera.Photos = new Class
if (fileData.status === Status.NONE) {
this.setImageStatus(
fileData, Status.WAITING, 'cloud-upload', _('Waiting for upload'));
fileData, Status.WAITING, 'cloud_upload', _('Waiting for upload'));
fileData.name.disabled = true;
this.uploadQueue.push(fileData);
count++;
@ -107,10 +107,10 @@ Hedera.Photos = new Class
fileData, Status.UPLOADING, 'upload', _('Uploading file'));
var formData = new FormData();
formData.append('updateMatching', this.$('update-matching').value);
formData.append('updateMatching', this.$.updateMatching.value);
formData.append('image', fileData.file);
formData.append('name', fileData.name.value);
formData.append('schema', this.$('schema').value);
formData.append('schema', this.$.schema.value);
formData.append('srv', 'json:image/upload');
this.conn.sendFormData(formData,
this.onFileUpload.bind(this, fileData));
@ -121,7 +121,7 @@ Hedera.Photos = new Class
if (data) {
this.setImageStatus(
fileData, Status.UPLOADED, 'ok', _('Image uploaded'));
fileData, Status.UPLOADED, 'cloud_done', _('Image uploaded'));
} else {
this.setImageStatus(
fileData, Status.NONE, 'error', error.message);
@ -146,14 +146,13 @@ Hedera.Photos = new Class
var statusNode = fileData.statusNode;
Vn.Node.removeChilds(statusNode);
var iconNode = new Htk.Icon({icon: icon});
var iconNode = new Htk.Icon({name: icon});
statusNode.appendChild(iconNode.node);
statusNode.title = title ? title : '';
}
,onFileRemove: function(button) {
var fileData = button.value;
this.$('file-list').removeChild(fileData.li);
,onFileRemove: function(fileData) {
this.$.fileList.removeChild(fileData.li);
for (var i = 0; i < this.filesData.length; i++)
if (this.filesData[i] === fileData) {
@ -164,23 +163,23 @@ Hedera.Photos = new Class
,onClearClick: function() {
this.filesData = [];
Vn.Node.removeChilds(this.$('file-list'));
Vn.Node.removeChilds(this.$.fileList);
}
,onDropzoneClick: function() {
this.$('file').click();
this.$.file.click();
}
,onFileChange: function() {
this.addFiles(this.$('file').files);
this.addFiles(this.$.file.files);
}
,onDragEnter: function() {
this.$('dropzone').classList.add('dragover');
this.$.dropzone.classList.add('dragover');
}
,onDragLeave: function() {
this.$('dropzone').classList.remove('dragover');
this.$.dropzone.classList.remove('dragover');
}
,onDragOver: function(event) {
@ -188,7 +187,7 @@ Hedera.Photos = new Class
}
,onDragEnd: function(event) {
this.$('dropzone').classList.remove('dragover');
this.$.dropzone.classList.remove('dragover');
event.dataTransfer.clearData();
}

View File

@ -1,12 +1,4 @@
.photos {
padding: 1em;
}
.photos .box {
max-width: 25em;
padding: 2em;
}
/* Dropzone */
.photos .dropzone {
@ -56,11 +48,11 @@
}
.photos .file-list .status {
cursor: pointer;
width: 1em;
width: 1.2em;
padding-left: .5em;
padding-right: .5em;
}
.photos .file-list .status > img {
.photos .file-list .status > .htk-icon {
display: block;
}
.photos .file-list .htk-button {

View File

@ -3,7 +3,7 @@
<h1><t>Images</t></h1>
</div>
<div id="form" class="photos">
<div class="box">
<div class="box form vn-w-sm vn-pa-lg">
<div class="form-group">
<label><t>Collection</t></label>
<htk-combo id="schema">

View File

@ -1,102 +1,91 @@
Hedera.Queries = new Class
({
Hedera.Queries = new Class({
Extends: Hedera.Form
,activate: function ()
{
this.$('result-index').value = 0;
,activate: function() {
this.$.resultIndex.value = 0;
}
,clean: function ()
{
if (this._grid)
{
this.$('grid-holder').removeChild (this._grid.node);
this._grid.unref ();
,clean: function() {
if (this._grid) {
this.$.gridHolder.removeChild(this._grid.node);
this._grid.unref();
this._grid = null;
}
}
,_onExecuteClick: function ()
{
this.clean ();
,onExecuteClick: function() {
this.clean();
var model = new Db.Model ({
var model = new Db.Model({
conn: this.conn,
query: this.$('sql').value,
resultIndex: this.$('result-index').value,
updatable: this.$('updatable').value
query: this.$.sql.value,
resultIndex: this.$.resultIndex.value,
updatable: this.$.updatable.value
});
model.on ('status-changed', this._onModelChange, this);
model.on('status-changed', this.onModelChange, this);
}
,_onCleanClick: function ()
{
this.clean ();
,onCleanClick: function() {
this.clean();
}
,_onModelChange: function (model, status)
{
if (status !== Db.Model.Status.LOADING)
{
model.disconnect ('status-changed', this._onModelChange, this);
model.unref ();
,onModelChange: function(model, status) {
if (status !== Db.Model.Status.LOADING) {
model.disconnect('status-changed', this.onModelChange, this);
model.unref();
}
if (status !== Db.Model.Status.READY)
return;
Htk.Toast.showMessage (_('Query executed!'));
Htk.Toast.showMessage(_('Query executed!'));
var gridHolder = this.$('grid-holder');
var gridHolder = this.$.gridHolder;
if (gridHolder.firstChild)
gridHolder.removeChilds (gridHolder.firstChild);
gridHolder.removeChilds(gridHolder.firstChild);
var grid = new Htk.Grid ();
var grid = new Htk.Grid();
var columns = model.columns;
for (var i = 0; i < columns.length; i++)
{
for (var i = 0; i < columns.length; i++) {
var c = columns[i];
switch (c.type)
{
switch (c.type) {
case Db.Conn.Type.BOOLEAN:
var column = new Htk.ColumnCheck ();
var column = new Htk.ColumnCheck();
break;
case Db.Conn.Type.INTEGER:
var column = new Htk.ColumnSpin ();
var column = new Htk.ColumnSpin();
break;
case Db.Conn.Type.DOUBLE:
var column = new Htk.ColumnSpin ({digits: 2});
var column = new Htk.ColumnSpin({digits: 2});
break;
case Db.Conn.Type.DATE:
var column = new Htk.ColumnDate ({format: '%a, %e %b %Y'});
var column = new Htk.ColumnDate({format: '%a, %e %b %Y'});
break;
case Db.Conn.Type.DATE_TIME:
var column = new Htk.ColumnDate ({format: '%a, %e %b %Y, %T'});
var column = new Htk.ColumnDate({format: '%a, %e %b %Y, %T'});
break;
case Db.Conn.Type.STRING:
default:
var column = new Htk.ColumnText ();
var column = new Htk.ColumnText();
}
column.setProperties ({
column.setProperties({
title: c.name,
editable: this.$('updatable').value,
editable: this.$.updatable.value,
columnIndex: i
});
grid.appendColumn (column);
grid.appendColumn(column);
}
grid.model = model;
gridHolder.appendChild (grid.node);
gridHolder.appendChild(grid.node);
this._grid = grid;
}
});

View File

@ -1,25 +1,10 @@
.queries
{
padding: 1em;
}
.queries .box
{
max-width: 40em;
margin: 0 auto;
}
.queries .form
{
box-sizing: border-box;
padding: 2em;
}
.queries textarea
{
.queries textarea {
display: block;
width: 100%;
height: 8em;
}
.queries .result
{
.queries .result {
margin-top: 1em;
overflow: auto;
}

View File

@ -6,14 +6,14 @@
<htk-bar-button
icon="ok"
tip="_Execute"
on-click="_onExecuteClick"/>
on-click="this.onExecuteClick()"/>
<htk-bar-button
icon="delete"
tip="_Clean"
on-click="_onCleanClick"/>
on-click="this.onCleanClick()"/>
</div>
<div id="form" class="queries">
<div class="box form">
<div class="box form vn-w-sm vn-pa-lg">
<div class="form-group">
<label><t>SQL query</t></label>
<textarea

View File

@ -1,45 +1,11 @@
.users
{
padding: 1em;
.users-box.item > .actions {
display: flex;
}
.users .box
{
max-width: 30em;
margin: 0 auto;
}
.users-box
{
padding: 1em;
border-bottom: 1px solid #DDD;
}
.users-box > button
{
float: right;
margin: 0;
}
.users-box > p
{
margin: .2em 0;
}
.users-box > p.important
{
font-size: 1.2em;
}
.users-box > .disabled
{
float: right;
.users-box .disabled {
color: white;
background-color: #F66;
border-radius: .2em;
padding: .2em;
margin: .3em;
padding: .3em;
font-size: .8em;
}
/* Topbar */
.action-bar .htk-search-entry
{
margin: .8em .6em;
}

View File

@ -1,62 +1,48 @@
<vn>
<vn-group>
<vn-param id="user-name"/>
<vn-hash-param key="user" param="user-name"/>
</vn-group>
<div id="title">
<h1><t>User management</t></h1>
</div>
<div id="actions">
<htk-search-entry
param="user-name"/>
<htk-search-entry form="hash" column="user"/>
</div>
<div id="form" class="users">
<div class="box">
<htk-repeater form-id="iter" renderer="rendererFunc">
<db-model property="model">
<custom>
<htk-repeater
form-id="iter"
renderer="rendererFunc"
class="htk-list box vn-w-xs">
<db-model property="model" lot="hash">
SELECT u.id, u.name, u.nickname, u.active
FROM account.user u
WHERE u.name LIKE CONCAT('%', #user, '%')
OR u.nickname LIKE CONCAT('%', #user, '%')
OR u.id = #user
ORDER BY u.name LIMIT 200
</custom>
<sql-batch property="batch">
<custom>
<item name="user" param="user-name"/>
</custom>
</sql-batch>
</db-model>
<custom>
<div class="users-box">
<htk-button
form="iter"
column="id"
tip="_Access log"
icon="gnome"
on-click="onAccessLogClick"/>
<htk-button
id="impersonate"
form="iter"
column="id"
tip="_Impersonate user"
icon="incognito"
on-click="onChangeUserClick"/>
<a class="users-box item"
href="{{`#!form=admin/access-log&amp;user=${iter.id}`}}"
title="_Access log">
<div class="content">
<p class="important">
{{iter.nickname}}
</p>
<p>
#{{iter.id}} - {{iter.name}}
</p>
</div>
<div class="actions"
on-click="$event.preventDefault()">
<span id="disabled" class="disabled">
<t>Disabled</t>
</span>
<p class="important">
<htk-text form="iter" column="nickname"/>
</p>
<p>
#<htk-text form="iter" column="id"/> -
<htk-text form="iter" column="name"/>
</p>
<div class="clear"/>
<htk-button
id="impersonate"
icon="supervisor_account"
tip="_Impersonate user"
on-click="this.onChangeUserClick(iter.name)"/>
</div>
</a>
</custom>
</htk-repeater>
</div>
</div>
</vn>

View File

@ -2,28 +2,21 @@
Hedera.Users = new Class({
Extends: Hedera.Form
,onAccessLogClick: function(button, form) {
this.hash.set({
'form': 'admin/access-log'
,'user': form.get('id')
});
}
,rendererFunc: function(scope, form) {
var isEnabled = form.get('active')
scope.$('disabled').style.display = isEnabled ?
var isEnabled = form.$.active
scope.$.disabled.style.display = isEnabled ?
'none' : 'block';
scope.$('impersonate').node.style.display = isEnabled ?
scope.$.impersonate.node.style.display = isEnabled ?
'block' : 'none';
}
,onChangeUserClick: function(button, form) {
this.gui.supplantUser(form.get('name'),
,onChangeUserClick: function(userName) {
this.gui.supplantUser(userName,
this.onUserSupplant.bind(this));
}
,onUserSupplant: function() {
this.hash.set({form: 'ecomerce/orders'});
this.hash.setAll({form: 'ecomerce/orders'});
}
});

View File

@ -1,46 +1,12 @@
.visits
{
padding: 1em;
.visits .box {
margin-bottom: 16px;
}
.visits .box
{
max-width: 25em;
margin: 0 auto;
.visits .box:last-child {
margin-bottom: 0;
}
.visits .form
{
padding: 1.5em;
max-width: 20em;
}
.visits .summary
{
margin-top: 1em;
}
.visits .summary p
{
padding: 1.5em;
.visits .summary p {
font-size: 1.4em;
margin: 0;
text-align: right;
}
/* List */
.visits .list
{
margin-top: 1em;
}
.visits .item
{
display: block;
padding: 1em;
border-bottom: 1px solid #DDD;
}
.visits .item > p
{
margin: .1em 0;
}
.visits .item > p.important
{
font-size: 1.2em;
}

View File

@ -1,4 +1,8 @@
<vn>
<vn-lot-query id="params">
<vn-spec name="from" type="Date"/>
<vn-spec name="to" type="Date"/>
</vn-lot-query>
<div id="title">
<h1><t>Visits</t></h1>
</div>
@ -6,30 +10,29 @@
<htk-bar-button
icon="refresh"
tip="_Refresh"
on-click="onRefreshClick"/>
on-click="visits.refresh()"/>
<htk-bar-button
icon="user-info"
icon="visibility"
tip="_Connections"
on-click="onSessionsClick"/>
on-click="this.hash.setAll({form: 'admin/connections'})"/>
</div>
<div id="form" class="visits">
<div class="box">
<div class="form">
<div class="vn-w-xs">
<div class="form vn-pa-lg box">
<div class="form-group">
<label><t>From</t></label>
<htk-date-chooser>
<vn-param property="param" id="from"/>
</htk-date-chooser>
<htk-date-chooser
form="params"
column="from"/>
</div>
<div class="form-group">
<label><t>To</t></label>
<htk-date-chooser>
<vn-param property="param" id="to"/>
</htk-date-chooser>
<htk-date-chooser
form="params"
column="to"/>
</div>
</div>
</div>
<div class="summary box">
<div class="summary vn-pa-lg box">
<p>
<htk-text>
<db-calc-sum
@ -47,10 +50,11 @@
<t>news</t>
</p>
</div>
<div class="list box">
<htk-repeater form-id="iter" empty-message="_Select date interval">
<db-model property="model" id="visits">
<custom>
<htk-repeater
class="box htk-list"
form-id="iter"
empty-message="_Select date interval">
<db-model property="model" id="visits" lot="params">
SELECT browser,
MIN(CAST(version AS DECIMAL(4,1))) minVersion,
MAX(CAST(version AS DECIMAL(4,1))) maxVersion,
@ -63,31 +67,22 @@
JOIN visit v ON v.id = a.visitFk
WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC
</custom>
<sql-batch property="batch">
<custom>
<item name="from" param="from"/>
<item name="to" param="to"/>
</custom>
</sql-batch>
</db-model>
<custom>
<div class="item">
<div class="content">
<p class="important">
<htk-text form="iter" column="browser"/>
<htk-text form="iter" column="minVersion"/> -
<htk-text form="iter" column="maxVersion"/>
{{iter.browser}} {{iter.minVersion}} - {{iter.maxVersion}}
</p>
<p>
<htk-text form="iter" column="visits"/>
<t>visits</t>,
<htk-text form="iter" column="newVisits"/>
<t>news</t>
{{iter.visits}} <t>visits</t>,
{{iter.newVisits}} <t>news</t>
</p>
<p>
<htk-text form="iter" column="lastVisit" format="_%a, %e %b %Y at %T"/>
{{Vn.Value.format(iter.lastVisit, _('%a, %e %b %Y at %T'))}}
</p>
</div>
</div>
</custom>
</htk-repeater>
</div>

View File

@ -1,22 +1,13 @@
Hedera.Visits = new Class
({
Hedera.Visits = new Class({
Extends: Hedera.Form
,activate: function ()
{
this.$('from').value = new Date ();
this.$('to').value = new Date ();
}
,onRefreshClick: function ()
{
this.$('visits').refresh ();
}
,onSessionsClick: function ()
{
this.hash.set ({'form': 'admin/connections'});
,activate: function() {
if (!this.hash.$.to)
this.hash.assign({
from: new Date(),
to: new Date()
});
}
});

View File

@ -1,13 +1,11 @@
Hedera.Packages = new Class
({
Hedera.Packages = new Class({
Extends: Hedera.Form
,onShowClick: function (column, agencyId)
{
this.hash.set ({
'form': 'agencies/provinces',
'agency': agencyId
,onShowClick: function(column, agencyId) {
this.hash.setAll({
form: 'agencies/provinces',
agency: agencyId
});
}
});

View File

@ -1,9 +0,0 @@
.packages
{
padding: 1em;
}
.packages .box
{
max-width: 40em;
margin: 0 auto;
}

View File

@ -3,7 +3,7 @@
<h1><t>ListByAgency</t></h1>
</div>
<div id="form" class="packages">
<div class="box">
<div class="box vn-w-sm">
<htk-grid>
<db-model property="model">
<custom>
@ -12,7 +12,7 @@
</db-model>
<htk-column-button
column="agency_id"
icon="show"
icon="search"
tip="_ShowByProvince"
on-clicked="onShowClick"/>
<htk-column-text title="_Agency" column="Agencia"/>

View File

@ -1,6 +1,5 @@
Hedera.Provinces = new Class
({
Hedera.Provinces = new Class({
Extends: Hedera.Form
});

View File

@ -1,9 +0,0 @@
.provinces
{
padding: 1em;
}
.provinces .box
{
max-width: 40em;
margin: 0 auto;
}

View File

@ -1,23 +1,12 @@
<vn>
<vn-group>
<vn-param id="agency"/>
<vn-hash-param key="agency" param="agency"/>
</vn-group>
<div id="title">
<h1><t>ByProvince</t></h1>
</div>
<div id="form" class="provinces">
<div id="form" class="provinces vn-w-sm">
<div class="box">
<htk-grid>
<db-model property="model">
<custom>
CALL vn2008.desglose_volume (#agency)
</custom>
<sql-batch property="batch">
<custom>
<item name="agency" param="agency"/>
</custom>
</sql-batch>
<db-model property="model" lot="hash">
CALL vn2008.desglose_volume(#agency)
</db-model>
<htk-column-text title="_Province" column="Provincia"/>
<htk-column-spin title="_Expeditions" column="expediciones"/>

View File

@ -1,15 +1,5 @@
.about
{
padding: 1em;
}
.about .cols
{
max-width: 85em;
margin: 0 auto;
}
@media screen and (min-width: 1000px) /* and (max-width: 1399px) */
{
@media screen and (min-width: 1000px) /* and (max-width: 1399px) */ {
.about .cols
{
column-count: 2;
@ -17,8 +7,7 @@
-webkit-column-count: 2;
}
}/*
@media screen and (min-width: 1400px)
{
@media screen and (min-width: 1400px) {
.about .cols
{
column-count: 3;
@ -26,8 +15,7 @@
-webkit-column-count: 3;
}
}
@media screen and (min-width: 2000px)
{
@media screen and (min-width: 2000px) {
.about .cols
{
column-count: 4;
@ -35,39 +23,33 @@
-webkit-column-count: 4;
}
}*/
.about .box
{
margin-bottom: 1em;
padding: 2em;
.about .box {
margin-bottom: 16px;
padding: 32px;
}
.about h1
{
.about h1 {
padding: 0;
margin: 0;
font-weight: normal;
font-size: 1.6em;
}
.about h2
{
.about h2 {
text-align: center;
font-size: 1.2em;
font-weight: normal;
margin: 1em;
}
.about h3
{
.about h3 {
text-align: center;
font-size: 1.2em;
font-weight: normal;
padding: 1em;
color: #00796B;
}
.about p
{
.about p {
margin: 1em 0;
}
.about p.summary
{
.about p.summary {
max-width: 26em;
text-align: center;
background-color: #FF8;
@ -79,8 +61,7 @@
/* Images */
.about img
{
.about img {
max-width: 90%;
text-align: center;
padding: 1em;
@ -90,16 +71,13 @@
.about img[alt="producers"],
.about img[alt="4_control"],
.about img[alt="dealer"],
.about img[alt="goods_transport"]
{
.about img[alt="goods_transport"] {
float: right;
}
.about img[alt="2_control"]
{
.about img[alt="2_control"] {
float: left;
}
.about img[alt="glass"]
{
.about img[alt="glass"] {
display: inline;
padding: 0;
padding-left: 0.9em;

View File

@ -3,7 +3,7 @@
<h1><t>About</t></h1>
</div>
<div id="form" class="about">
<div class="cols">
<div class="cols vn-w-lg">
<div class="box">
<h1>
<t>QualityAndVariety</t>

View File

@ -1,46 +1,40 @@
Hedera.Contact = new Class
({
Hedera.Contact = new Class({
Extends: Hedera.Form
,activate: function ()
{
,activate: function() {
var self = this;
this.$('contact-form').onsubmit = function ()
{ self._onSubmit (); return false; };
this.refreshCaptcha ();
}
,refreshCaptcha: function ()
{
params = {
'srv': 'rest:core/captcha',
'stamp': new Date ().getTime ()
this.$.contactForm.onsubmit = function() {
self._onSubmit(); return false;
};
this.$('captcha-img').src = '?'+ Vn.Url.makeUri (params);
this.refreshCaptcha();
}
,_onSubmit: function ()
{
this.conn.sendForm (this.$('contact-form'),
this._onResponse.bind (this));
,refreshCaptcha: function() {
params = {
srv: 'rest:misc/captcha',
stamp: new Date().getTime()
};
this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params);
}
,_onResponse: function (json, error)
{
var form = this.$('contact-form');
if (json)
{
form.reset ();
Htk.Toast.showMessage (_('DataSentSuccess'));
,_onSubmit: function() {
this.conn.sendForm(this.$.contactForm,
this._onResponse.bind(this));
}
else
Htk.Toast.showError (_('ErrorSendingData'));
,_onResponse: function(json) {
var form = this.$.contactForm;
if (json) {
form.reset();
Htk.Toast.showMessage(_('DataSentSuccess'));
} else
Htk.Toast.showError(_('ErrorSendingData'));
form['captcha'].value = '';
this.refreshCaptcha ();
this.refreshCaptcha();
}
});

View File

@ -1,55 +1,38 @@
.contact
{
padding: 1em;
}
.contact .box
{
max-width: 30em;
padding: 2em;
}
.contact .form
{
.contact .form {
position: relative;
text-align: left;
max-width: 25em;
margin: 0 auto;
}
.contact form
{
.contact form {
margin: 0 auto;
}
.contact form p
{
.contact form p {
margin: 1em auto;
display: block;
margin-top: 2em;
}
.contact textarea
{
.contact textarea {
height: 5em;
}
.contact button
{
.contact button {
display: block;
margin: 0 auto;
margin-top: 1em;
padding: 0.6em;
}
.contact .mandatory-message
{
.contact .mandatory-message {
font-size: .9em;
}
/* Captcha */
.captcha img
{
.captcha img {
vertical-align: middle;
margin-left: 1em;
}
.captcha input
{
.captcha input {
max-width: 8em;
}

View File

@ -3,16 +3,10 @@
<h1><t>IWantCustomer</t></h1>
</div>
<div id="form" class="contact">
<div class="box">
<div class="form">
<p>
<t>FillFormData</t>
</p>
<p>
<t>OrCallUs</t>
</p>
<form
id="contact-form">
<div class="box form vn-w-xs vn-pa-lg">
<p><t>FillFormData</t></p>
<p><t>OrCallUs</t></p>
<form id="contact-form">
<input type="hidden" name="srv" value="json:misc/contact"/>
<div class="form-group">
<label><t>Name</t></label>
@ -46,11 +40,10 @@
<p class="mandatory-message">
<t>AllFieldsMandatory</t>
</p>
<button class="thin">
<button>
<t>Send</t>
</button>
</form>
</div>
</div>
</div>
</vn>

View File

@ -1,9 +1,5 @@
Hedera.Home = new Class({
Extends: Hedera.Form
,onStartOrderClick: function() {
this.hash.set({form: 'ecomerce/catalog'});
}
});

View File

@ -1,70 +1,60 @@
.home {
padding: 0 !important;
}
/* News panel */
.column
{
.column {
margin: .5em;
max-width: 120em;
}
.action-bar button.start-order
{
background-color: #EF5350;
margin: .7em;
padding: .5em;
box-shadow: 0 0 0.4em rgba(1, 1, 1, 0.4);
.action-bar button.start-order {
border: 1px solid white;
}
.action-bar button.start-order:hover
{
background-color: #F44336;
.action-bar button.start-order:hover {
background-color: white !important;
color: black;
}
/* New */
.new
{
.new {
text-align: left;
background-color: white;
color: #222;
border: none;
border-radius: 0.1em;
box-shadow: 0 0.2em 0.2em rgba(1, 1, 1, 0.2);
margin: .5em;
}
.new img
{
.new img {
display: block;
margin: auto;
width: 100%;
}
.new .top
{
.new .top {
padding: 1.5em;
padding-bottom: 1px;
}
.new h2
{
.new h2 {
font-size: 1.6em;
color: black;
font-weight: normal;
padding: 0;
}
.new-info
{
.new-info {
font-size: 0.9em;
color: #444;
text-align: right;
margin: 0.8em 0;
margin: .8em 0;
}
.new-text
{
.new-text {
margin: 1.5em 0;
font-family: 'Open Sans';
}
.new-text a
{
color: blue;
.new-text a {
color: #6a1;
}
.new-text a:hover {
text-decoration: underline;
}
.new-text li
{
.new-text li {
margin: 0.4em 0;
}

View File

@ -5,34 +5,33 @@
<div id="actions" class="catalog-actions">
<htk-bar-button
class="start-order"
icon="new-order"
icon="add_shopping_cart"
tip="_Start order"
on-click="onStartOrderClick"/>
on-click="hash.setAll({form: 'ecomerce/catalog'})"/>
</div>
<div id="form" class="home">
<div class="column mansonry" id="news-column">
<htk-repeater form-id="new">
<htk-repeater form-id="iter">
<db-model property="model">
<custom>
SELECT title, text, image, id FROM news
WHERE tag != 'course'
SELECT title, text, image, id
FROM news
ORDER BY priority, created DESC
</custom>
</db-model>
<custom>
<div class="masonry-box">
<div class="new">
<div class="new box">
<htk-image
directory="news"
subdir="full"
form="new"
column="image"
value="{{iter.image}}"
editable="false"
full-dir="full"/>
<div class="top">
<h2><htk-text form="new" column="title"/></h2>
<h2>{{iter.title}}</h2>
<div class="new-text">
<htk-html form="new" column="text"/>
<htk-html value="{{iter.text}}"/>
</div>
</div>
</div>

View File

@ -24,7 +24,7 @@ Hedera.Location = new Class({
}
,onLocationsDone: function(resultSet) {
this.locations = resultSet.fetchResult();
this.locations = resultSet.fetchData();
this.allLoaded();
}
@ -44,12 +44,11 @@ Hedera.Location = new Class({
,center: new google.maps.LatLng(46.0, 4.0)
};
var div = this.$('form');
var div = this.$.form;
var gmap = new google.maps.Map(div, options);
if (this.locations)
while (this.locations.next())
this.createMarker(this.locations, gmap);
for (const location of this.locations)
this.createMarker(location, gmap);
}
,createMarker: function(location, gmap) {
@ -57,28 +56,28 @@ Hedera.Location = new Class({
div.className = 'marker';
var h = document.createElement('h3');
h.appendChild(document.createTextNode(location.get('title')));
h.appendChild(document.createTextNode(location.title));
div.appendChild(h);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('address')));
p.appendChild(document.createTextNode(location.address));
div.appendChild(p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('postcode') +' '+ location.get('city')));
p.appendChild(document.createTextNode(location.postcode +' '+ location.city));
div.appendChild(p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('province')));
p.appendChild(document.createTextNode(location.province));
div.appendChild(p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('phone')));
p.appendChild(document.createTextNode(location.phone));
div.appendChild(p);
var lat = new google.maps.LatLng(
location.get('lat'),
location.get('lng')
location.lat,
location.lng
);
var marker = new google.maps.Marker({
@ -95,7 +94,7 @@ Hedera.Location = new Class({
this.openInfoWindow.bind(this, infoWindow, gmap, marker));
if (Vn.Locale.language
&& Vn.Locale.language == location.get('language'))
&& Vn.Locale.language == location.language)
this.openInfoWindow(infoWindow, gmap, marker);
}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1,59 +0,0 @@
/* News panel */
.column
{
margin: .5em;
max-width: 120em;
}
/* New */
.new
{
text-align: left;
background-color: white;
color: #222;
border: none;
border-radius: 0.1em;
box-shadow: 0 0.2em 0.2em rgba(1, 1, 1, 0.2);
margin: .5em;
}
.new img
{
display: block;
margin: auto;
width: 100%;
}
.new .top
{
padding: 1.5em;
padding-bottom: 1px;
}
.new h2
{
font-size: 1.6em;
color: black;
font-weight: normal;
padding: 0;
}
.new-info
{
font-size: 0.9em;
color: #444;
text-align: right;
margin: 0.8em 0;
}
.new-text
{
margin: 1.5em 0;
}
.new-text a
{
color: blue;
text-decoration: underline;
}
.new-text li
{
margin: 0.4em 0;
}

View File

@ -1,5 +0,0 @@
Hedera.Training = new Class
({
Extends: Hedera.Form
});

View File

@ -1,41 +0,0 @@
<vn>
<div id="title">
<h1><t>Training</t></h1>
</div>
<div id="form" class="training">
<div class="column mansonry" id="news-column">
<htk-repeater form-id="new">
<db-model property="model">
<custom>
SELECT title, created, text, image, id FROM news
WHERE tag = 'course'
ORDER BY priority, created DESC
</custom>
</db-model>
<custom>
<div class="masonry-box">
<div class="new">
<htk-image
directory="news"
subdir="full"
form="new"
column="image"
editable="false"
full-dir="full"/>
<div class="top">
<h2><htk-text form="new" column="title"/></h2>
<p class="new-info">
<htk-text format="_%a, %e %b %Y" form="new" column="created"/>
</p>
<div class="new-text">
<htk-html form="new" column="text"/>
</div>
</div>
</div>
</div>
</custom>
</htk-repeater>
<div class="clear"/>
</div>
</div>
</vn>

View File

@ -1,27 +1,13 @@
.why
{
padding: 1em;
}
.why .box
{
max-width: 40em;
margin: 0 auto;
}
.why ul
{
.why ul {
list-style-type: none;
padding: 0 1em;
padding-bottom: 1em;
max-width: 36em;
margin: 0 auto;
padding: 0;
margin-top: 0;
}
.why li
{
padding: 0.5em 0;
.why li {
padding-bottom: 16px;
}
.why img
{
.why img {
display: block;
margin: 0 auto;
max-width: 95%;

View File

@ -3,9 +3,8 @@
<h1><t>AboutCompany</t></h1>
</div>
<div id="form" class="why">
<div class="box">
<div class="body">
<ul>
<div class="box vn-w-sm vn-pa-lg">
<ul class="vn-mb-lg">
<li><t>BecauseOurBigCatalog</t></li>
<li><t>BecauseThisWeb</t></li>
<li><t>BecauseOurShoppingDep</t></li>
@ -17,6 +16,5 @@
</ul>
<img src="forms/cms/why/store.png" alt="Store photo"/>
</div>
</div>
</div>
</vn>

View File

@ -1,58 +1,36 @@
Hedera.Basket = new Class
({
Hedera.Basket = new Class({
Extends: Hedera.Form
,open: function ()
{
this.close ();
,open: function() {
this.close();
this.isOpen = true;
Hedera.BasketChecker.check (this.conn,
this.onBasketCheck.bind (this));
Hedera.BasketChecker.check(this.conn, this.hash,
this.onBasketCheck.bind(this));
}
,onBasketCheck: function (isOk)
{
,onBasketCheck: function(isOk) {
if (isOk)
this.loadUi ();
this.loadUi();
}
,activate: function ()
{
this.$('items').setInfo ('bi', 'myBasketItem', 'hedera');
,activate: function() {
this.$.items.setInfo('bi', 'myBasketItem', 'hedera');
}
,onConfigureClick: function ()
{
Htk.Toast.showWarning (_('RememberReconfiguringImpact'));
this.hash.set ({form: 'ecomerce/checkout'});
,onConfigureClick: function() {
Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
this.hash.setAll({form: 'ecomerce/checkout'});
}
,onCatalogClick: function ()
{
this.hash.set ({form: 'ecomerce/catalog'});
,onDeleteClick: function(form) {
if (confirm(_('ReallyDelete')))
form.deleteRow();
}
,onCheckoutClick: function ()
{
this.hash.set ({form: 'ecomerce/confirm'});
}
,repeaterFunc: function (res, form)
{
res.$('subtotal').value = this.subtotal (form);
}
,onDeleteClick: function (button, form)
{
if (confirm (_('ReallyDelete')))
form.deleteRow ();
}
,subtotal: function (form)
{
return form.get ('amount') * form.get ('price');
,subtotal: function(form) {
return form.$.amount * form.$.price;
}
});

View File

@ -1,91 +1,65 @@
.basket
{
padding: 1em;
.basket .head {
border-bottom: 1px solid #DDD;
}
.basket .box
{
max-width: 30em;
margin: 0 auto;
padding: 0 2em;
.basket .head p {
font-weight: bold;
margin: 0;
padding: 0;
font-size: 1.4em;
text-align: right;
}
.basket .form > p
{
.basket .form > p {
margin: 0;
font-size: 1.4em;
color: white;
text-align: right;
}
.basket .head
{
padding: 1.8em 0;
margin: 0;
border-bottom: 1px solid #DDD;
}
.basket .head p
{
margin: 0;
padding: 0;
font-size: 1.4em;
text-align: right;
}
/* Lines */
.basket .lines
{
padding: .8em 0;
.basket .line {
display: flex;
gap: 20px;
margin: 24px 0;
height: 65px;
}
.basket .line
{
padding: 1em 0;
.basket .line:last-child {
margin-bottom: 0;
}
.basket .line > .delete
{
margin: -0.5em;
margin-top: 1em;
margin-right: .5em;
float: left;
.basket .line > .delete {
align-self: center;
}
.basket .line > .photo
{
margin-right: 1em;
float: left;
.basket .line > .photo {
flex: none;
border-radius: 50%;
height: 4.25em;
width: 4.25em;
width: 65px;
}
.basket .line > .info
{
margin-left: 7.5em;
.basket .line > .info {
flex: 1;
}
.basket .line > .info > h2
{
.basket .line > .info > h2 {
font-size: 1em;
font-weight: normal;
padding: 0;
padding-bottom: .1em;
}
.basket .line > .info > p
{
.basket .line > .info > p {
margin: 0;
}
.basket .line > .info > .tags
{
.basket .line > .info > .tags {
color: #777;
}
.basket .line .subtotal
{
.basket .line .subtotal {
float: right;
}
/* Fields */
.basket td.available-exceeded input
{
.basket td.available-exceeded input {
background-color: #FCC;
}
.basket .icon > img
{
.basket .icon > img {
border-radius: 50%;
}

View File

@ -4,21 +4,21 @@
</div>
<div id="actions">
<htk-bar-button
icon="ok"
tip="_Checkout"
on-click="onCheckoutClick"/>
<htk-bar-button
icon="view-dual"
tip="_Catalog"
on-click="onCatalogClick"/>
<htk-bar-button
icon="preferences"
icon="settings"
tip="_ConfigureOrder"
on-click="onConfigureClick"/>
on-click="this.onConfigureClick()"/>
<htk-bar-button
icon="local_florist"
tip="_Catalog"
on-click="this.hash.setAll({form: 'ecomerce/catalog'})"/>
<htk-bar-button
icon="shopping_cart_checkout"
tip="_Checkout"
on-click="this.hash.setAll({form: 'ecomerce/confirm'})"/>
</div>
<div id="form" class="basket">
<div class="box">
<div class="head">
<div class="box vn-w-sm vn-pa-lg">
<div class="head vn-pb-lg">
<p>
<t>Total</t>
<htk-text format="%.2d€">
@ -27,7 +27,7 @@
</p>
</div>
<div class="lines">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<htk-repeater form-id="iter">
<db-model id="items" property="model" updatable="true">
SELECT bi.id, bi.amount, bi.price, i.longName item,
i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7,
@ -41,38 +41,29 @@
<custom>
<div class="line">
<htk-button
form="iter"
column="id"
class="delete"
tip="_Remove"
icon="delete"
on-click="onDeleteClick"/>
on-click="this.onDeleteClick($iter)"/>
<htk-image
form="iter"
column="image"
value="{{iter.image}}"
stamp-column="updated"
class="photo"
directory="catalog"
subdir="200x200"
full-dir="1600x900"/>
<div class="info">
<h2>
<htk-text form="iter" column="item"/>
</h2>
<h2>{{iter.item}}</h2>
<p class="tags">
<htk-text form="iter" column="value5"/>
<htk-text form="iter" column="value6"/>
<htk-text form="iter" column="value7"/>
{{iter.value5}} {{iter.value6}} {{iter.value7}}
</p>
<p class="amount">
<htk-text form="iter" column="amount"/> x
<htk-text form="iter" column="price" format="%.2d€"/>
{{iter.amount}} x {{Vn.Value.format(iter.price, '%.2d€')}}
<span class="subtotal">
<htk-text id="subtotal" format="%.2d€"/>
{{Vn.Value.format(iter.price * iter.amount, '%.2d€')}}
</span>
</p>
</div>
<div class="clear"/>
</div>
</custom>
</htk-repeater>

View File

@ -9,7 +9,7 @@ Hedera.Catalog = new Class({
this.isOpen = true;
if (!localStorage.getItem('hederaGuest')) {
Hedera.BasketChecker.check(this.conn,
Hedera.BasketChecker.check(this.conn, this.hash,
this.onBasketCheck.bind(this));
} else {
var query = 'CALL mybasket_configureForGuest';
@ -23,40 +23,143 @@ Hedera.Catalog = new Class({
}
,activate: function() {
document.body.appendChild(this.$('right-panel'));
this.$('items-model').setInfo('i', 'item', 'vn', ['id']);
document.body.appendChild(this.$.rightPanel);
this.$.items.setInfo('i', 'item', 'vn', ['id']);
if (localStorage.getItem('hederaView'))
this.setView(parseInt(localStorage.getItem('hederaView')));
else
this.setView(Hedera.Catalog.View.GRID);
this.onFilterChange();
}
,deactivate: function() {
this.hideMenu();
this.gui.$('top-bar').style.backgroundColor = '';
Vn.Node.remove(this.$('right-panel'));
this.gui.$.topBar.style.backgroundColor = '';
Vn.Node.remove(this.$.rightPanel);
}
,getFilter(params, tags, currentTag) {
if (params.search == null && params.type == null)
return null;
const $ = this.$;
params = Object.assign({}, params);
const filter = new Sql.Operation({
type: Sql.Operation.Type.AND
});
let idSearch = false;
if (params.search != null) {
idSearch = /^\d+$/.test(params.search);
if (!idSearch) {
filter.push($.searchOp);
params.search = `%${params.search}%`;
} else
filter.push($.idOp);
}
if (!idSearch) {
if (params.realm != null)
filter.push($.realmOp);
if (params.type != null)
filter.push($.typeOp);
for (const tag of tags)
if (tag != currentTag && params[tag] != null)
filter.push($[`${tag}Op`]);
}
params.filter = filter;
const lot = new Vn.Lot();
lot.setAll(params);
return lot;
}
,onFilterChange: function() {
const $ = this.$;
const params = $.params.$;
this.refreshTitle();
const hasRealm = params.realm != null;
$.filters.style.display = hasRealm ? 'block' : 'none';
$.realmMsg.style.display = hasRealm ? 'none' : 'block';
const tags = [
'color',
'origin',
'category',
'producer'
];
const lot = this.getFilter(params, tags);
if (lot) {
$.items.lot = lot;
$.items.refresh();
} else
$.items.clean();
for (const tag of tags)
$[`${tag}s`].lot = this.getFilter(params, tags, tag);
if (lot) this.hideMenu();
}
,refreshTitle: function() {
const hash = this.hash.$;
const types = this.$.types;
const realms = this.$.realms;
const type = hash.type;
const realm = hash.realm;
let typeName;
let realmName;
if (type && types.ready) {
var row = types.search('id', type);
if (row != -1) typeName = types.get(row, 'name');
}
if (realm && realms.ready) {
var row = realms.search('id', realm);
if (row != -1) realmName = realms.get(row, 'name');
}
let title = _('Catalog');
let subtitle = '';
if (typeName) {
title = typeName;
subtitle = realmName;
} else if (realmName) {
title = realmName;
}
Vn.Node.setText(this.$.titleText, title);
Vn.Node.setText(this.$.subtitle, subtitle);
}
,setView: function(view) {
if (view === Hedera.Catalog.View.GRID) {
this.$('view-button').setProperties({
icon: 'view-list',
this.$.viewButton.setProperties({
icon: 'view_list',
tip: _('List view')
});
this.view = Hedera.Catalog.View.GRID;
var className = 'grid-view';
} else {
this.$('view-button').setProperties({
icon: 'view-grid',
this.$.viewButton.setProperties({
icon: 'grid_on',
tip: _('Grid view')
});
this.view = Hedera.Catalog.View.LIST;
var className = 'list-view';
}
var node = this.$('grid-view').node;
var node = this.$.gridView.node;
node.className = className;
localStorage.setItem('hederaView', this.view);
}
@ -66,18 +169,11 @@ Hedera.Catalog = new Class({
Hedera.Catalog.View.GRID : Hedera.Catalog.View.LIST);
}
,onBasketReady: function(form) {
if (form.get('method') != 'PICKUP')
Vn.Node.setText(this.$('method'), _('Agency'));
else
Vn.Node.setText(this.$('method'), _('Warehouse'));
}
,onItemsChange: function(model, status) {
if (status !== Db.Model.Status.CLEAN)
this.$('order').style.display = 'block';
this.$.order.style.display = 'block';
else
this.$('order').style.display = 'none';
this.$.order.style.display = 'none';
}
,onOrderChange: function(e) {
@ -87,98 +183,17 @@ Hedera.Catalog = new Class({
Db.Model.SortWay.ASC : Db.Model.SortWay.DESC;
if (sortField)
this.$('items-model').sortByName(sortField, sortWay);
this.$.items.sortByName(sortField, sortWay);
this.hideMenu();
}
,onFilterChange: function(param, newValue) {
if (newValue)
this.hideMenu();
}
,realmRenderer: function(builder, form) {
var link = builder.$('link');
var link = builder.$.link;
link.href = this.hash.make({
'form': this.hash.get('form'),
'realm': form.get('id')
form: this.hash.$.form,
realm: form.$.id
});
var img = builder.$('image');
img.src = 'image/family/light/'+ form.get('code') +'.svg';
img.title = form.get('name');
img.alt = img.title;
}
,onRealmChange: function(param, newValue) {
if (newValue) {
this.$('filters').style.display = 'block';
this.$('realm-msg').style.display = 'none';
} else {
this.$('filters').style.display = 'none';
this.$('realm-msg').style.display = 'block';
}
this.refreshTitleColor();
this.refreshFilter(newValue, undefined);
}
,onTypeChange: function(param, newValue) {
this.onFilterChange(param, newValue);
this.refreshTitle();
this.refreshFilter(undefined, newValue);
}
,refreshFilter: function(realm, type) {
var batch = this.$('filter-batch');
batch.block();
this.$('realm-value').value = realm;
this.$('type-value').value = type;
this.$('search').value = undefined;
this.$('color').value = undefined;
this.$('origin').value = undefined;
this.$('category').value = undefined;
this.$('producer').value = undefined;
batch.unblock();
batch.changed();
}
,refreshTitleColor: function() {
var realms = this.$('realms-model');
if (!realms.ready)
return;
var color = null;
var realm = this.$('realm').value;
if (realm) {
var row = realms.search('id', realm);
if (row != -1)
color = '#'+ realms.get(row, 'color');
}
this.gui.$('top-bar').style.backgroundColor = color;
}
,refreshTitle: function() {
var types = this.$('types-model');
if (!types.ready)
return;
var title = _('Catalog');
var type = this.$('type').value;
if (type) {
var row = types.search('id', type);
if (row != -1)
title = types.get(row, 'name');
}
Vn.Node.setText(this.$('title-text'), title);
}
,onRightPanelClick: function(event) {
@ -189,7 +204,7 @@ Hedera.Catalog = new Class({
this._menuShown = true;
event.stopPropagation();
this.gui.showBackground();
Vn.Node.addClass(this.$('right-panel'), 'show');
Vn.Node.addClass(this.$.rightPanel, 'show');
this.hideMenuCallback = this.hideMenu.bind(this);
document.addEventListener('click', this.hideMenuCallback);
}
@ -199,7 +214,7 @@ Hedera.Catalog = new Class({
return;
this.gui.hideBackground();
Vn.Node.removeClass(this.$('right-panel'), 'show');
Vn.Node.removeClass(this.$.rightPanel, 'show');
document.removeEventListener('click', this.hideMenuCallback);
this.hideMenuCallback = null;
}
@ -217,34 +232,29 @@ Hedera.Catalog = new Class({
if (this.isGuest())
return;
this.hash.set({'form': 'ecomerce/basket'});
this.hash.setAll({form: 'ecomerce/basket'});
}
,onConfigureClick: function() {
if (this.isGuest())
return;
this.hash.set({'form': 'ecomerce/checkout'});
this.hash.setAll({form: 'ecomerce/checkout'});
}
,repeaterFunc: function(res, form) {
res.$('item-box').addEventListener('click',
this.onAddItemClick.bind(this, form));
}
,onAddItemClick: function(form, event) {
,onAddItemClick: function(event, form) {
if (event.defaultPrevented) return;
event.preventDefault();
if (this.isGuest()) return;
this.onEraseClick();
this.$('card').row = form.row;
this.$('card-item').value = form.get('id');
this.$('card-popup').show(event.currentTarget);
this.$.$card.row = form.row;
this.$.cardLot.assign({item: form.$.id});
this.$.cardPopup.show(event.currentTarget);
}
,onAddLotClick: function(column, value, row) {
var model = this.$('item-lots');
var model = this.$.itemLots;
var grouping = model.get(row, 'grouping');
var warehouse = model.get(row, 'warehouseFk');
var available = model.get(row, 'available');
@ -261,14 +271,13 @@ Hedera.Catalog = new Class({
newAmount = available;
this.items[warehouse] = newAmount;
this.$('amount').value += newAmount - lotAmount;
this.$.amount.value += newAmount - lotAmount;
} else
Htk.Toast.showError(_('NoMoreAmountAvailable'));
}
,onConfirmClick: function() {
var sql = '';
var batch = new Sql.Batch();
var query = new Sql.String({query: 'CALL myBasket_addItem(#warehouse, #item, #amount);'});
var amountSum = 0;
@ -276,36 +285,38 @@ Hedera.Catalog = new Class({
var amount = this.items[warehouse];
amountSum += amount;
batch.addValue('warehouse', warehouse);
batch.addValue('item', this.$('card-item').value);
batch.addValue('amount', amount);
sql += query.render(batch);
const params = {
warehouse: warehouse,
item: this.$.cardLot.$.item,
amount: amount
}
sql += query.render(params);
}
if (amountSum > 0) {
this.conn.execQuery(sql);
var itemName = this.$('card').get('item');
var itemName = this.$.$card.get('item');
Htk.Toast.showMessage(
sprintf(_('Added%dOf%s'), amountSum, itemName));
Vn.Value.sprintf(_('Added%dOf%s'), amountSum, itemName));
}
this.$('card-popup').hide();
this.$.cardPopup.hide();
}
,onEraseClick: function() {
this.$('amount').value = 0;
this.$.amount.value = 0;
this.items = {};
}
,onPopupClose: function() {
this.onEraseClick();
this.$('card').row = -1;
this.$('card-item').value = undefined;
this.$.$card.row = -1;
this.$.cardLot.value = undefined;
}
,onCardLoad: function() {
this.$('card-popup').reset();
this.$.cardPopup.reset();
}
});
@ -315,161 +326,3 @@ Hedera.Catalog.extend({
GRID: 1
}
});
Vn.Filter = new Class({
Extends: Htk.Field
,Tag: 'vn-filter'
,Child: 'model'
,Properties:
{
model:
{
type: Db.Model
,set: function(x) {
x.batch = this._batch;
this._model = x;
this._select.model = x;
}
,get: function() {
return this._model;
}
},
placeholder:
{
type: String
,set: function(x) {
this._select.placeholder = x;
this._placeholder = x;
}
,get: function() {
return this._placeholder;
}
},
filter:
{
type: Sql.Filter
,set: function(x) {
this._filter = x;
this._batch.addObject('filter', x);
}
,get: function() {
return this._filter;
}
},
}
,_valueColumnIndex: 0
,_showColumnIndex: 1
,initialize: function(props) {
var node = this.createRoot('div');
node.className = 'vn-filter';
this._select = new Htk.Select();
this._select.on('mousedown', this._onMouseDown, this);
this._select.on('changed', this._onChange, this);
this._select.on('ready', this._onReady, this);
this.node.appendChild(this._select.node);
this._ul = this.createElement('ul');
this.node.appendChild(this._ul);
this._batch = new Sql.Batch();
this.parent(props);
}
,_onMouseDown: function() {
if (this._model && this._model.status === Db.Model.Status.CLEAN)
this._model.refresh();
}
,_onCloseClick: function() {
this._removeSelectionNode();
this._changeValue(undefined);
}
,_removeSelectionNode: function() {
if (this._lastLi) {
Vn.Node.remove(this._lastLi);
this._lastLi = null;
this._label = null;
}
}
,_onChange: function() {
if (this._select.value === null
|| this._select.value === undefined)
return;
this._realSetValue(this._select.value);
}
,_onReady: function() {
if (this._emptyLabel)
this._refreshLabel();
}
,_changeValue: function(newValue) {
this._batch.block();
this.value = newValue;
this._batch.unblock();
}
,_onTimeout: function() {
this._select.value = null;
}
,putValue: function(value) {
this._onMouseDown();
this._realSetValue(value);
}
,_realSetValue: function(value) {
this._removeSelectionNode();
if (value === null || value === undefined)
return;
var li = this._lastLi = this.createElement('li');
this._ul.appendChild(li);
var button = this.createElement('button');
button.addEventListener('click',
this._onCloseClick.bind(this, li));
li.appendChild(button);
var icon = new Htk.Icon({
icon: 'close',
alt: _('Close')
});
button.appendChild(icon.node);
var text = this._label = this.createTextNode('');
li.appendChild(text);
setTimeout(this._onTimeout.bind(this));
this._changeValue(value);
this._refreshLabel();
}
,_refreshLabel: function() {
if (!this._label)
return;
var row = -1;
if (this._model.ready)
row = this._model.searchByIndex(this._valueColumnIndex, this._value);
if (row != -1) {
var label = this._model.getByIndex(row, this._showColumnIndex);
this._label.nodeValue = label;
this._emptyLabel = false;
} else {
this._emptyLabel = true;
this._label.nodeValue = _('Loading...');
}
}
});

View File

@ -2,7 +2,7 @@ Catalog: Catàleg
SearchResults: Resultats de cerca
SelectFamily: Selecciona una família
Choose filter from right menu: Tria un filtre en el menú de la dreta
Choose a realm: Tria un regne
Choose a realm: Tria un categoria
ArticleNotFound: Artcle no trobat
ArticleNotAvailable: Article no disponible
List view: Vista de lista
@ -15,7 +15,7 @@ Warehouse: Magatzem
Filter by: Filtrar per
Order by: Ordenar per
Search: Cercar
Change: Cambiar
Modify: Modificar
Size: Mida
Realm: Regne
Family: Família
@ -35,6 +35,7 @@ Lower size: Mida més petita
Higher size: Mida més gran
'%.0d Units': '%.0d Unitats'
for: per
Zoom image: Ampliar imatge
AddToBasket: Afegir article
Add: Afegir
Erase: Esborrar

View File

@ -2,7 +2,7 @@ Catalog: Catalog
SearchResults: Search results
SelectFamily: Select family
Choose filter from right menu: Choose a filter from the right menu
Choose a realm: Choose a realm
Choose a realm: Choose a category
ArticleNotFound: Item not found
ArticleNotAvailable: Item not available
List view: List view
@ -15,7 +15,7 @@ Warehouse: Warehouse
Filter by: Filter by
Order by: Order by
Search: Search
Change: Change
Modify: Modify
Size: Size
Realm: Realm
Family: Family
@ -35,6 +35,7 @@ Lower size: Lower size
Higher size: Higher size
'%.0d Units': '%.0d Units'
for: for
Zoom image: Zoom image
AddToBasket: Add to basket
Add: Add
Erase: Remove

View File

@ -2,7 +2,7 @@ Catalog: Catálogo
SearchResults: Resultados de búsqueda
SelectFamily: Selecciona una familia
Choose filter from right menu: Elige un filtro en el menú de la derecha
Choose a realm: Elige un reino
Choose a realm: Elige una categoría
ArticleNotFound: Artículo no encontrado
ArticleNotAvailable: Artículo no disponible
List view: Vista de lista
@ -15,7 +15,7 @@ Warehouse: Almacén
Filter by: Filtrar por
Order by: Ordenar por
Search: Buscar
Change: Cambiar
Modify: Modificar
Size: Medida
Realm: Reino
Family: Familia
@ -35,6 +35,7 @@ Higher size: Medida más grande
Relevancy: Relevancia
'%.0d Units': '%.0d Unidades'
for: por
Zoom image: Ampliar imagen
AddToBasket: Añadir artículo
Add: Añadir
Erase: Borrar

View File

@ -2,7 +2,7 @@ Catalog: Catalogue
SearchResults: Résultats de la recherche
SelectFamily: Choisissez une famille
Choose filter from right menu: Choisissez un filtre dans le menu de droite
Choose a realm: Choisissez un royaume
Choose a realm: Choisissez une catégorie
ArticleNotFound: Article non trouvé
ArticleNotAvailable: Article non disponible
List view: Liste voir
@ -15,7 +15,7 @@ Warehouse: Entrepôt
Filter by: Filtrer par
Order by: Trier par
Search: Recherche
Change: Modifier
Modify: Modifier
Size: Mesure
Realm: Famille
Family: Sous-genre
@ -35,6 +35,7 @@ Lower size: Taille le plus bas
Higher size: Taille le plus élevé
'%.0d Units': '%.0d Unités'
for: pour
Zoom image: Agrandir l'image
AddToBasket: Ajouter article
Add: Ajouter
Erase: Effacer

View File

@ -2,7 +2,7 @@ Catalog: Catálogo
SearchResults: Resultados de busca
SelectFamily: Seleccione uma família
Choose filter from right menu: Escolha um filtro no menú da direita
Choose a realm: Escolha um reino
Choose a realm: Escolha uma categoria
ArticleNotFound: Ítem não encontrado
ArticleNotAvailable: Ítem não disponível
List view: Ver como lista
@ -15,7 +15,7 @@ Warehouse: Armazém
Filter by: Filtrar por
Order by: Ordenar por
Search: Buscar
Change: Modificar
Modify: Modificar
Size: Medida
Realm: Reino
Family: Família
@ -35,6 +35,7 @@ Lower size: Tamanho menor
Higher size: Tamanho maior
'%.0d Units': '%.0d Unidades'
por: para
Zoom image: Mais zoom
AddToBasket: Adicionar à Cesta
Add: Adicionar
Erase: Eliminar

View File

@ -1,180 +1,131 @@
.catalog
{
margin-right: 17em;
.catalog {
margin-right: 18em;
}
/* Topbar */
.catalog-actions > .htk-search-entry
{
margin-top: .8em;
margin-right: .4em;
}
/* Right panel */
.right-panel
{
position: fixed;
top: 3.9em;
bottom: 0;
right: 0;
width: 17em;
background-color: white;
box-shadow: 0 0 .2em rgba(1, 1, 1, .2);
overflow: auto;
}
.right-panel .basket-info
{
background-color: #00ACC1;
color: white;
box-shadow: 0 .1em .1em rgba(1, 1, 1, .3);
padding: 1.2em 2em;
}
.right-panel .basket-info > button
{
color: #E0F2F1;
margin: 0 auto;
display: block;
margin-top: .4em;
}
.right-panel .basket-info > p
{
margin: 0;
padding: .4em 0;
font-size: 1.1em;
text-align: left;
.title ._subtitle {
font-size: .7rem;
color: #bbb;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.right-panel .filter
{
padding: 1em;
/* Right panel */
.right-panel {
position: fixed;
top: 4.4em;
bottom: 0;
right: 0;
width: 18em;
overflow: auto;
background-color: #fafafa;
}
.right-panel .basket-info {
background-color: #8cc63f;
color: white;
padding: 1.2em 2em;
border-radius: .5em;
margin: 1em;
text-align: center;
}
.right-panel .basket-info > button {
color: white;
background-color: rgba(0, 0, 0, .1);
margin: 0 auto;
display: block;
margin-top: 10px;
padding: 10px 15px;
}
.right-panel .basket-info > button:hover {
background-color: white;
color: #60872c;
}
.right-panel .basket-info > p {
margin: 0;
padding: .4em 0;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.right-panel .filter {
margin: 1em;
}
.right-panel .categories,
.right-panel .filters,
.right-panel .order {
margin: 1.5em 0;
}
.right-panel .filters,
.right-panel .order
{
.right-panel .order {
display: none;
}
.right-panel .realm-msg
{
.right-panel .realm-msg {
margin-top: 1em;
}
.right-panel .realm-msg > h1
{
.right-panel .realm-msg > h5 {
font-weight: normal;
text-align: center;
padding: 2.5em 0;
color: #777;
}
.right-panel h2
{
.right-panel h2 {
font-weight: normal;
padding: .4em 0;
color: #777;
font-size: 1.1em;
}
.right-panel .realms > div > div
{
.right-panel .realms > div > div {
text-align: center;
}
.right-panel .realms a
{
.right-panel .realms a {
display: inline-block;
width: 30%;
width: 25%;
padding: .6em;
box-sizing: border-box;
border-radius: 50%;
}
.right-panel .realms a:hover
{
.right-panel .realms a:hover {
background-color: rgba(1, 1, 1, .05);
border-radius: .15em;
}
.right-panel .realms a > img
{
.right-panel .realms a > img {
display: block;
padding: 0;
width: 100%;
}
.right-panel .vn-filter,
.right-panel select
{
margin: 0 auto;
margin-bottom: .7em;
width: 90%;
display: block;
}
.vn-filter > ul
{
margin: 0;
list-style-type: none;
text-align: left;
color: #666;
padding-left: .8em;
}
.vn-filter li
{
margin: 0;
margin-top: .3em;
line-height: 2em;
max-width: 90%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.vn-filter li > button
{
vertical-align: middle;
text-align: center;
padding: .2em;
margin: 0;
margin-right: .2em;
}
.right-panel .filters > button
{
display: block;
margin: 0 auto;
.right-panel .filters > button {
margin-top: 1em;
}
/* Items */
.item-box
{
transition: background-color 200ms ease-in;
.item-box {
display: flex;
box-sizing: border-box;
}
.item-box:hover
{
cursor: pointer;
background-color: #eee;
.item-box > .htk-image {
flex: none;
}
.item-info
{
.item-box > .item-info {
flex: auto;
position: relative;
}
.item-info .second-category
{
.item-info .second-category {
font-weight: bold;
color: orange;
}
.item-info .third-category
{
.item-info .third-category {
font-weight: bold;
color: red;
}
.item-info > h2
{
.item-info > h2 {
padding: 0;
margin-bottom: .15em;
font-weight: normal;
font-size: 1em;
text-overflow: ellipsis;
overflow: hidden;
max-height: 3.8em;
max-height: 3em;
}
.item-info > p
{
.item-info > p {
margin: 0;
padding: 0;
color: #777;
@ -183,24 +134,29 @@
white-space: nowrap;
overflow: hidden;
}
.item-info .sub-name
{
.item-info .sub-name {
text-transform: uppercase;
padding: 0;
margin-bottom: .2em;
font-size: .9em;
}
.item-info > .htk-button
{
.item-info > .htk-button {
margin: -0.3em;
padding: .3em;
}
.item-info > .htk-button > img
{
.item-info > .htk-button > img {
vertical-align: middle;
}
.item-info .available-price
{
.item-info .item-id {
float: right;
font-size: .8rem;
line-height: 1.8em;
color: #777;
}
.item-info .available-price {
position: absolute;
bottom: 0;
right: 0;
white-space: nowrap;
font-size: .95em;
text-align: right;
@ -208,32 +164,27 @@
column-gap: .2em;
display: flex;
}
.item-info .available-price > *
{
.item-info .available-price > * {
border-radius: .2em;
padding: .3em;
padding: .1em .3em;
border: .1em transparent solid;
background-color: white;
box-sizing: border-box;
}
.item-info .grouping
{
width: 2em;
.item-info .grouping {
width: 38px;
background-color: #ddd;
}
.item-info .available
{
width: 3.3em;
.item-info .available {
width: 65px;
border-color: #bbb;
color: #777;
}
.item-info .price
{
width: 4em;
.item-info .price {
width: 75px;
border-color: #9cbc28;
color: #748c1e;
}
.tags
{
.tags {
font-size: .8em;
display: table;
color: #333;
@ -246,129 +197,38 @@
padding-right: .5em;
}
/* List view */
.list-view
{
max-width: 30em;
margin: 0 auto;
padding: 1em;
}
.list-view .item-box
{
display: block;
position: relative;
width: 100%;
margin: 0;
height: 5.5em;
overflow: visible;
border-bottom: 1px solid #DDD;
}
.list-view .item-box > .htk-image
{
margin: 1em;
width: 3.5em;
height: 3.5em;
float: left;
overflow: hidden;
}
.list-view .item-box > .htk-image > img
{
border-radius: 50%;
}
.list-view .item-info
{
position: absolute;
left: 5.5em;
right: 0;
top: 0;
bottom: 0;
margin: .8em;
margin-left: 0;
}
.list-view .item-info > h2
{
font-size: 1em;
white-space: nowrap;
}
.list-view .item-info > .color
{
display: none;
}
.list-view .item-info > .htk-button
{
float: right;
}
.list-view .item-info .available-price
{
clear: both;
float: right;
position:absolute;
bottom: 0;
right: 0;
}
.list-view .item-info .tags
{
display: block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.list-view .item-info .tags > tr
{
display: inline-block;
}
.list-view .item-info .tags td
{
display: inline-block;
padding-right: .5em;
}
.list-view .item-info .tags td:first-child
{
display: none;
}
/* Grid view */
.grid-view
{
padding: 1em;
padding-right: .2em;
padding-bottom: .4em;
text-align: center;
.grid-view > * {
display: flex;
gap: 16px;
flex-wrap: wrap;
justify-content: center;
}
.grid-view .item-box
{
text-align: left;
position: relative;
display: inline-block;
width: 24em;
margin: 0;
margin-right: .8em;
margin-bottom: .6em;
height: 11em;
.grid-view .item-box {
border-radius: .6em;
box-shadow: .05em .05em .2em rgba(0, 0, 0, .1);
overflow: hidden;
background-color: white;
flex-direction: column;
width: 260px;
height: 425px;
overflow: hidden;
}
.grid-view .item-box > .htk-image
{
width: 11em;
height: 100%;
float: left;
.grid-view .item-box:hover {
background-color: #efefef;
}
.grid-view .item-info
{
position: absolute;
left: 11.4em;
right: 0;
top: 0;
bottom: 0;
margin: .6em;
.grid-view .item-info {
margin: 10px;
}
.grid-view .item-info .available-price
{
position: absolute;
bottom: 0;
right: 0;
.grid-view .item-box > .htk-image {
width: 260px;
height: 260px;
}
.grid-view .item-box > .item-info {
flex: auto;
overflow: hidden;
}
.grid-view .item-info .tags td {
overflow: hidden;
@ -379,109 +239,138 @@
line-height: 1.1em;
}
/* List view */
.list-view {
border-radius: .6em;
box-shadow: .05em .05em .2em rgba(0, 0, 0, .1);
overflow: hidden;
background-color: white;
max-width: 544px;
margin: 0 auto;
}
.list-view .item-box {
gap: 10px;
margin: 0;
padding: 10px;
height: 130px;
overflow: visible;
border-bottom: 1px solid #DDD;
}
.list-view .item-box:last-child {
border-bottom: none;
}
.list-view .item-box > .htk-image {
width: 110px;
height: 110px;
border-radius: 50%;
}
.list-view .item-info {
overflow: hidden;
}
.list-view .item-info > h2 {
font-size: 1rem;
white-space: nowrap;
}
.list-view .item-info > .color {
display: none;
}
.list-view .item-info > .htk-button {
float: right;
}
.list-view .item-info .tags {
display: block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.list-view .item-info .tags > tr {
display: inline-block;
}
.list-view .item-info .tags td {
display: inline-block;
padding-right: .5em;
}
.list-view .item-info .tags td:first-child {
display: none;
}
/* Card */
.card-popup
{
.card-popup {
overflow: auto;
}
.item-card
{
.item-card {
font-size: .9em;
width: 20em;
}
.item-card .top
{
.item-card .top {
padding: 1em;
}
.item-card .item-info
{
.item-card .item-info {
margin-left: 9em;
height: 8em;
}
.item-card .htk-image
{
.item-card .htk-image {
height: 8em;
width: 8em;
float: left;
border-radius: .3em;
}
.item-card .desc
{
.item-card .desc {
clear: both;
margin-top: 1em 0;
font-size: .9em;
}
.item-card .lots-grid
{
.item-card .lots-grid {
border-top: 1px solid #DDD;
}
.item-card .lots-grid tr
{
.item-card .lots-grid tr {
height: 3em;
}
.item-card .lots-grid .cell-spin
{
.item-card .lots-grid .cell-spin {
max-width: initial;
width: 3em;
}
.item-card .lots-grid .price-kg
{
.item-card .lots-grid .price-kg {
font-size: .8em;
color: #999;
width: 1px;
}
.item-card .lots-grid .cell-text
{
.item-card .lots-grid .cell-text {
max-width: initial;
width: auto;
}
.item-card .lots-grid .cell-button
{
.item-card .lots-grid .cell-button {
max-width: initial;
width: 1em;
}
.item-card .footer
{
text-align: center;
background-color: #009688;
.item-card .footer {
display: flex;
align-items: center;
justify-content: space-between;
background-color: #1a1a1a;
color: white;
line-height: 2em;
padding: .4em;
padding: 10px;
}
.item-card .footer > button
{
margin: 0;
.item-card .footer > button:hover {
background-color: rgba(255, 255, 255, .1);
}
.item-card .erase
{
float: left;
}
.item-card .confirm
{
float: right;
}
.item-card .erase > img,
.item-card .confirm > img
{
.item-card .footer > button > .htk-icon {
display: block;
height: 1em;
}
/* Mobile */
.catalog-actions > button.menu
{
.catalog-actions > button.menu {
display: none;
padding: 1.1em .5em;
}
.catalog-actions > button.menu > img
{
height: 1.8em;
.catalog-actions > button.menu > .htk-icon {
display: block;
}
@media (max-width: 960px)
{
@media (max-width: 960px) {
.catalog-actions > button.menu
{
display: block;
@ -489,15 +378,15 @@
.right-panel
{
top: 0;
right: -17em;
right: -18em;
z-index: 20;
transition: transform 200ms ease-out;
-webkit-transition: transform 200ms ease-out;
}
.right-panel.show
{
transform: translateZ(0) translateX(-17em);
-webkit-transform: translateZ(0) translateX(-17em);
transform: translateZ(0) translateX(-18em);
-webkit-transform: translateZ(0) translateX(-18em);
}
.catalog
{

View File

@ -1,46 +1,93 @@
<vn>
<div id="title">
<h1 id="title-text"><t>Catalog</t></h1>
<div id="subtitle"></div>
</div>
<div id="actions" class="catalog-actions">
<htk-search-entry form="params" column="search"/>
<htk-bar-button
id="view-button"
tip="_Switch view"
icon="view_list"
on-click="this.onSwitchViewClick()"/>
<htk-bar-button
icon="shopping_cart_checkout"
tip="_ShoppingBasket"
on-click="this.onBasketClick()"/>
<button
class="menu"
on-click="onShowMenuClick">
<htk-icon name="menu" alt="_Menu"/>
</button>
</div>
<vn-group>
<vn-param id="card-item"/>
<vn-param id="realm" on-changed="onRealmChange"/>
<vn-param id="type" on-changed="onTypeChange"/>
<vn-param id="search" on-changed="onFilterChange"/>
<vn-param id="color" on-changed="onFilterChange"/>
<vn-param id="origin" on-changed="onFilterChange"/>
<vn-param id="category" on-changed="onFilterChange"/>
<vn-param id="producer" on-changed="onFilterChange"/>
<vn-hash-param key="realm" param="realm"/>
<vn-hash-param key="type" param="type"/>
<sql-filter type="AND" id="filter">
<sql-filter-item type="EQUAL" primary="false" id="op-realm">
<sql-field target="t" name="categoryFk"/>
<sql-value id="realm-value"/>
</sql-filter-item>
<sql-filter-item type="EQUAL" id="op-type">
<sql-field target="i" name="typeFk"/>
<sql-value id="type-value"/>
</sql-filter-item>
<sql-filter-item type="LIKE" id="op-name">
<sql-field target="i" name="longName"/>
<sql-search-tags param="search"/>
</sql-filter-item>
<sql-filter-item type="EQUAL" id="op-color">
<sql-field target="i" name="inkFk"/>
<sql-value param="color"/>
</sql-filter-item>
<sql-filter-item type="EQUAL" id="op-origin">
<sql-field target="i" name="originFk"/>
<sql-value param="origin"/>
</sql-filter-item>
<sql-filter-item type="EQUAL" id="op-category">
<sql-field target="i" name="category"/>
<sql-value param="category"/>
</sql-filter-item>
<sql-filter-item type="EQUAL" id="op-producer">
<sql-field target="i" name="producerFk"/>
<sql-value param="producer"/>
</sql-filter-item>
</sql-filter>
<db-form id="basket" on-ready="onBasketReady">
<vn-lot-query id="params" on-change="this.onFilterChange()">
<vn-spec name="search" type="String"/>
<vn-spec name="realm" type="Number"/>
<vn-spec name="type" type="Number"/>
</vn-lot-query>
<vn-lot id="filter-lot"/>
</vn-group>
<vn-group>
<sql-filter-item
id="id-op"
type="EQUAL"
target="i"
field="id"
param="search"/>
<sql-operation
id="search-op"
type="OR">
<sql-filter-item
type="LIKE"
target="i"
field="longName"
param="search"/>
<sql-filter-item
type="LIKE"
target="i"
field="subname"
param="search"/>
</sql-operation>
<sql-filter-item
id="realm-op"
type="EQUAL"
target="t"
field="categoryFk"
param="realm"/>
<sql-filter-item
id="type-op"
type="EQUAL"
target="i"
field="typeFk"
param="type"/>
<sql-filter-item
id="color-op"
type="EQUAL"
target="i"
field="inkFk"
param="color"/>
<sql-filter-item
type="EQUAL"
id="origin-op"
target="i"
field="originFk"
param="origin"/>
<sql-filter-item
type="EQUAL"
id="category-op"
target="i"
field="category"
param="category"/>
<sql-filter-item
id="producer-op"
type="EQUAL"
target="i"
field="producerFk"
param="producer"/>
</vn-group>
<vn-group>
<db-form v-model="basket">
<db-model property="model">
SELECT b.id, b.sent, a.description agency, m.code method
FROM myBasket b
@ -49,7 +96,8 @@
</db-model>
</db-form>
<db-model
id="items-model"
id="items"
auto-load="false"
result-index="3"
on-status-changed="onItemsChange">
DROP TEMPORARY TABLE IF EXISTS tmp.item;
@ -61,7 +109,7 @@
JOIN vn.itemType t ON t.id = i.typeFk
WHERE #filter;
CALL myBasket_calcCatalogFull;
SELECT i.id, i.description, i.longName item, i.subName,
SELECT i.id, i.longName item, i.subName,
i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7,
i.relevancy, i.size, i.category,
k.name ink, p.name producer, o.name origin,
@ -85,87 +133,64 @@
tmp.ticketComponent,
tmp.ticketLot,
tmp.zoneGetShipped;
<sql-batch property="batch" id="filter-batch">
<custom>
<item name="filter" object="filter"/>
</custom>
</sql-batch>
</db-model>
<db-form id="card" model="items-model"/>
<sql-batch id="card-batch">
<custom>
<item name="item" param="card-item"/>
</custom>
</sql-batch>
<db-form id="$card" v-model="card" model="items"/>
<vn-lot id="card-lot"/>
</vn-group>
<div id="title">
<h1 id="title-text"><t>Catalog</t></h1>
</div>
<div id="actions" class="catalog-actions">
<button class="menu" on-click="onShowMenuClick">
<img src="image/icon/dark/menu.svg" alt="_Menu"/>
</button>
<htk-bar-button
icon="basket"
tip="_ShoppingBasket"
on-click="onBasketClick"/>
<htk-bar-button
id="view-button"
tip="_Switch view"
on-click="onSwitchViewClick"/>
<htk-search-entry
param="search"/>
</div>
<div id="form" class="catalog">
<div id="main" class="main">
<htk-repeater
id="grid-view"
empty-message="_Choose filter from right menu"
form-id="item"
model="items-model"
renderer="repeaterFunc">
model="items">
<custom>
<div
id="item-box"
class="box item-box"
title="_AddToBasket">
class="item-box clickable"
title="{{_('AddToBasket')}}"
on-click="this.onAddItemClick($event, $iter)">
<htk-image
directory="catalog"
subdir="200x200"
form="item"
form="$iter"
column="image"
stamp-column="updated"
full-dir="1600x900"/>
full-dir="1600x900"
title="_Zoom image"/>
<div class="item-info">
<h2>
<htk-text form="item" column="item"/>
<span class="item-id">
#{{item.id}}
</span>
{{item.item}}
</h2>
<p class="sub-name">
<htk-text form="item" column="subName"/>
{{item.subName}}
</p>
<table class="tags">
<tr>
<td><htk-text form="item" column="tag5"/></td>
<td><htk-text form="item" column="value5"/></td>
<td>{{item.tag5}}</td>
<td>{{item.value5}}</td>
</tr>
<tr>
<td><htk-text form="item" column="tag6"/></td>
<td><htk-text form="item" column="value6"/></td>
<td>{{item.tag6}}</td>
<td>{{item.value6}}</td>
</tr>
<tr>
<td><htk-text form="item" column="tag7"/></td>
<td><htk-text form="item" column="value7"/></td>
<td>{{item.tag7}}</td>
<td>{{item.value7}}</td>
</tr>
</table>
<div class="available-price">
<span class="grouping" title="_MinimalGrouping">
<htk-text form="item" column="grouping" format="x%.0d"/>
{{Vn.Value.format(item.grouping, 'x%.0d')}}
</span>
<span class="available" title="_Available">
<htk-text form="item" column="available"/>
{{item.available}}
</span>
<span class="price" title="_GroupingPrice">
<htk-text form="item" column="price" format="%.2d€"/>
{{Vn.Value.format(item.price, '%.02d€')}}
</span>
</div>
</div>
@ -176,29 +201,26 @@
</div>
<div id="right-panel" class="right-panel" on-click="onRightPanelClick">
<div class="basket-info">
<p>{{Vn.Value.format(basket.sent, '%D')}}</p>
<p>
<htk-text form="basket" column="sent" format="%D"/>
{{_(basket.method != 'PICKUP' ? 'Agency' : 'Warehouse')}}
{{basket.agency}}
</p>
<p>
<span id="method"/>
<htk-text form="basket" column="agency"/>
</p>
<button class="thin" on-click="onConfigureClick">
<t>Change</t>
<button class="thin" on-click="this.onConfigureClick()">
<t>Modify</t>
</button>
</div>
<div class="filter">
<div class="categories">
<div class="realms">
<htk-repeater
model="realms-model"
form-id="realm-form"
form-id="form"
renderer="realmRenderer"
class="realms-box">
<db-model
id="realms-model"
id="realms"
property="model"
on-status-changed="refreshTitleColor">
on-status-changed="refreshTitle">
SELECT c.id, l.name, c.color, c.code
FROM vn.itemCategory c
JOIN vn.itemCategoryL10n l ON l.id = c.id
@ -207,7 +229,11 @@
</db-model>
<custom>
<a id="link">
<img id="image"/>
<img
id="image"
src="{{`image/family/black/${form.code}.svg`}}"
title="{{form.name}}"
alt="{{form.name}}"/>
</a>
</custom>
</htk-repeater>
@ -215,17 +241,20 @@
</div>
</div>
<div id="realm-msg" class="realm-msg">
<h1><t>Choose a realm</t></h1>
<h5><t>Choose a realm</t></h5>
</div>
<div id="filters" class="filters">
<h2><t>Filter by</t></h2>
<vn-filter
<htk-combo
placeholder="_Family"
param="type">
form="params"
column="type"
id="type-filter">
<db-model
id="types-model"
id="types"
property="model"
conn="conn"
lot="params"
result-index="1"
on-status-changed="refreshTitle">
CALL myBasket_getAvailable;
@ -234,21 +263,22 @@
JOIN vn.itemType t ON t.id = i.typeFk
JOIN tmp.itemAvailable a ON a.id = i.id
JOIN vn.itemTypeL10n l ON l.id = t.id
WHERE t.`order` >= 0 AND #filter
WHERE t.`order` >= 0
AND t.categoryFk = #realm
ORDER BY t.`order`, l.name;
DROP TEMPORARY TABLE tmp.itemAvailable;
</db-model>
<sql-filter property="filter" type="AND">
<sql-filter-item type="EQUAL">
<sql-field name="categoryFk" target="t"/>
<sql-value param="realm"/>
</sql-filter-item>
</sql-filter>
</vn-filter>
<vn-filter
</htk-combo>
<htk-combo
placeholder="_Color"
param="color">
<db-model property="model" auto-load="false" result-index="1">
form="params"
column="color"
on-mousedown="colors.lazyRefresh()">
<db-model
id="colors"
property="model"
auto-load="false"
result-index="1">
CALL myBasket_getAvailable;
SELECT DISTINCT l.id, l.name
FROM vn.item i
@ -259,19 +289,17 @@
ORDER BY name;
DROP TEMPORARY TABLE tmp.itemAvailable;
</db-model>
<sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/>
<pointer object="op-type"/>
<pointer object="op-name"/>
<pointer object="op-origin"/>
<pointer object="op-category"/>
<pointer object="op-producer"/>
</sql-filter>
</vn-filter>
<vn-filter
</htk-combo>
<htk-combo
placeholder="_Producer"
param="producer">
<db-model property="model" auto-load="false" result-index="1">
form="params"
column="producer"
on-mousedown="producers.lazyRefresh()">
<db-model
id="producers"
property="model"
auto-load="false"
result-index="1">
CALL myBasket_getAvailable;
SELECT DISTINCT p.id, p.name
FROM vn.item i
@ -282,19 +310,17 @@
ORDER BY name;
DROP TEMPORARY TABLE tmp.itemAvailable;
</db-model>
<sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/>
<pointer object="op-type"/>
<pointer object="op-name"/>
<pointer object="op-origin"/>
<pointer object="op-color"/>
<pointer object="op-category"/>
</sql-filter>
</vn-filter>
<vn-filter
</htk-combo>
<htk-combo
placeholder="_Origin"
param="origin">
<db-model property="model" auto-load="false" result-index="1">
form="params"
column="origin"
on-mousedown="origins.lazyRefresh()">
<db-model
id="origins"
property="model"
auto-load="false"
result-index="1">
CALL myBasket_getAvailable;
SELECT DISTINCT o.id, l.name, o.code
FROM vn.item i
@ -306,19 +332,17 @@
ORDER BY name;
DROP TEMPORARY TABLE tmp.itemAvailable;
</db-model>
<sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/>
<pointer object="op-type"/>
<pointer object="op-name"/>
<pointer object="op-color"/>
<pointer object="op-category"/>
<pointer object="op-producer"/>
</sql-filter>
</vn-filter>
<vn-filter
</htk-combo>
<htk-combo
placeholder="_Category"
param="category">
<db-model property="model" auto-load="false" result-index="1">
form="params"
column="category"
on-mousedown="categorys.lazyRefresh()">
<db-model
id="categorys"
property="model"
auto-load="false"
result-index="1">
CALL myBasket_getAvailable;
SELECT DISTINCT i.category, i.category
FROM vn.item i
@ -328,15 +352,7 @@
ORDER BY category;
DROP TEMPORARY TABLE tmp.itemAvailable;
</db-model>
<sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/>
<pointer object="op-type"/>
<pointer object="op-name"/>
<pointer object="op-color"/>
<pointer object="op-origin"/>
<pointer object="op-producer"/>
</sql-filter>
</vn-filter>
</htk-combo>
</div>
<div id="order" class="order">
<h2><t>Order by</t></h2>
@ -390,10 +406,10 @@
modal="true"
on-closed="onPopupClose">
<div property="child-node" class="item-card">
<db-form id="card-extend">
<db-form vModel="extendedCard">
<db-model
property="model"
batch="card-batch"
lot="card-lot"
on-status-changed-after="onCardLoad">
SELECT i.description, o.name origin
FROM vn.item i
@ -405,33 +421,23 @@
<htk-image
directory="catalog"
subdir="200x200"
form="card"
form="$card"
column="image"
stamp-column="updated"
full-dir="1600x900"
conn="conn"
editable="true"/>
<div class="item-info">
<h2>
<htk-text form="card" column="item"/>
</h2>
<p class="sub-name">
<htk-text form="card" column="subName"/>
</p>
<p>
#<htk-text form="card" column="id"/>
</p>
<p>
<htk-text form="card" column="stems" format="_%.0d Units"/>
</p>
<h2>{{card.item}}</h2>
<p class="sub-name">{{card.subname}}</p>
<p>#{{card.id}}</p>
<p>{{Vn.Value.format(card.stems, _('%.0d Units'))}}</p>
</div>
<p class="desc">
<htk-text form="card-extend" column="description" id="desc"/>
</p>
<p class="desc">{{extendedCard.description}}</p>
<htk-repeater show-status="false" form-id="tag" class="tags">
<db-model
property="model"
batch="card-batch"
lot="card-lot"
on-status-changed-after="onCardLoad">
SELECT l.name, it.value
FROM vn.itemTag it
@ -443,8 +449,8 @@
</db-model>
<custom>
<tr>
<td><htk-text form="tag" column="name"/></td>
<td><htk-text form="tag" column="value"/></td>
<td>{{tag.name}}</td>
<td>{{tag.value}}</td>
</tr>
</custom>
</htk-repeater>
@ -455,7 +461,7 @@
property="model"
result-index="1"
on-status-changed-after="onCardLoad"
batch="card-batch">
lot="card-lot">
CALL myBasket_calcCatalogFromItem(#item);
SELECT l.warehouseFk, w.name warehouse, p.`grouping`,
p.price, p.priceKg, p.rate, l.available
@ -480,20 +486,25 @@
on-clicked="onAddLotClick"/>
</htk-grid>
<div class="footer">
<button on-click="onEraseClick" title="_Erase" class="erase">
<button
title="_Erase"
on-click="this.onEraseClick()"
class="erase">
<htk-icon
icon="delete"
name="delete"
theme="dark"
alt="_Erase"/>
</button>
<htk-text id="amount"/>
<button on-click="onConfirmClick" title="_Confirm" class="confirm">
<button
title="_Confirm"
on-click="this.onConfirmClick()"
class="confirm">
<htk-icon
icon="ok"
name="done"
theme="dark"
alt="_Confirm"/>
</button>
<div class="clear"/>
</div>
</div>
</htk-popup>

View File

@ -4,32 +4,27 @@ Hedera.Checkout = new Class({
activate: function() {
this.autoStepLocked = true;
this.$('assistant').stepsIndex = this.agencySteps;
this.$.assistant.stepsIndex = this.agencySteps;
this.today = new Date();
this.today.setHours(0, 0, 0, 0);
},
onValuesReady: function() {
var orderForm = this.$('order-form');
var defaultsForm = this.$('defaults');
const orderForm = this.$.orderForm;
const defaultsForm = this.$.defaults;
if (!(orderForm.ready && defaultsForm.ready))
return;
var date;
if (orderForm.numRows > 0) {
var i = orderForm;
date = i.get('sent');
} else
var i = defaultsForm;
let date;
const row = orderForm.$ || defaultsForm.$ || {};
if (!date || date.getTime() < (new Date()).getTime()) {
date = new Date();
date.setHours(0, 0, 0, 0);
var addDays = 0;
let addDays = 0;
switch(date.getDay()) {
case 6: // Saturday
@ -40,37 +35,31 @@ Hedera.Checkout = new Class({
break;
}
if (i.get('deliveryMethod') != 'PICKUP')
if (row.deliveryMethod != 'PICKUP')
addDays++;
date.setDate(date.getDate() + addDays);
}
this.$('date').value = date;
this.$('method').value = i.get('deliveryMethod');
this.$('agency').value = i.get('agencyModeFk');
this.$('address').value = i.get('addressFk');
this.$.lot.assign({
date: date,
method: row.deliveryMethod,
agency: row.agencyModeFk,
address: row.addressFk
});
this.autoStepLocked = false;
},
disableButtons: function(disable) {
this.$('assistant-bar').disabled = disable;
this.$.assistantBar.disabled = disable;
},
onConfirmClick: function() {
this.disableButtons(true);
var query = 'CALL myBasket_configure(#date, #method, #agency, #address)';
var batch = new Sql.Batch();
batch.addParam('method', this.$('method'));
batch.addParam('date', this.$('date'));
batch.addParam('agency', this.$('agency'));
batch.addParam('address', this.$('address'));
const query = 'CALL myBasket_configure(#date, #method, #agency, #address)';
this.conn.execQuery(query,
this.onBasketConfigured.bind(this), batch);
this.onBasketConfigured.bind(this), this.$.lot.$);
},
onBasketConfigured: function(resultSet) {
@ -79,96 +68,91 @@ Hedera.Checkout = new Class({
if (!resultSet.fetchResult())
return;
if (this.$('order-form').numRows > 0)
if (this.$.orderForm.numRows > 0)
Htk.Toast.showMessage(_('OrderUpdated'));
else
Htk.Toast.showMessage(_('OrderStarted'));
this.hash.set({form: 'ecomerce/catalog'});
this.hash.setAll({form: 'ecomerce/catalog'});
},
onCancelClick: function() {
if (this.$('order-form').numRows > 0)
if (this.$.orderForm.numRows > 0)
window.history.back();
else
this.hash.set({form: 'ecomerce/orders'});
this.hash.setAll({form: 'ecomerce/orders'});
},
agencySteps: ['method', 'date', 'address', 'agency', 'confirm-delivery'],
pickupSteps: ['method', 'date', 'address', 'pickup', 'confirm-pickup'],
isDelivery: function() {
return this.$('rg-method').value != 'PICKUP';
return this.$.rgMethod.value != 'PICKUP';
},
onMethodChange: function() {
this.$('assistant').stepsIndex = this.isDelivery() ?
this.$.assistant.stepsIndex = this.isDelivery() ?
this.agencySteps : this.pickupSteps;
this.onFieldChange();
},
methodValidate: function() {
if (!this.$('rg-method').isSelected())
if (!this.$.rgMethod.isSelected())
throw new Error(_('Please select an option'));
},
dateShow: function() {
Vn.Node.setText(this.$('date-question'), this.isDelivery() ?
Vn.Node.setText(this.$.dateQuestion, this.isDelivery() ?
_('OrderDateDeliveryQuestion'):
_('OrderDatePickupQuestion'));
this.$('calendar').goToSelectedMonth();
this.$.calendar.goToSelectedMonth();
},
dateValidate: function() {
if (!this.$('calendar').value)
if (!this.$.calendar.value)
throw new Error(_('Please select a date'));
},
addressShow: function() {
Vn.Node.setText(this.$('address-question'), this.isDelivery() ?
Vn.Node.setText(this.$.addressQuestion, this.isDelivery() ?
_('AddressQuestion'):
_('AddressQuestionPickup'));
},
addressValidate: function() {
if (this.$('address-form').row == -1)
if (this.$.addressForm.row == -1)
throw new Error(_('Please select an address'));
},
agencyShow: function() {
this.$('agencies').refresh();
this.$.agencies.refresh();
},
agencyValidate: function() {
if (this.$('agency-combo').row == -1 && this.isDelivery())
if (this.$.agencyCombo.row == -1 && this.isDelivery())
throw new Error(_('Please select an agency'));
},
pickupShow: function() {
this.$('warehouses').refresh();
this.$.warehouses.refresh();
},
pickupValidate: function() {
if (this.$('warehouse-combo').row == -1)
if (this.$.warehouseCombo.row == -1)
throw new Error(_('Please select a store'));
},
onFieldChange: function() {
if (!this.autoStepLocked)
this.$('assistant').moveNext();
this.$.assistant.moveNext();
},
goNextStep: function() {
this.$('assistant').moveNext();
},
addressRenderer: function(builder, form) {
builder.$('address').addEventListener('click',
this.onAddressClick.bind(this, form.get('id')));
this.$.assistant.moveNext();
},
onAddressClick: function(addressId) {
this.$('address').value = addressId;
this.$.lot.set('address', addressId);
this.goNextStep();
},
@ -176,37 +160,43 @@ Hedera.Checkout = new Class({
if (this.selectedNode)
Vn.Node.removeClass(this.selectedNode, 'selected');
var row = this.$('addresses').search('id', this.$('address').value);
const row = this.$.addresses.search('id', this.$.lot.$.address);
if (row != -1) {
var builder = this.$('repeater').getBuilder(row);
const builder = this.$.repeater.getBuilder(row);
this.selectedNode = builder.$('address');
this.selectedNode = builder.$.address;
Vn.Node.addClass(this.selectedNode, 'selected');
}
this.$('address-form').row = row;
this.$.addressForm.row = row;
},
onAgenciesReady: function(model) {
if (!model.ready) return;
if (model.numRows > 0) {
var agency;
var defaults = [
this.$('order-form').get('agencyModeFk'),
this.$('defaults').get('agencyModeFk'),
this.$('defaults').get('defaultAgencyFk')
];
let agency;
const agencies = [];
for (var i = 0; i < defaults.length; i++) {
agency = defaults[i];
if (this.$.orderForm.$)
agencies.push(this.$.orderForm.$);
const defaults = this.$.defaults.$;
if (defaults)
agencies.push(
defaults.agencyModeFk,
defaults.defaultAgencyFk
);
for (let i = 0; i < agencies.length; i++) {
agency = agencies[i];
if (model.search('id', agency) !== -1)
break;
}
this.autoStepLocked = true;
this.$('agency').value = agency;
this.$.lot.assign({agency});
this.autoStepLocked = false;
} else
Htk.Toast.showError(_('NoAgeciesAvailableForDate'));

View File

@ -11,7 +11,7 @@ AddressQuestion: On vols rebre la comanda?
AddressQuestionPickup: A què direcció vols associar la comanda? (Opcional)
AgencyQuestion: Com vols rebre la comanda?
PickupWarehouseQuestion: En quin magatzem vols recollir la comanda?
ConfirmToAccessCatalog: Confirma les dades per accedir al catàleg
ConfirmData: Confirma les dades
Arrival: Arribada
Pickup: Recollida
Agency: Agència

View File

@ -11,7 +11,7 @@ AddressQuestion: Where do you want to receive the order?
AddressQuestionPickup: To which address do you want to associate the order? (Optional)
AgencyQuestion: How you want to receive the order?
PickupWarehouseQuestion: What store you want to pickup your order?
ConfirmToAccessCatalog: Confirm the data to access the catalog
ConfirmData: Confirm the data
Arrival: Arrival
Pickup: Pickup
Agency: Agency

View File

@ -11,7 +11,7 @@ AddressQuestion: ¿Dónde quieres recibir el pedido?
AddressQuestionPickup: ¿A qué dirección quieres asociar el pedido? (Opcional)
AgencyQuestion: ¿Cómo quieres recibir el pedido?
PickupWarehouseQuestion: ¿En qué almacén quieres recoger el pedido?
ConfirmToAccessCatalog: Confirma los datos para acceder al catálogo
ConfirmData: Confirma los datos
Arrival: Llegada
Pickup: Recogida
Agency: Agencia

View File

@ -11,7 +11,7 @@ AddressQuestion: Adresse livraison?
AddressQuestionPickup: À quelle adresse voulez-vous associer la commande? (Optionnel)
AgencyQuestion: Agence de livraison
PickupWarehouseQuestion: Dans quel magasin vuoulez-vous retirer votre commande?
ConfirmToAccessCatalog: Confirmez les coordonnées pour accéder au catalogue
ConfirmData: Confirmez les coordonnées
Arrival: Arrivée
Pickup: Retrait
Agency: Agence

View File

@ -11,7 +11,7 @@ AddressQuestion: Onde queres receber a encomenda?
AddressQuestionPickup: Para qual endereço deseja associar o pedido? (Opcional)
AgencyQuestion: Como queres receber a encomenda?
PickupWarehouseQuestion: Em qual armazém queres levantar a encomenda?
ConfirmToAccessCatalog: Confirme os dados para entrar no catálogo
ConfirmData: Confirme os dados
Arrival: Chegada
Pickup: Recolhida
Agency: Agência

View File

@ -1,89 +1,54 @@
.checkout
{
padding: 1em;
max-width: 40em;
margin: 0 auto;
}
.checkout .bar
{
margin-bottom: 1em;
}
.checkout .form
{
max-width: 40em;
padding: 4em 2em;
.checkout .bar {
margin-bottom: 16px;
}
/* Step */
.answers button,
.answers p,
.radio > div
{
.radio > div {
font-size: 1.2em;
}
.answers .htk-select {
max-width: 15em;
margin: 0 auto;
font-size: 1.4em;
}
.answers .htk-select
{
max-width: 10em;
display: block;
margin: 0 auto;
font-size: 1.6em;
height: 1.8em;
}
.answers p
{
.answers p {
margin: 0.3em 0;
}
.target
{
.target {
max-width: 28em;
margin: 0 auto;
}
.address
{
.address {
border-radius: 0.1em;
padding: 0.6em 1.4em;
}
.address.selected
{
.address.selected {
background-color: rgba(1, 1, 1, .1);
}
.address:hover
{
.address:hover {
cursor: pointer;
background-color: rgba(1, 1, 1, .05);
}
.address p.consignee
{
.address p.consignee {
font-weight: bold;
}
.radio
{
.radio {
max-width: 20em;
margin: 0 auto;
}
.radio > div
{
.radio > div {
padding: 0.5em;
border-top: 1px solid #AAA;
}
.radio > div:first-child
{
border-top: none;
}
.thin-calendar
{
width: inherit;
.thin-calendar {
max-width: 24em;
margin: 0 auto;
box-shadow: 0 0.1em 0.3em #ccc;
box-shadow: none;
}
.thin-calendar tr > th
{
color: white;
}
.htk-assistant .thin
{
.htk-assistant .thin {
float: right;
}

View File

@ -1,9 +1,6 @@
<vn>
<vn-group>
<vn-param id="method"/>
<vn-param id="date"/>
<vn-param id="agency"/>
<vn-param id="address" on-changed="onAddressChange"/>
<vn-lot id="lot" on-change="this.onAddressChange()"/>
<db-form id="defaults" on-ready="onValuesReady">
<db-model property="model">
SELECT deliveryMethod, agencyModeFk, addressFk, defaultAgencyFk
@ -19,6 +16,7 @@
</db-form>
<db-model id="agencies"
auto-load="false"
lot="lot"
result-index="1"
on-status-changed="onAgenciesReady">
CALL vn.zone_getAgency(#address, #date);
@ -30,15 +28,10 @@
AND a.isVisible
ORDER BY a.description;
DROP TEMPORARY TABLE tmp.zoneGetAgency;
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
<item name="date" param="date"/>
</custom>
</sql-batch>
</db-model>
<db-model id="warehouses"
auto-load="false"
lot="lot"
result-index="1"
on-status-changed="onWarehousesReady">
CALL vn.zone_getAgency(#address, #date);
@ -50,12 +43,6 @@
AND a.isVisible
ORDER BY a.description;
DROP TEMPORARY TABLE tmp.zoneGetAgency;
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
<item name="date" param="date"/>
</custom>
</sql-batch>
</db-model>
</vn-group>
<div id="title">
@ -68,12 +55,13 @@
on-click="onCancelClick"/>
</div>
<div id="form" class="checkout">
<div class="vn-w-sm">
<div class="box bar">
<htk-assistant-bar
id="assistant-bar"
assistant="assistant"/>
</div>
<div class="box">
<div class="box vn-px-lg vn-py-xl">
<div class="form">
<htk-assistant id="assistant"
endFunc="onConfirmClick">
@ -84,7 +72,8 @@
<div class="answers radio">
<htk-radio-group
id="rg-method"
param="method"
form="lot"
column="method"
on-changed="onMethodChange"/>
<div>
<label>
@ -109,7 +98,8 @@
<htk-calendar
id="calendar"
class="thin-calendar"
param="date"
form="lot"
column="date"
restrict-func="calendarRestrict"
on-changed="onFieldChange"/>
</div>
@ -124,8 +114,7 @@
<htk-repeater
id="repeater"
form-id="iter"
on-change="onAddressChange"
renderer="addressRenderer">
on-change="onAddressChange">
<db-model property="model" id="addresses">
SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.country
FROM myAddress a
@ -134,13 +123,12 @@
WHERE a.isActive
</db-model>
<custom>
<div class="address" id="address">
<p class="consignee">
<htk-text form="iter" column="nickname"/>
</p>
<p>
<htk-text form="iter" column="street"/>
</p>
<div
class="address"
on-click="this.onAddressClick(iter.id)"
id="address">
<p class="consignee">{{iter.nickname}}</p>
<p>{{iter.street}}</p>
</div>
</custom>
</htk-repeater>
@ -154,7 +142,8 @@
<div class="answers target">
<htk-combo
id="agency-combo"
param="agency"
form="lot"
column="agency"
on-changed="onFieldChange"
model="agencies"/>
</div>
@ -167,18 +156,19 @@
<div class="answers target">
<htk-combo
id="warehouse-combo"
param="agency"
form="lot"
column="agency"
on-changed="onFieldChange"
model="warehouses"/>
</div>
</htk-step>
<htk-step
name="confirm-delivery">
<h2><t>ConfirmToAccessCatalog</t></h2>
<h2><t>ConfirmData</t></h2>
<div class="answers target">
<p>
<t>Arrival</t>
<htk-text format="%D" param="date"/>
<htk-text format="%D" form="lot" column="date"/>
</p>
<p>
<htk-text form="address-form" column="street"/>
@ -192,11 +182,11 @@
</htk-step>
<htk-step
name="confirm-pickup">
<h2><t>ConfirmToAccessCatalog</t></h2>
<h2><t>ConfirmData</t></h2>
<div class="answers target">
<p>
<t>Pickup</t>
<htk-text format="%D" param="date"/>
<htk-text format="%D" form="lot" column="date"/>
</p>
<p>
<t>Warehouse</t>
@ -208,5 +198,6 @@
</htk-assistant>
</div>
</div>
</div>
</div>
</vn>

View File

@ -6,7 +6,7 @@ Hedera.Confirm = new Class({
this.close();
this.isOpen = true;
Hedera.BasketChecker.check(this.conn,
Hedera.BasketChecker.check(this.conn, this.hash,
this.onBasketCheck.bind(this));
},
@ -19,21 +19,21 @@ Hedera.Confirm = new Class({
if (form.row < 0)
return;
if (form.get('method') != 'PICKUP') {
Vn.Node.show(this.$('address'));
Vn.Node.setText(this.$('method'), _('Agency'));
if (form.$.method != 'PICKUP') {
Vn.Node.show(this.$.address);
Vn.Node.setText(this.$.method, _('Agency'));
} else {
Vn.Node.hide(this.$('address'));
Vn.Node.setText(this.$('method'), _('Warehouse'));
Vn.Node.hide(this.$.address);
Vn.Node.setText(this.$.method, _('Warehouse'));
}
var total = form.get('taxableBase') + form.get('tax');
var total = form.$.taxableBase + form.$.tax;
if (total === null)
total = 0;
var credit = form.get('credit');
var debt = form.get('debt');
var credit = form.$.credit;
var debt = form.$.debt;
var totalDebt = debt + total;
var exceededCredit = totalDebt - credit;
@ -43,21 +43,21 @@ Hedera.Confirm = new Class({
Htk.Toast.showWarning(
_('You have exceeded your credit.'));
this.$('debt').value = debt;
this.$('total-debt').value = totalDebt;
this.$('total-amount').value = totalDebt;
this.$('credit-excess').value = exceededCredit;
this.$('excess-amount').value = exceededCredit;
this.$.debt.value = debt;
this.$.totalDebt.value = totalDebt;
this.$.totalAmount.value = totalDebt;
this.$.creditExcess.value = exceededCredit;
this.$.excessAmount.value = exceededCredit;
this.$('pay-amount').value = 'ALL';
this.$.payAmount.value = 'ALL';
if (credit > 0) {
this.$('credit-info').style.display = 'table-row';
this.$.creditInfo.style.display = 'table-row';
if (creditExceededCond) {
this.$('amount-selector').style.display = 'block';
this.$('exceeded-info').style.display = 'table-row';
this.$('pay-amount').value = 'EXCEEDED';
this.$.amountSelector.style.display = 'block';
this.$.exceededInfo.style.display = 'table-row';
this.$.payAmount.value = 'EXCEEDED';
}
}
@ -77,29 +77,29 @@ Hedera.Confirm = new Class({
}
for (var i = 0; i < methods.length; i++)
this.$(methods[i] +'-method').style.display = 'block';
this.$[`${methods[i]}Method`].style.display = 'block';
this.$('pay-method').value = selectedMethod;
this.$.payMethod.value = selectedMethod;
},
onPayMethodChange: function(payMethod) {
var id = this.displayedInfo;
if (id)
Vn.Node.removeClass(this.$(id), 'selected');
Vn.Node.removeClass(this.$[id], 'selected');
switch (payMethod.value) {
case 'BALANCE':
id = 'balance-method';
id = 'balanceMethod';
break;
case 'CREDIT':
id = 'credit-method';
id = 'creditMethod';
break;
case 'CARD':
id = 'card-method';
id = 'cardMethod';
break;
case 'TRANSFER':
id = 'transfer-method';
id = 'transferMethod';
break;
default:
id = null;
@ -108,12 +108,12 @@ Hedera.Confirm = new Class({
this.displayedInfo = id;
if (id)
Vn.Node.addClass(this.$(id), 'selected');
Vn.Node.addClass(this.$[id], 'selected');
},
disableButtons: function(disable) {
this.$('modify').disabled = disable;
this.$('confirm').disabled = disable;
this.$.modify.disabled = disable;
this.$.confirm.disabled = disable;
},
onModifyClick: function() {
@ -122,27 +122,30 @@ Hedera.Confirm = new Class({
onConfirmClick: function() {
this.disableButtons(true);
this.$('confirm-query').execute();
this.$.confirmQuery.execute();
},
onConfirm: function(query, resultSet) {
this.disableButtons(false);
if (resultSet.fetchResult())
this.$('success-dialog').show();
this.$.successDialog.show();
},
onDialogResponse: function() {
if (this.$('pay-method').value === 'CARD') {
if (this.$('pay-amount').value === 'EXCEEDED')
var payAmount = this.$('excess-amount').value;
if (this.$.payMethod.value === 'CARD') {
if (this.$.payAmount.value === 'EXCEEDED')
var payAmount = this.$.excessAmount.value;
else
var payAmount = this.$('total-amount').value;
var payAmount = this.$.totalAmount.value;
var tpv = new Hedera.Tpv({conn: this.conn});
tpv.pay(payAmount, this.$('order-form').get('companyFk'));
var tpv = new Hedera.Tpv({
conn: this.conn,
hash: this.hash
});
tpv.pay(payAmount, this.$.order.companyFk);
} else
this.hash.set({'form': 'ecomerce/orders'});
this.hash.setAll({form: 'ecomerce/orders'});
}
});

View File

@ -1,5 +1,7 @@
Checkout: Finalitzar comanda
Order summary: Resum de la comanda
ShippingInformation: Dades d'enviament
DeliveryAddress: Adreça de lliurament
Delivery at: Lliurament el
Agency: Agència
Warehouse: Magatzem

View File

@ -1,5 +1,7 @@
Checkout: Checkout
Order summary: Order summary
ShippingInformation: Shipping information
DeliveryAddress: Delivery address
Delivery at: Delivery at
Agency: Agency
Warehouse: Store

View File

@ -1,5 +1,7 @@
Checkout: Finalizar pedido
Order summary: Resumen del pedido
ShippingInformation: Datos de envío
DeliveryAddress: Dirección de entrega
Delivery at: Entrega el
Agency: Agencia
Warehouse: Almacén

View File

@ -1,5 +1,7 @@
Checkout: Finir la commande
Order summary: Résumé de la commande
ShippingInformation: Informations sur la livraison
DeliveryAddress: Addresse de livraison
Delivery at: Livraison à
Agency: Agence
Warehouse: Entrepôt

View File

@ -1,5 +1,7 @@
Checkout: Finalizar encomenda
Order summary: Resumo da encomenda
ShippingInformation: Dados de envio
DeliveryAddress: Endereço de entrega
Delivery at: Entrega na
Agency: Agência
Warehouse: Armazém

View File

@ -1,86 +1,33 @@
.confirm
{
padding: 1em;
max-width: 30em;
margin: 0 auto;
color: #555;
.confirm .summary {
margin-bottom: 16px;
}
.confirm .box
{
padding: 2.2em 2.5em;
}
.confirm .summary
{
margin-bottom: 1em;
}
.confirm .address
{
margin-top: .8em;
}
.confirm h2
{
font-size: 1.1em;
font-weight: normal;
padding: 0;
margin: 0;
margin-bottom: .5em;
color: #333;
}
.confirm button
{
font-size: 1.4em;
}
.confirm p
{
.confirm p {
margin: .2em 0;
}
.confirm .modify-order
{
float: left;
}
.confirm .confirm-order
{
float: right;
}
.confirm .payment > div
{
margin-bottom: 1.4em;
}
.confirm .payment > .button-bar
{
margin: 0;
margin-top: 1.8em;
}
/* Table */
.confirm .debt-info
{
.confirm .debt-info {
padding: 0;
}
.confirm .debt-info > table
{
.confirm .debt-info > table {
border-collapse: collapse;
}
.confirm td
{
.confirm td {
padding: .15em 0;
}
.confirm .sum-total > td
{
.confirm .sum-total > td {
border-top: solid 1px #DDD;
font-weight: bold;
}
.confirm .currency
{
.confirm .currency {
text-align: right;
}
.confirm .credit-info
{
.confirm .credit-info {
display: none;
}
.confirm .exceeded-info
{
.confirm .exceeded-info {
display: none;
color: #E53935;
}
@ -88,34 +35,59 @@
/* Pay */
.confirm .amount-selector,
.confirm .pay-methods > div
{
.confirm .pay-methods > div {
display: none;
}
.confirm .pay-methods > div
{
.confirm .pay-methods > div {
margin: .3em 0;
}
.confirm .pay-methods > div > label > input[type=radio]
{
.confirm .pay-methods > div > label > input[type=radio] {
margin: 0;
margin-right: .5em;
vertical-align: middle;
}
.confirm .pay-methods > div > div
{
.confirm .pay-methods > div > div {
padding: .5em 1.5em;
display: none;
}
.confirm .pay-methods > div.selected > div
{
.confirm .pay-methods > div.selected > div {
display: block;
}
.confirm .transfer-account
{
.confirm .transfer-account {
margin-top: .5em;
}
.confirm .transfer-account > p
{
.confirm .transfer-account > p {
margin: .1em 0;
}
.confirm .payment > div {
margin-bottom: 1.4em;
}
.confirm .payment > .button-bar {
display: flex;
justify-content: space-between;
margin-bottom: 0;
margin-top: 32px;
}
.confirm .payment > .button-bar button{
font-size: 1.2rem;
border-radius: 2rem;
padding: .5rem 1rem;
margin: 0;
}
.confirm .modify-order {
border: 1px solid #1a1a1a;
}
.confirm .modify-order:hover {
color: white;
background-color: #1a1a1a;
}
.confirm .confirm-order {
border: 1px solid #8cc63f;
background-color: #8cc63f;
color: white;
}
.confirm .confirm-order:hover {
background-color: transparent;
color: #6b5;
}

View File

@ -1,6 +1,6 @@
<vn>
<vn-group>
<db-form id="order-form" on-ready="onOrderReady">
<db-form v-model="order" on-ready="onOrderReady">
<db-model property="model" result-index="1">
CALL myBasket_getTax;
SELECT o.id, o.sent, o.notes, o.companyFk,
@ -31,40 +31,32 @@
<h1><t>Order summary</t></h1>
</div>
<div id="form" class="confirm">
<div class="box summary">
<div class="vn-w-sm">
<div class="box vn-pa-lg summary">
<div>
<div class="delivery">
<h6><t>ShippingInformation</t></h6>
<p>
<t>Delivery at</t>
<htk-text format="%D" form="order-form" column="sent"/>
<t>Delivery at</t> {{Vn.Value.format(order.sent, _('%D'))}}
</p>
<p>
<span id="method"><t>Agency</t></span>
<htk-text form="order-form" column="agency"/>
<span id="method"><t>Agency</t></span> {{order.agency}}
</p>
</div>
<div id="address" class="address">
<p>
<htk-text form="order-form" column="nickname"/>
</p>
<p>
<htk-text form="order-form" column="street"/>
</p>
<p>
<htk-text form="order-form" column="postalCode"/>,
<htk-text form="order-form" column="city"/>
</p>
<div id="address" class="address vn-mt-md">
<h6><t>DeliveryAddress</t></h6>
<p>{{order.nickname}}</p>
<p>{{order.street}}</p>
<p>{{order.postalCode}}, {{order.city}}</p>
</div>
</div>
</div>
<div class="box payment">
<div class="box vn-pa-lg payment">
<div>
<table class="debt-info">
<tbody>
<tr>
<td>
<t>Previous balance</t>
</td>
<td><t>Previous balance</t></td>
<td class="currency">
<htk-text format="%.2d€" id="debt"/>
</td>
@ -74,7 +66,7 @@
<t>Order total</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="taxableBase"/>
{{Vn.Value.format(order.taxableBase, _('%.2d€'))}}
</td>
</tr>
<tr>
@ -82,7 +74,7 @@
<t>Order VAT</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="tax"/>
{{Vn.Value.format(order.tax, _('%.2d€'))}}
</td>
</tr>
<tr class="total-debt sum-total">
@ -98,7 +90,7 @@
<t>Credit</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="credit"/>
{{Vn.Value.format(order.credit, _('%.2d€'))}}
</td>
</tr>
<tr id="exceeded-info" class="exceeded-info sum-total">
@ -136,9 +128,7 @@
</div>
</div>
<div>
<h2>
<t>Pay method</t>
</h2>
<h6><t>Pay method</t></h6>
<div class="pay-methods">
<htk-radio-group
id="pay-method"
@ -183,8 +173,8 @@
</db-model>
<custom>
<div class="transfer-account">
<p><htk-text form="iter" column="name"/></p>
<p><htk-text form="iter" column="iban"/></p>
<p>{{iter.name}}</p>
<p>{{iter.iban}}</p>
</div>
</custom>
</htk-repeater>
@ -198,14 +188,20 @@
</div>
</div>
</div>
<div class="button-bar">
<button on-click="onModifyClick" id="modify" class="thin modify-order">
<div class="button-bar vn-mt-md">
<button
id="modify"
on-click="this.onModifyClick()"
class="modify-order">
<t>Modify</t>
</button>
<button on-click="onConfirmClick" id="confirm" class="thin confirm-order">
<button
id="confirm"
on-click="this.onConfirmClick()"
class="confirm-order">
<t>Confirm</t>
</button>
<div class="clear"/>
</div>
</div>
</div>
</div>

View File

@ -3,9 +3,9 @@ Hedera.Invoices = new Class({
Extends: Hedera.Form,
donwloadRenderer: function(column, invoice) {
var invoiceId = invoice.get('id');
var invoiceId = invoice.$.id;
if (invoice.get('hasPdf') && invoiceId) {
if (invoice.$.hasPdf && invoiceId) {
var params = {
srv: 'rest:dms/invoice',
invoice: invoiceId,

View File

@ -1,14 +0,0 @@
.invoices
{
padding: 1em;
}
.invoices .box
{
max-width: 40em;
}
.invoices .box > .header,
.invoices .htk-grid > thead > tr
{
background-color: #3F51B6;
}

View File

@ -3,9 +3,9 @@
<h1><t>Invoices</t></h1>
</div>
<div id="form" class="invoices">
<div class="box">
<div>
<htk-grid show-header="false">
<htk-grid
class="box vn-w-sm"
show-header="false">
<db-model property="model" id="tickets">
SELECT id, ref, issued, amount, hasPdf
FROM myInvoice
@ -19,7 +19,5 @@
renderer="donwloadRenderer"
target="_blank"/>
</htk-grid>
</div>
</div>
</div>
</vn>

Some files were not shown because too many files have changed in this diff Show More