diff --git a/wrenchboard/src/include/sel_data.h b/wrenchboard/src/include/sel_data.h new file mode 100644 index 00000000..9538f571 --- /dev/null +++ b/wrenchboard/src/include/sel_data.h @@ -0,0 +1,16 @@ +#ifndef __mx_sel_data_h__ +#define __mx_sel_data_h__ + +#include "vars.h" + +long getJobPriceCombo( CVars in, CVars &out ); +long getJobPostDuration( CVars in, CVars &out ); +long getUserRecipientCombo( CVars in, CVars &out ); +long getAccountTypeCombo( CVars in, CVars &out ); +long getGeneralSkillCombo( CVars in, CVars &out ); +long getUserNewSkillCombo( CVars in, CVars &out ); +long getCountryCombo( CVars in, CVars &out ); +long getCountryJobCombo( CVars in, CVars &out ); +long getBankCombo( CVars in, CVars &out ); + +#endif \ No newline at end of file diff --git a/wrenchboard/src/include/wrenchboard_api.h b/wrenchboard/src/include/wrenchboard_api.h index b9040b89..4924aea4 100644 --- a/wrenchboard/src/include/wrenchboard_api.h +++ b/wrenchboard/src/include/wrenchboard_api.h @@ -197,6 +197,13 @@ enum { PARTNER_STRIPE }; #define WRENCHBOARD_ACCOUNT_COMPLETE_TOPUP 11063 +#define WRENCHBOARD_ACCOUNT_PRICE_COMBO 11171 +#define WRENCHBOARD_ACCOUNT_JOBPOST_DURATION 11173 +#define WRENCHBOARD_ACCOUNT_USER_RECIPEINT 11175 +#define WRENCHBOARD_ACCOUNT_ACCOUNT_TYPES 11177 +#define WRENCHBOARD_ACCOUNT_COUNTRY_COMBO 11179 +#define WRENCHBOARD_ACCOUNT_JOB_COUNTRY 11181 + #define WRENCHBOARD_USER_DELETEACC 11990 #define WRENCHBOARD_ACCOUNT_END 11999 diff --git a/wrenchboard/src/shared_tool/account.cc b/wrenchboard/src/shared_tool/account.cc index cce2888d..d39497b4 100644 --- a/wrenchboard/src/shared_tool/account.cc +++ b/wrenchboard/src/shared_tool/account.cc @@ -16,6 +16,8 @@ #include "creditcards.h" #include "payments.h" +#include "sel_data.h" + #include "jobs.h" #define CREATE_BY_EMAIL 1000 @@ -400,6 +402,30 @@ long account_calls(CVars in, CVars &out) { */ break; + case WRENCHBOARD_ACCOUNT_PRICE_COMBO: + return getJobPriceCombo(in, out); + break; + + case WRENCHBOARD_ACCOUNT_JOBPOST_DURATION: + return getJobPostDuration(in, out); + break; + + case WRENCHBOARD_ACCOUNT_USER_RECIPEINT: + return getUserRecipientCombo(in, out); + break; + + case WRENCHBOARD_ACCOUNT_ACCOUNT_TYPES: + return getAccountTypeCombo(in, out); + break; + + case WRENCHBOARD_ACCOUNT_COUNTRY_COMBO: + return getCountryCombo(in, out); + break; + + case WRENCHBOARD_ACCOUNT_JOB_COUNTRY: + return getCountryJobCombo(in, out); + break; + } logfmt(logINFO, "/account_calls()"); return ret; diff --git a/wrenchboard/src/shared_tool/history.cc b/wrenchboard/src/shared_tool/history.cc index e50c8e65..8925cbc3 100644 --- a/wrenchboard/src/shared_tool/history.cc +++ b/wrenchboard/src/shared_tool/history.cc @@ -1,5 +1,5 @@ -// Account management toosl +// History Listing #include "clog.h" #include "cgi.h" #include "input.h" diff --git a/wrenchboard/src/shared_tool/sel_data.cc b/wrenchboard/src/shared_tool/sel_data.cc new file mode 100644 index 00000000..64e6a004 --- /dev/null +++ b/wrenchboard/src/shared_tool/sel_data.cc @@ -0,0 +1,207 @@ +// Combo Data +#include "clog.h" +#include "cgi.h" +#include "input.h" +#include "wrenchboard_api.h" +#include "sel_data.h" +#include "email.h" +#include "payments.h" +#include "safestring.h" +#include +#include "pgsql.h" +#include "pgsql_wrapper.h" +#include "cfg.h" +#include + + +public function getJobPriceCombo( CVars in, CVars &out ) +{ + +/* $this->defaultComboMessage ='Select Price...'; + $cmbstr =""; + for ($i = 2000; $i <= 10000; $i = $i + 1000) { + // $amountArray[] = [$i,$i,'Naira']; + $selV = ''; + if ($curVal == $i) { + $selV = " selected "; + } + $cmbstr .= ""; + } +*/ + return 0; +} + +long getJobPostDuration( CVars in, CVars &out ) +{ +/* + $this->defaultComboMessage ='Select duration of post'; + $cmbstr =""; + for ($ii = 2; $ii <= 10; $ii++) { + + $cmbstr .= ""; + } + + for ($ii = 2; $ii <= 5; $ii++) { + $days_c = $ii*7; + $cmbstr .= ""; + } + */ + return 0; +} + +long getUserJobGroupCombo( CVars in, CVars &out ) +{ + /* + // $sql = "SELECT id,group_name FROM members_job_group WHERE member_id = $member_id AND status = 1 ORDER BY group_name ASC "; + $sql = "SELECT m.id,m.group_name, m.group_name||' ['||count(g.group_id)||' members]' AS member_group_count " + . "FROM members_job_group m " + . "LEFT JOIN members_job_groupmember g ON g.group_id = m.id " + . "WHERE m.member_id = $member_id " + . "AND m.status = 1 GROUP BY m.id,m.group_name ORDER BY m.group_name ASC"; + + $q = $this->db->query($sql); + $option_value = $this->optionValueObject($q->result(), "id", "member_group_count", $curVal); + */ + return 0; +} + +long getUserRecipientCombo( CVars in, CVars &out ){ + + char vname[30]; + long ret = PHP_API_BAD_PARAM; + + logfmt( logINFO, "getUserRecipientCombo()" ); + out["result"] = "Yes i go to this back end"; + + try { + long member_id = REQ_LONG( in, "member_id", 1, -1 ); + long limit = REQ_LONG( in, "limit", 1, -1 ); + REQ_LONG( in, "page", 1, -1 ); + REQ_STRING (in, "uid", 10, 100, "(.*)"); + + out["total_record"] = "0"; + const PGresult *res; + res = pgsql_query("SELECT b.id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient, b.account_no,b.country " + "FROM sendmoney_recipient b " + "LEFT JOIN bank_entity_codes k ON k.code=b.bank_code " + "WHERE b.member_id = %lu AND b.status=1",member_id); + + if (res != NULL && pgsql_num_rows(res) > 0) { + out["total_record"] = pgsql_num_rows(res); + + for (int i = 0, n = pgsql_num_rows(res); i < n; i++) { + mapf = pgsql_fetch_assoc(res, i); + if (f.empty()) continue; + CVars rec; + map_to_cvars(f, rec); + + snprintf(vname, sizeof (vname), "recipient_%05d", i); + out[vname] = rec["recipient"]; + + snprintf(vname, sizeof (vname), "id_%05d", i); + out[vname] = rec["id"]; + + snprintf(vname, sizeof (vname), "uid_%05d", i); + out[vname] = rec["uid"]; + + snprintf(vname, sizeof (vname), "account_no_%05d", i); + out[vname] = rec["account_no"]; + + snprintf(vname, sizeof (vname), "country_%05d", i); + out[vname] = rec["country"]; + } + } + ret = PHP_API_OK; + out["status"] = "OK"; + } catch (bad_parameter) { + logfmt(logINFO, "ERROR CALL long getUserRecipientCombo(CVars in, CVars &out)"); + } + + logfmt( logINFO, "/getUserRecipientCombo()" ); + return ret; +} + +long getAccountTypeCombo( CVars in, CVars &out ) { +/* $q = $this + ->db + ->where('status', 1) + ->order_by('type_name', 'ASC') + ->get('account_types'); + + $option_value = $this->optionValueObject($q->result(), "type_value", "type_name", $curVal); +*/ + return 0; +} + +long getGeneralSkillCombo( CVars in, CVars &out ) { +/* $this->showDefaultSelect = false; + $q = $this + ->db + ->where('status', 1) + ->order_by('lorder', 'DESC') + ->get('skill_category'); + $option_value = $this->optionValueObject($q->result(), "id", "category", $curVal); +*/ + return 0; +} + +long getUserNewSkillCombo( CVars in, CVars &out ) { +/* $q = $this + ->db + ->where('status', 1) + ->where('category_id', $category_id) + ->order_by('lorder', 'DESC') + ->get('skill_types'); + $option_value = $this->optionValueObject($q->result(), "id", "skill", $curVal); +*/ + return 0; +} + +long getCountryCombo( CVars in, CVars &out ) { +/* $q = $this + ->db + ->where('status', 1) + ->order_by('country', 'ASC') + ->get('country'); + + $option_value = $this->optionValueObject($q->result(), "code", "country", $curVal); +*/ + return 0; +} + +long getCountryJobCombo( CVars in, CVars &out ) { + /* $q = $this + ->db + ->where('status', 1) + ->where('jobs is NOT NULL', NULL, FALSE) + ->order_by('country', 'ASC') + ->get('country'); + + $option_value = $this->optionValueObject($q->result(), "code", "country", $curVal); +*/ + return 0; +} + +long getBankCombo( CVars in, CVars &out ) { + /* + wrenchboard=> Select code,name from bank_entity_codes WHERE country ='NG' ORDER BY name ASC; + code | name + ------+------------------------------------------------ + 044 | Access Bank + 014 | Afri Bank + 023 | Citi Bank + 063 | Diamond Bank + 050 | Ecobank + 040 | Equitorial Trust Bank + */ + + /* $q = $this + ->db + ->where('status', 1) + ->order_by('name', 'ASC') + ->get('bank_entity_codes'); + + $option_value = $this->optionValueObject($q->result(), "code", "name", $curVal); +*/ + return 0; +}