Skip to content

Commit 55faa1c

Browse files
committed
Merge branch 'main-front' for sync into main
* new styles and beutifully fo the frontend * implementation of the new api class, in almost all calls * fix some common styles.. (first try)
2 parents 9f9deb1 + b530ace commit 55faa1c

18 files changed

+499
-66
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.contain-converter{
2+
background-color: #f9faff;
3+
background-image: url('../media/falling-dollar-coins-success-luck-money-investment-concept_1262-13463__1_-removebg-preview.png');
4+
background-size: cover;
5+
background-repeat: no-repeat;
6+
/* background-position-y: 100vh; */
7+
}
Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
11
.links-menu{
2-
color: #3BD671 !important;
2+
color: white !important;
3+
font-weight: 700;
4+
5+
}
6+
/* #table_id_filter{
7+
display: none;
8+
} */
9+
#table_id_filter label input, #table_id2_filter label input{
10+
border: none;
11+
}
12+
#table_id_filter, #table_id2_filter{
13+
margin-bottom: 5px;
14+
background-color: white;
15+
border-radius: 15px;
16+
padding-left: 14px;
17+
border: solid 1px;
18+
}
19+
.current{
20+
position: relative;
21+
line-height: 1.25;
22+
background: #fff !important;
23+
border-radius: 24px !important;
24+
}
25+
#table_id2_info,#table_id_info{
26+
display: none;
27+
}
28+
#table_id,#table_id2{
29+
border-radius: 15px;
30+
background-color: white;
31+
-webkit-box-shadow: -1px 7px 5px -3px rgb(107 104 107 / 64%);
32+
-moz-box-shadow: -1px 7px 5px -3px rgba(107, 104, 107, 0.64);
33+
box-shadow: -1px 7px 5px -3px rgb(107 104 107 / 64%);
34+
}
35+
.even{
36+
border: 0px;
37+
}
38+
.dataTables_length{
39+
display: none;
340
}

cweb/elcurrencyfiles/css/login.css

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
.contain-fund{
2-
display: none;
3-
width: 0;
4-
}
51
.contain-login{
6-
height: 85vh !important;
2+
height: 100vh !important;
3+
background-image: url('../media/bitcoin-moneda-activo-financiero-inflacción.jpg');
4+
background-size: cover;
5+
background-repeat: no-repeat;
76
}
87
@media screen and (min-width:800px) {
98
.contain-login{
109
height: 100vh !important;
1110
}
12-
13-
.contain-fund{
14-
width: 50vw;
15-
height: 100%;
16-
background-color: #3BD671;
17-
border-radius: 0px 50% 8px 50%;
18-
}
1911
}
463 KB
Loading
175 KB
Loading

cweb/elcurrencyweb/controllers/Currency_Api.php

Lines changed: 209 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ function __construct()
2323

2424
/**
2525
* uri CALL to uptate the amount of a specific rate currency by code using api call
26+
* it will receive the user_id, cod_base, mon_rate currency and codkey as post parameters,
27+
* and later will return 1 when sucess and any other string when fails
2628
*
2729
* @access public
2830
* @param $codkey mixed and authentication string key to check api
@@ -78,12 +80,14 @@ public function updateRateAmount()
7880
}
7981

8082
/**
81-
* uri CALL to invoke the api and store the data into db
83+
* uri CALL to invoke the api and store the data into db,
84+
* it will receive the user_id and codkey as post parameters,
85+
* and later will return 1 when sucess and any other string when fails
8286
*
8387
* @access public
84-
* @param $codkey mixed and authentication string key to check api
88+
* @param $extradata mixed and authentication string key to check api
8589
*/
86-
public function callApisAndSaveDB($codkey = NULL)
90+
public function callApisAndSaveDB($extradata = NULL)
8791
{
8892

8993
$this->load->model('Currency_m','dbcm');
@@ -111,9 +115,6 @@ public function callApisAndSaveDB($codkey = NULL)
111115
return $error;
112116
}
113117

