0
1
Fork 0

Añadida funcionalidad a Vn.Builder

This commit is contained in:
Juan Ferrer Toribio 2015-03-07 00:33:54 +01:00
parent 9f9095a74e
commit d87695fd99
131 changed files with 2180 additions and 1894 deletions

View File

@ -1,5 +1,5 @@
Package: hedera-web
Version: 1.0-35
Version: 1.0-36
Architecture: all
Maintainer: Juan Ferrer Toribio <juan@verdnatura.es>
Depends: apache2, php5-mysql, php-vn-web

View File

@ -8,7 +8,7 @@ Alias /hedera-web /usr/share/hedera-web/
Order Allow,Deny
Allow From All
<FilesMatch "\.(css|js|json|php)$">
<FilesMatch "\.(css|js|json|php|xml|html)$">
SetOutputFilter DEFLATE
</FilesMatch>

View File

@ -1,24 +0,0 @@
<?php
require_once ('vn/hedera/web.php');
use Vn\Lib\Locale;
use Vn\Hedera\Web;
Web::init ();
Web::login ();
header ('Content-Type: text/xml; charset=UTF-8');
if (isset ($_GET['form']) && Vn\Hedera\checkFilePath ($_GET['form'], 'forms'))
$form = $_GET['form'];
else
$form = $conf['defaultForm'];
$formPath = "forms/$form";
Locale::addPath ($formPath);
include ("$formPath/html.php");
Web::deinit ();
?>

View File

@ -5,58 +5,51 @@ Vn.Account = new Class
,activate: function ()
{
var model = this.get ('user-model');
var model = this.$('user-model');
model.setTableInfo ('u', 'user_view');
model.setTableInfo ('c', 'customer_view');
this.get ('password').conn = this.conn;
this.$('user-form').on ('iter-changed', this.onUserDataReady, this);
this.$('new-password').addEventListener ('change', this.onPasswordChange.bind (this));
this.$('repeat-password').addEventListener ('change', this.onPasswordChange.bind (this));
this.$('user-name').addEventListener ('change', this.onUserChange.bind (this));
}
});
Htk.Password = new Class
({
Extends: Htk.Widget
,Tag: 'htk-password'
,initialize: function ()
,onUserDataReady: function (form)
{
this.createElement ('div');
this.node.className = 'htk-password';
var passwordEntry = document.createElement ('input');
passwordEntry.type = 'password';
passwordEntry.value = '123456';
passwordEntry.addEventListener ('change', this.passCheckAndChange.bind (this));
this.node.appendChild (passwordEntry);
this.$('user-name').value = form.get ('name');
}
,onUserChange: function ()
{
if (!confirm (_('MustReloginIfChange')))
return;
var batch = new Sql.Batch ();
batch.addValue ('name', this.$('user-name').value);
var query = 'UPDATE user_view SET name = #name '
+'WHERE id = account.user_get_id () LIMIT 1';
var repeatEntry = document.createElement ('input');
repeatEntry.type = 'password';
repeatEntry.addEventListener ('change', this.passCheckAndChange.bind (this));
this.node.appendChild (repeatEntry);
var logNode = document.createElement ('span');
this.node.appendChild (logNode);
this.logNode = logNode;
this.passwordEntry = passwordEntry;
this.repeatEntry = repeatEntry;
this.conn.execQuery (query, this.onUserUpdate.bind (this), batch);
}
,onUserUpdate: function (resultSet)
{
if (!resultSet.fetchResult ())
return;
location.reload ();
}
,passCheckAndChange: function ()
,onPasswordChange: function ()
{
var newPassword = this.passwordEntry.value;
var repeatedPassword = this.repeatEntry.value;
Vn.Node.removeChilds (this.logNode);
var newPassword = this.$('new-password').value;
var repeatedPassword = this.$('repeat-password').value;
if (newPassword != '' && repeatedPassword != '')
{
if (newPassword !== repeatedPassword)
{
this.logNode.style.color = 'red';
Vn.Node.setText (this.logNode, _('PasswordsDoesntMatch'));
}
else
if (newPassword === repeatedPassword)
{
var batch = new Sql.Batch ();
batch.addValue ('password', newPassword);
@ -64,18 +57,29 @@ Htk.Password = new Class
var query = 'UPDATE user_view SET password = MD5(#password) '
+'WHERE id = account.user_get_id () LIMIT 1';
this.conn.execQuery (query, this.passUpdated.bind (this), batch);
this.conn.execQuery (query, this.onPasswordUpdate.bind (this), batch);
}
else
(new Htk.Toast ()).showError (_('PasswordsDoesntMatch'));
}
}
,passUpdated: function (resultSet)
,onPasswordUpdate: function (resultSet)
{
if (!resultSet.fetchResult ())
return;
this.relogin ();
(new Htk.Toast ()).showMessage (_('PasswordsChanged'));
}
this.logNode.style.color = 'green';
Vn.Node.setText (this.logNode, _('PasswordsChanged'));
,relogin: function ()
{
this.conn.open (
this.$('user-form').get ('name')
,this.$('new-password').value
,Vn.Cookie.check ('vn_pass')
);
}
});

View File

@ -1,39 +0,0 @@
<div id="account">
<vn-group>
<db-form id="user-form">
<db-model id="user-model">
SELECT id, u.name, password, email, mail, c.user_id
FROM user_view u
LEFT JOIN customer_view c
ON u.id = c.user_id
</db-model>
</db-form>
</vn-group>
<div class="box">
<div class="header">
<h1><?php i('Configuration') ?></h1>
</div>
<div class="form">
<div class="form-group">
<label for="user-id"><?php i('UserNumber') ?></label>
<htk-label column="id" form="user-form"/>
</div>
<div class="form-group">
<label for="user-name"><?php i('UserName') ?></label>
<htk-entry column="name" form="user-form"/>
</div>
<div class="form-group">
<label for="user-pass"><?php i('Password') ?></label>
<htk-password id="password"/>
</div>
<div class="form-group">
<label for="email"><?php i('Email') ?></label>
<htk-entry column="email" form="user-form"></htk-entry>
</div>
<div class="form-group">
<label for="mail"><?php i('BillingByEmail') ?></label>
<htk-check column="mail" form="user-form"/>
</div>
</div>
</div>
</div>

View File

@ -1,34 +1,34 @@
#account
.account
{
padding: 1em;
}
#account .box
.account .box
{
max-width: 40em;
}
#account div.form
.account .form
{
margin: 0 auto;
max-width: 25em;
padding: 2em;
}
div.form-group
.account .form-group
{
padding: 0.4em;
}
div.form-group label
.account .form-group label
{
display: block;
margin-bottom: 0.5em;
}
div.form-group input[type=text],
div.form-group input[type=password]
.account .form-group input[type=text],
.account .form-group input[type=password]
{
margin: 0;
width: 100%;
}
div.form-group input[type=password]
.account .form-group input[type=password]
{
margin-bottom: 0.5em;
}

View File

@ -0,0 +1,42 @@
<vn>
<vn-group>
<db-form id="user-form">
<db-model id="user-model">
SELECT id, u.name, email, mail, c.user_id
FROM user_view u
LEFT JOIN customer_view c
ON u.id = c.user_id
</db-model>
</db-form>
</vn-group>
<div id="form" class="account">
<div class="box">
<div class="header">
<h1><t>Configuration</t></h1>
</div>
<div class="form">
<div class="form-group">
<label for="user-id"><t>UserNumber</t></label>
<htk-label column="id" form="user-form"/>
</div>
<div class="form-group">
<label for="user-name"><t>UserName</t></label>
<input type="text" id="user-name"/>
</div>
<div class="form-group">
<label for="user-pass"><t>Password</t></label>
<input type="password" id="new-password" placeholder="_NewPassword"/>
<input type="password" id="repeat-password" placeholder="_RepeatPassword"/>
</div>
<div class="form-group">
<label for="email"><t>Email</t></label>
<htk-entry column="email" form="user-form"></htk-entry>
</div>
<div class="form-group">
<label for="mail"><t>BillingByEmail</t></label>
<htk-check column="mail" form="user-form"/>
</div>
</div>
</div>
</div>
</vn>

View File

@ -5,7 +5,7 @@ Vn.AccessLog = new Class
,activate: function ()
{
// this.get ('return').on ('clicked', this.returnClicked.bind (this));
// this.$('return').on ('clicked', this.returnClicked.bind (this));
}
,returnClicked: function (column, value)

View File

@ -1,79 +0,0 @@
<div id="access-log">
<vn-group>
<vn-param id="user">
<vn-hash-link key="user"/>
</vn-param>
<db-form id="user-form">
<db-model updatable="false">
SELECT Id_Cliente, Cliente, Telefono, movil
FROM vn2008.Clientes WHERE Id_Cliente = #user
<sql-batch property="batch">
<item name="user" param="user"/>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div class="box">
<div class="header">
<h1><?=s('AccessLog')?></h1>
</div>
<table class="form">
<tbody>
<tr>
<td class="label">
<label><?=s('UserNumber:')?></label>
</td>
<td>
<htk-label column="Id_Cliente" form="user-form"/>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('User:')?></label>
</td>
<td>
<htk-label column="Cliente" form="user-form"/>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('Phone:')?></label>
</td>
<td>
<htk-label column="Telefono" form="user-form"/>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('Mobile:')?></label>
</td>
<td>
<htk-label column="movil" form="user-form"/>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid id="access">
<db-model updatable="false">
SELECT u.date_time, a.platform, a.browser, a.version, a.javascript, a.cookies
FROM visit_user u
JOIN visit_access c ON u.access_id = c.id
JOIN visit_agent a ON c.agent_id = a.id
WHERE u.user_id = #user
ORDER BY u.date_time DESC
LIMIT 30
<sql-batch property="batch">
<item name="user" param="user"/>
</sql-batch>
</db-model>
<htk-column-date title="Access" column="date_time" format="%a, %e %b %Y at %T"/>
<htk-column-text title="SO" column="platform"/>
<htk-column-text title="Browser" column="browser"/>
<htk-column-text title="Version" column="version"/>
<htk-column-check title="Javascript" column="javascript"/>
<htk-column-check title="Cookies" column="cookies"/>
</htk-grid>
</div>
</div>
</div>

View File

@ -1,14 +1,14 @@
#access-log
.access-log
{
padding: 1em;
min-width: 35em;
}
#access-log .box
.access-log .box
{
max-width: 50em;
margin: 0 auto;
}
#access-log grid tbody tr
.access-log grid tbody tr
{
height: 3.4em;
}

View File

@ -0,0 +1,81 @@
<vn>
<vn-group>
<vn-param id="user">
<vn-hash-link key="user"/>
</vn-param>
<db-form id="user-form">
<db-model updatable="false">
SELECT Id_Cliente, Cliente, Telefono, movil
FROM vn2008.Clientes WHERE Id_Cliente = #user
<sql-batch property="batch">
<item name="user" param="user"/>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div id="form" class="access-log">
<div class="box">
<div class="header">
<h1><t>AccessLog</t></h1>
</div>
<table class="form">
<tbody>
<tr>
<td class="label">
<label><t>UserNumber:</t></label>
</td>
<td>
<htk-label column="Id_Cliente" form="user-form"/>
</td>
</tr>
<tr>
<td class="label">
<label><t>User:</t></label>
</td>
<td>
<htk-label column="Cliente" form="user-form"/>
</td>
</tr>
<tr>
<td class="label">
<label><t>Phone:</t></label>
</td>
<td>
<htk-label column="Telefono" form="user-form"/>
</td>
</tr>
<tr>
<td class="label">
<label><t>Mobile:</t></label>
</td>
<td>
<htk-label column="movil" form="user-form"/>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid id="access">
<db-model updatable="false">
SELECT u.date_time, a.platform, a.browser, a.version, a.javascript, a.cookies
FROM visit_user u
JOIN visit_access c ON u.access_id = c.id
JOIN visit_agent a ON c.agent_id = a.id
WHERE u.user_id = #user
ORDER BY u.date_time DESC
LIMIT 30
<sql-batch property="batch">
<item name="user" param="user"/>
</sql-batch>
</db-model>
<htk-column-date title="Access" column="date_time" format="%a, %e %b %Y at %T"/>
<htk-column-text title="SO" column="platform"/>
<htk-column-text title="Browser" column="browser"/>
<htk-column-text title="Version" column="version"/>
<htk-column-check title="Javascript" column="javascript"/>
<htk-column-check title="Cookies" column="cookies"/>
</htk-grid>
</div>
</div>
</div>
</vn>

View File

@ -1,16 +0,0 @@
<div id="cpanel">
<div class="box">
<div class="header">
<h1><?php i('ControlPanel') ?></h1>
</div>
<htk-grid>
<db-model>
SELECT image, name, description, link FROM link
ORDER BY name
</db-model>
<htk-column-image directory="link" subdir="full" column="image"/>
<htk-column-link title="Module" column="name" target="_blank" id="column-link"/>
<htk-column-text title="Description" column="description"/>
</htk-grid>
</div>
</div>

View File

@ -5,7 +5,7 @@ Vn.Links = new Class
,activate: function ()
{
this.get ('column-link').renderer = this.linkRenderer;
this.$('column-link').renderer = this.linkRenderer;
}
,linkRenderer: function (column, form)

View File

@ -1,18 +1,18 @@
#cpanel
.cpanel
{
padding: 1em;
}
#cpanel .box
.cpanel .box
{
max-width: 60em;
min-width: 25em;
}
#cpanel tbody tr
.cpanel tbody tr
{
height: 3.5em;
}
#cpanel tbody td img
.cpanel tbody td img
{
min-height: 1.6em;
}

View File

@ -0,0 +1,18 @@
<vn>
<div id="form" class="cpanel">
<div class="box">
<div class="header">
<h1><t>ControlPanel</t></h1>
</div>
<htk-grid>
<db-model>
SELECT image, name, description, link FROM link
ORDER BY name
</db-model>
<htk-column-image directory="link" subdir="full" column="image"/>
<htk-column-link title="_Module" column="name" target="\_blank" id="column-link"/>
<htk-column-text title="_Description" column="description"/>
</htk-grid>
</div>
</div>
</vn>

View File

@ -1,37 +0,0 @@
<div id="photos">
<div class="box">
<div class="header">
<h1><?=s('Photos')?></h1>
</div>
<div class="body">
<form action="rest.php?action=image" method="post" enctype="multipart/form-data" target="photos-iframe" id="photos-form">
<div class="form-group">
<label><?=s('Id:')?></label>
<input type="number" name="id" id="photo-id"/>
</div>
<div class="form-group">
<label><?=s('ImageName:')?></label>
<input type="text" name="name"/>
</div>
<div class="form-group">
<label><?=s('Schema:')?></label>
<input type="hidden" name="schema" id="schema-field"/>
<htk-combo id="schema">
<db-model property="model">
SELECT name, `desc` FROM image_schema ORDER BY `desc`
</db-model>
</htk-combo>
</div>
<div class="form-group">
<label><?=s('ImageFile:')?></label>
<input type="file" name="image"/>
<input type="hidden" name="MAX_FILE_SIZE" id="photo-size"/>
</div>
<button class="vn" id="photo-submit">
<?=s('Upload')?>
</button>
</form>
<iframe name="photos-iframe" id="photos-iframe"></iframe>
</div>
</div>
</div>

View File

