| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104 |
- <?php
- Lib::loadClass('RouteBase');
- Lib::loadClass('ProcesHelper');
- Lib::loadClass('Typespecial');
- class Route_DealsSales extends RouteBase {
- public function handleAuth() {
- if (!User::logged()) {
- throw new HttpException('Unauthorized', 401);
- }
- }
- public function defaultAction() {
- SE_Layout::gora();
- SE_Layout::menu();
- $this->legacy_DEALS_SALES();
- SE_Layout::dol();
- }
- public function typespecialAction() {
- $DBG = ('1' == V::get('DBG', '', $_REQUEST));
- header("Content-type: application/json");
- $fld = V::get('fld', '', $_GET);
- switch ($fld) {
- case 'id_telboxes': {
- Lib::loadClass('TypespecialVariable');
- $typeSpecialTelboxes = TypespecialVariable::getInstance(-1, '__DEALS_SALES_TELBOXES_NAME');
- $query = V::get('q', '', $_REQUEST);
- $rawRows = null;
- $rows = $typeSpecialTelboxes->getValuesWithExports($query);
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'</pre>';}
- foreach ($rows as $kID => $vItem) {
- $itemJson = new stdClass();
- $itemJson->id = $vItem->id;
- $itemJson->name = $vItem->param_out;
- if (!empty($vItem->exports)) {
- $itemJson->exports = $vItem->exports;
- }
- $jsonData[] = $itemJson;
- }
- echo json_encode($jsonData);
- }
- break;
- case 'id_companies': {
- Lib::loadClass('TypespecialVariable');
- $typeSpecialCompanies = TypespecialVariable::getInstance(-1, '__COMPANIES');
- $query = V::get('q', '', $_REQUEST);
- $rawRows = null;
- $rows = $typeSpecialCompanies->getValuesWithExports($query);
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">rows('.$query.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($rows);echo'</pre>';}
- foreach ($rows as $kID => $vItem) {
- $itemJson = new stdClass();
- $itemJson->id = $vItem->id;
- $itemJson->name = $vItem->param_out;
- if (!empty($vItem->exports)) {
- $itemJson->exports = $vItem->exports;
- }
- $jsonData[] = $itemJson;
- }
- echo json_encode($jsonData);
- }
- break;
- }
- }
- public function getDataAjaxAction() {
- header("Content-type: application/json");
- $response = new stdClass();
- $response->msg = 'TODO: F. ' . __FUNCTION__ . ' L.' . __LINE__;
- echo json_encode($response);
- }
- public function inlineEditAjaxAction() {
- //header("Content-type: application/json");
- $response = new stdClass();
- $response->msg = 'TODO: F. ' . __FUNCTION__ . ' L.' . __LINE__;// TODO: DBG
- $response->_request = $_REQUEST;// TODO: DBG
- $year = V::get('year', 0, $_REQUEST, 'int');
- $month = V::get('month', 0, $_REQUEST, 'int');
- $telbox = V::get('telbox', '', $_REQUEST, 'word');
- if ($year <= 0) throw new Exception('Error: wrong year');
- if ($month <= 0 || $month > 12) throw new Exception('Error: wrong month');
- if (empty($telbox)) throw new Exception('Error: wrong telbox');
- $record = $this->_fetchSaleByParams($telbox, $year, $month);
- if (empty($record)) {
- return $this->_renderInlineCreateForm($telbox, $year, $month);
- } else {
- return $this->_renderInlineEditForm($record);
- }
- }
- public function saveInlineAjaxAction() {
- header("Content-type: application/json");
- $response = new stdClass();
- $response->msg = 'TODO: F. ' . __FUNCTION__ . ' L.' . __LINE__;
- $response->_request = $_REQUEST;// TODO: DBG
- $id = V::get('ID', 0, $_REQUEST, 'int');
- if ($id > 0) {
- return $this->_saveInlineEdit($id, $_REQUEST);
- } else {
- return $this->_saveInlineCreate($_REQUEST);
- }
- }
- private function _saveInlineEdit($id, $args) {
- $record = $this->_fetchSaleById($id);
- if (empty($record)) throw new HttpException("Record {$id} not exists", 404);
- DBG::_('DBG', '>2', "record", $record, __CLASS__, __FUNCTION__, __LINE__);// TODO: DBG
- DBG::_('DBG', '>2', "args", $args, __CLASS__, __FUNCTION__, __LINE__);// TODO: DBG
- $tblAcl = $this->_getTableAcl();
- $primaryKeyFieldName = 'ID';
- $primaryKey = V::get($primaryKeyFieldName, 0, $record);
- $itemPatch = new stdClass();
- $itemPatch->{$primaryKeyFieldName} = $primaryKey;
- $visibleCols = array('SALES_VALUE', 'marka', 'A_STATUS');
- foreach ($visibleCols as $fieldName) {
- $fieldID = $tblAcl->getFieldIdByName($fieldName);
- if (!$fieldID) throw new Exception("No field by name ({$fieldName})");
- if (!$tblAcl->isAllowed($fieldID, 'W', $record)) {
- throw new Exception("Brak uprawnień do zapisu ({$fieldName})");
- }
- $argsFieldName = "f{$fieldID}";
- if (!isset($args[$argsFieldName])) throw new Exception("Brak danych dla pola ({$fieldName})");
- $itemPatch->{$fieldName} = $args[$argsFieldName];
- }
- DBG::_('DBG', '>1', "TODO: save record", $itemPatch, __CLASS__, __FUNCTION__, __LINE__);// TODO: DBG
- $response = new stdClass();
- try {
- $affected = $tblAcl->updateItem($itemPatch);
- if ($affected > 0) {
- $response->type = 'success';
- $response->msg = "Rekord zapisany pomyślnie";//"Record saved successfully";
- } else if ($affected == 0) {
- $response->type = 'info';
- $response->msg = "Nie wprowadzono żadnych zmian";
- }
- $response->record = $tblAcl->getItem($primaryKey);
- }
- catch (Exception $e) {
- $response->type = 'error';
- $response->msg = $e->getMessage();
- }
- echo json_encode($response);
- }
- private function _saveInlineCreate($args) {
- $year = V::get('SALES_YEAR', 0, $args, 'int');
- $month = V::get('SALES_MONTH', 0, $args, 'int');
- $telbox = V::get('T_TELBOX_NEIGHBOUR_IN', '', $args, 'word');
- if ($year <= 0) throw new Exception('Error: wrong year');
- if ($month <= 0 || $month > 12) throw new Exception('Error: wrong month');
- if (empty($telbox)) throw new Exception('Error: wrong telbox');
- $tblAcl = $this->_getTableAcl();
- $primaryKeyFieldName = 'ID';
- $primaryKey = V::get($primaryKeyFieldName, 0, $record);
- $item = new stdClass();//$tblAcl->convertObjectFromUserInput($args, $type = 'array_by_id', $prefix = 'f');
- $item->T_TELBOX_NEIGHBOUR_IN = $telbox;
- $item->SALES_YEAR = $year;
- $item->SALES_MONTH = $month;
- $visibleCols = array('SALES_VALUE', 'marka');
- foreach ($visibleCols as $fieldName) {
- $fieldID = $tblAcl->getFieldIdByName($fieldName);
- if (!$fieldID) throw new Exception("No field by name ({$fieldName})");
- if (!$tblAcl->isAllowed($fieldID, 'C', $record)) {
- throw new Exception("Brak uprawnień do utworzenia ({$fieldName})");
- }
- $argsFieldName = "f{$fieldID}";
- if (!isset($args[$argsFieldName])) throw new Exception("Brak danych dla pola ({$fieldName})");
- $item->{$fieldName} = $args[$argsFieldName];
- }
- try {
- $createdId = $tblAcl->addItem($item);
- if ($createdId) {
- $response->type = 'success';
- $response->msg = "Utworzono pomyślnie rekord nr {$createdId}";
- $response->id = $createdId;
- $response->record = $tblAcl->getItem($createdId);
- }
- else {
- $response->type = 'error';
- $response->msg = "Nie udało się utworzyć nowego rekordu!";
- }
- }
- catch (Exception $e) {
- $response->type = 'error';
- $response->msg = "Wystąpiły błędy!";
- $response->msg = $e->getMessage();
- }
- echo json_encode($response);
- }
- private function _fetchSaleByParams($telbox, $year, $month) {
- $record = null;
- $db = DB::getDB();
- $sqlWhere = array();
- $sqlWhere[] = " o.`A_STATUS`!='DELETED' ";
- $sqlIdTelboxes = $db->_($telbox);
- $sqlWhere[] = " o.`T_TELBOX_NEIGHBOUR_IN`='{$sqlIdTelboxes}' ";
- $sqlWhere[] = " o.`SALES_YEAR`='{$year}' ";
- $sqlWhere[] = " o.`SALES_MONTH`='{$month}' ";
- $sqlWhere = (!empty($sqlWhere))? implode(" and ", $sqlWhere) : '';
- $sql = "select o.`ID`
- , o.`T_TELBOX_NEIGHBOUR_IN`
- , o.`ID_DEALS_TABLE`
- , o.`SALES_YEAR`
- , o.`SALES_MONTH`
- , o.`SALES_VALUE`
- , o.`marka`
- , o.`A_STATUS`
- from `DEALS_SALES` as o
- where
- {$sqlWhere}
- ";
- DBG::_('DBG_SQL', '>1', "sql:fetch({telbox:{$telbox},year:{$year},month:{$month}})", $sql, __CLASS__, __FUNCTION__, __LINE__);
- $res = $db->query($sql);
- while ($r = $db->fetch($res)) {
- $record = $r;
- }
- return $record;
- }
- private function _fetchSaleById($idSale) {
- $record = null;
- $db = DB::getDB();
- $sqlWhere = array();
- $sqlWhere[] = " o.`A_STATUS`!='DELETED' ";
- $sqlWhere[] = " o.`ID`='{$idSale}' ";
- $sqlWhere = (!empty($sqlWhere))? implode(" and ", $sqlWhere) : '';
- $sql = "select o.`ID`
- , o.`T_TELBOX_NEIGHBOUR_IN`
- , o.`ID_DEALS_TABLE`
- , o.`SALES_YEAR`
- , o.`SALES_MONTH`
- , o.`SALES_VALUE`
- , o.`marka`
- , o.`A_STATUS`
- from `DEALS_SALES` as o
- where
- {$sqlWhere}
- ";
- DBG::_('DBG_SQL', '>1', "sql:fetch({telbox:{$telbox},year:{$year},month:{$month}})", $sql, __CLASS__, __FUNCTION__, __LINE__);
- $res = $db->query($sql);
- while ($r = $db->fetch($res)) {
- $record = $r;
- }
- return $record;
- }
- private function _renderInlineCreateForm($telbox, $year, $month) {
- //DBG::_(true, true, "TODO: Edit Form for record", $record, __CLASS__, __FUNCTION__, __LINE__);// TODO: DBG
- $DBG = ('1' == V::get('DBG', '', $_REQUEST));
- header("Content-type: text/plain");
- $row = $record;// TODO: refactor
- $tblAcl = $this->_getTableAcl();
- $visibleCols = array('SALES_VALUE', 'marka');
- $hasTypeSpecial = false;
- foreach ($visibleCols as $fieldName) {
- $fieldID = $tblAcl->getFieldIdByName($fieldName);
- if (!$fieldID) throw new Exception("No field by name ({$fieldName})");
- $fieldVal = ($tblAcl->isAllowed($fieldID, 'R', $row))? V::get($fieldName, '', $row) : '*****';
- $fieldVal = V::get("f{$fieldID}", $fieldVal, $_POST);
- $vCol = $tblAcl->getField($fieldID);
- $vCol['label'] = (!empty($vCol['label']))? $vCol['label'] : $vCol['name'];
- $tsValues = array();
- $typeSpecial = Typespecial::getInstance($fieldID, $vCol['name']);
- if ($typeSpecial) {
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$fieldID.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($typeSpecial);echo'</pre>';}
- $specialValues = $typeSpecial->getEditSelectedValuesByIds($this->_zasobID, $row->ID, $fieldName, V::get($fieldName, $fieldVal, $row));
- if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Typespecial('.$fieldID.') specialValues (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($specialValues);echo'</pre>';}
- if (!empty($specialValues)) {
- $tsValues[$row->ID] = implode('<br>', $specialValues);
- }
- }
- ?>
- <label for="<?php echo "f{$fieldID}"; ?>" class="AjaxTableEdit-label">
- <strong title="<?php echo "[{$fieldID}] {$fieldName}"; ?>"><?php echo "{$vCol['label']}"; ?></strong>
- <?php if (!empty($vCol['opis'])) : ?>
- <em><?php echo $vCol['opis']; ?></em>
- <?php $perms = $tblAcl->getFieldPerms($fieldID); SE_Layout::hotKeyDBG($perms); ?>
- <?php endif; ?>
- </label>
- <?php
- $fieldParams = array('widthClass'=>'inside-modal', 'maxGrid'=>6);
- if (!empty($tsValues[$row->ID])) {
- $fieldParams['typespecialValue'] = $tsValues[$row->ID];
- }
- $vDefault = $tblAcl->getColDefault($fieldName);
- if (!empty($vDefault)) {
- $fieldParams['default'] = $vDefault;
- }
- echo $tblAcl->showFormItem('W', $fieldID, "f{$fieldID}", $fieldVal, $fieldParams, $row);
- if ($typeSpecial) $hasTypeSpecial = true;
- }
- if ($hasTypeSpecial) {
- echo '<p style="padding:100px 0;"></p>';
- }
- ?>
- <input type="hidden" name="T_TELBOX_NEIGHBOUR_IN" value="<?php echo $telbox; ?>" />
- <input type="hidden" name="SALES_YEAR" value="<?php echo $year; ?>" />
- <input type="hidden" name="SALES_MONTH" value="<?php echo $month; ?>" />
- <?php
- exit;
- }
- private function _renderInlineEditForm($record) {
- //DBG::_(true, true, "TODO: Edit Form for record", $record, __CLASS__, __FUNCTION__, __LINE__);// TODO: DBG
- $DBG = ('1' == V::get('DBG', '', $_REQUEST));
- header("Content-type: text/plain");
- $row = $record;// TODO: refactor
- $tblAcl = $this->_getTableAcl();
- // TODO: $cols = array('T_TELBOX_NEIGHBOUR_IN','SALES_YEAR','SALES_MONTH','SALES_VALUE','marka');
- // TODO: form for only 'SALES_VALUE' and eventually 'marka'
- $visibleCols = array('SALES_VALUE', 'marka', 'A_STATUS');
- $hasTypeSpecial = false;
- foreach ($visibleCols as $fieldName) {
- $fieldID = $tblAcl->getFieldIdByName($fieldName);
- if (!$fieldID) throw new Exception("No field by name ({$fieldName})");
- $fieldVal = ($tblAcl->isAllowed($fieldID, 'R', $row))? V::get($fieldName, '', $row) : '*****';
- $fieldVal = V::get("f{$fieldID}", $fieldVal, $_POST);
- $vCol = $tblAcl->getField($fieldID);
- $vCol['label'] = (!empty($vCol['label']))? $vCol['label'] : $vCol['name'];
- $tsValues = array();
- $typeSpecial = Typespecial::getInstance($fieldID, $vCol['name']);
- if ($typeSpecial) {
- $specialValues = $typeSpecial->getEditSelectedValuesByIds($this->_zasobID, $row->ID, $fieldName, V::get($fieldName, $fieldVal, $row));
- if (!empty($specialValues)) {
- $tsValues[$row->ID] = implode('<br>', $specialValues);
- }
- }
- ?>
- <label for="<?php echo "f{$fieldID}"; ?>" class="AjaxTableEdit-label">
- <strong title="<?php echo "[{$fieldID}] {$fieldName}"; ?>"><?php echo "{$vCol['label']}"; ?></strong>
- <?php if (!empty($vCol['opis'])) : ?>
- <em><?php echo $vCol['opis']; ?></em>
- <?php $perms = $tblAcl->getFieldPerms($fieldID); SE_Layout::hotKeyDBG($perms); ?>
- <?php endif; ?>
- </label>
- <?php
- $fieldParams = array('widthClass'=>'inside-modal', 'maxGrid'=>6);
- if (!empty($tsValues[$row->ID])) {
- $fieldParams['typespecialValue'] = $tsValues[$row->ID];
- }
- $vDefault = $tblAcl->getColDefault($fieldName);
- if (!empty($vDefault)) {
- $fieldParams['default'] = $vDefault;
- }
- echo $tblAcl->showFormItem('W', $fieldID, "f{$fieldID}", $fieldVal, $fieldParams, $row);
- if ($typeSpecial) $hasTypeSpecial = true;
- }
- if ($hasTypeSpecial) {
- echo '<p style="padding:100px 0;"></p>';
- }
- ?>
- <input type="hidden" name="ID" value="<?php echo $record->ID; ?>" />
- <?php
- exit;
- }
- private function _getTableAcl() {
- $zasobObj = ProcesHelper::getZasobTableInfoByUri('default_db/deals_sales');
- if (!$zasobObj) throw new Exception("Zasob tabela deals_sales nie istnieje.");
- $userAcl = User::getAcl();
- $userAcl->fetchGroups();
- if (!$userAcl->hasTableAcl($zasobObj->ID)) throw new Exception("Brak uprawnień do tabeli ");
- $tblAcl = $userAcl->getTableAcl($zasobObj->ID);
- return $tblAcl;
- }
- public function legacy_DEALS_SALES() {
- $id_telboxes = V::get('id_telboxes', '', $_REQUEST);
- $id_companies = V::get('id_companies', '', $_REQUEST, 'int');
- $idTelboxes = $id_telboxes;
- if (!empty($idTelboxes)) {
- if (!empty($idTelboxes)) {
- if (false !== strpos($idTelboxes, ': ')) {
- $parts = explode(': ', $idTelboxes, 2);
- $idTelboxes = $parts[0];
- }
- }
- }
- SE_Layout::menu();
- Lib::loadClass('TypespecialVariable');
- $typeSpecialTelboxes = TypespecialVariable::getInstance(-1, '__DEALS_SALES_TELBOXES_NAME');
- $typeSpecialCompanies = null;// TypespecialVariable::getInstance(-1, '__COMPANIES');
- $obroty = array();
- $obrotyByYear = array();
- $marki = array();
- $obrotyToMarki = array();
- if (!empty($idTelboxes)) {
- $db = DB::getDB();
- $sqlWhere = array();
- $sqlWhere[] = " o.`A_STATUS`!='DELETED' ";
- $sqlIdTelboxes = $db->_($idTelboxes);
- $sqlWhere[] = " o.`T_TELBOX_NEIGHBOUR_IN`='{$sqlIdTelboxes}' ";
- $sqlWhere = (!empty($sqlWhere))? implode(" and ", $sqlWhere) : '';
- $sql = "select o.`ID`
- -- , d.`T_TELBOX_NEIGHBOUR_IN`
- , o.`T_TELBOX_NEIGHBOUR_IN`
- , o.`ID_DEALS_TABLE`
- -- , o.`SALES_DATE`
- , o.`SALES_YEAR`
- , o.`SALES_MONTH`
- , o.`SALES_VALUE`
- , o.`marka`
- from `DEALS_SALES` as o
- -- join `DEALS_TABLE` as d on (d.`ID`=o.`ID_DEALS_TABLE`)
- where
- {$sqlWhere}
- ";
- if(V::get('DBG','',$_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($sql);echo'</pre>';}
- $res = $db->query($sql);
- while ($r = $db->fetch($res)) {
- $year = $r->SALES_YEAR;
- $month = sprintf("%02d", $r->SALES_MONTH);
- $obroty[$r->ID_DEALS_TABLE][$year][$month] = $r->SALES_VALUE;
- $obrotyByYear[$year][$month] = floatval($r->SALES_VALUE);
- $marki[$r->marka] = true;
- $obrotyToMarki[$year][$month] = $r->marka;
- }
- }
- krsort($obrotyByYear);
- //DBG::_(true, true, "obrotyByYear", $obrotyByYear, __CLASS__, __FUNCTION__, __LINE__);
- //DBG::_('DBG', '>0', "marki", $marki, __CLASS__, __FUNCTION__, __LINE__);
- //DBG::_('DBG', '>0', "obrotyToMarki", $obrotyToMarki, __CLASS__, __FUNCTION__, __LINE__);
- $markiOut = array();
- {
- $markiLabels = array('primary', 'success', 'warning', 'danger', 'default');
- // <span class="label label-default">Default</span>
- reset($markiLabels);
- foreach ($marki as $marka => $vBool) {
- $markiOut[$marka] = current($markiLabels);
- if (!next($markiLabels)) reset($markiLabels);
- }
- }// Default Primary Success Info Warning Danger
- $monthsOut = array();
- for ($i = 0; $i < 12; $i++) $monthsOut[] = sprintf("%02d", $i + 1);
- $initData = new stdClass();
- $initData->obroty = $obrotyByYear;
- $initData->marki = $markiOut;
- $initData->obrotyToMarki = $obrotyToMarki;
- $initData->months = $monthsOut;
- $initData->years = array_keys($obrotyByYear);
- //DBG::_(true, true, "initData", $initData, __CLASS__, __FUNCTION__, __LINE__);
- ?>
- <style type="text/css">
- .cell_marka_primary { background-color: #d9edf7; }
- .cell_marka_success { background-color: #dff0d8; }
- .cell_marka_warning { background-color: #fcf8e3; }
- .cell_marka_danger { background-color: #f2dede; }
- .cell_marka_default { background-color: #f5f5f5; }
- </style>
- <div class="container-fluid">
- <p></p>
- <form action="" method="GET" class="form-inline">
- <input type="hidden" name="_route" value="DealsSales">
- <table>
- <!--
- <summary>Wybierz lokal i/lub firmę w celu przeglądania obrotów </summary>
- -->
- <thead>
- <tr>
- <th style="text-align:left">Wyszukaj lokal lub markę</th>
- <th style="text-align:left">
- <?php if ($typeSpecialCompanies) : ?>
- Firma
- <?php endif; ?>
- </th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <?php if ($typeSpecialTelboxes) : ?>
- <?php
- $fName = 'id_telboxes';
- $fldParams = array();
- $fldParams['allowCreate'] = false;
- $fldParams['ajaxDataUrlBase'] = "index.php?_route=DealsSales&_task=typespecial&fld={$fName}";
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
- echo $typeSpecialTelboxes->showFormItem($tblID = -1, $fName, $selValue = $id_telboxes, $fldParams);
- ?>
- <?php endif; ?>
- </td>
- <td>
- <?php if ($typeSpecialCompanies) : ?>
- <?php
- $fName = 'id_companies';
- $fldParams = array();
- $fldParams['allowCreate'] = false;
- $fldParams['ajaxDataUrlBase'] = "index.php?_route=DealsSales&_task=typespecial&fld={$fName}";
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
- echo $typeSpecialCompanies->showFormItem($tblID = -1, $fName, $selValue = $id_companies, $fldParams);
- ?>
- <?php endif; ?>
- </td>
- </tr>
- <tr>
- <td clspan="2">
- <button class="btn">wybierz</button>
- </td>
- </tr>
- </tbody>
- </table>
- </form>
- <?php if (empty($obroty)) : ?>
-
- <?php else : ?>
- <hr>
- <div id="dealsSalesByMonth"></div>
- <script>
- (function($, undefined) {
- var DealsSalesTable = function () {
- var priv = {};// private api
- var publ = {};// public api
- priv.options = {};
- var defaults = {
- url: '',
- urlInlineEdit: '',
- urlSaveInlineEdit: '',
- initData: {},
- debug: false
- },
- _uiNodeCont = null,// container node
- _uiNode$Table = null,
- _inlineEditBox$Node = null,
- _state = {};// state - to replace variables below (date, ...)
- priv.init = function () {
- _uiNodeCont = priv.options.id;
- _state = {};// init state
- priv.initEvents();
- priv.initData();
- priv.initialRender();// set up _uiNode$...
- };
- priv.initEvents = function () {
- jQuery(_uiNodeCont).on('DealsSalesTable:render', priv.onRender);
- };
- priv.initData = function () {
- if (!priv.options.initData) return;
- if (priv.options.initData.obroty) _state.obroty = priv.options.initData.obroty;
- if (priv.options.initData.marki) _state.marki = priv.options.initData.marki;
- if (priv.options.initData.obrotyToMarki) _state.obrotyToMarki = priv.options.initData.obrotyToMarki;
- if (priv.options.initData.months) _state.months = priv.options.initData.months;
- if (priv.options.initData.years) _state.years = priv.options.initData.years;
- };
- priv.initialRender = function () {
- _uiNode$Marki = $('<table class="table table-bordered" style="width:auto"></table>');
- $('<tbody><tr><th>Marki:</th></tr></tbody>').appendTo(_uiNode$Marki);
- _uiNode$Marki.appendTo(_uiNodeCont);
- _uiNode$Table = $('<table class="table table-bordered table-hover"></table>');
- {// thead
- var thead$Node = $('<thead></thead>').appendTo(_uiNode$Table);
- var theadTr$Node = $('<tr></tr>').appendTo(thead$Node);
- $('<th></th>').appendTo(theadTr$Node);
- $.each(_state.months, function(index, value) {
- $('<th>' + value + '</th>').appendTo(theadTr$Node);
- });
- $('<th>suma</th>').appendTo(theadTr$Node);
- }
- $('<tbody></tbody>').appendTo(_uiNode$Table);
- _uiNode$Table.appendTo(_uiNodeCont);
- _uiNode$GraphByYear = $('<div style="width:100%; margin:10px 0; border:1px solid gray; overflow:auto"></div>');
- $('<canvas id="wykres03" width="1760" height="300">[No canvas support]</canvas>').appendTo(_uiNode$GraphByYear);
- _uiNode$GraphByYear.appendTo(_uiNodeCont);
- _uiNode$GraphByMonth = $('<div style="width:100%; margin:10px 0; border:1px solid gray; overflow:auto"></div>');
- $('<canvas id="wykres04" width="1760" height="300">[No canvas support]</canvas>').appendTo(_uiNode$GraphByMonth);
- _uiNode$GraphByMonth.appendTo(_uiNodeCont);
- priv.renderHeaderMarki();
- priv.renderTableBody();
- priv.renderGraphByYear();
- priv.renderGraphByMonth();
- priv.renderInitInlineEditBox();// .dealsSales__inlineEditBox
- };
- priv.renderGraphByYear = function(record) {
- var jsonData = [],
- jsonLabels = [],
- jsonTooltips = [],
- jsonColors = ['Gradient(#fe783e:#EC561B:#F59F7D)', 'Gradient(#99f:#27afe9:#058DC7:#058DC7)', 'Gradient(#94f776:#50B332:#B1E59F)', 'Gradient(#CC76F7:#8832B3:#CE9FE5)', 'Gradient(#768CF7:#3247B3:#9FABE5)', 'Gradient(#F77681:#B3323C:#E59FA5)'],
- jsonColorsAll = [],
- wykresWidth = 940,
- wykresMinItemWidth = 15,
- graphGutterLeft = 60,
- graphGutterRight = 25,
- itemsInLabelCount = 0,
- currentNode = _uiNode$GraphByYear.children('canvas'),
- node = $('<canvas id="wykres03" width="1760" height="300">[No canvas support]</canvas>')
- ;
- {// replace node
- currentNode.replaceWith(node);
- }
- $.each(_state.obroty, function(kYear, vSalesByMonth) {
- var jsonYearData = {},
- yearDataValues = []
- ;
- jsonLabels.push(parseInt(kYear));
- $.each(_state.months, function(monthIdx, vMonth) {
- if (undefined === vSalesByMonth[vMonth]) {
- jsonYearData['' + kYear + '-' + vMonth] = 0;
- } else {
- jsonYearData['' + kYear + '-' + vMonth] = vSalesByMonth[vMonth];
- }
- });
- $.each(jsonYearData, function(kLabel, vValue) {
- jsonTooltips.push('Obrót ' + numeral(vValue).format('0,0[.]00') + ' w ' + kLabel);
- });
- yearDataValues = Object.keys(jsonYearData).map(function (key) {
- return jsonYearData[key];
- });
- jsonData.push(yearDataValues);
- itemsInLabelCount = Math.max(itemsInLabelCount, yearDataValues.length);
- });
- {// colors
- for (var i = 0, mi = 0, mc = jsonColors.length; i < 12; i++) {
- jsonColorsAll.push(jsonColors[mi]);
- if (++mi >= mc) {
- mi = 0;
- }
- }
- jsonColors = jsonColorsAll;
- }
- {// wykres width
- wykresTestWidth = jsonLabels.length * (20 * 2 + itemsInLabelCount * wykresMinItemWidth) + graphGutterLeft + graphGutterRight;
- wykresWidth = Math.max(wykresWidth, wykresTestWidth);
- jQuery('#wykres03').css({width: wykresWidth});
- }
- var bar = new RGraph.Bar('wykres03', jsonData)
- .Set('labels', jsonLabels)
- .Set('colors', jsonColors)
- .Set('strokestyle', 'white')
- .Set('linewidth', 1)
- .Set('shadow', true)
- .Set('shadow.color', '#ccc')
- .Set('shadow.offsetx', 0)
- .Set('shadow.offsety', 0)
- .Set('shadow.blur', 10)
- .Set('gutter.bottom', 30)
- .Set('gutter.left', graphGutterLeft)
- .Set('gutter.right', graphGutterRight)
- .Set('tooltips', RGraph.ISOLD ? null : jsonTooltips)
- .Set('tooltips.event', 'mousemove')
- .Set('labels.above', true)
- .Set('hmargin', 20)
- .Draw();
- };
- priv.renderGraphByMonth = function(record) {
- var jsonData = [],
- jsonLabels = ['styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień','październik','listopad','grudzień'],
- jsonTooltips = [],
- jsonColors = ['Gradient(#fe783e:#EC561B:#F59F7D)', 'Gradient(#99f:#27afe9:#058DC7:#058DC7)', 'Gradient(#94f776:#50B332:#B1E59F)', 'Gradient(#CC76F7:#8832B3:#CE9FE5)', 'Gradient(#768CF7:#3247B3:#9FABE5)', 'Gradient(#F77681:#B3323C:#E59FA5)'],
- jsonColorsAll = [],
- wykresWidth = 940,
- wykresMinItemWidth = 15,
- graphGutterLeft = 60,
- graphGutterRight = 25,
- itemsInLabelCount = 0,
- currentNode = _uiNode$GraphByMonth.children('canvas'),
- node = $('<canvas id="wykres04" width="1760" height="300">[No canvas support]</canvas>')
- ;
- {// replace node
- currentNode.replaceWith(node);
- }
- $.each(_state.months, function(monthIdx, vMonth) {
- var jsonByMonthData = {},
- byMonthDataValues = []
- ;
- $.each(_state.obroty, function(kYear, vSalesByMonth) {
- if (undefined === vSalesByMonth[vMonth]) {
- jsonByMonthData['' + kYear + '-' + vMonth] = 0;
- } else {
- jsonByMonthData['' + kYear + '-' + vMonth] = vSalesByMonth[vMonth];
- }
- });
- $.each(jsonByMonthData, function(kLabel, vValue) {
- jsonTooltips.push('Obrót ' + numeral(vValue).format('0,0[.]00') + ' w ' + kLabel);
- });
- byMonthDataValues = Object.keys(jsonByMonthData).map(function (key) {
- return jsonByMonthData[key];
- });
- jsonData.push(byMonthDataValues);
- itemsInLabelCount = Math.max(itemsInLabelCount, byMonthDataValues.length);
- });
- {// colors
- for (var i = 0, mi = 0, mc = jsonColors.length; i < 12; i++) {
- jsonColorsAll.push(jsonColors[mi]);
- if (++mi >= mc) {
- mi = 0;
- }
- }
- jsonColors = jsonColorsAll;
- }
- {// wykres width
- wykresTestWidth = jsonLabels.length * (20 * 2 + itemsInLabelCount * wykresMinItemWidth) + graphGutterLeft + graphGutterRight;
- wykresWidth = Math.max(wykresWidth, wykresTestWidth);
- jQuery('#wykres04').css({width: wykresWidth});
- }
- var bar = new RGraph.Bar('wykres04', jsonData)
- .Set('labels', jsonLabels)
- .Set('colors', jsonColors)
- .Set('strokestyle', 'white')
- .Set('linewidth', 1)
- .Set('shadow', true)
- .Set('shadow.color', '#ccc')
- .Set('shadow.offsetx', 0)
- .Set('shadow.offsety', 0)
- .Set('shadow.blur', 10)
- .Set('gutter.bottom', 30)
- .Set('gutter.left', graphGutterLeft)
- .Set('gutter.right', graphGutterRight)
- .Set('tooltips', RGraph.ISOLD ? null : jsonTooltips)
- .Set('tooltips.event', 'mousemove')
- .Set('labels.above', true)
- .Set('hmargin', 20)
- .Draw();
- };
- priv.renderHeaderMarki = function(record) {
- var currentNode = _uiNode$Marki.children('tbody').children('tr'),
- node = $('<tr></tr>'),
- marki = _state.marki
- ;
- $('<th>Marki:</th>').appendTo(node);
- $.each(_state.marki, function(markaLabel, markaClassName) {
- var td$Node = $('<td><b>' + markaLabel + '</b></td>').appendTo(node);
- td$Node.addClass('cell_marka_' + markaClassName);
- });
- currentNode.replaceWith(node);
- };
- priv.renderTableBody = function(record) {
- var currentNode = _uiNode$Table.children('tbody'),
- node = $('<tbody></tbody>'),
- vSalesByYear = _state.obroty
- ;
- $.each(_state.years, function(yearIdx, vYearId) {
- var vSalesByMonth = vSalesByYear[vYearId];
- var tr$Node = $('<tr></tr>').appendTo(node);
- $('<th>' + vYearId + '</th>').appendTo(tr$Node);
- var suma = 0;
- $.each(_state.months, function(monthsIdx, vMonth) {
- var td$Node = $('<td></td>').appendTo(tr$Node);
- td$Node.css({textAlign: 'right'});
- var saleValue = parseFloat(vSalesByMonth[vMonth]);
- //if (!vSalesByMonth.hasOwnProperty(vMonth)) {
- if (isNaN(saleValue)) {
- td$Node.text('...');
- td$Node.css({color: '#ddd'});
- } else {
- suma += saleValue;
- $('<nobr>' + numeral(saleValue).format('0,0[.]00') + '</nobr>').appendTo(td$Node);
- if (undefined !== _state.obrotyToMarki[vYearId][vMonth]) {
- var marka = _state.obrotyToMarki[vYearId][vMonth];
- td$Node.addClass('cell_marka_' + _state.marki[marka]);
- }
- }
- td$Node.on('dblclick', {year:vYearId, month:vMonth}, priv.cellDblClicked);
- });
- var suma$Node = $('<td>' + numeral(suma).format('0,0[.]00') + '</td>').appendTo(tr$Node);
- suma$Node.css({textAlign: 'right'});
- });
- currentNode.replaceWith(node);
- };
- priv.renderInitInlineEditBox = function() {
- var nodeClass = 'dealsSales__inlineEditBox',
- node;
- var node = $('<div class="' + nodeClass + ' modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>');
- var modalWrap = $('<div class="modal-dialog"></div>').appendTo(node);
- var modalWrap = $('<div class="modal-content"></div>').appendTo(modalWrap);
- var frmInlineEdit = $('<form style="margin:0;padding:0;"></form>').appendTo(modalWrap);
- var iebHead = $('<div class="modal-header">').appendTo(frmInlineEdit);
- $('<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i></button>').appendTo(iebHead);
- $('<h3 id="myModalLabel">Edytuj</h3>').appendTo(iebHead);
- var iebBodyWrap = $('<div class="modal-body" style="padding:0"></div>').appendTo(frmInlineEdit);
- var iebBody = $('<div style="padding:15px"></div>').appendTo(iebBodyWrap);
- //$('<input type="hidden" name="ID" value="">').appendTo(iebBody);
- //$('<input type="hidden" name="col" value="">').appendTo(iebBody);
- $('<div class="inlineEditBox-cnt"></div>').appendTo(iebBody);
- var iebFoot = $('<div class="modal-footer"></div>').appendTo(frmInlineEdit);
- $('<button class="btn" data-dismiss="modal" aria-hidden="true">Zamknij</button>').appendTo(iebFoot);
- var iebBtnSave = $('<input type="submit" value="Zapisz" class="btn btn-primary btn-save">').appendTo(iebFoot);
- frmInlineEdit.on('submit', function() {
- var data = _inlineEditBox$Node.find('form').serialize();
- _inlineEditBox$Node.find('.inlineEditBox-cnt').html('<span class="loading-info"> loading ...</span>');
- function notifyAjaxCallback(data) {
- var notify = {};
- notify.type = (data && data.type)? data.type : '';
- notify.msg = (data && data.msg)? data.msg : '';
- switch (notify.type) {
- case 'success':
- if (!notify.msg) notify.msg = 'Dane poprawnie zaktualizowane';
- break;
- case 'info':
- if (!notify.msg) notify.msg = 'Nie wprowadzono żadnych zmian';
- break;
- case 'error':
- if (!notify.msg) notify.msg = 'Wystąpiły błędy';
- break;
- case 'warning':
- notify.type = 'warn';
- if (!notify.msg) notify.msg = 'Wystąpiły błędy';
- break;
- default:
- notify.msg = 'Nieznany błąd';
- if (data && data.errorCode) notify.msg += ' ' + data.errorCode;
- notify.type = '';
- }
- jQuery.notify(notify.msg, notify.type);
- }
- $.ajax({
- data: data,
- dataType: 'json',
- type: "POST",
- url: priv.options.urlSaveInlineEdit
- })
- .done(function(data, textStatus, jqXHR){
- notifyAjaxCallback(data);
- if (data.record) {
- var year = data.record.SALES_YEAR,
- month = data.record.SALES_MONTH,
- status = data.record.A_STATUS,
- saleValue = parseFloat(data.record.SALES_VALUE),
- marka = data.record.marka,
- state = {}
- ;
- if (month < 10) month = '0' + month;
- // TODO: if marka changed - fix state
- if ('DELETED' === status) {
- state.obroty = {};
- state.obroty[year] = {};
- state.obroty[year][month] = null;
- state.obrotyToMarki = {};
- state.obrotyToMarki[year] = {};
- state.obrotyToMarki[year][month] = null;
- } else {
- state.obroty = {};
- state.obroty[year] = {};
- state.obroty[year][month] = saleValue;
- state.obrotyToMarki = {};
- state.obrotyToMarki[year] = {};
- state.obrotyToMarki[year][month] = marka;
- }
- priv.setState(state);
- }
- _inlineEditBox$Node.modal('hide');
- })
- .fail(function(jqXHR){// jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
- if (jqXHR.responseJSON) {
- notifyAjaxCallback(jqXHR.responseJSON);
- }
- else {
- var txt = jqXHR.responseText || 'Wystąpiły błędy';
- if (jqXHR.status == 404) {
- jQuery.notify(jqXHR.responseText, 'error');
- } else {
- jQuery.notify(jqXHR.responseText, 'warn');
- }
- }
- _inlineEditBox$Node.modal('hide');
- });
- return false;
- });
- node.appendTo(_uiNodeCont);//currentNode.replaceWith(node);
- _inlineEditBox$Node = node;
- };
- priv.cellDblClicked = function(e) {
- if ('year' in e.data && 'month' in e.data && e.data.year > 0 && e.data.month > 0) {
- _inlineEditBox$Node.modal();
- _inlineEditBox$Node.show();
- _inlineEditBox$Node.on('shown.bs.modal', function(e) {
- var dialogBox = jQuery(this).find('.modal-dialog'),
- modalBody = dialogBox.find('.modal-body'),
- boudingRect = dialogBox.get(0).getBoundingClientRect();
- dialogBox.css({position: 'absolute', margin:0, top: boudingRect.top, left: boudingRect.left});
- modalBody.css({overflow: 'scroll'});
- dialogBox.resizable({minHeight: 300, minWidth: 300, alsoResize: modalBody});
- dialogBox.draggable();
- });
- _inlineEditBox$Node.on('hidden.bs.modal', function(e) {
- var dialogBox = jQuery(this).find('.modal-dialog'),
- modalBody = dialogBox.find('.modal-body');
- dialogBox.removeAttr('style');
- modalBody.removeAttr('style');
- modalBody.css({padding: '0'});
- dialogBox.resizable();
- dialogBox.draggable();
- dialogBox.resizable('destroy');
- dialogBox.draggable('destroy');
- });
- _inlineEditBox$Node.find('input[name=ID]').val(e.data.id);
- _inlineEditBox$Node.find('input[name=col]').val(e.data.col);
- _inlineEditBox$Node.find('.inlineEditBox-cnt').html('<span class="loading-info"> loading ...</span>');
- $.ajax({
- url: priv.options.urlInlineEdit,
- type: 'GET',
- dataType: 'text',
- data: e.data,
- async: true,
- success: function (data) {
- _inlineEditBox$Node.find('.inlineEditBox-cnt').html(data);
- _inlineEditBox$Node.find('.btn-save').show();
- initDateTimePicker(_inlineEditBox$Node);
- _inlineEditBox$Node.find('textarea').autosize();
- var fld = _inlineEditBox$Node.find('input[id^="f"]:first');
- if (fld && !fld.hasClass('se_type-date')) {
- fld.focus();
- fld.keydown(function(event) {
- if (event.which == 13) {
- event.preventDefault();
- _inlineEditBox$Node.find('form').submit();
- }
- });
- }
- },
- error: function (err) {
- if (priv.options.debug) console.log('err');
- }
- });
- } else {
- if (priv.options.debug) console.log('NO data');
- return false;
- }
- };
- priv.onRender = function(e) {
- if (priv.options.debug) console.log('onRender.arguments:', arguments.length, arguments, 'e:', e);
- if (arguments.length > 1) {
- for (var i=1; i<arguments.length; i++) {
- switch (arguments[i]) {
- case 'body': priv.renderTableBody(); break;
- case 'marki': priv.renderHeaderMarki(); break;
- case 'graphs': priv.renderGraphByYear(); priv.renderGraphByMonth(); break;
- }
- }
- }
- };
- priv.setState = function(state) {
- var oldState = _state,// TODO: use to check what really changed (use extend!)
- renderParts = {};
- if (state.obroty) {
- $.each(state.obroty, function(kYear, vSalesByMonth) {
- $.each(vSalesByMonth, function(kMonth, vSaleValue) {
- if (null === vSaleValue) {
- _state.obroty[kYear][kMonth] = undefined;
- } else {
- _state.obroty[kYear][kMonth] = vSaleValue;
- }
- });
- });
- renderParts['body'] = true;
- renderParts['graphs'] = true;
- }
- /*
- state.obrotyToMarki[year][month] = marka;
- */
- if (state.obrotyToMarki) {
- $.each(state.obrotyToMarki, function(kYear, vMarkiByMonth) {
- $.each(vMarkiByMonth, function(kMonth, vMarka) {
- if (null === vMarka) {
- _state.obrotyToMarki[kYear][kMonth] = undefined;
- } else {
- _state.obrotyToMarki[kYear][kMonth] = vMarka;
- if (undefined === _state.marki[vMarka]) {
- _state.marki[vMarka] = 'default';
- }
- }
- });
- });
- renderParts['marki'] = true;
- }
- renderParts = Object.keys(renderParts);
- if (priv.options.debug) console.log('setState::renderParts: ', renderParts);//TODO:DBG:RMME
- if (renderParts.length > 0) {
- jQuery(_uiNodeCont).trigger('DealsSalesTable:render', renderParts);
- }
- };
- publ.init = function (options) {
- if (priv.options.debug) console.log('DealsSalesTable initialization...');
- //merge supplied options with defaults
- $.extend(priv.options, defaults, options);
- priv.init();
- return publ;
- };
- return publ;
- };
- $.fn.DealsSalesTable = function (options) {
- options = options || {};
- return this.each(function () {
- options.id = this;
- $(this).data('DealsSalesTable', new DealsSalesTable().init(options));
- });
- };
- })(jQuery);
- jQuery(document).ready(function() {
- jQuery('#dealsSalesByMonth').DealsSalesTable({
- url: 'index.php?_route=DealsSales&_task=getDataAjax&telbox=<?php echo $idTelboxes; ?>',
- urlInlineEdit: 'index.php?_route=DealsSales&_task=inlineEditAjax&telbox=<?php echo $idTelboxes; ?>',
- urlSaveInlineEdit: 'index.php?_route=DealsSales&_task=saveInlineAjax&telbox=<?php echo $idTelboxes; ?>',
- initData: <?php echo json_encode($initData); ?>
- });
- });
- </script>
- <script src="stuff/RGraph/libraries/RGraph.common.core.js?_v=20140626"></script>
- <script src="stuff/RGraph/libraries/RGraph.common.dynamic.js?_v=20140626"></script>
- <script src="stuff/RGraph/libraries/RGraph.common.key.js?_v=20140626"></script>
- <script src="stuff/RGraph/libraries/RGraph.drawing.rect.js?_v=20140626"></script>
- <script src="stuff/RGraph/libraries/RGraph.common.tooltips.js?_v=20140626"></script>
- <script src="stuff/RGraph/libraries/RGraph.bar.js?_v=20140626"></script>
- <script src="stuff/RGraph/libraries/RGraph.line.js?_v=20140626"></script>
- <?php endif; ?>
- </div>
- <?php
- }
- }
|