Changeset 5685409
- Timestamp:
- Dec 2, 2019, 2:21:43 AM (3 years ago)
- Branches:
- master
- Children:
- 6e371e3
- Parents:
- fd09a48 (diff), a653dec (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- web
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
web/include/doc.nulltype.php
rfd09a48 r5685409 1906 1906 var result = 1907 1907 row[0] + 1908 ' (' + row[3] + ')' +1909 1908 \"<em class='qnt'> тел . \" + row[2] + \"</em>\"; 1910 1909 return result; -
web/include/doc.s.agent.php
rfd09a48 r5685409 92 92 list($nxt[0],$nxt[3])=[$nxt[3],$nxt[0]]; 93 93 } 94 $tmpl->addContent("$nxt[0] |$nxt[1]|$nxt[2]|$nxt[3]\n");94 $tmpl->addContent("$nxt[0] ".($nxt[3] ? "($nxt[3])" : "")."|$nxt[1]|$nxt[2]|$nxt[3]\n"); 95 95 } 96 96 } elseif ($opt == 'jgetcontracts') { -
web/include/models/ldo/doclist.php
rfd09a48 r5685409 88 88 } 89 89 return $filter; 90 } 91 92 93 /** 94 * Сформировать order из запроса 95 * @return string 96 */ 97 protected function getOrder() 98 { 99 $orderFields = [ 100 'sum' => '`doc_list`.`sum`', 101 'date' => '`doc_list`.`date`', 102 'asc' => 'ASC', 103 'desc' => 'DESC' 104 ]; 105 if(!empty($this->options['order'])) { 106 foreach (json_decode($this->options['order'], true) as $item) { 107 if(!empty($orderFields[$item['field']]) && !empty($orderFields[$item['order']])) { 108 $orders[] = $orderFields[$item['field']] . ' ' . $orderFields[$item['order']]; 109 } 110 } 111 } 112 if(!empty($orders)) { 113 return 'ORDER BY '.implode(', ', $orders); 114 } 115 return 'ORDER by `doc_list`.`date` DESC'; 90 116 } 91 117 … … 203 229 $sql_join 204 230 WHERE 1 $sql_filter 205 ORDER by `doc_list`.`date` DESC231 {$this->getOrder()} 206 232 LIMIT $start,{$this->limit}"; 207 233 $result = array(); -
web/js/doc_journal.js
rfd09a48 r5685409 132 132 var httpRequest = new XMLHttpRequest(); 133 133 134 let sortableFields = []; 135 let fieldsWithCnt = [ 136 { 137 attributes: { 138 width: 55 139 }, 140 html: 'a.№' 141 }, 142 { 143 attributes: { 144 width: 20 145 }, 146 html: '' 147 }, 148 { 149 attributes: { 150 width: 20 151 }, 152 html: '' 153 }, 154 { 155 html: 'Тип' 156 }, 157 { 158 html: 'Участник 1' 159 }, 160 { 161 html: 'Участник 2' 162 }, 163 { 164 html: 'Кол-во' 165 }, 166 { 167 html: 'Цена' 168 }, 169 { 170 attributes: { 171 class: 'js-order-filter' 172 }, 173 field: 'sum', 174 order: 'asc', 175 html: 'Сумма' 176 }, 177 { 178 attributes: { 179 class: 'js-order-filter' 180 }, 181 field: 'date', 182 order: 'asc', 183 html: 'Дата' 184 }, 185 { 186 html: 'Автор' 187 }, 188 { 189 html: 'id' 190 }, 191 ]; 192 193 let fields = [ 194 { 195 attributes: { 196 width: 55 197 }, 198 html: 'a.№' 199 }, 200 { 201 attributes: { 202 width: 20 203 }, 204 html: '' 205 }, 206 { 207 attributes: { 208 width: 20 209 }, 210 html: '' 211 }, 212 { 213 html: 'Тип' 214 }, 215 { 216 html: 'Участник 1' 217 }, 218 { 219 html: 'Участник 2' 220 }, 221 { 222 attributes: { 223 class: 'js-order-filter' 224 }, 225 field: 'sum', 226 order: 'asc', 227 html: 'Сумма' 228 }, 229 { 230 attributes: { 231 class: 'js-order-filter' 232 }, 233 field: 'date', 234 order: 'asc', 235 html: 'Дата' 236 }, 237 { 238 html: 'Автор' 239 }, 240 { 241 html: 'id' 242 }, 243 ]; 244 245 134 246 var deffer_timer; 135 247 var docj_list_body = document.getElementById('docj_list_body'); … … 218 330 if (okfilter_id.value != '0') 219 331 filter_request += '&doclist[ok]=' + encodeURIComponent(okfilter_id.value); 332 333 if(sortableFields) { 334 let orderQuery = []; 335 sortableFields.forEach(function(item){ 336 if(item.hasOwnProperty('order') && item.hasOwnProperty('field')) { 337 orderQuery.push({ 338 'field': item.field, 339 'order': item.order 340 }); 341 } 342 }); 343 filter_request += '&doclist[order]=' + encodeURIComponent(JSON.stringify(orderQuery)); 344 } 220 345 } 221 346 … … 558 683 } 559 684 685 function buldHeaderFields(data) { 686 let tr = document.createElement("tr"); 687 data.forEach(function (item, i) { 688 let th = document.createElement("th"); 689 th.innerText = item.html; 690 if(item.hasOwnProperty('attributes')) { 691 if(item.attributes.hasOwnProperty('class')){ 692 th.classList = item.attributes.class ? item.attributes.class : ''; 693 } 694 } 695 if(item.hasOwnProperty('order')) { 696 th.style = 'background: url(/img/i_orderarrows.png) 100% ' 697 +(item.order === 'asc' ? '' : '10') 698 +'0% no-repeat transparent; background-color: #6488DC; cursor: pointer'; 699 } 700 if(item.hasOwnProperty('field')) { 701 th.dataset.field = item.field; 702 } 703 th.dataset.fieldId = i; 704 tr.appendChild(th); 705 }); 706 return tr.innerHTML; 707 } 708 709 560 710 function initTableHead() { 561 711 var head = document.getElementById('doc_list_head'); 562 712 if (show_count_column) { 563 head.innerHTML = "<tr><th width='55'>a.№</th><th width='20'> </th><th width='20'> </th><th>Тип</th><th>Участник 1</th><th>Участник 2</th><th>Кол-во</th><th>Цена</th><th>Сумма</th><th>Дата</th><th>Автор</th><th width='45'>id</th></tr>";713 head.innerHTML = buldHeaderFields(fieldsWithCnt); 564 714 } 565 715 else { 566 head.innerHTML = "<tr><th width='55'>a.№</th><th width='20'> </th><th width='20'> </th><th>Тип</th><th>Участник 1</th><th>Участник 2</th><th>Сумма</th><th>Дата</th><th>Автор</th><th width='45'>id</th></tr>"; 567 } 716 head.innerHTML = buldHeaderFields(fields); 717 } 718 let orderFilter = function(e) { 719 let data = show_count_column ? fieldsWithCnt : fields; 720 let self = this; 721 sortableFields = sortableFields.filter(function(val){ 722 return val.field !== data[self.dataset.fieldId].field; 723 }); 724 sortableFields.unshift({ 725 field: data[this.dataset.fieldId].field, 726 order: data[this.dataset.fieldId].order === 'asc' ? 'desc' : 'asc', 727 }); 728 data[this.dataset.fieldId].order = data[this.dataset.fieldId].order === 'asc' ? 'desc' : 'asc'; 729 beginDefferedRequest(); 730 }; 731 document.querySelectorAll("th.js-order-filter").forEach(box => { box.addEventListener('click', orderFilter, false); }); 568 732 } 569 733 -
web/vitrina.php
rfd09a48 r5685409 400 400 $lim = 100; 401 401 } 402 402 $this->OrderAndViewBar($group, $page, $order, $view); 403 403 if ($res->num_rows) { 404 404 if ($page < 1 || $lim * ($page - 1) > $res->num_rows) { … … 406 406 exit(); 407 407 } 408 $this->OrderAndViewBar($group, $page, $order, $view);409 408 410 409 $this->PageBar($group, $res->num_rows, $lim, $page); … … 429 428 header("Location: " . (empty($_SERVER['HTTPS']) ? "http" : "https") . "://" . $_SERVER['HTTP_HOST'] . html_in($this->GetGroupLink($group)), false, 301); 430 429 exit(); 430 } else { 431 $tmpl->addContent("<h2 style='text-align: center'>Нет подходящих товаров</h2>"); 431 432 } 432 433 } … … 1370 1371 $img = ''; 1371 1372 } 1373 $product_data = $this->getProductData($item['id']); 1374 $product_name_html = html_out($product_data['group_printname'] . ' ' . $product_data['name']); 1372 1375 $img = isset($item['img_uri']) ? "<img_src='{$item['img_uri']}' alt='" . html_out($item['name']) . "'>" : ''; 1373 1376 $tmpl->addContent("<tr id='korz_ajax_item_{$item['pos_id']}'{$lock_mark}> … … 1376 1379 <img src='/img/i_del.png' alt='Убрать'></a></span></td> 1377 1380 <td>$img</td> 1378 <td><a href='/vitrina.php?mode=product&p={$item['pos_id']}'>" . html_out($item['name']). "</a></td>1381 <td><a href='/vitrina.php?mode=product&p={$item['pos_id']}'>" . $product_name_html . "</a></td> 1379 1382 <td class='right'{$gray_price}>$price_p</td> 1380 1383 <td class='right'><span class='sum'>$sum_p</span></td> … … 1770 1773 /// Заключительная форма оформления покупки 1771 1774 protected function BuyMakeForm() { 1772 global $tmpl ;1775 global $tmpl, $db; 1773 1776 if (@$_SESSION['uid']) { 1774 1777 $up = getUserProfile($_SESSION['uid']); … … 1840 1843 } 1841 1844 1842 $tmpl->addContent(" 1843 Другая информация:<br> 1844 <textarea name='dop' rows='5' cols='80'>" . html_out(@$up['dop']['dop_info']) . "</textarea><br> 1845 <button type='submit'>Оформить заказ</button> 1846 </div> 1847 </form>"); 1845 $tmpl->addContent("Другая информация:<br><textarea name='dop' rows='5' cols='80'>" . html_out(@$up['dop']['dop_info']) . "</textarea><br>"); 1846 1847 if($this->getBasket()) { 1848 $basket = $this->getBasket(); 1849 $tmpl->addContent('<br> 1850 <table class="list"> 1851 <tbody> 1852 <tr class="title"> 1853 <th width="60%">Наименование</th> 1854 <th width="15%">Цена, руб.</th> 1855 <th width="10%">Количество</th> 1856 <th width="15%">Сумма, руб.</th> 1857 </tr> 1858 '); 1859 foreach ($basket['items'] as $item) { 1860 $product_data = $this->getProductData($item['id']); 1861 $product_name_html = html_out($product_data['group_printname'] . ' ' . $product_data['name']); 1862 $tmpl->addContent(" 1863 <tr> 1864 <td style='text-align: left'><a href='/vitrina.php?mode=product&p={$item['pos_id']}'>{$product_name_html}</a></td> 1865 <td>".number_format($item['price'], 2, ',', ' ')."</td> 1866 <td>{$item['cnt']}</td> 1867 <td style='text-align: right'>".number_format($item['sum'], 2, ',', ' ')."</td> 1868 </tr> 1869 "); 1870 } 1871 1872 $tmpl->addContent(" 1873 <tr> 1874 <td colspan=\"3\">Сумма заказа:</td> 1875 <td style='text-align: right' colspan=\"1\">" . number_format($basket['sum'], 2, ',', ' ') . "</td> 1876 </tr> 1877 "); 1878 1879 if(!empty($_SESSION['basket']['delivery_region']) && !empty($_SESSION['basket']['delivery_type'])) { 1880 $delivery = $_SESSION['basket']['delivery_type']; 1881 $delivery_region = $_SESSION['basket']['delivery_region']; 1882 $res = $db->query("SELECT `name` FROM `delivery_types` WHERE `id`='$delivery'"); 1883 list($d_service_name) = $res->fetch_row(); 1884 $res = $db->query("SELECT `price`, `name` FROM `delivery_regions` WHERE `id`='$delivery_region'"); 1885 list($d_price, $d_region_name) = $res->fetch_row(); 1886 $tmpl->addContent(" 1887 <tr> 1888 <td colspan=\"3\">$d_service_name ($d_region_name):</td> 1889 <td style='text-align: right' colspan=\"1\">".number_format($d_price, 2, ',', ' ')."</td> 1890 </tr> 1891 "); 1892 } 1893 1894 $tmpl->addContent(' 1895 <tr class="total"> 1896 <td colspan="3">Итого:</td> 1897 <td style=\'text-align: right\' colspan="1"> 1898 ' . number_format(($basket['sum'] + (isset($d_price) ? $d_price : 0)), 2, ',', ' ') . ' 1899 </td> 1900 </tr> 1901 </tbody> 1902 </table><br> 1903 '); 1904 } 1905 1906 $tmpl->addContent("<button type='submit'>Оформить заказ</button></div></form>"); 1848 1907 } 1849 1908
Note: See TracChangeset
for help on using the changeset viewer.