@ -5,33 +5,33 @@ Vn.Photos = new Class
,activate: function ()
{
this.get ('schema').value = 'catalog';
$('photo-size').value = 10 /* MB */ * 1048576;
$('photos-form').addEventListener ('submit', this.onFormSubmit.bind (this));
$('photos-iframe').addEventListener ('load', this.onImageUpload.bind (this));
$('photo-id').focus ();
this.$('schema').value = 'catalog';
this.$('photo-size').value = 10 /* MB */ * 1048576;
this.$('photo-form').addEventListener ('submit', this.onFormSubmit.bind (this));
this.$('iframe').addEventListener ('load', this.onImageUpload.bind (this));
this.$('photo-id').focus ();
}
,onFormSubmit: function ()
{
$('schema-field').value = this.get ('schema').value;
$('photo-submit').disabled = true;
this.$('schema-field').value = this.$('schema').value;
this.$('submit').disabled = true;
this.gui.loaderPush ();
}
,onImageUpload: function (iframe)
{
this.gui.loaderPop ();
$('photo-submit').disabled = false;
this.$('submit').disabled = false;
try {
var responseText = $('photos-iframe').contentDocument.body.textContent;
var responseText = this.$('iframe').contentDocument.body.textContent;
var response = eval ('('+ responseText +')');
if (response.data)
{
$('photo-id').value = '';
$('photo-id').focus ();
this.$('photo-id').value = '';
this.$('photo-id').focus ();
alert (_('ImageUploaded'));
}
else

View File

@ -1,13 +1,13 @@
#photos
.photos
{
padding: 1em;
}
#photos .box
.photos .box
{
max-width: 40em;
}
#photos form
.photos form
{
margin: 0 auto;
max-width: 25em;
@ -16,25 +16,25 @@ div.form-group
{
padding: 0.4em;
}
#photos form label
.photos form label
{
display: block;
margin-bottom: 0.5em;
}
#photos input,
#photos select
.photos input,
.photos select
{
margin: 0;
width: 100%;
}
#photos-iframe
.photos iframe
{
display: none;
}
/* Footer */
#photos button
.photos button
{
display: block;
margin: 0 auto;

View File

@ -0,0 +1,39 @@
<vn>
<div id="form" class="photos">
<div class="box">
<div class="header">
<h1><t>Photos</t></h1>
</div>
<div class="body">
<form action="rest.php?action=image" method="post" enctype="multipart/form-data" target="photos-iframe" id="photo-form">
<div class="form-group">
<label><t>Id:</t></label>
<input type="number" name="id" id="photo-id"/>
</div>
<div class="form-group">
<label><t>ImageName:</t></label>
<input type="text" name="name"/>
</div>
<div class="form-group">
<label><t>Schema:</t></label>
<input type="hidden" name="schema" id="schema-field"/>
<htk-combo id="schema">
<db-model property="model">
SELECT name, `desc` FROM image_schema ORDER BY `desc`
</db-model>
</htk-combo>
</div>
<div class="form-group">
<label><t>ImageFile:</t></label>
<input type="file" name="image"/>
<input type="hidden" name="MAX_FILE_SIZE" id="photo-size"/>
</div>
<button class="vn" id="submit">
<t>Upload</t>
</button>
</form>
<iframe name="photos-iframe" id="iframe"></iframe>
</div>
</div>
</div>
</vn>

View File

@ -1,42 +0,0 @@
<div id="users">
<div class="box">
<div class="header">
<h1><?=s('UserManagement')?></h1>
</div>
<table class="form">
<tbody>
<tr>
<td class="label">
<label><?=s('UserName:')?></label>
</td>
<td>
<htk-entry>
<vn-param id="user-name"/>
</htk-entry>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid id="users-grid">
<db-model updatable="false">
SELECT u.id, u.name, c.Cliente
FROM account.user u
INNER JOIN vn2008.Clientes c ON u.id = c.Id_Cliente
WHERE u.name LIKE CONCAT('%', #user, '%')
OR c.Cliente LIKE CONCAT('%', #user, '%')
OR u.id = #user
ORDER BY u.name LIMIT 200
<sql-batch property="batch">
<item name="user" param="user-name"/>
</sql-batch>
</db-model>
<htk-column-button image="image/supplant.png" tip="AccessAsUser" column="id" id="change-user"/>
<htk-column-button image="image/access-log.svg" tip="AccessLog" column="id" id="access-log"/>
<htk-column-spin title="UserNumber" column="id"/>
<htk-column-text title="UserName" column="name"/>
<htk-column-text title="Alias" column="Cliente"/>
</htk-grid>
</div>
</div>
</div>

View File

@ -1,14 +1,14 @@
#users
.users
{
padding: 1em;
min-width: 35em;
}
#users .box
.users .box
{
max-width: 50em;
margin: 0 auto;
}
#users tbody tr
.users tbody tr
{
height: 3.4em;
}

View File

@ -0,0 +1,44 @@
<vn>
<div id="form" class="users">
<div class="box">
<div class="header">
<h1><t>UserManagement</t></h1>
</div>
<table class="form">
<tbody>
<tr>
<td class="label">
<label><t>UserName:</t></label>
</td>
<td>
<htk-entry>
<vn-param id="user-name"/>
</htk-entry>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid id="users-grid">
<db-model updatable="false">
SELECT u.id, u.name, c.Cliente
FROM account.user u
INNER JOIN vn2008.Clientes c ON u.id = c.Id_Cliente
WHERE u.name LIKE CONCAT('%', #user, '%')
OR c.Cliente LIKE CONCAT('%', #user, '%')
OR u.id = #user
ORDER BY u.name LIMIT 200
<sql-batch property="batch">
<item name="user" param="user-name"/>
</sql-batch>
</db-model>
<htk-column-button image="image/supplant.png" tip="_AccessAsUser" column="id" id="change-user"/>
<htk-column-button image="image/access-log.svg" tip="_AccessLog" column="id" id="access-log"/>
<htk-column-spin title="_UserNumber" column="id"/>
<htk-column-text title="_UserName" column="name"/>
<htk-column-text title="_Alias" column="Cliente"/>
</htk-grid>
</div>
</div>
</div>
</vn>

View File

@ -5,8 +5,8 @@ Vn.Users = new Class
,activate: function ()
{
this.get ('change-user').on ('clicked', this.changeUserClicked.bind (this));
this.get ('access-log').on ('clicked', this.accessLogClicked.bind (this));
this.$('change-user').on ('clicked', this.changeUserClicked.bind (this));
this.$('access-log').on ('clicked', this.accessLogClicked.bind (this));
}
,changeUserClicked: function (column, value)

View File

@ -1,145 +0,0 @@
<div id="visits">
<div class="box">
<div class="header">
<h1><?=s('VisitsManagement')?></h1>
<div class="action-bar">
<button id="refresh">
<img src="image/dark/refresh.svg" alt=""/>
<?=s('Refresh')?>
</button>
<button id="sessions-button">
<img src="image/dark/user-info.svg" alt=""/>
<?=s('ActiveSessions')?>
</button>
<button id="visits-button">
<img src="image/dark/graph.svg" alt=""/>
<?=s('VisitsQuery')?>
</button>
</div>
</div>
<div class="step" id="sessions-step">
<table class="form">
<tbody>
<tr>
<td class="label">
<label><?=s('ActiveSessions:')?></label>
</td>
<td>
<htk-label>
<db-calc-sum model="sessions" id="num-sessions"/>
</htk-label>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('NewVisitsTotal:')?></label>
</td>
<td>
<htk-label>
<db-calc-sum model="sessions" column-name="is_new"/>
</htk-label>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid>
<db-model updatable="false" id="sessions">
SELECT s.id, c.Cliente, e.date_time login, is_new,
s.date_time last_activity, a.platform, a.browser, a.version
FROM user_session s
JOIN visit_user e ON s.visit_user_id = e.id
JOIN visit_access c ON e.access_id = c.id
JOIN visit_agent a ON c.agent_id = a.id
JOIN visit v ON a.visit_id = v.id
JOIN account.user u ON e.user_id = u.id
JOIN vn2008.Clientes c ON e.user_id = c.Id_cliente
ORDER BY last_activity DESC
</db-model>
<htk-column-spin title="SessionNumber" column="id"/>
<htk-column-text title="User" column="Cliente"/>
<htk-column-date title="Login" column="login" format="%a, %T"/>
<htk-column-date title="LastActivity" column="last_activity" format="%a, %T"/>
<htk-column-text title="SO" column="platform"/>
<htk-column-text title="Browser" column="browser"/>
<htk-column-text title="Version" column="version"/>
<htk-column-check title="NewVisit" column="is_new"/>
</htk-grid>
</div>
</div>
<div class="step" id="visits-step">
<table class="form">
<tbody>
<tr>
<td class="label">
<label><?=s('FromDate:')?></label>
</td>
<td>
<htk-date-chooser>
<vn-param id="date-from"/>
</htk-date-chooser>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('ToDate:')?></label>
</td>
<td>
<htk-date-chooser>
<vn-param id="date-to"/>
</htk-date-chooser>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('VisitsTotal:')?></label>
</td>
<td>
<htk-label>
<db-calc-sum model="visits" column-name="visits"/>
</htk-label>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('NewVisitsTotal:')?></label>
</td>
<td>
<htk-label>
<db-calc-sum model="visits" column-name="new_visits"/>
</htk-label>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid empty-message="SelectDateInterval">
<db-model id="visits">
SELECT browser
,MIN(CAST(version AS DECIMAL(4,1))) min_version
,MAX(CAST(version AS DECIMAL(4,1))) max_version
,MAX(e.date_time) last_visit
,COUNT(DISTINCT c.id) visits
,SUM(is_new) new_visits
FROM visit_user e
JOIN visit_access c ON e.access_id = c.id
JOIN visit_agent a ON c.agent_id = a.id
JOIN visit v ON a.visit_id = v.id
WHERE e.date_time BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC
<sql-batch property="batch">
<item name="from" param="date-from"/>
<item name="to" param="date-to"/>
</sql-batch>
</db-model>
<htk-column-text title="Browser" column="browser"/>
<htk-column-spin title="MinVersion" column="min_version" digits="1"/>
<htk-column-spin title="MaxVersion" column="max_version" digits="1"/>
<htk-column-date title="LastVisit" column="last_visit" format="%a, %e %b %Y at %T"/>
<htk-column-spin title="Visits" column="visits"/>
<htk-column-spin title="NewVisits" column="new_visits"/>
</htk-grid>
</div>
</div>
</div>
</div>

View File

@ -1,9 +1,9 @@
#visits
.visits
{
padding: 1em;
min-width: 50em;
}
#visits .box
.visits .box
{
max-width: 80em;
margin: 0 auto;

View File

@ -0,0 +1,147 @@
<vn>
<div id="form" class="visits">
<div class="box">
<div class="header">
<h1><t>VisitsManagement</t></h1>
<div class="action-bar">
<button id="refresh">
<img src="image/dark/refresh.svg" alt=""/>
<t>Refresh</t>
</button>
<button id="sessions-button">
<img src="image/dark/user-info.svg" alt=""/>
<t>ActiveSessions</t>
</button>
<button id="visits-button">
<img src="image/dark/graph.svg" alt=""/>
<t>VisitsQuery</t>
</button>
</div>
</div>
<div class="step" id="sessions-step">
<table class="form">
<tbody>
<tr>
<td class="label">
<label><t>ActiveSessions:</t></label>
</td>
<td>
<htk-label>
<db-calc-sum model="sessions" id="num-sessions"/>
</htk-label>
</td>
</tr>
<tr>
<td class="label">
<label><t>NewVisitsTotal:</t></label>
</td>
<td>
<htk-label>
<db-calc-sum model="sessions" column-name="is_new"/>
</htk-label>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid>
<db-model updatable="false" id="sessions">
SELECT s.id, c.Cliente, e.date_time login, is_new,
s.date_time last_activity, a.platform, a.browser, a.version
FROM user_session s
JOIN visit_user e ON s.visit_user_id = e.id
JOIN visit_access c ON e.access_id = c.id
JOIN visit_agent a ON c.agent_id = a.id
JOIN visit v ON a.visit_id = v.id
JOIN account.user u ON e.user_id = u.id
JOIN vn2008.Clientes c ON e.user_id = c.Id_cliente
ORDER BY last_activity DESC
</db-model>
<htk-column-spin title="_SessionNumber" column="id"/>
<htk-column-text title="_User" column="Cliente"/>
<htk-column-date title="_Login" column="login" format="%a, %T"/>
<htk-column-date title="_LastActivity" column="last_activity" format="%a, %T"/>
<htk-column-text title="_SO" column="platform"/>
<htk-column-text title="_Browser" column="browser"/>
<htk-column-text title="_Version" column="version"/>
<htk-column-check title="_NewVisit" column="is_new"/>
</htk-grid>
</div>
</div>
<div class="step" id="visits-step">
<table class="form">
<tbody>
<tr>
<td class="label">
<label><t>FromDate:</t></label>
</td>
<td>
<htk-date-chooser>
<vn-param id="date-from"/>
</htk-date-chooser>
</td>
</tr>
<tr>
<td class="label">
<label><t>ToDate:</t></label>
</td>
<td>
<htk-date-chooser>
<vn-param id="date-to"/>
</htk-date-chooser>
</td>
</tr>
<tr>
<td class="label">
<label><t>VisitsTotal:</t></label>
</td>
<td>
<htk-label>
<db-calc-sum model="visits" column-name="visits"/>
</htk-label>
</td>
</tr>
<tr>
<td class="label">
<label><t>NewVisitsTotal:</t></label>
</td>
<td>
<htk-label>
<db-calc-sum model="visits" column-name="new_visits"/>
</htk-label>
</td>
</tr>
</tbody>
</table>
<div>
<htk-grid empty-message="SelectDateInterval">
<db-model id="visits">
SELECT browser
,MIN(CAST(version AS DECIMAL(4,1))) min_version
,MAX(CAST(version AS DECIMAL(4,1))) max_version
,MAX(e.date_time) last_visit
,COUNT(DISTINCT c.id) visits
,SUM(is_new) new_visits
FROM visit_user e
JOIN visit_access c ON e.access_id = c.id
JOIN visit_agent a ON c.agent_id = a.id
JOIN visit v ON a.visit_id = v.id
WHERE e.date_time BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC
<sql-batch property="batch">
<item name="from" param="date-from"/>
<item name="to" param="date-to"/>
</sql-batch>
</db-model>
<htk-column-text title="_Browser" column="browser"/>
<htk-column-spin title="_MinVersion" column="min_version" digits="1"/>
<htk-column-spin title="_MaxVersion" column="max_version" digits="1"/>
<htk-column-date title="_LastVisit" column="last_visit" format="%a, %e %b %Y at %T"/>
<htk-column-spin title="_Visits" column="visits"/>
<htk-column-spin title="_NewVisits" column="new_visits"/>
</htk-grid>
</div>
</div>
</div>
</div>
</vn>

View File

@ -5,13 +5,11 @@ Vn.Visits = new Class
,activate: function ()
{
Vn.get ('refresh').addEventListener ('click', this.refreshClicked.bind (this));
Vn.get ('sessions-button').addEventListener ('click', this.sessionsClicked.bind (this));
Vn.get ('visits-button').addEventListener ('click', this.visitsClicked.bind (this));
this.get ('date-to').value = new Date ();
this.get ('num-sessions').func = this.sessionsFunc;
this.$('refresh').addEventListener ('click', this.refreshClicked.bind (this));
this.$('sessions-button').addEventListener ('click', this.sessionsClicked.bind (this));
this.$('visits-button').addEventListener ('click', this.visitsClicked.bind (this));
this.$('date-to').value = new Date ();
this.$('num-sessions').func = this.sessionsFunc;
this.sessionsClicked ();
}
@ -20,20 +18,20 @@ Vn.Visits = new Class
if (this.currentStep)
this.currentStep.style.display = 'none';
this.currentStep = Vn.get (stepId);
this.currentStep = this.$(stepId);
this.currentStep.style.display = 'inline';
}
,sessionsClicked: function ()
{
this.showStep ('sessions-step');
this.model = this.get ('sessions');
this.model = this.$('sessions');
}
,visitsClicked: function ()
{
this.showStep ('visits-step');
this.model = this.get ('visits');
this.model = this.$('visits');
}
,refreshClicked: function ()

View File

@ -1,17 +0,0 @@
<div id="packages">
<div class="box">
<div class="header">
<h1><?=s('ListByAgency')?></h1>
</div>
<htk-grid>
<db-model property="model">
CALL vn2008.agencia_volume ()
</db-model>
<htk-column-button image="image/show.svg" tip="ShowByProvince" column="agency_id" id="column-show"/>
<htk-column-text title="Agency" column="Agencia"/>
<htk-column-spin title="Exps" column="expediciones"/>
<htk-column-spin title="Bundles" column="Bultos"/>
<htk-column-spin title="Prevision" column="Faltan"/>
</htk-grid>
</div>
</div>

View File

@ -5,7 +5,7 @@ Vn.Packages = new Class
,activate: function ()
{
this.get ('column-show').on ('clicked', this.onShowClick, this);
this.$('column-show').on ('clicked', this.onShowClick, this);
}
,onShowClick: function (column, agencyId)

View File

@ -1,8 +1,8 @@
#packages
.packages
{
padding: 1em;
}
#packages .box
.packages .box
{
max-width: 50em;
margin: 0 auto;

View File

@ -0,0 +1,19 @@
<vn>
<div id="form" class="packages">
<div class="box">
<div class="header">
<h1><t>ListByAgency</t></h1>
</div>
<htk-grid>
<db-model property="model">
CALL vn2008.agencia_volume ()
</db-model>
<htk-column-button image="image/show.svg" tip="_ShowByProvince" column="agency_id" id="column-show"/>
<htk-column-text title="_Agency" column="Agencia"/>
<htk-column-spin title="_Exps" column="expediciones"/>
<htk-column-spin title="_Bundles" column="Bultos"/>
<htk-column-spin title="_Prevision" column="Faltan"/>
</htk-grid>
</div>
</div>
</vn>

View File

@ -1,25 +0,0 @@
<div id="provinces">
<vn-group>
<vn-param id="agency">
<vn-hash-link key="agency"/>
</vn-param>
<vn-param id="agency-id"/>
</vn-group>
<div class="box">
<div class="header">
<h1><?php i('ByProvince') ?></h1>
</div>
<htk-grid empty-message="SelectAgency">
<db-model>
CALL vn2008.desglose_volume (#agency)
<sql-batch property="batch">
<item name="agency" param="agency"/>
</sql-batch>
</db-model>
<htk-column-text title="Province" column="Provincia"/>
<htk-column-spin title="Expeditions" column="expediciones"/>
<htk-column-spin title="Bundles" column="Bultos"/>
<htk-column-spin title="Left" column="Prevision"/>
</htk-grid>
</div>
</div>

View File

@ -1,8 +1,8 @@
#provinces
.provinces
{
padding: 1em;
}
#provinces .box
.provinces .box
{
max-width: 50em;
margin: 0 auto;

View File

@ -0,0 +1,27 @@
<vn>
<vn-group>
<vn-param id="agency">
<vn-hash-link key="agency"/>
</vn-param>
<vn-param id="agency-id"/>
</vn-group>
<div id="form" class="provinces">
<div class="box">
<div class="header">
<h1><t>ByProvince</t></h1>
</div>
<htk-grid empty-message="SelectAgency">
<db-model>
CALL vn2008.desglose_volume (#agency)
<sql-batch property="batch">
<item name="agency" param="agency"/>
</sql-batch>
</db-model>
<htk-column-text title="_Province" column="Provincia"/>
<htk-column-spin title="_Expeditions" column="expediciones"/>
<htk-column-spin title="_Bundles" column="Bultos"/>
<htk-column-spin title="_Left" column="Prevision"/>
</htk-grid>
</div>
</div>
</vn>

View File

@ -1,21 +1,21 @@
#about
.about
{
padding: 1em;
}
#about .box
.about .box
{
max-width: 50em;
margin: 0 auto;
}
#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;
@ -23,17 +23,17 @@
margin: 1em;
color: #4A1;
}
#about p
.about p
{
width: 90%;
display: block;
margin: 1em auto;
}
#summary
.summary
{
padding-bottom: 1em;
}
#summary p
.summary p
{
max-width: 30em;
text-align: center;
@ -46,7 +46,7 @@
/* Images */
#about img
.about img
{
max-width: 90%;
text-align: center;
@ -54,18 +54,18 @@
display: block;
margin: 0 auto;
}
#about img[alt="producers"],
#about img[alt="4_control"],
#about img[alt="dealer"],
#about img[alt="goods_transport"]
.about img[alt="producers"],
.about img[alt="4_control"],
.about img[alt="dealer"],
.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;

View File

@ -1,95 +1,97 @@
<div id="about">
<vn>
<div id="form" class="about">
<div class="box">
<div>
<div class="header">
<h1><?=s('QualityAndVariety')?></h1>
<h1><t>QualityAndVariety</t></h1>
</div>
<p><?=s('MaximumFreshness')?></p>
<h3><?=s('SquareMeters')?></h3>
<p><t>MaximumFreshness</t></p>
<h3><t>SquareMeters</t></h3>
<img src="forms/cms/about/image/store.png" alt="store"/>
<h3><?=s('AboutRealms')?></h3>
<p><?=s('AboutLocation')?></p>
<h3><t>AboutRealms</t></h3>
<p><t>AboutLocation</t></p>
<img src="forms/cms/about/image/trailer.png" alt="trailer"/>
<p>
<img src="forms/cms/about/image/dealer.png" alt="dealer"/>
<?=s('PurchaseThroughWeb')?>
<t>PurchaseThroughWeb</t>
</p>
<img src="forms/cms/about/image/palletizing.png" alt="palletizing"/>
</div>
<div>
<div class="header">
<h1><?=s('WhatMakeUsDifferent')?></h1>
<h1><t>WhatMakeUsDifferent</t></h1>
</div>
<p><?=s('DesignVariety')?></p>
<p><t>DesignVariety</t></p>
<img src="forms/cms/about/image/differentiates_us.png" alt="differentiates_us"/>
<p><?=s('AdaptToYourNeeds')?></p>
<h3><?=s('TheBestQuality')?></h3>
<p><t>AdaptToYourNeeds</t></p>
<h3><t>TheBestQuality</t></h3>
</div>
<div>
<div class="header">
<h1><?=s('AtYourService')?></h1>
<h1><t>AtYourService</t></h1>
</div>
<h2><?=s('BuyersAndTraders')?></h2>
<h2><t>BuyersAndTraders</t></h2>
<img src="forms/cms/about/image/commercial.png" alt="commercial"/>
</div>
<div>
<div class="header">
<h1><?=s('Training')?></h1>
<h1><t>Training</t></h1>
</div>
<p><?=s('GoodTraining')?></p>
<p><t>GoodTraining</t></p>
<img src="forms/cms/about/image/training.png" alt="training"/>
<p><?=s('SpecialTrainingPrices')?></p>
<p><t>SpecialTrainingPrices</t></p>
<img src="forms/cms/about/image/courses.png" alt="courses"/>
<h2><?=s('YoutubeChannel')?></h2>
<h2><t>YoutubeChannel</t></h2>
<img src="forms/cms/about/image/youtube.png" alt="youtube"/>
</div>
<div>
<div class="header">
<h1><?=s('HowWeWork')?></h1>
<h1><t>HowWeWork</t></h1>
</div>
<p><?=s('AalsmeerAuction')?></p>
<p><t>AalsmeerAuction</t></p>
<img src="forms/cms/about/image/auction.png" alt="auction"/>
<p><?=s('BeforeAuction')?></p>
<p><t>BeforeAuction</t></p>
<img src="forms/cms/about/image/producers.png" alt="producers"/>
<p><?=s('DirectlyFromProviders')?></p>
<p><?=s('GoodsDischarge')?></p>
<p><t>DirectlyFromProviders</t></p>
<p><t>GoodsDischarge</t></p>
<img src="forms/cms/about/image/goods_transport.png" alt="goods_transport"/>
<h2>
<?=s('FirstQualityControl')?>
<t>FirstQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<img src="forms/cms/about/image/goods_receive.png" alt="goods_receive"/>
<p><?=s('GoodsTravel')?></p>
<p><t>GoodsTravel</t></p>
<img src="forms/cms/about/image/2_control.png" alt="2_control"/>
<p><?=s('GoodsReception')?></p>
<p><t>GoodsReception</t></p>
<h2>
<?=s('SecondQualityControl')?>
<t>SecondQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><?=s('CustomerOrders')?></p>
<p><t>CustomerOrders</t></p>
<img src="forms/cms/about/image/web.png" alt="web"/>
<p><?=s('AfterOrder')?></p>
<p><t>AfterOrder</t></p>
<img src="forms/cms/about/image/4_control.png" alt="4_control"/>
<h2>
<?=s('ThirdQualityControl')?>
<t>ThirdQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><?=s('BuyerControl')?></p>
<p><t>BuyerControl</t></p>
<h2>
<?=s('FourthQualityControl')?>
<t>FourthQualityControl</t>
<img src="forms/cms/about/image/glass.png" alt="glass"/>
</h2>
<p><?=s('EmbeddedSection')?></p>
<p><t>EmbeddedSection</t></p>
<img src="forms/cms/about/image/fit.png" alt="fit"/>
<p><?=s('AfterEmbedAgency')?></p>
<p><t>AfterEmbedAgency</t></p>
<img src="forms/cms/about/image/agencies.png" alt="agencies"/>
<p><?=s('FreshnessGuaranteed')?></p>
<p><t>FreshnessGuaranteed</t></p>
</div>
<div id="summary">
<div class="summary">
<p>
<?=s('AboutSummary')?>
<t>AboutSummary</t>
<img src="image/logo.svg" alt="Verdnatura"/>
</p>
</div>
</div>
</div>
</vn>

View File

@ -6,7 +6,7 @@ Vn.Contact = new Class
,activate: function ()
{
var self = this;
var form = Vn.get ('contact-form').onsubmit = function ()
var form = this.$('contact-form').onsubmit = function ()
{ self.onSubmit (); return false; };
this.refreshCaptcha ();
@ -15,12 +15,12 @@ Vn.Contact = new Class
,refreshCaptcha: function ()
{
var url = 'forms/cms/contact/captcha.php';
Vn.get ('captcha-img').src = url +'?'+ new Date ().getTime ();
this.$('captcha-img').src = url +'?'+ new Date ().getTime ();
}
,onSubmit: function ()
{
var form = Vn.get ('contact-form');
var form = this.$('contact-form');
var request = new Vn.FormRequest ();
request.send (form, this.onResponse.bind (this));
@ -28,7 +28,7 @@ Vn.Contact = new Class
,onResponse: function (response)
{
var form = Vn.get ('contact-form');
var form = this.$('contact-form');
if (response)
{

View File

@ -1,52 +0,0 @@
<div id="contact">
<div class="box">
<div class="header">
<h1><?=s('IWantCustomer')?></h1>
</div>
<div class="body">
<p>
<?=s('FillFormData')?>
</p>
<p>
<?=s('OrCallUs')?>
</p>
<form action="forms/cms/contact/send-data.php" method="post" id="contact-form">
<div class="form-group">
<label><?=s('Name:')?></label>
<input type="text" name="name"/>
</div>
<div class="form-group">
<label><?=s('City:')?></label>
<input type="text" name="city"/>
</div>
<div class="form-group">
<label><?=s('PC:')?></label>
<input type="text" name="pc"/>
</div>
<div class="form-group">
<label><?=s('Phone:')?></label>
<input type="text" name="phone"/>
</div>
<div class="form-group">
<label><?=s('EMail:')?></label>
<input type="text" name="email"/>
</div>
<div class="form-group">
<label><?=s('Message:')?></label>
<textarea name="message"/>
</div>
<div class="form-group" id="captcha">
<label><?=s('Anti-Spam:')?></label>
<img alt="Captcha" id="captcha-img"/>
<input type="text" name="captcha"/>
</div>
<p>
<?=s('AllFieldsMandatory')?>
</p>
<button class="vn">
<?=s('Send')?>
</button>
</form>
</div>
</div>
</div>

View File

@ -1,25 +1,25 @@
#contact
.contact
{
padding: 1em;
}
#contact .box
.contact .box
{
max-width: 40em;
}
#contact p
.contact p
{
position: relative;
text-align: center;
max-width: 25em;
margin: 1em auto;
}
#contact form
.contact form
{
margin: 0 auto;
max-width: 25em;
}
#contact form p
.contact form p
{
margin: 1em auto;
display: block;
@ -29,22 +29,22 @@ div.form-group
{
padding: 0.4em;
}
#contact form label
.contact form label
{
display: block;
margin-bottom: 0.5em;
}
#contact input,
#contact textarea
.contact input,
.contact textarea
{
margin: 0;
width: 100%;
}
#contact textarea
.contact textarea
{
height: 5em;
}
#contact button
.contact button
{
display: block;
margin: 0 auto;
@ -54,11 +54,11 @@ div.form-group
/* Captcha */
#captcha img
.captcha img
{
vertical-align: middle;
}
#captcha input
.captcha input
{
margin-left: 1em;
max-width: 8em;

View File

@ -0,0 +1,54 @@
<vn>
<div id="form" class="contact">
<div class="box">
<div class="header">
<h1><t>IWantCustomer</t></h1>
</div>
<div class="body">
<p>
<t>FillFormData</t>
</p>
<p>
<t>OrCallUs</t>
</p>
<form action="forms/cms/contact/send-data.php" method="post" id="contact-form">
<div class="form-group">
<label><t>Name:</t></label>
<input type="text" name="name"/>
</div>
<div class="form-group">
<label><t>City:</t></label>
<input type="text" name="city"/>
</div>
<div class="form-group">
<label><t>PC:</t></label>
<input type="text" name="pc"/>
</div>
<div class="form-group">
<label><t>Phone:</t></label>
<input type="text" name="phone"/>
</div>
<div class="form-group">
<label><t>EMail:</t></label>
<input type="text" name="email"/>
</div>
<div class="form-group">
<label><t>Message:</t></label>
<textarea name="message"/>
</div>
<div class="form-group captcha">
<label><t>Anti-Spam:</t></label>
<img alt="Captcha" id="captcha-img"/>
<input type="text" name="captcha"/>
</div>
<p>
<t>AllFieldsMandatory</t>
</p>
<button class="vn">
<t>Send</t>
</button>
</form>
</div>
</div>
</div>
</vn>

View File

@ -17,14 +17,13 @@ Vn.Home = new Class
var query = 'SELECT question, @id := id FROM survey ORDER BY id DESC LIMIT 1; '
+'SELECT id, answer, votes FROM survey_answer WHERE survey_id = @id';
this.conn.execQuery (query, this.answersQueryDone.bind (this));
var voteButton = document.getElementById ('vote-button');
voteButton.addEventListener ('click', this.voteClicked.bind (this));
this.$('vote-button').addEventListener ('click', this.voteClicked.bind (this));
*/ }
,onNewsQueryDone: function (resultSet)
{
var newsColumn = document.getElementById ('news-column');
var newsColumn = this.$('news-column');
var res = resultSet.fetchResult ();
if (res)
@ -64,13 +63,13 @@ Vn.Home = new Class
{
var value = resultSet.fetchValue ();
var question = document.getElementById ('question');
var question = this.$('question');
question.appendChild (document.createTextNode (value));
var res = resultSet.fetchResult ();
this.totalVotes = 0;
var answers = document.getElementById ('answers');
var answers = this.$('answers');
if (res)
while (res.next ())
@ -112,7 +111,7 @@ Vn.Home = new Class
,refreshVotes: function ()
{
var totalNode = Vn.get ('total');
var totalNode = this.$('total');
Vn.Node.setText (totalNode, this.totalVotes);
}

View File

@ -1,15 +0,0 @@
<div id="home">
<div class="column" id="news-column"/>
<!--
<div id="survey">
<div id="question"/>
<table>
<tbody id="answers"/>
</table>
<div id="survey-votes">
<?=s('Total')?> <span id="total"/> <?=s('votes')?>
</div>
<button id="vote-button"><?=s('Vote')?></button>
</div>
-->
</div>

View File

@ -1,9 +1,9 @@
/* News panel */
#home
.home
{
padding: 1em;
}
#home .column
.home .column
{
max-width: 40em;
margin: 0 auto;
@ -52,23 +52,23 @@
/* Survey */
#survey
.survey
{
position: absolute;
right: 0;
width: 6em;
top: 0;
}
#question, #survey-votes
.question, .survey-votes
{
text-align: center;
margin: 1em;
}
#answers .radio
.answers .radio
{
text-align: right;
}
#survey button
.survey button
{
display: block;
margin: auto;

View File

@ -0,0 +1,17 @@
<vn>
<div id="form" class="home">
<div class="column" id="news-column"/>
<!--
<div class="survey">
<div id="question" class="question"/>
<table>
<tbody id="answers" class="answers"/>
</table>
<div class="survey-votes">
<t>Total</t> <span id="total"/> <t>votes</t>
</div>
<button id="vote-button"><t>Vote</t></button>
</div>
-->
</div>
</vn>

View File

@ -1 +0,0 @@
<div id="location"/>

View File

@ -43,12 +43,12 @@ Vn.Location = new Class
return;
var options = {
zoom: 5
zoom: 4
,mapTypeId: google.maps.MapTypeId.ROADMAP
,center: new google.maps.LatLng (46.0, 4.0)
};
var div = document.getElementById ('location');
var div = this.$('form');
var gmap = new google.maps.Map (div, options);
if (this.locations)

View File

@ -1,4 +1,4 @@
#location
.location
{
position: relative;
height: 100%;

View File

@ -0,0 +1,3 @@
<vn>
<div id="form" class="location"/>
</vn>

View File

@ -1,9 +1,10 @@
/* News panel */
#training
.training
{
padding: 1em;
}
#training .column
.training .column
{
max-width: 40em;
margin: 0 auto;

View File

@ -15,7 +15,7 @@ Vn.Training = new Class
,onCoursesQueryDone: function (resultSet)
{
var coursesColumn = document.getElementById ('courses-column');
var coursesColumn = this.$('courses-column');
var res = resultSet.fetchResult ();
if (res)

View File

@ -1,3 +1,5 @@
<div id="training">
<vn>
<div id="form" class="training">
<div class="column" id="courses-column"/>
</div>
</vn>

View File

@ -1,11 +0,0 @@
<div id="why">
<div class="box">
<div class="header">
<h1><?=s('AboutCompany')?></h1>
</div>
<div class="body">
<ul><?=s('AboutWhy')?></ul>
<img src="image/store.png" alt="Store photo"/>
</div>
</div>
</div>

View File

@ -1,14 +1,14 @@
#why
.why
{
padding: 1em;
}
#why .box
.why .box
{
max-width: 40em;
margin: 0 auto;
}
#why ul
.why ul
{
list-style-type: none;
padding: 0 1em;
@ -16,11 +16,11 @@
max-width: 36em;
margin: 0 auto;
}
#why li
.why li
{
padding: 0.5em 0;
}
#why img
.why img
{
display: block;
margin: 0 auto;

View File

@ -0,0 +1,22 @@
<vn>
<div id="form" class="why">
<div class="box">
<div class="header">
<h1><t>AboutCompany</t></h1>
</div>
<div class="body">
<ul>
<li><t>BecauseOurBigCatalog</t></li>
<li><t>BecauseThisWeb</t></li>
<li><t>BecauseOurShoppingDep</t></li>
<li><t>BecauseOrderIsEasy</t></li>
<li><t>BecauseOurPlant</t></li>
<li><t>BecauseOurSalesDep</t></li>
<li><t>BecauseOurWorkShop</t></li>
<li><t>BecauseWeHaveWhatYouNeed</t></li>
</ul>
<img src="image/store.png" alt="Store photo"/>
</div>
</div>
</div>
</vn>

View File

@ -9,12 +9,12 @@ Vn.Basket = new Class
{
// Connecting buttons events
Vn.get ('go-catalog').addEventListener ('click', this.catalogClicked.bind (this));
Vn.get ('checkout-button').addEventListener ('click', this.checkoutClicked.bind (this));
this.$('go-catalog').addEventListener ('click', this.catalogClicked.bind (this));
this.$('checkout-button').addEventListener ('click', this.checkoutClicked.bind (this));
// Loading order
this.orderId = this.get ('order-id');
this.orderId = this.$('order-id');
if (!this.orderId.value)
{
@ -32,13 +32,13 @@ Vn.Basket = new Class
// Configuring columns
var amount = this.get ('column-amount');
var amount = this.$('column-amount');
amount.on ('changed', this.amountChanged.bind (this));
amount.renderer = this.amountRender;
this.get ('column-subtotal').renderer = this.subtotalRender.bind (this);
this.get ('stems').renderer = this.stemsRender.bind (this);
this.get ('order-total').func = this.subtotal;
this.$('column-subtotal').renderer = this.subtotalRender.bind (this);
this.$('stems').renderer = this.stemsRender.bind (this);
this.$('order-total').func = this.subtotal;
}
,catalogClicked: function ()
@ -82,7 +82,7 @@ Vn.Basket = new Class
,amountChanged: function (renderer, row, newValue)
{
var model = this.get ('order-rows');
var model = this.$('order-rows');
model.set (row, 'amount', newValue * model.get (row, 'grouping'));
}

View File

@ -1,9 +1,9 @@
#basket
.basket
{
padding: 1em;
min-width: 65em;
}
#basket .box
.basket .box
{
max-width: 70em;
margin: 0 auto;
@ -11,14 +11,14 @@
/* Data */
#basket td.label
.basket td.label
{
width: 10em;
}
/* Rows */
#basket td.available-exceeded input
.basket td.available-exceeded input
{
background-color: #FCC;
}

View File

@ -1,30 +1,33 @@
<div id="basket">
<vn-param id="order-id">
<vn-hash-link key="order"/>
</vn-param>
<db-form id="order-form">
<db-model>
SELECT date_send, type_id, wh_id, note, insurance, address_id, id
FROM order_view WHERE id = #id
<sql-batch property="batch">
<item name="id" param="order-id"/>
</sql-batch>
</db-model>
<db-param column="date_send" id="date"/>
<db-param column="wh_id" id="warehouse"/>
<db-param column="address_id" id="address"/>
</db-form>
<vn>
<vn-group>
<vn-param id="order-id">
<vn-hash-link key="order"/>
</vn-param>
<db-form id="order-form">
<db-model>
SELECT date_send, type_id, wh_id, note, insurance, address_id, id
FROM order_view WHERE id = #id
<sql-batch property="batch">
<item name="id" param="order-id"/>
</sql-batch>
</db-model>
<db-param column="date_send" id="date"/>
<db-param column="wh_id" id="warehouse"/>
<db-param column="address_id" id="address"/>
</db-form>
</vn-group>
<div id="form" class="basket">
<div class="box">
<div class="header">
<h1><?=s('ShoppingBasket')?></h1>
<h1><t>ShoppingBasket</t></h1>
<div class="action-bar">
<button id="go-catalog">
<img src="image/dark/menu.svg" alt=""/>
<?=s('GoToCatalog')?>
<t>GoToCatalog</t>
</button>
<button id="checkout-button">
<img src="image/dark/ok.svg" alt=""/>
<?=s('Checkout')?>
<t>Checkout</t>
</button>
<div class="clear"></div>
</div>
@ -34,7 +37,7 @@
<tbody>
<tr>
<td class="label">
<label><?=s('OrderNumber:')?></label>
<label><t>OrderNumber:</t></label>
</td>
<td>
<htk-label column="id" form="order-form"/>
@ -42,7 +45,7 @@
</tr>
<tr>
<td class="label">
<label><?=s('DateExit:')?></label>
<label><t>DateExit:</t></label>
</td>
<td>
<htk-date-chooser column="date_send" form="order-form"/>
@ -50,7 +53,7 @@
</tr>
<tr>
<td class="label">
<label for="warehouse"><?=s('Warehouse:')?></label>
<label for="warehouse"><t>Warehouse:</t></label>
</td>
<td>
<htk-combo column="wh_id" form="order-form">
@ -63,13 +66,13 @@
</tr>
<tr>
<td class="label">
<label for="total"><?=s('OrderTotal:')?></label>
<label for="total"><t>OrderTotal:</t></label>
</td>
<td>
<htk-label format="%.2d€">
<db-calc-sum id="order-total" model="order-rows"/>
</htk-label>
<?=s('VATNotIncluded')?>
<t>VATNotIncluded</t>
</td>
</tr>
</tbody>
@ -92,20 +95,21 @@
</sql-batch>
</db-model>
<htk-column-image column="Foto" directory="catalog" subdir="30x30" show-full="true"/>
<htk-column-spin title="Amount" editable="true" id="column-amount"/>
<htk-column-text title="Pack" column="grouping" format="x%.0d"/>
<htk-column-spin title="Stems" column="amount" id="stems" editable="true"/>
<htk-column-spin title="Avail" column="available"/>
<htk-column-text title="Item" column="Article"/>
<htk-column-text title="Cat" column="Categoria"/>
<htk-column-text title="S1" column="Medida"/>
<htk-column-text title="Stems" column="Tallos"/>
<htk-column-text title="Color" column="Color"/>
<htk-column-text title="Origin" column="Abreviatura"/>
<htk-column-spin title="Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="Desc" column="discount" unit="%"/>
<htk-column-spin title="Subtotal" unit="€" digits="2" id="column-subtotal"/>
<htk-column-spin title="_Amount" editable="true" id="column-amount"/>
<htk-column-text title="_Pack" column="grouping" format="x%.0d"/>
<htk-column-spin title="_Stems" column="amount" id="stems" editable="true"/>
<htk-column-spin title="_Avail" column="available"/>
<htk-column-text title="_Item" column="Article"/>
<htk-column-text title="_Cat" column="Categoria"/>
<htk-column-text title="_S1" column="Medida"/>
<htk-column-text title="_Stems" column="Tallos"/>
<htk-column-text title="_Color" column="Color"/>
<htk-column-text title="_Origin" column="Abreviatura"/>
<htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="_Desc" column="discount" unit="%"/>
<htk-column-spin title="_Subtotal" unit="€" digits="2" id="column-subtotal"/>
</htk-grid>
</div>
</div>
</div>
</vn>

View File

@ -7,26 +7,26 @@ Vn.Catalog = new Class
,activate: function ()
{
var model = this.get ('items');
var model = this.$('items-model');
model.setTableInfo ('m', 'order_row_view');
model.setFieldFlags ('id', Db.Conn.Flag.AI);
model.setFieldFlags ('Id_Article', Db.Conn.Flag.PRI_KEY);
$('basket-button').addEventListener ('click', this.basketClicked.bind (this));
$('catalog-menu-button').addEventListener ('click', this.showMenu.bind (this));
$('catalog-menu').addEventListener ('click', this.onMenuClick.bind (this));
$('search-entry').addEventListener ('change', this.onSearch.bind (this));
this.$('basket-button').addEventListener ('click', this.basketClicked.bind (this));
this.$('menu-button').addEventListener ('click', this.showMenu.bind (this));
this.$('menu').addEventListener ('click', this.onMenuClick.bind (this));
this.$('search-entry').addEventListener ('change', this.onSearch.bind (this));
this.get ('type-column').renderer = this.typeRenderer.bind (this);
this.get ('cat').renderer = this.catRenderer;
this.$('type-column').renderer = this.typeRenderer.bind (this);
this.$('cat').renderer = this.catRenderer;
this.get ('realms-model').on ('status-changed', this.onRealmsReload.bind (this));
this.get ('realms').on ('changed', this.onRealmChanged.bind (this));
this.get ('types-model').on ('status-changed', this.onTypesReload.bind (this));
this.get ('type').on ('changed', this.onTypeChanged.bind (this));
this.get ('order-form').on ('status-changed', this.orderFormChanged.bind (this));
this.get ('warehouse').value = 1;
this.get ('date').value = new Date ();
this.$('realms-model').on ('status-changed', this.onRealmsReload.bind (this));
this.$('realms').on ('changed', this.onRealmChanged.bind (this));
this.$('types-model').on ('status-changed', this.onTypesReload.bind (this));
this.$('type').on ('changed', this.onTypeChanged.bind (this));
this.$('order-form').on ('status-changed', this.orderFormChanged.bind (this));
this.$('warehouse').value = 1;
this.$('date').value = new Date ();
if (!Vn.Url.getQuery ('guest'))
{
@ -35,10 +35,10 @@ Vn.Catalog = new Class
if (!orderId)
this.configureView ();
else
this.get ('order-batch').addValue ('order', orderId);
this.$('order-batch').addValue ('order', orderId);
}
else
this.get ('order').value = 0;
this.$('order').value = 0;
}
,onRealmsReload: function (model, status)
@ -53,8 +53,8 @@ Vn.Catalog = new Class
,onRealmChanged: function ()
{
var color;
var realms = this.get ('realms-model');
var row = realms.search ('id', this.get ('realm').value);
var realms = this.$('realms-model');
var row = realms.search ('id', this.$('realm').value);
if (row != -1)
this.realmColor = '#'+ realms.get (row, 'color');
@ -77,12 +77,12 @@ Vn.Catalog = new Class
var color = null;
if (this.get ('type').value)
if (this.$('type').value)
color = this.realmColor;
$('catalog-header').style.backgroundColor = color;
this.$('header').style.backgroundColor = color;
var itemsGrid = this.get ('items-grid').getNode ();
var itemsGrid = this.$('items-grid').getNode ();
var thead = itemsGrid.getElementsByTagName ('thead')[0];
var tr = thead.getElementsByTagName ('tr')[0];
tr.style.backgroundColor = color;
@ -92,35 +92,35 @@ Vn.Catalog = new Class
{
var title = null;
if (this.get ('type').value)
if (this.$('type').value)
{
var types = this.get ('types-model');
var row = types.search ('tipo_id', this.get ('type').value);
var types = this.$('types-model');
var row = types.search ('tipo_id', this.$('type').value);
if (row != -1)
title = types.get (row, 'Tipo');
}
else if ($('search-entry').value)
else if (this.$('search-entry').value)
title = _('SearchResults');
if (title)
Vn.Node.setText ($('catalog-title'), title);
Vn.Node.setText (this.$('title'), title);
}
,onSearch: function (event)
{
var searchTags = $('search-entry').value;
var searchTags = this.$('search-entry').value;
searchTags = searchTags != '' ? searchTags : null;
var batch = this.get ('batch');
var batch = this.$('batch');
batch.block ();
this.get ('search').value = searchTags;
this.$('search').value = searchTags;
if (searchTags)
{
this.get ('type').value = null;
this.get ('realm').value = null;
this.$('type').value = null;
this.$('realm').value = null;
}
batch.unblock ();
@ -136,7 +136,7 @@ Vn.Catalog = new Class
{
event.stopPropagation ();
this.gui.showBackground ();
$('catalog-menu').style.display = 'block';
this.$('catalog-menu').style.display = 'block';
this.hideMenuCallback = this.hideMenu.bind (this);
document.addEventListener ('click', this.hideMenuCallback);
}
@ -144,7 +144,7 @@ Vn.Catalog = new Class
,hideMenu: function ()
{
this.gui.hideBackground ();
$('catalog-menu').style.display = 'none';
this.$('catalog-menu').style.display = 'none';
document.removeEventListener ('click', this.hideMenuCallback);
this.hideMenuCallback = null;
}
@ -152,17 +152,17 @@ Vn.Catalog = new Class
,configureView: function ()
{
var orderId = 0;
var grid = this.get ('items-grid');
var orderForm = this.get ('order-form');
var grid = this.$('items-grid');
var orderForm = this.$('order-form');
if (orderForm.numRows > 0)
{
orderForm.row = 0;
orderId = orderForm.get ('id');
Vn.Node.setText ($('basket-button'), _('ShoppingBasket'));
Vn.Node.setText (this.$('basket-button'), _('ShoppingBasket'));
var items = this.get ('items');
var items = this.$('items-model');
items.updatable = true;
items.setDefaultFromColumn ('item_id', 'm', 'Id_Article');
items.setDefaultFromValue ('order_id', 'm', orderId);
@ -184,13 +184,13 @@ Vn.Catalog = new Class
});
grid.insertColumn (3, stemsCol);
this.get ('warehouse').master = orderForm.getParam ('wh_id');
this.get ('date').master = orderForm.getParam ('date_send');
this.$('warehouse').master = orderForm.getParam ('wh_id');
this.$('date').master = orderForm.getParam ('date_send');
}
else
Vn.Cookie.unset ('order');
this.get ('order').value = orderId;
this.$('order').value = orderId;
var priceCol = new Htk.ColumnSpin
({
@ -202,7 +202,7 @@ Vn.Catalog = new Class
});
grid.insertColumn (11, priceCol);
$('basket-button').disabled = false;
this.$('basket-button').disabled = false;
}
,orderFormChanged: function (form)
@ -234,7 +234,7 @@ Vn.Catalog = new Class
,amountChanged: function (renderer, row, newValue)
{
var model = this.get ('items');
var model = this.$('items-model');
model.set (row, 'amount', newValue * model.get (row, 'grouping'));
}

View File

@ -1,118 +0,0 @@
<div id="catalog">
<vn-group>
<vn-param id="type">
<vn-hash-link key="type"/>
</vn-param>
<vn-param id="order"/>
<vn-param id="search"/>
<db-model id="realms-model">
SELECT id, reino, color FROM vn2008.reinos
WHERE display != FALSE ORDER BY reino
</db-model>
<db-form id="order-form">
<db-model>
SELECT date_send, wh_id, id FROM order_view WHERE id = #order
<sql-batch property="batch" id="order-batch"/>
</db-model>
</db-form>
<sql-filter type="AND" id="filter">
<sql-filter-item type="EQUAL" id="sql-type">
<sql-field name="tipo_id"/>
<sql-value param="type"/>
</sql-filter-item>
<sql-filter-item type="LIKE">
<sql-field name="Article"/>
<sql-search-tags param="search"/>
</sql-filter-item>
</sql-filter>
</vn-group>
<div id="catalog-center">
<div id="catalog-main">
<div class="box">
<div class="header" id="catalog-header">
<button id="catalog-menu-button">
<img src="image/dark/menu.svg" alt="<?=s('Menu')?>"/>
</button>
<h1 id="catalog-title"><?=s('Catalog')?></h1>
<div id="catalog-topbar">
<div id="catalog-search">
<img src="image/search.svg" alt="<?=s('Search')?>" class="icon"/>
<input type="text" id="search-entry"/>
</div>
</div>
</div>
<htk-grid empty-message="SelectSubtype" id="items-grid">
<db-model result-index="1" main-table="m" updatable="false" id="items">
CALL item (#warehouse, #date);
SELECT i.grouping, m.amount, Foto, i.available, Article, Categoria,
Medida, Tallos, Color, o.Abreviatura, price, fixed, m.id,
Id_Article
FROM vn2008.Articles a
INNER JOIN vn2008.item_catalog i ON i.item_id = a.Id_Article
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
LEFT JOIN order_row_view m
ON m.item_id = a.Id_Article AND m.order_id = #order
WHERE #filter AND available > 0
ORDER BY Article, Medida
LIMIT 400;
DROP TEMPORARY TABLE vn2008.item_catalog;
<sql-batch property="batch" id="batch">
<item name="warehouse" param="warehouse"/>
<item name="date" param="date"/>
<item name="order" param="order"/>
<item name="filter" object="filter"/>
</sql-batch>
</db-model>
<htk-column-image title="*" column="Foto" directory="catalog" subdir="200x200" show-full="true" editable="true"/>
<htk-column-text title="Pack" column="grouping" format="x%.0d"/>
<htk-column-spin title="Aval" column="available"/>
<htk-column-text title="Name" column="Article"/>
<htk-column-text title="Cat" column="Categoria" id="cat"/>
<htk-column-text title="S1" column="Medida"/>
<htk-column-text title="Color" column="Color"/>
<htk-column-text title="Tallos" column="Tallos"/>
<htk-column-text title="Origin" column="Abreviatura"/>
</htk-grid>
<p id="footer-message">
<?=s('IndicativePhotos')?>
</p>
</div>
</div>
</div>
<div id="catalog-menu">
<button disabled="true" id="basket-button">
<?=s('StartOrder')?>
</button>
<div class="form-group">
<htk-date-chooser>
<vn-param id="date"/>
</htk-date-chooser>
</div>
<div class="form-group">
<htk-combo>
<db-model property="model">
SELECT id, name FROM vn2008.warehouse
WHERE reserve ORDER BY name
</db-model>
<vn-param id="warehouse"/>
</htk-combo>
</div>
<htk-realm id="realms" model="realms-model">
<vn-param id="realm">
<vn-hash-link key="realm"/>
</vn-param>
</htk-realm>
<div id="types-box">
<htk-grid id="types-grid" empty-message="SelectFamily">
<db-model id="types-model">
SELECT tipo_id, Tipo FROM vn2008.Tipos
WHERE reino_id = #realm AND Orden != 0 ORDER BY Orden DESC, Tipo
<sql-batch property="batch">
<item name="realm" param="realm"/>
</sql-batch>
</db-model>
<htk-column-link title="Subtype" column="Tipo" id="type-column"/>
</htk-grid>
</div>
</div>
</div>

View File

@ -1,11 +1,11 @@
#catalog
.catalog
{
position: relative;
width: 100%;
height: 100%;
min-height: 25em;
}
#catalog-center
.catalog .center
{
position: absolute;
top: 0;
@ -16,7 +16,7 @@
/* Main */
#catalog-main
.catalog .main
{
position: absolute;
top: 0;
@ -26,14 +26,14 @@
overflow: auto;
padding: 1em;
}
#catalog-main .box
.catalog .main .box
{
margin: 0 auto;
min-width: 52em;
max-width: 70em;
}
#footer-message
.catalog .footer-message
{
padding-bottom: 1em;
text-align: center;
@ -41,13 +41,13 @@
/* Topbar */
#catalog-topbar
.catalog .topbar
{
float: right;
max-width: 15em;
margin: 0 auto;
}
#catalog-search
.catalog .search
{
float: left;
display: block;
@ -55,24 +55,24 @@
height: 2.2em;
padding: 0;
}
#search-entry
.catalog .search > input
{
margin: 0;
border: none;
width: 10em;
box-shadow: none;
}
#search-entry:focus
.catalog .search > input:focus
{
background-color: initial;
}
#catalog-search > img
.catalog .search > img
{
margin: 0.4em;
margin-top: 0;
vertical-align: middle;
}
#catalog-menu-button
.catalog button.menu
{
float: left;
display: none;
@ -83,14 +83,14 @@
padding-left: 0;
margin-left: 0;
}
#catalog-menu-button img
.catalog button.menu > img
{
height: 1.8em;
}
/* Menu */
#catalog-menu
.catalog .menu
{
position: absolute;
z-index: 20;
@ -101,7 +101,7 @@
background-color: white;
box-shadow: 0 0.2em 0.2em #AAA;
}
#basket-button
button.basket
{
width: 100%;
height: 2.5em;
@ -109,16 +109,16 @@
background-color: #00BCD4;
font-size: 1.1em;
}
#basket-button:hover
button.basket:hover
{
background-color: #0AB;
}
#catalog .form-group
.catalog .form-group
{
margin: 2em;
}
#catalog .form-group select,
#catalog .form-group button
.catalog .form-group select,
.catalog .form-group button
{
display: block;
margin: 0 auto;
@ -147,7 +147,7 @@
/* Types */
#types-box
.types-box
{
position: absolute;
top: 16.8em;
@ -156,56 +156,56 @@
left: 0em;
overflow: auto;
}
#types-grid
table.types
{
width: 100%;
}
#types-grid thead
table.types > thead
{
display: none;
}
#types-grid tbody tr
table.types > tbody > tr
{
border: none;
border-top: none;
height: 2.2em;
}
#types-grid tbody a
table.types > tbody a
{
display: block;
padding: 0.3em 7%;
width: 88%;
height: 100%;
}
#types-grid tbody a:hover
table.types tbody a:hover
{
background-color: #EEE;
}
#types-grid td.grid-message
table.types td.grid-message
{
padding-top: 1em;
}
/* Items */
#items-grid
table.items
{
width: 100%;
}
#catalog-main > div.box > div.header,
#items-grid > thead > tr,
#realms-bar
.catalog div.header,
table.items > thead > tr,
.realms-bar
{
background-color: #777;
}
#items-grid > thead th:hover
table.items > thead th:hover
{
background-color: #333;
}
#items-grid > tbody > tr
table.items > tbody > tr
{
height: 6em;
}
#items-grid > tbody img
table.items > tbody img
{
max-height: 5em;
max-width: 5em;

View File

@ -0,0 +1,120 @@
<vn>
<vn-group>
<vn-param id="type">
<vn-hash-link key="type"/>
</vn-param>
<vn-param id="order"/>
<vn-param id="search"/>
<db-model id="realms-model">
SELECT id, reino, color FROM vn2008.reinos
WHERE display != FALSE ORDER BY reino
</db-model>
<db-form id="order-form">
<db-model>
SELECT date_send, wh_id, id FROM order_view WHERE id = #order
<sql-batch property="batch" id="order-batch"/>
</db-model>
</db-form>
<sql-filter type="AND" id="filter">
<sql-filter-item type="EQUAL" id="sql-type">
<sql-field name="tipo_id"/>
<sql-value param="type"/>
</sql-filter-item>
<sql-filter-item type="LIKE">
<sql-field name="Article"/>
<sql-search-tags param="search"/>
</sql-filter-item>
</sql-filter>
</vn-group>
<div id="form" class="catalog">
<div class="center">
<div class="main">
<div class="box">
<div id="header" class="header">
<button id="menu-button" class="menu">
<img src="image/dark/menu.svg" alt="_Menu"/>
</button>
<h1 id="title"><t>Catalog</t></h1>
<div class="topbar">
<div class="search">
<img src="image/search.svg" alt="_Search" class="icon"/>
<input type="text" id="search-entry"/>
</div>
</div>
</div>
<htk-grid empty-message="_SelectSubtype" id="items-grid" class="items">
<db-model result-index="1" main-table="m" updatable="false" id="items-model">
CALL item (#warehouse, #date);
SELECT i.grouping, m.amount, Foto, i.available, Article, Categoria,
Medida, Tallos, Color, o.Abreviatura, price, fixed, m.id,
Id_Article
FROM vn2008.Articles a
INNER JOIN vn2008.item_catalog i ON i.item_id = a.Id_Article
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
LEFT JOIN order_row_view m
ON m.item_id = a.Id_Article AND m.order_id = #order
WHERE #filter AND available > 0
ORDER BY Article, Medida
LIMIT 400;
DROP TEMPORARY TABLE vn2008.item_catalog;
<sql-batch property="batch" id="batch">
<item name="warehouse" param="warehouse"/>
<item name="date" param="date"/>
<item name="order" param="order"/>
<item name="filter" object="filter"/>
</sql-batch>
</db-model>
<htk-column-image title="*" column="Foto" directory="catalog" subdir="200x200" show-full="true" editable="true"/>
<htk-column-text title="_Pack" column="grouping" format="x%.0d"/>
<htk-column-spin title="_Aval" column="available"/>
<htk-column-text title="_Name" column="Article"/>
<htk-column-text title="_Cat" column="Categoria" id="cat"/>
<htk-column-text title="_S1" column="Medida"/>
<htk-column-text title="_Color" column="Color"/>
<htk-column-text title="_Tallos" column="Tallos"/>
<htk-column-text title="_Origin" column="Abreviatura"/>
</htk-grid>
<p class="footer-message">
<t>IndicativePhotos</t>
</p>
</div>
</div>
</div>
<div id="menu" class="menu">
<button disabled="true" id="basket-button" class="basket">
<t>StartOrder</t>
</button>
<div class="form-group">
<htk-date-chooser>
<vn-param id="date"/>
</htk-date-chooser>
</div>
<div class="form-group">
<htk-combo>
<db-model property="model">
SELECT id, name FROM vn2008.warehouse
WHERE reserve ORDER BY name
</db-model>
<vn-param id="warehouse"/>
</htk-combo>
</div>
<htk-realm id="realms" model="realms-model">
<vn-param id="realm">
<vn-hash-link key="realm"/>
</vn-param>
</htk-realm>
<div class="types-box">
<htk-grid class="types" empty-message="_SelectFamily">
<db-model id="types-model">
SELECT tipo_id, Tipo FROM vn2008.Tipos
WHERE reino_id = #realm AND Orden != 0 ORDER BY Orden DESC, Tipo
<sql-batch property="batch">
<item name="realm" param="realm"/>
</sql-batch>
</db-model>
<htk-column-link title="_Subtype" column="Tipo" id="type-column"/>
</htk-grid>
</div>
</div>
</div>
</vn>

View File

@ -2,22 +2,18 @@
Vn.Checkout = new Class
({
Extends: Vn.Module
,orderId: null
,activate: function ()
{
Vn.get ('go-basket').addEventListener ('click', this.goBasket.bind (this));
Vn.get ('confirm-button').addEventListener ('click', this.confirmClicked.bind (this));
this.orderId = this.get ('order-id');
this.$('go-basket').addEventListener ('click', this.goBasket.bind (this));
this.$('confirm-button').addEventListener ('click', this.confirmClicked.bind (this));
}
,goBasket: function ()
{
this.hash.set ({
'form': 'ecomerce/basket',
'order': this.orderId.value
'order': this.$('order-id').value
});
}
@ -25,11 +21,11 @@ Vn.Checkout = new Class
{
if (!confirm (_('SureConfirmOrder')))
return;
var query = 'CALL order_confirm (#order)';
var batch = new Sql.Batch ();
batch.addParam ('order', this.orderId);
batch.addParam ('order', this.$('order-id'));
this.conn.execQuery (query, this.confirmDone.bind (this), batch);
}
@ -39,8 +35,9 @@ Vn.Checkout = new Class
if (resultSet.fetchResult ())
{
Vn.Cookie.unset ('order');
this.hash.set ({'module': 'orders'});
alert (_('OrderConfirmed'));
this.hash.set ({'form': 'ecomerce/orders'});
(new Htk.Toast ()).showMessage (_('OrderConfirmed'));
}
else
this.goBasket ();

View File

@ -1,81 +0,0 @@
<div id="checkout">
<vn-param id="order-id">
<vn-hash-link key="order"/>
</vn-param>
<db-form id="order-form">
<db-model>
SELECT type_id, note, insurance, address_id, id
FROM order_view WHERE id = #id
<sql-batch property="batch">
<item name="id" param="order-id"/>
</sql-batch>
</db-model>
<db-param column="date_send" id="date"/>
<db-param column="wh_id" id="warehouse"/>
<db-param column="address_id" id="address"/>
</db-form>
<div class="box">
<div class="header">
<h1><?=s('Checkout')?></h1>
<div class="action-bar">
<button id="go-basket">
<img src="image/dark/go-previous.svg" alt=""/>
<?=s('GoBasket')?>
</button>
<button id="confirm-button">
<img src="image/dark/ok.svg" alt=""/>
<?=s('Confirm')?>
</button>
</div>
</div>
<div>
<table class="form">
<tbody>
<tr>
<td class="label">
<label for="notes"><?=s('Notes:')?></label>
</td>
<td>
<htk-textarea column="note" form="order-form"/>
</td>
</tr>
<tr>
<td class="label">
<label for="type"><?=s('SendMethod:')?></label>
</td>
<td>
<htk-combo column="type_id" form="order-form">
<db-model property="model">
SELECT Id_Agencia, Agencia FROM vn2008.Agencias
WHERE web != FALSE ORDER BY Agencia
</db-model>
</htk-combo>
</td>
</tr>
<tr>
<td class="label">
</td>
<td>
<htk-check column="insurance" form="order-form"/>
<?=s('Insurance')?>
</td>
</tr>
</tbody>
</table>
<htk-grid>
<db-model updatable="false">
SELECT id, consignee, p.name province, zip_code, city, a.name
FROM address_view a
JOIN vn2008.province p ON a.province_id = p.province_id
WHERE active != FALSE
</db-model>
<htk-column-radio column="id" param="address"/>
<htk-column-text title="Consignee" column="consignee"/>
<htk-column-text title="Province" column="province"/>
<htk-column-text title="PC" column="zip_code"/>
<htk-column-text title="City" column="city"/>
<htk-column-text title="Address" column="name"/>
</htk-grid>
</div>
</div>
</div>

View File

@ -1,9 +1,9 @@
#checkout
.checkout
{
padding: 1em;
min-width: 50em;
}
#checkout .box
.checkout .box
{
max-width: 70em;
margin: 0 auto;
@ -11,7 +11,7 @@
/* Data */
#checkout td.label
.checkout td.label
{
width: 10em;
}

View File

@ -0,0 +1,85 @@
<vn>
<vn-group>
<vn-param id="order-id">
<vn-hash-link key="order"/>
</vn-param>
<db-form id="order-form">
<db-model>
SELECT type_id, note, insurance, address_id, id
FROM order_view WHERE id = #id
<sql-batch property="batch">
<item name="id" param="order-id"/>
</sql-batch>
</db-model>
<db-param column="date_send" id="date"/>
<db-param column="wh_id" id="warehouse"/>
<db-param column="address_id" id="address"/>
</db-form>
</vn-group>
<div id="form" class="checkout">
<div class="box">
<div class="header">
<h1><t>Checkout</t></h1>
<div class="action-bar">
<button id="go-basket">
<img src="image/dark/go-previous.svg" alt=""/>
<t>GoBasket</t>
</button>
<button id="confirm-button">
<img src="image/dark/ok.svg" alt=""/>
<t>Confirm</t>
</button>
</div>
</div>
<div>
<table class="form">
<tbody>
<tr>
<td class="label">
<label for="notes"><t>Notes:</t></label>
</td>
<td>
<htk-textarea column="note" form="order-form"/>
</td>
</tr>
<tr>
<td class="label">
<label for="type"><t>SendMethod:</t></label>
</td>
<td>
<htk-combo column="type_id" form="order-form">
<db-model property="model">
SELECT Id_Agencia, Agencia FROM vn2008.Agencias
WHERE web != FALSE ORDER BY Agencia
</db-model>
</htk-combo>
</td>
</tr>
<tr>
<td class="label">
</td>
<td>
<htk-check column="insurance" form="order-form"/>
<t>Insurance</t>
</td>
</tr>
</tbody>
</table>
<htk-grid>
<db-model updatable="false">
SELECT id, consignee, p.name province, zip_code, city, a.name
FROM address_view a
JOIN vn2008.province p ON a.province_id = p.province_id
WHERE active != FALSE
</db-model>
<htk-column-radio column="id" param="address"/>
<htk-column-text title="_Consignee" column="consignee"/>
<htk-column-text title="_Province" column="province"/>
<htk-column-text title="_PC" column="zip_code"/>
<htk-column-text title="_City" column="city"/>
<htk-column-text title="_Address" column="name"/>
</htk-grid>
</div>
</div>
</div>
</vn>

View File

@ -1,77 +0,0 @@
<div id="orders">
<div class="box">
<div class="header">
<h1><?=s('StartedOrdersDesc')?></h1>
<div class="action-bar">
<button id="start-order">
<img src="image/dark/order.svg" alt=""/>
<?=s('StartOrder')?>
</button>
</div>
</div>
<div>
<htk-grid>
<db-model>
SELECT o.id, date_send, Agencia
FROM order_view o
JOIN vn2008.Agencias a ON o.type_id = a.Id_Agencia
</db-model>
<htk-column-button column="id" image="image/edit.svg" tip="ContinueOrder" id="edit-order"/>
<htk-column-spin title="OrderNumber" column="id"/>
<htk-column-date title="DateExit" column="date_send"/>
<htk-column-text title="SendMethod" column="Agencia"/>
</htk-grid>
</div>
</div>
<div class="box">
<div class="header">
<h1><?=s('ConfirmedOrdersDesc')?></h1>
<div id="debt">
<?=s('PendingBalance:')?>
<htk-label format="%.2d€" id="debt-amount">
<db-calc-sum model="balance" column-name="amount"/>
</htk-label>
<img src="image/dark/info.svg" title="<?=s('PaymentInfo')?>" id="debt-info" alt="Info"/>
<button id="pay-button" title="<?=s('MakePayment')?>">
<img src="image/dark/pay.svg" alt="<?=s('MakePayment')?>"/>
</button>
</div>
</div>
<div id="debt-popup">
<htk-grid id="debt-grid" updatable="false">
<db-model id="balance">
CALL customer_debt ();
</db-model>
<htk-column-text title="Company" column="abbreviation"/>
<htk-column-spin title="Pending" column="amount" unit="" digits="2"/>
<htk-column-button title="Pay" image="image/pay.svg" tip="Pay" id="company-pay"/>
</htk-grid>
</div>
<div>
<htk-grid>
<db-model id="tickets">
CALL ticket_list ();
</db-model>
<htk-column-button column="ticket_id" image="image/show.svg" tip="SeeOrder" id="edit-ticket"/>
<htk-column-spin title="TicketNumber" column="ticket_id"/>
<htk-column-date title="DateExit" column="date"/>
<htk-column-text title="SendMethod" column="type"/>
<htk-column-text title="SentAddress" column="consignee"/>
<htk-column-spin title="TotalWithVAT" column="total" unit="" digits="2"/>
<htk-column-button image="image/pay.svg" tip="PayOrder" id="ticket-pay"/>
</htk-grid>
</div>
<form method="post" id="tpv-form">
<input type="hidden" name="Ds_Merchant_Amount"/>
<input type="hidden" name="Ds_Merchant_Order"/>
<input type="hidden" name="Ds_Merchant_MerchantCode"/>
<input type="hidden" name="Ds_Merchant_Currency"/>
<input type="hidden" name="Ds_Merchant_TransactionType"/>
<input type="hidden" name="Ds_Merchant_Terminal"/>
<input type="hidden" name="Ds_Merchant_MerchantURL"/>
<input type="hidden" name="Ds_Merchant_MerchantSignature"/>
<input type="hidden" name="Ds_Merchant_UrlOK"/>
<input type="hidden" name="Ds_Merchant_UrlKO"/>
</form>
</div>
</div>

View File

@ -5,16 +5,17 @@ Vn.Orders = new Class
,activate: function ()
{
Vn.get ('pay-button').addEventListener ('click', this.onPayButtonClick.bind (this));
Vn.get ('start-order').addEventListener ('click', this.onStartClick.bind (this));
this.get ('company-pay').on ('clicked', this.onCompanyPayClick, this);
this.get ('edit-order').on ('clicked', this.onContinueClick, this);
this.get ('edit-ticket').on ('clicked', this.onShowClick, this);
this.get ('ticket-pay').on ('clicked', this.onTicketPayClick, this);
this.get ('ticket-pay').renderer = this.payRenderer;
this.get ('debt-amount').conditionalFunc = this.debtConditionalFunc;
this.$('pay-button').addEventListener ('click', this.onPayButtonClick.bind (this));
this.$('start-order').addEventListener ('click', this.onStartClick.bind (this));
this.$('company-pay').on ('clicked', this.onCompanyPayClick, this);
this.$('edit-order').on ('clicked', this.onContinueClick, this);
this.$('edit-ticket').on ('clicked', this.onShowClick, this);
this.$('ticket-pay').on ('clicked', this.onTicketPayClick, this);
this.$('ticket-pay').renderer = this.payRenderer;
this.$('debt-amount').conditionalFunc = this.debtConditionalFunc;
this.payPopup = new Vn.NodePopup ({htmlNode: Vn.get ('debt-popup')});
this.payPopup = new Htk.Popup ();
this.payPopup.setChildNode (this.$('debt-popup'));
// Ends the transaction
@ -75,12 +76,12 @@ Vn.Orders = new Class
,onPayButtonClick: function ()
{
this.payPopup.showPopup (Vn.get ('pay-button'));
this.payPopup.show (this.$('pay-button'));
}
,onCompanyPayClick: function (column, value, row)
{
var model = this.get ('balance');
var model = this.$('balance');
var company = model.get (row, 'id');
var amount = model.get (row, 'amount');
@ -91,7 +92,7 @@ Vn.Orders = new Class
,onTicketPayClick: function (column, value, row)
{
var model = this.get ('tickets');
var model = this.$('tickets');
var company = model.get (row, 'company_id');
var total = model.get (row, 'total');
this.pay (total, total, company);
@ -118,7 +119,7 @@ Vn.Orders = new Class
this.onTransactionStart.bind (this), batch);
}
else if (!isNaN (amount))
alert (_('AmountError'))
(new Htk.Toast ()).showError (_('AmountError'));
}
,getTpvUrl: function (status, order)
@ -143,7 +144,7 @@ Vn.Orders = new Class
{
var transactionId = res.get ('ds_order');
var form = Vn.get ('tpv-form');
var form = this.$('tpv-form');
var formMap =
{
'Ds_Merchant_Amount': 'amount'
@ -174,37 +175,7 @@ Vn.Orders = new Class
,onTransactionEnd: function ()
{
this.get ('tickets').refresh ();
}
});
Vn.NodePopup = new Class
({
Extends: Htk.Widget
,Implements: Htk.Popup
,Properties:
{
htmlNode:
{
type: Object
,set: function (x)
{
if (x.parentNode)
Vn.Node.remove (x);
x.style.display = 'block';
this.node = x;
}
,get: function (x)
{
return this.node;
}
}
}
,initialize: function (props)
{
this.parent (props);
this.$('tickets').refresh ();
}
});

View File

@ -1,26 +1,26 @@
#orders
.orders
{
padding: 1em;
min-width: 55em;
}
#orders .box
.orders .box
{
max-width: 70em;
}
#orders .grid tbody tr
.orders .grid tbody tr
{
height: 5em;
}
/* Info box */
#orders .info
.orders .info
{
padding: 0.4em;
background-color: #FFC;
border-radius: 0.1em;
}
#orders .info > img
.orders .info > img
{
vertical-align: middle;
margin: 0.7em;
@ -29,35 +29,35 @@
/* Buttons */
#orders td.hide
.orders td.hide
{
display: none;
}
/* Balance */
#debt
.debt
{
float: right;
}
#debt img
.debt img
{
vertical-align: middle;
padding-left: 0.3em;
cursor: pointer;
}
#pay-button
.pay-button
{
margin-left: 1.2em;
}
#debt-amount
.debt-amount
{
color: white;
padding: 0.3em;
}
.positive-debt
{
background-color: #ef5350;
background-color: #EF5350;
border-radius: 0.1em;
box-shadow: 0 0 0.4em #666;
}
@ -65,51 +65,13 @@
{
color: white;
}
#debt-popup
.debt-popup
{
display: none;
background-color: white;
border-radius: 0.1em;
box-shadow: 0 0 0.4em #666;
width: 25em;
}
#debt-grid
.debt-grid
{
width: 100%;
margin: auto;
}
/* TPV */
div.tpv
{
position: absolute;
margin-left: -35em;
top: 0.8em;
left: 50%;
height: 50em;
width: 70em;
border: 1px solid #999;
border-radius: 0.1em;
background-color: white;
text-align: center;
z-index: 2;
}
div.tpv button
{
position: absolute;
right: 0.6em;
bottom: 0.6em;
z-index: 4;
}
div.tpv iframe
{
width: 100%;
height: 50em;
bottom: 0;
overflow: auto;
border-width: 0;
}

View File

@ -0,0 +1,79 @@
<vn>
<div id="form" class="orders">
<div class="box">
<div class="header">
<h1><t>StartedOrdersDesc</t></h1>
<div class="action-bar">
<button id="start-order">
<img src="image/dark/order.svg" alt=""/>
<t>StartOrder</t>
</button>
</div>
</div>
<div>
<htk-grid>
<db-model>
SELECT o.id, date_send, Agencia
FROM order_view o
JOIN vn2008.Agencias a ON o.type_id = a.Id_Agencia
</db-model>
<htk-column-button column="id" image="image/edit.svg" tip="_ContinueOrder" id="edit-order"/>
<htk-column-spin title="_OrderNumber" column="id"/>
<htk-column-date title="_DateExit" column="date_send"/>
<htk-column-text title="_SendMethod" column="Agencia"/>
</htk-grid>
</div>
</div>
<div class="box">
<div class="header">
<h1><t>ConfirmedOrdersDesc</t></h1>
<div class="debt">
<t>PendingBalance:</t>
<htk-label format="%.2d€" id="debt-amount" class="debt-amount">
<db-calc-sum model="balance" column-name="amount"/>
</htk-label>
<img src="image/dark/info.svg" title="_PaymentInfo" class="debt-info" alt="Info"/>
<button id="pay-button" class="pay-button" title="_MakePayment">
<img src="image/dark/pay.svg" alt="_MakePayment"/>
</button>
</div>
</div>
<div>
<htk-grid>
<db-model id="tickets">
CALL ticket_list ();
</db-model>
<htk-column-button column="ticket_id" image="image/show.svg" tip="_SeeOrder" id="edit-ticket"/>
<htk-column-spin title="_TicketNumber" column="ticket_id"/>
<htk-column-date title="_DateExit" column="date"/>
<htk-column-text title="_SendMethod" column="type"/>
<htk-column-text title="_SentAddress" column="consignee"/>
<htk-column-spin title="_TotalWithVAT" column="total" unit="€" digits="2"/>
<htk-column-button image="image/pay.svg" tip="_PayOrder" id="ticket-pay"/>
</htk-grid>
</div>
<form method="post" id="tpv-form">
<input type="hidden" name="Ds_Merchant_Amount"/>
<input type="hidden" name="Ds_Merchant_Order"/>
<input type="hidden" name="Ds_Merchant_MerchantCode"/>
<input type="hidden" name="Ds_Merchant_Currency"/>
<input type="hidden" name="Ds_Merchant_TransactionType"/>
<input type="hidden" name="Ds_Merchant_Terminal"/>
<input type="hidden" name="Ds_Merchant_MerchantURL"/>
<input type="hidden" name="Ds_Merchant_MerchantSignature"/>
<input type="hidden" name="Ds_Merchant_UrlOK"/>
<input type="hidden" name="Ds_Merchant_UrlKO"/>
</form>
</div>
</div>
<div id="debt-popup" class="debt-popup">
<htk-grid class="debt-grid" updatable="false">
<db-model id="balance">
CALL customer_debt ();
</db-model>
<htk-column-text title="_Company" column="abbreviation"/>
<htk-column-spin title="_Pending" column="amount" unit="€" digits="2"/>
<htk-column-button title="_Pay" image="image/pay.svg" tip="Pay" id="company-pay"/>
</htk-grid>
</div>
</vn>

View File

@ -1,113 +0,0 @@
<div id="ticket">
<vn-group>
<vn-param id="ticket-id">
<vn-hash-link key="ticket"/>
</vn-param>
<db-form id="ticket">
<db-model id="ticket-data" updatable="false">
SELECT t.id, date, a.Agencia, note, p.name province,
zip_code, city, c.name, consignee, invoice
FROM ticket_view t
JOIN address_view c ON t.address_id = c.id
JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia
JOIN vn2008.province p ON c.province_id = p.province_id
WHERE t.id = #ticket
<sql-batch property="batch">
<item name="ticket" param="ticket-id"/>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div class="box">
<div class="header">
<h1><?=s('OrderDetail')?></h1>
<div class="action-bar">
<button id="print">
<img src="image/dark/print.svg" alt=""/>
<?=s('Print')?>
</button>
</div>
</div>
<div id="ticket-report">
<table class="form">
<tbody>
<tr>
<td class="label">
<label><?=s('TicketNumber:')?></label>
</td>
<td>
<htk-label column="id" form="ticket"/>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('DateExit:')?></label>
</td>
<td>
<htk-date-chooser column="date" form="ticket" editable="false"/>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('SendMethod:')?></label>
</td>
<td>
<htk-label column="Agencia" form="ticket"/>
</td>
</tr>
<tr>
<td class="label">
<label><?=s('Notes:')?></label>
</td>
<td>
<htk-label column="note" form="ticket"/>
</td>
</tr>
<tr>
<td class="label">
<label for="total"><?=s('Subtotal:')?></label>
</td>
<td>
<htk-label format="%.2d€">
<db-calc-sum id="ticket-subtotal" model="movements"/>
</htk-label>
</td>
</tr>
</tbody>
</table>
<htk-grid model="ticket-data">
<htk-column-spin title="PC" column="zip_code"/>
<htk-column-text title="City" column="city"/>
<htk-column-text title="Province" column="province"/>
<htk-column-text title="Address" column="name"/>
<htk-column-text title="Consignee" column="consignee"/>
</htk-grid>
<htk-grid>
<db-model id="movements">
SELECT m.item_id, amount, concept, Categoria, Medida, Tallos, Color,
Abreviatura, IF(fixed != FALSE, price, NULL) price, fixed, discount
FROM ticket_row_view m
INNER JOIN vn2008.Articles a
ON m.item_id = a.Id_Article AND ticket_id = #ticket
LEFT JOIN vn2008.Origen o
ON a.id_origen = o.id
ORDER BY concept
<sql-batch property="batch">
<item name="ticket" param="ticket-id"/>
</sql-batch>
</db-model>
<htk-column-spin title="ItemNumber" column="item_id"/>
<htk-column-spin title="Amount" column="amount"/>
<htk-column-text title="Item" column="concept"/>
<htk-column-text title="Category" column="Categoria"/>
<htk-column-text title="S1" column="Medida"/>
<htk-column-text title="Stems" column="Tallos"/>
<htk-column-text title="Color" column="Color"/>
<htk-column-text title="Origin" column="Abreviatura"/>
<htk-column-spin title="Price" column="price" unit="" digits="2"/>
<htk-column-spin title="Desc" column="discount" unit="%"/>
<htk-column-spin title="Subtotal" unit="" digits="2" id="subtotal"/>
</htk-grid>
</div>
</div>
</div>

View File

@ -1,9 +1,9 @@
#ticket
.ticket
{
padding: 1em;
min-width: 50em;
}
#ticket .box
.ticket .box
{
max-width: 70em;
margin: 0 auto;
@ -11,7 +11,7 @@
/* Data */
#ticket td.label
.ticket td.label
{
width: 10em;
}

View File

@ -5,9 +5,9 @@ Vn.Ticket = new Class
,activate: function ()
{
Vn.get ('print').addEventListener ('click', this.printClicked.bind (this));
this.get ('subtotal').renderer = this.subtotalRenderer.bind (this);
this.get ('ticket-subtotal').func = this.subtotal;
this.$('print').addEventListener ('click', this.printClicked.bind (this));
this.$('subtotal').renderer = this.subtotalRenderer.bind (this);
this.$('ticket-subtotal').func = this.subtotal;
}
,printClicked: function (event)

View File

@ -0,0 +1,115 @@
<vn>
<vn-group>
<vn-param id="ticket-id">
<vn-hash-link key="ticket"/>
</vn-param>
<db-form id="ticket">
<db-model id="ticket-data" updatable="false">
SELECT t.id, date, a.Agencia, note, p.name province,
zip_code, city, c.name, consignee, invoice
FROM ticket_view t
JOIN address_view c ON t.address_id = c.id
JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia
JOIN vn2008.province p ON c.province_id = p.province_id
WHERE t.id = #ticket
<sql-batch property="batch">
<item name="ticket" param="ticket-id"/>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div id="form" class="ticket">
<div class="box">
<div class="header">
<h1><t>OrderDetail</t></h1>
<div class="action-bar">
<button id="print">
<img src="image/dark/print.svg" alt=""/>
<t>Print</t>
</button>
</div>
</div>
<div id="ticket-report">
<table class="form">
<tbody>
<tr>
<td class="label">
<label><t>TicketNumber:</t></label>
</td>
<td>
<htk-label column="id" form="ticket"/>
</td>
</tr>
<tr>
<td class="label">
<label><t>DateExit:</t></label>
</td>
<td>
<htk-date-chooser column="date" form="ticket" editable="false"/>
</td>
</tr>
<tr>
<td class="label">
<label><t>SendMethod:</t></label>
</td>
<td>
<htk-label column="Agencia" form="ticket"/>
</td>
</tr>
<tr>
<td class="label">
<label><t>Notes:</t></label>
</td>
<td>
<htk-label column="note" form="ticket"/>
</td>
</tr>
<tr>
<td class="label">
<label for="total"><t>Subtotal:</t></label>
</td>
<td>
<htk-label format="%.2d€">
<db-calc-sum id="ticket-subtotal" model="movements"/>
</htk-label>
</td>
</tr>
</tbody>
</table>
<htk-grid model="ticket-data">
<htk-column-spin title="PC" column="zip_code"/>
<htk-column-text title="City" column="city"/>
<htk-column-text title="Province" column="province"/>
<htk-column-text title="Address" column="name"/>
<htk-column-text title="Consignee" column="consignee"/>
</htk-grid>
<htk-grid>
<db-model id="movements">
SELECT m.item_id, amount, concept, Categoria, Medida, Tallos, Color,
Abreviatura, IF(fixed != FALSE, price, NULL) price, fixed, discount
FROM ticket_row_view m
INNER JOIN vn2008.Articles a
ON m.item_id = a.Id_Article AND ticket_id = #ticket
LEFT JOIN vn2008.Origen o
ON a.id_origen = o.id
ORDER BY concept
<sql-batch property="batch">
<item name="ticket" param="ticket-id"/>
</sql-batch>
</db-model>
<htk-column-spin title="ItemNumber" column="item_id"/>
<htk-column-spin title="Amount" column="amount"/>
<htk-column-text title="Item" column="concept"/>
<htk-column-text title="Category" column="Categoria"/>
<htk-column-text title="S1" column="Medida"/>
<htk-column-text title="Stems" column="Tallos"/>
<htk-column-text title="Color" column="Color"/>
<htk-column-text title="Origin" column="Abreviatura"/>
<htk-column-spin title="Price" column="price" unit="€" digits="2"/>
<htk-column-spin title="Desc" column="discount" unit="%"/>
<htk-column-spin title="Subtotal" unit="€" digits="2" id="subtotal"/>
</htk-grid>
</div>
</div>
</div>
</vn>

View File

@ -1,45 +0,0 @@
<div id="new">
<vn-group>
<vn-param id="new-param">
<vn-hash-link key="new"/>
</vn-param>
<db-form id="new-form">
<db-param column="text" id="new-body"/>
<db-model>
SELECT id, user_id, title, text, tag
FROM news WHERE id = #new
<sql-batch property="batch">
<item name="new" param="new-param"/>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div class="box">
<div class="header">
<h1><?=s('AddNew')?></h1>
</div>
<div class="form">
<div class="form-group">
<label><?=s('Title:')?></label>
<htk-entry column="title" form="new-form"/>
</div>
<div class="form-group">
<label><?=s('Tag:')?></label>
<htk-combo column="tag" form="new-form">
<db-model property="model">
SELECT name, description FROM news_tag
ORDER BY description
</db-model>
</htk-combo>
</div>
<div class="form-group">
<label><?=s('NewBody:')?></label>
<textarea id="html-editor"/>
</div>
<div class="foot">
<button id="new-cancel" class="vn"><?=s('Cancel')?></button>
<button id="new-accept" class="vn"><?=s('Accept')?></button>
</div>
</div>
</div>
</div>

View File

@ -5,10 +5,11 @@ Vn.New = new Class
,activate: function ()
{
Vn.get ('new-cancel').addEventListener ('click', this.onCancelClick.bind (this));
Vn.get ('new-accept').addEventListener ('click', this.onAcceptClick.bind (this));
this.get ('new-form').on ('status-changed', this.onStatusChange, this);
this.get ('new-body').on ('changed', this.onBodyChange, this);
this.$('new-cancel').addEventListener ('click', this.onCancelClick.bind (this));
this.$('new-accept').addEventListener ('click', this.onAcceptClick.bind (this));
this.$('new-form').on ('status-changed', this.onStatusChange, this);
this.$('new-body').on ('changed', this.onBodyChange, this);
this.$('html-editor').id = 'html-editor';
tinymce.init ({
mode : 'exact'
@ -35,13 +36,13 @@ Vn.New = new Class
,onStatusChange: function (form)
{
if (this.get ('new-param').value == 0)
if (this.$('new-param').value == 0)
form.insertRow ();
}
,onBodyChange: function ()
{
var newHtml = this.get ('new-form').get ('text');
var newHtml = this.$('new-form').get ('text');
if (!newHtml)
newHtml = '';
@ -56,10 +57,10 @@ Vn.New = new Class
,onAcceptClick: function ()
{
var form = this.get ('new-form');
var form = this.$('new-form');
var newHtml = tinyMCE.get ('html-editor').getContent ();
if (this.get ('new-param').value == 0)
if (this.$('new-param').value == 0)
{
var batch = new Sql.Batch ();
batch.addValue ('title', form.get ('title'));
@ -70,7 +71,7 @@ Vn.New = new Class
+'VALUES (#title, #text, #tag, account.user_get_id())';
this.conn.execQuery (query, this.newAdded.bind (this), batch);
// this.get ('new-form').performOperations ();
// this.$('new-form').performOperations ();
}
else
{

View File

@ -1,9 +1,9 @@
#new
.new
{
padding: 1em;
}
#new .box
.new .box
{
max-width: 50em;
margin: 0 auto;
@ -11,32 +11,32 @@
/* Form */
#new .form
.new .form
{
padding: 2em;
}
#new div.form-group
.new div.form-group
{
padding: 0.4em;
}
#new div.form-group label
.new div.form-group label
{
display: block;
margin-bottom: 0.5em;
}
#new div.form-group input,
#new div.form-group textarea,
#new div.form-group select
.new div.form-group input,
.new div.form-group textarea,
.new div.form-group select
{
margin: 0;
width: 100%;
}
#new textarea
.new textarea
{
min-height: 26em;
}
#new .foot
.new .foot
{
text-align: center;
margin-top: 1em;

View File

@ -0,0 +1,47 @@
<vn>
<vn-group>
<vn-param id="new-param">
<vn-hash-link key="new"/>
</vn-param>
<db-form id="new-form">
<db-param column="text" id="new-body"/>
<db-model>
SELECT id, user_id, title, text, tag
FROM news WHERE id = #new
<sql-batch property="batch">
<item name="new" param="new-param"/>
</sql-batch>
</db-model>
</db-form>
</vn-group>
<div id="form" class="new">
<div class="box">
<div class="header">
<h1><t>AddNew</t></h1>
</div>
<div class="form">
<div class="form-group">
<label><t>Title:</t></label>
<htk-entry column="title" form="new-form"/>
</div>
<div class="form-group">
<label><t>Tag:</t></label>
<htk-combo column="tag" form="new-form">
<db-model property="model">
SELECT name, description FROM news_tag
ORDER BY description
</db-model>
</htk-combo>
</div>
<div class="form-group">
<label><t>NewBody:</t></label>
<textarea id="html-editor"/>
</div>
<div class="foot">
<button id="new-cancel" class="vn"><t>Cancel</t></button>
<button id="new-accept" class="vn"><t>Accept</t></button>
</div>
</div>
</div>
</div>
</vn>

View File

@ -1,27 +0,0 @@
<div id="news">
<div class="box">
<div class="header">
<h1><?=s('NewsManagement')?></h1>
<div class="action-bar">
<button id="add-new">
<img src="image/dark/add.svg" alt=""/>
<?=s('AddNew')?>
</button>
</div>
</div>
<htk-grid>
<db-model id="news-model">
SELECT n.id, c.Cliente, priority,
CONCAT(LEFT(n.title, 25), '...') title
FROM news n
JOIN vn2008.Clientes c ON n.user_id = c.Id_Cliente
ORDER BY priority, n.date_time DESC
</db-model>
<htk-column-button column="id" tip="EditNew" image="image/edit.svg" id="edit-new"/>
<htk-column-image column="id" directory="news" subdir="30x30" show-full="true" editable="true"/>
<htk-column-text title="Title" column="title"/>
<htk-column-text title="Author" column="Cliente"/>
<htk-column-spin title="Priority" column="priority"/>
</htk-grid>
</div>
</div>

View File

@ -5,8 +5,8 @@ Vn.News = new Class
,activate: function ()
{
this.get ('edit-new').on ('clicked', this.onEditClick, this);
Vn.get ('add-new').addEventListener ('click', this.onAddClick.bind (this));
this.$('edit-new').on ('clicked', this.onEditClick, this);
this.$('add-new').addEventListener ('click', this.onAddClick.bind (this));
}
,editNew: function (newId)

View File

@ -1,9 +1,9 @@
#news
.news
{
padding: 1em;
min-width: 35em;
}
#news .box
.news .box
{
max-width: 60em;
margin: 0 auto;

View File

@ -0,0 +1,29 @@
<vn>
<div id="form" class="news">
<div class="box">
<div class="header">
<h1><t>NewsManagement</t></h1>
<div class="action-bar">
<button id="add-new">
<img src="image/dark/add.svg" alt=""/>
<t>AddNew</t>
</button>
</div>
</div>
<htk-grid>
<db-model id="news-model">
SELECT n.id, c.Cliente, priority,
CONCAT(LEFT(n.title, 25), '...') title
FROM news n
JOIN vn2008.Clientes c ON n.user_id = c.Id_Cliente
ORDER BY priority, n.date_time DESC
</db-model>
<htk-column-button column="id" tip="_EditNew" image="image/edit.svg" id="edit-new"/>
<htk-column-image column="id" directory="news" subdir="30x30" show-full="true" editable="true"/>
<htk-column-text title="_Title" column="title"/>
<htk-column-text title="_Author" column="Cliente"/>
<htk-column-spin title="_Priority" column="priority"/>
</htk-grid>
</div>
</div>
</vn>

View File

@ -2,10 +2,14 @@
/* Responsive */
@media screen
{
* { font-size: 8pt; }
}
@media screen and (min-device-width: 1150px)
{
* { font-size: 10pt; }
}
@media screen and (min-device-width: 1900px)
@media screen and (min-device-width: 1850px)
{
* { font-size: 11pt; }
}
@ -161,6 +165,13 @@ button.vn:hover
cursor: pointer;
}
/* Image */
img.editable
{
cursor: pointer;
}
/* Date chooser */
.date-chooser button
@ -265,15 +276,15 @@ img.icon
/* Grid */
table.grid
table.htk-grid
{
margin: auto;
border-collapse: collapse;
text-align: center;
margin-bottom: 1em;
}
table.grid thead tr,
table.grid tfoot tr
table.htk-grid thead tr,
table.htk-grid tfoot tr
{
/* box-shadow: 0px 0.1em 0.1em #DDD;
background-color: #AD4;
@ -284,26 +295,26 @@ table.grid tfoot tr
text-align: center;
height: 3em;
}
table.grid thead th
table.htk-grid thead th
{
cursor: pointer;
font-weight: normal;
padding: 0 0.4em;
}
table.grid thead th:hover
table.htk-grid thead th:hover
{
background-color: #076 /* #DDE */;
}
table.grid tr
table.htk-grid tr
{
height: 3.5em;
}
table.grid tfoot a,
table.grid thead a
table.htk-grid tfoot a,
table.htk-grid thead a
{
color: black;
}
table.grid tr.pair-row
table.htk-grid tr.pair-row
{
background-color: transparent;
}
@ -317,26 +328,26 @@ td.grid-message img
padding: 0.8em;
height: 1.8em;
}
table.grid tbody tr
table.htk-grid tbody tr
{
border-top: 1px solid #DDD;
}
table.grid tbody tr:first-child
table.htk-grid tbody tr:first-child
{
border-top: none;
}
table.grid tbody td
table.htk-grid tbody td
{
padding-right: 0.7em;
padding-left: 0.3em;
}
table.grid tbody td:first-child,
table.grid thead th:first-child
table.htk-grid tbody td:first-child,
table.htk-grid thead th:first-child
{
padding-left: 1em;
}
table.grid tbody td:last-child,
table.grid thead th:last-child
table.htk-grid tbody td:last-child,
table.htk-grid thead th:last-child
{
padding-right: 1em;
}
@ -359,56 +370,54 @@ button.cell-button img
/* Calendar */
.calendar
.htk-calendar
{
width: 20em;
background-color: white;
border: none /* 1px solid #CCD */;
border-radius: 0.1em;
box-shadow: 0 0.2em 0.2em #AAA;
border: none;
}
.calendar table
.htk-calendar table
{
border-collapse: collapse;
}
.calendar thead tr,
.calendar tfoot tr
.htk-calendar thead tr,
.htk-calendar tfoot tr
{
background-color: #009688 /*#EEF*/;
background-color: #009688;
color: white;
font-weight: normal;
vertical-align: middle;
text-align: center;
height: 3em;
}
.calendar thead tr
.htk-calendar thead tr
{
border-bottom: none /* 1px solid #CCD */;
border-bottom: none;
}
.calendar tfoot tr
.htk-calendar tfoot tr
{
border-top: none /* 1px solid #CCD */;
border-top: none;
}
.calendar th.button:hover
.htk-calendar th.button:hover
{
cursor: pointer;
background-color: #076;
}
.calendar col
.htk-calendar col
{
width: 14.2%;
}
.calendar tr
.htk-calendar tr
{
height: 2em;
}
.calendar tbody td
.htk-calendar tbody td
{
text-align: right;
padding-right: 0.5em;
}
.calendar td.highlight,
.calendar td:hover
.htk-calendar td.highlight,
.htk-calendar td:hover
{
cursor: pointer;
background-color: #DDE;
@ -416,41 +425,78 @@ button.cell-button img
/* Full image */
div.full-image
.htk-full-image
{
z-index: 100;
position: fixed;
background-color: #FFF;
text-align: center;
border: 1px solid #999;
border-radius: 2px;
z-index: 2;
}
div.image-loader
.htk-full-image-loader
{
z-index: 110;
position: fixed;
background-color: #FFF;
border: 1px solid #999;
border-radius: 0.1em;
z-index: 3;
}
div.image-loader img
.htk-full-image-loader img
{
padding: 1em;
}
/* Toast */
.htk-toast
{
z-index: 200;
display: block;
position: fixed;
background-color: white;
border-radius: 0.1em;
box-shadow: 0 0 0.4em #666;
padding: 0.5em;
left: 50%;
top: 4em;
max-width: 20em;
text-align: center;
}
.htk-toast.message
{
background-color: #BFB;
}
.htk-toast.warning
{
background-color: #FFB;
}
.htk-toast.error
{
background-color: #FBB;
}
/* Popup */
.htk-popup
{
z-index: 200;
display: block;
position: fixed;
background-color: white;
border-radius: 0.1em;
box-shadow: 0 0 0.4em #666;
}
/* Image editor */
img.editable
{
cursor: pointer;
}
.htk-image-editor
{
width: 20em;
background-color: white;
margin: 0 auto;
border-radius: 0.1em;
box-shadow: 0 0 0.4em #AAA;
}
.htk-image-editor h2
{

View File

@ -9,6 +9,7 @@ use Vn\Lib\Locale;
try {
Web::init ();
Web::sysInit ();
}
catch (Exception $e)
{
@ -60,7 +61,7 @@ if (!isset ($_SESSION['skipBrowser']) && $page != 'update-browser')
// Setting the version
setcookie ('hedera_version', $_SESSION['version']);
setcookie ('hedera_version', Web::getVersion ());
// Loading the requested page

View File

@ -51,7 +51,7 @@ Db.Conn.implement
{
this.signalEmit ('loading-changed', true);
var request = new Db.HttpRequest ();
var request = new Vn.HttpRequest ();
request.add ({'action': 'login'});
if (user != null)
@ -100,7 +100,7 @@ Db.Conn.implement
{
this.signalEmit ('loading-changed', true);
var request = new Db.HttpRequest ();
var request = new Vn.HttpRequest ();
request.addValue ({'action': 'close'});
request.send ('rest.php',
this.closed.bind (this, closeCallback));
@ -133,7 +133,7 @@ Db.Conn.implement
if (this.requestsCount == 1)
this.signalEmit ('loading-changed', true);
var httpRequest = new Db.HttpRequest ()
var httpRequest = new Vn.HttpRequest ()
httpRequest.add
({
'action': 'query'

View File

@ -1,4 +1,4 @@
Db.HttpRequest = new Class
Vn.HttpRequest = new Class
({
kvPairs: {}

View File

@ -12,7 +12,6 @@ Vn\Hedera\Js::includeLib ('db'
,'param'
,'calc'
,'calc-sum'
,'http-request'
);
?>

View File

@ -92,7 +92,7 @@ Htk.ColumnImage = new Class
url += cell.value;
if (!useCache)
query = '?'+ new Date ().getTime ();
url += '?'+ new Date ().getTime ();
cell.img.src = url;
}
@ -134,7 +134,9 @@ Htk.ColumnImage = new Class
this.editorClosedHandler = this.onEditorClose.bind (this);
editor.on ('closed', this.editorClosedHandler);
editor.showPopup (cell.img);
this.popup = new Htk.Popup ();
this.popup.setChild (editor);
this.popup.show (cell.img);
}
,onNameChange: function (cell, editor, value)
@ -147,7 +149,7 @@ Htk.ColumnImage = new Class
,onFileUpload: function (cell, editor)
{
this.setSrc (cell, false);
editor.hidePopup ();
this.popup.hide ();
}
,onEditorClose: function (editor)

View File

@ -1,7 +1,6 @@
Htk.Calendar = new Class
({
Extends: Htk.Field
,Implements: Htk.Popup
,Tag: 'htk-calendar'
,tds: []
@ -16,7 +15,7 @@ Htk.Calendar = new Class
var len = Vn.Date.WDays.length;
this.createElement ('div');
this.node.className = 'calendar';
this.node.className = 'htk-calendar';
var table = document.createElement ('table');
this.node.appendChild (table);

View File

@ -44,9 +44,11 @@ Htk.DateChooser = new Class
this.button.appendChild (this.label);
this.node.appendChild (this.button);
var calendar = new Htk.Calendar ();
calendar.on ('changed', this.calendarChanged.bind (this));
this.calendar = calendar;
this.calendar = new Htk.Calendar ();
this.calendar.on ('changed', this.calendarChanged.bind (this));
this.popup = new Htk.Popup ();
this.popup.setChild (this.calendar);
}
else if (!editable)
{
@ -62,7 +64,7 @@ Htk.DateChooser = new Class
if (this.ignoreCalendarChange)
return;
this.calendar.hidePopup ();
this.popup.hide ();
var newDate = calendar.value;
this.putValue (newDate);
@ -75,8 +77,8 @@ Htk.DateChooser = new Class
this.calendar.value = this._value;
this.calendar.goToSelectedMonth ();
this.ignoreCalendarChange = false;
this.calendar.showPopup (this.button);
this.popup.show (this.button);
}
});

View File

@ -1,123 +0,0 @@
Htk.ImageEditor = new Class
({
Extends: Htk.Widget
,Implements: Htk.Popup
,maxFileSize: 10 /* MB */ * 1048576
,initialize: function ()
{
this.createElement ('div');
this.node.className = 'htk-image-editor';
var title = document.createElement ('h2');
title.appendChild (document.createTextNode (_('UpdateImage')));
this.node.appendChild (title);
var form = document.createElement ('form');
form.method = 'post';
form.action = 'rest.php?action=image';
form.target = 'image-editor';
form.enctype = 'multipart/form-data';
form.addEventListener ('submit', this.formSubmit.bind (this));
this.node.appendChild (form);
var div = document.createElement ('div');
div.className = 'form-group';
form.appendChild (div);
var label = document.createElement ('label');
label.appendChild (document.createTextNode (_('FileName') + ':'));
div.appendChild (label);
var nameInput = document.createElement ('input');
nameInput.type = 'text';
nameInput.name = 'name';
nameInput.addEventListener ('change', this.nameChanged.bind (this));
div.appendChild (nameInput);
var div = document.createElement ('div');
div.className = 'form-group';
form.appendChild (div);
var label = document.createElement ('label');
label.appendChild (document.createTextNode (_('File') + ':'));
div.appendChild (label);
var fileInput = document.createElement ('input');
fileInput.type = 'file';
fileInput.name = 'image';
div.appendChild (fileInput);
var div = document.createElement ('div');
div.className = 'footer';
form.appendChild (div);
var loader = document.createElement ('img');
loader.alt = _('Loading');
loader.src = 'image/loader-black.gif';
div.appendChild (loader);
var submitButton = document.createElement ('input');
submitButton.type = 'submit';
submitButton.appendChild (document.createTextNode (_('UploadFile')));
div.appendChild (submitButton);
var iframe = document.createElement ('iframe');
iframe.name = 'image-editor';
iframe.addEventListener ('load', this.imageUploaded.bind (this, iframe));
this.node.appendChild (iframe);
var schemaInput = document.createElement ('input');
schemaInput.type = 'hidden';
schemaInput.name = 'schema';
form.appendChild (schemaInput);
var input = document.createElement ('input');
input.type = 'hidden';
input.name = 'MAX_FILE_SIZE';
input.value = this.maxFileSize;
form.appendChild (input);
this.schemaInput = schemaInput;
this.fileInput = fileInput;
this.nameInput = nameInput;
this.submitButton = submitButton;
this.loader = loader;
}
,setData: function (image, directory)
{
this.nameInput.value = image;
this.schemaInput.value = directory;
}
,formSubmit: function ()
{
this.submitButton.disabled = true;
this.loader.style.visibility = 'visible';
}
,imageUploaded: function (iframe)
{
this.submitButton.disabled = false;
this.loader.style.visibility = 'hidden';
try {
var responseText = iframe.contentDocument.body.textContent;
var response = eval ('('+ responseText +')');
if (response.data)
this.signalEmit ('file-uploaded', this.nameInput.value);
else
alert (response.error.message +' ('+ response.error.code +')');
}
catch (e) {}
}
,nameChanged: function ()
{
this.signalEmit ('name-changed', this.nameInput.value);
}
});

View File

@ -15,12 +15,12 @@ Htk.FullImage = new Class
this.parent (props);
var div = document.createElement ('div');
div.className = 'full-image';
div.className = 'htk-full-image';
div.addEventListener ('mouseover', this.cancelHide.bind (this));
div.addEventListener ('mouseout', this.hideNow.bind (this));
var loadingBox = document.createElement ('div');
loadingBox.className = 'image-loader';
loadingBox.className = 'htk-full-image-loader';
var loadingImg = document.createElement ('img');
loadingImg.src = 'image/loader-black.gif';
@ -34,12 +34,12 @@ Htk.FullImage = new Class
,getLeft: function (width)
{
return parseInt (getPageXOffset () + (getInnerWidth () - width) / 2) +'px';
return parseInt (Vn.Browser.getPageXOffset () + (Vn.Browser.getInnerWidth () - width) / 2) +'px';
}
,getTop: function (height)
{
return parseInt (getPageYOffset () + (getInnerHeight () - height) / 2) +'px';
return parseInt (Vn.Browser.getPageYOffset () + (Vn.Browser.getInnerHeight () - height) / 2) +'px';
}
,show: function (basedir, file)
@ -76,8 +76,8 @@ Htk.FullImage = new Class
var scale = 1.0;
var width = img.width;
var height = img.height;
var innerWidth = getInnerWidth () - 350;
var innerHeight = getInnerHeight () - 120;
var innerWidth = Vn.Browser.getInnerWidth () - 350;
var innerHeight = Vn.Browser.getInnerHeight () - 120;
if (width > innerWidth)
{

View File

@ -31,7 +31,7 @@ Htk.Grid = new Class
emptyMessage:
{
type: String
,value: 'NoData'
,value: _('NoData')
}
}
@ -46,7 +46,7 @@ Htk.Grid = new Class
this.parent ();
this.table = this.createElement ('table');
this.table.className = 'grid';
this.table.className = 'htk-grid';
var thead = document.createElement ('thead');
this.table.appendChild (thead);
@ -179,7 +179,7 @@ Htk.Grid = new Class
this.showMessage (_('Loading'), 'loader-black.gif');
break;
case Db.Model.Status.CLEAN:
this.showMessage (_(this.emptyMessage), 'refresh.svg');
this.showMessage (this.emptyMessage, 'refresh.svg');
break;
case Db.Model.Status.ERROR:
this.showMessage (_('ErrorLoadingData'), 'error.svg');
@ -269,7 +269,7 @@ Htk.Grid = new Class
if (column.title)
{
var title = document.createTextNode (_(column.title));
var title = document.createTextNode (column.title);
header.appendChild (title);
}

View File

@ -0,0 +1,56 @@
Htk.ImageEditor = new Class
({
Extends: Htk.Widget
,Xml: 'js/htk/image-editor.xml'
,maxFileSize: 10 /* MB */ * 1048576
,initialize: function ()
{
this.builderInit (Htk.ImageEditor.Xml);
this.$('max-size').value = this.maxFileSize;
this.$('iframe').addEventListener ('load', function ()
{
var toast = new Htk.Toast ();
this.$('submit').disabled = false;
this.$('loader').style.visibility = 'hidden';
try {
var responseText = this.$('iframe').contentDocument.body.textContent;
var response = eval ('('+ responseText +')');
if (response.data)
{
this.signalEmit ('file-uploaded', this.$('name').value);
toast.showMessage (_('ImageAdded'));
}
else
toast.showError (response.error.message +' ('+ response.error.code +')');
}
catch (e) {}
}
.bind (this));
this.$('form').addEventListener ('submit', function ()
{
this.$('submit').disabled = true;
this.$('loader').style.visibility = 'visible';
}
.bind (this));
this.$('name').addEventListener ('change', function ()
{
this.signalEmit ('name-changed', this.nameInput.value);
}
.bind (this));
}
,setData: function (image, directory)
{
this.$('name').value = image;
this.$('schema').value = directory;
}
});

View File

@ -0,0 +1,22 @@
<vn>
<div id="main" class="htk-image-editor">
<h2><t>UpdateImage</t></h2>
<form id="form" method="post" action="rest.php?action=image" target="image-editor" enctype="multipart/form-data">
<div class="form-group">
<label for="name"><t>FileName</t></label>
<input id="name" type="text" name="name"/>
</div>
<div class="form-group">
<label for="file"><t>File</t></label>
<input id="file" type="file" name="image"/>
</div>
<div class="footer">
<img id="loader" src="image/loader-black.gif" alt="Loading"/>
<input id="submit" type="submit"/>
</div>
<input id="schema" type="hidden" name="schema"/>
<input id="max-size" type="hidden" name="MAX_FILE_SIZE"/>
</form>
<iframe id="iframe" name="image-editor"/>
</div>
</vn>

View File

@ -6,8 +6,11 @@ Vn\Hedera\Js::includeLib ('htk'
,'main'
,'widget'
,'popup'
,'toast'
,'grid'
,'radio-group'
,'full-image'
,'image-editor'
,'field'
,'field/entry'
,'field/radio'
@ -18,9 +21,7 @@ Vn\Hedera\Js::includeLib ('htk'
,'field/select'
,'field/calendar'
,'field/date-chooser'
,'field/full-image'
,'field/image'
,'field/image-editor'
,'field/table'
,'column'
,'column/button'

View File

@ -1,46 +1,74 @@
/**
* Interface for use a widget as a popup.
* Class to handle popups.
**/
Htk.Popup = new Class
({
showPopup: function (parent)
Extends: Htk.Widget
,Tag: 'htk-popup'
,child: null
,parent: null
,initialize: function ()
{
this.createElement ('div');
this.node.className = 'htk-popup';
}
,setChild: function (child)
{
this.setChildNode (child.getNode ());
}
,setChildNode: function (childNode)
{
Vn.Node.removeChilds (this.node);
this.node.appendChild (childNode);
}
,show: function (parent)
{
document.body.appendChild (this.node);
this.node.addEventListener ('mousedown', this.stopEvent);
this.hidePopupHandler = this.hidePopup.bind (this);
document.addEventListener ('mousedown', this.hidePopupHandler);
this.hideHandler = this.hide.bind (this);
document.addEventListener ('mousedown', this.hideHandler);
this.parent = parent;
this.setPosition ();
}
,setPosition: function ()
{
var spacing = 5;
var rect = parent.getBoundingClientRect ();
var rect = this.parent.getBoundingClientRect ();
var left = rect.left;
var top = rect.top + spacing + parent.offsetHeight;
var top = rect.top + spacing + this.parent.offsetHeight;
var width = this.node.offsetWidth;
var height = this.node.offsetHeight;
if (left + width > getInnerWidth ())
left -= width - parent.offsetWidth;
if (top + height > getInnerHeight ())
top -= height + parent.offsetHeight + spacing * 2;
if (left + width > Vn.Browser.getInnerWidth ())
left -= width - this.parent.offsetWidth;
if (top + height > Vn.Browser.getInnerHeight ())
top -= height + this.parent.offsetHeight + spacing * 2;
if (left < 0)
left = 0;
if (top < 0)
top = 0;
this.node.style.top = (top) + 'px';
this.node.style.left = (left) + 'px';
this.node.style.position = 'fixed';
this.node.style.zIndex = 100;
this.node.style.top = (top) +'px';
this.node.style.left = (left) +'px';
}
,hidePopup: function ()
,hide: function ()
{
this.node.removeEventListener ('mousedown', this.stopEvent)
document.removeEventListener ('mousedown', this.hidePopupHandler);
document.removeEventListener ('mousedown', this.hideHandler);
document.body.removeChild (this.node);
this.parent = null;
this.signalEmit ('closed');
}

View File

@ -37,7 +37,7 @@ Htk.RadioGroup = new Class
,createButton: function (value)
{
var radio = createRadio (this.name);
var radio = Vn.Browser.createRadio (this.name);
radio.value = value;
radio.checked = value == this.value;
radio.addEventListener ('change', this.onRadioChange.bind (this, value));

View File

@ -0,0 +1,64 @@
/**
* Class to show toast messages.
**/
Htk.Toast = new Class
({
Extends: Htk.Widget
,Tag: 'htk-toast'
,child: null
,timerId: null
,initialize: function ()
{
this.createElement ('div');
this.node.addEventListener ('mousedown', this.stopEvent);
}
,showText: function (message, className)
{
var textNode = document.createTextNode (message);
Vn.Node.removeChilds (this.node);
this.node.appendChild (textNode);
this.node.className = 'htk-toast '+ className;
document.body.appendChild (this.node);
this.hideHandler = this.hide.bind (this);
document.addEventListener ('mousedown', this.hideHandler);
var marginLeft = -parseInt (this.node.offsetWidth / 2);
this.node.style.marginLeft = (marginLeft) +'px';
this.timerId = setTimeout (this.hide.bind (this), 10000);
}
,showMessage: function (message)
{
this.showText (message, 'message');
}
,showWarning: function (message)
{
this.showText (message, 'warning');
}
,showError: function (message)
{
this.showText (message, 'error');
}
,hide: function ()
{
clearTimeout (this.timerId);
this.timerId = null;
document.removeEventListener ('mousedown', this.hideHandler);
document.body.removeChild (this.node);
this.signalEmit ('closed');
}
,stopEvent: function (event)
{
event.stopPropagation ();
}
});

View File

@ -1,9 +1,32 @@
Htk.Widget = new Class
({
Extends: Vn.Object
,Properties:
{
class:
{
type: String
,set: function (x)
{
this.node.className = x +' '+ this.node.className;
}
,get: function ()
{
return this.node.className;
}
}
}
/** Main HTML node that represents the widget **/
,node: null
,builder: null
,builderInit: function (path)
{
this.builder = new Vn.Builder ();
this.builder.loadXml (Vn.getXml (path));
this.node = this.builder.get ('main');
}
,createElement: function (tagName)
{
@ -15,4 +38,30 @@ Htk.Widget = new Class
{
return this.node;
}
,ui: function (uiFile)
{
this.builder = new Vn.Builder ();
this.builder.load (uiFile, this.onUiReady.bind (this));
}
,onUiReady: function ()
{
this.node = this.builder.getNode ();
this.uiReady ();
}
,$: function (id)
{
if (this.builder)
return this.builder.get (id);
return null;
}
/**
* Virtual method that shoud be implemented by all widgets using the ui
* builder.
**/
,uiReady: function () {}
});

View File

@ -1,34 +0,0 @@
function getPageYOffset ()
{
return window.pageYOffset;
}
function getPageXOffset ()
{
return window.pageXOffset;
}
function getInnerHeight ()
{
return window.innerHeight;
}
function getInnerWidth ()
{
return window.innerWidth;
}
function createRadio (uid)
{
var radio = document.createElement ('input');
radio.type = 'radio';
radio.name = uid;
return radio;
}
function setInputTypeNumber (input)
{
input.type = 'number';
}

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