114-
$data = array();
115-
// example invokation http://localhost/~general/codeigniter-currencylib/cweb/index.php/Currency_Manager/callapitodb/SHAR265ql-23krjhnou2q34rhi2?dateapi=2023-02-03&curbase=USD
116-
// example shot base "index.php/Currency_Manager/callapitodb/SHAR265ql-23krjhnou2q34rhi2?dateapi=2023-02-03&curbase=USD"
117118
$currencyDate = $this->input->get_post('dateapi', FALSE);
118119
$currencyBase = $this->input->get_post('curbase', FALSE);
119120
$currencyDest = $this->input->get_post('curdest', FALSE);
@@ -157,7 +158,208 @@ public function callApisAndSaveDB($codkey = NULL)
157158
$currencyDate = date('Ymd',strtotime($currencyDate)).date('H');
158159
$createdbresult = $this->dbcm->createCurrencyFromApi($currency_list_apiarray, $currencyDate, $currencyBase);
159160
log_message('debug', __METHOD__ .' saved? : ' .print_r($createdbresult,TRUE). ' from parameter: '.print_r($currencyDate, TRUE));
160-
$result = json_encode(array('result'=>$createdbresult));
161+
$result = $createdbresult;
162+
163+
$data = array();
164+
$data['result'] = $createdbresult;
165+
$data['currency_list_apiarray'] = $currency_list_apiarray;
166+
$data['currenturl'] = $this->currenturl;
167+
log_message('debug', __METHOD__ .' saved? : ' .print_r($data,TRUE). ' from parameter: '.print_r($currencyDate, TRUE));
168+
$result = json_encode($data);
169+
echo $result;
170+
return $result;
171+
}
172+
173+
/**
174+
* uri CALL to read rates from db event call from an external api (if there is such rates already saved)
175+
* it will receive the user_id, currency base, mount currency and codkey as post parameters,
176+
* and later will return 1 when sucess and any other string when fails
177+
* the data when success will be in second string after the result
178+
*
179+
* @access public
180+
* @param $codkey mixed and authentication string key to check api
181+
*/
182+
public function callRatesFromDB($extradata = NULL)
183+
{
184+
185+
$this->load->model('Currency_m','dbcm');
186+
$this->load->library('Userlib');
187+
$this->load->library('form_validation');
188+
189+
$user_id = $this->input->get_post('user_id', FALSE);
190+
$codkey = $this->input->get_post('codkey', FALSE);
191+
$currencyBase = $this->input->get_post('curbase', FALSE);
192+
$currencyDest = $this->input->get_post('curdest', FALSE);
193+
$currencyDate = $this->input->get_post('dateapi', FALSE);
194+
195+
$validfields = $this->form_validation->required($user_id);
196+
$validfields = preg_match('/^[a-zA-Z0-9_\.]{1,}+$/i', $user_id);
197+
if($validfields == FALSE){
198+
log_message('error', __METHOD__ .' POST : ' . print_r($user_id, TRUE) . ' user_id is not valid : '.print_r($validfields, TRUE));
199+
$error = json_encode(array('result' =>'user_id is not valid'));
200+
echo $error;
201+
return $error;
202+
}
203+
204+
$validfields = $this->form_validation->required($codkey);
205+
$validfields = preg_match('/^[a-zA-Z0-9\.]{1,}+$/i', $codkey);
206+
if($validfields == FALSE){
207+
log_message('error', __METHOD__ .' POST : ' . print_r($codkey, TRUE) . ' codkey is not valid : '.print_r($validfields, TRUE));
208+
$error = json_encode(array('result' =>'codkey is not valid'));
209+
echo $error;
210+
return $error;
211+
}
212+
213+
$missdest = $this->form_validation->required($currencyDest);
214+
$validcurren = $this->form_validation->exact_length($currencyDest,3);
215+
$missdate = $this->form_validation->required($currencyDate);
216+
$validfields = $this->form_validation->exact_length($currencyDate,10);
217+
$missbase = $this->form_validation->required($currencyBase);
218+
$validfields = $this->form_validation->exact_length($currencyBase,3);
219+
220+
if($missdate == FALSE)
221+
$currencyDate = date('Y-m-d');
222+
if($missbase == FALSE)
223+
$currencyBase = 'USD';
224+
if($validfields == FALSE)
225+
$currencyBase = 'USD';
226+
if($validcurren == FALSE OR $missdest == FALSE)
227+
{
228+
log_message('info', __METHOD__ .' missing currency rates to convert, we will use all availables from api results ');
229+
$currencyDest = NULL;
230+
}
231+
232+
$this->userlib->initialize($user_id);
233+
$this->userlib->getID();
234+
235+
log_message('debug', __METHOD__ .' API already called, now try to retrieve the result from DB for : '.print_r($currencyDate, TRUE));
236+
$user_preferences = $this->userlib->getUser();
237+
$cur_monedas_base = $this->userlib->getBaseCurrency();
238+
$cur_monedas_dest = $this->userlib->getDestCurrency();
239+
$currency_list_dbarraynow = array();
240+
$currency_list_dbarraypre = array();
241+
// ver si id y status es valido ejemplo $this->userlib->isActive(); solo edita si esta activo
242+
$active = $this->userlib->isActive();
243+
if($active)
244+
{
245+
$currency_list_dbarraynow = $this->dbcm->readCurrenciesTodayStored($currencyDest,$currencyDate,$currencyBase);
246+
$currency_list_dbarraypre = $this->dbcm->readCurrenciesTodayStored($cur_monedas_dest,NULL,$cur_monedas_base);
247+
}
248+
$result = 0;
249+
if(is_array($currency_list_dbarraypre))
250+
{
251+
if(count($currency_list_dbarraypre) > 0 );
252+
$result = 1;
253+
}
254+
if(is_array($currency_list_dbarraynow))
255+
{
256+
if(count($currency_list_dbarraynow) > 0 );
257+
$result = 1;
258+
}
259+
$data = array();
260+
$data['result'] = $result;
261+
$data['currency_list_dbarraynow'] = $currency_list_dbarraynow;
262+
$data['currency_list_dbarraypre'] = $currency_list_dbarraypre;
263+
$data['currenturl'] = $this->currenturl;
264+
log_message('debug', __METHOD__ .' saved? : ' .print_r($data,TRUE). ' from parameter: '.print_r($currencyDate, TRUE));
265+
$result = json_encode($data);
266+
echo $result;
267+
return $result;
268+
}
269+
270+
/**
271+
* uri CALL to convert one currency to another currency TODO
272+
* it will receive the user_id, currency base/dest, mount currency and codkey as post parameters,
273+
* and later will return 1 when sucess and any other string when fails
274+
* the data when success will be in second string after the result
275+
*
276+
* @access public
277+
* @param $codkey mixed and authentication string key to check api
278+
*/
279+
public function convertCurrency($extradata = NULL)
280+
{
281+
282+
$this->load->model('Currency_m','dbcm');
283+
$this->load->library('Userlib');
284+
$this->load->library('form_validation');
285+
286+
$user_id = $this->input->get_post('user_id', FALSE);
287+
$codkey = $this->input->get_post('codkey', FALSE);
288+
$currencyBase = $this->input->get_post('curbase', FALSE);
289+
$currencyDest = $this->input->get_post('curdest', FALSE);
290+
$currencyDate = $this->input->get_post('dateapi', FALSE);
291+
$currencyMont = $this->input->get_post('curmont', FALSE);
292+
293+
$validfields = $this->form_validation->required($user_id);
294+
$validfields = preg_match('/^[a-zA-Z0-9_\.]{1,}+$/i', $user_id);
295+
if($validfields == FALSE){
296+
log_message('error', __METHOD__ .' POST : ' . print_r($user_id, TRUE) . ' user_id is not valid : '.print_r($validfields, TRUE));
297+
$error = json_encode(array('result' =>'user_id is not valid'));
298+
echo $error;
299+
return $error;
300+
}
301+
302+
$validfields = $this->form_validation->required($codkey);
303+
$validfields = preg_match('/^[a-zA-Z0-9\.]{1,}+$/i', $codkey);
304+
if($validfields == FALSE){
305+
log_message('error', __METHOD__ .' POST : ' . print_r($codkey, TRUE) . ' codkey is not valid : '.print_r($validfields, TRUE));
306+
$error = json_encode(array('result' =>'codkey is not valid'));
307+
echo $error;
308+
return $error;
309+
}
310+
311+
$missdest = $this->form_validation->required($currencyDest);
312+
$validcurren = $this->form_validation->exact_length($currencyDest,3);
313+
$missdate = $this->form_validation->required($currencyDate);
314+
$validfields = $this->form_validation->exact_length($currencyDate,10);
315+
$missbase = $this->form_validation->required($currencyBase);
316+
$validfields = $this->form_validation->exact_length($currencyBase,3);
317+
318+
if($missdate == FALSE)
319+
$currencyDate = date('Y-m-d');
320+
if($missbase == FALSE)
321+
$currencyBase = 'USD';
322+
if($validfields == FALSE)
323+
$currencyBase = 'USD';
324+
if($validcurren == FALSE OR $missdest == FALSE)
325+
{
326+
log_message('info', __METHOD__ .' missing currency rates to convert, we will use all availables from api results ');
327+
$currencyDest = NULL;
328+
}
329+
330+
$this->userlib->initialize($user_id);
331+
$this->userlib->getID();
332+
333+
log_message('debug', __METHOD__ .' API already called, now try to retrieve the result from DB for : '.print_r($currencyDate, TRUE));
334+
$user_preferences = $this->userlib->getUser();
335+
$cur_monedas_base = $this->userlib->getBaseCurrency();
336+
$cur_monedas_dest = $this->userlib->getDestCurrency();
337+
$currency_list_dbarraynow = array();
338+
$currency_list_dbarraypre = array();
339+
// ver si id y status es valido ejemplo $this->userlib->isActive(); solo edita si esta activo
340+
$active = $this->userlib->isActive();
341+
if($active)
342+
{
343+
$currency_list_dbarraynow = $this->dbcm->readCurrenciesTodayStored($currencyDest,$currencyDate,$currencyBase);
344+
$currency_list_dbarraypre = $this->dbcm->readCurrenciesTodayStored($cur_monedas_dest,NULL,$cur_monedas_base);
345+
}
346+
$result = 0;
347+
if(is_array($currency_list_dbarraypre))
348+
{
349+
if(count($currency_list_dbarraypre) > 0 );
350+
$result = 1;
351+
}
352+
if(is_array($currency_list_dbarraynow))
353+
{
354+
if(count($currency_list_dbarraynow) > 0 );
355+
$result = 1;
356+
}
357+
$data = array();
358+
$data['result'] = $result;
359+
$data['currency_mont'] = '30.90';
360+
$data['currenturl'] = $this->currenturl;
361+
log_message('debug', __METHOD__ .' saved? : ' .print_r($data,TRUE). ' from parameter: '.print_r($currencyDate, TRUE));
362+
$result = json_encode($data);
161363
echo $result;
162364
return $result;
163365
}

