[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17413] controller: more on frontend
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17413] controller: more on frontend |
Date: |
Thu, 7 Dec 2017 17:29:27 -0500 (EST) |
Revision: 17413
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17413
Author: sigurdne
Date: 2017-12-07 17:29:27 -0500 (Thu, 07 Dec 2017)
Log Message:
-----------
controller: more on frontend
Modified Paths:
--------------
trunk/controller/inc/class.uicomponent.inc.php
trunk/controller/js/controller/component.index.js
trunk/controller/templates/mobilefrontend/check_list/add_check_list.xsl
trunk/controller/templates/mobilefrontend/check_list/edit_check_list.xsl
trunk/controller/templates/mobilefrontend/css/base.css
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2017-12-07 15:13:45 UTC
(rev 17412)
+++ trunk/controller/inc/class.uicomponent.inc.php 2017-12-07 22:29:27 UTC
(rev 17413)
@@ -1355,21 +1355,22 @@
$row['choose'] = "<input
id=\"selected_components\" class=\"mychecks\" type=\"checkbox\"
name=\"selected_components[]\" value =
\"{$entry['location_id']}_{$entry['component_id']}\">";
}
+ $control_link_data = null;
$found_at_least_one = false;
if($filter_month)
{
$filter_status = $filter_status ?
$filter_status : 'filter_month';
- $row[$filter_month] =
$this->translate_calendar_info($entry[$filter_month], $year, $filter_month,
$filter_status, $found_at_least_one, $keep_only_assigned_to,
$entry['location_code']);
- if(true)// ($row[$_month] && (!$user_id
|| $entry[$_month]['info']['assigned_to'] == $user_id))
+ $row[$filter_month] =
$this->translate_calendar_info($entry[$filter_month], $year, $filter_month,
$filter_status, $found_at_least_one, $keep_only_assigned_to,
$entry['location_code'],$control_link_data);
+ if(true)// ($row[$filter_month] &&
(!$user_id || $entry[$filter_month]['info']['assigned_to'] == $user_id))
{
- $row_sum[$_month] =
(float)$entry[$_month]['info']['service_time'] +
(float)$entry[$_month]['info']['controle_time'];
- $row_sum_actual[$_month] = +
(float)$entry[$_month]['info']['billable_hours'];
+ $row_sum[$filter_month] =
(float)$entry[$filter_month]['info']['service_time'] +
(float)$entry[$filter_month]['info']['controle_time'];
+ $row_sum_actual[$filter_month]
= + (float)$entry[$filter_month]['info']['billable_hours'];
}
else
{
- $row_sum[$_month] = 0;
- $row_sum_actual[$_month] = 0;
+ $row_sum[$filter_month] = 0;
+ $row_sum_actual[$filter_month]
= 0;
}
if (!$filter_status ||
$found_at_least_one)
@@ -1376,6 +1377,11 @@
{
$total_time[] = $row_sum;
$total_time_actual[] =
$row_sum_actual;
+
+ $this->add_action_buttons($row,
$filter_month, $entry[$filter_month], $control_link_data);
+
+
+
$data_set[] = $row;
}
}
@@ -1383,7 +1389,7 @@
{
for ($_month = 1; $_month < 13;
$_month++)
{
- $row[$_month] =
$this->translate_calendar_info($entry[$_month], $year, $_month, $filter_status,
$found_at_least_one, $keep_only_assigned_to, $entry['location_code']);
+ $row[$_month] =
$this->translate_calendar_info($entry[$_month], $year, $_month, $filter_status,
$found_at_least_one, $keep_only_assigned_to, $entry['location_code'],
$control_link_data);
if(true)// ($row[$_month] &&
(!$user_id || $entry[$_month]['info']['assigned_to'] == $user_id))
{
$row_sum[$_month] =
(float)$entry[$_month]['info']['service_time'] +
(float)$entry[$_month]['info']['controle_time'];
@@ -1405,6 +1411,11 @@
}
}
$fields = $this->get_fields($year, $filter_month,
$this->user_id);
+ if($filter_month)
+ {
+ $fields[] = array('key' => 'action_button');
+ }
+
$class = '';
$tbody = '';
foreach ($data_set as $row_data)
@@ -1505,7 +1516,7 @@
);
}
- private function translate_calendar_info( $param = array(),
$year, $month, $filter_status = '', &$found_at_least_one = false,
$keep_only_assigned_to, $location_code ='' )
+ private function translate_calendar_info( $param = array(),
$year, $month, $filter_status = '', &$found_at_least_one = false,
$keep_only_assigned_to, $location_code ='', &$control_link_data )
{
if (!isset($param['repeat_type']))
{
@@ -1646,6 +1657,48 @@
return
"{$repeat_type}<br/>{$link}<br/>{$assigned_to}<br/>{$time}";
}
+ private function add_action_buttons(&$row, $_month, $param,
$control_link_data)
+ {
+
+ $control_link = json_encode($control_link_data);
+
+ $lang_plan = lang('plan');
+ $lang_ok = lang('ok');
+ $lang_deviation = lang('deviation');
+ if ($param['status'] == 'CONTROL_REGISTERED')
+ {
+ $row['action_button'] = <<<HTML
+ <button class="save_check_list
pure-button pure-button-primary" type="submit" name="save_check_list" onclick =
'perform_action("save_check_list", {$control_link});'>
+ <i class="fa fa-floppy-o"
aria-hidden="true"></i>
+ {$lang_plan}
+ </button>
+ <button class="submit_ok pure-button
pure-button-primary" type="submit" name="submit_ok" onclick =
'perform_action("submit_ok", {$control_link});'>
+ <i class="fa fa-check-square-o"
aria-hidden="true"></i>
+ {$lang_ok}
+ </button>
+ <button class="submit_deviation
pure-button pure-button-primary" type="submit" name="submit_deviation" onclick
= 'perform_action("submit_deviation", {$control_link});'>
+ <i class="fa
fa-exclamation-triangle" aria-hidden="true"></i>
+ {$lang_deviation}
+ </button>
+HTML;
+ }
+ else if ($param['status'] == 'CONTROL_PLANNED')
+ {
+ $row['action_button'] = <<<HTML
+ <button class="submit_ok pure-button
pure-button-primary" type="submit" name="submit_ok" onclick =
'perform_action("submit_ok", {$control_link});'>
+ <i class="fa fa-check-square-o"
aria-hidden="true"></i>
+ {$lang_ok}
+ </button>
+ <button class="submit_deviation
pure-button pure-button-primary" type="submit" name="submit_deviation" onclick
= 'perform_action("submit_deviation", {$control_link});'>
+ <i class="fa
fa-exclamation-triangle" aria-hidden="true"></i>
+ {$lang_deviation}
+ </button>
+HTML;
+
+
+ }
+ }
+
private function get_summary( $data, $user_id )
{
Modified: trunk/controller/js/controller/component.index.js
===================================================================
--- trunk/controller/js/controller/component.index.js 2017-12-07 15:13:45 UTC
(rev 17412)
+++ trunk/controller/js/controller/component.index.js 2017-12-07 22:29:27 UTC
(rev 17413)
@@ -383,3 +383,58 @@
var oArgs = {menuaction: 'property.bolocation.get_locations'};
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'location_name', 'location_code',
'location_container');
+
+
+
+perform_action = function(name, oArgs)
+{
+
+ if(name == 'save_check_list')
+ {
+ //nothing
+ location.assign(phpGWLink('index.php', oArgs));
+ return
+ }
+ else if (name == 'submit_ok')
+ {
+ oArgs.menuaction =
'controller.uicheck_list.save_check_list';
+ oArgs.submit_ok = 1;
+
+ }
+ else if (name == 'submit_deviation')
+ {
+ oArgs.menuaction =
'controller.uicheck_list.save_check_list';
+ oArgs.submit_deviation = 1;
+ }
+
+console.log(oArgs);
+
+ var requestUrl = phpGWLink('index.php', oArgs);
+ var confirm_msg = requestUrl;
+ var r = confirm(confirm_msg);
+ if (r !== true)
+ {
+ return false;
+ }
+
+ location.assign(phpGWLink('index.php', oArgs));
+};
+
+
+$(document).ready(function ()
+{
+ $(".save_check_list_form").on("click", function (e)
+ {
+ alert('e');
+ e.preventDefault();
+ var thisForm = $(this);
+ var requestUrl = $(thisForm).attr("action");
+ alert(requestUrl);
+ });
+
+ $(".submit_ok").on("on", function (e)
+ {
+ alert('e');
+ });
+
+});
\ No newline at end of file
Modified:
trunk/controller/templates/mobilefrontend/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/mobilefrontend/check_list/add_check_list.xsl
2017-12-07 15:13:45 UTC (rev 17412)
+++ trunk/controller/templates/mobilefrontend/check_list/add_check_list.xsl
2017-12-07 22:29:27 UTC (rev 17413)
@@ -191,17 +191,17 @@
</textarea>
</div>
<div id="submit_group">
- <button id="save_check_list"
class="pure-button pure-button-primary" type="submit" name="save_check_list"
value="1">
+ <button id="save_check_list"
class="save_check_list pure-button pure-button-primary" type="submit"
name="save_check_list" value="1">
<i class="fa
fa-floppy-o" aria-hidden="true"></i>
<xsl:text> </xsl:text>
<xsl:value-of
select="php:function('lang', 'plan')" />
</button>
- <button id="submit_ok"
class="pure-button pure-button-primary" type="submit" name="submit_ok"
value="1">
+ <button id="submit_ok"
class="submit_ok pure-button pure-button-primary" type="submit"
name="submit_ok" value="1">
<i class="fa
fa-check-square-o" aria-hidden="true"></i>
<xsl:text> </xsl:text>
<xsl:value-of
select="php:function('lang', 'ok')" />
</button>
- <button id="submit_deviation"
class="pure-button pure-button-primary" type="submit" name="submit_deviation"
value="1">
+ <button id="submit_deviation"
class="submit_deviation pure-button pure-button-primary" type="submit"
name="submit_deviation" value="1">
<i class="fa
fa-exclamation-triangle" aria-hidden="true"></i>
<xsl:text> </xsl:text>
<xsl:value-of
select="php:function('lang', 'deviation')" />
Modified:
trunk/controller/templates/mobilefrontend/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/mobilefrontend/check_list/edit_check_list.xsl
2017-12-07 15:13:45 UTC (rev 17412)
+++ trunk/controller/templates/mobilefrontend/check_list/edit_check_list.xsl
2017-12-07 22:29:27 UTC (rev 17413)
@@ -175,19 +175,19 @@
<input class="btn"
type="submit" name="save_control" value="Lagre detaljer" />
</div-->
<div id="submit_group"
class="pure-button-group" role="group">
- <button
id="save_check_list" class="pure-button pure-button-primary" type="submit"
name="save_check_list" value="1">
+ <button
id="save_check_list" class="save_check_list pure-button pure-button-primary"
type="submit" name="save_check_list" value="1">
<i class="fa
fa-floppy-o" aria-hidden="true"></i>
<xsl:text>
</xsl:text>
<xsl:value-of
select="php:function('lang', 'save')" />
</button>
<xsl:if test =
"check_list/num_open_cases = 0">
- <button
id="submit_ok" class="pure-button pure-button-primary" type="submit"
name="submit_ok" value="1">
+ <button
id="submit_ok" class="submit_ok pure-button pure-button-primary" type="submit"
name="submit_ok" value="1">
<i
class="fa fa-check-square-o" aria-hidden="true"></i>
<xsl:text> </xsl:text>
<xsl:value-of select="php:function('lang', 'ok')" />
</button>
</xsl:if>
- <button
id="submit_deviation" class="pure-button pure-button-primary" type="submit"
name="submit_deviation" value="1">
+ <button
id="submit_deviation" class="submit_deviation pure-button pure-button-primary"
type="submit" name="submit_deviation" value="1">
<i class="fa
fa-exclamation-triangle" aria-hidden="true"></i>
<xsl:text>
</xsl:text>
<xsl:value-of
select="php:function('lang', 'deviation')" />
Modified: trunk/controller/templates/mobilefrontend/css/base.css
===================================================================
--- trunk/controller/templates/mobilefrontend/css/base.css 2017-12-07
15:13:45 UTC (rev 17412)
+++ trunk/controller/templates/mobilefrontend/css/base.css 2017-12-07
22:29:27 UTC (rev 17413)
@@ -16,13 +16,13 @@
width: 125px;
}
-#save_check_list
+.save_check_list
{
/* text-align: center;*/
width: 140px;
}
-#submit_ok
+.submit_ok
{
/* text-align: center;*/
background-color: #4CAF50;
@@ -29,7 +29,7 @@
width: 140px;
}
-#submit_deviation {
+.submit_deviation {
/* text-align: center;*/
background-color: #f44336;
width: 140px;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17413] controller: more on frontend,
sigurdne <=