[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15561]
From: |
saul . huanay |
Subject: |
[Fmsystem-commits] [15561] |
Date: |
Fri, 2 Sep 2016 00:26:41 +0000 (UTC) |
Revision: 15561
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15561
Author: psaul
Date: 2016-09-02 00:26:41 +0000 (Fri, 02 Sep 2016)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
branches/dev-syncromind-2/rental/js/rental/schedule.js
branches/dev-syncromind-2/rental/templates/base/schedule.xsl
Modified: branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind-2/phpgwapi/js/jquery/common.js 2016-09-01
13:00:54 UTC (rev 15560)
+++ branches/dev-syncromind-2/phpgwapi/js/jquery/common.js 2016-09-02
00:26:41 UTC (rev 15561)
@@ -1273,7 +1273,7 @@
}
-function createTableSchedule (d, u, c, r, cl, dt)
+function createTableSchedule (d, u, c, r, cl, dt, a, p)
{
var container = document.getElementById(d);
var xtable = document.createElement('table');
@@ -1311,7 +1311,7 @@
container.innerHTML = "";
container.appendChild(xtable);
- $.get(u, function (data)
+ $.post(u, a, function (data)
{
var selected = new Array();
if (typeof (r) == 'object')
@@ -1416,6 +1416,21 @@
tableBody.appendChild(tableBodyTr);
});
}
+
+ if (p)
+ {
+ var start = a.start;
+ var total = data['ResultSet'].totalResultsAvailable;
+ var n_objects = a.n_objects;
+
+ var pages = Math.floor(total / n_objects);
+ var res = total % n_objects;
+
+ if (res > 0)
+ {
+ pages++;
+ }
+ }
});
}
@@ -1653,7 +1668,7 @@
if (data[k])
{
var contratctLink = (data['contract_link']) ?
data['contract_link'] : null;
- text = (data[k]['old_contract_id'] ?
formatGenericLink(data[k]['old_contract_id'], contratctLink) : "");
+ text = data[k]['status'];
}
else
{
Modified: branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
2016-09-01 13:00:54 UTC (rev 15560)
+++ branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
2016-09-02 00:26:41 UTC (rev 15561)
@@ -547,82 +547,108 @@
}
/*----------------------------------------------------------------*/
-// $contracts =
rental_socontract::get_instance()->get($options['start_index'],
$options['num_of_objects'], $options['sort_field'], $options['ascending'],
$options['search_for'], $options['search_type'], $filters);
-// 29 Jun 2016
-// 01 Sep 2016
-
- $data = null;
- $composite_obj =
rental_socomposite::get_instance()->get($options['start_index'],
$options['num_of_objects'], $options['sort_field'], $options['ascending'],
$options['search_for'], $options['search_type'], $filters);
+// if (count($composite_obj) > 0)
+// {
+// $keys = array_keys($composite_obj);
+// $composite = $composite_obj[$keys[0]];
+// }
+//
+// $contracts = $composite->get_contracts();
+//
+// $data_contracts = array();
+//
+// foreach ($contracts as $contract)
+// {
+// $contract = $contract->serialize();
+//
+// $contract_date_start = new
DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
+// $contract_date_end = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
+//
+// $data_contract = array();
+//
+// foreach ($days as $day)
+// {
+// if ($day >= $contract_date_start &&
$day <= $contract_date_end)
+// {
+//
$data_contract[date_format($day, 'D')] = $contract;
+// }
+// }
+//
+// if ($data_contract)
+// {
+// $link =
$GLOBALS['phpgw']->link('/index.php', array(
+// 'menuaction' =>
'rental.uicontract.view',
+// 'id' => $contract['id']
+// ));
+//
+// $data_contract['contract_link'] = $link;
+// $data_contracts[] = $data_contract;
+// }
+// }
- foreach ($composite_obj as $composite)
+// Mixtos K00006822 K00006853
+ $composites_obj =
rental_socomposite::get_instance()->get($options['start_index'],
$options['num_of_objects'], $options['sort_field'], $options['ascending'],
$options['search_for'], $options['search_type'], $filters);
+ $composite_count =
rental_socomposite::get_instance()->get_count($options['search_for'],
$options['search_type'], $filters);
+
+ $composites = array();
+ $n = 0;
+ foreach ($composites_obj as $composite)
{
$contracts = $composite->get_contracts();
- foreach ($contracts as $contract) {
- $contract = $contract->serialize();
+ $composite = $composite->serialize();
- $contract_date_start = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
- $contract_date_end = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
+ if (count($contracts) > 0)
+ {
+ foreach ($contracts as $contract)
+ {
+ $contract = $contract->serialize();
+
+ if ($composites[$n-1]['id'] != $composite['id'])
+ {
+ $composites[$n]['id'] = $composite['id'];
+ }
+
+ $composites[$n]['name'] = $composite['name'];
- $data_contract = array();
+ $contract_date_start = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
+ $contract_date_end = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
- foreach ($days as $day)
- {
- if ($day >= $contract_date_start && $day <=
$contract_date_end)
+ foreach ($days as $day)
{
- $data_contract[date_format($day, 'D')] = $contract;
+ if ($day >= $contract_date_start && ($day <=
$contract_date_end || $contract['date_end'] == ''))
+ {
+ $composites[$n]['contract_id'] =
$contract['id'];
+ $composites[$n]['old_contract_id'] =
$contract['old_contract_id'];
+ $composites[$n][date_format($day,
'D')]['status'] = 'Ikke ledig';
+ }
+ else
+ {
+ $composites[$n][date_format($day,
'D')]['status'] = 'Ledig';
+ }
}
+ $n++;
}
- $data_contracts[] = $data_contract;
}
+ else
+ {
+ $composites[$n]['id'] = $composite['id'];
+ $composites[$n]['name'] = $composite['name'];
+ foreach ($days as $day)
+ {
+ $composites[$n][date_format($day, 'D')]['status'] =
'Ledig';
+ }
+ $n++;
+ }
}
+
+// if (!(count($composites) > 0))
+// {
+// $composites[] = '';
+// }
- if (count($composite_obj) > 0)
- {
- $keys = array_keys($composite_obj);
- $composite = $composite_obj[$keys[0]];
- }
-
- $contracts = $composite->get_contracts();
-
- $data_contracts = array();
-
- foreach ($contracts as $contract)
- {
- $contract = $contract->serialize();
-
- $contract_date_start = new
DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
- $contract_date_end = new DateTime(date('Y-m-d',
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
-
- $data_contract = array();
-
- foreach ($days as $day)
- {
- if ($day >= $contract_date_start &&
$day <= $contract_date_end)
- {
-
$data_contract[date_format($day, 'D')] = $contract;
- }
- }
-
- if ($data_contract)
- {
- $link =
$GLOBALS['phpgw']->link('/index.php', array(
- 'menuaction' =>
'rental.uicontract.view',
- 'id' => $contract['id']
- ));
-
- $data_contract['contract_link'] = $link;
- $data_contracts[] = $data_contract;
- }
- }
-
- if (!(count($data_contracts) > 0))
- {
- $data_contracts[] = '';
- }
-
return array(
- 'total_records' => count($data_contracts),
- 'results' => $data_contracts
+ 'total_records' => $composite_count,
+ 'results' => $composites
);
}
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
2016-09-01 13:00:54 UTC (rev 15560)
+++ branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
2016-09-02 00:26:41 UTC (rev 15561)
@@ -1112,6 +1112,10 @@
if ($date->format('w') != 1) {
$date->modify('last monday');
}
+
+ $filters = $this->_get_filters();
+
+ $schedule['filters'] = $filters;
$schedule['datasource_url'] = self::link(array(
'menuaction' =>
'rental.uicomposite.get_schedule',
@@ -1136,17 +1140,20 @@
$filters = array();
$options = array();
-// if (phpgw::get_var('composite_id'))
-// $filters['composite_id'] =
phpgw::get_var('composite_id');
-//
-// if (phpgw::get_var('contract_status'))
-// $filters['contract_status'] =
phpgw::get_var('contract_status');
-//
-// if (phpgw::get_var('contract_type'))
-// $filters['contract_type'] =
phpgw::get_var('contract_type');
+ if (phpgw::get_var('furnished_status'))
+ $filters['furnished_status'] =
phpgw::get_var('furnished_status');
+ if (phpgw::get_var('district_id'))
+ $filters['district_id'] =
phpgw::get_var('district_id');
+
+ if (phpgw::get_var('is_active'))
+ $filters['is_active'] =
phpgw::get_var('is_active');
+
+ if (phpgw::get_var('has_contract'))
+ $filters['has_contract'] =
phpgw::get_var('has_contract');
+
$options['start_index'] = 0;
- $options['num_of_objects'] =
(phpgw::get_var('n_objects')) ? phpgw::get_var('n_objects') : 30;
+ $options['num_of_objects'] =
(phpgw::get_var('n_objects')) ? phpgw::get_var('n_objects') : 15;
$options['sort_field'] = '';
$options['ascending'] = false;
$options['search_for'] = (phpgw::get_var('search')) ?
phpgw::get_var('search') : '' ;
Modified: branches/dev-syncromind-2/rental/js/rental/schedule.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/schedule.js 2016-09-01
13:00:54 UTC (rev 15560)
+++ branches/dev-syncromind-2/rental/js/rental/schedule.js 2016-09-02
00:26:41 UTC (rev 15561)
@@ -7,7 +7,7 @@
var schedule = new Array();
schedule.renderSchedule = function (container, url, date, colFormatter,
includeResource, classTable)
-{
+{
classTable = (classTable) ? classTable : "pure-table";
while (date.getDay() != 1)
{
@@ -50,7 +50,8 @@
}
var colDefs = [
-// {key: '', label: ''}
+ {key: 'id', label: 'Composite ID', type: 'th'},
+ {key: 'old_contract_id', label: 'Contract'}
]
var keys = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
@@ -71,8 +72,11 @@
var r = [{n: 'ResultSet'}, {n: 'Result'}];
- createTableSchedule(container, url, colDefs, r, classTable, datestr)
+ var params = (schedule.params) ? schedule.params : new Array();
+ var pagination = true;
+ createTableSchedule(container, url, colDefs, r, classTable, datestr,
params, pagination)
+
}
schedule.setupWeekPicker = function ()
@@ -162,14 +166,15 @@
}
$('select.searchSchedule').on('change', function() {
- searchSchedule();
+ schedule.renderSchedule('schedule_container', schedule.datasourceUrl,
schedule.date, schedule.colFormatter, schedule.includeResource);
});
$('input.searchSchedule').on('keyup', function() {
var $this = $(this);
if ($this.data('text') != $this.val()) {
setTimeout(function(){
$this.data('text', $this.val());
- searchSchedule();
+ schedule.params.search = $this.val();
+ schedule.renderSchedule('schedule_container',
schedule.datasourceUrl, schedule.date, schedule.colFormatter,
schedule.includeResource);
}, 500);
}
});
Modified: branches/dev-syncromind-2/rental/templates/base/schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/schedule.xsl
2016-09-01 13:00:54 UTC (rev 15560)
+++ branches/dev-syncromind-2/rental/templates/base/schedule.xsl
2016-09-02 00:26:41 UTC (rev 15561)
@@ -42,50 +42,61 @@
</tr>
</thead>
<tbody>
- <tr>
- <td><label
for="location_id">!t_new_contract</label></td>
- <td valign="top">
- <select style="width: 250px" width="250"
name="location_id" id="location_id" class="searchSchedule">
- <option
value="838">!contract_type_eksternleie</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><label
for="search_option">!search_where</label></td>
- <td valign="top">
- <select style="width: 250px" width="250"
name="search_option" id="search_option" class="searchSchedule">
- <option value="all">All</option>
- <option
value="id">!contract_id</option>
- <option
value="party_name">!party_name</option>
- <option
value="composite">!composite_name</option>
- <option
value="composite_address">!composite_address</option>
- <option
value="location_code">!object_number</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><label
for="contract_status">Status</label></td>
- <td valign="top">
- <select style="width: 250px" width="250"
name="contract_status" id="contract_status" class="searchSchedule">
- <option value="all">All</option>
- <option
value="under_planning">!under_planning</option>
- <option
value="active">!active_plural</option>
- <option
value="under_dismissal">!under_dismissal</option>
- <option value="ended">!ended</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><label
for="contract_type">!field_of_responsibility</label></td>
- <td valign="top">
- <select style="width: 250px" width="250"
name="contract_type" id="contract_type" class="searchSchedule">
- <option value="all">All</option>
- <option
value="836">!contract_type_internleie</option>
- <option
value="837">!contract_type_innleie</option>
- <option
value="838">!contract_type_eksternleie</option>
- </select>
- </td>
- </tr>
+ <script type="text/javascript">
+ schedule.params = {};
+ </script>
+ <xsl:for-each select="filters">
+ <tr>
+ <td><xsl:value-of select="text" /></td>
+ <td>
+ <xsl:variable name="name">
+
<xsl:value-of select="name"/>
+
</xsl:variable>
+ <xsl:if test="type = 'filter'">
+ <select id="{$name}"
name="{$name}" class="searchSchedule" width="250" style="width: 250px">
+ <xsl:for-each select="list">
+ <xsl:variable name="id">
+ <xsl:value-of
select="id"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="id =
'NEW'">
+ <option
value="{$id}" selected="selected">
+ <xsl:value-of
select="name"/>
+ </option>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="selected = 'selected'">
+ <option
value="{$id}" selected="selected">
+
<xsl:value-of select="name"/>
+ </option>
+ </xsl:when>
+ <xsl:when
test="selected = '1'">
+ <option
value="{$id}" selected="selected">
+
<xsl:value-of select="name"/>
+ </option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option
value="{$id}">
+
<xsl:value-of select="name"/>
+ </option>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </select>
+ </xsl:if>
+ </td>
+ </tr>
+ <script type="text/javascript">
+ schedule.params.<xsl:value-of
select="name"/> = $('select#<xsl:value-of select="name"/>').val();
+ $('select#<xsl:value-of
select="name"/>').change( function()
+ {
+ schedule.params.<xsl:value-of
select="name"/> = $(this).val();
+ });
+ </script>
+ </xsl:for-each>
</tbody>
</table>
</div>
@@ -126,11 +137,22 @@
<option value="0">All</option>
</select>
<label for="cboNObjects">Entries</label>
+ <script type="text/javascript">
+ schedule.params.n_objects = $('select#cboNObjects').val();
+ $('select#cboNObjects').change( function()
+ {
+ schedule.params.n_objects = $(this).val();
+ });
+ </script>
</p>
</div>
<script type="text/javascript">
var composite_id = '<xsl:value-of select="composite_id"/>';
$(window).load(function() {
+
+ schedule.params.n_objects = $('#cboNObjects').val();
+ schedule.params.search = $('#txtSearchSchedule').val();
+
schedule.setupWeekPicker('cal_container');
var img_src = '<xsl:value-of select="picker_img"/>';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15561],
saul . huanay <=