cweb/elcurrencyweb/controllers/Currency_Converter.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function __construct()
2424
}
2525

2626
/**
27-
* index that shows the presentation, or login
28-
*
27+
* index that shows the presentation, or login
28+
*
2929
* @name: index
3030
* @param void
3131
* @return void
@@ -37,12 +37,16 @@ public function index()
3737
$data['currentctr'] = $this->currentctr;
3838
$data['currentinx'] = $this->currentinx;
3939
$data['currenturl'] = $this->currenturl;
40+
$this->load->model('Currency_m','dbcm');
41+
$cod_currency_base_array = $this->dbcm->readCurrencyNames();
42+
$exx = array('840'=>'VES','971'=>'USD');
43+
$data['cod_base_currency_array'] = $exx;
44+
$data['cod_base_currency'] = 'VES';
4045
$this->load->view('header',$data);
4146
$this->load->view('menu',$data);
4247
$this->load->view('converter',$data);
4348
$this->load->view('footer',$data);
4449
}
45-
4650
}
4751

4852
/* End of file Home.php */

cweb/elcurrencyweb/controllers/Currency_History.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ public function listcurrencies($id = NULL)
115115
$this->load->view('header.php',$data);
116116
$this->load->view('menu',$data);
117117
$this->load->view('history',$data);
118-
$this->load->view('footer',$data);
118+
// $this->load->view('footer',$data);
119+
$this->load->view('footer_internal',$data);
120+
119121

120122
}
121123

cweb/elcurrencyweb/controllers/Currency_Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function listTodayCurrencies()
7676
$this->load->view('header',$data);
7777
$this->load->view('menu',$data);
7878
$this->load->view('currency',$data);
79-
$this->load->view('footer',$data);
79+
$this->load->view('footer_internal',$data);
8080
}
8181

8282
}

cweb/elcurrencyweb/controllers/Currency_Users.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public function listusers()
5050
$this->load->view('header',$data);
5151
$this->load->view('menu');
5252
$this->load->view('empty',$data);
53-
$this->load->view('footer',$data);
53+
// $this->load->view('footer',$data);
54+
$this->load->view('footer_internal',$data);
55+
5456
}
5557
}
5658

0 commit comments

Comments
 (0)