[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16341] more on eventplanner
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16341] more on eventplanner |
Date: |
Sun, 19 Feb 2017 12:00:34 -0500 (EST) |
Revision: 16341
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16341
Author: sigurdne
Date: 2017-02-19 12:00:34 -0500 (Sun, 19 Feb 2017)
Log Message:
-----------
more on eventplanner
Modified Paths:
--------------
trunk/eventplanner/inc/class.uivendor.inc.php
trunk/eventplanner/js/portico/application.edit.js
trunk/eventplanner/templates/base/application.xsl
trunk/eventplannerfrontend/js/portico/application.edit.js
Modified: trunk/eventplanner/inc/class.uivendor.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uivendor.inc.php 2017-02-19 13:40:34 UTC
(rev 16340)
+++ trunk/eventplanner/inc/class.uivendor.inc.php 2017-02-19 17:00:34 UTC
(rev 16341)
@@ -41,6 +41,7 @@
'view' => true,
'edit' => true,
'save' => true,
+ 'get' => true,
'get_list' => true
);
@@ -239,6 +240,26 @@
self::render_template_xsl(array('vendor',
'datatable_inline'), array($mode => $data));
}
+ /*
+ * Get the vendor with the id given in the http variable 'id'
+ */
+
+ public function get( $id = 0 )
+ {
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
+ {
+ phpgw::no_access();
+ }
+
+ $id = !empty($id) ? $id : phpgw::get_var('id', 'int');
+
+ $vendor = $this->bo->read_single($id)->toArray();
+
+ unset($vendor['secret']);
+
+ return $vendor;
+ }
+
public function save()
{
parent::save();
Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js 2017-02-19 13:40:34 UTC
(rev 16340)
+++ trunk/eventplanner/js/portico/application.edit.js 2017-02-19 17:00:34 UTC
(rev 16341)
@@ -1,3 +1,4 @@
+var vendor_id_selection;
var lang;
var oArgs = {menuaction: 'eventplanner.uivendor.index', organization_number:
true};
@@ -4,6 +5,50 @@
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'vendor_name', 'vendor_id',
'vendor_container', 'name');
+$(window).on('load', function ()
+{
+ vendor_id = $('#vendor_id').val();
+ if (vendor_id)
+ {
+ vendor_id_selection = vendor_id;
+ }
+ $("#vendor_name").on("autocompleteselect", function (event, ui)
+ {
+ var vendor_id = ui.item.value;
+ if (vendor_id != vendor_id_selection)
+ {
+ populateVendorContact(vendor_id);
+ }
+ });
+});
+
+function populateVendorContact(vendor_id)
+{
+ vendor_id = vendor_id || $('#vendor_id').val();
+
+ if (!vendor_id)
+ {
+ return;
+ }
+ oArgs = {
+ menuaction: 'eventplanner.uivendor.get',
+ id: vendor_id
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ var data = {};
+
+ JqueryPortico.execute_ajax(requestUrl,
+ function (result)
+ {
+ $("#contact_name").val(result.contact_name);
+ $("#contact_email").val(result.contact_email);
+ $("#contact_phone").val(result.contact_phone);
+
+ }, data, "POST", "json"
+ );
+}
+
validate_submit = function ()
{
var active_tab = $("#active_tab").val();
Modified: trunk/eventplanner/templates/base/application.xsl
===================================================================
--- trunk/eventplanner/templates/base/application.xsl 2017-02-19 13:40:34 UTC
(rev 16340)
+++ trunk/eventplanner/templates/base/application.xsl 2017-02-19 17:00:34 UTC
(rev 16341)
@@ -182,7 +182,7 @@
<label>
<xsl:value-of select="php:function('lang', 'contact phone')"/>
</label>
- <input
type="text" name="contact_phone" value="{application/contact_phone}">
+ <input
type="text" id="contact_phone" name="contact_phone"
value="{application/contact_phone}">
<xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
Modified: trunk/eventplannerfrontend/js/portico/application.edit.js
===================================================================
--- trunk/eventplannerfrontend/js/portico/application.edit.js 2017-02-19
13:40:34 UTC (rev 16340)
+++ trunk/eventplannerfrontend/js/portico/application.edit.js 2017-02-19
17:00:34 UTC (rev 16341)
@@ -1,3 +1,4 @@
+var vendor_id_selection;
var lang;
var oArgs = {menuaction: 'eventplanner.uivendor.index', organization_number:
true};
@@ -4,6 +5,50 @@
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'vendor_name', 'vendor_id',
'vendor_container', 'name');
+$(window).on('load', function ()
+{
+ vendor_id = $('#vendor_id').val();
+ if (vendor_id)
+ {
+ vendor_id_selection = vendor_id;
+ }
+ $("#vendor_name").on("autocompleteselect", function (event, ui)
+ {
+ var vendor_id = ui.item.value;
+ if (vendor_id != vendor_id_selection)
+ {
+ populateVendorContact(vendor_id);
+ }
+ });
+});
+
+function populateVendorContact(vendor_id)
+{
+ vendor_id = vendor_id || $('#vendor_id').val();
+
+ if (!vendor_id)
+ {
+ return;
+ }
+ oArgs = {
+ menuaction: 'eventplanner.uivendor.get',
+ id: vendor_id
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ var data = {};
+
+ JqueryPortico.execute_ajax(requestUrl,
+ function (result)
+ {
+ $("#contact_name").val(result.contact_name);
+ $("#contact_email").val(result.contact_email);
+ $("#contact_phone").val(result.contact_phone);
+
+ }, data, "POST", "json"
+ );
+}
+
validate_submit = function ()
{
var active_tab = $("#active_tab").val();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16341] more on eventplanner,
sigurdne <=