Pman
authorjohn <john@roojs.com>
Mon, 13 Nov 2017 04:59:25 +0000 (12:59 +0800)
committerjohn <john@roojs.com>
Mon, 13 Nov 2017 04:59:25 +0000 (12:59 +0800)
159 files changed:
Pman/Admin [new symlink]
Pman/BAdmin [new symlink]
Pman/Coba/.Schema.php.swp [new file with mode: 0644]
Pman/Coba/ApplicationSummary.php [new file with mode: 0644]
Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.bjs [new file with mode: 0644]
Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.js [new file with mode: 0644]
Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.bjs [new file with mode: 0644]
Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.js [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_address.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_application_signup.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_company.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_country.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_declarations.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_investor_declarations.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_investor_lexis_results.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_investor_notes.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_investor_relation.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_person.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_person_investor_profile.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_person_notes.php [new file with mode: 0644]
Pman/Coba/DataObjects/Coba_state.php [new file with mode: 0644]
Pman/Coba/DataObjects/Ext_data.php [new file with mode: 0644]
Pman/Coba/DataObjects/I18n.php [new file with mode: 0644]
Pman/Coba/DataObjects/Images.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_accountmgmts.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_accounts.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_backend_notifications.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_country.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_documents.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_frontend_notifications.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_session.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_site_content.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_state.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_user_attributes.php [new file with mode: 0644]
Pman/Coba/DataObjects/Modx_users.php [new file with mode: 0644]
Pman/Coba/DataObjects/placeholder.txt [new file with mode: 0644]
Pman/Coba/DataObjects/pman.links.ini [new file with mode: 0644]
Pman/Coba/Import/Investors.php [new file with mode: 0644]
Pman/Coba/LexisNexis/Base.php [new file with mode: 0644]
Pman/Coba/LexisNexis/Search.php [new file with mode: 0644]
Pman/Coba/ModxSession.php [new file with mode: 0644]
Pman/Coba/Passport/Dump.php [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaFundManagerEdit.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaFundManagerEdit.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorCreate.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorCreate.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorImport.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorImport.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorModify.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorModify.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorSearch.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorSearch.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaLexisNexisReject.bjs [new file with mode: 0644]
Pman/Coba/Pman.Dialog.CobaLexisNexisReject.js [new file with mode: 0644]
Pman/Coba/Pman.Dialog.FundManagerEdit.bjs [new file with mode: 0644]
Pman/Coba/Pman.Tab.Coba.bjs [new file with mode: 0644]
Pman/Coba/Pman.Tab.Coba.js [new file with mode: 0644]
Pman/Coba/Pman.Tab.CobaFundManager.bjs [new file with mode: 0644]
Pman/Coba/Pman.Tab.CobaFundManager.js [new file with mode: 0644]
Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.bjs [new file with mode: 0644]
Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.js [new file with mode: 0644]
Pman/Coba/Pman.Tab.CobaInvestors.bjs [new file with mode: 0644]
Pman/Coba/Pman.Tab.CobaInvestors.js [new file with mode: 0644]
Pman/Coba/Reports/ApplicationSummary.php [new file with mode: 0644]
Pman/Coba/Reports/ClientSummary.php [new file with mode: 0644]
Pman/Coba/Reports/ComplianceReport.php [new file with mode: 0644]
Pman/Coba/Reports/InvestorRiskProfile.php [new file with mode: 0644]
Pman/Coba/Reports/LexisNexis.php [new file with mode: 0644]
Pman/Coba/Reports/LexisNexisDetail.php [new file with mode: 0644]
Pman/Coba/Reports/ReportShare.php [new file with mode: 0644]
Pman/Coba/Reports/Summary.php [new file with mode: 0644]
Pman/Coba/Schema.php [new file with mode: 0644]
Pman/Coba/UpdateDatabase.php [new file with mode: 0644]
Pman/Coba/UploadDocument.php [new file with mode: 0644]
Pman/Coba/coba.css [new file with mode: 0644]
Pman/Coba/investorLoginCheck.php [new file with mode: 0644]
Pman/Coba/is_bootstrap [new file with mode: 0644]
Pman/Coba/sql/README.txt [new file with mode: 0644]
Pman/Coba/sql/coba_address.sql [new file with mode: 0644]
Pman/Coba/sql/coba_application_signup.sql [new file with mode: 0644]
Pman/Coba/sql/coba_company.sql [new file with mode: 0644]
Pman/Coba/sql/coba_country.sql [new file with mode: 0644]
Pman/Coba/sql/coba_declarations.sql [new file with mode: 0644]
Pman/Coba/sql/coba_investor_lexis_results.sql [new file with mode: 0644]
Pman/Coba/sql/coba_investor_notes.sql [new file with mode: 0644]
Pman/Coba/sql/coba_investor_relation.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_investor_profile.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_notes.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_advisor.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_asset.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_child.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_insurance.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_liability.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_pension.sql [new file with mode: 0644]
Pman/Coba/sql/coba_person_risk_property.sql [new file with mode: 0644]
Pman/Coba/sql/coba_state.sql [new file with mode: 0644]
Pman/Coba/sql/coba_user_declarations.sql [new file with mode: 0644]
Pman/Coba/sql/events.sql [new file with mode: 0644]
Pman/Coba/sql/ext_data.sql [new file with mode: 0644]
Pman/Coba/sql/modx_accountmgmts.sql [new file with mode: 0644]
Pman/Coba/sql/modx_site_content.sql [new file with mode: 0644]
Pman/Coba/sql/modx_users.sql [new file with mode: 0644]
Pman/Coba/templates/Pman.Tab.Coba.html [new file with mode: 0644]
Pman/Coba/templates/Pman.Tab.CobaFundManager.html [new file with mode: 0644]
Pman/Coba/templates/Pman.Tab.CobaInvestors.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-corporate.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-individual.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-joint.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-master-footer.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-master-head.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-master-simple.html [new file with mode: 0644]
Pman/Coba/templates/application-summary-master.html [new file with mode: 0644]
Pman/Coba/templates/application_summary.html [new file with mode: 0644]
Pman/Coba/templates/capital_company/report-footer.html [new file with mode: 0644]
Pman/Coba/templates/capital_company/report-header.html [new file with mode: 0644]
Pman/Coba/templates/client-summary-corporate.html [new file with mode: 0644]
Pman/Coba/templates/client-summary-individual.html [new file with mode: 0644]
Pman/Coba/templates/client-summary-joint.html [new file with mode: 0644]
Pman/Coba/templates/compliance-individual.html [new file with mode: 0644]
Pman/Coba/templates/compliance-report-corporate.html [new file with mode: 0644]
Pman/Coba/templates/compliance-report-individual.html [new file with mode: 0644]
Pman/Coba/templates/compliance-report-joint.html [new file with mode: 0644]
Pman/Coba/templates/css/lexis-nexis.css [new file with mode: 0644]
Pman/Coba/templates/css/report.css [new file with mode: 0644]
Pman/Coba/templates/investor-risk-profile-corporate.html [new file with mode: 0644]
Pman/Coba/templates/investor-risk-profile-individual.html [new file with mode: 0644]
Pman/Coba/templates/investor-risk-profile-joint.html [new file with mode: 0644]
Pman/Coba/templates/investor-risk-profile-score.html [new file with mode: 0644]
Pman/Coba/templates/investor-risk-profile-types.html [new file with mode: 0644]
Pman/Coba/templates/js/lexis-nexis.js [new file with mode: 0644]
Pman/Coba/templates/lexis-nexis-detail.html [new file with mode: 0644]
Pman/Coba/templates/lexis-nexis-master.html [new file with mode: 0644]
Pman/Coba/templates/lexis-nexis.html [new file with mode: 0644]
Pman/Coba/templates/veridate/report-footer.html [new file with mode: 0644]
Pman/Coba/templates/veridate/report-header.html [new file with mode: 0644]
Pman/Core [new symlink]
Pman/GnumericToExcel.php [new symlink]
Pman/I18n.php [new symlink]
Pman/Images.php [new symlink]
Pman/Login.php [new symlink]
Pman/Roo.php [new symlink]

diff --git a/Pman/Admin b/Pman/Admin
new file mode 120000 (symlink)
index 0000000..a09cc8b
--- /dev/null
@@ -0,0 +1 @@
+../Pman.Admin
\ No newline at end of file
diff --git a/Pman/BAdmin b/Pman/BAdmin
new file mode 120000 (symlink)
index 0000000..51e26da
--- /dev/null
@@ -0,0 +1 @@
+../Pman.BAdmin
\ No newline at end of file
diff --git a/Pman/Coba/.Schema.php.swp b/Pman/Coba/.Schema.php.swp
new file mode 100644 (file)
index 0000000..3f8bb12
Binary files /dev/null and b/Pman/Coba/.Schema.php.swp differ
diff --git a/Pman/Coba/ApplicationSummary.php b/Pman/Coba/ApplicationSummary.php
new file mode 100644 (file)
index 0000000..9e1f659
--- /dev/null
@@ -0,0 +1,405 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Coba_ApplicationSummary extends Pman
+{
+
+    var $masterTemplate = "application-summary-master.html";
+    var $tempalte = "individual.html";
+    var $client_css;
+
+    var $summary;
+    var $declarations;
+    var $documents;
+
+    var $modx_user_id;
+    var $dependentRow;
+    var $report_date;
+    var $user_name;
+    var $name_advisor;
+    var $data_director;
+    var $data_individual_shareholder;
+    var $data_company_shareholder;
+    var $ref_code;
+
+    //schema buffer for matching the data with shareholder of shareholder
+    var $schema_data_individual;
+    var $schema_data_company;
+
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {
+        // ------load data for template-------
+        //phpinfo();
+        require_once 'Pman/Coba/Schema.php';
+        //load ext_data
+        $temp = PDO_DataObject::factory('ext_data');
+        $temp->autoJoin();
+        $temp->get('userdata_id',$userdata_id);
+        $this->ext_data = $temp->toArray();
+        //var_dump($this->ext_data);exit;
+        $account_type = $this->ext_data['account_type'];
+        $x = new Pman_Coba_Schema();
+        $this->summary = $x->modifySummary($this->ext_data);
+        //print_r($this->ext_data);exit;
+        $this->name_advisor = $this->ext_data['investment_advisor_id_firstname']." ".$this->ext_data['investment_advisor_id_lastname'];
+        //var_dump($this->name_advisor);exit;
+        //switch template && init name for diff account type
+        switch ($account_type) {
+            case 'individual':
+                $account_type_for_declaration = 'I';
+                $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                break;
+            case 'joint':
+                $account_type_for_declaration = 'J';
+                $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                break;
+            case 'corporate':
+                $account_type_for_declaration = 'C';
+                $this->user_name = $this->ext_data['company_name'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                $this->modx_user_id = $userdata_id;
+                break;
+            default:
+                $account_type_for_declaration = 'I';
+                $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                break;
+        }
+        //init ref code
+        $ff = HTML_FlexyFramework2::get();
+        $this->ref_code = $ff->Coba['default_fund']."-".$userdata_id;
+
+        //load declaration
+        $y = PDO_DataObject::factory('coba_declarations');
+        $t = PDO_DataObject::factory('coba_investor_declarations');
+        $t->set
+              (
+                  [
+                      'user_id' => $userdata_id
+                  ]
+              );
+        $y->joinAdd($t);
+        $y->set
+              (
+                  [
+                      'dec_type' => 'declaration',
+                      'used_by' => $account_type_for_declaration
+                  ]
+              );
+        $this->declarations = $y->fetchAll();
+        //var_dump($this->declarations);
+
+        //load document
+        $z = PDO_DataObject::factory('coba_declarations');
+        $z->set
+              (
+                  [
+                      'user_id' => $userdata_id
+                  ]
+              );
+        $u = PDO_DataObject::factory('coba_investor_declarations');
+        $z->joinAdd($u);
+        $z->set
+              (
+                  [
+                      'dec_type' => 'checklist',
+                      'used_by' => $account_type_for_declaration
+                  ]
+              );
+        $this->documents = $z->fetchAll();
+        $this->report_date = date('F j, Y, h:i A');
+
+
+
+        $ff = HTML_FlexyFramework2::get();
+    }
+
+    //check the field dependency
+    function checkDependency($row)
+    {
+        if ($row['being_dependent'] == 'Y') {
+            //buffering the data for dependency checking
+            $this->dependentRow[$row['Section']][$row['Data Table']][$row['column_name']]
+                = $row['data']; //dependentRow[section][data table][column_name] = data
+
+            //checking for check_box hide or show property when the box if checked
+            if ($row['if_checked'] == 'show') {
+                if (!$row['data']) {
+                    return FALSE;
+                }
+            } else {
+                if($row['data']) {
+                    return FALSE;
+                }
+            }
+        }
+
+        //checking the data with the corresponding dependent row in the buffer
+        if (!empty($row['dependent_column_name'])) {
+            if ($row['dependent_val']
+                    == $this->dependentRow[$row['Section']][$row['dependent_table']][$row['dependent_column_name']]) {
+                return TRUE;
+            } else {
+                return FALSE;
+            }
+        } else {
+            return TRUE;
+        }
+    }
+
+    //------check specific section for corporate------
+    function is_director_section($sectionKey)
+    {
+        if ($sectionKey == "Directors") {
+            $x = PDO_DataObject::factory('coba_investor_relation');
+            $x->autoJoin();
+            $x->_join .= "
+              LEFT JOIN
+                  coba_address
+              ON
+                  coba_address.id = join_coba_person_id_id.coba_address_id
+            ";
+            $address = DB_DataObject::factory('coba_address');
+            $x->selectAs($address, 'coba_address_id_%s');
+
+            $x->set(array(
+                'relation' => 'DIRECTOR',
+                'modx_user_id' => $this->modx_user_id
+            ));
+
+            $this->data_director = $x->fetchAll();
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function is_individual_shareholder($sectionKey)
+    {
+        if ($sectionKey == 'KYC: Shareholders: Individual') {
+            $x = PDO_DataObject::factory('coba_investor_relation');
+            $x->autoJoin();
+            $x->_join .= "
+              LEFT JOIN
+                  coba_address
+              ON
+                  coba_address.id = join_coba_person_id_id.coba_address_id
+            ";
+            $address = DB_DataObject::factory('coba_address');
+            $x->selectAs($address, 'coba_address_id_%s');
+
+            $x->set(array(
+                'relation' => 'SHAREHOLDER',
+                'modx_user_id' => $this->modx_user_id,
+                'coba_company_id' => '0'
+            ));
+
+            $this->data_individual_shareholder = $x->fetchAll();
+
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function is_company_shareholder($sectionKey)
+    {
+        if ($sectionKey == 'KYC: Shareholders: Company') {
+            $x = PDO_DataObject::factory('coba_investor_relation');
+            $x->autoJoin();
+            $x->_join .= "
+              LEFT JOIN
+                  coba_address
+              ON
+                  coba_address.id = join_coba_company_id_id.coba_address_id
+            ";
+
+            $address = DB_DataObject::factory('coba_address');
+            $x->selectAs($address, 'coba_address_id_%s');
+            $x->set(array(
+                'relation' => 'SHAREHOLDER',
+                'modx_user_id' => $this->modx_user_id,
+                'coba_person_id' => '0',
+                'parent_company_id' => '0'
+            ));
+            $this->data_company_shareholder = $x->fetchAll();
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    //------saving buffer for specific section------
+    function save_buffer_for_individual_shareholder($row)
+    {
+        if (!isset($this->schema_data_individual)) {
+            $this->schema_data_individual = $row;
+        }
+    }
+
+    function save_buffer_for_company_shareholder($row)
+    {
+        if (!isset($this->schema_data_company)) {
+            $this->schema_data_company = $row;
+        }
+    }
+
+    function print_label_and_data($client_data,$row,$tab_num)
+    {
+        $field_name = $row['Data Table']."_id_".$row['column_name'];
+        //var_dump($client_data);
+        $row['data'] = $client_data->$field_name;
+        if ($this->checkDependency($row)) {
+            echo "
+                <tr class='app-sum-body-indi-data-row'>
+                    <td class='col-md-6 app-sum-body-indi-data'>
+                    {$this->tabbing($tab_num)}
+                    {$row['Label']}
+                    </td>
+                    <td class='col-md-6 app-sum-body-indi-data'>
+                 ";
+            $this->outputQuestionByType($row);
+            echo "</td></tr>";
+        }
+    }
+
+    //output question from each section && switch the output for different questions' type
+    function outputQuestionByType($row)
+    {
+        switch ($row['type']) {
+        case 'checkbox':
+            if ($row['data']){
+                echo "<span class='glyphicon glyphicon-check app-sum-icon'></span>";
+            } else {
+                echo "<span class='glyphicon glyphicon-unchecked app-sum-icon'></span>";
+            }
+            break;
+        default:
+            echo $row['data'];
+            break;
+        }
+    }
+
+    function print_shareholder_of_shareholder($company_shareholder,$tab_num)
+    {
+        $tab_num ++;
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+
+        $x->_join .= "
+          LEFT JOIN
+              coba_address
+          ON
+              coba_address.id = join_coba_person_id_id.coba_address_id
+        ";
+
+        $address = DB_DataObject::factory('coba_address');
+        $x->selectAs($address, 'coba_address_id_%s');
+
+
+        $x->set(array(
+            'relation' => 'SHAREHOLDER',
+            'parent_company_id' => $company_shareholder->coba_company_id,
+            'coba_company_id' => '0'
+        ));
+        $data_individual_shareholder = $x->fetchAll();
+
+        foreach ($data_individual_shareholder as $individual_shareholder_key
+                  => $individual_shareholder) {
+            echo "
+                <table class='app-sum-body-indi-data-table'>
+                    <tr class='app-sum-body-indi-data-row'>
+                        <td class='col-md-6 app-sum-body-indi-data'>
+                            {$this->tabbing($tab_num)}
+                            <span class='app-sum-body-corp-title'>
+                                Individual Shareholder
+                                {$this->modifyClientNumber($individual_shareholder_key)}
+                            </span>
+                        </td>
+                        <td class='col-md-6 app-sum-body-indi-data'>
+                        </td>
+                    </tr>
+            ";
+            foreach ($this->schema_data_individual as $individual_row) {
+                $this->print_label_and_data($individual_shareholder,$individual_row,$tab_num);
+            }
+            echo "</table>";
+        }
+
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+
+        $x->_join .= "
+          LEFT JOIN
+              coba_address
+          ON
+              coba_address.id = join_coba_company_id_id.coba_address_id
+        ";
+
+        $address = DB_DataObject::factory('coba_address');
+        $x->selectAs($address, 'coba_address_id_%s');
+
+        $x->set(array(
+            'relation' => 'SHAREHOLDER',
+            'parent_company_id' => $company_shareholder->coba_company_id,
+            'coba_person_id' => '0',
+        ));
+        $data_company_shareholder = $x->fetchAll();
+
+
+        if (count($data_company_shareholder)) {
+            foreach ($data_company_shareholder as $company_shareholder_key
+                      => $company_shareholder) {
+                echo "
+                    <table class='app-sum-body-indi-data-table'>
+                        <tr class='app-sum-body-indi-data-row'>
+                            <td class='col-md-6 app-sum-body-indi-data'>
+                                {$this->tabbing($tab_num)}
+                                <span class='app-sum-body-corp-title'>
+                                    Company Shareholder
+                                    {$this->modifyClientNumber($company_shareholder_key)}
+                                </span>
+                            </td>
+                            <td class='col-md-6 app-sum-body-indi-data'>
+                            </td>
+                        </tr>
+                ";
+                foreach ($this->schema_data_company as $company_row) {
+                    $this->print_label_and_data($company_shareholder,$company_row,$tab_num);
+                }
+                echo "</table>";
+                $this->print_shareholder_of_shareholder($company_shareholder,$tab_num);
+            }
+        }
+    }
+
+    function tabbing($tab_num)
+    {
+        $n = 0;
+        $tabbing_class_string = "";
+        while ($n < $tab_num) {
+            $tabbing_class_string.="<span class='app-sum-body-tabbing'></span>";
+            $n++;
+        };
+        return $tabbing_class_string;
+    }
+
+    function modifyClientNumber($n)
+    {
+        return $n+1;
+    }
+
+    function PHP_var_dump($a)
+    {
+        var_dump($a);
+        exit;
+    }
+}
diff --git a/Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.bjs b/Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.bjs
new file mode 100644 (file)
index 0000000..1659f8f
--- /dev/null
@@ -0,0 +1,469 @@
+{
+ "name" : "Coba.Tab.RiskPersonal.EstatePlanning",
+ "parent" : "Coba.Tab.RiskPersonal",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "964b03e94a6edfea87737f699fed5e16" : "11. Estate Planning",
+  "8efb22767cae88d8b201f93d67317f62" : "Do you have any charitable causes or fundations you wish to discuss further?",
+  "39d5089caa3c9caaa10b6d1a13216596" : "Have you empowered someone else to look after you medically in the event of disability or illness? This is known as an \"Advance Health Directive\"",
+  "529d3b49eec19fe53051e19f8b285124" : "Have you empowered someone else to look after your finances in the event of disability or illness? This is known as an \"Enduring Power of Attorney\"",
+  "6512bd43d9caa6e02c990b0a82652dca" : "11",
+  "2dca51ee6dc27c6d61d11edc7c21ebf0" : "Do you have a will?",
+  "3e30ef4abf20f94f57539695c792e0d5" : "If you do have a will, when was it last updated?",
+  "7f4dc4b9041e1b0ea37cdb415a85961a" : "Do you have any special need requirements of any dependents?",
+  "bf7d6c2a60f55d4ca507729b47f0ca74" : "Do you have a testamentary trust?",
+  "26a710cd1671b5d262ccccf9a6998300" : "If yes please explain further."
+ },
+ "items" : [
+  {
+   "xtype" : "Content",
+   "String region" : "center",
+   "$ xns" : "Roo.bootstrap.panel",
+   "String title" : 11,
+   "items" : [
+    {
+     "String header" : "11. Estate Planning",
+     "xtype" : "Container",
+     "String panel" : "primary",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:20px;",
+     "items" : [
+      {
+       "xtype" : "Form",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 4,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Do you have a will?",
+             "String style" : "line-height: 43px; margin-left:14px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 8,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_will",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "top",
+                 "String boxLabel" : "Yes",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 1
+                }
+               ]
+              },
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_will",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "left",
+                 "String boxLabel" : "No",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 0
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 6,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "String name" : "estate_year_will",
+             "xtype" : "Input",
+             "String labelAlign" : "left",
+             "string fieldLabel" : "If you do have a will, when was it last updated?",
+             "$ xns" : "Roo.bootstrap",
+             "String style" : "line-height:40px;",
+             "Number labelWidth" : 8
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 4,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Do you have a testamentary trust?",
+             "String style" : "line-height: 43px; margin-left:14px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 8,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_testamentary",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "top",
+                 "String boxLabel" : "Yes",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 1
+                }
+               ]
+              },
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_testamentary",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "left",
+                 "String boxLabel" : "No",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 0
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 4,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Have you empowered someone else to look after your finances in the event of disability or illness? This is known as an \"Enduring Power of Attorney\"",
+             "String style" : " margin-left:14px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 8,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_enduring_power",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "top",
+                 "String boxLabel" : "Yes",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 1
+                }
+               ]
+              },
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_enduring_power",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "left",
+                 "String boxLabel" : "No",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 0
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 4,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Have you empowered someone else to look after you medically in the event of disability or illness? This is known as an \"Advance Health Directive\"",
+             "String style" : "margin-left:14px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 8,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_health_directive",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "top",
+                 "String boxLabel" : "Yes",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 1
+                }
+               ]
+              },
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_health_directive",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "left",
+                 "String boxLabel" : "No",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 0
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 4,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Do you have any special need requirements of any dependents?",
+             "String style" : "margin-left:14px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 8,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_special_need",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "top",
+                 "String boxLabel" : "Yes",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 1
+                }
+               ]
+              },
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_special_need",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "left",
+                 "String boxLabel" : "No",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 0
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 6,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "String name" : "estate_reason_special_need",
+             "xtype" : "Input",
+             "string fieldLabel" : "If yes please explain further.",
+             "String labelAlign" : "left",
+             "$ xns" : "Roo.bootstrap",
+             "String style" : "line-height:40px;",
+             "Number labelWidth" : 8
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "margin: 5px;",
+         "items" : [
+          {
+           "Number md" : 4,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Do you have any charitable causes or fundations you wish to discuss further?",
+             "String style" : "margin-left:14px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 8,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_charitable",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "top",
+                 "String boxLabel" : "Yes",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 1
+                }
+               ]
+              },
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "String name" : "estate_is_charitable",
+                 "xtype" : "Radio",
+                 "String labelAlign" : "left",
+                 "String boxLabel" : "No",
+                 "$ xns" : "Roo.bootstrap",
+                 "String inputValue" : 0
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.js b/Pman/Coba/Coba.Tab.RiskPersonal.EstatePlanning.js
new file mode 100644 (file)
index 0000000..ca83b70
--- /dev/null
@@ -0,0 +1,543 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Coba.Tab.RiskPersonal');
+
+Coba.Tab.RiskPersonal.EstatePlanning = new Roo.XComponent({
+
+ _strings : {
+  '964b03e94a6edfea87737f699fed5e16' :"11. Estate Planning",
+  '8efb22767cae88d8b201f93d67317f62' :"Do you have any charitable causes or fundations you wish to discuss further?",
+  '39d5089caa3c9caaa10b6d1a13216596' :"Have you empowered someone else to look after you medically in the event of disability or illness? This is known as an \"Advance Health Directive\"",
+  '529d3b49eec19fe53051e19f8b285124' :"Have you empowered someone else to look after your finances in the event of disability or illness? This is known as an \"Enduring Power of Attorney\"",
+  '6512bd43d9caa6e02c990b0a82652dca' :"11",
+  '2dca51ee6dc27c6d61d11edc7c21ebf0' :"Do you have a will?",
+  '3e30ef4abf20f94f57539695c792e0d5' :"If you do have a will, when was it last updated?",
+  '7f4dc4b9041e1b0ea37cdb415a85961a' :"Do you have any special need requirements of any dependents?",
+  'bf7d6c2a60f55d4ca507729b47f0ca74' :"Do you have a testamentary trust?",
+  '26a710cd1671b5d262ccccf9a6998300' :"If yes please explain further."
+ },
+
+  part     :  ["Coba", "EstatePlanning" ],
+  order    : '001-Coba.Tab.RiskPersonal.EstatePlanning',
+  region   : 'center',
+  parent   : 'Coba.Tab.RiskPersonal',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'Content',
+   region : 'center',
+   title : 11,
+   xns : Roo.bootstrap.panel,
+   '|xns' : 'Roo.bootstrap.panel',
+   items  : [
+    {
+     xtype : 'Container',
+     header : _this._strings['964b03e94a6edfea87737f699fed5e16'] /* 11. Estate Planning */,
+     panel : 'primary',
+     style : 'margin:20px;',
+     xns : Roo.bootstrap,
+     '|xns' : 'Roo.bootstrap',
+     items  : [
+      {
+       xtype : 'Form',
+       xns : Roo.bootstrap,
+       '|xns' : 'Roo.bootstrap',
+       items  : [
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 4,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'FieldLabel',
+             html : _this._strings['2dca51ee6dc27c6d61d11edc7c21ebf0'] /* Do you have a will? */,
+             style : 'line-height: 43px; margin-left:14px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          },
+          {
+           xtype : 'Column',
+           md : 8,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Row',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'Yes',
+                 inputValue : 1,
+                 labelAlign : 'top',
+                 name : 'estate_is_will',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              },
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'No',
+                 inputValue : 0,
+                 labelAlign : 'left',
+                 name : 'estate_is_will',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 6,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Input',
+             fieldLabel : _this._strings['3e30ef4abf20f94f57539695c792e0d5'] /* If you do have a will, when was it last updated? */,
+             labelAlign : 'left',
+             labelWidth : 8,
+             name : 'estate_year_will',
+             style : 'line-height:40px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 4,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'FieldLabel',
+             html : _this._strings['bf7d6c2a60f55d4ca507729b47f0ca74'] /* Do you have a testamentary trust? */,
+             style : 'line-height: 43px; margin-left:14px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          },
+          {
+           xtype : 'Column',
+           md : 8,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Row',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'Yes',
+                 inputValue : 1,
+                 labelAlign : 'top',
+                 name : 'estate_is_testamentary',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              },
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'No',
+                 inputValue : 0,
+                 labelAlign : 'left',
+                 name : 'estate_is_testamentary',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 4,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'FieldLabel',
+             html : _this._strings['529d3b49eec19fe53051e19f8b285124'] /* Have you empowered someone else to look after your finances in the event of disability or illness? This is known as an "Enduring Power of Attorney" */,
+             style : ' margin-left:14px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          },
+          {
+           xtype : 'Column',
+           md : 8,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Row',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'Yes',
+                 inputValue : 1,
+                 labelAlign : 'top',
+                 name : 'estate_is_enduring_power',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              },
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'No',
+                 inputValue : 0,
+                 labelAlign : 'left',
+                 name : 'estate_is_enduring_power',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 4,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'FieldLabel',
+             html : _this._strings['39d5089caa3c9caaa10b6d1a13216596'] /* Have you empowered someone else to look after you medically in the event of disability or illness? This is known as an "Advance Health Directive" */,
+             style : 'margin-left:14px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          },
+          {
+           xtype : 'Column',
+           md : 8,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Row',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'Yes',
+                 inputValue : 1,
+                 labelAlign : 'top',
+                 name : 'estate_is_health_directive',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              },
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'No',
+                 inputValue : 0,
+                 labelAlign : 'left',
+                 name : 'estate_is_health_directive',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 4,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'FieldLabel',
+             html : _this._strings['7f4dc4b9041e1b0ea37cdb415a85961a'] /* Do you have any special need requirements of any dependents? */,
+             style : 'margin-left:14px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          },
+          {
+           xtype : 'Column',
+           md : 8,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Row',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'Yes',
+                 inputValue : 1,
+                 labelAlign : 'top',
+                 name : 'estate_is_special_need',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              },
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'No',
+                 inputValue : 0,
+                 labelAlign : 'left',
+                 name : 'estate_is_special_need',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 6,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Input',
+             fieldLabel : _this._strings['26a710cd1671b5d262ccccf9a6998300'] /* If yes please explain further. */,
+             labelAlign : 'left',
+             labelWidth : 8,
+             name : 'estate_reason_special_need',
+             style : 'line-height:40px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Row',
+         style : 'margin: 5px;',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Column',
+           md : 4,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'FieldLabel',
+             html : _this._strings['8efb22767cae88d8b201f93d67317f62'] /* Do you have any charitable causes or fundations you wish to discuss further? */,
+             style : 'margin-left:14px;',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            }
+           ]
+          },
+          {
+           xtype : 'Column',
+           md : 8,
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Row',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'Yes',
+                 inputValue : 1,
+                 labelAlign : 'top',
+                 name : 'estate_is_charitable',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              },
+              {
+               xtype : 'Column',
+               md : 2,
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Radio',
+                 boxLabel : 'No',
+                 inputValue : 0,
+                 labelAlign : 'left',
+                 name : 'estate_is_charitable',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  };  }
+});
diff --git a/Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.bjs b/Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.bjs
new file mode 100644 (file)
index 0000000..d41b27b
--- /dev/null
@@ -0,0 +1,583 @@
+{
+ "name" : "Coba.Tab.RiskPersonal.LifeInsurance",
+ "parent" : "Coba.Tab.RiskPersonal",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "2895e3be29309616204afd096d1e6653" : "Liabilities to be paid out (e.g. Mortgage, Personal Loans):",
+  "74a2c78bffd362899c586b892448533e" : "Guarantor's insurance:",
+  "1f20f91fae0ff79efca4d8d02306ba3e" : "Protecion of family and/ or assets in the event of Death or Total and Permanent Disablement",
+  "ab91c7fde7e3f470415e967fd72f9332" : "Provide against Critical Illness or Major Trauma",
+  "e1678dfbd206408d8ef5bfb94228bea5" : "Business Insurance",
+  "4f81ff448f5008d6dfbe5b474d7521f2" : "Liabilities to be paid out (e.g. Mortgage, Loans):",
+  "cbf07fc663c0d8d286520e88cef718d6" : "Amount of income to be covered:",
+  "c262b5a5a8b218eaa0604f30bf75e7f6" : "For how long would you want your income replaced?",
+  "d3d9446802a44259755d38e6d163e820" : "10",
+  "b8fa154d2e9e40b9f339dba7dabde17c" : "Emergency fund:",
+  "eedf4b0c45884f110a705535494c893f" : "Do you require Key-person insurance?",
+  "dea938ebabb8ebbf5fe89506727bb247" : "Funeral expenses:",
+  "7fe2a2366ed2550f552a84a37c46af56" : "Protect income against serious illness or injury",
+  "f7302683963f2a1c38d31d48aa2a17ef" : "Waiting period (How long could you sustain lifestyle without earning income?)",
+  "1447299d17e7910f74983c23e9d79d5b" : "Children's education expenses:",
+  "70e9e572ab6623d0d2420faaa2c67adf" : "Other Expenses (e.g. Medical, Home Improvements):",
+  "22dd14a1d6bbc507213d3502c364d721" : "Need for share purchase, partnership insurance for buy/sell arrangement:",
+  "00c1ad871e16f31bc35aaeba5c71d296" : "Income to be replaced:",
+  "176a8c52ebd1a2f21acceabb717334ec" : "Benefit period (If you needed to make claim, for how long would you like benefits paid?)",
+  "ee629a7c963d602a41c6a4cdfd36673a" : "10. Life Insurance Objectives & Concerns",
+  "66c4c5112f455a19afde47829df363fa" : "Total:",
+  "fc1858e766ad35ccd1e3aaa0766a7fea" : "Other:"
+ },
+ "items" : [
+  {
+   "xtype" : "Content",
+   "String region" : "center",
+   "$ xns" : "Roo.bootstrap.panel",
+   "String title" : 10,
+   "items" : [
+    {
+     "String header" : "10. Life Insurance Objectives & Concerns",
+     "xtype" : "Container",
+     "String panel" : "primary",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:20px;",
+     "items" : [
+      {
+       "xtype" : "Form",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "String header" : "Protecion of family and/ or assets in the event of Death or Total and Permanent Disablement",
+         "String panel" : "info",
+         "xtype" : "Container",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_liability_family",
+               "xtype" : "Input",
+               "string fieldLabel" : "Liabilities to be paid out (e.g. Mortgage, Personal Loans):",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_expense_edu_family",
+               "xtype" : "Input",
+               "string fieldLabel" : "Children's education expenses:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_income_replace_family",
+               "xtype" : "Input",
+               "string fieldLabel" : "Income to be replaced:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_year_replace_family",
+               "xtype" : "Input",
+               "string fieldLabel" : "For how long would you want your income replaced?",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_expense_funeral_family",
+               "xtype" : "Input",
+               "string fieldLabel" : "Funeral expenses:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_fund_emergency_family",
+               "xtype" : "Input",
+               "string fieldLabel" : "Emergency fund:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "xtype" : "Input",
+               "string fieldLabel" : "Total:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "String header" : "Provide against Critical Illness or Major Trauma",
+         "String panel" : "info",
+         "xtype" : "Container",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_liability_critical",
+               "xtype" : "Input",
+               "string fieldLabel" : "Liabilities to be paid out (e.g. Mortgage, Loans):",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_expense_critical",
+               "xtype" : "Input",
+               "string fieldLabel" : "Other Expenses (e.g. Medical, Home Improvements):",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_income_replace_critical",
+               "xtype" : "Input",
+               "string fieldLabel" : "Income to be replaced:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_income_other_critical",
+               "xtype" : "Input",
+               "string fieldLabel" : "Other:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "xtype" : "Input",
+               "string fieldLabel" : "Total:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "String header" : "Protect income against serious illness or injury",
+         "xtype" : "Container",
+         "String panel" : "info",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_income_cover_serious",
+               "xtype" : "Input",
+               "string fieldLabel" : "Amount of income to be covered:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_year_sustain_serious",
+               "xtype" : "Input",
+               "string fieldLabel" : "Waiting period (How long could you sustain lifestyle without earning income?)",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_year_benefit_serious",
+               "xtype" : "Input",
+               "string fieldLabel" : "Benefit period (If you needed to make claim, for how long would you like benefits paid?)",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_income_other_serious",
+               "xtype" : "Input",
+               "string fieldLabel" : "Other:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "xtype" : "Input",
+               "String labelAlign" : "left",
+               "string fieldLabel" : "Total:",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "String header" : "Business Insurance",
+         "String panel" : "info",
+         "xtype" : "Container",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_expense_share_business",
+               "xtype" : "Input",
+               "string fieldLabel" : "Need for share purchase, partnership insurance for buy/sell arrangement:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 12,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "String name" : "insurance_expense_guarantor_business",
+               "xtype" : "Input",
+               "string fieldLabel" : "Guarantor's insurance:",
+               "String labelAlign" : "left",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "line-height: 30px;",
+               "Number labelWidth" : 4
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Row",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "margin: 5px;",
+           "items" : [
+            {
+             "Number md" : 4,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "xtype" : "FieldLabel",
+               "$ xns" : "Roo.bootstrap",
+               "String html" : "Do you require Key-person insurance?",
+               "String style" : "line-height: 45px; margin-left:14px;"
+              }
+             ]
+            },
+            {
+             "Number md" : 8,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "xtype" : "Row",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "Number md" : 2,
+                 "xtype" : "Column",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "String name" : "insurance_is_require_keyperson",
+                   "xtype" : "Radio",
+                   "String labelAlign" : "top",
+                   "String boxLabel" : "Yes",
+                   "$ xns" : "Roo.bootstrap",
+                   "String inputValue" : 1
+                  }
+                 ]
+                },
+                {
+                 "Number md" : 2,
+                 "xtype" : "Column",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "String name" : "insurance_is_require_keyperson",
+                   "xtype" : "Radio",
+                   "String labelAlign" : "left",
+                   "String boxLabel" : "No",
+                   "$ xns" : "Roo.bootstrap",
+                   "String inputValue" : 0
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.js b/Pman/Coba/Coba.Tab.RiskPersonal.LifeInsurance.js
new file mode 100644 (file)
index 0000000..9753e89
--- /dev/null
@@ -0,0 +1,667 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Coba.Tab.RiskPersonal');
+
+Coba.Tab.RiskPersonal.LifeInsurance = new Roo.XComponent({
+
+ _strings : {
+  '2895e3be29309616204afd096d1e6653' :"Liabilities to be paid out (e.g. Mortgage, Personal Loans):",
+  '74a2c78bffd362899c586b892448533e' :"Guarantor's insurance:",
+  '1f20f91fae0ff79efca4d8d02306ba3e' :"Protecion of family and/ or assets in the event of Death or Total and Permanent Disablement",
+  'ab91c7fde7e3f470415e967fd72f9332' :"Provide against Critical Illness or Major Trauma",
+  'e1678dfbd206408d8ef5bfb94228bea5' :"Business Insurance",
+  '4f81ff448f5008d6dfbe5b474d7521f2' :"Liabilities to be paid out (e.g. Mortgage, Loans):",
+  'cbf07fc663c0d8d286520e88cef718d6' :"Amount of income to be covered:",
+  'c262b5a5a8b218eaa0604f30bf75e7f6' :"For how long would you want your income replaced?",
+  'd3d9446802a44259755d38e6d163e820' :"10",
+  'b8fa154d2e9e40b9f339dba7dabde17c' :"Emergency fund:",
+  'eedf4b0c45884f110a705535494c893f' :"Do you require Key-person insurance?",
+  'dea938ebabb8ebbf5fe89506727bb247' :"Funeral expenses:",
+  '7fe2a2366ed2550f552a84a37c46af56' :"Protect income against serious illness or injury",
+  'f7302683963f2a1c38d31d48aa2a17ef' :"Waiting period (How long could you sustain lifestyle without earning income?)",
+  '1447299d17e7910f74983c23e9d79d5b' :"Children's education expenses:",
+  '70e9e572ab6623d0d2420faaa2c67adf' :"Other Expenses (e.g. Medical, Home Improvements):",
+  '22dd14a1d6bbc507213d3502c364d721' :"Need for share purchase, partnership insurance for buy/sell arrangement:",
+  '00c1ad871e16f31bc35aaeba5c71d296' :"Income to be replaced:",
+  '176a8c52ebd1a2f21acceabb717334ec' :"Benefit period (If you needed to make claim, for how long would you like benefits paid?)",
+  'ee629a7c963d602a41c6a4cdfd36673a' :"10. Life Insurance Objectives & Concerns",
+  '66c4c5112f455a19afde47829df363fa' :"Total:",
+  'fc1858e766ad35ccd1e3aaa0766a7fea' :"Other:"
+ },
+
+  part     :  ["Coba", "LifeInsurance" ],
+  order    : '001-Coba.Tab.RiskPersonal.LifeInsurance',
+  region   : 'center',
+  parent   : 'Coba.Tab.RiskPersonal',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'Content',
+   region : 'center',
+   title : 10,
+   xns : Roo.bootstrap.panel,
+   '|xns' : 'Roo.bootstrap.panel',
+   items  : [
+    {
+     xtype : 'Container',
+     header : _this._strings['ee629a7c963d602a41c6a4cdfd36673a'] /* 10. Life Insurance Objectives & Concerns */,
+     panel : 'primary',
+     style : 'margin:20px;',
+     xns : Roo.bootstrap,
+     '|xns' : 'Roo.bootstrap',
+     items  : [
+      {
+       xtype : 'Form',
+       xns : Roo.bootstrap,
+       '|xns' : 'Roo.bootstrap',
+       items  : [
+        {
+         xtype : 'Container',
+         header : _this._strings['1f20f91fae0ff79efca4d8d02306ba3e'] /* Protecion of family and/ or assets in the event of Death or Total and Permanent Disablement */,
+         panel : 'info',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['2895e3be29309616204afd096d1e6653'] /* Liabilities to be paid out (e.g. Mortgage, Personal Loans): */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_liability_family',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['1447299d17e7910f74983c23e9d79d5b'] /* Children's education expenses: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_expense_edu_family',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['00c1ad871e16f31bc35aaeba5c71d296'] /* Income to be replaced: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_income_replace_family',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['c262b5a5a8b218eaa0604f30bf75e7f6'] /* For how long would you want your income replaced? */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_year_replace_family',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['dea938ebabb8ebbf5fe89506727bb247'] /* Funeral expenses: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_expense_funeral_family',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['b8fa154d2e9e40b9f339dba7dabde17c'] /* Emergency fund: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_fund_emergency_family',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['66c4c5112f455a19afde47829df363fa'] /* Total: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Container',
+         header : _this._strings['ab91c7fde7e3f470415e967fd72f9332'] /* Provide against Critical Illness or Major Trauma */,
+         panel : 'info',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['4f81ff448f5008d6dfbe5b474d7521f2'] /* Liabilities to be paid out (e.g. Mortgage, Loans): */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_liability_critical',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['70e9e572ab6623d0d2420faaa2c67adf'] /* Other Expenses (e.g. Medical, Home Improvements): */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_expense_critical',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['00c1ad871e16f31bc35aaeba5c71d296'] /* Income to be replaced: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_income_replace_critical',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['fc1858e766ad35ccd1e3aaa0766a7fea'] /* Other: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_income_other_critical',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['66c4c5112f455a19afde47829df363fa'] /* Total: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Container',
+         header : _this._strings['7fe2a2366ed2550f552a84a37c46af56'] /* Protect income against serious illness or injury */,
+         panel : 'info',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['cbf07fc663c0d8d286520e88cef718d6'] /* Amount of income to be covered: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_income_cover_serious',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['f7302683963f2a1c38d31d48aa2a17ef'] /* Waiting period (How long could you sustain lifestyle without earning income?) */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_year_sustain_serious',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['176a8c52ebd1a2f21acceabb717334ec'] /* Benefit period (If you needed to make claim, for how long would you like benefits paid?) */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_year_benefit_serious',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['fc1858e766ad35ccd1e3aaa0766a7fea'] /* Other: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_income_other_serious',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['66c4c5112f455a19afde47829df363fa'] /* Total: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         xtype : 'Container',
+         header : _this._strings['e1678dfbd206408d8ef5bfb94228bea5'] /* Business Insurance */,
+         panel : 'info',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['22dd14a1d6bbc507213d3502c364d721'] /* Need for share purchase, partnership insurance for buy/sell arrangement: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_expense_share_business',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 12,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Input',
+               fieldLabel : _this._strings['74a2c78bffd362899c586b892448533e'] /* Guarantor's insurance: */,
+               labelAlign : 'left',
+               labelWidth : 4,
+               name : 'insurance_expense_guarantor_business',
+               style : 'line-height: 30px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Row',
+           style : 'margin: 5px;',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'Column',
+             md : 4,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'FieldLabel',
+               html : _this._strings['eedf4b0c45884f110a705535494c893f'] /* Do you require Key-person insurance? */,
+               style : 'line-height: 45px; margin-left:14px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            },
+            {
+             xtype : 'Column',
+             md : 8,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Row',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Column',
+                 md : 2,
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'Radio',
+                   boxLabel : 'Yes',
+                   inputValue : 1,
+                   labelAlign : 'top',
+                   name : 'insurance_is_require_keyperson',
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  }
+                 ]
+                },
+                {
+                 xtype : 'Column',
+                 md : 2,
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'Radio',
+                   boxLabel : 'No',
+                   inputValue : 0,
+                   labelAlign : 'left',
+                   name : 'insurance_is_require_keyperson',
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  };  }
+});
diff --git a/Pman/Coba/DataObjects/Coba_address.php b/Pman/Coba/DataObjects/Coba_address.php
new file mode 100644 (file)
index 0000000..a7fb899
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_address extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_address';
+
+    public $id;
+    public $country;
+    public $other_country;
+    public $state;
+    public $other_state;
+    public $city;
+    public $without_post_code;
+    public $post_code;
+    public $address_line_1;
+    public $address_line_2;
+
+
+
+}
diff --git a/Pman/Coba/DataObjects/Coba_application_signup.php b/Pman/Coba/DataObjects/Coba_application_signup.php
new file mode 100644 (file)
index 0000000..7af92e9
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_application_signup extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_application_signup';
+    
+    function sendVerification($template, $roo)
+    {   
+        $content = array(
+            'template'      => $template,
+            'person'        => $this,
+            'serverName'    => $_SERVER['SERVER_NAME'],
+            'baseURL'       => $roo->baseURL
+        );
+        
+        $sent = DB_DataObject::factory('core_email')->send($content);
+        
+        if(!is_object($sent)){
+            return true;
+        }
+        
+        print_r($sent->getMessage());exit;
+        return false;
+    }
+
+}
diff --git a/Pman/Coba/DataObjects/Coba_company.php b/Pman/Coba/DataObjects/Coba_company.php
new file mode 100644 (file)
index 0000000..2ff0987
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_company extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_company';
+
+    public $id;
+    public $name;
+    public $domicile;
+    public $other_domicile;
+    public $registration_number;
+    public $date_of_incorporation;
+    public $not_domociled_usa;
+    public $giin_number;
+
+    function beforeDelete($dependants, $roo)
+    {
+        $coba_investor_relation = DB_DataObject::factory('coba_investor_relation');
+        $coba_investor_relation->setFrom(array(
+            'parent_company_id' => $this->id
+        ));
+
+        foreach($coba_investor_relation->fetchAll() as $c){
+            $c->beforeDelete(array(), $roo);
+            $c->delete();
+        }
+
+        $coba_address = DB_DataObject::factory('coba_address');
+        $coba_address->get($this->coba_address_id);
+        $coba_address->delete();
+    }
+
+    function getShareholders()
+    {
+        $coba_investor_relation = DB_DataObject::factory('coba_investor_relation');
+        $coba_investor_relation->autoJoin();
+        $coba_investor_relation->setFrom(array(
+            'relation' => 'SHAREHOLDER',
+        ));
+        $coba_investor_relation->whereAdd("coba_investor_relation.coba_company_id != 0");
+
+        return $coba_investor_relation->fetchAll();
+    }
+
+}
diff --git a/Pman/Coba/DataObjects/Coba_country.php b/Pman/Coba/DataObjects/Coba_country.php
new file mode 100644 (file)
index 0000000..2724f31
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_country extends PDO_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_country';
+
+    public $id;
+    public $name;
+    public $abbrv;
+    
+}
diff --git a/Pman/Coba/DataObjects/Coba_declarations.php b/Pman/Coba/DataObjects/Coba_declarations.php
new file mode 100644 (file)
index 0000000..800737e
--- /dev/null
@@ -0,0 +1,201 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_declarations extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_declarations';
+
+    public $id;
+    public $fund_id;
+    public $dec_type;
+    public $nickname;
+    public $title;
+    public $created_dt;
+    public $created_by;
+    public $is_active;
+    public $used_by;
+    public $seq_order;
+
+    var $account_type_mapping = array(
+        'individual' => 'I',
+        'joint' => 'J',
+        'corporate' => 'C'
+   );
+    
+    function applyFilters($q, $au)
+    {
+        if(!empty($q['_user_id'])){
+            
+            $ext_data = DB_DataObject::factory('ext_data')->load('userdata_id', $q['_user_id']);
+            
+            $used_by = $this->account_type_mapping[$ext_data->account_type];
+
+            if($ext_data->account_type == 'corporate' && $ext_data->is_listed_company == 'yes'){
+                $used_by = 'CL';
+            }
+            
+            $this->whereAdd("coba_declarations.used_by = '{$used_by}'");
+            
+            $this->whereAddUserFilter($ext_data);
+            
+        }
+        
+   }
+   
+   function postListFilter($data, $au, $q)
+   {
+       if(!empty($q['_user_id'])){
+           
+           foreach ($data as $k => $v){
+               
+               $coba_investor_declarations = DB_DataObject::factory('coba_investor_declarations');
+               $coba_investor_declarations->setFrom(array(
+                   'user_id' => $q['_user_id'],
+                   'dec_id' => $v['id']
+               ));
+               
+               if(!$coba_investor_declarations->find(true)){
+                   $coba_investor_declarations->insert();
+               }
+               
+               $data[$k]['coba_investor_declarations_id'] = $coba_investor_declarations->id;
+               
+               $data[$k]['coba_investor_declarations_documents'] = $coba_investor_declarations->getDocuments();
+               
+           }
+           
+           if(!empty($q['_with_others'])){
+               
+                $images = DB_DataObject::factory('Images');
+                $images->setFrom(array(
+                    'ontable' => 'modx_users',
+                    'onid' => $q['_user_id'],
+                    'imgtype' => 'other_documents'
+                ));
+                
+                $data[] = array(
+                    'id' => -1,
+                    'title' => 'Others',
+                    'coba_investor_declarations_id' => $q['_user_id'],
+                    'coba_investor_declarations_documents' => $images->fetchAll(false, false, 'toArray')
+                );
+                
+           }
+           
+       }
+       
+       return $data;
+       
+   }
+   
+   function whereAddUserFilter($ext_data)
+   {
+       if(empty($ext_data) || empty($ext_data->account_type)){
+           return;
+       }
+       
+       if($ext_data->in_professional_investor != 'yes' && $ext_data->professional_investor_second_ap != 'yes'){
+            $this->whereAdd("coba_declarations.nickname != 'prof_inv'");
+        }
+       
+       switch ($ext_data->account_type) {
+            
+            case 'individual' : 
+                
+                /*
+                 * FormList
+                 */
+                
+                if($ext_data->in_uscitizen == 'yes'){
+                    $this->whereAdd("coba_declarations.nickname != 'w8ben'");
+                }
+                
+                if($ext_data->in_uscitizen == 'no'){
+                    $this->whereAdd("coba_declarations.nickname != 'w9'");
+                }
+                
+                /*
+                 * CheckList
+                 */
+                
+                if(!empty($ext_data->not_have_passport)){
+                    $this->whereAdd("coba_declarations.nickname != 'passport_copy'");
+                }
+                
+                if(!empty($ext_data->not_have_id_card)){
+                    $this->whereAdd("coba_declarations.nickname != 'id_copy'");
+                }
+                
+                if($ext_data->in_uscitizen == 'yes'){
+                    $this->whereAdd("coba_declarations.nickname != 'w8ben'");
+                }
+                
+                if($ext_data->in_uscitizen == 'no'){
+                    $this->whereAdd("coba_declarations.nickname != 'w9'");
+                }
+                
+                break;
+            case 'joint' :
+                
+                /*
+                 * FormList
+                 */
+                
+                if($ext_data->in_uscitizen == 'yes' && $ext_data->uscitizen_second_ap == 'yes'){
+                    $this->whereAdd("coba_declarations.nickname != 'w8ben'");
+                }
+                
+                if($ext_data->in_uscitizen == 'no' && $ext_data->uscitizen_second_ap == 'no'){
+                    $this->whereAdd("coba_declarations.nickname != 'w9'");
+                }
+                
+                /*
+                 * CheckList
+                 */
+                
+                if(!empty($ext_data->not_have_passport) && !empty($ext_data->not_have_passport_ap2)){
+                    $this->whereAdd("coba_declarations.nickname != 'passport_copy'");
+                }
+                
+                if(!empty($ext_data->not_have_id_card) && !empty($ext_data->not_have_id_card_ap2)){
+                    $this->whereAdd("coba_declarations.nickname != 'id_copy'");
+                }
+                
+                if($ext_data->in_uscitizen == 'yes' && $ext_data->uscitizen_second_ap == 'yes'){
+                    $this->whereAdd("coba_declarations.nickname != 'w8ben'");
+                }
+                
+                if($ext_data->in_uscitizen == 'no' && $ext_data->uscitizen_second_ap == 'no'){
+                    $this->whereAdd("coba_declarations.nickname != 'w9'");
+                }
+                
+                break;
+            case 'corporate' :
+                
+                /*
+                 * FormList
+                 */
+                
+                if($ext_data->is_listed_company == 'yes' || $ext_data->in_uscitizen == 'yes'){
+                    $this->whereAdd("coba_declarations.nickname != 'w8bene'");
+                }
+                
+                /*
+                 * CheckList
+                 */
+                
+                if($ext_data->is_listed_company == 'yes' || $ext_data->in_uscitizen == 'yes'){
+                    $this->whereAdd("coba_declarations.nickname != 'w8bene'");
+                }
+                
+                break;
+        }
+   }
+
+   
+
+}
diff --git a/Pman/Coba/DataObjects/Coba_investor_declarations.php b/Pman/Coba/DataObjects/Coba_investor_declarations.php
new file mode 100644 (file)
index 0000000..161a444
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_investor_declarations extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_investor_declarations';
+
+    public $id;
+    public $user_id;
+    public $dec_id;
+    public $is_agreed;
+    public $agreed_dt;
+
+    function applyFilters($q, $au, $roo)
+    {
+        
+    }
+    
+    function getDocuments()
+    {
+        $images = DB_DataObject::factory('Images');
+        $images->setFrom(array(
+            'ontable' => $this->tableName(),
+            'onid' => $this->id
+        ));
+        
+        return $images->fetchAll(false, false, 'toArray');
+    }
+   
+
+}
diff --git a/Pman/Coba/DataObjects/Coba_investor_lexis_results.php b/Pman/Coba/DataObjects/Coba_investor_lexis_results.php
new file mode 100644 (file)
index 0000000..496f9b2
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_investor_lexis_results extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_investor_lexis_results';
+
+    public $id;
+    public $investor_id;
+    public $match_id;
+    public $updated_by;
+    public $updated_dt;
+    public $reason;
+    public $is_active;
+    public $status;
+    
+    function onUpdate($old, $q, $roo)
+    {
+        $this->addActivityEvent($old, $roo);
+        
+        $this->validateProcess($roo);
+    }
+    
+    function addActivityEvent($old, $roo)
+    {
+        switch ($this->status) {
+            case 1 :
+                $action = 'LEXIS NEXIS ACCEPT';
+                $remarks = 'Lexis Nexis Accepted';
+                break;
+            case -1:
+                $action = 'LEXIS NEXIS REJECT';
+                $remarks = 'Lexis Nexis Rejected';
+                break;
+            default :
+                
+                if($old->status == 1){
+                    $action = 'LEXIS NEXIS UN-ACCEPT';
+                    $remarks = 'Lexis Nexis Un-accepted';
+                    break;
+                }
+                
+                $action = 'LEXIS NEXIS UN-REJECT';
+                $remarks = 'Lexis Nexis Un-rejected';
+                    
+                break;
+        }
+        
+        $e = $roo->addEvent($action, $this, $remarks);
+        
+        $o = clone($e);
+        $e->modx_users_id = $this->investor_id;
+        $e->update($o);
+        
+    }
+    
+    function validateProcess($roo)
+    {
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->investor_id,
+            'is_active' => 1,
+            'status' => 0
+        ));
+        
+        if($coba_investor_lexis_results->count()){
+            return;
+        }
+        
+        $modx_users = DB_DataObject::factory('modx_users');
+        
+        if(empty($this->investor_id) || !$modx_users->get($this->investor_id)){
+            return;
+        }
+        
+        $modx_users->sendLexisNexisComplianceEmail();
+        
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Coba_investor_notes.php b/Pman/Coba/DataObjects/Coba_investor_notes.php
new file mode 100644 (file)
index 0000000..0a98fe1
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_investor_notes extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_investor_notes';
+
+    public $id;
+    public $investor_id;
+    public $created_by;
+    public $created_dt;
+    public $notes;
+    public $note_type;
+
+    function onInsert($q, $roo)
+    {
+        if(!empty($this->note_type) && $this->note_type == 'COMPLIANCE REJECTED'){
+            
+            $this->addComplianceLog($roo);
+            
+            DB_DataObject::factory('modx_users')->load($this->investor_id)->sendComplianceRejectionEmail();
+        }
+    }
+    
+    function addComplianceLog($roo)
+    {
+        $e = $roo->addEvent('COMPLIANCE REJECTED', $this, 'Compliance officer rejected');
+        
+        $o = clone($e);
+        $e->modx_users_id = $this->investor_id;
+        $e->update($o);
+        
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Coba_investor_relation.php b/Pman/Coba/DataObjects/Coba_investor_relation.php
new file mode 100644 (file)
index 0000000..1e35fe3
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_investor_relation extends PDO_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_investor_relation';
+
+    public $id;
+    public $modx_user_id;
+    public $coba_person_id;
+    public $relation;
+    public $parent_company_id;
+    public $coba_company_id;
+    
+    function can_delete_by($au)
+    {
+        if(!empty($this->modx_user_id)){
+            return ($this->modx_user_id == $au->id) ? true : false;
+        }
+        
+        if(empty($this->parent_company_id)){
+            return false;
+        }
+        
+        $coba_investor_relation = DB_DataObject::factory('coba_investor_relation');
+        $coba_investor_relation->setFrom(array(
+            'modx_user_id' => $au->id,
+            'coba_company_id' => $this->parent_company_id
+        ));
+        
+        return $coba_investor_relation->count() ? true : false;
+        
+    }
+    
+    function beforeDelete($dependants, $roo)
+    {
+        if(!empty($this->coba_person_id)){
+            
+            $other = DB_DataObject::factory('coba_investor_relation');
+            $other->setFrom(array(
+                'coba_person_id' => $this->coba_person_id
+            ));
+            
+            $other->whereAdd("coba_investor_relation.id != {$this->id}");
+            
+            if(!$other->count()){
+                
+                $coba_person = DB_DataObject::factory('coba_person');
+        
+                if($coba_person->get($this->coba_person_id)){
+                    $coba_person->beforeDelete(array(), $roo);
+                    $coba_person->delete();
+                }
+            }
+        }
+        
+        if(!empty($this->coba_company_id)){
+            
+            $other = DB_DataObject::factory('coba_investor_relation');
+            
+            $other->setFrom(array(
+                'coba_company_id' => $this->coba_company_id
+            ));
+            
+            $other->whereAdd("coba_investor_relation.id != {$this->id}");
+            
+            if(!$other->count()){
+                
+                $coba_company = DB_DataObject::factory('coba_company');
+        
+                if($coba_company->get($this->coba_company_id)){
+                    $coba_company->beforeDelete(array(), $roo);
+                    $coba_company->delete();
+                }
+                
+            }
+        }
+    }
+    
+    function autoJoinPersonAddr()
+    {
+       $this->_join .= "LEFT JOIN
+                            coba_address AS coba_address_cir
+                        ON
+                            coba_address_cir.id = join_coba_person_id_id.coba_address_id";
+    }
+    
+    function autoJoinComAddr()
+    {
+       $this->_join .= "LEFT JOIN
+                             coba_address AS coba_address_cir
+                        ON
+                             coba_address_cir.id = join_coba_company_id_id.coba_address_id";
+    }
+    
+    function selectAddCountryStates() 
+    {
+       $this->selectAdd("
+            (SELECT coba_state.name FROM coba_state 
+              WHERE coba_state.id = coba_address_cir.state) 
+              AS state_name ,        
+
+            (SELECT i18n_translate('c' , coba_address_cir.country, 'en')) 
+              AS country_name ,
+
+            (SELECT i18n_translate('c' , join_coba_person_id_id.nationality, 'en')) 
+              AS nationality_name , 
+
+            (SELECT i18n_translate('c' , join_coba_person_id_id.place_of_birth, 'en')) 
+              AS place_of_birth_name,
+
+            (SELECT i18n_translate('c' ,join_coba_company_id_id.domicile, 'en')) 
+             AS domicile_name,                        
+
+             coba_address_cir.country AS coba_address_id_country,
+
+             coba_address_cir.other_country AS coba_address_id_other_country,
+
+             coba_address_cir.state AS coba_address_id_state,
+
+             coba_address_cir.other_state AS coba_address_id_other_state,
+
+             coba_address_cir.city AS coba_address_id_city,
+
+             coba_address_cir.without_post_code AS coba_address_id_without_post_code,
+
+             coba_address_cir.post_code AS coba_address_id_post_code,
+
+             coba_address_cir.address_line_1 AS coba_address_id_address_line_1,
+
+             coba_address_cir.address_line_2 AS coba_address_id_address_line_2
+        ");
+    }
+}
\ No newline at end of file
diff --git a/Pman/Coba/DataObjects/Coba_person.php b/Pman/Coba/DataObjects/Coba_person.php
new file mode 100644 (file)
index 0000000..a136bec
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'Pman/Core/DataObjects/Core_person.php';
+
+class Pman_Coba_DataObjects_Coba_person extends Pman_Core_DataObjects_Core_person 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_person';
+    
+    function beforeDelete($dependants, $roo)
+    {
+        $coba_address = DB_DataObject::factory('coba_address');
+        $coba_address->get($this->coba_address_id);
+        $coba_address->delete();
+        
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Coba_person_investor_profile.php b/Pman/Coba/DataObjects/Coba_person_investor_profile.php
new file mode 100644 (file)
index 0000000..d23f6cd
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_person_investor_profile extends PDO_DataObject
+{
+    public $__table = 'coba_person_investor_profile';
+
+    function post()
+    {
+        /*
+        if(empty($_REQUEST['investor_id'])){
+            $this->insert($_REQUEST);
+        }
+
+        $this->update($_REQUEST);
+        */
+    }
+}
diff --git a/Pman/Coba/DataObjects/Coba_person_notes.php b/Pman/Coba/DataObjects/Coba_person_notes.php
new file mode 100644 (file)
index 0000000..342fd1b
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Table Definition for Coba_person_notes
+ *
+ * objects can implement relatedWhere(), which should return
+ *    'tablename' => array of ids
+ *
+ * 
+ */
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_person_notes extends PDO_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_person_notes';                          // table name
+    public $id;                              // int(11)  not_null primary_key auto_increment
+    public $coba_person_id;                  // int(11)  
+    public $date_created;                     // date
+    public $notes;                           // longtext
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+    
+    
+    
+    
+    //  ------------ROO HOOKS------------------------------------
+    function applyFilters($q, $au ,$roo)
+    {
+        $tn = $this->tableName();
+        // if not empty on_table
+                
+        if (!empty($q['query']['from'])) {
+            $dt = date('Y-m-d' , strtotime($q['query']['from']));
+            $this->whereAdd(" {$tn}.date_created >=  '$dt' ");
+        }
+        if (!empty($q['query']['to'])) {
+            $dt = date('Y-m-d' , strtotime($q['query']['to']));
+            $this->whereAdd(" {$tn}.date_created <=  '$dt' ");
+        }
+        
+       if (!empty($q['coba_person_id'])) {
+           $coba_person_id = $this->escape($q['coba_person_id']);              
+            //$dt = date('Y-m-d' , strtotime($q['query']['to']));
+            $this->whereAdd(" {$tn}.coba_person_id <=  '$coba_person_id' ");
+        }
+         
+       if (!empty($q['_order_by'])) {
+           $_order_by = $this->escape($q['_order_by']);
+           $this->orderBy($_order_by);                     
+        }
+
+       
+                
+    }
+      
+    
+    
+    /**
+     * object :
+     * return the object that this relates to.
+     * 
+     * @return {DB_DataObject} related object
+     */
+    function object()
+    {
+        $o = DB_DataObject::factory($this->on_table);
+        $o->get($this->on_id);
+        return $o;
+        
+    }
+    
+       
+    function beforeInsert($request,$roo)
+    {
+        if(empty($this->date_created)){
+            $this->date_created = $this->sqlValue("NOW()");
+        }        
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Coba_state.php b/Pman/Coba/DataObjects/Coba_state.php
new file mode 100644 (file)
index 0000000..20b78de
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Coba_state extends PDO_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'coba_state';
+
+    public $id;
+    public $country_id;
+    public $name;
+    
+}
diff --git a/Pman/Coba/DataObjects/Ext_data.php b/Pman/Coba/DataObjects/Ext_data.php
new file mode 100644 (file)
index 0000000..9146941
--- /dev/null
@@ -0,0 +1,389 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Ext_data extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'ext_data';
+
+    function applyFilters($q, $au, $roo)
+    {
+        $this->selectAdd("
+            CASE
+                WHEN in_middlename='' THEN
+                    CONCAT_WS(' ', in_firstname,in_lastname)
+                ELSE
+                    CONCAT_WS(' ', in_firstname,in_middlename,in_lastname)
+            END AS full_name
+        ");
+
+        if (!empty($q['_search_filter'])) {
+            $search_filter = str_replace(' ','%',trim($this->escape($q['_search_filter'])));
+            $this->whereAdd("(
+                    in_email LIKE '%{$search_filter}%' 
+                OR 
+                   concat(in_firstname, in_middlename, in_lastname) LIKE '%{$search_filter}%'                    
+                OR
+                   concat(in_lastname, in_firstname, in_middlename) LIKE '%{$search_filter}%'                  
+                OR                           
+                   company_name LIKE '%{$search_filter}%'
+            )");            
+        }
+                          
+        if (!empty($q['_with_status'])) {
+            require_once 'Pman/Coba/Schema.php';
+            $x = new Pman_Coba_Schema(); // ctor -> load
+            
+            $x->modifySelectAdd($this); //modifying the select add query for checking the completeness of the user profile
+            
+            $this->selectAddIsMissingDocument();
+            
+        }
+        
+        if (!empty($q['_include_deleted'])) {
+            $this->whereAdd("ext_data.deleted_by>=0");
+        } else {
+            $this->whereAdd("ext_data.deleted_by=0");
+        }
+    }
+    
+    function selectAddIsMissingDocument()
+    {
+        $this->selectAdd("
+            CASE WHEN 
+            (
+                (
+                    SELECT
+                            COUNT(coba_investor_declarations.id)
+                    FROM
+                            coba_investor_declarations
+                    WHERE
+                            coba_investor_declarations.user_id = ext_data.userdata_id
+                        AND
+                            coba_investor_declarations.dec_id IN (
+
+                                SELECT
+                                        coba_declarations.id
+                                FROM
+                                        coba_declarations
+                                WHERE
+                                        coba_declarations.dec_type = 'checklist'
+                                    AND
+                                        coba_declarations.is_active = 1
+                                    AND
+                                        (
+                                            CASE WHEN ext_data.account_type = 'individual' THEN
+                                                coba_declarations.used_by = 'I'
+                                            WHEN ext_data.account_type = 'joint' THEN
+                                                coba_declarations.used_by = 'J'
+                                            WHEN ext_data.account_type = 'corporate' AND ext_data.is_listed_company != 'yes' THEN
+                                                coba_declarations.used_by = 'C'
+                                            WHEN ext_data.account_type = 'corporate' AND ext_data.is_listed_company = 'yes' THEN
+                                                coba_declarations.used_by = 'CL'
+                                            END
+                                        )
+                                    AND
+                                        (
+                                            CASE WHEN 
+                                                (ext_data.account_type = 'individual' AND ext_data.not_have_passport = 1) OR
+                                                (ext_data.account_type = 'joint' AND ext_data.not_have_passport = 1 AND ext_data.not_have_passport_ap2 = 1)
+                                            THEN
+                                                coba_declarations.nickname != 'passport_copy'
+                                            ELSE
+                                                TRUE
+                                            END
+                                        )
+                                    AND
+                                        (
+                                            CASE WHEN 
+                                                (ext_data.account_type = 'individual' AND ext_data.not_have_id_card = 1) OR
+                                                (ext_data.account_type = 'joint' AND ext_data.not_have_id_card = 1 AND ext_data.not_have_id_card_ap2 = 1)
+                                            THEN
+                                                coba_declarations.nickname != 'id_copy'
+                                            ELSE
+                                                TRUE
+                                            END
+                                        )
+                                    AND
+                                        (
+                                            CASE WHEN 
+                                                (ext_data.account_type = 'individual' AND ext_data.in_uscitizen = 'yes') OR
+                                                (ext_data.account_type = 'joint' AND ext_data.in_uscitizen = 'yes' AND ext_data.uscitizen_second_ap = 'yes')
+                                            THEN
+                                                coba_declarations.nickname != 'w8ben'
+                                            ELSE
+                                                TRUE
+                                            END
+                                        )
+                                    AND
+                                        (
+                                            CASE WHEN 
+                                                (ext_data.account_type = 'individual' AND ext_data.in_uscitizen = 'no') OR
+                                                (ext_data.account_type = 'joint' AND ext_data.in_uscitizen = 'no' AND ext_data.uscitizen_second_ap = 'no')
+                                            THEN
+                                                coba_declarations.nickname != 'w9'
+                                            ELSE
+                                                TRUE
+                                            END
+                                        )
+                                    AND
+                                        (
+                                            CASE WHEN 
+                                                (ext_data.account_type = 'corporate' AND ext_data.is_listed_company = 'yes') OR
+                                                (ext_data.account_type = 'corporate' AND ext_data.in_uscitizen = 'yes')
+                                            THEN
+                                                coba_declarations.nickname != 'w8bene'
+                                            ELSE
+                                                TRUE
+                                            END
+                                        )
+                                    
+                                    
+                            )
+                        AND
+                            (
+                                SELECT
+                                        COUNT(Images.id)
+                                FROM
+                                        Images
+                                WHERE
+                                        Images.ontable = 'coba_investor_declarations'
+                                    AND
+                                        Images.onid = coba_investor_declarations.id
+                            ) > 0
+                ) 
+                = 
+                (
+                    SELECT
+                            COUNT(coba_declarations.id)
+                    FROM
+                            coba_declarations
+                    WHERE
+                            coba_declarations.dec_type = 'checklist'
+                        AND
+                            coba_declarations.is_active = 1
+                        AND
+                            (
+                                CASE WHEN ext_data.account_type = 'individual' THEN
+                                    coba_declarations.used_by = 'I'
+                                WHEN ext_data.account_type = 'joint' THEN
+                                    coba_declarations.used_by = 'J'
+                                WHEN ext_data.account_type = 'corporate' AND ext_data.is_listed_company != 'yes' THEN
+                                    coba_declarations.used_by = 'C'
+                                WHEN ext_data.account_type = 'corporate' AND ext_data.is_listed_company = 'yes' THEN
+                                    coba_declarations.used_by = 'CL'
+                                END
+                            )
+                        AND
+                            (
+                                CASE WHEN 
+                                    (ext_data.account_type = 'individual' AND ext_data.not_have_passport = 1) OR
+                                    (ext_data.account_type = 'joint' AND ext_data.not_have_passport = 1 AND ext_data.not_have_passport_ap2 = 1)
+                                THEN
+                                    coba_declarations.nickname != 'passport_copy'
+                                ELSE
+                                    TRUE
+                                END
+                            )
+                        AND
+                            (
+                                CASE WHEN 
+                                    (ext_data.account_type = 'individual' AND ext_data.not_have_id_card = 1) OR
+                                    (ext_data.account_type = 'joint' AND ext_data.not_have_id_card = 1 AND ext_data.not_have_id_card_ap2 = 1)
+                                THEN
+                                    coba_declarations.nickname != 'id_copy'
+                                ELSE
+                                    TRUE
+                                END
+                            )
+                        AND
+                            (
+                                CASE WHEN 
+                                    (ext_data.account_type = 'individual' AND ext_data.in_uscitizen = 'yes') OR
+                                    (ext_data.account_type = 'joint' AND ext_data.in_uscitizen = 'yes' AND ext_data.uscitizen_second_ap = 'yes')
+                                THEN
+                                    coba_declarations.nickname != 'w8ben'
+                                ELSE
+                                    TRUE
+                                END
+                            )
+                        AND
+                            (
+                                CASE WHEN 
+                                    (ext_data.account_type = 'individual' AND ext_data.in_uscitizen = 'no') OR
+                                    (ext_data.account_type = 'joint' AND ext_data.in_uscitizen = 'no' AND ext_data.uscitizen_second_ap = 'no')
+                                THEN
+                                    coba_declarations.nickname != 'w9'
+                                ELSE
+                                    TRUE
+                                END
+                            )
+                        AND
+                            (
+                                CASE WHEN 
+                                    (ext_data.account_type = 'corporate' AND ext_data.is_listed_company = 'yes') OR
+                                    (ext_data.account_type = 'corporate' AND ext_data.in_uscitizen = 'yes')
+                                THEN
+                                    coba_declarations.nickname != 'w8bene'
+                                ELSE
+                                    TRUE
+                                END
+                            )
+                        
+                )
+            ) THEN
+                0
+            ELSE
+                1
+            END AS is_missing_document
+
+        ");
+       
+    }
+    
+    function toRooSingleArray($au, $q)
+    {
+        $ret = $this->toArray();
+        
+        if(!empty($q['_with_lexis_nexis'])){
+            
+            $ff = HTML_FlexyFramework::get();
+            
+            if(!empty($ff->Coba) && !empty($ff->Coba['LexisNexis'])){
+                
+                $file = "{$ff->Pman['storedir']}/soap/responses/{$ret['userdata_id']}.json";
+                
+                $ret['is_lexis_nexis_search_completed'] = (file_exists($file)) ? 1 : 0;
+                
+                $ret['total_lexis_nexis'] = 0;
+                
+                if (!$ret['is_lexis_nexis_search_completed']  ) {
+                    return $ret;
+                }
+                
+                $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+                $coba_investor_lexis_results->setFrom(array(
+                    'investor_id' => $ret['userdata_id'],
+                    'is_active' => 1
+                ));
+                $coba_investor_lexis_results->whereAdd("coba_investor_lexis_results.status != -1");
+                
+                $ret['total_lexis_nexis'] = $coba_investor_lexis_results->count();
+                
+                $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+                $coba_investor_lexis_results->setFrom(array(
+                    'investor_id' => $ret['userdata_id'],
+                    'is_active' => 1,
+                    'status' => 0
+                ));
+                
+                $ret['is_lexis_nexis_view_completed'] = ($coba_investor_lexis_results->count()) ? 0 : 1;
+                
+            }
+        }
+        
+        if(!empty($q['_with_compliance_status'])){
+            
+            $ret['compliance_status'] = 'PENDING';
+            $ret['compliance_status_by'] = '';
+            $ret['compliance_coba_investor_notes'] = 0;
+            
+            $coba_investor_notes = DB_DataObject::factory('coba_investor_notes');
+            $coba_investor_notes->setFrom(array(
+                'investor_id' => $ret['userdata_id'],
+                'note_type' => 'COMPLIANCE REJECTED'
+            ));
+            
+            if($coba_investor_notes->find(true)){
+                $ret['compliance_status'] = 'REJECTED';
+                $ret['compliance_status_by'] = DB_DataObject::factory('core_person')->load($coba_investor_notes->created_by)->name;
+                $ret['compliance_coba_investor_notes'] = $coba_investor_notes->toArray();
+            } else {
+                
+                $events = DB_DataObject::factory('Events');
+                $events->setFrom(array(
+                    'modx_users_id' => $ret['userdata_id'],
+                    'action' => 'COMPLIANCE APPROVED'
+                ));
+                
+                if($events->find(true)){
+                    $ret['compliance_status'] = 'APPROVED';
+                    $ret['compliance_status_by'] = DB_DataObject::factory('core_person')->load($events->person_id)->name;
+                }
+                
+            }
+        }
+        
+        return $ret;
+    }
+    
+    function beforeDelete($dependants, $roo)
+    {
+        $roo->jerr('ERROR', 'Record delete is not allowed');
+    }
+    
+    function beforeUpdate($old, $q,$roo)
+    {                                    
+        if(!empty($q['_is_delete'])){
+            $ff = HTML_FlexyFramework::get();
+            $pg = $ff->page;
+            $au = $pg->getAuthUser();                                  
+            if ($au->id) {
+                $this->deleted_by = $au->id;
+                $this->deleted_dt = date('Y-m-d H:i:s');                       
+            }                                     
+        }
+        
+        if(!empty($q['_accept'])){
+            
+            $e = $roo->addEvent('COMPLIANCE APPROVED', false, 'Compliance officer approved');
+        
+            $o = clone($e);
+            $e->modx_users_id = $this->userdata_id;
+            $e->update($o);
+            $roo->jok('OK');
+        }
+        
+    }
+    
+    function getUserName()
+    {
+        if($this->in_middlename !='' ) {
+            return $this->in_firstname. " " . $this->in_middlename. " " .$this->in_lastname;        
+        }
+        return $this->in_firstname. " " .$this->in_lastname;
+    }
+    
+    function getUserNameSecAp()
+    {          
+        if($this->middlename_second_ap !='' ) {
+            return $this->firstname_second_ap." " . $this->middlename_second_ap. " ".$this->lastname_second_ap;                    
+        }
+        return $this->firstname_second_ap." ".$this->lastname_second_ap;        
+    }
+    
+    function getFullName()
+    {
+        if($this->account_type == 'corporate'){
+            return $this->company_name;
+        }
+        
+        $fullname = array();
+        
+        foreach (array('in_firstname', 'in_middlename', 'in_lastname') as $k) {
+            if (empty($this->{$k})) {
+                continue;
+            }
+            
+            $fullname[] = $this->{$k};
+        }
+        
+        $fullname = implode(' ', $fullname);
+        
+        return $fullname;
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/I18n.php b/Pman/Coba/DataObjects/I18n.php
new file mode 100644 (file)
index 0000000..419a6a9
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+require_once 'Pman/Core/DataObjects/I18n.php';
+
+class Pman_Coba_DataObjects_I18n extends Pman_Core_DataObjects_I18n 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+}
diff --git a/Pman/Coba/DataObjects/Images.php b/Pman/Coba/DataObjects/Images.php
new file mode 100644 (file)
index 0000000..0f02826
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+require_once 'Pman/Core/DataObjects/Images.php';
+
+class Pman_Coba_DataObjects_Images extends Pman_Core_DataObjects_Images
+{
+    function addEvent($ar, $roo) 
+    {
+        parent::addEvent($ar, $roo);
+        
+        $this->addExtraLog($ar, $roo);
+        
+    }
+    
+    function addExtraLog($q, $roo)
+    {
+        if(empty($q['_coba_document'])){
+            return;
+        }
+        
+        if($this->ontable == 'coba_investor_declarations'){
+            
+            $coba_investor_declarations = DB_DataObject::factory('coba_investor_declarations');
+            $coba_investor_declarations->get($this->onid);
+
+            $coba_declarations = DB_DataObject::factory('coba_declarations');
+            $coba_declarations->get($coba_investor_declarations->dec_id);
+
+            $ext_data = DB_DataObject::factory('ext_data');
+            $ext_data->get('userdata_id', $coba_investor_declarations->user_id);
+            
+            $title = $coba_declarations->title;
+        }
+        
+        if($this->ontable == 'modx_users'){
+            
+            $ext_data = DB_DataObject::factory('ext_data');
+            $ext_data->get('userdata_id', $this->onid);
+            
+            $title = 'Other Documents';
+        }
+        
+        $remarks = "{$ext_data->getFullName()} has uploaded document for {$title}";
+        
+        if($q['_coba_document'] == 'remove'){
+            $remarks = "{$ext_data->getFullName()} has removed document for {$title}";
+        }
+        
+        $event = DB_DataObject::factory('Events');
+        $event->setFrom(array(
+            'event_when' => date('Y-m-d H:i:s'),
+            'action' => ($q['_coba_document'] == 'remove') ? 'REMOVE DOCUMENT' : 'UPLOAD DOCUMENT',
+            'person_table' => 'modx_users',
+            'modx_users_id' => $ext_data->userdata_id,
+            'remarks' => $remarks
+        ));
+        
+        $event->insert();
+        
+    }
+    
+    function onDelete($q, $roo)
+    {
+        $this->addExtraLog($q, $roo);
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_accountmgmts.php b/Pman/Coba/DataObjects/Modx_accountmgmts.php
new file mode 100644 (file)
index 0000000..7ceff59
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_accountmgmts extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_accountmgmts';
+    
+    function applyFilters($q, $au, $roo)
+    {
+        
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_accounts.php b/Pman/Coba/DataObjects/Modx_accounts.php
new file mode 100644 (file)
index 0000000..5fe7a24
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_accounts extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_accounts';
+    
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_backend_notifications.php b/Pman/Coba/DataObjects/Modx_backend_notifications.php
new file mode 100644 (file)
index 0000000..d96851e
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_backend_notifications extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_backend_notifications';
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_country.php b/Pman/Coba/DataObjects/Modx_country.php
new file mode 100644 (file)
index 0000000..74895b3
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_country extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_country';
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_documents.php b/Pman/Coba/DataObjects/Modx_documents.php
new file mode 100644 (file)
index 0000000..60ab53e
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_documents extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_documents';
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_frontend_notifications.php b/Pman/Coba/DataObjects/Modx_frontend_notifications.php
new file mode 100644 (file)
index 0000000..c044675
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_frontend_notifications extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_frontend_notifications';
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_session.php b/Pman/Coba/DataObjects/Modx_session.php
new file mode 100644 (file)
index 0000000..79ee278
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_session extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_session';
+    
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_site_content.php b/Pman/Coba/DataObjects/Modx_site_content.php
new file mode 100644 (file)
index 0000000..510f743
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_site_content extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_site_content';
+    
+    
+    var $route =  array(
+        1 => 'Coba',
+        5 => 'Coba/TermsOfUse',
+        7 => 'Coba/Disclaimer',
+        8 => 'Coba/PrivacyPolicy',
+        9 => 'Coba/ApplicationGuide',
+        10 => 'Coba/TermsAndCondition',
+        11 => 'Coba/Registration/FirstStep',
+        14 => 'Coba/Registration/LandingPage',
+        17 => 'Coba/Corporate/Declarations',
+        24 => 'Coba/Corporate/Banking',
+        25 => 'Coba/Corporate/Documents',
+        29 => 'Coba/Corporate/Completion',
+        30 => 'Coba/Corporate/Financial',
+        32 => 'Coba/Corporate/Contact',
+        38 => 'Coba/Corporate/SignForm',
+        64 => 'Coba/Individual/Declarations',
+        70 => 'Coba/Individual/SignForm',
+        71 => 'Coba/Individual/Banking',
+        73 => 'Coba/Individual/Documents',
+        77 => 'Coba/Individual/Profile',
+        78 => 'Coba/Individual/Completion',
+        80 => 'Coba/Individual/Dashboard',
+        81 => 'Coba/Individual/Contact',
+        83 => 'Coba/Individual/Financial',
+        110 => 'Coba/Joint/Declarations',
+        115 => 'Coba/Joint/Financial',
+        120 => 'Coba/Joint/Contact',
+        122 => 'Coba/Joint/SignForm',
+        124 => 'Coba/Joint/Banking',
+        125 => 'Coba/Joint/Completion',
+        130 => 'Coba/Joint/Documents',
+        133 => 'Coba/LoginCheckSteps'
+    );
+    
+    function getByMap($type, $class)
+    {
+        $map = implode('/', array_filter(array('Coba', $type, $class)));
+        
+        $id = 1; // default to index...
+        
+        $modx_site_content = DB_DataObject::factory('modx_site_content');
+        
+        $pg = HTML_FlexyFramework2::get()->page;
+        
+        if(array_search($map, $this->route) != false){
+            $id = array_search($map, $this->route);
+        } else {
+            $modx_site_content->alias = $pg->baseURL . '/'. $type .'/'. $class; // use the class url..
+            return $modx_site_content;
+        }
+        
+        if (!$modx_site_content->get($id)) {
+            $modx_site_content->alias = $pg->baseURL . '/'. $type .'/'. $class; // use the class url..
+            return $modx_site_content;
+        }
+        $modx_site_content->alias = $pg->rootURL .'/'. $modx_site_content->alias ;
+        return $modx_site_content;
+    }
+    
+    function redirect()
+    {
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($this->alias) || $this->alias == 'index'){
+            header("Location:{$ff->baseURL}");
+            exit;
+        }
+        
+        header("Location:{$this->alias}.html");
+        exit;
+    }
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_state.php b/Pman/Coba/DataObjects/Modx_state.php
new file mode 100644 (file)
index 0000000..ebc0052
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_state extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_state';
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/Modx_user_attributes.php b/Pman/Coba/DataObjects/Modx_user_attributes.php
new file mode 100644 (file)
index 0000000..e740bc3
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_user_attributes extends PDO_DataObject 
+{
+    public $__table = 'modx_user_attributes';
+    
+    
+}
\ No newline at end of file
diff --git a/Pman/Coba/DataObjects/Modx_users.php b/Pman/Coba/DataObjects/Modx_users.php
new file mode 100644 (file)
index 0000000..9d0dcc0
--- /dev/null
@@ -0,0 +1,973 @@
+<?php
+
+require_once 'PDO/DataObject.php';
+
+class Pman_Coba_DataObjects_Modx_users extends PDO_DataObject
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'modx_users';
+
+    function beforeInsert($request,$roo) {
+        
+        $u = DB_DataObject::Factory('modx_users');
+        $u->username = $request['username'];
+        
+        if($u->find(true)) {
+            $roo->jerr("Username already exists");
+        }
+
+        $x = DB_DataObject::Factory('ext_data');
+        $x->in_email = $request['email'];
+        
+        if($x->find(true)) {
+            $roo->jerr("Emaiil already exists");
+        }
+
+        //DB_DataObject::DebugLevel(1);
+        if (   empty($request['type'])
+            || empty($request['fund_name'])
+            || empty($request['email'])
+            || $request['pw_enter']!=$request['pw_reenter']
+            || !filter_var($request['email'], FILTER_VALIDATE_EMAIL)
+        ) {
+            $roo->jerr("Missing Data");
+        }
+        
+        $this->hash_class = 'hashing.modMD5';
+        $this->password = md5($request['new_password']);
+        
+    }
+
+    function beforeUpdate($old, $request,$roo)
+    {
+        if(!empty($request['new_password'])){
+            $this->hash_class = 'hashing.modMD5';
+            $this->password = md5($request['new_password']); 
+        }
+    }
+
+    function onInsert($q,$roo)
+    {
+        /*
+         * Checking the modx_accountmgmts
+         */
+        $modx_accountmgmts = DB_DataObject::Factory('modx_accountmgmts');
+        $modx_accountmgmts->name = $q['fund_name'];
+        
+        if(!$modx_accountmgmts->find(true)) {
+            $roo->jerr("invalid fund name '" . $q['fund_name'] ."'");
+        }
+        
+        /*
+         * Create ext_data
+         */
+        $ext_data = PDO_DataObject::factory ('ext_data');
+        
+        $ext_data->setFrom($q);
+        
+        $ext_data->setFrom(array(
+            'userdata_id' => $this->id,
+            'isin_code' => $modx_accountmgmts->isin_code,
+            'fund_name' => $modx_accountmgmts->name ,
+            'in_email' => $q['email'] ,
+            'account_type' => strtolower($q['type']),
+            'in_firstname' => (empty($q['firstname'])) ? '' : $q['firstname'],
+            'in_middlename' => (empty($q['middlename'])) ? '' : $q['middlename'],
+            'in_lastname' => (empty($q['lastname'])) ? '' : $q['lastname'],
+            'firstname_second_ap' => (empty($q['firstname_sec_ap'])) ? '' : $q['firstname_sec_ap'],
+            'middlename_second_ap' => (empty($q['middlename_sec_ap'])) ? '' : $q['middlename_sec_ap'],
+            'lastname_second_ap' => (empty($q['lastname_sec_ap'])) ? '' : $q['lastname_sec_ap'],
+            'in_username' => (empty($q['username'])) ? '' : $q['username'],
+            'investment_advisor_id' => (empty($q['investment_advisor_id'])) ? 0 : $q['investment_advisor_id']
+        ));
+        
+        $ext_data->insert();
+        
+        $fullname = array();
+        
+        foreach(array('in_firstname', 'in_middlename', 'in_lastname') as $k) {
+            if (empty($ext_data->{$k})) {
+                continue;
+            }
+            $fullname[] = $ext_data->{$k};
+        }
+        
+        $fullname = implode(' ', $fullname);
+        
+        /*
+         * Create modx_account
+         */
+        $modx_accounts = PDO_DataObject::factory ('modx_accounts');
+        
+        $modx_accounts->setFrom(array(
+            'user_id' => $this->id,
+            'isin_code' => $ext_data->isin_code,
+            'isin_original_code' => $ext_data->isin_code,
+            'name' => $ext_data->fund_name,
+            'user_fullname' => $fullname,
+            'user_account_type' => $ext_data->account_type
+        ));
+        
+        $modx_accounts->insert();
+        /*
+         * Create modx_user_attributes
+         */
+        $modx_user_attributes = PDO_DataObject::factory ('modx_user_attributes');
+        $modx_user_attributes->setFrom(array(
+            'internalKey' => $this->id,
+            'fullname' => $fullname,
+            'email' => $ext_data->in_email
+        ));
+        
+        $modx_user_attributes->insert();
+        
+        /*
+         * Create Event Log
+         */
+        
+        $event = DB_DataObject::factory('Events');
+        $event->setFrom(array(
+            'event_when' => date('Y-m-d H:i:s'),
+            'action' => 'REGISTER',
+            'person_table' => 'modx_users',
+            'modx_users_id' => $this->id,
+            'remarks' => "{$this->username} has been created"
+        ));
+        
+        $event->insert();
+            
+    }
+    
+    function ext_data()
+    {
+        return PDO_DataObject::factory('ext_data')->load('userdata_id', $this->id);
+    }
+    
+    
+    function beforeDelete($dependants, $roo)
+    {
+         return $roo->jerr('ERROR', 'Record delete is not allowed');
+                      
+        //if(!empty($this->id)){            
+        //    $ext_data = PDO_DataObject::factory('ext_data');            
+        //    $ext_data->get('userdata_id',$this->id);                       
+        //    $ext_data->delete();
+
+        //    $cid = PDO_DataObject::factory('coba_investor_declarations');
+        //    $cid->user_id = $this->id;
+        //    foreach ($cid->fetchAll() as $c){                        
+        //        $c->delete();
+        //    }                                
+                               
+        //    $cir = PDO_DataObject::factory('coba_investor_relation');        
+        //    $cir->modx_user_id = $this->id;                                        
+        //    foreach ($cir->fetchAll() as $c){
+        //        $c->beforeDelete(array(), $roo);                        
+        //        $c->delete();
+        //    }
+            
+        //    $cp = PDO_DataObject::factory('coba_person');        
+        //    $cp->investor_id = $this->id;                                        
+        //    foreach ($cp->fetchAll() as $c){                                        
+        //        $c->delete();
+        //    }
+            
+        //    $e = PDO_DataObject::Factory('Events');
+        //    $e->whereAdd('person_id = ' . $this->id);
+        //    $e->delete(true); 
+            
+              
+        //}
+                
+    }    
+    
+    function relatedEventsWhere($q, $roo)
+    {
+         if($q['_related_on_table'] == '' && $q['_related_on_id'] == '')
+         {
+             return;
+         }
+         
+        return  "(
+                  on_table = '{$q['_related_on_table']}' 
+                  AND
+                  on_id = {$q['_related_on_id']}     
+                 )
+                 OR
+                 (
+                  on_table = 'coba_investor_relation'
+                  AND
+                  on_id in (SELECT id from coba_investor_relation where modx_user_id = {$q['_related_on_id']})
+                 )
+                 OR
+                 (
+                  on_table = 'coba_person'
+                  AND
+                  on_id in (SELECT id from coba_person where investor_id = {$q['_related_on_id']})
+                 )
+                 OR
+                 ( 
+                  on_table = 'ext_data'
+                  AND
+                  on_id in (SELECT id from ext_data where userdata_id = {$q['_related_on_id']})
+                 )
+                 OR
+                 ( 
+                  on_table = 'coba_investor_declarations'
+                  AND
+                  on_id in (SELECT id from coba_investor_declarations where user_id = {$q['_related_on_id']})
+                 )
+                 OR
+                 ( 
+                  on_table = 'coba_person_investor_profile'
+                  AND
+                  on_id in (SELECT id from coba_person_investor_profile where modx_user_id = {$q['_related_on_id']})
+                 )
+                 OR
+                 ( 
+                  on_table = 'coba_investor_lexis_results'
+                  AND
+                  on_id in (SELECT id from coba_investor_lexis_results where investor_id = {$q['_related_on_id']})
+                 )
+                 ";                       
+    }
+    
+    function authUserName($name)
+    {
+        $this->whereAdd('LENGTH(password) > 1'); 
+        $this->username = $name;
+    }
+    
+    function getFullName()
+    {
+        $ext_data = $this->ext_data();
+        
+        return $ext_data->getFullName();
+        
+    }
+    
+    function getEmailFrom()
+    {
+        $name = $this->getFullName();
+        
+        if (empty($name)) {
+            return $this->in_email;
+        }
+        return '"' . addslashes($name) . '" <' . $this->in_email . '>';
+    }
+    
+    function active()
+    { 
+        return $this->active;
+    }
+    
+    function checkPassword($val)
+    {
+        return md5($val) == $this->password;
+    }
+    
+    function genPassKey ($t) 
+    {
+        return md5($this->username . $t . $this->password);
+    }
+    
+    function setPassword($value)
+    {
+        $this->password = md5($value);
+    }
+    
+    function login() 
+    {
+        @session_start();
+        
+        if (empty($this->id)) {
+            return false;
+        }
+
+        $ext_data = $this->ext_data();
+
+        if (empty($ext_data->id)) {
+            return false;
+        }
+
+        $modx_token_array = array(
+            'modx.user.0.resourceGroups' => array(
+                'web' => array()
+            ),
+            'modx.user.0.attributes' => array(
+                'web' => array(
+                    'modAccessContext' => array(
+                        'web' => array(
+                            '0' => array(
+                                'principal' => 0,
+                                'authority' => 0,
+                                'policy' => array(
+                                    'load' => 1
+                                )
+                            )
+                        )
+                    ),
+                    'modAccessResourceGroup' => array(),
+                    'modAccessCategory' => array(),
+                    'sources.modAccessResourceGroup' => array(),
+                    'modAccessNamespace' => array()
+                )
+            ),
+            'modx.user.contextTokens' => array(
+                'web' => $this->id
+            ),
+            'modx.web.user.token' => array('modx56c40ae4272610.40167821_107659a4dff3c93758.93495480'),
+            'modx.web.session.cookie.lifetime' => array(0),
+            'modx.web.user.config' => array(),
+            'modx.user.' . $this->id . '.resourceGroups' => array(
+                'web' => array()
+            ),
+            'modx.user.' . $this->id . '.attributes' => array(
+                'web' => array(
+                    'modAccessContext' => array(),
+                    'modAccessResourceGroup' => array(),
+                    'modAccessCategory' => array(),
+                    'sources.modAccessResourceGroup' => array(),
+                    'modAccessNamespace' => array()
+                )
+            ),
+            'modx.mgr.user.token' => array('modx56c40ae4272610.40167821_159794824ebf884.45346569'),
+            'modx.mgr.session.cookie.lifetime' => array(0),
+            'modx.mgr.user.config' => array(),
+            'newResourceTokens' => array()
+        );
+        
+        foreach ($modx_token_array as $key => $value) {
+            $_SESSION[$key] = $value;
+        }
+        
+        return true;
+        
+    }
+    
+    function sendPasswordResetEmail()
+    {
+        $ff = HTML_FlexyFramework::get();
+        
+        $templateDir = $this->clientFilePath('/mail/investor_password_reset_request.txt', true);
+        
+        if(empty($templateDir)){
+            return false;
+        }
+        
+        $ts = time();
+        
+        $ext_data = $this->ext_data();
+        
+        $contents = array(
+            'subject' => "[Coba] {$ext_data->getFullName()} as requested password reset",
+            'fromEmail' => 'admin@capital-company.coba-kyc.com',
+            'person' => $this,
+            'authFrom' => $ts,
+            'authKey' => $this->genPassKey($ts)
+        );
+
+        $cfg = array(
+            'template'=> 'investor_password_reset_request',
+            'templateDir' => $templateDir,
+            'page' => $ff,
+            'contents' => $contents,
+            'css_embed' => true
+        );
+
+        require_once 'Pman/Core/Mailer.php';
+        
+        $r = new Pman_Core_Mailer($cfg);
+
+        return $r->send();
+    }
+    
+    function sendLexisNexisComplianceEmail()
+    {
+        $event = DB_DataObject::factory('Events');
+        $event->setFrom(array(
+            'action' => 'LEXIS NEXIS COMPLIANCE EMAIL',
+            'person_table' => 'modx_users',
+            'modx_users_id' => $this->id
+        ));
+        
+        if($event->find(true)){
+            return true;
+        }
+        
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba['client_dir'])) {
+            return false;
+        }
+        
+        require_once 'Pman/Core/Mailer.php';
+        
+        $templateDir = $this->clientFilePath('/mail/lexis_nexis_notice_compliance_officers.txt', true);
+        
+        if(empty($templateDir)){
+            return false;
+        }
+        
+        $rcpts = DB_DataObject::factory('core_group')->lookupMembers('Compliance Officers','email');
+        
+        if (empty($rcpts)) {
+            return false;
+        }
+        
+        $contents = array(
+            'subject' => "[Coba] Application needs review",
+            'fromEmail' => 'admin@capital-company.coba-kyc.com',
+            'rcpts' => implode(',', $rcpts),
+            'investor' => $this
+        );
+
+        $cfg = array(
+            'template'=> 'lexis_nexis_notice_compliance_officers',
+            'templateDir' => $templateDir,
+            'page' => $ff,
+            'contents' => $contents,
+            'css_embed' => true
+        );
+
+        $r = new Pman_Core_Mailer($cfg);
+        
+        $sent = $r->send();
+        
+        $event = DB_DataObject::factory('Events');
+        $event->setFrom(array(
+            'event_when' => date('Y-m-d H:i:s'),
+            'action' => 'LEXIS NEXIS COMPLIANCE EMAIL',
+            'person_table' => 'modx_users',
+            'modx_users_id' => $this->id,    
+            'remarks' => 'Send Lexis Nexis Compliance Officers Email'
+        ));
+        
+        $event->insert();
+        
+        return $sent;
+        
+    }
+    
+    function sendComplianceRejectionEmail()
+    {
+        $ff = HTML_FlexyFramework::get();
+        
+        $ext_data = $this->ext_data();
+        
+        $core_person = DB_DataObject::factory('core_person');
+        
+        if(
+                empty($ff->Coba['client_dir']) ||
+                empty($ext_data->investment_advisor_id) ||
+                !$core_person->get($ext_data->investment_advisor_id) ||
+                empty($core_person->email)
+        ) {
+            return false;
+        }
+        
+        require_once 'Pman/Core/Mailer.php';
+        
+        $templateDir = $this->clientFilePath('/mail/investor_compliance_rejection.txt', true);
+        
+        if(empty($templateDir)){
+            return false;
+        }
+        
+        $contents = array(
+            'subject' => "[Coba] Compliance office rejection",
+            'fromEmail' => 'admin@capital-company.coba-kyc.com',
+            'person' => $core_person,
+            'investor' => $ext_data
+        );
+
+        $cfg = array(
+            'template'=> 'investor_compliance_rejection',
+            'templateDir' => $templateDir,
+            'page' => $ff,
+            'contents' => $contents,
+            'css_embed' => true
+        );
+        
+        $r = new Pman_Core_Mailer($cfg);
+        
+        return $r->send();
+        
+    }
+    
+    function sendCompletionEmail($checklist)
+    {
+        $ff = HTML_FlexyFramework::get();
+        
+        $ext_data = $this->ext_data();
+        
+        $core_person = DB_DataObject::factory('core_person');
+        
+        if(
+                empty($ff->Coba['client_dir']) ||
+                empty($ext_data->investment_advisor_id) ||
+                !$core_person->get($ext_data->investment_advisor_id) ||
+                empty($core_person->email)
+        ) {
+            return false;
+        }
+        
+        require_once 'Pman/Core/Mailer.php';
+        
+        $templateDir = $this->clientFilePath('/mail/investor_submitted.txt', true);
+        
+        if(empty($templateDir)){
+            return false;
+        }
+        
+        $contents = array(
+            'subject' => "[Coba] {$ext_data->getFullName()} as submitted the Coba application",
+            'fromEmail' => 'admin@capital-company.coba-kyc.com',
+            'person' => $core_person,
+            'investor' => $ext_data,
+            'CheckList' => $checklist
+        );
+
+        $cfg = array(
+            'template'=> 'investor_submitted',
+            'templateDir' => $templateDir,
+            'page' => $ff,
+            'contents' => $contents,
+            'css_embed' => true
+        );
+        
+        $r = new Pman_Core_Mailer($cfg);
+        
+        return $r->send();
+    }
+    
+    static function clientFilePath($file, $isDir = false)
+    {
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba['client_dir'])){
+            return false;
+        }
+        
+        $defaultDir = $ff->rootDir . "/Coba/Clients/default";
+        $specificDir = $ff->rootDir . "/Coba/Clients/{$ff->Coba['client_dir']}";
+        
+        $defaultFile = $ff->rootDir . "/Coba/Clients/default/{$file}";
+        $specificFile = $ff->rootDir . "/Coba/Clients/{$ff->Coba['client_dir']}/{$file}";
+        
+        if(file_exists($specificFile)) {
+            return (empty($isDir)) ? $specificFile : $specificDir;
+        }
+
+        if (file_exists($defaultFile)) {
+            return (empty($isDir)) ? $defaultFile : $defaultDir;
+        }
+
+        return false;
+
+    }
+    
+    function getLexisNexisStoreName()
+    {
+        $opts = HTML_FlexyFramework::get()->Pman;
+        
+        return implode( '/', array(
+            $opts['storedir'], 'soap', 'responses', $this->id . '.json'
+        ));
+    }
+    
+    function cleanLexisNexisResults()
+    {
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->id,
+            'status' => 0
+        ));
+        
+        foreach ($coba_investor_lexis_results->fetchAll() as $c){
+            $c->delete();
+        }
+        
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->id
+        ));
+        
+        foreach ($coba_investor_lexis_results->fetchAll() as $c){
+            $o = clone ($c);
+            $c->is_active = 0;
+            $c->update($o);
+        }
+        
+        $fn = $this->getLexisNexisStoreName();
+        
+        $dest = dirname($fn);
+        
+        if (!file_exists($dest)) {
+            $oldumask = umask(0);
+            mkdir($dest, 0775, true);
+            umask($oldumask);  
+        }
+        
+        if(!file_exists($fn)){
+            return;
+        }
+        
+        unlink($fn);
+        
+    }
+    
+    static $entityID = array();
+    
+    function syncLexisNexisResult($data)
+    {
+        if(empty($data->EntityUniqueID) || in_array($data->EntityUniqueID, self::$entityID)){
+            return;
+        }
+        
+        self::$entityID[] = $data->EntityUniqueID;
+        
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->id,
+            'match_id' => $data->EntityUniqueID
+        ));
+        
+        if($coba_investor_lexis_results->find(true)){
+                
+            $o = clone ($coba_investor_lexis_results);
+
+            $coba_investor_lexis_results->setFrom(array(
+                'json_detail' => json_encode($data),
+                'updated_dt' => date('Y-m-d'),
+                'is_active' => 1
+            ));
+            
+            $coba_investor_lexis_results->update($o);
+
+            return;
+        }
+
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+
+        $coba_investor_lexis_results->setFrom(array(
+            'json_detail' => json_encode($data),
+            'investor_id' => $this->id,
+            'match_id' => $data->EntityUniqueID,
+            'updated_by' => 0,
+            'updated_dt' => date('Y-m-d'),
+            'reason' => '',
+            'is_active' => 1,
+            'status' => 0
+        ));
+
+        $coba_investor_lexis_results->insert();
+        
+    }
+    
+    function toLexisNexisParams($roo)
+    {
+        $params = array();
+        
+        $clientReference = md5("{$this->id}-" . date('Y-m-d H:i:s'));
+        
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba) || empty($ff->Coba['LexisNexis'])){
+            $roo->jerr('Missing Coba[LexisNexis] Settings');
+        }
+        
+        $ret = array(
+            'context' => array(
+                'ClientID' => 'VeridateHK',
+                'ClientReference' => $clientReference,
+                'Password' => $ff->Coba['LexisNexis']['password'],
+                'UserID' => $ff->Coba['LexisNexis']['username']
+            ),
+            'config' => array(
+                'AssignResultTo' => array(
+                    'EmailNotification' => true,
+                    'RolesOrUsers' => array(
+                        'string' => 'Administrator'
+                    ),
+                    'Type' => 'Role'
+                ),
+                'PredefinedSearchName' => 'List Screening',
+                'WriteResultsToDatabase' => true
+            ),
+            'input' => array(
+                'Records' => array(
+                    'InputRecord' => array(
+                        'Entity' => array()
+                    )
+                )
+            )
+        );
+        
+        $this->ext_data = $this->ext_data();
+        
+        switch ($this->ext_data->account_type) {
+            
+            case 'individual' :
+                
+                $ret['input']['Records']['InputRecord']['Entity'] = $this->toPersonalLexisNexisEntiry(false, $roo);
+                
+                $params[] = $ret;
+                
+                break;
+            case 'joint' :
+                
+                $clientReference = md5("{$this->id}-Joint-First-Applicant-" . date('Y-m-d H:i:s'));
+                
+                $ret['context']['ClientReference'] = $clientReference;
+                
+                $ret['input']['Records']['InputRecord']['Entity'] = $this->toPersonalLexisNexisEntiry(false, $roo);
+                
+                $params[] = $ret;
+                
+                $clientReference = md5("{$this->id}-Joint-Second-Applicant" . date('Y-m-d H:i:s'));
+                
+                $ret['context']['ClientReference'] = $clientReference;
+                
+                $ret['input']['Records']['InputRecord']['Entity'] = $this->toPersonalLexisNexisEntiry(true, $roo);
+                
+                $params[] = $ret;
+                
+                break;
+            case 'corporate' :
+                break;
+            default :
+                break;
+        }
+        
+        return $params;
+    }
+    
+    function toPersonalLexisNexisEntiry($is_second, $roo)
+    {
+        $entity = array(
+            'EntityType' => 'Individual'
+        );
+        
+        $in_title = (empty($is_second)) ? $this->ext_data->in_title : $this->ext_data->title_second_ap;
+        
+        if(!empty($in_title)){
+            $entity['Gender'] = ($in_title == 'Mr') ? 'Male' : 'Female';
+        }
+        
+        $name = array();
+        
+        $in_firstname = (empty($is_second)) ? $this->ext_data->in_firstname : $this->ext_data->firstname_second_ap;
+        
+        if(!empty($in_firstname)){
+            $name['First'] = $in_firstname;
+        }
+        
+        $in_lastname = (empty($is_second)) ? $this->ext_data->in_lastname : $this->ext_data->lastname_second_ap;
+        
+        if(!empty($in_lastname)){
+            $name['Last'] = $in_lastname;
+        }
+        
+        $in_middlename = (empty($is_second)) ? $this->ext_data->in_middlename : $this->ext_data->middlename_second_ap;
+        
+        if(!empty($in_middlename)){
+            $name['Middle'] = $in_middlename;
+        }
+        
+        if(!empty($name)){
+            $entity['Name'] = $name;
+        }
+        
+        $InputAdditionalInfo = array();
+        
+        $in_dob = (empty($is_second)) ? $this->ext_data->in_dob : $this->ext_data->sec_dob;
+        
+        if(!empty($in_dob) && $in_dob != '0000-00-00') {
+            $day = date('j', strtotime($in_dob));
+            $month = date('n', strtotime($in_dob));
+            $year = date('Y', strtotime($in_dob));
+            
+            if(checkdate($month, $day, $year)){
+                $InputAdditionalInfo[] = array(
+                    'Date' => array(
+                        'Day' => $day,
+                        'Month' => $month,
+                        'Year' => $year
+                    ),
+                    'Type' => 'DOB'
+                );
+            }
+        }
+        
+        $in_nationality = (empty($is_second)) ? $this->ext_data->in_nationality : $this->ext_data->nationality_second_ap;
+        $in_other_nationality = (empty($is_second)) ? $this->ext_data->in_other_nationality : $this->ext_data->other_nationality_second_ap;
+        
+        if(!empty($in_nationality) || !empty($in_other_nationality)){
+            
+            $InputAdditionalInfo[] = array(
+                'Type' => 'Nationality',
+                'Value' => empty($in_nationality) ? $in_other_nationality : $in_nationality
+            );
+            
+            $InputAdditionalInfo[] = array(
+                'Type' => 'Citizenship',
+                'Value' => empty($in_nationality) ? $in_other_nationality : $in_nationality
+            );
+            
+        }
+        
+        if(!empty($InputAdditionalInfo)){
+            $entity['AdditionalInfo'] = array(
+                'InputAdditionalInfo' => $InputAdditionalInfo
+            );
+        }
+        
+        $InputID = array();
+        
+        $not_have_passport = (empty($is_second)) ? $this->ext_data->not_have_passport : $this->ext_data->not_have_passport_ap2;
+        $in_id_passport_number = (empty($is_second)) ? $this->ext_data->in_id_passport_number : $this->ext_data->id_passport_number_second_ap;
+        
+        if(empty($not_have_passport) && !empty($in_id_passport_number)){
+            
+            $passport = array(
+                'Number' => $in_id_passport_number,
+                'Type' => 'Passport'
+            );
+            
+            $date_of_issue = (empty($is_second)) ? $this->ext_data->date_of_issue : $this->ext_data->date_of_issue_partner;
+            
+            if(!empty($date_of_issue) && $date_of_issue != '0000-00-00') {
+                $day = date('j', strtotime($date_of_issue));
+                $month = date('n', strtotime($date_of_issue));
+                $year = date('Y', strtotime($date_of_issue));
+
+                if(checkdate($month, $day, $year)){
+                    $passport['DateIssued'] = array(
+                        'Day' => $day,
+                        'Month' => $month,
+                        'Year' => $year
+                    );
+                }
+            }
+            
+            $date_of_expiry = (empty($is_second)) ? $this->ext_data->date_of_expiry : $this->ext_data->date_of_expiry_partner;
+            
+            if(!empty($date_of_expiry) && $date_of_expiry != '0000-00-00') {
+                $day = date('j', strtotime($date_of_expiry));
+                $month = date('n', strtotime($date_of_expiry));
+                $year = date('Y', strtotime($date_of_expiry));
+
+                if(checkdate($month, $day, $year)){
+                    $passport['DateExpires'] = array(
+                        'Day' => $day,
+                        'Month' => $month,
+                        'Year' => $year
+                    );
+                }
+            }
+            
+            $InputID[] = $passport;
+            
+        }
+        
+        $not_have_id_card = (empty($is_second)) ? $this->ext_data->not_have_id_card : $this->ext_data->not_have_id_card_ap2;
+        $id_card_number = (empty($is_second)) ? $this->ext_data->id_card_number : $this->ext_data->id_card_number_ap2;
+        
+        if(empty($not_have_id_card) && !empty($id_card_number)){
+            
+            $id_card = array(
+                'Number' => $id_card_number,
+                'Type' => 'ProprietaryUID'
+            );
+            
+            $id_card_date_of_issue = (empty($is_second)) ? $this->ext_data->id_card_date_of_issue : $this->ext_data->id_card_date_of_issue_ap2;
+            
+            $day = date('j', strtotime($id_card_date_of_issue));
+            $month = date('n', strtotime($id_card_date_of_issue));
+            $year = date('Y', strtotime($id_card_date_of_issue));
+
+            if(checkdate($month, $day, $year)){
+                $id_card['DateIssued'] = array(
+                    'Day' => $day,
+                    'Month' => $month,
+                    'Year' => $year
+                );
+            }
+            
+            $InputID[] = $id_card;
+            
+        }
+        
+        if(!empty($InputID)){
+            $entity['IDs'] = array(
+                'InputID' => $InputID
+            );
+        }
+        
+        $address = array();
+        
+        $in_city = (empty($is_second)) ? $this->ext_data->in_city : $this->ext_data->city_second_ap;
+        
+        if(!empty($in_city)){
+            $address['City'] = $in_city;
+        }
+        
+        $in_country = (empty($is_second)) ? $this->ext_data->in_country : $this->ext_data->country_second_ap;
+        $in_country_lkey = false;
+        
+        if(!empty($in_country)){
+            $i18n = DB_DataObject::factory('i18n');
+            $i18n->setFrom(array(
+                'ltype' => 'c',
+                'inlang' => 'en',
+                'lval' => $in_country,
+                'is_active' => 1
+            ));
+            
+            if($i18n->find(true)){
+                $in_country_lkey = $i18n->lkey;
+            }
+        }
+        
+        if(!empty($in_country_lkey)){
+            $address['Country'] = $in_country_lkey;
+        }
+        
+        $in_postalcode = (empty($is_second)) ? $this->ext_data->in_postalcode : $this->ext_data->postalcode_second_ap;
+        
+        if(!empty($in_postalcode)){
+            $address['PostalCode'] = $in_postalcode;
+        }
+        
+        $in_addressline1 = (empty($is_second)) ? $this->ext_data->in_addressline1 : $this->ext_data->address_line1_second_ap;
+        
+        if(!empty($in_addressline1)){
+            $address['Street1'] = $in_addressline1;
+        }
+        
+        $in_addressline2 = (empty($is_second)) ? $this->ext_data->in_addressline2 : $this->ext_data->address_line2_second_ap;
+        
+        if(!empty($in_addressline2)){
+            $address['Street2'] = $in_addressline2;
+        }
+        
+        if(!empty($address)){
+            $address['Type'] = 'Current';
+            
+            $entity['Addresses'] = array(
+                'InputAddress' => $address
+            );
+        }
+        
+        return $entity;
+    }
+    
+    
+}
diff --git a/Pman/Coba/DataObjects/placeholder.txt b/Pman/Coba/DataObjects/placeholder.txt
new file mode 100644 (file)
index 0000000..a958ef1
--- /dev/null
@@ -0,0 +1 @@
+test placeholder 
\ No newline at end of file
diff --git a/Pman/Coba/DataObjects/pman.links.ini b/Pman/Coba/DataObjects/pman.links.ini
new file mode 100644 (file)
index 0000000..f814ceb
--- /dev/null
@@ -0,0 +1,95 @@
+
+[coba_investor_relation]
+modx_user_id = modx_users:id
+coba_person_id = coba_person:id
+parent_company_id = coba_company:id
+coba_company_id = coba_company:id
+
+[coba_person]
+office_id = core_office:id
+company_id = core_company:id
+project_id = core_project:id
+owner_id = coba_person:id
+investor_id = modx_users:id
+coba_address_id = coba_address:id
+
+[modx_users]
+
+
+[ext_data]
+userdata_id = modx_users:id
+investment_advisor_id = core_person:id
+risk_profile_invest_profile_id = core_enum:id
+
+[coba_state]
+country_id = coba_country:id
+
+[coba_company]
+coba_address_id = coba_address:id
+
+[coba_address]
+state = coba_state:id
+
+[coba_person_risk]
+
+
+[coba_person_risk_child]
+coba_person_risk_id = coba_person_risk:id
+
+[coba_person_risk_advisor]
+coba_person_risk_id = coba_person_risk:id
+
+[coba_person_risk_insurance]
+coba_person_risk_id = coba_person_risk:id
+
+[coba_person_risk_pension]
+coba_person_risk_id = coba_person_risk:id
+
+[coba_person_risk_liability]
+coba_person_risk_id = coba_person_risk:id
+
+[coba_person_risk_asset]
+coba_person_risk_id = coba_person_risk:id
+
+[coba_declarations]
+fund_id = modx_accountmgmts:id
+created_by = modx_users:id
+
+[coba_investor_declarations]
+user_id = modx_users:id
+dec_id = coba_declarations:id
+
+[coba_person_investor_profile]
+modx_user_id = ext_data:userdata_id
+info_year_invest_id = core_enum:id
+info_income_require_id = core_enum:id
+info_to_do_id = core_enum:id
+info_regular_invest_id = core_enum:id
+info_rate_id = core_enum:id
+exp_type_id = core_enum:id
+risk_fluctuate_id = core_enum:id
+risk_more_risk_id = core_enum:id
+risk_willing_id = core_enum:id
+risk_risk_taker_id = core_enum:id
+risk_familiar_id = core_enum:id
+risk_security_id = core_enum:id
+risk_suit_id = core_enum:id
+risk_year_income_id = core_enum:id
+risk_goal_id = core_enum:id
+risk_expect_normal_id = core_enum:id
+risk_expect_poor_id = core_enum:id
+risk_attitude_year_id = core_enum:id
+risk_attitude_month_id = core_enum:id
+
+[Events]
+modx_users_id = modx_users:id
+modx_users_id = ext_data:userdata_id
+
+[coba_investor_lexis_results]
+investor_id = modx_users:id
+updated_by = core_person:id
+
+[coba_investor_notes]
+investor_id = modx_users:id
+created_by = core_person:id
+
diff --git a/Pman/Coba/Import/Investors.php b/Pman/Coba/Import/Investors.php
new file mode 100644 (file)
index 0000000..bafff15
--- /dev/null
@@ -0,0 +1,382 @@
+<?php
+
+require_once 'Pman.php';
+
+//require_once 'assets/components/accounts/phpexcel/Classes/PHPExcel/IOFactory.php';
+
+
+class Pman_Coba_Import_Investors extends Pman 
+{
+
+    /**
+     *  get .. same as roo... 
+     * 
+     */
+    var $column_map = array(
+        'NAME' => 'name',
+        'LAST NAME' => 'last_name',
+        'FIRST NAME' => 'first_name',
+        'MIDDLE NAME' => 'middle_name',
+        'SPOUSE NAME' => 'spouse_name',
+        'ADVISOR' => 'advisor',
+        'CONTRACT SIGNED DATE' => 'contract_sign_date',
+        'CLIENT SUPPORT' => 'client_support',
+        'E-MAIL' => 'email',
+        'ADDRESS 1' => 'address_1',
+        'ADDRESS 2' => 'address_2',
+        'CITY' => 'city',
+        'STATE/PROVINCE' => 'province',
+        'ZIP/POSTAL CODE' => 'zip',
+        'COUNTRY/REGION' => 'country',
+        'CLIENT TYPE' => 'client_type'
+    );
+    var $import_duplicate = false;
+    var $row_array = array();
+
+    function getAuth() 
+    {
+        if (HTML_FlexyFramework::get()->cli) {
+            return true;
+        }
+        
+        return parent::getAuth();
+    }
+
+    function get() 
+    {
+        $this->jerr('Invalid URL');
+    }
+
+    function post() 
+    {
+        if (isset($_POST['import_duplicate']) && $_POST['import_duplicate']) {
+            $this->import_duplicate = true;
+        }
+
+        $img = DB_DataObject::Factory('images');
+        $img->setFrom(array(
+            'onid' => 0,
+            'ontable' => 'investor'
+        ));
+
+        $img->onUpload(false);
+
+        require_once 'File/Convert.php';
+        $fc = new File_Convert($img->getStoreName(), $img->mimetype);
+
+        $csv = $fc->convert('text/csv');
+
+        if (!$csv) {
+            $this->jerr("Error", "File Convert Error");
+        }
+
+        $this->validateCsv($csv);
+        
+        $this->importCsv($csv);
+    }
+
+    function validateCsv($csv) 
+    {
+
+        ini_set("auto_detect_line_endings", true);
+
+        $fh = fopen($csv, 'r');
+        
+        if (!$fh) {
+            $this->jerr("Error", "invalid file");
+        }
+        
+        $bom = "\xEF\xBB\xBF";
+        for ($i = 0; $i < 3; $i++) {
+            if ($bom[$i] != fgetc($fh)) {
+                fseek($fh, 0);
+                break;
+            }
+        }
+
+        // we need to break this into cols..
+        $cols = false;
+
+        $count = 1;
+        $error_msg = '';
+        while (false !== ($n = fgetcsv($fh, 10000, ',', '"'))) {
+
+            if (!$cols) {
+
+                $cols = array();
+                foreach ($n as $k) {
+                    $cols[] = strtoupper(trim($k));
+                }
+
+                continue;
+            }
+            $row = array();
+            $row['row_no'] = $count + 1;
+            //print_r($cols);
+            foreach ($cols as $i => $k) {
+                //$row[$k] = $n[$i];
+                $row[$this->column_map[$k]] = trim($n[$i]);
+            }
+            //print_r($row);
+            $this->validateRow($row);
+
+            if (!$this->import_duplicate) {
+                if (in_array($row['email'], $this->row_array)) {
+                    $error_msg .= 'Row ' . $row['row_no'] . ' : ' . $row['email'] . '<br>';
+                } else {
+                    $this->row_array[] = $row['email'];
+                }
+            }
+
+            $count++;
+        }
+
+        fclose($fh);
+        if (strlen($error_msg) > 0) {
+            $this->jerr('duplicate', 'Duplicated email in file<br>' . $error_msg);
+        }
+    }
+
+    function advisor($name) 
+    {
+        static $cache = array();
+        if (isset($cache[$name])) {
+            return $cache[$name]->id;
+        }
+        $p = PDO_DataObject::factory('core_person')->
+            set([ 'name' => $name, 'active' => 1]);
+        if ($p->count() > 1) {
+            $this->jerr("Error", "more than one entry for '$name'");
+        }
+        try {
+            $p = PDO_DataObject::factory('core_person')->load('name', $name);
+            $cache[$name] = $p;
+            return $p->id;
+        } catch (PDO_DataObject_Exception_NoData $e) {
+            return 0;
+        }
+    }
+
+    function importCsv($csv) 
+    {
+        ini_set("auto_detect_line_endings", true);
+
+        $fh = fopen($csv, 'r');
+        if (!$fh) {
+            $this->jerr("Error", "invalid file");
+        }
+        $bom = "\xEF\xBB\xBF";
+        for ($i = 0; $i < 3; $i++) {
+            if ($bom[$i] != fgetc($fh)) {
+                fseek($fh, 0);
+                break;
+            }
+        }
+
+        // we need to break this into cols..
+        $cols = false;
+        $count = 1;
+        $error_msg = '';
+        while (false !== ($n = fgetcsv($fh, 10000, ',', '"'))) {
+
+            if (!$cols) {
+
+                $cols = array();
+                foreach ($n as $k) {
+                    $cols[] = strtoupper(trim($k));
+                }
+
+                continue;
+            }
+            $row = array();
+            $row['row_no'] = $count + 1;
+
+            foreach ($cols as $i => $k) {
+                //$row[$k] = $n[$i];
+                $row[$this->column_map[$k]] = trim($n[$i]);
+            }
+
+            $error_msg .= $this->importRow($row);
+            $count++;
+        }
+
+        fclose($fh);
+
+        if (strlen($error_msg) > 0) {
+            $this->jerr('duplicate record', 'Records already exist in System<br>' . $error_msg);
+        }
+        $this->jok("DONE");
+    }
+
+    function validateRow($row) 
+    {
+        $error_msg = '';
+
+        //if(trim($row['name']) =='') {            
+        //    $error_msg.= ' Missing Name, ';
+        //}
+        if ($row['first_name'] == '') {
+            $error_msg .= ' Missing First Name, ';
+        }
+
+        if ($row['last_name'] == '') {
+            $error_msg .= ' Missing Last Name, ';
+        }
+
+        if ($row['email'] == '') {
+            $error_msg .= ' Missing Email, ';
+        }
+        if ($row['client_type'] == '') {
+            $error_msg .= ' Missing Type, ';
+        }
+        if (strtolower($row['client_type']) == 'joint' && $row['spouse_name'] == '') {
+            $error_msg .= ' Missing Spouse, ';
+        }
+        if (strtolower($row['client_type']) == 'corporate' && $row['name'] == '') {
+            $error_msg .= ' Missing Company Name, ';
+        }
+        if ($row['spouse_name'] != '') {
+            $second_user_name_array = explode(" ", $row['spouse_name']);
+            if (count($second_user_name_array) == 1) {
+                $error_msg .= ' Incorrect Spouse Firstname or Lastname, ';
+            }
+        }
+
+        if (!$this->advisor($row['advisor'])) {
+            $error_msg .= ' Missing Advisor - not registered : ' . $row['advisor'];
+        }
+
+        if (strlen($error_msg) > 0) {
+            $this->jerr("invalid data", 'Row ' . $row['row_no'] . ' : ' . $error_msg);
+        }
+    }
+
+    function importRow($row) 
+    {
+        $ff = HTML_FlexyFramework::get();
+        if (empty($ff->Coba['default_fund'])) {
+            $this->jerr("Error", "No default fund");
+        }
+
+        $accmgt = DB_DataObject::Factory('modx_accountmgmts');
+        $accmgt->isin_code = trim($ff->Coba['default_fund']);
+
+        if ($accmgt->find(true)) {
+            $isin_code = $accmgt->isin_code;
+        }
+
+        if (empty($isin_code)) {
+            $this->jerr("Error", "Invalid fund name");
+        }
+
+        $u = DB_DataObject::Factory('modx_users');
+        $u->username = trim($row['email']);
+
+        if ($u->find(true)) {
+            return 'Row ' . $row['row_no'] . ' : ' . $row['email'] . '<br>';
+            //$this->jerr("Error","Users already exists : " . $row['email'] );
+        }
+
+        $u->setFrom(array(
+            'username' => trim($row['email']),
+            'investment_advisor' => trim($row['advisor'])
+        ));
+
+
+        $u->insert();
+
+        // create modx_accounts
+        $o = PDO_DataObject::factory('modx_accounts');
+
+        $o->setFrom(array(
+            'user_id' => $u->id,
+            'isin_code' => $isin_code,
+            'isin_original_code' => $isin_code,
+            'name' => $ff->Coba['default_fund'],
+            'user_account_type' => strtolower($row['client_type'])
+        ));
+        $o->insert();
+
+        // create ext_data 
+        $e = PDO_DataObject::factory('ext_data');
+
+        $spouse_firstname = '';
+        $spouse_lastname = '';
+        $company_name = '';
+
+        if (trim($row['spouse_name']) != '') {
+            $second_user_name_array = explode(" ", $row['spouse_name']);
+            if (count($second_user_name_array) > 1) {
+                $spouse_firstname = trim($second_user_name_array[0]);
+                $spouse_lastname = trim($second_user_name_array[1]);
+            }
+        }
+
+        if (trim(strtolower($row['client_type'])) == 'corporate') {
+            $company_name = $row['name'];
+        }
+
+
+        $e->setFrom(array(
+            'userdata_id' => $u->id,
+            'isin_code' => $isin_code,
+            'fund_name' => $ff->Coba['default_fund'],
+            'in_email' => $row['email'],
+            'account_type' => strtolower($row['client_type']),
+            'company_name' => $company_name,
+            'firstname_second_ap' => $spouse_firstname,
+            'lastname_second_ap' => $spouse_lastname,
+            'in_firstname' => $row['first_name'],
+            'in_lastname' => $row['last_name'],
+            'in_middlename' => $row['middle_name'],
+            'in_addressline1' => $row['address_1'],
+            'in_addressline2' => $row['address_2'],
+            'in_city' => $row['city'],
+            'in_country' => $row['country'],
+            'in_postalcode' => $row['zip'],
+            'province' => $row['province'],
+            'investment_advisor_id' => $this->advisor($row['advisor'])
+        ));
+        $e->insert();
+
+        $fullname = array();
+
+        foreach (array('in_firstname', 'in_middlename', 'in_lastname') as $k) {
+            if (empty($e->{$k})) {
+                continue;
+            }
+            $fullname[] = $e->{$k};
+        }
+
+        $fullname = implode(' ', $fullname);
+
+        $modx_user_attributes = PDO_DataObject::factory('modx_user_attributes');
+        $modx_user_attributes->setFrom(array(
+            'internalKey' => $u->id,
+            'fullname' => $fullname,
+            'email' => $e->in_email
+        ));
+
+        $modx_user_attributes->insert();
+
+        /*
+         * Create Event Log
+         */
+        
+        $name = ($e->account_type == 'corporate') ? $company_name : $fullname;
+        
+        $event = DB_DataObject::factory('Events');
+        $event->setFrom(array(
+            'event_when' => date('Y-m-d H:i:s'),
+            'action' => 'REGISTER',
+            'person_table' => 'modx_users',
+            'modx_users_id' => $u->id,
+            'remarks' => "{$name} has been imported"
+        ));
+        
+        $event->insert();
+        
+        return;
+    }
+
+}
diff --git a/Pman/Coba/LexisNexis/Base.php b/Pman/Coba/LexisNexis/Base.php
new file mode 100644 (file)
index 0000000..568312c
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Coba_LexisNexis_Base extends Pman
+{
+    var $soapClient = false;
+    
+    var $settings = array();
+    
+    var $wsdl = false;
+    
+    var $storeDir = false;
+    
+    var $responseDir = false;
+    
+    function getAuth()
+    {
+        if(!extension_loaded('soap')) {
+            $this->jerr('Please install php-soap');
+        }
+
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba) || empty($ff->Coba['LexisNexis'])){
+            $this->jerr('Missing Coba[LexisNexis] Settings');
+        }
+        
+        $this->settings = $ff->Coba['LexisNexis'];
+        
+        $this->storeDir = "{$ff->Pman['storedir']}/soap";
+        
+        if(!file_exists("{$ff->Pman['storedir']}/soap")){
+            
+            $oldumask = umask(0);
+            mkdir($this->storeDir, 0775, true);
+            umask($oldumask);
+        }
+        
+        $this->wsdl = "{$ff->Pman['storedir']}/soap/LexisNexis.xml";
+        
+        if(!file_exists($this->wsdl)){
+            file_put_contents($this->wsdl, file_get_contents($this->settings['wsdl']));
+        }
+        
+        $this->responseDir = "{$this->storeDir}/responses";
+        
+        if (!file_exists($this->responseDir)) {
+            $oldumask = umask(0);
+            mkdir($this->responseDir, 0775, true);
+            umask($oldumask);  
+        }
+        
+        try{
+            
+            $this->soapClient = new SoapClient($this->wsdl, array("trace"=>1));
+            
+        } catch(SoapFault $e) {
+            $this->jerr($e->getMessage());
+        }
+        
+        return true;
+    }
+    
+}
diff --git a/Pman/Coba/LexisNexis/Search.php b/Pman/Coba/LexisNexis/Search.php
new file mode 100644 (file)
index 0000000..b1e838b
--- /dev/null
@@ -0,0 +1,204 @@
+<?php
+
+require_once 'Pman/Coba/LexisNexis/Base.php';
+
+class Pman_Coba_LexisNexis_Search extends Pman_Coba_LexisNexis_Base
+{
+    var $modx_user = false;
+    
+    var $ext_data = false;
+    
+    function get($id, $opt = array())
+    {
+        $this->modx_user = DB_DataObject::factory('modx_users');
+        
+        if(empty($id) || !$this->modx_user->get($id)){
+            $this->jerr('Invalid URL');
+        }
+        
+        $this->modx_user->cleanLexisNexisResults();
+        
+        $params = $this->modx_user->toLexisNexisParams($this);
+        
+        $results = array();
+        
+        foreach ($params as $p){
+            
+            try{
+            
+                $response = $this->soapClient->Search($p);
+                
+                if(
+                        empty($response) ||
+                        empty($response->SearchResult) || 
+                        empty($response->SearchResult->ClientReference) || 
+                        $response->SearchResult->ClientReference != $p['context']['ClientReference']
+                ) {
+                    continue;
+                }
+                
+                $results[$response->SearchResult->ClientReference] = $response;
+                
+                if(
+                        empty($response->SearchResult->Records) || 
+                        empty($response->SearchResult->Records->ResultRecord) || 
+                        empty($response->SearchResult->Records->ResultRecord->Watchlist) || 
+                        empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches) || 
+                        empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch)
+                ) {
+                    continue;
+                }
+                
+                $matches = $response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch;
+                $matches = is_array($matches) ? $matches : array($matches);
+
+                foreach ($matches as $m){
+                    $this->modx_user->syncLexisNexisResult($m);
+                }
+                
+
+            } catch(SoapFault $e) {
+
+                $this->jerr($e->getMessage());
+            }
+            
+        }
+        
+        print_R($results);exit;
+        
+        $fn = $this->modx_user->getLexisNexisStoreName();
+        
+        file_put_contents($fn, json_encode($results));
+        
+        exit;
+        
+        try{
+            
+            $response = $this->soapClient->Search($params);
+            
+            file_put_contents("{$this->responseDir}/{$this->modx_user->id}.json", json_encode($response));
+            
+            if(
+                    !empty($response->SearchResult) && 
+                    !empty($response->SearchResult->Records) && 
+                    !empty($response->SearchResult->Records->ResultRecord) && 
+                    !empty($response->SearchResult->Records->ResultRecord->Watchlist) && 
+                    !empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches) && 
+                    !empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch)
+            ) {
+                $results = $response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch;
+                $results = is_array($results ) ? $results : array($results);
+            }
+            
+            if(empty($results)){
+                $this->modx_user->sendLexisNexisComplianceEmail();
+            }
+            
+        } catch(SoapFault $e) {
+            
+            $this->jerr($e->getMessage());
+        }
+        
+        $this->addActivityLog();
+        
+        $this->syncResults($results);
+        
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->modx_user->id,
+            'is_active' => 1
+        ));
+        
+        $total = $coba_investor_lexis_results->count();
+        
+        $this->jdata(array(
+            'total' => $total
+        ));
+    }
+    
+    function addActivityLog()
+    {
+        $e = $this->addEvent('LEXIS NEXIS SEARCH', false, 'Lexis Nexis Fetched');
+        
+        $o = clone($e);
+        $e->modx_users_id = $this->ext_data->userdata_id;
+        $e->update($o);
+    }
+    
+    function syncResults($results)
+    {
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->modx_user->id,
+            'status' => 0
+        ));
+        
+        foreach ($coba_investor_lexis_results->fetchAll() as $c){
+            $c->delete();
+        }
+        
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        $coba_investor_lexis_results->setFrom(array(
+            'investor_id' => $this->modx_user->id
+        ));
+        
+        foreach ($coba_investor_lexis_results->fetchAll() as $c){
+            $o = clone ($c);
+            $c->is_active = 0;
+            $c->update($o);
+        }
+        
+        if(empty($results)){
+            return;
+        }
+        
+        $processed = array();
+        
+        foreach ($results as $r){
+            
+            if(empty($r->EntityUniqueID) || in_array($r->EntityUniqueID, $processed)){
+                continue;
+            }
+            
+            $processed[] = $r->EntityUniqueID;
+            
+            $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+            $coba_investor_lexis_results->setFrom(array(
+                'investor_id' => $this->modx_user->id,
+                'match_id' => $r->EntityUniqueID
+            ));
+            
+            if($coba_investor_lexis_results->find(true)){
+                
+                $o = clone ($coba_investor_lexis_results);
+                
+                $coba_investor_lexis_results->is_active = 1;
+                $coba_investor_lexis_results->update($o);
+                
+                continue;
+            }
+            
+            $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+            $coba_investor_lexis_results->setFrom(array(
+                'investor_id' => $this->modx_user->id,
+                'match_id' => $r->EntityUniqueID,
+                'updated_by' => 0,
+                'updated_dt' => date('Y-m-d'),
+                'reason' => '',
+                'is_active' => 1,
+                'status' => 0
+            ));
+            
+            $coba_investor_lexis_results->insert();
+            
+        }
+        
+    }
+    
+    
+}
diff --git a/Pman/Coba/ModxSession.php b/Pman/Coba/ModxSession.php
new file mode 100644 (file)
index 0000000..24752f8
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+
+require_once 'Pman.php';
+require_once 'Coba.php';
+
+class Pman_Coba_ModxSession extends Pman 
+{
+   
+    function getAuth()
+    {
+        //parent::getAuth(); // load company!
+        $au = $this->getAuthUser();
+        
+        if (!$au || !$au->pid()) {
+            
+            $this->jerr("authenticated Users only");
+        }
+        
+        
+        $this->authUser = $au;
+        return true;
+    }
+    
+   
+    function get()
+    {
+         if(empty($_GET['investor_id']) || empty($_GET['account_type'])) { 
+            $this->jerror('ERROR','Missing user_id or account_type', $errors=array(), $content_type = false);
+            return;
+        }
+        // investor ID
+        $user_id = trim($_GET['investor_id']); 
+        $account_type = trim($_GET['account_type']);   
+            // creating the session data array
+        
+        $modx_token_array = array( 'modx.user.0.resourceGroups' => array('web'=>array()),
+            'modx.user.0.attributes'=> array(
+                'web'=> array(
+                    'modAccessContext' =>  array(
+                        'web'=>  array(
+                            '0'=>  array(
+                                'principal' => 0,
+                                'authority' => 0, 
+                                'policy' => array(
+                                    'load' => 1
+                                )
+                            )
+                         )
+                    ), 
+                    'modAccessResourceGroup' => array(),
+                    'modAccessCategory' => array(),
+                    'sources.modAccessResourceGroup' => array(),
+                    'modAccessNamespace' => array()
+                )
+            ),
+            
+            'modx.user.contextTokens' => array(
+                    'web'=>$user_id
+            ),
+            'modx.web.user.token' => array( 'modx56c40ae4272610.40167821_107659a4dff3c93758.93495480'),
+            'modx.web.session.cookie.lifetime' => array(0),
+            'modx.web.user.config' => array(),
+                
+            'modx.user.'.$user_id.'.resourceGroups' => array(
+                'web'=>array()
+            ),
+            'modx.user.'.$user_id.'.attributes'  => array(
+                'web'=> array(
+                    'modAccessContext' => array(),
+                    'modAccessResourceGroup' => array(),
+                    'modAccessCategory' => array(),
+                    'sources.modAccessResourceGroup' => array(),
+                    'modAccessNamespace' => array()
+                )
+            ),         
+            'modx.mgr.user.token' =>array('modx56c40ae4272610.40167821_159794824ebf884.45346569'),
+            'modx.mgr.session.cookie.lifetime' => array(0),
+            'modx.mgr.user.config' => array(),
+            'newResourceTokens' => array()
+        );
+        $modx_token_str ='';                                   
+        foreach($modx_token_array as $key => $value) {
+            $_SESSION[$key] = $value;
+        }
+    
+        $modx_site_content = DB_DataObject::factory('modx_site_content')->getByMap(ucfirst($account_type), 'Contact');
+        
+        $url = "{$modx_site_content->alias}.html";
+        
+        $this->jok($url);
+        
+    }
+    
+    
+}
diff --git a/Pman/Coba/Passport/Dump.php b/Pman/Coba/Passport/Dump.php
new file mode 100644 (file)
index 0000000..cc8b601
--- /dev/null
@@ -0,0 +1,169 @@
+<?php
+require_once 'Pman.php';
+
+class Pman_Coba_Passport_Dump extends Pman
+{
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id)
+    {
+        $x = PDO_DataObject::factory('ext_data');
+        $x->autoJoin();
+        $x->get('userdata_id',$userdata_id);
+        $ext_data = $x->toArray();
+        
+        $y = PDO_DataObject::factory('coba_person_investor_profile');
+        $y->autoJoin();
+        $y->setFrom(array(
+             'modx_user_id' => $userdata_id,
+         ));
+        $inv_prof = $y->fetchAll(false, false, 'toArray');
+        
+        $data = array_merge($ext_data, $inv_prof);
+        
+        $json_data = json_encode($data, JSON_PRETTY_PRINT);
+        
+        print_r($json_data);exit;
+        
+        $uid = isset($ext_data['id_card_number']) ?
+            $ext_data['in_dob']."-".$ext_data['id_card_number'] :
+            $ext_data['in_dob']."-".$ext_data['in_id_passport_number'];
+
+        $storedir = $this->bootLoader->Pman['storedir'];
+        $json_file_dir = "{$storedir}/{$uid}.json";
+        $zip_file_dir = "{$storedir}/{$uid}.zip";
+
+        if(!file_exists($json_file_dir)) {
+            $json_file = fopen($json_file_dir, "w") or die("cannot create/open the JSON file\n");
+            if (isset($json_file)) {
+                chmod($json_file_dir, 0777);
+                fwrite($json_file, $json_data);
+                fclose($json_file);
+            }
+        }
+        
+        if (!file_exists($zip_file_dir)) {
+            $zip = new ZipArchive;
+            if (!$zip->open($zip_file_dir, ZipArchive::CREATE)) {
+                echo "cannot open the zip file\n";
+            }
+            $zip->addFile($json_file_dir,"{$uid}.json");
+            $zip->close();
+            echo "ZipArchive::done\n";
+        }
+
+        /*
+        //encrypting the zip file
+        $data = file_get_contents($zip_file_dir);
+
+        echo $data;
+        putenv('GNUPGHOME=/home/sender/.gnupg');
+        $gpg = new gnupg();
+        $gpg->seterrormode(gnupg::ERROR_EXCEPTION);
+
+        try {
+                $keys = $gpg->keyinfo('testing');
+        } catch(Exception $e) {
+            echo 'ERROR: '.$e->getMessage();
+        }
+
+        var_dump($keys);exit;
+        */
+
+
+        /*
+        // set path to keyring directory
+        putenv('GNUPGHOME={$storedir}');
+
+        // create new GnuPG object
+        $gpg = new gnupg();
+
+        // throw exception if error occurs
+        $gpg->seterrormode(gnupg::ERROR_EXCEPTION);
+
+        // get list of keys containing string 'example'
+        try {
+          $info = $gpg->keyinfo("example");
+          print_r($info);
+        } catch (Exception $e) {
+          echo 'ERROR: ' . $e->getMessage();
+        }
+        */
+
+
+
+
+        /*
+        putenv("GNUPGHOME=/tmp");
+        $pubkey = "-----BEGIN PGP PUBLIC KEY BLOCK-----
+        Version: GnuPG v1.2.6 (GNU/Linux)
+
+        mQGiBEe68W8RBACVuFuv4d+roDSCdRO1SuO8dQwds4VTjVOqgVKQtq6+8Fe95RY8
+        BAf1IyLj4bxvWPhr0wZdVwTosD/sFoPtdCyhVcF932nP0GLHsTEeVwSz9mid22HI
+        O4Kmwj2kE+I+C9QdzAg0zaWQnVaF9UC7pIdMR6tEnADI8nkVDdZ+zb2ziwCg6Yqu
+        tk3KAzKRT1SNUzTE/n9y2PED/1tIWiXfGBGzseX0W/e1G+MjuolWOXv4BXeiFGmn
+        8wnHsQ4Z4Tzk+ag0k+6pZZXjcL6Le486wpZ9MAe6LM31XDpQDVtyCL8t63nvQpB8
+        TUimbseBZMb3TytCubNLGFe5FnNLGDciElcD09d2xC6Xv6zE2jj4GtBW1bXqYWtl
+        jm0PA/4u6av6o6pIgLRfAawspr8kaeZ8+FU4NbIiS6xZmBUEQ/o7q95VKGgFVKBi
+        ugDOlnbgSzBIwSlsRVT2ivu/XVWnhQaRCotSm3AzOc2XecqrJ6F1gqk0n+yP/1h1
+        yeTvvfS5zgqNTG2UmovjVsKFzaDqmsYZ+sYfwc209z9PY+6FuLQnQXBhY2hlVGVz
+        dCAoVGVzdGluZykgPGFwYWNoZUBsb2NhbGhvc3Q+iF4EExECAB4FAke68W8CGwMG
+        CwkIBwMCAxUCAwMWAgECHgECF4AACgkQJE9COu2PFIEGDwCglArzAza13xjbdR04
+        DQ1U9FWQhMYAnRrWQeGTRm+BYm6SghNpDOKcmMqruQENBEe68XAQBADPIO+JFe5t
+        BQmI4l60bNMNSUqsL0TtIP8G6Bpd8q2xBOemHCLfGT9Y5DN6k0nneBQxajSfWBQ5
+        ZdKFwV5ezICz9fnGisEf9LPSwctfUIcvumbcPPsrUOUZX7BuCHrcfy1nebS3myO/
+        ScTKpW8Wz8AjpKTBG55DMkXSvnx+hS+PEwADBQP/dNnVlKYdNKA70B4QTEzfvF+E
+        5lyiauyT41SQoheTMhrs/3RIqUy7WWn3B20aTutHWWYXdYV+E85/CarhUmLNZGA2
+        tml1Mgl6F2myQ/+MiKi/aj9NVhcuz38OK/IAze7kNJJqK+UEWblB2Wfa31/9nNzv
+        ewVHa1xHtUyVDaewAACISQQYEQIACQUCR7rxcAIbDAAKCRAkT0I67Y8UgRwEAKDT
+        L6DwyEZGLTpAqy2OLUH7SFKm2ACgr3tnPuPFlBtHx0OqY4gGiNMJHXE=
+        =jHPH
+        -----END PGP PUBLIC KEY BLOCK-----";
+
+        $enc = (null);
+        $res = gnupg_init();
+        echo "gnupg_init RTV = <br/><pre>\n";
+        var_dump($res);
+        echo "</pre>\n";
+        $rtv = gnupg_import($res, $pubkey);
+        echo "gnupg_import RTV = <br/><pre>\n";
+        var_dump($rtv);
+        echo "</pre>\n";
+        $rtv = gnupg_addencryptkey($res, "C25F29936D9046D73A77DCF8244F423AED8F1481");
+        echo "gnupg_addencryptkey RTV = <br /><pre>\n";
+        var_dump($rtv);
+        echo "</pre>\n";
+        $enc = gnupg_encrypt($res, $data);
+        echo "Encrypted Data: " . $enc . "<br/>";
+        */
+
+        /*
+        $config = array(
+            "digest_alg" => "sha512",
+            "private_key_bits" => 4096,
+            "private_key_type" => OPENSSL_KEYTYPE_RSA,
+        );
+
+        $res = openssl_pkey_new($config);
+        openssl_pkey_export($res, $privKey);
+
+        $pubKey = openssl_pkey_get_details($res);
+        $pubKey = $pubKey["key"];
+
+        $zip_file = fopen($zip_file_dir, "r") or die("cannot read the zip file\n ");
+        $data = fread($zip_file,filesize($zip_file_dir));
+
+        echo strlen("data length: {$data} \n");
+
+        if (openssl_public_encrypt($data, $encrypted, $pubKey)) {
+            print_r($encrypted);
+        } else {
+            echo "cannot encrypt the zip file\n";
+        }
+        */
+    }
+    
+}
diff --git a/Pman/Coba/Pman.Dialog.CobaFundManagerEdit.bjs b/Pman/Coba/Pman.Dialog.CobaFundManagerEdit.bjs
new file mode 100644 (file)
index 0000000..fd211c1
--- /dev/null
@@ -0,0 +1,152 @@
+{
+ "name" : "Pman.Dialog.CobaFundManagerEdit",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaFundManagerEdit.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
+  "2b15fbffc15a21f95838d3338de6798f" : "Add Fund",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
+  "422918621aa6642c26d5ee9222765ddf" : "Fund Name",
+  "2efbd104fbdac27979de616938992e78" : "Fund Code",
+  "d41d8cd98f00b204e9800998ecf8427e" : " "
+ },
+ "items" : [
+  {
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Add Fund",
+   "items" : [
+    {
+     "xtype" : "Container",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "width: 100%",
+     "items" : [
+      {
+       "listeners" : {
+        "actionfailed" : "function (_self, action)\n{\n    if (action.type == 'submit') {\n        \n        Roo.log('faul');\n        \n    }\n}",
+        "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'submit') {\n        \n        Roo.log('teststestset');\n        \n    }\n}",
+        "render" : "function (_self)\n{\n    _this.form = this;\n}"
+       },
+       "xtype" : "Form",
+       "$ xns" : "Roo.bootstrap",
+       "String method" : "GET",
+       "$ String url" : "baseURL + '/Roo/Modx_accountmgmts'",
+       "items" : [
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Number md" : 12,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "String name" : "isin_code",
+             "xtype" : "Input",
+             "string fieldLabel" : "Fund Code",
+             "String labelAlign" : "top",
+             "$ xns" : "Roo.bootstrap"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Number md" : 12,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "String name" : "name",
+             "xtype" : "Input",
+             "String labelAlign" : "top",
+             "string fieldLabel" : "Fund Name",
+             "$ xns" : "Roo.bootstrap"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Number md" : 2,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "String target" : "is_active",
+             "xtype" : "FieldLabel",
+             "$ xns" : "Roo.bootstrap",
+             "String html" : "Active",
+             "String style" : "line-height: 40px;"
+            }
+           ]
+          },
+          {
+           "Number md" : 3,
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "String name" : "is_active",
+             "Boolean checked" : false,
+             "xtype" : "CheckBox",
+             "String valueOff" : 0,
+             "string fieldLabel" : " ",
+             "$ xns" : "Roo.bootstrap",
+             "String inputValue" : 1
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "Number md" : 12,
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "String weight" : "danger",
+           "xtype" : "Button",
+           "$ xns" : "Roo.bootstrap",
+           "String html" : "Cancel",
+           "String style" : "margin: 10px; float:right"
+          },
+          {
+           "listeners" : {
+            "click" : "function (_self, e)\n{\n    _this.form.doAction('submit');\n}"
+           },
+           "String weight" : "primary",
+           "xtype" : "Button",
+           "$ xns" : "Roo.bootstrap",
+           "String html" : "Add",
+           "String style" : "margin: 10px; float:right"
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaFundManagerEdit.js b/Pman/Coba/Pman.Dialog.CobaFundManagerEdit.js
new file mode 100644 (file)
index 0000000..af6106b
--- /dev/null
@@ -0,0 +1,216 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaFundManagerEdit= function() {}
+Roo.apply(Pman.Dialog.CobaFundManagerEdit.prototype, {
+
+ _strings : {
+  'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
+  '2b15fbffc15a21f95838d3338de6798f' :"Add Fund",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
+  '422918621aa6642c26d5ee9222765ddf' :"Fund Name",
+  '2efbd104fbdac27979de616938992e78' :"Fund Code",
+  'd41d8cd98f00b204e9800998ecf8427e' :" "
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    title : _this._strings['2b15fbffc15a21f95838d3338de6798f'] /* Add Fund */,
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    items  : [
+     {
+      xtype : 'Container',
+      style : 'width: 100%',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Form',
+        method : 'GET',
+        url : baseURL + '/Roo/Modx_accountmgmts',
+        listeners : {
+         actioncomplete : function (_self, action)
+          {
+              if(action.type == 'submit') {
+                  
+                  Roo.log('teststestset');
+                  
+              }
+          },
+         actionfailed : function (_self, action)
+          {
+              if (action.type == 'submit') {
+                  
+                  Roo.log('faul');
+                  
+              }
+          },
+         render : function (_self)
+          {
+              _this.form = this;
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['2efbd104fbdac27979de616938992e78'] /* Fund Code */,
+              labelAlign : 'top',
+              name : 'isin_code',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 12,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              fieldLabel : _this._strings['422918621aa6642c26d5ee9222765ddf'] /* Fund Name */,
+              labelAlign : 'top',
+              name : 'name',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         },
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            md : 2,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'FieldLabel',
+              html : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
+              style : 'line-height: 40px;',
+              target : 'is_active',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           },
+           {
+            xtype : 'Column',
+            md : 3,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'CheckBox',
+              checked : false,
+              fieldLabel : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*   */,
+              inputValue : 1,
+              name : 'is_active',
+              valueOff : 0,
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          md : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Button',
+            html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+            style : 'margin: 10px; float:right',
+            weight : 'danger',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           },
+           {
+            xtype : 'Button',
+            html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
+            style : 'margin: 10px; float:right',
+            weight : 'primary',
+            listeners : {
+             click : function (_self, e)
+              {
+                  _this.form.doAction('submit');
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaFundManagerEdit, Pman.Dialog.CobaFundManagerEdit.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.bjs
new file mode 100644 (file)
index 0000000..efb30fa
--- /dev/null
@@ -0,0 +1,107 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorChangeAdvisor",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "5cfee765454e9ab499d547c20476f696" : "Change Advisor",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "c9cc8cce247e49bae79f15173ce97354" : "Save",
+  "76f6e3fca8e568586bf04d22f80c5628" : "Please select an advisor"
+ },
+ "items" : [
+  {
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Change Advisor",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{\n    Roo.log(action);\n    \n    var err = 'Please fill in all the request fields';\n    \n    if (typeof(action) != 'undefined' && (action.failureType == 'server' || action.failureType == 'load')) {    \n        err = action.result.errorMsg;\n    }\n    \n    Roo.bootstrap.MessageBox.alert('Error', err);\n\n}",
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        \n        if(_this.data.id * 1 > 0) {\n            this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});\n        }\n        \n        return;\n    }\n   \n    if (action.type == 'load') {\n    \n        _this.data = action.result.data;\n        \n        return;\n    }\n    \n    \n    if (action.type == 'submit') {\n    \n        _this.dialog.hide();\n       \n        if (_this.callback) {\n            _this.callback.call(this, action.result.data);\n        }\n        \n        return; \n    }\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL + '/Roo/Ext_data'",
+     "xtype" : "Form",
+     "String labelAlign" : "top",
+     "$ xns" : "Roo.bootstrap",
+     "items" : [
+      {
+       "Number pageSize" : 25,
+       "Boolean allowBlank" : false,
+       "Number minChars" : 2,
+       "String name" : "investment_advisor_id_name",
+       "String valueField" : "id",
+       "String queryParam" : "query[name_starts]",
+       "Boolean typeAhead" : true,
+       "xtype" : "ComboBox",
+       "String triggerAction" : "all",
+       "Boolean editable" : false,
+       "Boolean alwaysQuery" : true,
+       "string placeholder" : "Please select an advisor",
+       "$ xns" : "Roo.bootstrap",
+       "String/Roo.Template tpl" : "<div class=\"roo-select2-result\"><b>{name}</b></div>",
+       "String hiddenName" : "investment_advisor_id",
+       "String displayField" : "name",
+       "items" : [
+        {
+         "listeners" : {
+          "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    o.params.active = 1;\n    \n    o.params.in_group_name = 'Adviser';\n}"
+         },
+         "xtype" : "Store",
+         "boolean remoteSort" : true,
+         "$ xns" : "Roo.data",
+         "$ sortInfo" : "{field:\"name\",direction:\"ASC\"}",
+         "* prop" : "store",
+         "items" : [
+          {
+           "xtype" : "HttpProxy",
+           "$ xns" : "Roo.data",
+           "String method" : "GET",
+           "* prop" : "proxy",
+           "$ String url" : "baseURL+'/Roo/Core_person'"
+          },
+          {
+           "xtype" : "JsonReader",
+           "$ xns" : "Roo.data",
+           "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    }\n]",
+           "* prop" : "reader"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "String name" : "id",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide(); \n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Cancel",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.form.doAction(\"submit\");\n\n    return;\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Save",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.js b/Pman/Coba/Pman.Dialog.CobaInvestorChangeAdvisor.js
new file mode 100644 (file)
index 0000000..34ccc00
--- /dev/null
@@ -0,0 +1,203 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorChangeAdvisor= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorChangeAdvisor.prototype, {
+
+ _strings : {
+  '5cfee765454e9ab499d547c20476f696' :"Change Advisor",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'c9cc8cce247e49bae79f15173ce97354' :"Save",
+  '76f6e3fca8e568586bf04d22f80c5628' :"Please select an advisor"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    title : _this._strings['5cfee765454e9ab499d547c20476f696'] /* Change Advisor */,
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide(); 
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.form.doAction("submit");
+        
+            return;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      labelAlign : 'top',
+      url : baseURL + '/Roo/Ext_data',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+                
+                if(_this.data.id * 1 > 0) {
+                    this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
+                }
+                
+                return;
+            }
+           
+            if (action.type == 'load') {
+            
+                _this.data = action.result.data;
+                
+                return;
+            }
+            
+            
+            if (action.type == 'submit') {
+            
+                _this.dialog.hide();
+               
+                if (_this.callback) {
+                    _this.callback.call(this, action.result.data);
+                }
+                
+                return; 
+            }
+        },
+       actionfailed : function (_self, action)
+        {
+            Roo.log(action);
+            
+            var err = 'Please fill in all the request fields';
+            
+            if (typeof(action) != 'undefined' && (action.failureType == 'server' || action.failureType == 'load')) {    
+                err = action.result.errorMsg;
+            }
+            
+            Roo.bootstrap.MessageBox.alert('Error', err);
+        
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'ComboBox',
+        allowBlank : false,
+        alwaysQuery : true,
+        displayField : 'name',
+        editable : false,
+        hiddenName : 'investment_advisor_id',
+        minChars : 2,
+        name : 'investment_advisor_id_name',
+        pageSize : 25,
+        placeholder : _this._strings['76f6e3fca8e568586bf04d22f80c5628'] /* Please select an advisor */,
+        queryParam : 'query[name_starts]',
+        tpl : '<div class=\"roo-select2-result\"><b>{name}</b></div>',
+        triggerAction : 'all',
+        typeAhead : true,
+        valueField : 'id',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        store : {
+         xtype : 'Store',
+         remoteSort : true,
+         sortInfo : {field:"name",direction:"ASC"},
+         listeners : {
+          beforeload : function (_self, o)
+           {
+               o.params = o.params || {};
+               
+               o.params.active = 1;
+               
+               o.params.in_group_name = 'Adviser';
+           }
+         },
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         proxy : {
+          xtype : 'HttpProxy',
+          method : 'GET',
+          url : baseURL+'/Roo/Core_person',
+          xns : Roo.data,
+          '|xns' : 'Roo.data'
+         },
+         reader : {
+          xtype : 'JsonReader',
+          fields : [
+              {
+                  'name': 'id',
+                  'type': 'int'
+              },
+              {
+                  'name': 'name',
+                  'type': 'string'
+              }
+          ],
+          xns : Roo.data,
+          '|xns' : 'Roo.data'
+         }
+        }
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'id',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorChangeAdvisor, Pman.Dialog.CobaInvestorChangeAdvisor.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.bjs
new file mode 100644 (file)
index 0000000..bf91320
--- /dev/null
@@ -0,0 +1,117 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorChangePassword",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/khlau/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "150526edf0f88e7bfd828dc679d4daeb" : "Retype Password",
+  "8f1e77e0d2be21da93cd4d9a939148f7" : "Change Password",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "ae3bb2a1ac61750150b606298091d38a" : "New Password",
+  "51eea3dc60ae3a0b1bb8188bc6337dc2" : "enter password",
+  "32ab89ebb0ab2b1b4062993bff92cc41" : "retype password",
+  "e0aa021e21dddbd6d8cecec71e9cf564" : "OK"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n//    _this.form.clearInvalid();\n}"
+   },
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Change Password",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{\n   _this.submit_button.enable();\n   _this.submit_button.setText('OK');\n   \n   switch(action.failureType) {\n    case Roo.form.Action.SERVER_INVALID: \n       Roo.bootstrap.MessageBox.alert(\"Server Error\", action.result.errorMsg);\n       break;\n    case Roo.form.Action.CLIENT_INVALID: //for validation\n       Roo.bootstrap.MessageBox.alert(\"Client Error\", action.result.errorMsg);\n       break;\n    case Roo.form.Action.CONNECT_FAILURE:\n       Roo.bootstrap.MessageBox.alert(\"Connect Error\", action.result.errorMsg);\n       break;\n    default: \n       Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg);\n       break;\n       \n    }\n}",
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n       if(_this.data.id * 1 > 0) {\n            _this.userdata_id.setValue(_this.data.id);\n            _this.form.clearInvalid();\n       }\n        return;\n    }\n\n\n    if (action.type =='submit') {\n        Roo.log('test submit');\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        _this.form.reset();\n        \n        _this.submit_button.enable();\n        _this.submit_button.setText('OK');\n        _this.dialog.hide({});\n        return;\n    }\n\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL+'/Roo/Modx_users'",
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:15px;",
+     "String method" : "POST",
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.pw_enter = this; \n}",
+            "change" : "function (_self, newValue, oldValue)\n{\n    _this.pw_reenter.markInvalid('unmatch2');\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "new_password",
+           "xtype" : "Input",
+           "string placeholder" : "enter password",
+           "String labelAlign" : "top",
+           "string fieldLabel" : "New Password",
+           "String inputType" : "password",
+           "$ xns" : "Roo.bootstrap"
+          },
+          {
+           "listeners" : {
+            "valid" : "function (_self)\n{\n    if (_this.pw_enter.getValue() != _this.pw_reenter.getValue()){\n        _this.pw_reenter.markInvalid('unmatch2');\n    }\n}",
+            "render" : "function (_self)\n{\n    _this.pw_reenter = this;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "retype_password",
+           "xtype" : "Input",
+           "string placeholder" : "retype password",
+           "String labelAlign" : "top",
+           "string fieldLabel" : "Retype Password",
+           "String inputType" : "password",
+           "$ xns" : "Roo.bootstrap"
+          },
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.userdata_id = _self;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "id",
+           "xtype" : "Input",
+           "string placeholder" : "enter password",
+           "String labelAlign" : "top",
+           "String inputType" : "hidden",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n\n}",
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide({});\n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Cancel",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.submit_button = this;\n}",
+      "click" : "function (_self, e)\n{\n    if(!_this.form.isValid()){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');\n        return;\n    }\n    \n    if (_this.form.findField('new_password')) {\n            \n        var p1 = _this.form.findField('new_password').getValue();\n        var p2 = _this.form.findField('retype_password').getValue();\n\n        if (p1.length || p2.length) {\n            if (p1 != p2) {\n                Roo.bootstrap.MessageBox.alert(\"Error\", \"Passwords do not match\");\n                return;\n            }\n        }\n            \n        \n   }\n    _this.form.doAction('submit');\n    _this.submit_button.disable();\n    _this.submit_button.setText('sending...');\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "OK",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.js b/Pman/Coba/Pman.Dialog.CobaInvestorChangePassword.js
new file mode 100644 (file)
index 0000000..9008e57
--- /dev/null
@@ -0,0 +1,253 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorChangePassword= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorChangePassword.prototype, {
+
+ _strings : {
+  '150526edf0f88e7bfd828dc679d4daeb' :"Retype Password",
+  '8f1e77e0d2be21da93cd4d9a939148f7' :"Change Password",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'ae3bb2a1ac61750150b606298091d38a' :"New Password",
+  '51eea3dc60ae3a0b1bb8188bc6337dc2' :"enter password",
+  '32ab89ebb0ab2b1b4062993bff92cc41' :"retype password",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    title : _this._strings['8f1e77e0d2be21da93cd4d9a939148f7'] /* Change Password */,
+    listeners : {
+     show : function (_self)
+      {
+      //    _this.form.clearInvalid();
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide({});
+        },
+       render : function (_self)
+        {
+        
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(!_this.form.isValid()){
+                Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
+                return;
+            }
+            
+            if (_this.form.findField('new_password')) {
+                    
+                var p1 = _this.form.findField('new_password').getValue();
+                var p2 = _this.form.findField('retype_password').getValue();
+        
+                if (p1.length || p2.length) {
+                    if (p1 != p2) {
+                        Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
+                        return;
+                    }
+                }
+                    
+                
+           }
+            _this.form.doAction('submit');
+            _this.submit_button.disable();
+            _this.submit_button.setText('sending...');
+        },
+       render : function (_self)
+        {
+            _this.submit_button = this;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      method : 'POST',
+      style : 'margin:15px;',
+      url : baseURL+'/Roo/Modx_users',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+               if(_this.data.id * 1 > 0) {
+                    _this.userdata_id.setValue(_this.data.id);
+                    _this.form.clearInvalid();
+               }
+                return;
+            }
+        
+        
+            if (action.type =='submit') {
+                Roo.log('test submit');
+                
+                if (_this.callback) {
+                    _this.callback.call(_this, action.result);
+                }
+                _this.form.reset();
+                
+                _this.submit_button.enable();
+                _this.submit_button.setText('OK');
+                _this.dialog.hide({});
+                return;
+            }
+        
+        },
+       actionfailed : function (_self, action)
+        {
+           _this.submit_button.enable();
+           _this.submit_button.setText('OK');
+           
+           switch(action.failureType) {
+            case Roo.form.Action.SERVER_INVALID: 
+               Roo.bootstrap.MessageBox.alert("Server Error", action.result.errorMsg);
+               break;
+            case Roo.form.Action.CLIENT_INVALID: //for validation
+               Roo.bootstrap.MessageBox.alert("Client Error", action.result.errorMsg);
+               break;
+            case Roo.form.Action.CONNECT_FAILURE:
+               Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
+               break;
+            default: 
+               Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
+               break;
+               
+            }
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            fieldLabel : _this._strings['ae3bb2a1ac61750150b606298091d38a'] /* New Password */,
+            inputType : 'password',
+            labelAlign : 'top',
+            name : 'new_password',
+            placeholder : _this._strings['51eea3dc60ae3a0b1bb8188bc6337dc2'] /* enter password */,
+            listeners : {
+             change : function (_self, newValue, oldValue)
+              {
+                  _this.pw_reenter.markInvalid('unmatch2');
+              },
+             render : function (_self)
+              {
+                  _this.pw_enter = this; 
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           },
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            fieldLabel : _this._strings['150526edf0f88e7bfd828dc679d4daeb'] /* Retype Password */,
+            inputType : 'password',
+            labelAlign : 'top',
+            name : 'retype_password',
+            placeholder : _this._strings['32ab89ebb0ab2b1b4062993bff92cc41'] /* retype password */,
+            listeners : {
+             render : function (_self)
+              {
+                  _this.pw_reenter = this;
+              },
+             valid : function (_self)
+              {
+                  if (_this.pw_enter.getValue() != _this.pw_reenter.getValue()){
+                      _this.pw_reenter.markInvalid('unmatch2');
+                  }
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           },
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            inputType : 'hidden',
+            labelAlign : 'top',
+            name : 'id',
+            placeholder : _this._strings['51eea3dc60ae3a0b1bb8188bc6337dc2'] /* enter password */,
+            listeners : {
+             render : function (_self)
+              {
+                  _this.userdata_id = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorChangePassword, Pman.Dialog.CobaInvestorChangePassword.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.bjs
new file mode 100644 (file)
index 0000000..d83c36c
--- /dev/null
@@ -0,0 +1,97 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorComplianceReject",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "c3829f941b2eb369a4eb1788396c5556" : "explain why you reject this investor",
+  "babca5bf265170c851ad830547a20f02" : "Please explain why reject this investor",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "e0aa021e21dddbd6d8cecec71e9cf564" : "OK",
+  "539d24367a77a2a7b50a66bf7c4e6cf0" : "COMPLIANCE REJECTED"
+ },
+ "items" : [
+  {
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Please explain why reject this investor",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{\n    Roo.log(action);\n    \n    var err = 'Please Correct all the errors in red';\n   \n    if (\n            typeof(action) != 'undefined' && \n            (\n                action.failureType == 'server' ||\n                action.failureType == 'load'\n            )\n    ) {\n        err = action.result.errorMsg;\n    }\n    \n    Roo.bootstrap.MessageBox.alert('Error', err);\n    return;\n    \n}",
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n    \n        return;\n    }\n\n\n    if (action.type =='submit') {\n        \n        _this.dialog.hide();\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.form.reset();\n        \n        return;\n    }\n\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL+'/Roo/coba_investor_notes'",
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:15px;",
+     "String method" : "POST",
+     "Boolean loadMask" : false,
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : false,
+           "String name" : "notes",
+           "xtype" : "TextArea",
+           "string placeholder" : "explain why you reject this investor",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "String name" : "id",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      },
+      {
+       "String name" : "investor_id",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      },
+      {
+       "String name" : "note_type",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap",
+       "string value" : "COMPLIANCE REJECTED"
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Cancel",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.form.doAction('submit');\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "OK",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.js b/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReject.js
new file mode 100644 (file)
index 0000000..a48edb1
--- /dev/null
@@ -0,0 +1,182 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorComplianceReject= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorComplianceReject.prototype, {
+
+ _strings : {
+  'c3829f941b2eb369a4eb1788396c5556' :"explain why you reject this investor",
+  'babca5bf265170c851ad830547a20f02' :"Please explain why reject this investor",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK",
+  '539d24367a77a2a7b50a66bf7c4e6cf0' :"COMPLIANCE REJECTED"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    title : _this._strings['babca5bf265170c851ad830547a20f02'] /* Please explain why reject this investor */,
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.form.doAction('submit');
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      loadMask : false,
+      method : 'POST',
+      style : 'margin:15px;',
+      url : baseURL+'/Roo/coba_investor_notes',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+            
+                return;
+            }
+        
+        
+            if (action.type =='submit') {
+                
+                _this.dialog.hide();
+                
+                if (_this.callback) {
+                    _this.callback.call(_this, action.result);
+                }
+                
+                _this.form.reset();
+                
+                return;
+            }
+        
+        },
+       actionfailed : function (_self, action)
+        {
+            Roo.log(action);
+            
+            var err = 'Please Correct all the errors in red';
+           
+            if (
+                    typeof(action) != 'undefined' && 
+                    (
+                        action.failureType == 'server' ||
+                        action.failureType == 'load'
+                    )
+            ) {
+                err = action.result.errorMsg;
+            }
+            
+            Roo.bootstrap.MessageBox.alert('Error', err);
+            return;
+            
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'TextArea',
+            allowBlank : false,
+            name : 'notes',
+            placeholder : _this._strings['c3829f941b2eb369a4eb1788396c5556'] /* explain why you reject this investor */,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'id',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'investor_id',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'note_type',
+        value : _this._strings['539d24367a77a2a7b50a66bf7c4e6cf0'] /* COMPLIANCE REJECTED */,
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorComplianceReject, Pman.Dialog.CobaInvestorComplianceReject.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.bjs
new file mode 100644 (file)
index 0000000..2272f35
--- /dev/null
@@ -0,0 +1,104 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorComplianceReview",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "d98ac12774fca5c3cbaffe276840c55f" : "Reject",
+  "c4408d335012a56ff58937d78050efad" : "Accept",
+  "57d3c3623b963750443582d79de27efc" : "Please review the Compliance Report"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    _this.acceptBtn.disableIt();\n    _this.rejectBtn.disableIt();\n    \n    var url = 'about:blank';\n    \n    if(_this.data.userdata_id * 1 > 0){\n        url = baseURL + '/Coba/Reports/ComplianceReport/' + _this.data.userdata_id;\n    }\n    \n    window.addEventListener(\"resize\", _this.compliance_report_frame.resize);\n    \n    _this.compliance_report_frame.el.dom.onload = function(){\n        \n        _this.compliance_report_frame.resize();\n    \n        var frame = _this.compliance_report_frame.el.dom.contentDocument || _this.compliance_report_frame.el.dom.contentWindow.document;\n        \n        var frameBody = Roo.get(frame.body);\n        \n        frameBody.scrollTo('top');\n        \n        frame.addEventListener('scroll', function(e) {\n            _this.compliance_report_frame.onScroll();\n        }, false);\n        \n    };\n    \n    _this.compliance_report_frame.el.dom.src = url;\n    \n    \n}"
+   },
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "Boolean fitwindow" : true,
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Please review the Compliance Report",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{\n    Roo.log(action);\n    \n    var err = 'Please Correct all the errors in red';\n   \n    if (\n            typeof(action) != 'undefined' && \n            (\n                action.failureType == 'server' ||\n                action.failureType == 'load'\n            )\n    ) {\n        err = action.result.errorMsg;\n    }\n    \n    Roo.bootstrap.MessageBox.alert('Error', err);\n    return;\n    \n}",
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n    \n        return;\n    }\n\n\n    if (action.type =='submit') {\n        \n        _this.dialog.hide();\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.form.reset();\n        \n        return;\n    }\n\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL+'/Roo/Coba_investor_lexis_results'",
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:15px;",
+     "String method" : "POST",
+     "Boolean loadMask" : false,
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "String style" : "margin-top: 15px;",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.compliance_report_frame = this;\n    \n}"
+           },
+           "String tag" : "iframe",
+           "| function resize" : "function() \n{ \n    var height = _this.dialog.bodyEl.getHeight(true);\n    \n    _this.compliance_report_frame.el.setHeight(height);\n}",
+           "| function onScroll" : "function() \n{ \n    var frame = _this.compliance_report_frame.el.dom.contentDocument || _this.compliance_report_frame.el.dom.contentWindow.document;\n        \n    var frameBody = Roo.get(frame.body);\n    \n    var scrollHeight = frameBody.dom.scrollHeight;\n    \n    var viewHeight = _this.compliance_report_frame.el.getHeight();\n    \n    var scrollTop = frame.documentElement.scrollTop || frame.body.scrollTop;\n    \n    if(scrollHeight - viewHeight > scrollTop){\n        return;\n    }\n    \n    _this.acceptBtn.enableIt();\n    _this.rejectBtn.enableIt();\n    \n}",
+           "xtype" : "Element",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "width:100%;border:none;"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "String name" : "id",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      },
+      {
+       "String name" : "status",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.acceptBtn = this;\n}",
+      "click" : "function (_self, e)\n{\n    if(_this.data.id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Invalid User ID');\n        return;\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Ext_data.php',\n        method : 'POST',\n        params : {\n            id : _this.data.id,\n            _accept : 1\n        }, \n        success : function(res) {\n            \n            _this.dialog.hide();\n            \n            if(_this.callback){\n                _this.callback.call(_this);\n            }\n            \n        }\n    });\n    \n}"
+     },
+     "| function disableIt" : "function() \n{ \n    this.setText('Scroll to end before accept');\n    this.disable();\n}",
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Accept",
+     "* prop" : "buttons[]",
+     "| function enableIt" : "function() \n{ \n    this.setText('Accept');\n    \n    this.enable();\n}"
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.rejectBtn = this;\n}",
+      "click" : "function (_self, e)\n{\n    if(_this.data.userdata_id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'Invalid User ID');\n        return;\n    }\n    \n    Pman.Dialog.CobaInvestorComplianceReject.show({\n        id : 0,\n        investor_id : _this.data.userdata_id\n    }, function(res){\n        \n        _this.dialog.hide();\n        \n        if(_this.callback){\n            _this.callback.call(_this);\n        }\n        \n    });\n    \n}"
+     },
+     "| function disableIt" : "function() \n{ \n    this.setText('Scroll to end before reject');\n    this.disable();\n}",
+     "String weight" : "danger",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Reject",
+     "* prop" : "buttons[]",
+     "| function enableIt" : "function() \n{ \n    this.setText('Reject');\n    \n    this.enable();\n}"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.js b/Pman/Coba/Pman.Dialog.CobaInvestorComplianceReview.js
new file mode 100644 (file)
index 0000000..196fdc7
--- /dev/null
@@ -0,0 +1,311 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorComplianceReview= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorComplianceReview.prototype, {
+
+ _strings : {
+  'd98ac12774fca5c3cbaffe276840c55f' :"Reject",
+  'c4408d335012a56ff58937d78050efad' :"Accept",
+  '57d3c3623b963750443582d79de27efc' :"Please review the Compliance Report"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    fitwindow : true,
+    title : _this._strings['57d3c3623b963750443582d79de27efc'] /* Please review the Compliance Report */,
+    listeners : {
+     show : function (_self)
+      {
+          _this.acceptBtn.disableIt();
+          _this.rejectBtn.disableIt();
+          
+          var url = 'about:blank';
+          
+          if(_this.data.userdata_id * 1 > 0){
+              url = baseURL + '/Coba/Reports/ComplianceReport/' + _this.data.userdata_id;
+          }
+          
+          window.addEventListener("resize", _this.compliance_report_frame.resize);
+          
+          _this.compliance_report_frame.el.dom.onload = function(){
+              
+              _this.compliance_report_frame.resize();
+          
+              var frame = _this.compliance_report_frame.el.dom.contentDocument || _this.compliance_report_frame.el.dom.contentWindow.document;
+              
+              var frameBody = Roo.get(frame.body);
+              
+              frameBody.scrollTo('top');
+              
+              frame.addEventListener('scroll', function(e) {
+                  _this.compliance_report_frame.onScroll();
+              }, false);
+              
+          };
+          
+          _this.compliance_report_frame.el.dom.src = url;
+          
+          
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      disableIt : function() 
+      { 
+          this.setText('Scroll to end before accept');
+          this.disable();
+      },
+      enableIt : function() 
+      { 
+          this.setText('Accept');
+          
+          this.enable();
+      },
+      html : _this._strings['c4408d335012a56ff58937d78050efad'] /* Accept */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(_this.data.id * 1 < 1){
+                Roo.bootstrap.MessageBox.alert('Error', 'Invalid User ID');
+                return;
+            }
+            
+            new Pman.Request({
+                url: baseURL + '/Roo/Ext_data.php',
+                method : 'POST',
+                params : {
+                    id : _this.data.id,
+                    _accept : 1
+                }, 
+                success : function(res) {
+                    
+                    _this.dialog.hide();
+                    
+                    if(_this.callback){
+                        _this.callback.call(_this);
+                    }
+                    
+                }
+            });
+            
+        },
+       render : function (_self)
+        {
+            _this.acceptBtn = this;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      disableIt : function() 
+      { 
+          this.setText('Scroll to end before reject');
+          this.disable();
+      },
+      enableIt : function() 
+      { 
+          this.setText('Reject');
+          
+          this.enable();
+      },
+      html : _this._strings['d98ac12774fca5c3cbaffe276840c55f'] /* Reject */,
+      weight : 'danger',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(_this.data.userdata_id * 1 < 1){
+                Roo.bootstrap.MessageBox.alert('Error', 'Invalid User ID');
+                return;
+            }
+            
+            Pman.Dialog.CobaInvestorComplianceReject.show({
+                id : 0,
+                investor_id : _this.data.userdata_id
+            }, function(res){
+                
+                _this.dialog.hide();
+                
+                if(_this.callback){
+                    _this.callback.call(_this);
+                }
+                
+            });
+            
+        },
+       render : function (_self)
+        {
+            _this.rejectBtn = this;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      loadMask : false,
+      method : 'POST',
+      style : 'margin:15px;',
+      url : baseURL+'/Roo/Coba_investor_lexis_results',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+            
+                return;
+            }
+        
+        
+            if (action.type =='submit') {
+                
+                _this.dialog.hide();
+                
+                if (_this.callback) {
+                    _this.callback.call(_this, action.result);
+                }
+                
+                _this.form.reset();
+                
+                return;
+            }
+        
+        },
+       actionfailed : function (_self, action)
+        {
+            Roo.log(action);
+            
+            var err = 'Please Correct all the errors in red';
+           
+            if (
+                    typeof(action) != 'undefined' && 
+                    (
+                        action.failureType == 'server' ||
+                        action.failureType == 'load'
+                    )
+            ) {
+                err = action.result.errorMsg;
+            }
+            
+            Roo.bootstrap.MessageBox.alert('Error', err);
+            return;
+            
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        style : 'margin-top: 15px;',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Element',
+            onScroll : function() 
+            { 
+                var frame = _this.compliance_report_frame.el.dom.contentDocument || _this.compliance_report_frame.el.dom.contentWindow.document;
+                    
+                var frameBody = Roo.get(frame.body);
+                
+                var scrollHeight = frameBody.dom.scrollHeight;
+                
+                var viewHeight = _this.compliance_report_frame.el.getHeight();
+                
+                var scrollTop = frame.documentElement.scrollTop || frame.body.scrollTop;
+                
+                if(scrollHeight - viewHeight > scrollTop){
+                    return;
+                }
+                
+                _this.acceptBtn.enableIt();
+                _this.rejectBtn.enableIt();
+                
+            },
+            resize : function() 
+            { 
+                var height = _this.dialog.bodyEl.getHeight(true);
+                
+                _this.compliance_report_frame.el.setHeight(height);
+            },
+            style : 'width:100%;border:none;',
+            tag : 'iframe',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.compliance_report_frame = this;
+                  
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'id',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'status',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorComplianceReview, Pman.Dialog.CobaInvestorComplianceReview.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorCreate.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorCreate.bjs
new file mode 100644 (file)
index 0000000..aaa1d30
--- /dev/null
@@ -0,0 +1,464 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorCreate",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/khlau/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorCreate.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "c55bb3f1897a02f7c3be32fc933b0e0c" : "Create Investor",
+  "5a679c50cadfca1ff5cdbd31939af3fc" : "Generated password",
+  "b60a6cfe4d8391ec9c29e11ab13216cd" : "Select Investment Advisor",
+  "e5676ba19f12f141c9d199c36ee5fde6" : "please select the fund related to the investor",
+  "c83804c010b690de6f340363e374b777" : "please enter the email of the investor",
+  "52c649c38236206862e79e77f735902d" : "Investment Advisor",
+  "e09596c4d5ca0043bbe539924e37adf9" : "please enter the username of the investor",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "ae9e6ac49d4f451b1ebf440619f595b5" : "please select the type of the investor",
+  "f6039d44b29456b20f8f373155ae4973" : "Username",
+  "51eea3dc60ae3a0b1bb8188bc6337dc2" : "enter password",
+  "c1098dd48f0fb20eeea79235055d02ca" : "Fund",
+  "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
+  "e0aa021e21dddbd6d8cecec71e9cf564" : "OK",
+  "e456949630edb405fba2217ddeef7f3c" : "Primary contact email",
+  "27f4aa512a351222967865d05016314c" : "enter password again to confirm"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n     Roo.get(document.body).mask('Loading');\n     new Pman.Request({\n        url : baseURL + '/Roo/Modx_accountmgmts' ,\n        method : 'GET',\n        params : {\n        }, \n        success : function(res) {          \n            if(res.data){\n                _this.fund_name.store.proxy.data = res;\n            }\n            new Pman.Request({\n                url : baseURL + '/Roo/core_person' ,\n                method : 'GET',\n                params : {\n                    in_group_name : 'Adviser'\n                }, \n                success : function(res) {          \n                    if(res.data){\n                        _this.advisor.store.proxy.data = res;\n                    }\n                    Roo.get(document.body).unmask();\n                },\n                failure : function(res) {\n                    Roo.get(document.body).unmask();\n                }\n            });\n        },\n        failure : function(res) {\n            Roo.get(document.body).unmask();\n        }\n    });\n}",
+    "render" : "function (_self)\n{\n    _this._confirm_dialog = Pman.Dialog.CobaInvestorCreateConfirm;\n}"
+   },
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Create Investor",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{  \n   _this.submit_button.enable();\n   _this.submit_button.setText('OK');\n   Roo.log('action call: '+action);\n   Roo.log(\"action failed\");\n   Roo.log(\"action type:\"+action.failureType);\n  \n   \n   if(action.result.errorMsg.length >= 200) {\n       Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg.substring(0,199) + '...');\n  \n   } else {\n       Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg);\n   }\n}",
+      "actioncomplete" : "function (_self, action) {\n\n    if (action.type == 'setdata') {\n        _this.check_set_pw_true.setValue('0');\n        //this.url = baseURL+'/Roo/Modx_accountmgmts'\n        //this.doAction('load', { method: 'GET', params: action.data });\n        return;\n    }\n    if (action.type == 'load') {\n        return;\n    }\n    if (action.type =='submit') {\n        Roo.log('test submit');\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n      \n        \n        _this.submit_button.enable();\n        _this.submit_button.setText('OK');\n        _this.dialog.hide();\n        if(_this._confirm_dialog) {\n            _this._confirm_dialog.show({'investor_id':action.result.data.id, 'account_type': _this.investor_type.getValue()});            \n        }\n         \n        _this.form.reset();\n        return;\n    }\n\n}",
+      "show" : "function (_self)\n{\n    //if(_this.fund_name) {\n    //    _this.fund_name.store.load({});\n    //}\n}",
+      "render" : "function (_self,e)\n{\n    _this.form = _self;\n    \n}"
+     },
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "String method" : "POST",
+     "$ String url" : "baseURL+'/Roo/Modx_users'",
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.investor_type = _self;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "type",
+           "xtype" : "ComboBox",
+           "String triggerAction" : "all",
+           "Boolean editable" : false,
+           "String labelAlign" : "top",
+           "string fieldLabel" : "Type",
+           "string placeholder" : "please select the type of the investor",
+           "$ xns" : "Roo.bootstrap",
+           "String displayField" : "value",
+           "items" : [
+            {
+             "| data" : "[\n    ['individual', 'Individual'],\n    ['corporate', 'Corporate'],\n    ['joint', 'Joint']\n]",
+             "xtype" : "SimpleStore",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[ 'code', 'value' ]",
+             "* prop" : "store"
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.fund_name = _self;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "fund_name",
+           "String triggerAction" : "all",
+           "xtype" : "ComboBox",
+           "Boolean editable" : false,
+           "String labelAlign" : "top",
+           "string fieldLabel" : "Fund",
+           "string placeholder" : "please select the fund related to the investor",
+           "Boolean alwaysQuery" : false,
+           "$ xns" : "Roo.bootstrap",
+           "String/Roo.Template tpl" : "<div class=\"roo-select2-result\"><b>{name}</b></div>",
+           "String displayField" : "name",
+           "items" : [
+            {
+             "listeners" : {
+              "beforeload" : "function (_self, options)\n{\n\n}"
+             },
+             "$ Object sortInfo" : "{field:\"name\",direction:\"ASC\"}",
+             "xtype" : "Store",
+             "boolean remoteSort" : false,
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ Array fields" : "[{'name':'name','type':'string'},{'name':'id',type:'string'}]",
+               "xtype" : "JsonReader",
+               "$ xns" : "Roo.data",
+               "* prop" : "reader"
+              },
+              {
+               "xtype" : "MemoryProxy",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.advisor = _self;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "Number minChars" : 2,
+           "String name" : "investment_advisor_id_name",
+           "String valueField" : "id",
+           "String queryParam" : "query[name]",
+           "Boolean typeAhead" : true,
+           "xtype" : "ComboBox",
+           "String triggerAction" : "all",
+           "Boolean editable" : false,
+           "Boolean alwaysQuery" : false,
+           "String labelAlign" : "top",
+           "string placeholder" : "Select Investment Advisor",
+           "$ xns" : "Roo.bootstrap",
+           "String/Roo.Template tpl" : "<div class=\"roo-select2-result\"><b>{name}</b></div>",
+           "String fieldLabel" : "Investment Advisor",
+           "String hiddenName" : "investment_advisor_id",
+           "String displayField" : "name",
+           "Boolean forceSelection" : true,
+           "String indicatorpos" : "right",
+           "items" : [
+            {
+             "listeners" : {
+              "beforeload" : "function (_self, o)\n{\n\n}"
+             },
+             "xtype" : "Store",
+             "boolean remoteSort" : false,
+             "$ xns" : "Roo.data",
+             "$ sortInfo" : "{field:\"name\",direction:\"ASC\"}",
+             "* prop" : "store",
+             "items" : [
+              {
+               "xtype" : "JsonReader",
+               "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    }\n]",
+               "$ xns" : "Roo.data",
+               "* prop" : "reader"
+              },
+              {
+               "xtype" : "MemoryProxy",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "valid" : "function (_self)\n{\n    var re = /^(([^<>()\\[\\]\\.,;:\\s@\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/;\n    if (!re.test(_this.email.getValue())){\n        _this.email.markInvalid('testing');\n    }\n}",
+            "keyup" : "function (_self, e)\n{\n//    console.debug('text box value: ' + _this.form.findField('email').getValue());\n    var email = _this.form.findField('email').getValue();\n    if(email.length>0) {\n        var res = email.split('@');\n        if(res.length>0) {\n            _this.form.findField('username').setValue(res[0]);\n        } else {\n            _this.form.findField('username').setValue(email);\n        }\n    }\n}",
+            "render" : "function (_self)\n{\n    _this.email = this;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "email",
+           "xtype" : "Input",
+           "string fieldLabel" : "Primary contact email",
+           "String labelAlign" : "top",
+           "string placeholder" : "please enter the email of the investor",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "width: inherit;"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "username",
+           "xtype" : "Input",
+           "string fieldLabel" : "Username",
+           "String labelAlign" : "top",
+           "string placeholder" : "please enter the username of the investor",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "width: inherit;"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 6,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.check_set_pw_false = this;\n}",
+            "check" : "function (_self, checked)\n{\n\n    if (checked){\n    \n    \n    _this.check_gen_pw_row.el.hide('TRUE');\n    _this.pw_enter_row.el.hide('TRUE');\n    _this.pw_gen_row.el.hide('TRUE');\n    \n    _this.pw_gen.setValue('');\n    _this.pw_enter.setValue('please enter your password');\n    _this.pw_reenter.setValue('please enter your password');\n    //_this.check_gen_pw_true.setValue('0');\n    }\n   \n    \n}"
+           },
+           "String name" : "check_set_pw",
+           "xtype" : "Radio",
+           "String valueOff" : 0,
+           "String boxLabel" : "No password",
+           "$ xns" : "Roo.bootstrap",
+           "String inputValue" : 0,
+           "String style" : "float: left; width: 200px;"
+          }
+         ]
+        },
+        {
+         "xtype" : "Column",
+         "Number xs" : 6,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.check_set_pw_true = this;\n}",
+            "check" : "function (_self, checked)\n{\n    if (checked){\n        Roo.log('return check_set_pw_true: '+checked);\n        _this.check_gen_pw_row.el.show('TRUE');\n        _this.pw_enter_row.el.hide('TURE');\n        _this.check_gen_pw_true.setValue('1');\n        _this.pw_enter.setValue('please enter your password');\n        _this.pw_reenter.setValue('please enter your password');\n\n    }\n}\n\n"
+           },
+           "String name" : "check_set_pw",
+           "xtype" : "Radio",
+           "String valueOff" : 0,
+           "String boxLabel" : "Set password",
+           "$ xns" : "Roo.bootstrap",
+           "String inputValue" : 1
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "render" : "function (_self)\n{\n    _this.check_gen_pw_row = this;\n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n}"
+       },
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 6,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "check" : "function (_self, checked)\n{\n\n    _this.pw_gen_row.el.hide('TRUE');\n    _this.pw_gen.setValue('');\n    \n    _this.pw_enter_row.el.show('TRUE');\n    _this.pw_enter.setValue('');\n    _this.pw_reenter.setValue('');\n}"
+           },
+           "String name" : "check_gen_pw",
+           "xtype" : "Radio",
+           "String boxLabel" : "Enter Password",
+           "$ xns" : "Roo.bootstrap",
+           "String inputValue" : 0,
+           "String style" : "float: left; width: 200px;"
+          }
+         ]
+        },
+        {
+         "xtype" : "Column",
+         "Number xs" : 6,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.check_gen_pw_true = this;\n}",
+            "check" : "function (_self, checked)\n{\n\n    _this.pw_gen_row.el.show('TRUE');\n    var randomPw = Math.random().toString(36).slice(-8);\n    _this.pw_gen.setValue(randomPw);\n    \n    _this.pw_enter_row.el.hide('TRUE');\n\n    _this.pw_enter.setValue('please enter your password');\n    _this.pw_reenter.setValue('please enter your password');\n    \n    \n}"
+           },
+           "String name" : "check_gen_pw",
+           "xtype" : "Radio",
+           "String boxLabel" : "Generate password",
+           "$ xns" : "Roo.bootstrap",
+           "String inputValue" : 1
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "render" : "function (_self)\n{\n    _this.pw_enter_row = this;\n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n}"
+       },
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.pw_enter = this;\n}",
+            "change" : "function (_self, newValue, oldValue)\n{\n    _this.pw_reenter.markInvalid('unmatch2');\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "pw_enter",
+           "xtype" : "Input",
+           "String labelAlign" : "top",
+           "string placeholder" : "enter password",
+           "String inputType" : "password",
+           "$ xns" : "Roo.bootstrap"
+          },
+          {
+           "listeners" : {
+            "valid" : "function (_self)\n{\n\n    if (_this.pw_enter.getValue() != _this.pw_reenter.getValue()){\n\n        _this.pw_reenter.markInvalid('unmatch2');\n\n    }\n\n}",
+            "render" : "function (_self)\n{\n    _this.pw_reenter = this;\n}"
+           },
+           "Boolean allowBlank" : false,
+           "String name" : "pw_reenter",
+           "xtype" : "Input",
+           "String labelAlign" : "top",
+           "string placeholder" : "enter password again to confirm",
+           "String inputType" : "password",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "render" : "function (_self)\n{\n    _this.pw_gen_row = this;\n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n}"
+       },
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.pw_gen = this;\n}"
+           },
+           "Boolean allowBlank" : true,
+           "String name" : "pw_gen",
+           "xtype" : "Input",
+           "String labelAlign" : "top",
+           "string fieldLabel" : "Generated password",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "render" : "function (_self)\n{\n    _this.password = this;\n}"
+       },
+       "String name" : "new_password",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      }
+     ]
+    },
+    {
+     "xtype" : "Row",
+     "$ xns" : "Roo.bootstrap",
+     "items" : [
+      {
+       "xtype" : "Column",
+       "Number xs" : 12,
+       "$ xns" : "Roo.bootstrap"
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.submit_button = this;\n}",
+      "click" : "function (_self, e)\n{\n    if(!_this.form.isValid()){\n        Roo.bootstrap.MessageBox.alert('Error','Invalid Input');\n        return;\n    }\n       \n    if(_this.check_set_pw_true.getValue() == '0'){\n        _this.password.setValue('');\n    }\n    else{\n        if(_this.check_gen_pw_true.getValue() == '0'){\n            _this.password.setValue(_this.pw_reenter.getValue());\n        }\n        else {\n            _this.password.setValue(_this.pw_gen.getValue());\n        }\n    }\n    \n    _this.form.doAction('submit');\n    _this.submit_button.disable();\n    _this.submit_button.setText('sending...');\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "OK",
+     "String style" : "float: right; margin: 10px; width:70px;",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "String weight" : "danger",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Cancel",
+     "String style" : "float: right; margin: 10px;",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorCreate.js b/Pman/Coba/Pman.Dialog.CobaInvestorCreate.js
new file mode 100644 (file)
index 0000000..186087a
--- /dev/null
@@ -0,0 +1,786 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorCreate= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorCreate.prototype, {
+
+ _strings : {
+  'c55bb3f1897a02f7c3be32fc933b0e0c' :"Create Investor",
+  '5a679c50cadfca1ff5cdbd31939af3fc' :"Generated password",
+  'b60a6cfe4d8391ec9c29e11ab13216cd' :"Select Investment Advisor",
+  'e5676ba19f12f141c9d199c36ee5fde6' :"please select the fund related to the investor",
+  'c83804c010b690de6f340363e374b777' :"please enter the email of the investor",
+  '52c649c38236206862e79e77f735902d' :"Investment Advisor",
+  'e09596c4d5ca0043bbe539924e37adf9' :"please enter the username of the investor",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'ae9e6ac49d4f451b1ebf440619f595b5' :"please select the type of the investor",
+  'f6039d44b29456b20f8f373155ae4973' :"Username",
+  '51eea3dc60ae3a0b1bb8188bc6337dc2' :"enter password",
+  'c1098dd48f0fb20eeea79235055d02ca' :"Fund",
+  'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK",
+  'e456949630edb405fba2217ddeef7f3c' :"Primary contact email",
+  '27f4aa512a351222967865d05016314c' :"enter password again to confirm"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    title : _this._strings['c55bb3f1897a02f7c3be32fc933b0e0c'] /* Create Investor */,
+    listeners : {
+     render : function (_self)
+      {
+          _this._confirm_dialog = Pman.Dialog.CobaInvestorCreateConfirm;
+      },
+     show : function (_self)
+      {
+           Roo.get(document.body).mask('Loading');
+           new Pman.Request({
+              url : baseURL + '/Roo/Modx_accountmgmts' ,
+              method : 'GET',
+              params : {
+              }, 
+              success : function(res) {          
+                  if(res.data){
+                      _this.fund_name.store.proxy.data = res;
+                  }
+                  new Pman.Request({
+                      url : baseURL + '/Roo/core_person' ,
+                      method : 'GET',
+                      params : {
+                          in_group_name : 'Adviser'
+                      }, 
+                      success : function(res) {          
+                          if(res.data){
+                              _this.advisor.store.proxy.data = res;
+                          }
+                          Roo.get(document.body).unmask();
+                      },
+                      failure : function(res) {
+                          Roo.get(document.body).unmask();
+                      }
+                  });
+              },
+              failure : function(res) {
+                  Roo.get(document.body).unmask();
+              }
+          });
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      style : 'float: right; margin: 10px; width:70px;',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(!_this.form.isValid()){
+                Roo.bootstrap.MessageBox.alert('Error','Invalid Input');
+                return;
+            }
+               
+            if(_this.check_set_pw_true.getValue() == '0'){
+                _this.password.setValue('');
+            }
+            else{
+                if(_this.check_gen_pw_true.getValue() == '0'){
+                    _this.password.setValue(_this.pw_reenter.getValue());
+                }
+                else {
+                    _this.password.setValue(_this.pw_gen.getValue());
+                }
+            }
+            
+            _this.form.doAction('submit');
+            _this.submit_button.disable();
+            _this.submit_button.setText('sending...');
+        },
+       render : function (_self)
+        {
+            _this.submit_button = this;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      style : 'float: right; margin: 10px;',
+      weight : 'danger',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      method : 'POST',
+      url : baseURL+'/Roo/Modx_users',
+      listeners : {
+       actioncomplete : function (_self, action) {
+        
+            if (action.type == 'setdata') {
+                _this.check_set_pw_true.setValue('0');
+                //this.url = baseURL+'/Roo/Modx_accountmgmts'
+                //this.doAction('load', { method: 'GET', params: action.data });
+                return;
+            }
+            if (action.type == 'load') {
+                return;
+            }
+            if (action.type =='submit') {
+                Roo.log('test submit');
+                
+                if (_this.callback) {
+                    _this.callback.call(_this, action.result);
+                }
+                
+              
+                
+                _this.submit_button.enable();
+                _this.submit_button.setText('OK');
+                _this.dialog.hide();
+                if(_this._confirm_dialog) {
+                    _this._confirm_dialog.show({'investor_id':action.result.data.id, 'account_type': _this.investor_type.getValue()});            
+                }
+                 
+                _this.form.reset();
+                return;
+            }
+        
+        },
+       actionfailed : function (_self, action)
+        {  
+           _this.submit_button.enable();
+           _this.submit_button.setText('OK');
+           Roo.log('action call: '+action);
+           Roo.log("action failed");
+           Roo.log("action type:"+action.failureType);
+          
+           
+           if(action.result.errorMsg.length >= 200) {
+               Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg.substring(0,199) + '...');
+          
+           } else {
+               Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
+           }
+        },
+       render : function (_self,e)
+        {
+            _this.form = _self;
+            
+        },
+       show : function (_self)
+        {
+            //if(_this.fund_name) {
+            //    _this.fund_name.store.load({});
+            //}
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'ComboBox',
+            allowBlank : false,
+            displayField : 'value',
+            editable : false,
+            fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
+            labelAlign : 'top',
+            name : 'type',
+            placeholder : _this._strings['ae9e6ac49d4f451b1ebf440619f595b5'] /* please select the type of the investor */,
+            triggerAction : 'all',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.investor_type = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'SimpleStore',
+             data : [
+                 ['individual', 'Individual'],
+                 ['corporate', 'Corporate'],
+                 ['joint', 'Joint']
+             ],
+             fields : [ 'code', 'value' ],
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'ComboBox',
+            allowBlank : false,
+            alwaysQuery : false,
+            displayField : 'name',
+            editable : false,
+            fieldLabel : _this._strings['c1098dd48f0fb20eeea79235055d02ca'] /* Fund */,
+            labelAlign : 'top',
+            name : 'fund_name',
+            placeholder : _this._strings['e5676ba19f12f141c9d199c36ee5fde6'] /* please select the fund related to the investor */,
+            tpl : '<div class=\"roo-select2-result\"><b>{name}</b></div>',
+            triggerAction : 'all',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.fund_name = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'Store',
+             remoteSort : false,
+             sortInfo : {field:"name",direction:"ASC"},
+             listeners : {
+              beforeload : function (_self, options)
+               {
+               
+               }
+             },
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             proxy : {
+              xtype : 'MemoryProxy',
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             },
+             reader : {
+              xtype : 'JsonReader',
+              fields : [{'name':'name','type':'string'},{'name':'id',type:'string'}],
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             }
+            }
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'ComboBox',
+            allowBlank : false,
+            alwaysQuery : false,
+            displayField : 'name',
+            editable : false,
+            fieldLabel : _this._strings['52c649c38236206862e79e77f735902d'] /* Investment Advisor */,
+            forceSelection : true,
+            hiddenName : 'investment_advisor_id',
+            indicatorpos : 'right',
+            labelAlign : 'top',
+            minChars : 2,
+            name : 'investment_advisor_id_name',
+            placeholder : _this._strings['b60a6cfe4d8391ec9c29e11ab13216cd'] /* Select Investment Advisor */,
+            queryParam : 'query[name]',
+            tpl : '<div class=\"roo-select2-result\"><b>{name}</b></div>',
+            triggerAction : 'all',
+            typeAhead : true,
+            valueField : 'id',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.advisor = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'Store',
+             remoteSort : false,
+             sortInfo : {field:"name",direction:"ASC"},
+             listeners : {
+              beforeload : function (_self, o)
+               {
+               
+               }
+             },
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             proxy : {
+              xtype : 'MemoryProxy',
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             },
+             reader : {
+              xtype : 'JsonReader',
+              fields : [
+                  {
+                      'name': 'id',
+                      'type': 'int'
+                  },
+                  {
+                      'name': 'name',
+                      'type': 'string'
+                  }
+              ],
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             }
+            }
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            fieldLabel : _this._strings['e456949630edb405fba2217ddeef7f3c'] /* Primary contact email */,
+            labelAlign : 'top',
+            name : 'email',
+            placeholder : _this._strings['c83804c010b690de6f340363e374b777'] /* please enter the email of the investor */,
+            style : 'width: inherit;',
+            listeners : {
+             keyup : function (_self, e)
+              {
+              //    console.debug('text box value: ' + _this.form.findField('email').getValue());
+                  var email = _this.form.findField('email').getValue();
+                  if(email.length>0) {
+                      var res = email.split('@');
+                      if(res.length>0) {
+                          _this.form.findField('username').setValue(res[0]);
+                      } else {
+                          _this.form.findField('username').setValue(email);
+                      }
+                  }
+              },
+             render : function (_self)
+              {
+                  _this.email = this;
+              },
+             valid : function (_self)
+              {
+                  var re = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/;
+                  if (!re.test(_this.email.getValue())){
+                      _this.email.markInvalid('testing');
+                  }
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
+            labelAlign : 'top',
+            name : 'username',
+            placeholder : _this._strings['e09596c4d5ca0043bbe539924e37adf9'] /* please enter the username of the investor */,
+            style : 'width: inherit;',
+            listeners : {
+             render : function (_self)
+              {
+              
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 6,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Radio',
+            boxLabel : 'No password',
+            inputValue : 0,
+            name : 'check_set_pw',
+            style : 'float: left; width: 200px;',
+            valueOff : 0,
+            listeners : {
+             check : function (_self, checked)
+              {
+              
+                  if (checked){
+                  
+                  
+                  _this.check_gen_pw_row.el.hide('TRUE');
+                  _this.pw_enter_row.el.hide('TRUE');
+                  _this.pw_gen_row.el.hide('TRUE');
+                  
+                  _this.pw_gen.setValue('');
+                  _this.pw_enter.setValue('please enter your password');
+                  _this.pw_reenter.setValue('please enter your password');
+                  //_this.check_gen_pw_true.setValue('0');
+                  }
+                 
+                  
+              },
+             render : function (_self)
+              {
+                  _this.check_set_pw_false = this;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         },
+         {
+          xtype : 'Column',
+          xs : 6,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Radio',
+            boxLabel : 'Set password',
+            inputValue : 1,
+            name : 'check_set_pw',
+            valueOff : 0,
+            listeners : {
+             check : function (_self, checked)
+              {
+                  if (checked){
+                      Roo.log('return check_set_pw_true: '+checked);
+                      _this.check_gen_pw_row.el.show('TRUE');
+                      _this.pw_enter_row.el.hide('TURE');
+                      _this.check_gen_pw_true.setValue('1');
+                      _this.pw_enter.setValue('please enter your password');
+                      _this.pw_reenter.setValue('please enter your password');
+              
+                  }
+              },
+             render : function (_self)
+              {
+                  _this.check_set_pw_true = this;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        listeners : {
+         render : function (_self)
+          {
+              _this.check_gen_pw_row = this;
+              this.el.setVisibilityMode(Roo.Element.DISPLAY);
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 6,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Radio',
+            boxLabel : 'Enter Password',
+            inputValue : 0,
+            name : 'check_gen_pw',
+            style : 'float: left; width: 200px;',
+            listeners : {
+             check : function (_self, checked)
+              {
+              
+                  _this.pw_gen_row.el.hide('TRUE');
+                  _this.pw_gen.setValue('');
+                  
+                  _this.pw_enter_row.el.show('TRUE');
+                  _this.pw_enter.setValue('');
+                  _this.pw_reenter.setValue('');
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         },
+         {
+          xtype : 'Column',
+          xs : 6,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Radio',
+            boxLabel : 'Generate password',
+            inputValue : 1,
+            name : 'check_gen_pw',
+            listeners : {
+             check : function (_self, checked)
+              {
+              
+                  _this.pw_gen_row.el.show('TRUE');
+                  var randomPw = Math.random().toString(36).slice(-8);
+                  _this.pw_gen.setValue(randomPw);
+                  
+                  _this.pw_enter_row.el.hide('TRUE');
+              
+                  _this.pw_enter.setValue('please enter your password');
+                  _this.pw_reenter.setValue('please enter your password');
+                  
+                  
+              },
+             render : function (_self)
+              {
+                  _this.check_gen_pw_true = this;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        listeners : {
+         render : function (_self)
+          {
+              _this.pw_enter_row = this;
+              this.el.setVisibilityMode(Roo.Element.DISPLAY);
+              
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            inputType : 'password',
+            labelAlign : 'top',
+            name : 'pw_enter',
+            placeholder : _this._strings['51eea3dc60ae3a0b1bb8188bc6337dc2'] /* enter password */,
+            listeners : {
+             change : function (_self, newValue, oldValue)
+              {
+                  _this.pw_reenter.markInvalid('unmatch2');
+              },
+             render : function (_self)
+              {
+                  _this.pw_enter = this;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           },
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            inputType : 'password',
+            labelAlign : 'top',
+            name : 'pw_reenter',
+            placeholder : _this._strings['27f4aa512a351222967865d05016314c'] /* enter password again to confirm */,
+            listeners : {
+             render : function (_self)
+              {
+                  _this.pw_reenter = this;
+              },
+             valid : function (_self)
+              {
+              
+                  if (_this.pw_enter.getValue() != _this.pw_reenter.getValue()){
+              
+                      _this.pw_reenter.markInvalid('unmatch2');
+              
+                  }
+              
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        listeners : {
+         render : function (_self)
+          {
+              _this.pw_gen_row = this;
+              this.el.setVisibilityMode(Roo.Element.DISPLAY);
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : true,
+            fieldLabel : _this._strings['5a679c50cadfca1ff5cdbd31939af3fc'] /* Generated password */,
+            labelAlign : 'top',
+            name : 'pw_gen',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.pw_gen = this;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'new_password',
+        listeners : {
+         render : function (_self)
+          {
+              _this.password = this;
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     },
+     {
+      xtype : 'Row',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Column',
+        xs : 12,
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorCreate, Pman.Dialog.CobaInvestorCreate.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.bjs
new file mode 100644 (file)
index 0000000..bc6c18f
--- /dev/null
@@ -0,0 +1,100 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorCreateConfirm",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/khlau/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "230a38ecd64762d2d7dac46233a7b148" : "Investor has been Created",
+  "8d9fd121bd6d00163322d9902fe5ce98" : "Create another",
+  "62e680151024df75579daae4662e0724" : "Start entering Accreditation",
+  "f92965e2c8a7afb3c1b9a5c09a263636" : "Done"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "render" : "function (_self)\n{\n    _this.modal = _self;\n}"
+   },
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Investor has been Created",
+   "String style" : "align-items: center;",
+   "items" : [
+    {
+     "xtype" : "Container",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "width: inherit; margin:10px; text-align:center;",
+     "items" : [
+      {
+       "listeners" : {
+        "click" : "function (_self, e)\n{\n    Pman.Dialog.CobaInvestorCreate.show({});\n    _this.dialog.hide();\n}"
+       },
+       "String weight" : "primary",
+       "xtype" : "Button",
+       "$ xns" : "Roo.bootstrap",
+       "String html" : "Create another",
+       "String style" : "width:300px;"
+      }
+     ]
+    },
+    {
+     "xtype" : "Container",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "width: inherit; margin:10px; text-align:center",
+     "items" : [
+      {
+       "listeners" : {
+        "click" : "function (_self, e)\n{\n    _this.modal.el.mask('Sending');       \n    var investor_id = _this.investor_id.getValue();\n    var account_type = _this.account_type.getValue();\n    new Pman.Request({\n        url: baseURL + '/Coba/ModxSession',\n        method: 'GET',\n        params: {\n            investor_id: investor_id,\n            account_type: account_type\n        },\n        success:  function(res)  {  // check successfull...\n            if (res.success) { // error!\n                window.onbeforeunload  =null;\n                window.onunload  = function () {_this.modal.el.unmask()};\n                if(res.data) {\n                    var win = window.open(res.data, '_self');                          \n                }\n            }\n        },\n        failure : function(res)\n        {\n            _this.modal.el.unmask();           \n            Roo.bootstrap.MessageBox.alert(\"Error\",  res.errorMsg);\n        }\n    });\n}\n\n\n"
+       },
+       "String weight" : "primary",
+       "xtype" : "Button",
+       "$ xns" : "Roo.bootstrap",
+       "String html" : "Start entering Accreditation",
+       "String style" : "width:300px;"
+      },
+      {
+       "listeners" : {
+        "actioncomplete" : "function (_self, action)\n{\n    if (action.type == 'setdata') {\n       if(action.data)\n       {\n            _this.investor_id.setValue(action.data.investor_id);\n            _this.account_type.setValue(action.data.account_type.toLowerCase());\n       }\n        return;\n    }\n}",
+        "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+       },
+       "xtype" : "Form",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n    _this.investor_id = _self;\n}"
+         },
+         "String name" : "investor_id",
+         "xtype" : "Input",
+         "String inputType" : "hidden",
+         "$ xns" : "Roo.bootstrap"
+        },
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n_this.account_type = _self;\n}"
+         },
+         "String name" : "account_type",
+         "xtype" : "Input",
+         "String inputType" : "hidden",
+         "$ xns" : "Roo.bootstrap"
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n    Pman.Dialog.CobaInvestorCreate.dialog.hide(); \n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "float: right; margin:10px; width:150px",
+     "String html" : "Done",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.js b/Pman/Coba/Pman.Dialog.CobaInvestorCreateConfirm.js
new file mode 100644 (file)
index 0000000..89a0f3f
--- /dev/null
@@ -0,0 +1,193 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorCreateConfirm= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorCreateConfirm.prototype, {
+
+ _strings : {
+  '230a38ecd64762d2d7dac46233a7b148' :"Investor has been Created",
+  '8d9fd121bd6d00163322d9902fe5ce98' :"Create another",
+  '62e680151024df75579daae4662e0724' :"Start entering Accreditation",
+  'f92965e2c8a7afb3c1b9a5c09a263636' :"Done"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    style : 'align-items: center;',
+    title : _this._strings['230a38ecd64762d2d7dac46233a7b148'] /* Investor has been Created */,
+    listeners : {
+     render : function (_self)
+      {
+          _this.modal = _self;
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['f92965e2c8a7afb3c1b9a5c09a263636'] /* Done */,
+      style : 'float: right; margin:10px; width:150px',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+            Pman.Dialog.CobaInvestorCreate.dialog.hide(); 
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Container',
+      style : 'width: inherit; margin:10px; text-align:center;',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Button',
+        html : _this._strings['8d9fd121bd6d00163322d9902fe5ce98'] /* Create another */,
+        style : 'width:300px;',
+        weight : 'primary',
+        listeners : {
+         click : function (_self, e)
+          {
+              Pman.Dialog.CobaInvestorCreate.show({});
+              _this.dialog.hide();
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     },
+     {
+      xtype : 'Container',
+      style : 'width: inherit; margin:10px; text-align:center',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Button',
+        html : _this._strings['62e680151024df75579daae4662e0724'] /* Start entering Accreditation */,
+        style : 'width:300px;',
+        weight : 'primary',
+        listeners : {
+         click : function (_self, e)
+          {
+              _this.modal.el.mask('Sending');       
+              var investor_id = _this.investor_id.getValue();
+              var account_type = _this.account_type.getValue();
+              new Pman.Request({
+                  url: baseURL + '/Coba/ModxSession',
+                  method: 'GET',
+                  params: {
+                      investor_id: investor_id,
+                      account_type: account_type
+                  },
+                  success:  function(res)  {  // check successfull...
+                      if (res.success) { // error!
+                          window.onbeforeunload  =null;
+                          window.onunload  = function () {_this.modal.el.unmask()};
+                          if(res.data) {
+                              var win = window.open(res.data, '_self');                          
+                          }
+                      }
+                  },
+                  failure : function(res)
+                  {
+                      _this.modal.el.unmask();           
+                      Roo.bootstrap.MessageBox.alert("Error",  res.errorMsg);
+                  }
+              });
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       },
+       {
+        xtype : 'Form',
+        listeners : {
+         actioncomplete : function (_self, action)
+          {
+              if (action.type == 'setdata') {
+                 if(action.data)
+                 {
+                      _this.investor_id.setValue(action.data.investor_id);
+                      _this.account_type.setValue(action.data.account_type.toLowerCase());
+                 }
+                  return;
+              }
+          },
+         render : function (_self)
+          {
+              _this.form = _self;
+          }
+        },
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Input',
+          inputType : 'hidden',
+          name : 'investor_id',
+          listeners : {
+           render : function (_self)
+            {
+                _this.investor_id = _self;
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         },
+         {
+          xtype : 'Input',
+          inputType : 'hidden',
+          name : 'account_type',
+          listeners : {
+           render : function (_self)
+            {
+            _this.account_type = _self;
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorCreateConfirm, Pman.Dialog.CobaInvestorCreateConfirm.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.bjs
new file mode 100644 (file)
index 0000000..31d844a
--- /dev/null
@@ -0,0 +1,71 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorDocumentTitle",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "cc50e67baddb78229bf62a269e95b3fe" : "Enter Document Title",
+  "e0aa021e21dddbd6d8cecec71e9cf564" : "OK",
+  "e647ea78eaa03bc9426685b054758bb9" : "Please enter the document title"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    this.setTitle(\"Enter Document Title For \" + _this.data.name)\n}"
+   },
+   "String cls" : "enable-overflow",
+   "Boolean animate" : false,
+   "Boolean allow_close" : false,
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Enter Document Title",
+   "items" : [
+    {
+     "listeners" : {
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        return;\n    }\n\n    if (action.type =='submit') {\n        return;\n    }\n\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL + '/Roo/Invalid'",
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:15px;",
+     "String method" : "POST",
+     "Boolean loadMask" : false,
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : false,
+           "String name" : "title",
+           "xtype" : "Input",
+           "string placeholder" : "Please enter the document title",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    if(!_this.form.isValid()){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please fill in all the require field');\n        return;\n    }\n    \n    _this.dialog.hide();\n    \n    if (_this.callback) {\n        _this.callback.call(_this, _this.form.getValues());\n    }\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "OK",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.js b/Pman/Coba/Pman.Dialog.CobaInvestorDocumentTitle.js
new file mode 100644 (file)
index 0000000..a366f95
--- /dev/null
@@ -0,0 +1,132 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorDocumentTitle= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorDocumentTitle.prototype, {
+
+ _strings : {
+  'cc50e67baddb78229bf62a269e95b3fe' :"Enter Document Title",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK",
+  'e647ea78eaa03bc9426685b054758bb9' :"Please enter the document title"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    allow_close : false,
+    animate : false,
+    cls : 'enable-overflow',
+    title : _this._strings['cc50e67baddb78229bf62a269e95b3fe'] /* Enter Document Title */,
+    listeners : {
+     show : function (_self)
+      {
+          this.setTitle("Enter Document Title For " + _this.data.name)
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(!_this.form.isValid()){
+                Roo.bootstrap.MessageBox.alert('Error', 'Please fill in all the require field');
+                return;
+            }
+            
+            _this.dialog.hide();
+            
+            if (_this.callback) {
+                _this.callback.call(_this, _this.form.getValues());
+            }
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      loadMask : false,
+      method : 'POST',
+      style : 'margin:15px;',
+      url : baseURL + '/Roo/Invalid',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+                return;
+            }
+        
+            if (action.type =='submit') {
+                return;
+            }
+        
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : false,
+            name : 'title',
+            placeholder : _this._strings['e647ea78eaa03bc9426685b054758bb9'] /* Please enter the document title */,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorDocumentTitle, Pman.Dialog.CobaInvestorDocumentTitle.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorImport.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorImport.bjs
new file mode 100644 (file)
index 0000000..803d4b7
--- /dev/null
@@ -0,0 +1,116 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorImport",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorImport.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "1aa14e9f377b528b5537d70fbd35c6a2" : "Select File",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "913ddd7613d305b4879b376adf3f798c" : "Import Investor",
+  "e0aa021e21dddbd6d8cecec71e9cf564" : "OK"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    _this.submit_button.enable();\n    _this.submit_button.setText('OK');\n}"
+   },
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Import Investor",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{\n    _this.submit_button.enable();\n    _this.submit_button.setText('OK');\n    Roo.log('action call: ');\n    Roo.log(action);\n    Roo.log(\"action failed\");\n    Roo.log(\"action type:\"+action.failureType);\n    \n    switch(action.failureType) {\n        case Roo.form.Action.SERVER_INVALID: \n           if(action.result.errorMsg==\"duplicate\") {\n               Roo.bootstrap.MessageBox.confirm(\n                   \"Duplicate Entries where found, do you wish to import anyway\", \n                    action.result.errors.toString(), \n                    function(res) {\n                        if(res == 'no') {\n                            return;\n                        }\n                        _this.form.findField('import_duplicate').setValue('1'); \n                        _this.form.doAction('submit');\n                        _this.submit_button.disable();\n                        _this.submit_button.setText('sending...');\n                       }\n                    );\n                  \n           } else {\n               Roo.bootstrap.MessageBox.alert(\"Server Error\", action.result.errors.toString());\n           }\n           break;\n        case Roo.form.Action.CLIENT_INVALID: //for validation\n            Roo.bootstrap.MessageBox.alert(\"Client Error\", action.result.errorMsg);\n            break;\n        case Roo.form.Action.CONNECT_FAILURE:\n            Roo.bootstrap.MessageBox.alert(\"Connect Error\", action.result.errorMsg);\n            break;\n        default: \n           Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg);\n           break;    \n    }\n}",
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        _self.reset(); \n        if(_this.data.id * 1 > 0) {\n//            _this.onid.setValue(_this.data.id);\n//            _this.ontable.setValue('coba_declarations');\n        }        \n        return;\n    }\n   \n   if (action.type == 'submit') { // only submitted here if we are \n       _this.dialog.hide();\n       if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.submit_button.enable();\n        _this.submit_button.setText('OK');\n        return;\n    }\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL + '/Coba/Import/Investors'",
+     "xtype" : "Form",
+     "Boolean fileUpload" : true,
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:15px;",
+     "String method" : "POST",
+     "items" : [
+      {
+       "String cls" : "col-md-12",
+       "xtype" : "Container",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Row",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "xtype" : "Column",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "Boolean allowBlank" : false,
+             "String name" : "imageUpload",
+             "xtype" : "Input",
+             "string fieldLabel" : "Select File",
+             "String labelAlign" : "top",
+             "String inputType" : "file",
+             "$ xns" : "Roo.bootstrap"
+            },
+            {
+             "String name" : "post_max_filesize",
+             "xtype" : "Input",
+             "String inputType" : "hidden",
+             "$ xns" : "Roo.bootstrap",
+             "String vtype" : "32M"
+            },
+            {
+             "String name" : "upload_max_filesize",
+             "xtype" : "Input",
+             "String inputType" : "hidden",
+             "$ xns" : "Roo.bootstrap",
+             "String vtype" : "32M"
+            },
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n    _this.import_duplicate = _self;\n}"
+             },
+             "String name" : "import_duplicate",
+             "xtype" : "Input",
+             "String inputType" : "hidden",
+             "$ xns" : "Roo.bootstrap"
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide({});\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "float: right; margin: 10px; width: 70px;",
+     "String html" : "Cancel",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.submit_button = _self;\n}",
+      "click" : "function (_self, e)\n{\n    if(!_this.form.isValid()){\n          Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');\n          return;\n    }\n    _this.form.findField('import_duplicate').setValue(''); \n    _this.form.doAction('submit');\n    _this.submit_button.disable();\n    _this.submit_button.setText('sending...');\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "float: right; margin: 10px; width: 70px;",
+     "String html" : "OK",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorImport.js b/Pman/Coba/Pman.Dialog.CobaInvestorImport.js
new file mode 100644 (file)
index 0000000..99b14cb
--- /dev/null
@@ -0,0 +1,240 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorImport= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorImport.prototype, {
+
+ _strings : {
+  '1aa14e9f377b528b5537d70fbd35c6a2' :"Select File",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '913ddd7613d305b4879b376adf3f798c' :"Import Investor",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    title : _this._strings['913ddd7613d305b4879b376adf3f798c'] /* Import Investor */,
+    listeners : {
+     show : function (_self)
+      {
+          _this.submit_button.enable();
+          _this.submit_button.setText('OK');
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      style : 'float: right; margin: 10px; width: 70px;',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide({});
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      style : 'float: right; margin: 10px; width: 70px;',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(!_this.form.isValid()){
+                  Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
+                  return;
+            }
+            _this.form.findField('import_duplicate').setValue(''); 
+            _this.form.doAction('submit');
+            _this.submit_button.disable();
+            _this.submit_button.setText('sending...');
+        },
+       render : function (_self)
+        {
+            _this.submit_button = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      fileUpload : true,
+      method : 'POST',
+      style : 'margin:15px;',
+      url : baseURL + '/Coba/Import/Investors',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+                _self.reset(); 
+                if(_this.data.id * 1 > 0) {
+        //            _this.onid.setValue(_this.data.id);
+        //            _this.ontable.setValue('coba_declarations');
+                }        
+                return;
+            }
+           
+           if (action.type == 'submit') { // only submitted here if we are 
+               _this.dialog.hide();
+               if (_this.callback) {
+                    _this.callback.call(_this, action.result);
+                }
+                
+                _this.submit_button.enable();
+                _this.submit_button.setText('OK');
+                return;
+            }
+        },
+       actionfailed : function (_self, action)
+        {
+            _this.submit_button.enable();
+            _this.submit_button.setText('OK');
+            Roo.log('action call: ');
+            Roo.log(action);
+            Roo.log("action failed");
+            Roo.log("action type:"+action.failureType);
+            
+            switch(action.failureType) {
+                case Roo.form.Action.SERVER_INVALID: 
+                   if(action.result.errorMsg=="duplicate") {
+                       Roo.bootstrap.MessageBox.confirm(
+                           "Duplicate Entries where found, do you wish to import anyway", 
+                            action.result.errors.toString(), 
+                            function(res) {
+                                if(res == 'no') {
+                                    return;
+                                }
+                                _this.form.findField('import_duplicate').setValue('1'); 
+                                _this.form.doAction('submit');
+                                _this.submit_button.disable();
+                                _this.submit_button.setText('sending...');
+                               }
+                            );
+                          
+                   } else {
+                       Roo.bootstrap.MessageBox.alert("Server Error", action.result.errors.toString());
+                   }
+                   break;
+                case Roo.form.Action.CLIENT_INVALID: //for validation
+                    Roo.bootstrap.MessageBox.alert("Client Error", action.result.errorMsg);
+                    break;
+                case Roo.form.Action.CONNECT_FAILURE:
+                    Roo.bootstrap.MessageBox.alert("Connect Error", action.result.errorMsg);
+                    break;
+                default: 
+                   Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
+                   break;    
+            }
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Container',
+        cls : 'col-md-12',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Row',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Column',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              allowBlank : false,
+              fieldLabel : _this._strings['1aa14e9f377b528b5537d70fbd35c6a2'] /* Select File */,
+              inputType : 'file',
+              labelAlign : 'top',
+              name : 'imageUpload',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             },
+             {
+              xtype : 'Input',
+              inputType : 'hidden',
+              name : 'post_max_filesize',
+              vtype : '32M',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             },
+             {
+              xtype : 'Input',
+              inputType : 'hidden',
+              name : 'upload_max_filesize',
+              vtype : '32M',
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             },
+             {
+              xtype : 'Input',
+              inputType : 'hidden',
+              name : 'import_duplicate',
+              listeners : {
+               render : function (_self)
+                {
+                    _this.import_duplicate = _self;
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorImport, Pman.Dialog.CobaInvestorImport.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorModify.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorModify.bjs
new file mode 100644 (file)
index 0000000..21b44f9
--- /dev/null
@@ -0,0 +1,945 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorModify",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorModify.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "44749712dbec183e983dcd78a7736c41" : "Date",
+  "4e97aeeaa8b15ca1180fcd1f3ac478d1" : "When",
+  "e1d496d505f34ae1866fc7ad0e59e7ac" : "Compliance Review",
+  "f28128b38efbc6134dc40751ee21fd29" : "Documents",
+  "d41d8cd98f00b204e9800998ecf8427e" : "",
+  "3e4901127828df59e44a55af7659e508" : "<i class=\"fa fa-times-circle\"></i> not complete",
+  "457dd55184faedb7885afd4009d70163" : "Review",
+  "231bc72756b5e6de492aaaa1577f61b1" : "Remarks",
+  "b80bb7740288fda1f201890375a60c8f" : "id",
+  "09677be3a36334e7fcad710832364b77" : "Add a Note",
+  "418c5509e2171d55b0aee5c2ea4442b5" : "action",
+  "31e41095bfaa14799239e8d9ba7ad438" : "Application Details",
+  "13348442cc6a27032d2b4aa28b75a5d3" : "Search",
+  "93b6fe26d96a3a9812a34cb6ba9b3567" : "Historical Notes",
+  "5cfee765454e9ab499d547c20476f696" : "Change Advisor",
+  "1eb39f9b4c58313ca684e44d590b1d82" : "Lexis Nexis",
+  "2b16564e6e838ce86608620b70beb570" : "Activity Log",
+  "3e4696aa5313272da1baa6497c82a9b5" : "Notes about User",
+  "4b1b4dc8cf38b3c64b1d657da8f5ac8c" : "Report",
+  "0945359809dad1fbf3dea1c95a0da951" : "Document",
+  "b46df2f1d2e702b38d83cc22954263c6" : "Un-submit",
+  "f018a137eb54d99d29a9b41fb6b061b5" : "Add Note",
+  "269d037052d86346356a8077aee32baf" : "View Reason",
+  "0e883c2b722f8a57275b249bef7c94db" : "Lexis Nexis Search",
+  "4ee972120bcda675f75222c87cb9d356" : "Who",
+  "292659c2de7f3de1a9ab2abfef6839a4" : "Uploaded Documents",
+  "801ab24683a4a8c433c6eb40c48bcd9d" : "Download",
+  "405e3e5c89b4b29dcb052614626788bb" : "View / Status",
+  "cce99c598cfdb9773ab041d54c3d973a" : "Profile",
+  "3b878279a04dc47d60932cb294d96259" : "Overview",
+  "8f2ec0b04f61587a0e83068e5ef842bd" : "<i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>  not complete",
+  "a14739916eebbb7689b495e07b15fe2a" : "Edit Accreditation",
+  "66e77e7bfdc713de218e85cf6655b9d1" : "Modify / View Investor",
+  "f4c6f851b00d5518bf888815de279aba" : "Notes",
+  "e3a96404a82d284db5e77ec5a0d9d6cb" : "Change User's Password",
+  "d3d2e617335f08df83599665eef8a418" : "Close"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    _this.dialog.items[0].getRegion('center').showPanel(0); \n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Core_group.php',\n        method : 'GET',\n        params : {\n            _count_member_by_name : 'Compliance Officers'\n        }, \n        success : function(res) {\n\n            if(res.data * 1 > 0){\n                return;\n            }\n            \n            Roo.bootstrap.MessageBox.alert('Warning', \"There is no any memeber in 'Compliance Officers' group\");\n            \n        }\n    });\n}",
+    "hide" : "function (_self)\n{\n    if (_this.callback) {\n        _this.callback.call(_self, _this.data);\n    } \n}"
+   },
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Modify / View Investor",
+   "bool fitwindow" : true,
+   "items" : [
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.layout = _self;\n}"
+     },
+     "xtype" : "Border",
+     "$ xns" : "Roo.bootstrap.layout",
+     "items" : [
+      {
+       "String tabPosition" : "top",
+       "xtype" : "Region",
+       "$ xns" : "Roo.bootstrap.layout",
+       "Boolean alwaysShowTabs" : true,
+       "* prop" : "center"
+      },
+      {
+       "Boolean fitContainer" : true,
+       "xtype" : "Nest",
+       "Boolean fitToFrame" : true,
+       "$ xns" : "Roo.bootstrap.panel",
+       "String region" : "center",
+       "String title" : "Overview",
+       "Boolean autoScroll" : false,
+       "items" : [
+        {
+         "xtype" : "Border",
+         "$ xns" : "Roo.bootstrap.layout",
+         "* prop" : "layout",
+         "items" : [
+          {
+           "xtype" : "Region",
+           "Boolean hideTabs" : true,
+           "Number height" : 280,
+           "$ xns" : "Roo.bootstrap.layout",
+           "* prop" : "north",
+           "Boolean split" : true
+          },
+          {
+           "xtype" : "Region",
+           "Boolean hideTabs" : true,
+           "$ xns" : "Roo.bootstrap.layout",
+           "* prop" : "center"
+          },
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.overview_tab = _self;\n}"
+           },
+           "Boolean fitContainer" : true,
+           "xtype" : "Content",
+           "Boolean fitToFrame" : true,
+           "$ xns" : "Roo.bootstrap.panel",
+           "String region" : "north",
+           "String title" : "Overview",
+           "Boolean autoScroll" : true,
+           "items" : [
+            {
+             "listeners" : {
+              "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n\n        _this.form.reset();\n\n        if(_this.data.id * 1 > 0) {\n            \n            _this.form.reloadData();\n            \n        }\n        \n        return;\n    }\n    \n    if(action.type == 'load') {\n        \n        _this.data = action.result.data;\n        \n        _this.dialog.el.unmask();\n        \n        _this.dialog.setTitle('Manage Investor - ' + String.format('{0}', _this.data.full_name));\n        \n        _this.profile_indicator.update();\n        \n        _this.documents_indicator.update();\n        \n        _this.lexis_nexis_indicator.update();\n        \n        _this.compliance_indicator.update();\n        \n        _this.account_type_notice.update();\n        \n        _this.fund_name_notice.update();\n        \n        _this.advisor_notice.update();\n        \n        _this.lexis_nexis_panel.update();\n        \n        _this.reportGrid.store.load({});\n\n        return;\n    }\n    \n    if(action.type == 'submit') {\n\n        return;\n    }\n}",
+              "render" : "function (_self)\n{\n    _this.form = _self; \n}"
+             },
+             "$ url" : "baseURL + '/Roo/Ext_data'",
+             "xtype" : "Form",
+             "| function reloadData" : "function() \n{\n    _this.dialog.el.mask('Loading...');\n    \n    _this.form.doAction('load', { method: 'GET', params: { \n        '_id' : _this.data.id, \n        _with_status : 1, \n        _with_lexis_nexis : 1,\n        _with_compliance_status : 1\n    }});\n}",
+             "$ xns" : "Roo.bootstrap",
+             "Boolean loadMask" : false,
+             "items" : [
+              {
+               "xtype" : "Container",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "margin-top:5px;",
+               "items" : [
+                {
+                 "xtype" : "Row",
+                 "$ xns" : "Roo.bootstrap",
+                 "String style" : "margin-top: 10px; margin-bottom: 10px;",
+                 "items" : [
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.account_type_notice = this;\n}"
+                   },
+                   "String cls" : "text-center",
+                   "| function update" : "function() \n{ \n    this.el.dom.innerHTML = String.format('<b>Type:</b> {0}', _this.data.account_type);\n}",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "Number sm" : 4
+                  },
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.fund_name_notice = this;\n}"
+                   },
+                   "String cls" : "text-center",
+                   "| function update" : "function() \n{ \n    this.el.dom.innerHTML = String.format('<b>Fund Name:</b> {0}', _this.data.fund_name);\n}",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "Number sm" : 4
+                  },
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.advisor_notice = this;\n}"
+                   },
+                   "String cls" : "text-center",
+                   "| function update" : "function() \n{ \n    this.el.dom.innerHTML = String.format('<b>Advisor:</b> {0}', _this.data.investment_advisor_id_name);\n}",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "Number sm" : 4
+                  }
+                 ]
+                },
+                {
+                 "xtype" : "Row",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.profile_indicator = this;\n}"
+                   },
+                   "| function update" : "function() \n{ \n    var icon = 'fa-times-circle';\n    var msg = 'Not Submitted';\n    var color = '#941B0C';\n    \n    _this.unSubmitBtn.el.hide();\n    \n    if(_this.data.is_submit * 1) {\n    \n        icon = 'fa-check';\n        msg = 'Submitted';\n        color = 'green';\n        \n        _this.unSubmitBtn.el.show();\n    }\n    \n    _this.profile_icon.el.setStyle('color', color);\n    \n    _this.profile_message.el.dom.innerHTML = String.format('<i style=\"color:{0}\" class=\"fa {1}\"></i> {2}', color, icon, msg);\n    \n}",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "String style" : "text-align:center",
+                   "Number sm" : 3,
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.profile_icon = this;\n}"
+                     },
+                     "String cls" : "fa-5x",
+                     "string fa" : "user",
+                     "xtype" : "Container",
+                     "$ xns" : "Roo.bootstrap"
+                    },
+                    {
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Profile"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.profile_message = this;\n    \n}"
+                     },
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "<i class=\"fa fa-times-circle\"></i> not complete"
+                    },
+                    {
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "items" : [
+                      {
+                       "xtype" : "Row",
+                       "$ xns" : "Roo.bootstrap",
+                       "items" : [
+                        {
+                         "xtype" : "Column",
+                         "Number xs" : 12,
+                         "$ xns" : "Roo.bootstrap",
+                         "items" : [
+                          {
+                           "listeners" : {
+                            "render" : "function (_self)\n{\n    _this.unSubmitBtn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
+                            "click" : "function (_self, e)\n{\n    if(!_this.data.id* 1) {\n        return;\n    }\n\n    Roo.bootstrap.MessageBox.confirm(\"Confirm\", \"Are sure you want to Un-submit?\", function (v){\n        if (v != 'yes') {\n            return;\n        }\n\n        new Pman.Request({\n            url : baseURL + '/Roo/Ext_data',\n            method: 'POST',\n            mask : 'Loading',\n            params : {\n                id : _this.data.id* 1,\n                is_submit: 0\n            },\n            success : function(res)\n            {\n                _this.form.reloadData();\n            }\n        });\n    });\n    \n}"
+                           },
+                           "String weight" : "info",
+                           "xtype" : "Button",
+                           "$ xns" : "Roo.bootstrap",
+                           "String html" : "Un-submit",
+                           "String style" : "margin-left: auto; margin-right: auto; margin-bottom: 10px; width: 150px; text-align: center;"
+                          }
+                         ]
+                        }
+                       ]
+                      }
+                     ]
+                    }
+                   ]
+                  },
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.documents_indicator = this;\n    \n}"
+                   },
+                   "| function update" : "function() \n{ \n    var icon = 'fa-times-circle';\n    var msg = 'Not Complete';\n    var color = '#941B0C';\n    \n    if(_this.data.is_missing_document * 1 == 0) {\n        icon = 'fa-check';\n        msg = 'Complete';\n        color = 'green';\n    }\n    \n    _this.check_document_icon.el.setStyle('color', color);\n    \n    _this.documents_message.el.dom.innerHTML = String.format('<i style=\"color:{0}\" class=\"fa {1}\"></i> {2}', color, icon, msg);\n}",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "String style" : "text-align:center",
+                   "Number sm" : 3,
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.check_document_icon = _self;\n}"
+                     },
+                     "String cls" : "fa-5x",
+                     "string fa" : "file-text",
+                     "xtype" : "Container",
+                     "$ xns" : "Roo.bootstrap"
+                    },
+                    {
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Documents"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.documents_message = this;\n    \n}"
+                     },
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "<i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>  not complete"
+                    }
+                   ]
+                  },
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.lexis_nexis_indicator = this;\n}"
+                   },
+                   "| function update" : "function() \n{ \n    var textIcon = '';\n    var msg = 'Status : Search not done';\n    var textColor = '#941B0C';\n    var color = '#941B0C';\n    \n    if(_this.data.is_lexis_nexis_search_completed * 1 == 1) {\n        msg = String.format('Status : {0} Matches Found', (_this.data.total_lexis_nexis * 1 > 0) ? _this.data.total_lexis_nexis: 'No');\n        textColor = 'green';\n        color = 'green';\n    }\n    \n    if(_this.data.is_missing_document * 1 == 1) {\n        textIcon = 'fa-times-circle';\n        msg = 'Document Not Upload';\n        textColor = '#941B0C';\n        color = '#999';\n    }\n    \n    if(_this.data.is_submit * 1 == 0) {\n        textIcon = 'fa-times-circle';\n        msg = 'Application Not complete';\n        textColor = '#941B0C';\n        color = '#999';\n    }\n    \n    \n    _this.lexis_nexis_icon.el.setStyle('color', color);\n    \n    _this.lexis_nexis_message.el.dom.innerHTML = String.format(\n        '<span style=\"color:{0}\">{1}</span>', \n        textColor, \n        msg\n    );\n    \n    if(textIcon.length){\n        _this.lexis_nexis_message.el.dom.innerHTML = String.format(\n            '<i style=\"color:{0}\" class=\"fa {1}\"></i> <span style=\"color:{0}\">{2}</span>', \n            textColor, \n            textIcon, \n            msg\n        );\n    }\n    \n    _this.lexis_nexis_btn.disable();\n                       \n    if(_this.data.is_submit * 1 == 1 && _this.data.is_missing_document * 1 == 0){\n        _this.lexis_nexis_btn.enable();\n    }\n    \n}\n",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "String style" : "text-align:center",
+                   "Number sm" : 3,
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.lexis_nexis_icon = this;\n}"
+                     },
+                     "String cls" : "fa-5x",
+                     "string fa" : "search",
+                     "xtype" : "Container",
+                     "$ xns" : "Roo.bootstrap"
+                    },
+                    {
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Lexis Nexis"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.lexis_nexis_message = this;\n}"
+                     },
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : " "
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.lexis_nexis_btn = this;\n}",
+                      "click" : "function (_self, e)\n{\n    if(_this.data.userdata_id * 1 < 1){\n        return;\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Coba/LexisNexis/Search/' + _this.data.userdata_id,\n        method: 'GET',\n        mask: 'Processing...',\n        success : function(res) {\n            var total = res.data.total;\n            \n            var msg = 'No Matching Records where found';\n            \n            if(res.data.total * 1 > 0){\n                msg = String.format('{0} Matching Records where found - please review them on the Lexis Nexis Tab.', res.data.total);\n            }\n            \n            var m = new Roo.bootstrap.Modal({ \n                html : msg, \n                title:'Lexis Nexis Search Succeed', \n                buttons : [\n                    {\n                        name : 'ok',\n                        html : 'OK',\n                        weight : 'primary'\n                    }\n                ],\n                listeners : { \n                    btnclick : function(name, e) { \n                        \n                        this.hide();\n                        \n                        _this.form.reloadData();\n                        \n                        if(res.data.total * 1 == 0){\n                            return;\n                        }\n                        \n                        _this.dialog.items[0].getRegion('center').showPanel(3); \n                        \n                    }\n                }\n            });\n      \n            m.show();\n            \n        }\n    });\n    \n}"
+                     },
+                     "String weight" : "primary",
+                     "xtype" : "Button",
+                     "Boolean disabled" : false,
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Lexis Nexis Search"
+                    }
+                   ]
+                  },
+                  {
+                   "listeners" : {
+                    "render" : "function (_self)\n{\n    _this.compliance_indicator = this;\n}"
+                   },
+                   "| function update" : "function() \n{\n    var msg = 'Pending Approval';\n    var textColor = '#337ab7';\n    var color = '#337ab7';\n    var icon = 'fa-user';\n    \n    var isComplianceOfficer = (Pman.Login.authUser.groups.indexOf('Compliance Officers') == -1) ? false : true;\n    var isAdministrator = (Pman.Login.authUser.groups.indexOf('Administrators') == -1) ? false : true;\n    \n    _this.compliance_review_btn.el.hide();\n    _this.compliance_view_reason_btn.el.hide();\n    \n    if(isComplianceOfficer){\n        _this.compliance_review_btn.el.show();\n    }\n    \n    switch (_this.data.compliance_status) {\n        case 'APPROVED' : \n            msg = String.format('Approved by {0}', _this.data.compliance_status_by);\n            textColor = 'green';\n            color = 'green';\n            icon = 'fa-check';\n            \n            _this.compliance_review_btn.el.hide();\n            _this.compliance_view_reason_btn.el.hide();\n            \n            break;\n        case 'REJECTED' : \n            msg = String.format('Reject by {0}', _this.data.compliance_status_by);\n            textColor = '#941B0C';\n            color = '#941B0C';\n            icon = 'fa-times';\n            \n            _this.compliance_review_btn.el.hide();\n            \n            if(isComplianceOfficer || isAdministrator){\n                _this.compliance_view_reason_btn.el.show();\n            }\n    \n            break;\n        default :\n            break;\n    }\n    \n    if(_this.data.is_lexis_nexis_view_completed * 1 == 0){\n        msg = 'Nexis Lexis needs reviewing';\n        color = '#999';\n        textColor = '#941B0C';\n        _this.compliance_review_btn.el.hide();\n        _this.compliance_view_reason_btn.el.hide();\n    }\n    \n    if(_this.data.is_lexis_nexis_search_completed * 1 == 0) {\n        msg = 'Nexis Lexis not run';\n        color = '#999';\n        textColor = '#941B0C';\n        _this.compliance_review_btn.el.hide();\n        _this.compliance_view_reason_btn.el.hide();\n    }\n    \n    _this.compliance_icon.el.setStyle('color', color);\n    \n    _this.compliance_icon.el.select('i', true).first().removeClass(['fa-user', 'fa-check']).addClass(icon);\n    \n    _this.compliance_message.el.dom.innerHTML = String.format('<span style=\"color:{0}\">{1}</span>', textColor, msg);\n    \n}",
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "String style" : "text-align:center",
+                   "Number sm" : 3,
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.compliance_icon = this;\n}"
+                     },
+                     "String cls" : "fa-5x",
+                     "string fa" : "user",
+                     "xtype" : "Container",
+                     "$ xns" : "Roo.bootstrap"
+                    },
+                    {
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Compliance Review"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.compliance_message = this;\n    \n}"
+                     },
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : ""
+                    },
+                    {
+                     "xtype" : "Element",
+                     "$ xns" : "Roo.bootstrap",
+                     "items" : [
+                      {
+                       "xtype" : "Row",
+                       "$ xns" : "Roo.bootstrap",
+                       "items" : [
+                        {
+                         "xtype" : "Column",
+                         "Number xs" : 12,
+                         "$ xns" : "Roo.bootstrap",
+                         "items" : [
+                          {
+                           "listeners" : {
+                            "render" : "function (_self)\n{\n    _this.compliance_review_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
+                            "click" : "function (_self, e)\n{\n    if(_this.data.id * 1 < 1) {\n        return;\n    }\n    \n    Pman.Dialog.CobaInvestorComplianceReview.show({\n        id : _this.data.id,\n        userdata_id : _this.data.userdata_id\n    }, function(){\n        _this.form.reloadData();\n    });\n    \n}"
+                           },
+                           "String weight" : "primary",
+                           "xtype" : "Button",
+                           "$ xns" : "Roo.bootstrap",
+                           "String html" : "Review",
+                           "String style" : "width: 150px; text-align: center;"
+                          },
+                          {
+                           "listeners" : {
+                            "render" : "function (_self)\n{\n    _this.compliance_view_reason_btn = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n    this.el.hide();\n}",
+                            "click" : "function (_self, e)\n{\n    if(!_this.data.compliance_coba_investor_notes || _this.data.compliance_coba_investor_notes.id * 1 < 1) {\n        return;\n    }\n    \n    Roo.bootstrap.MessageBox.alert('Reason', _this.data.compliance_coba_investor_notes.notes);\n    \n}"
+                           },
+                           "String weight" : "danger",
+                           "xtype" : "Button",
+                           "$ xns" : "Roo.bootstrap",
+                           "String html" : "View Reason",
+                           "String style" : "width: 150px; text-align: center;"
+                          }
+                         ]
+                        }
+                       ]
+                      }
+                     ]
+                    }
+                   ]
+                  }
+                 ]
+                }
+               ]
+              },
+              {
+               "String name" : "id",
+               "xtype" : "Input",
+               "String inputType" : "hidden",
+               "$ xns" : "Roo.bootstrap"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "Boolean fitContainer" : true,
+           "xtype" : "Grid",
+           "Boolean fitToFrame" : true,
+           "String region" : "center",
+           "$ xns" : "Roo.bootstrap.panel",
+           "Boolean autoScroll" : true,
+           "items" : [
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n    _this.reportGrid = this;\n}"
+             },
+             "Boolean footerShow" : false,
+             "xtype" : "Table",
+             "$ xns" : "Roo.bootstrap",
+             "* prop" : "grid",
+             "items" : [
+              {
+               "$ Array data" : " [[ \"Client Summary Report\", \"ClientSummary\" ],\n  [ \"Compliance Report\", \"ComplianceReport\" ],\n  [ \"Investor Risk Profile\", \"InvestorRiskProfile\" ]\n ]",
+               "boolean isLocal" : true,
+               "$ Array fields" : "[ 'name', 'url' ]",
+               "xtype" : "SimpleStore",
+               "$ xns" : "Roo.data",
+               "* prop" : "store"
+              },
+              {
+               "String header" : "Report",
+               "String dataIndex" : "name",
+               "xtype" : "ColumnModel",
+               "Number xs" : 6,
+               "$ xns" : "Roo.grid",
+               "$ renderer" : "function(v,x,r) {    \n     return v;\n}",
+               "* prop" : "cm[]"
+              },
+              {
+               "String header" : "Download",
+               "String dataIndex" : "url",
+               "$ Function renderer" : "function(v,x,r) {\n     return String.format( '<a href=\"{0}/Coba/Reports/'+ r.data.url.trim() +'/{1}\" target=\"_new\">Download</a>', \n            baseURL, _this.data.userdata_id\n     );\n}",
+               "xtype" : "ColumnModel",
+               "Number xs" : 6,
+               "$ xns" : "Roo.grid",
+               "* prop" : "cm[]"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "activate" : "function (_self)\n{\n    var url = 'about:blank';\n    \n    if(_this.data.userdata_id * 1 > 0){\n        url = baseURL + '/Coba/Reports/ApplicationSummary/' + _this.data.userdata_id;\n    }\n     \n    _this.app_summary_frame.el.dom.src = url;\n}",
+        "render" : "function (_self)\n{\n    _this.detail_tab = _self;\n}"
+       },
+       "Boolean fitContainer" : true,
+       "xtype" : "Content",
+       "Boolean fitToFrame" : true,
+       "$ xns" : "Roo.bootstrap.panel",
+       "String region" : "center",
+       "String title" : "Application Details",
+       "Boolean autoScroll" : false,
+       "Boolean background" : true,
+       "items" : [
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n    _this.app_summary_frame = this; \n}"
+         },
+         "xtype" : "Element",
+         "tag" : "iframe",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "width:100%;height:100%;border:none;"
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "activate" : "function (_self)\n{\n    if(_this.documentGrid){\n        _this.documentGrid.store.load({});\n    }\n}"
+       },
+       "xtype" : "Grid",
+       "String region" : "center",
+       "$ xns" : "Roo.bootstrap.panel",
+       "String title" : "Uploaded Documents",
+       "Boolean background" : false,
+       "items" : [
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n    _this.documentGrid = this;\n}"
+         },
+         "Boolean footerShow" : false,
+         "String cls" : "coba-document-table",
+         "xtype" : "Table",
+         "$ xns" : "Roo.bootstrap",
+         "* prop" : "grid",
+         "boolean condensed" : true,
+         "items" : [
+          {
+           "listeners" : {
+            "beforeload" : "function (_self, options)\n{ \n    options.params = options.params || {};\n    \n    if(typeof(_this.data.userdata_id) == 'undefined' || _this.data.userdata_id * 1 < 1){\n        this.removeAll();\n        return false;\n    }\n    \n    options.params.is_active = 1;\n    options.params.dec_type = 'checklist';\n    \n    options.params._user_id = _this.data.userdata_id;\n    \n    options.params._with_others = 1;\n}"
+           },
+           "$ Object sortInfo" : "{ direction : 'ASC', field: 'seq_order' } ",
+           "xtype" : "Store",
+           "boolean remoteSort" : true,
+           "$ xns" : "Roo.data",
+           "* prop" : "store",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/coba_declarations'",
+             "xtype" : "HttpProxy",
+             "$ xns" : "Roo.data",
+             "String method" : "GET",
+             "* prop" : "proxy"
+            },
+            {
+             "xtype" : "JsonReader",
+             "String root" : "data",
+             "$ xns" : "Roo.data",
+             "String id" : "id",
+             "* prop" : "reader"
+            }
+           ]
+          },
+          {
+           "String header" : "Document",
+           "String dataIndex" : "title",
+           "xtype" : "ColumnModel",
+           "Number xs" : 4,
+           "$ xns" : "Roo.grid",
+           "Boolean sortable" : true,
+           "* prop" : "cm[]"
+          },
+          {
+           "String header" : "View / Status",
+           "String dataIndex" : "images_ids",
+           "xtype" : "ColumnModel",
+           "Number xs" : 8,
+           "$ xns" : "Roo.grid",
+           "$ renderer" : "function(v,x,r) {\n\n    var types = [\n        'image/png',\n        'image/jpeg',\n        'application/pdf',\n        'application/msword',\n        'application/mswordapplication',\n        'application/vnd.oasis.opendocument.text',\n        'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n        'application/x-abiword'\n    ];\n      \n    var manager = new Roo.bootstrap.DocumentManager({\n        url : baseURL + '/Roo/Images',\n        editable: false,\n        toolTipName: 'title',\n        listeners : {\n            render : function (_self) {\n                \n            },\n            beforeselectfile : function(_self){\n                \n                if(typeof(window.FileReader) == 'undefined' || !window.FileReader) {\n                    Roo.bootstrap.MessageBox.alert('Sorry', 'Your browser is not support to upload file, Please upgrade it.');\n                    return false;\n                }\n                \n                return true;\n            },\n            initial : function (_self) {\n                \n                this.files = r.data.coba_investor_declarations_documents;\n                this.queue();\n            },\n            process : function (_self, file) {\n                \n                if(types.indexOf(file.type) == -1){\n                    this.progressDialog.hide();\n                    Roo.bootstrap.MessageBox.alert('Sorry', 'Invalid File Format');\n                    return false;\n                }\n                \n                if(file.size > 8388608){\n                    this.progressDialog.hide();\n                    Roo.bootstrap.MessageBox.alert('Sorry', 'Maximum size is 8MB');\n                    return false;\n                }\n            },\n            prepare : function (_self, formData, options) {\n                \n                if(r.data.id * 1 == -1){\n                    \n                    options.manually = true;\n                    \n                    Pman.Dialog.CobaInvestorDocumentTitle.show({name : options.file.name}, function(res){\n                        formData.append('_coba_document', 'upload');\n                        formData.append('title', res.title);\n                        formData.append('ontable', 'modx_users');\n                        formData.append('onid', r.data.coba_investor_declarations_id);\n                        formData.append('imgtype', 'other_documents');\n                        \n                        _self.xhr.send(formData);\n                        \n                        return;\n                    });\n                    \n                    return;\n                }\n                \n                formData.append('_coba_document', 'upload');\n                formData.append('ontable', 'coba_investor_declarations');\n                formData.append('onid', r.data.coba_investor_declarations_id);\n            },\n            remove : function (_self, file) {\n                \n                if(typeof(file) == 'undefined' || file.id * 1 < 1){\n                    return;\n                }\n                \n                var m = new Roo.bootstrap.Modal({ \n                    html : 'Are you sure want to remove this document', \n                    title:'Confirm',\n                    buttons : [\n                        {\n                            name : 'yes',\n                            html : 'Yes'\n                        },\n                        {\n                            name : 'no',\n                            html : 'No',\n                            weight : 'primary'\n                        }\n                    ],\n                    listeners : { \n                       btnclick : function(name, e) {\n                       \n                            this.hide();\n                            \n                            if(name == 'no'){\n                                return;\n                            }\n                            \n                            file.target.mask();\n                       \n                            new Pman.Request({\n                                url: baseURL + '/Roo/Images',\n                                method: 'POST',\n                                params: {\n                                    _coba_document : 'remove',\n                                    _delete : file.id\n                                },\n                                success: function(res){\n                                    _self.remove(file);\n                                    _this.form.reloadData();\n                                    return;\n                                },\n                                failure : function(ret) {\n                                    (function(){Roo.bootstrap.MessageBox.alert('Error', ret.errorMsg);}).defer(100);\n                                    return;\n                                }\n                            });\n                            \n                            return;\n                       }\n                   }\n                });\n                \n                m.show();\n             \n            },\n            afterupload : function(_self, xhr)\n            {\n                _this.form.reloadData();\n            },\n            click : function (_self, file) \n            {\n                Pman.Dialog.CobaInvestorViewDocument.show({\n                    file : file\n                }, function(ret){\n                \n                    if(typeof(ret) != 'string'){\n                        return;\n                    }\n                    \n                    if(ret == 'trash'){\n                        _self.fireEvent('remove', _self, file);\n                        return;\n                    }\n                    \n                });\n                \n                return;\n            }\n       }\n       \n    });\n    \n    return manager;\n    \n }\n ",
+           "Boolean sortable" : false,
+           "* prop" : "cm[]"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "activate" : "function (_self)\n{\n    var url = 'about:blank';\n    \n    if(_this.data.userdata_id * 1 > 0){\n        url = baseURL + '/Coba/Reports/LexisNexis/' + _this.data.userdata_id;\n    }\n    \n    var updateMatchStatus = function(frame, id, status) {\n        new Pman.Request({\n            url: baseURL + '/Roo/Coba_investor_lexis_results.php',\n            method : 'POST',\n            params : {\n                id : id,\n                status : status,\n                reason : ''\n            }, \n            success : function(res) {\n                _this.form.reloadData();\n                _this.lexis_nexis_frame.el.dom.src = url;\n                scrollTop = frame.documentElement.scrollTop || frame.body.scrollTop;\n            }\n        });\n    };\n    \n    var scrollTop = 0;\n    \n    _this.lexis_nexis_frame.el.dom.onload = function(){\n        \n        var frame = _this.lexis_nexis_frame.el.dom.contentDocument || _this.lexis_nexis_frame.el.dom.contentWindow.document;\n        \n        var scrollTarget = (typeof(frame.documentElement.scrollTop) != 'undefined') ? frame.documentElement : frame.body;\n        \n        frame.documentElement.scrollTop = scrollTop;\n        frame.body.scrollTop = scrollTop;\n        \n        Roo.each(Roo.get(frame.body).select('button.reject-match', true).elements, function(button){\n        \n            var id = button.attr('data-id');\n            \n            button.on('click', function(e){\n            \n                e.preventDefault();\n                \n                Pman.Dialog.CobaLexisNexisReject.show({ id : id }, function(){\n                    _this.form.reloadData();\n                    _this.lexis_nexis_frame.el.dom.src = url;\n                    scrollTop = Roo.get(frame.body).getScroll().top;\n                });\n                \n            });\n            \n        });\n        \n        Roo.each(Roo.get(frame.body).select('button.accept-match', true).elements, function(button){\n        \n            var id = button.attr('data-id');\n            \n            button.on('click', function(e){\n            \n                e.preventDefault();\n                \n                updateMatchStatus(frame, id, 1);\n                \n            });\n        });\n        \n        Roo.each(Roo.get(frame.body).select('button.un-accept-match', true).elements, function(button){\n        \n            var id = button.attr('data-id');\n            \n            button.on('click', function(e){\n            \n                e.preventDefault();\n                \n                updateMatchStatus(frame, id, 0);\n                \n            });\n        });\n        \n        Roo.each(Roo.get(frame.body).select('button.un-reject-match', true).elements, function(button){\n        \n            var id = button.attr('data-id');\n            \n            button.on('click', function(e){\n            \n                e.preventDefault();\n                \n                updateMatchStatus(frame, id, 0);\n                \n            });\n        });\n        \n    };\n    \n    _this.lexis_nexis_frame.el.dom.src = url;\n    \n    _this.lexis_nexis_search.update();\n}",
+        "render" : "function (_self)\n{\n    _this.lexis_nexis_panel = this;\n}"
+       },
+       "| function update" : "function() \n{ \n    var badges = this.tabItem.el.select('span.badge', true).first();\n    \n    var icon = this.tabItem.el.select('span.icon', true).first();\n    \n    if(!badges || !icon){\n        return;\n    }\n    \n    badges.setVisibilityMode(Roo.Element.DISPLAY).hide();\n    icon.setVisibilityMode(Roo.Element.DISPLAY).hide();\n    \n    if(_this.data.is_lexis_nexis_search_completed * 1 != 1){\n        icon.show();\n        return;\n    }\n    \n    badges.removeClass(['badge-success', 'badge-error']).addClass('badge-error');\n    \n    if(_this.data.is_lexis_nexis_view_completed * 1 == 1){\n        badges.removeClass(['badge-success', 'badge-error']).addClass('badge-success');\n    }\n    \n    badges.show();\n    \n    badges.dom.innerHTML = _this.data.total_lexis_nexis;\n    \n}",
+       "Boolean fitContainer" : true,
+       "xtype" : "Content",
+       "Boolean fitToFrame" : true,
+       "$ xns" : "Roo.bootstrap.panel",
+       "String region" : "center",
+       "String title" : "Lexis Nexis",
+       "Boolean background" : true,
+       "string tpl" : "<a href=\"#\"><span unselectable=\"on\" title=\"{text}\">{text}</span> <span class=\"badge\">{badge}</span><span class=\"icon\"><i class=\"fa fa-cog\"></i></span></a>",
+       "items" : [
+        {
+         "xtype" : "NavSimplebar",
+         "$ xns" : "Roo.bootstrap",
+         "* prop" : "toolbar",
+         "items" : [
+          {
+           "xtype" : "NavGroup",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "xtype" : "NavItem",
+             "$ xns" : "Roo.bootstrap",
+             "String style" : "float: left",
+             "items" : [
+              {
+               "listeners" : {
+                "render" : "function (_self)\n{\n    _this.lexis_nexis_search = this;\n}",
+                "click" : "function (_self, e)\n{\n    if(_this.data.userdata_id * 1 < 1){\n        return;\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Coba/LexisNexis/Search/' + _this.data.userdata_id,\n        method: 'GET',\n        mask: 'Processing...',\n        success : function(res) {\n            var total = res.data.total;\n            \n            var msg = 'No Matching Records where found';\n            \n            if(res.data.total * 1 > 0){\n                msg = String.format('{0} Matching Records where found - please review them on the Lexis Nexis Tab.', res.data.total);\n            }\n            \n            Roo.bootstrap.MessageBox.alert('Lexis Nexis Search Succeed', msg);\n            \n            _this.form.reloadData();\n            \n            var url = 'about:blank';\n    \n            if(_this.data.userdata_id * 1 > 0){\n                url = baseURL + '/Coba/Reports/LexisNexis/' + _this.data.userdata_id;\n            }\n            \n            _this.lexis_nexis_frame.el.dom.src = url;\n        }\n    });\n    \n}"
+               },
+               "String weight" : "primary",
+               "| function update" : "function() \n{ \n    _this.lexis_nexis_search.disable();\n    \n    if(_this.data.is_submit * 1 == 1 && _this.data.is_missing_document * 1 == 0){\n        _this.lexis_nexis_search.enable();\n    }\n    \n}",
+               "xtype" : "Button",
+               "$ xns" : "Roo.bootstrap",
+               "String html" : "Search",
+               "String style" : "margin:5px;"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n    _this.lexis_nexis_frame = this;\n    \n}"
+         },
+         "String tag" : "iframe",
+         "xtype" : "Element",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "width:100%;height:100%;border:none;"
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "activate" : "function (_self)\n{\n    if(_this.activityGrid ) {\n        _this.activityGrid.footer.onClick('first');\n    }\n}"
+       },
+       "xtype" : "Grid",
+       "$ xns" : "Roo.bootstrap.panel",
+       "String region" : "center",
+       "String title" : "Activity Log",
+       "Boolean background" : false,
+       "items" : [
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n    _this.activityGrid = _self;;\n}"
+         },
+         "String cls" : "coba-activity-table",
+         "xtype" : "Table",
+         "$ xns" : "Roo.bootstrap",
+         "Boolean loadMask" : true,
+         "* prop" : "grid",
+         "boolean condensed" : false,
+         "items" : [
+          {
+           "listeners" : {
+            "beforeload" : "function (_self, options)\n{ \n    options.params = options.params || {};\n    \n    if(typeof(_this.data.userdata_id) == 'undefined' || _this.data.userdata_id * 1 < 1){\n        this.removeAll();\n        return false;\n    }\n    options.params._with_dupe_count = 1;\n\n\n    options.params.modx_users_id = _this.data.userdata_id; \n\n\n    \n}\n"
+           },
+           "$ Object sortInfo" : "{ direction : 'DESC', field: 'event_when' } ",
+           "xtype" : "Store",
+           "boolean remoteSort" : true,
+           "$ xns" : "Roo.data",
+           "* prop" : "store",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/Events.php'",
+             "xtype" : "HttpProxy",
+             "$ xns" : "Roo.data",
+             "String method" : "GET",
+             "* prop" : "proxy"
+            },
+            {
+             "xtype" : "JsonReader",
+             "String root" : "data",
+             "$ xns" : "Roo.data",
+             "String id" : "id",
+             "* prop" : "reader"
+            }
+           ]
+          },
+          {
+           "String header" : "When",
+           "String dataIndex" : "event_when",
+           "xtype" : "ColumnModel",
+           "Number xs" : 3,
+           "$ xns" : "Roo.grid",
+           "Boolean sortable" : true,
+           "$ string renderer" : "function(v) \n{ \n    return v ? v.dateFormat('d/M/Y H:i') : ''; \n}",
+           "* prop" : "cm[]"
+          },
+          {
+           "String header" : "action",
+           "String dataIndex" : "action",
+           "xtype" : "ColumnModel",
+           "Number xs" : 3,
+           "$ xns" : "Roo.grid",
+           "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : '');\n}",
+           "Boolean sortable" : true,
+           "* prop" : "cm[]"
+          },
+          {
+           "String header" : "Who",
+           "xtype" : "ColumnModel",
+           "Number xs" : 3,
+           "$ xns" : "Roo.grid",
+           "$ renderer" : "function(v,x,r) {\n     if(r.data.person_id* 1 > 0) {\n         return String.format('{0}', r.data.person_id_name );\n     }\n     if(r.data.modx_users_id_in_middlename !='')\n     {\n         return String.format('{0} {1} {2}', r.data.modx_users_id_in_firstname, r.data.modx_users_id_in_middlename, r.data.modx_users_id_in_lastname );\n     }\n     return String.format('{0} {1}', r.data.modx_users_id_in_firstname, r.data.modx_users_id_in_lastname  );\n\n}",
+           "Boolean sortable" : true,
+           "* prop" : "cm[]"
+          },
+          {
+           "String header" : "Remarks",
+           "String dataIndex" : "remarks",
+           "xtype" : "ColumnModel",
+           "Number xs" : 3,
+           "$ xns" : "Roo.grid",
+           "$ renderer" : "function(v,x,r) {\n     if(r.data.dupe_count*1 > 1) {\n         return String.format('{0} ({1})', v ? v : '', r.data.dupe_count);\n     }\n     return String.format('{0}', v ? v : ''); \n}",
+           "Boolean sortable" : false,
+           "* prop" : "cm[]"
+          },
+          {
+           "Number pageSize" : 10,
+           "xtype" : "PagingToolbar",
+           "$ xns" : "Roo.bootstrap",
+           "* prop" : "footer"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "activate" : "function (_self)\n{\n    if(_this.notes_table ) {\n        _this.notes_table.footer.onClick('first');\n    }\n    \n    _this.coba_person_id.setValue(_this.data.userdata_id);\n    \n}",
+        "render" : "function (_self)\n{\n    _this.notes_tab = _self;\n}"
+       },
+       "Boolean fitContainer" : true,
+       "xtype" : "Nest",
+       "Boolean fitToFrame" : true,
+       "$ xns" : "Roo.bootstrap.panel",
+       "String region" : "center",
+       "String title" : "Notes about User",
+       "Boolean autoScroll" : true,
+       "Boolean background" : true,
+       "items" : [
+        {
+         "xtype" : "Border",
+         "$ xns" : "Roo.bootstrap.layout",
+         "* prop" : "layout",
+         "items" : [
+          {
+           "xtype" : "Region",
+           "Boolean hideTabs" : true,
+           "Number height" : 280,
+           "$ xns" : "Roo.bootstrap.layout",
+           "* prop" : "north",
+           "Boolean split" : true
+          },
+          {
+           "xtype" : "Region",
+           "Boolean hideTabs" : true,
+           "$ xns" : "Roo.bootstrap.layout",
+           "* prop" : "center"
+          },
+          {
+           "Boolean fitContainer" : true,
+           "xtype" : "Content",
+           "Boolean fitToFrame" : true,
+           "String region" : "north",
+           "$ xns" : "Roo.bootstrap.panel",
+           "Boolean autoScroll" : true,
+           "String title" : "Add a Note",
+           "items" : [
+            {
+             "listeners" : {
+              "actionfailed" : "function (_self, action)\n{\n     Roo.bootstrap.MessageBox.alert(action.result.errorMsg);\n}",
+              "actioncomplete" : "function (_self, action)\n{\n   if (action.type == 'submit') { // only submitted here if we are \n        _this.add_notes_button.enable();\n        _this.add_notes_button.setText('Add Note');\n\n   \n        if (_this.callback) {\n            _this.callback.call(this, action.result.data);\n        }\n       _this.notes_textarea.setValue('');\n       if(_this.notes_table ) {\n          _this.notes_table.footer.onClick('first');\n       }\n        return; \n    }\n}",
+              "render" : "function (_self)\n{\n    _this.notes_form = _self; \n}"
+             },
+             "$ url" : "baseURL + '/Roo/Coba_person_notes'",
+             "xtype" : "Form",
+             "$ xns" : "Roo.bootstrap",
+             "String style" : "margin:15px;",
+             "String method" : "POST",
+             "Boolean loadMask" : true,
+             "items" : [
+              {
+               "String header" : "Add a Note",
+               "String panel" : "primary",
+               "xtype" : "Container",
+               "$ xns" : "Roo.bootstrap",
+               "Boolean expandable" : false,
+               "items" : [
+                {
+                 "xtype" : "Row",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "xtype" : "Column",
+                   "$ xns" : "Roo.bootstrap",
+                   "Number sm" : 12,
+                   "items" : [
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.notes_textarea = _self;\n}"
+                     },
+                     "Boolean allowBlank" : false,
+                     "String name" : "notes",
+                     "xtype" : "TextArea",
+                     "Number rows" : 5,
+                     "$ xns" : "Roo.bootstrap"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.coba_person_id = this;\n}"
+                     },
+                     "String name" : "coba_person_id",
+                     "xtype" : "Input",
+                     "String inputType" : "input",
+                     "$ xns" : "Roo.bootstrap",
+                     "String style" : "display: none;"
+                    },
+                    {
+                     "listeners" : {
+                      "render" : "function (_self)\n{\n    _this.add_notes_button = _self;\n}",
+                      "click" : "function (_self, e)\n{\n    if(!_this.notes_form.isValid()){\n          Roo.bootstrap.MessageBox.alert('Error', 'Please enter note');\n          return;\n    }\n    \n    _this.notes_form.doAction('submit');\n    _this.add_notes_button.disable();\n    _this.add_notes_button.setText('sending...');\n\n}"
+                     },
+                     "String weight" : "primary",
+                     "xtype" : "Button",
+                     "$ xns" : "Roo.bootstrap",
+                     "String html" : "Add Note",
+                     "String style" : "float: right; margin: 10px; width: 100px; "
+                    }
+                   ]
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "Boolean fitContainer" : true,
+           "xtype" : "Grid",
+           "Boolean fitToFrame" : true,
+           "String region" : "center",
+           "$ xns" : "Roo.bootstrap.panel",
+           "String title" : "Historical Notes",
+           "items" : [
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n    _this.notes_table = _self;\n}"
+             },
+             "Boolean cellSelection" : true,
+             "boolean responsive" : true,
+             "xtype" : "Table",
+             "$ xns" : "Roo.bootstrap",
+             "Boolean loadMask" : true,
+             "* prop" : "grid",
+             "items" : [
+              {
+               "listeners" : {
+                "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    // set more here\n    options.params.coba_person_id =  _this.data.userdata_id; \n    options.params.limit =   _this.notes_table.footer.pageSize *1; \n    options.params._order_by =   'date_created desc, id desc'; \n}"
+               },
+               "Object sortInfo" : "{ direction : 'ASC', field: 'id' } ",
+               "xtype" : "Store",
+               "boolean remoteSort" : true,
+               "$ xns" : "Roo.data",
+               "* prop" : "store",
+               "items" : [
+                {
+                 "$ url" : "baseURL + '/Roo/Coba_person_notes' ",
+                 "xtype" : "HttpProxy",
+                 "$ xns" : "Roo.data",
+                 "String method" : "GET",
+                 "* prop" : "proxy"
+                },
+                {
+                 "xtype" : "JsonReader",
+                 "String root" : "data",
+                 "$ xns" : "Roo.data",
+                 "String id" : "id",
+                 "* prop" : "reader"
+                }
+               ]
+              },
+              {
+               "String header" : "Date",
+               "String dataIndex" : "date_created",
+               "xtype" : "ColumnModel",
+               "Number xs" : 3,
+               "$ xns" : "Roo.grid",
+               "Boolean sortable" : false,
+               "$ string renderer" : "function(v) { return v ? v.dateFormat('d/m/Y') : ''; }",
+               "* prop" : "cm[]",
+               "Boolean hidden" : false
+              },
+              {
+               "String header" : "id",
+               "String dataIndex" : "id",
+               "xtype" : "ColumnModel",
+               "Number xs" : 2,
+               "$ xns" : "Roo.grid",
+               "Boolean sortable" : true,
+               "* prop" : "cm[]",
+               "Boolean hidden" : true
+              },
+              {
+               "String header" : "Notes",
+               "String dataIndex" : "notes",
+               "xtype" : "ColumnModel",
+               "Number xs" : 9,
+               "$ xns" : "Roo.grid",
+               "$ renderer" : "function(v) { \n\n    //if(v.length > 200) {\n    //    return v.substring(0,199) + '...';\n    //}\n     \n    return v;\n}",
+               "Boolean sortable" : false,
+               "* prop" : "cm[]",
+               "Boolean hidden" : false
+              },
+              {
+               "Number pageSize" : 5,
+               "xtype" : "PagingToolbar",
+               "$ xns" : "Roo.bootstrap",
+               "* prop" : "footer"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    if(_this.data.is_submit * 1 == 1){\n        Roo.bootstrap.MessageBox.alert('Application has been submittted', \"You should 'un-submit' the application if you wish to edit it.\");\n        return;\n    }\n    \n    _this.dialog.el.mask('Sending');\n    \n    new Pman.Request({\n        url: baseURL + '/Coba/ModxSession',\n        method: 'GET',\n        params: {\n            investor_id: _this.data.userdata_id,\n            account_type: _this.data.account_type\n        },\n        success:  function(res)  {\n            if (res.success && res.data) {\n                window.onbeforeunload  =null;\n                window.onunload  = function () {\n                    _this.dialog.el.unmask()\n                };\n                var win = window.open(res.data, '_self');\n            }\n        },\n        failure : function(res)\n        {\n            _this.dialog.el.unmask();\n            Roo.bootstrap.MessageBox.alert(\"Error\",  res.errorMsg);\n        }\n    });\n     \n}"
+     },
+     "String weight" : "warning",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Edit Accreditation",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{   \n    Pman.Dialog.CobaInvestorChangeAdvisor.show({id: _this.data.id}, function(){\n        _this.form.fireEvent('actioncomplete', _this.form,  { type: 'setdata', data: { id : _this.data.id }});\n    });\n    \n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Change Advisor",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    Pman.Dialog.CobaInvestorChangePassword.show({id: _this.data.userdata_id})\n    \n\n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Change User's Password",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n//     if (_this.callback) {\n//         _this.callback.call(this, _this.data);\n//     }\n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Close",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorModify.js b/Pman/Coba/Pman.Dialog.CobaInvestorModify.js
new file mode 100644 (file)
index 0000000..896e61f
--- /dev/null
@@ -0,0 +1,1990 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorModify= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorModify.prototype, {
+
+ _strings : {
+  '44749712dbec183e983dcd78a7736c41' :"Date",
+  '4e97aeeaa8b15ca1180fcd1f3ac478d1' :"When",
+  'e1d496d505f34ae1866fc7ad0e59e7ac' :"Compliance Review",
+  'f28128b38efbc6134dc40751ee21fd29' :"Documents",
+  'd41d8cd98f00b204e9800998ecf8427e' :" ",
+  '3e4901127828df59e44a55af7659e508' :"<i class=\"fa fa-times-circle\"></i> not complete",
+  '457dd55184faedb7885afd4009d70163' :"Review",
+  '231bc72756b5e6de492aaaa1577f61b1' :"Remarks",
+  'b80bb7740288fda1f201890375a60c8f' :"id",
+  '09677be3a36334e7fcad710832364b77' :"Add a Note",
+  '418c5509e2171d55b0aee5c2ea4442b5' :"action",
+  '31e41095bfaa14799239e8d9ba7ad438' :"Application Details",
+  'd41d8cd98f00b204e9800998ecf8427e' :"",
+  '13348442cc6a27032d2b4aa28b75a5d3' :"Search",
+  '93b6fe26d96a3a9812a34cb6ba9b3567' :"Historical Notes",
+  '5cfee765454e9ab499d547c20476f696' :"Change Advisor",
+  '1eb39f9b4c58313ca684e44d590b1d82' :"Lexis Nexis",
+  '2b16564e6e838ce86608620b70beb570' :"Activity Log",
+  '3e4696aa5313272da1baa6497c82a9b5' :"Notes about User",
+  '4b1b4dc8cf38b3c64b1d657da8f5ac8c' :"Report",
+  '0945359809dad1fbf3dea1c95a0da951' :"Document",
+  'b46df2f1d2e702b38d83cc22954263c6' :"Un-submit",
+  'f018a137eb54d99d29a9b41fb6b061b5' :"Add Note",
+  '269d037052d86346356a8077aee32baf' :"View Reason",
+  '0e883c2b722f8a57275b249bef7c94db' :"Lexis Nexis Search",
+  '4ee972120bcda675f75222c87cb9d356' :"Who",
+  '292659c2de7f3de1a9ab2abfef6839a4' :"Uploaded Documents",
+  '801ab24683a4a8c433c6eb40c48bcd9d' :"Download",
+  '405e3e5c89b4b29dcb052614626788bb' :"View / Status",
+  'cce99c598cfdb9773ab041d54c3d973a' :"Profile",
+  '3b878279a04dc47d60932cb294d96259' :"Overview",
+  '8f2ec0b04f61587a0e83068e5ef842bd' :"<i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>  not complete",
+  'a14739916eebbb7689b495e07b15fe2a' :"Edit Accreditation",
+  '66e77e7bfdc713de218e85cf6655b9d1' :"Modify / View Investor",
+  'f4c6f851b00d5518bf888815de279aba' :"Notes",
+  'e3a96404a82d284db5e77ec5a0d9d6cb' :"Change User's Password",
+  'd3d2e617335f08df83599665eef8a418' :"Close"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    fitwindow : true,
+    title : _this._strings['66e77e7bfdc713de218e85cf6655b9d1'] /* Modify / View Investor */,
+    listeners : {
+     hide : function (_self)
+      {
+          if (_this.callback) {
+              _this.callback.call(_self, _this.data);
+          } 
+      },
+     show : function (_self)
+      {
+          _this.dialog.items[0].getRegion('center').showPanel(0); 
+          
+          new Pman.Request({
+              url: baseURL + '/Roo/Core_group.php',
+              method : 'GET',
+              params : {
+                  _count_member_by_name : 'Compliance Officers'
+              }, 
+              success : function(res) {
+      
+                  if(res.data * 1 > 0){
+                      return;
+                  }
+                  
+                  Roo.bootstrap.MessageBox.alert('Warning', "There is no any memeber in 'Compliance Officers' group");
+                  
+              }
+          });
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['a14739916eebbb7689b495e07b15fe2a'] /* Edit Accreditation */,
+      weight : 'warning',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(_this.data.is_submit * 1 == 1){
+                Roo.bootstrap.MessageBox.alert('Application has been submittted', "You should 'un-submit' the application if you wish to edit it.");
+                return;
+            }
+            
+            _this.dialog.el.mask('Sending');
+            
+            new Pman.Request({
+                url: baseURL + '/Coba/ModxSession',
+                method: 'GET',
+                params: {
+                    investor_id: _this.data.userdata_id,
+                    account_type: _this.data.account_type
+                },
+                success:  function(res)  {
+                    if (res.success && res.data) {
+                        window.onbeforeunload  =null;
+                        window.onunload  = function () {
+                            _this.dialog.el.unmask()
+                        };
+                        var win = window.open(res.data, '_self');
+                    }
+                },
+                failure : function(res)
+                {
+                    _this.dialog.el.unmask();
+                    Roo.bootstrap.MessageBox.alert("Error",  res.errorMsg);
+                }
+            });
+             
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['5cfee765454e9ab499d547c20476f696'] /* Change Advisor */,
+      listeners : {
+       click : function (_self, e)
+        {   
+            Pman.Dialog.CobaInvestorChangeAdvisor.show({id: _this.data.id}, function(){
+                _this.form.fireEvent('actioncomplete', _this.form,  { type: 'setdata', data: { id : _this.data.id }});
+            });
+            
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['e3a96404a82d284db5e77ec5a0d9d6cb'] /* Change User's Password */,
+      listeners : {
+       click : function (_self, e)
+        {
+            Pman.Dialog.CobaInvestorChangePassword.show({id: _this.data.userdata_id})
+            
+        
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['d3d2e617335f08df83599665eef8a418'] /* Close */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        //     if (_this.callback) {
+        //         _this.callback.call(this, _this.data);
+        //     }
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Border',
+      listeners : {
+       render : function (_self)
+        {
+            _this.layout = _self;
+        }
+      },
+      xns : Roo.bootstrap.layout,
+      '|xns' : 'Roo.bootstrap.layout',
+      center : {
+       xtype : 'Region',
+       alwaysShowTabs : true,
+       tabPosition : 'top',
+       xns : Roo.bootstrap.layout,
+       '|xns' : 'Roo.bootstrap.layout'
+      },
+      items  : [
+       {
+        xtype : 'Nest',
+        autoScroll : false,
+        fitContainer : true,
+        fitToFrame : true,
+        region : 'center',
+        title : _this._strings['3b878279a04dc47d60932cb294d96259'] /* Overview */,
+        xns : Roo.bootstrap.panel,
+        '|xns' : 'Roo.bootstrap.panel',
+        layout : {
+         xtype : 'Border',
+         xns : Roo.bootstrap.layout,
+         '|xns' : 'Roo.bootstrap.layout',
+         center : {
+          xtype : 'Region',
+          hideTabs : true,
+          xns : Roo.bootstrap.layout,
+          '|xns' : 'Roo.bootstrap.layout'
+         },
+         north : {
+          xtype : 'Region',
+          height : 280,
+          hideTabs : true,
+          split : true,
+          xns : Roo.bootstrap.layout,
+          '|xns' : 'Roo.bootstrap.layout'
+         },
+         items  : [
+          {
+           xtype : 'Content',
+           autoScroll : true,
+           fitContainer : true,
+           fitToFrame : true,
+           region : 'north',
+           title : _this._strings['3b878279a04dc47d60932cb294d96259'] /* Overview */,
+           listeners : {
+            render : function (_self)
+             {
+                 _this.overview_tab = _self;
+             }
+           },
+           xns : Roo.bootstrap.panel,
+           '|xns' : 'Roo.bootstrap.panel',
+           items  : [
+            {
+             xtype : 'Form',
+             loadMask : false,
+             reloadData : function() 
+             {
+                 _this.dialog.el.mask('Loading...');
+                 
+                 _this.form.doAction('load', { method: 'GET', params: { 
+                     '_id' : _this.data.id, 
+                     _with_status : 1, 
+                     _with_lexis_nexis : 1,
+                     _with_compliance_status : 1
+                 }});
+             },
+             url : baseURL + '/Roo/Ext_data',
+             listeners : {
+              actioncomplete : function (_self, action)
+               {
+                   if(action.type == 'setdata'){
+               
+                       _this.form.reset();
+               
+                       if(_this.data.id * 1 > 0) {
+                           
+                           _this.form.reloadData();
+                           
+                       }
+                       
+                       return;
+                   }
+                   
+                   if(action.type == 'load') {
+                       
+                       _this.data = action.result.data;
+                       
+                       _this.dialog.el.unmask();
+                       
+                       _this.dialog.setTitle('Manage Investor - ' + String.format('{0}', _this.data.full_name));
+                       
+                       _this.profile_indicator.update();
+                       
+                       _this.documents_indicator.update();
+                       
+                       _this.lexis_nexis_indicator.update();
+                       
+                       _this.compliance_indicator.update();
+                       
+                       _this.account_type_notice.update();
+                       
+                       _this.fund_name_notice.update();
+                       
+                       _this.advisor_notice.update();
+                       
+                       _this.lexis_nexis_panel.update();
+                       
+                       _this.reportGrid.store.load({});
+               
+                       return;
+                   }
+                   
+                   if(action.type == 'submit') {
+               
+                       return;
+                   }
+               },
+              render : function (_self)
+               {
+                   _this.form = _self; 
+               }
+             },
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Container',
+               style : 'margin-top:5px;',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Row',
+                 style : 'margin-top: 10px; margin-bottom: 10px;',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'Column',
+                   cls : 'text-center',
+                   sm : 4,
+                   update : function() 
+                   { 
+                       this.el.dom.innerHTML = String.format('<b>Type:</b> {0}', _this.data.account_type);
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.account_type_notice = this;
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  },
+                  {
+                   xtype : 'Column',
+                   cls : 'text-center',
+                   sm : 4,
+                   update : function() 
+                   { 
+                       this.el.dom.innerHTML = String.format('<b>Fund Name:</b> {0}', _this.data.fund_name);
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.fund_name_notice = this;
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  },
+                  {
+                   xtype : 'Column',
+                   cls : 'text-center',
+                   sm : 4,
+                   update : function() 
+                   { 
+                       this.el.dom.innerHTML = String.format('<b>Advisor:</b> {0}', _this.data.investment_advisor_id_name);
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.advisor_notice = this;
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  }
+                 ]
+                },
+                {
+                 xtype : 'Row',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'Column',
+                   sm : 3,
+                   style : 'text-align:center',
+                   update : function() 
+                   { 
+                       var icon = 'fa-times-circle';
+                       var msg = 'Not Submitted';
+                       var color = '#941B0C';
+                       
+                       _this.unSubmitBtn.el.hide();
+                       
+                       if(_this.data.is_submit * 1) {
+                       
+                           icon = 'fa-check';
+                           msg = 'Submitted';
+                           color = 'green';
+                           
+                           _this.unSubmitBtn.el.show();
+                       }
+                       
+                       _this.profile_icon.el.setStyle('color', color);
+                       
+                       _this.profile_message.el.dom.innerHTML = String.format('<i style="color:{0}" class="fa {1}"></i> {2}', color, icon, msg);
+                       
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.profile_indicator = this;
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap',
+                   items  : [
+                    {
+                     xtype : 'Container',
+                     cls : 'fa-5x',
+                     fa : 'user',
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.profile_icon = this;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['cce99c598cfdb9773ab041d54c3d973a'] /* Profile */,
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['3e4901127828df59e44a55af7659e508'] /* <i class="fa fa-times-circle"></i> not complete */,
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.profile_message = this;
+                           
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap',
+                     items  : [
+                      {
+                       xtype : 'Row',
+                       xns : Roo.bootstrap,
+                       '|xns' : 'Roo.bootstrap',
+                       items  : [
+                        {
+                         xtype : 'Column',
+                         xs : 12,
+                         xns : Roo.bootstrap,
+                         '|xns' : 'Roo.bootstrap',
+                         items  : [
+                          {
+                           xtype : 'Button',
+                           html : _this._strings['b46df2f1d2e702b38d83cc22954263c6'] /* Un-submit */,
+                           style : 'margin-left: auto; margin-right: auto; margin-bottom: 10px; width: 150px; text-align: center;',
+                           weight : 'info',
+                           listeners : {
+                            click : function (_self, e)
+                             {
+                                 if(!_this.data.id* 1) {
+                                     return;
+                                 }
+                             
+                                 Roo.bootstrap.MessageBox.confirm("Confirm", "Are sure you want to Un-submit?", function (v){
+                                     if (v != 'yes') {
+                                         return;
+                                     }
+                             
+                                     new Pman.Request({
+                                         url : baseURL + '/Roo/Ext_data',
+                                         method: 'POST',
+                                         mask : 'Loading',
+                                         params : {
+                                             id : _this.data.id* 1,
+                                             is_submit: 0
+                                         },
+                                         success : function(res)
+                                         {
+                                             _this.form.reloadData();
+                                         }
+                                     });
+                                 });
+                                 
+                             },
+                            render : function (_self)
+                             {
+                                 _this.unSubmitBtn = this;
+                                 
+                                 this.el.setVisibilityMode(Roo.Element.DISPLAY);
+                                 
+                                 this.el.hide();
+                             }
+                           },
+                           xns : Roo.bootstrap,
+                           '|xns' : 'Roo.bootstrap'
+                          }
+                         ]
+                        }
+                       ]
+                      }
+                     ]
+                    }
+                   ]
+                  },
+                  {
+                   xtype : 'Column',
+                   sm : 3,
+                   style : 'text-align:center',
+                   update : function() 
+                   { 
+                       var icon = 'fa-times-circle';
+                       var msg = 'Not Complete';
+                       var color = '#941B0C';
+                       
+                       if(_this.data.is_missing_document * 1 == 0) {
+                           icon = 'fa-check';
+                           msg = 'Complete';
+                           color = 'green';
+                       }
+                       
+                       _this.check_document_icon.el.setStyle('color', color);
+                       
+                       _this.documents_message.el.dom.innerHTML = String.format('<i style="color:{0}" class="fa {1}"></i> {2}', color, icon, msg);
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.documents_indicator = this;
+                         
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap',
+                   items  : [
+                    {
+                     xtype : 'Container',
+                     cls : 'fa-5x',
+                     fa : 'file-text',
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.check_document_icon = _self;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['f28128b38efbc6134dc40751ee21fd29'] /* Documents */,
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['8f2ec0b04f61587a0e83068e5ef842bd'] /* <i class="fa fa-times-circle" aria-hidden="true"></i>  not complete */,
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.documents_message = this;
+                           
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    }
+                   ]
+                  },
+                  {
+                   xtype : 'Column',
+                   sm : 3,
+                   style : 'text-align:center',
+                   update : function() 
+                   { 
+                       var textIcon = '';
+                       var msg = 'Status : Search not done';
+                       var textColor = '#941B0C';
+                       var color = '#941B0C';
+                       
+                       if(_this.data.is_lexis_nexis_search_completed * 1 == 1) {
+                           msg = String.format('Status : {0} Matches Found', (_this.data.total_lexis_nexis * 1 > 0) ? _this.data.total_lexis_nexis: 'No');
+                           textColor = 'green';
+                           color = 'green';
+                       }
+                       
+                       if(_this.data.is_missing_document * 1 == 1) {
+                           textIcon = 'fa-times-circle';
+                           msg = 'Document Not Upload';
+                           textColor = '#941B0C';
+                           color = '#999';
+                       }
+                       
+                       if(_this.data.is_submit * 1 == 0) {
+                           textIcon = 'fa-times-circle';
+                           msg = 'Application Not complete';
+                           textColor = '#941B0C';
+                           color = '#999';
+                       }
+                       
+                       
+                       _this.lexis_nexis_icon.el.setStyle('color', color);
+                       
+                       _this.lexis_nexis_message.el.dom.innerHTML = String.format(
+                           '<span style="color:{0}">{1}</span>', 
+                           textColor, 
+                           msg
+                       );
+                       
+                       if(textIcon.length){
+                           _this.lexis_nexis_message.el.dom.innerHTML = String.format(
+                               '<i style="color:{0}" class="fa {1}"></i> <span style="color:{0}">{2}</span>', 
+                               textColor, 
+                               textIcon, 
+                               msg
+                           );
+                       }
+                       
+                       _this.lexis_nexis_btn.disable();
+                                          
+                       if(_this.data.is_submit * 1 == 1 && _this.data.is_missing_document * 1 == 0){
+                           _this.lexis_nexis_btn.enable();
+                       }
+                       
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.lexis_nexis_indicator = this;
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap',
+                   items  : [
+                    {
+                     xtype : 'Container',
+                     cls : 'fa-5x',
+                     fa : 'search',
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.lexis_nexis_icon = this;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['1eb39f9b4c58313ca684e44d590b1d82'] /* Lexis Nexis */,
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*   */,
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.lexis_nexis_message = this;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Button',
+                     disabled : false,
+                     html : _this._strings['0e883c2b722f8a57275b249bef7c94db'] /* Lexis Nexis Search */,
+                     weight : 'primary',
+                     listeners : {
+                      click : function (_self, e)
+                       {
+                           if(_this.data.userdata_id * 1 < 1){
+                               return;
+                           }
+                           
+                           new Pman.Request({
+                               url: baseURL + '/Coba/LexisNexis/Search/' + _this.data.userdata_id,
+                               method: 'GET',
+                               mask: 'Processing...',
+                               success : function(res) {
+                                   var total = res.data.total;
+                                   
+                                   var msg = 'No Matching Records where found';
+                                   
+                                   if(res.data.total * 1 > 0){
+                                       msg = String.format('{0} Matching Records where found - please review them on the Lexis Nexis Tab.', res.data.total);
+                                   }
+                                   
+                                   var m = new Roo.bootstrap.Modal({ 
+                                       html : msg, 
+                                       title:'Lexis Nexis Search Succeed', 
+                                       buttons : [
+                                           {
+                                               name : 'ok',
+                                               html : 'OK',
+                                               weight : 'primary'
+                                           }
+                                       ],
+                                       listeners : { 
+                                           btnclick : function(name, e) { 
+                                               
+                                               this.hide();
+                                               
+                                               _this.form.reloadData();
+                                               
+                                               if(res.data.total * 1 == 0){
+                                                   return;
+                                               }
+                                               
+                                               _this.dialog.items[0].getRegion('center').showPanel(3); 
+                                               
+                                           }
+                                       }
+                                   });
+                             
+                                   m.show();
+                                   
+                               }
+                           });
+                           
+                       },
+                      render : function (_self)
+                       {
+                           _this.lexis_nexis_btn = this;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    }
+                   ]
+                  },
+                  {
+                   xtype : 'Column',
+                   sm : 3,
+                   style : 'text-align:center',
+                   update : function() 
+                   {
+                       var msg = 'Pending Approval';
+                       var textColor = '#337ab7';
+                       var color = '#337ab7';
+                       var icon = 'fa-user';
+                       
+                       var isComplianceOfficer = (Pman.Login.authUser.groups.indexOf('Compliance Officers') == -1) ? false : true;
+                       var isAdministrator = (Pman.Login.authUser.groups.indexOf('Administrators') == -1) ? false : true;
+                       
+                       _this.compliance_review_btn.el.hide();
+                       _this.compliance_view_reason_btn.el.hide();
+                       
+                       if(isComplianceOfficer){
+                           _this.compliance_review_btn.el.show();
+                       }
+                       
+                       switch (_this.data.compliance_status) {
+                           case 'APPROVED' : 
+                               msg = String.format('Approved by {0}', _this.data.compliance_status_by);
+                               textColor = 'green';
+                               color = 'green';
+                               icon = 'fa-check';
+                               
+                               _this.compliance_review_btn.el.hide();
+                               _this.compliance_view_reason_btn.el.hide();
+                               
+                               break;
+                           case 'REJECTED' : 
+                               msg = String.format('Reject by {0}', _this.data.compliance_status_by);
+                               textColor = '#941B0C';
+                               color = '#941B0C';
+                               icon = 'fa-times';
+                               
+                               _this.compliance_review_btn.el.hide();
+                               
+                               if(isComplianceOfficer || isAdministrator){
+                                   _this.compliance_view_reason_btn.el.show();
+                               }
+                       
+                               break;
+                           default :
+                               break;
+                       }
+                       
+                       if(_this.data.is_lexis_nexis_view_completed * 1 == 0){
+                           msg = 'Nexis Lexis needs reviewing';
+                           color = '#999';
+                           textColor = '#941B0C';
+                           _this.compliance_review_btn.el.hide();
+                           _this.compliance_view_reason_btn.el.hide();
+                       }
+                       
+                       if(_this.data.is_lexis_nexis_search_completed * 1 == 0) {
+                           msg = 'Nexis Lexis not run';
+                           color = '#999';
+                           textColor = '#941B0C';
+                           _this.compliance_review_btn.el.hide();
+                           _this.compliance_view_reason_btn.el.hide();
+                       }
+                       
+                       _this.compliance_icon.el.setStyle('color', color);
+                       
+                       _this.compliance_icon.el.select('i', true).first().removeClass(['fa-user', 'fa-check']).addClass(icon);
+                       
+                       _this.compliance_message.el.dom.innerHTML = String.format('<span style="color:{0}">{1}</span>', textColor, msg);
+                       
+                   },
+                   listeners : {
+                    render : function (_self)
+                     {
+                         _this.compliance_indicator = this;
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap',
+                   items  : [
+                    {
+                     xtype : 'Container',
+                     cls : 'fa-5x',
+                     fa : 'user',
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.compliance_icon = this;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['e1d496d505f34ae1866fc7ad0e59e7ac'] /* Compliance Review */,
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.compliance_message = this;
+                           
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Element',
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap',
+                     items  : [
+                      {
+                       xtype : 'Row',
+                       xns : Roo.bootstrap,
+                       '|xns' : 'Roo.bootstrap',
+                       items  : [
+                        {
+                         xtype : 'Column',
+                         xs : 12,
+                         xns : Roo.bootstrap,
+                         '|xns' : 'Roo.bootstrap',
+                         items  : [
+                          {
+                           xtype : 'Button',
+                           html : _this._strings['457dd55184faedb7885afd4009d70163'] /* Review */,
+                           style : 'width: 150px; text-align: center;',
+                           weight : 'primary',
+                           listeners : {
+                            click : function (_self, e)
+                             {
+                                 if(_this.data.id * 1 < 1) {
+                                     return;
+                                 }
+                                 
+                                 Pman.Dialog.CobaInvestorComplianceReview.show({
+                                     id : _this.data.id,
+                                     userdata_id : _this.data.userdata_id
+                                 }, function(){
+                                     _this.form.reloadData();
+                                 });
+                                 
+                             },
+                            render : function (_self)
+                             {
+                                 _this.compliance_review_btn = this;
+                                 
+                                 this.el.setVisibilityMode(Roo.Element.DISPLAY);
+                                 
+                                 this.el.hide();
+                             }
+                           },
+                           xns : Roo.bootstrap,
+                           '|xns' : 'Roo.bootstrap'
+                          },
+                          {
+                           xtype : 'Button',
+                           html : _this._strings['269d037052d86346356a8077aee32baf'] /* View Reason */,
+                           style : 'width: 150px; text-align: center;',
+                           weight : 'danger',
+                           listeners : {
+                            click : function (_self, e)
+                             {
+                                 if(!_this.data.compliance_coba_investor_notes || _this.data.compliance_coba_investor_notes.id * 1 < 1) {
+                                     return;
+                                 }
+                                 
+                                 Roo.bootstrap.MessageBox.alert('Reason', _this.data.compliance_coba_investor_notes.notes);
+                                 
+                             },
+                            render : function (_self)
+                             {
+                                 _this.compliance_view_reason_btn = this;
+                                 
+                                 this.el.setVisibilityMode(Roo.Element.DISPLAY);
+                                 
+                                 this.el.hide();
+                             }
+                           },
+                           xns : Roo.bootstrap,
+                           '|xns' : 'Roo.bootstrap'
+                          }
+                         ]
+                        }
+                       ]
+                      }
+                     ]
+                    }
+                   ]
+                  }
+                 ]
+                }
+               ]
+              },
+              {
+               xtype : 'Input',
+               inputType : 'hidden',
+               name : 'id',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Grid',
+           autoScroll : true,
+           fitContainer : true,
+           fitToFrame : true,
+           region : 'center',
+           xns : Roo.bootstrap.panel,
+           '|xns' : 'Roo.bootstrap.panel',
+           grid : {
+            xtype : 'Table',
+            footerShow : false,
+            listeners : {
+             render : function (_self)
+              {
+                  _this.reportGrid = this;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'SimpleStore',
+             data : [[ "Client Summary Report", "ClientSummary" ],
+               [ "Compliance Report", "ComplianceReport" ],
+               [ "Investor Risk Profile", "InvestorRiskProfile" ]
+              ],
+             fields : [ 'name', 'url' ],
+             isLocal : true,
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            },
+            cm : [
+             {
+              xtype : 'ColumnModel',
+              dataIndex : 'name',
+              header : _this._strings['4b1b4dc8cf38b3c64b1d657da8f5ac8c'] /* Report */,
+              renderer : function(v,x,r) {    
+                   return v;
+              },
+              xs : 6,
+              xns : Roo.grid,
+              '|xns' : 'Roo.grid'
+             },
+             {
+              xtype : 'ColumnModel',
+              dataIndex : 'url',
+              header : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
+              renderer : function(v,x,r) {
+                   return String.format( '<a href="{0}/Coba/Reports/'+ r.data.url.trim() +'/{1}" target="_new">Download</a>', 
+                          baseURL, _this.data.userdata_id
+                   );
+              },
+              xs : 6,
+              xns : Roo.grid,
+              '|xns' : 'Roo.grid'
+             }
+            ]
+           }
+          }
+         ]
+        }
+       },
+       {
+        xtype : 'Content',
+        autoScroll : false,
+        background : true,
+        fitContainer : true,
+        fitToFrame : true,
+        region : 'center',
+        title : _this._strings['31e41095bfaa14799239e8d9ba7ad438'] /* Application Details */,
+        listeners : {
+         activate : function (_self)
+          {
+              var url = 'about:blank';
+              
+              if(_this.data.userdata_id * 1 > 0){
+                  url = baseURL + '/Coba/Reports/ApplicationSummary/' + _this.data.userdata_id;
+              }
+               
+              _this.app_summary_frame.el.dom.src = url;
+          },
+         render : function (_self)
+          {
+              _this.detail_tab = _self;
+          }
+        },
+        xns : Roo.bootstrap.panel,
+        '|xns' : 'Roo.bootstrap.panel',
+        items  : [
+         {
+          xtype : 'Element',
+          style : 'width:100%;height:100%;border:none;',
+          tag : 'iframe',
+          listeners : {
+           render : function (_self)
+            {
+                _this.app_summary_frame = this; 
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         }
+        ]
+       },
+       {
+        xtype : 'Grid',
+        background : false,
+        region : 'center',
+        title : _this._strings['292659c2de7f3de1a9ab2abfef6839a4'] /* Uploaded Documents */,
+        listeners : {
+         activate : function (_self)
+          {
+              if(_this.documentGrid){
+                  _this.documentGrid.store.load({});
+              }
+          }
+        },
+        xns : Roo.bootstrap.panel,
+        '|xns' : 'Roo.bootstrap.panel',
+        grid : {
+         xtype : 'Table',
+         cls : 'coba-document-table',
+         condensed : true,
+         footerShow : false,
+         listeners : {
+          render : function (_self)
+           {
+               _this.documentGrid = this;
+           }
+         },
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         store : {
+          xtype : 'Store',
+          remoteSort : true,
+          sortInfo : { direction : 'ASC', field: 'seq_order' },
+          listeners : {
+           beforeload : function (_self, options)
+            { 
+                options.params = options.params || {};
+                
+                if(typeof(_this.data.userdata_id) == 'undefined' || _this.data.userdata_id * 1 < 1){
+                    this.removeAll();
+                    return false;
+                }
+                
+                options.params.is_active = 1;
+                options.params.dec_type = 'checklist';
+                
+                options.params._user_id = _this.data.userdata_id;
+                
+                options.params._with_others = 1;
+            }
+          },
+          xns : Roo.data,
+          '|xns' : 'Roo.data',
+          proxy : {
+           xtype : 'HttpProxy',
+           method : 'GET',
+           url : baseURL + '/Roo/coba_declarations',
+           xns : Roo.data,
+           '|xns' : 'Roo.data'
+          },
+          reader : {
+           xtype : 'JsonReader',
+           id : 'id',
+           root : 'data',
+           xns : Roo.data,
+           '|xns' : 'Roo.data'
+          }
+         },
+         cm : [
+          {
+           xtype : 'ColumnModel',
+           dataIndex : 'title',
+           header : _this._strings['0945359809dad1fbf3dea1c95a0da951'] /* Document */,
+           sortable : true,
+           xs : 4,
+           xns : Roo.grid,
+           '|xns' : 'Roo.grid'
+          },
+          {
+           xtype : 'ColumnModel',
+           dataIndex : 'images_ids',
+           header : _this._strings['405e3e5c89b4b29dcb052614626788bb'] /* View / Status */,
+           renderer : function(v,x,r) {
+           
+               var types = [
+                   'image/png',
+                   'image/jpeg',
+                   'application/pdf',
+                   'application/msword',
+                   'application/mswordapplication',
+                   'application/vnd.oasis.opendocument.text',
+                   'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+                   'application/x-abiword'
+               ];
+                 
+               var manager = new Roo.bootstrap.DocumentManager({
+                   url : baseURL + '/Roo/Images',
+                   editable: false,
+                   toolTipName: 'title',
+                   listeners : {
+                       render : function (_self) {
+                           
+                       },
+                       beforeselectfile : function(_self){
+                           
+                           if(typeof(window.FileReader) == 'undefined' || !window.FileReader) {
+                               Roo.bootstrap.MessageBox.alert('Sorry', 'Your browser is not support to upload file, Please upgrade it.');
+                               return false;
+                           }
+                           
+                           return true;
+                       },
+                       initial : function (_self) {
+                           
+                           this.files = r.data.coba_investor_declarations_documents;
+                           this.queue();
+                       },
+                       process : function (_self, file) {
+                           
+                           if(types.indexOf(file.type) == -1){
+                               this.progressDialog.hide();
+                               Roo.bootstrap.MessageBox.alert('Sorry', 'Invalid File Format');
+                               return false;
+                           }
+                           
+                           if(file.size > 8388608){
+                               this.progressDialog.hide();
+                               Roo.bootstrap.MessageBox.alert('Sorry', 'Maximum size is 8MB');
+                               return false;
+                           }
+                       },
+                       prepare : function (_self, formData, options) {
+                           
+                           if(r.data.id * 1 == -1){
+                               
+                               options.manually = true;
+                               
+                               Pman.Dialog.CobaInvestorDocumentTitle.show({name : options.file.name}, function(res){
+                                   formData.append('_coba_document', 'upload');
+                                   formData.append('title', res.title);
+                                   formData.append('ontable', 'modx_users');
+                                   formData.append('onid', r.data.coba_investor_declarations_id);
+                                   formData.append('imgtype', 'other_documents');
+                                   
+                                   _self.xhr.send(formData);
+                                   
+                                   return;
+                               });
+                               
+                               return;
+                           }
+                           
+                           formData.append('_coba_document', 'upload');
+                           formData.append('ontable', 'coba_investor_declarations');
+                           formData.append('onid', r.data.coba_investor_declarations_id);
+                       },
+                       remove : function (_self, file) {
+                           
+                           if(typeof(file) == 'undefined' || file.id * 1 < 1){
+                               return;
+                           }
+                           
+                           var m = new Roo.bootstrap.Modal({ 
+                               html : 'Are you sure want to remove this document', 
+                               title:'Confirm',
+                               buttons : [
+                                   {
+                                       name : 'yes',
+                                       html : 'Yes'
+                                   },
+                                   {
+                                       name : 'no',
+                                       html : 'No',
+                                       weight : 'primary'
+                                   }
+                               ],
+                               listeners : { 
+                                  btnclick : function(name, e) {
+                                  
+                                       this.hide();
+                                       
+                                       if(name == 'no'){
+                                           return;
+                                       }
+                                       
+                                       file.target.mask();
+                                  
+                                       new Pman.Request({
+                                           url: baseURL + '/Roo/Images',
+                                           method: 'POST',
+                                           params: {
+                                               _coba_document : 'remove',
+                                               _delete : file.id
+                                           },
+                                           success: function(res){
+                                               _self.remove(file);
+                                               _this.form.reloadData();
+                                               return;
+                                           },
+                                           failure : function(ret) {
+                                               (function(){Roo.bootstrap.MessageBox.alert('Error', ret.errorMsg);}).defer(100);
+                                               return;
+                                           }
+                                       });
+                                       
+                                       return;
+                                  }
+                              }
+                           });
+                           
+                           m.show();
+                        
+                       },
+                       afterupload : function(_self, xhr)
+                       {
+                           _this.form.reloadData();
+                       },
+                       click : function (_self, file) 
+                       {
+                           Pman.Dialog.CobaInvestorViewDocument.show({
+                               file : file
+                           }, function(ret){
+                           
+                               if(typeof(ret) != 'string'){
+                                   return;
+                               }
+                               
+                               if(ret == 'trash'){
+                                   _self.fireEvent('remove', _self, file);
+                                   return;
+                               }
+                               
+                           });
+                           
+                           return;
+                       }
+                  }
+                  
+               });
+               
+               return manager;
+               
+            },
+           sortable : false,
+           xs : 8,
+           xns : Roo.grid,
+           '|xns' : 'Roo.grid'
+          }
+         ]
+        }
+       },
+       {
+        xtype : 'Content',
+        background : true,
+        fitContainer : true,
+        fitToFrame : true,
+        region : 'center',
+        title : _this._strings['1eb39f9b4c58313ca684e44d590b1d82'] /* Lexis Nexis */,
+        tpl : '<a href=\"#\"><span unselectable=\"on\" title=\"{text}\">{text}</span> <span class=\"badge\">{badge}</span><span class=\"icon\"><i class=\"fa fa-cog\"></i></span></a>',
+        update : function() 
+        { 
+            var badges = this.tabItem.el.select('span.badge', true).first();
+            
+            var icon = this.tabItem.el.select('span.icon', true).first();
+            
+            if(!badges || !icon){
+                return;
+            }
+            
+            badges.setVisibilityMode(Roo.Element.DISPLAY).hide();
+            icon.setVisibilityMode(Roo.Element.DISPLAY).hide();
+            
+            if(_this.data.is_lexis_nexis_search_completed * 1 != 1){
+                icon.show();
+                return;
+            }
+            
+            badges.removeClass(['badge-success', 'badge-error']).addClass('badge-error');
+            
+            if(_this.data.is_lexis_nexis_view_completed * 1 == 1){
+                badges.removeClass(['badge-success', 'badge-error']).addClass('badge-success');
+            }
+            
+            badges.show();
+            
+            badges.dom.innerHTML = _this.data.total_lexis_nexis;
+            
+        },
+        listeners : {
+         activate : function (_self)
+          {
+              var url = 'about:blank';
+              
+              if(_this.data.userdata_id * 1 > 0){
+                  url = baseURL + '/Coba/Reports/LexisNexis/' + _this.data.userdata_id;
+              }
+              
+              var updateMatchStatus = function(frame, id, status) {
+                  new Pman.Request({
+                      url: baseURL + '/Roo/Coba_investor_lexis_results.php',
+                      method : 'POST',
+                      params : {
+                          id : id,
+                          status : status,
+                          reason : ''
+                      }, 
+                      success : function(res) {
+                          _this.form.reloadData();
+                          _this.lexis_nexis_frame.el.dom.src = url;
+                          scrollTop = frame.documentElement.scrollTop || frame.body.scrollTop;
+                      }
+                  });
+              };
+              
+              var scrollTop = 0;
+              
+              _this.lexis_nexis_frame.el.dom.onload = function(){
+                  
+                  var frame = _this.lexis_nexis_frame.el.dom.contentDocument || _this.lexis_nexis_frame.el.dom.contentWindow.document;
+                  
+                  var scrollTarget = (typeof(frame.documentElement.scrollTop) != 'undefined') ? frame.documentElement : frame.body;
+                  
+                  frame.documentElement.scrollTop = scrollTop;
+                  frame.body.scrollTop = scrollTop;
+                  
+                  Roo.each(Roo.get(frame.body).select('button.reject-match', true).elements, function(button){
+                  
+                      var id = button.attr('data-id');
+                      
+                      button.on('click', function(e){
+                      
+                          e.preventDefault();
+                          
+                          Pman.Dialog.CobaLexisNexisReject.show({ id : id }, function(){
+                              _this.form.reloadData();
+                              _this.lexis_nexis_frame.el.dom.src = url;
+                              scrollTop = Roo.get(frame.body).getScroll().top;
+                          });
+                          
+                      });
+                      
+                  });
+                  
+                  Roo.each(Roo.get(frame.body).select('button.accept-match', true).elements, function(button){
+                  
+                      var id = button.attr('data-id');
+                      
+                      button.on('click', function(e){
+                      
+                          e.preventDefault();
+                          
+                          updateMatchStatus(frame, id, 1);
+                          
+                      });
+                  });
+                  
+                  Roo.each(Roo.get(frame.body).select('button.un-accept-match', true).elements, function(button){
+                  
+                      var id = button.attr('data-id');
+                      
+                      button.on('click', function(e){
+                      
+                          e.preventDefault();
+                          
+                          updateMatchStatus(frame, id, 0);
+                          
+                      });
+                  });
+                  
+                  Roo.each(Roo.get(frame.body).select('button.un-reject-match', true).elements, function(button){
+                  
+                      var id = button.attr('data-id');
+                      
+                      button.on('click', function(e){
+                      
+                          e.preventDefault();
+                          
+                          updateMatchStatus(frame, id, 0);
+                          
+                      });
+                  });
+                  
+              };
+              
+              _this.lexis_nexis_frame.el.dom.src = url;
+              
+              _this.lexis_nexis_search.update();
+          },
+         render : function (_self)
+          {
+              _this.lexis_nexis_panel = this;
+          }
+        },
+        xns : Roo.bootstrap.panel,
+        '|xns' : 'Roo.bootstrap.panel',
+        toolbar : {
+         xtype : 'NavSimplebar',
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         items  : [
+          {
+           xtype : 'NavGroup',
+           xns : Roo.bootstrap,
+           '|xns' : 'Roo.bootstrap',
+           items  : [
+            {
+             xtype : 'NavItem',
+             style : 'float: left',
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Button',
+               html : _this._strings['13348442cc6a27032d2b4aa28b75a5d3'] /* Search */,
+               style : 'margin:5px;',
+               update : function() 
+               { 
+                   _this.lexis_nexis_search.disable();
+                   
+                   if(_this.data.is_submit * 1 == 1 && _this.data.is_missing_document * 1 == 0){
+                       _this.lexis_nexis_search.enable();
+                   }
+                   
+               },
+               weight : 'primary',
+               listeners : {
+                click : function (_self, e)
+                 {
+                     if(_this.data.userdata_id * 1 < 1){
+                         return;
+                     }
+                     
+                     new Pman.Request({
+                         url: baseURL + '/Coba/LexisNexis/Search/' + _this.data.userdata_id,
+                         method: 'GET',
+                         mask: 'Processing...',
+                         success : function(res) {
+                             var total = res.data.total;
+                             
+                             var msg = 'No Matching Records where found';
+                             
+                             if(res.data.total * 1 > 0){
+                                 msg = String.format('{0} Matching Records where found - please review them on the Lexis Nexis Tab.', res.data.total);
+                             }
+                             
+                             Roo.bootstrap.MessageBox.alert('Lexis Nexis Search Succeed', msg);
+                             
+                             _this.form.reloadData();
+                             
+                             var url = 'about:blank';
+                     
+                             if(_this.data.userdata_id * 1 > 0){
+                                 url = baseURL + '/Coba/Reports/LexisNexis/' + _this.data.userdata_id;
+                             }
+                             
+                             _this.lexis_nexis_frame.el.dom.src = url;
+                         }
+                     });
+                     
+                 },
+                render : function (_self)
+                 {
+                     _this.lexis_nexis_search = this;
+                 }
+               },
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap'
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        items  : [
+         {
+          xtype : 'Element',
+          style : 'width:100%;height:100%;border:none;',
+          tag : 'iframe',
+          listeners : {
+           render : function (_self)
+            {
+                _this.lexis_nexis_frame = this;
+                
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         }
+        ]
+       },
+       {
+        xtype : 'Grid',
+        background : false,
+        region : 'center',
+        title : _this._strings['2b16564e6e838ce86608620b70beb570'] /* Activity Log */,
+        listeners : {
+         activate : function (_self)
+          {
+              if(_this.activityGrid ) {
+                  _this.activityGrid.footer.onClick('first');
+              }
+          }
+        },
+        xns : Roo.bootstrap.panel,
+        '|xns' : 'Roo.bootstrap.panel',
+        grid : {
+         xtype : 'Table',
+         cls : 'coba-activity-table',
+         condensed : false,
+         loadMask : true,
+         listeners : {
+          render : function (_self)
+           {
+               _this.activityGrid = _self;;
+           }
+         },
+         xns : Roo.bootstrap,
+         '|xns' : 'Roo.bootstrap',
+         footer : {
+          xtype : 'PagingToolbar',
+          pageSize : 10,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         },
+         store : {
+          xtype : 'Store',
+          remoteSort : true,
+          sortInfo : { direction : 'DESC', field: 'event_when' },
+          listeners : {
+           beforeload : function (_self, options)
+            { 
+                options.params = options.params || {};
+                
+                if(typeof(_this.data.userdata_id) == 'undefined' || _this.data.userdata_id * 1 < 1){
+                    this.removeAll();
+                    return false;
+                }
+                options.params._with_dupe_count = 1;
+            
+            
+                options.params.modx_users_id = _this.data.userdata_id; 
+            
+            
+                
+            }
+          },
+          xns : Roo.data,
+          '|xns' : 'Roo.data',
+          proxy : {
+           xtype : 'HttpProxy',
+           method : 'GET',
+           url : baseURL + '/Roo/Events.php',
+           xns : Roo.data,
+           '|xns' : 'Roo.data'
+          },
+          reader : {
+           xtype : 'JsonReader',
+           id : 'id',
+           root : 'data',
+           xns : Roo.data,
+           '|xns' : 'Roo.data'
+          }
+         },
+         cm : [
+          {
+           xtype : 'ColumnModel',
+           dataIndex : 'event_when',
+           header : _this._strings['4e97aeeaa8b15ca1180fcd1f3ac478d1'] /* When */,
+           renderer : function(v) 
+           { 
+               return v ? v.dateFormat('d/M/Y H:i') : ''; 
+           },
+           sortable : true,
+           xs : 3,
+           xns : Roo.grid,
+           '|xns' : 'Roo.grid'
+          },
+          {
+           xtype : 'ColumnModel',
+           dataIndex : 'action',
+           header : _this._strings['418c5509e2171d55b0aee5c2ea4442b5'] /* action */,
+           renderer : function(v) 
+           { 
+               return String.format('{0}', v ? v : '');
+           },
+           sortable : true,
+           xs : 3,
+           xns : Roo.grid,
+           '|xns' : 'Roo.grid'
+          },
+          {
+           xtype : 'ColumnModel',
+           header : _this._strings['4ee972120bcda675f75222c87cb9d356'] /* Who */,
+           renderer : function(v,x,r) {
+                if(r.data.person_id* 1 > 0) {
+                    return String.format('{0}', r.data.person_id_name );
+                }
+                if(r.data.modx_users_id_in_middlename !='')
+                {
+                    return String.format('{0} {1} {2}', r.data.modx_users_id_in_firstname, r.data.modx_users_id_in_middlename, r.data.modx_users_id_in_lastname );
+                }
+                return String.format('{0} {1}', r.data.modx_users_id_in_firstname, r.data.modx_users_id_in_lastname  );
+           
+           },
+           sortable : true,
+           xs : 3,
+           xns : Roo.grid,
+           '|xns' : 'Roo.grid'
+          },
+          {
+           xtype : 'ColumnModel',
+           dataIndex : 'remarks',
+           header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */,
+           renderer : function(v,x,r) {
+                if(r.data.dupe_count*1 > 1) {
+                    return String.format('{0} ({1})', v ? v : '', r.data.dupe_count);
+                }
+                return String.format('{0}', v ? v : ''); 
+           },
+           sortable : false,
+           xs : 3,
+           xns : Roo.grid,
+           '|xns' : 'Roo.grid'
+          }
+         ]
+        }
+       },
+       {
+        xtype : 'Nest',
+        autoScroll : true,
+        background : true,
+        fitContainer : true,
+        fitToFrame : true,
+        region : 'center',
+        title : _this._strings['3e4696aa5313272da1baa6497c82a9b5'] /* Notes about User */,
+        listeners : {
+         activate : function (_self)
+          {
+              if(_this.notes_table ) {
+                  _this.notes_table.footer.onClick('first');
+              }
+              
+              _this.coba_person_id.setValue(_this.data.userdata_id);
+              
+          },
+         render : function (_self)
+          {
+              _this.notes_tab = _self;
+          }
+        },
+        xns : Roo.bootstrap.panel,
+        '|xns' : 'Roo.bootstrap.panel',
+        layout : {
+         xtype : 'Border',
+         xns : Roo.bootstrap.layout,
+         '|xns' : 'Roo.bootstrap.layout',
+         center : {
+          xtype : 'Region',
+          hideTabs : true,
+          xns : Roo.bootstrap.layout,
+          '|xns' : 'Roo.bootstrap.layout'
+         },
+         north : {
+          xtype : 'Region',
+          height : 280,
+          hideTabs : true,
+          split : true,
+          xns : Roo.bootstrap.layout,
+          '|xns' : 'Roo.bootstrap.layout'
+         },
+         items  : [
+          {
+           xtype : 'Content',
+           autoScroll : true,
+           fitContainer : true,
+           fitToFrame : true,
+           region : 'north',
+           title : _this._strings['09677be3a36334e7fcad710832364b77'] /* Add a Note */,
+           xns : Roo.bootstrap.panel,
+           '|xns' : 'Roo.bootstrap.panel',
+           items  : [
+            {
+             xtype : 'Form',
+             loadMask : true,
+             method : 'POST',
+             style : 'margin:15px;',
+             url : baseURL + '/Roo/Coba_person_notes',
+             listeners : {
+              actioncomplete : function (_self, action)
+               {
+                  if (action.type == 'submit') { // only submitted here if we are 
+                       _this.add_notes_button.enable();
+                       _this.add_notes_button.setText('Add Note');
+               
+                  
+                       if (_this.callback) {
+                           _this.callback.call(this, action.result.data);
+                       }
+                      _this.notes_textarea.setValue('');
+                      if(_this.notes_table ) {
+                         _this.notes_table.footer.onClick('first');
+                      }
+                       return; 
+                   }
+               },
+              actionfailed : function (_self, action)
+               {
+                    Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
+               },
+              render : function (_self)
+               {
+                   _this.notes_form = _self; 
+               }
+             },
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap',
+             items  : [
+              {
+               xtype : 'Container',
+               expandable : false,
+               header : _this._strings['09677be3a36334e7fcad710832364b77'] /* Add a Note */,
+               panel : 'primary',
+               xns : Roo.bootstrap,
+               '|xns' : 'Roo.bootstrap',
+               items  : [
+                {
+                 xtype : 'Row',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'Column',
+                   sm : 12,
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap',
+                   items  : [
+                    {
+                     xtype : 'TextArea',
+                     allowBlank : false,
+                     name : 'notes',
+                     rows : 5,
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.notes_textarea = _self;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Input',
+                     inputType : 'input',
+                     name : 'coba_person_id',
+                     style : 'display: none;',
+                     listeners : {
+                      render : function (_self)
+                       {
+                           _this.coba_person_id = this;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    },
+                    {
+                     xtype : 'Button',
+                     html : _this._strings['f018a137eb54d99d29a9b41fb6b061b5'] /* Add Note */,
+                     style : 'float: right; margin: 10px; width: 100px; ',
+                     weight : 'primary',
+                     listeners : {
+                      click : function (_self, e)
+                       {
+                           if(!_this.notes_form.isValid()){
+                                 Roo.bootstrap.MessageBox.alert('Error', 'Please enter note');
+                                 return;
+                           }
+                           
+                           _this.notes_form.doAction('submit');
+                           _this.add_notes_button.disable();
+                           _this.add_notes_button.setText('sending...');
+                       
+                       },
+                      render : function (_self)
+                       {
+                           _this.add_notes_button = _self;
+                       }
+                     },
+                     xns : Roo.bootstrap,
+                     '|xns' : 'Roo.bootstrap'
+                    }
+                   ]
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          },
+          {
+           xtype : 'Grid',
+           fitContainer : true,
+           fitToFrame : true,
+           region : 'center',
+           title : _this._strings['93b6fe26d96a3a9812a34cb6ba9b3567'] /* Historical Notes */,
+           xns : Roo.bootstrap.panel,
+           '|xns' : 'Roo.bootstrap.panel',
+           grid : {
+            xtype : 'Table',
+            cellSelection : true,
+            loadMask : true,
+            responsive : true,
+            listeners : {
+             render : function (_self)
+              {
+                  _this.notes_table = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            footer : {
+             xtype : 'PagingToolbar',
+             pageSize : 5,
+             xns : Roo.bootstrap,
+             '|xns' : 'Roo.bootstrap'
+            },
+            store : {
+             xtype : 'Store',
+             remoteSort : true,
+             sortInfo : '{ direction : \'ASC\', field: \'id\' } ',
+             listeners : {
+              beforeload : function (_self, options)
+               {
+                   options.params = options.params || {};
+                   // set more here
+                   options.params.coba_person_id =  _this.data.userdata_id; 
+                   options.params.limit =   _this.notes_table.footer.pageSize *1; 
+                   options.params._order_by =   'date_created desc, id desc'; 
+               }
+             },
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             proxy : {
+              xtype : 'HttpProxy',
+              method : 'GET',
+              url : baseURL + '/Roo/Coba_person_notes',
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             },
+             reader : {
+              xtype : 'JsonReader',
+              id : 'id',
+              root : 'data',
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             }
+            },
+            cm : [
+             {
+              xtype : 'ColumnModel',
+              dataIndex : 'date_created',
+              header : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */,
+              hidden : false,
+              renderer : function(v) { return v ? v.dateFormat('d/m/Y') : ''; },
+              sortable : false,
+              xs : 3,
+              xns : Roo.grid,
+              '|xns' : 'Roo.grid'
+             },
+             {
+              xtype : 'ColumnModel',
+              dataIndex : 'id',
+              header : _this._strings['b80bb7740288fda1f201890375a60c8f'] /* id */,
+              hidden : true,
+              sortable : true,
+              xs : 2,
+              xns : Roo.grid,
+              '|xns' : 'Roo.grid'
+             },
+             {
+              xtype : 'ColumnModel',
+              dataIndex : 'notes',
+              header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
+              hidden : false,
+              renderer : function(v) { 
+              
+                  //if(v.length > 200) {
+                  //    return v.substring(0,199) + '...';
+                  //}
+                   
+                  return v;
+              },
+              sortable : false,
+              xs : 9,
+              xns : Roo.grid,
+              '|xns' : 'Roo.grid'
+             }
+            ]
+           }
+          }
+         ]
+        }
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorModify, Pman.Dialog.CobaInvestorModify.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.bjs
new file mode 100644 (file)
index 0000000..05e3670
--- /dev/null
@@ -0,0 +1,18 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorModifyViewProfile",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "c428704e24d1e6c1b7a914c2a6ba9695" : "Investor Profile"
+ },
+ "items" : [
+  {
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Investor Profile"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.js b/Pman/Coba/Pman.Dialog.CobaInvestorModifyViewProfile.js
new file mode 100644 (file)
index 0000000..42c846c
--- /dev/null
@@ -0,0 +1,43 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorModifyViewProfile = {
+
+ _strings : {
+  'c428704e24d1e6c1b7a914c2a6ba9695' :"Investor Profile"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    title : _this._strings['c428704e24d1e6c1b7a914c2a6ba9695'] /* Investor Profile */,
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap'
+   }  );
+ }
+};
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorSearch.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorSearch.bjs
new file mode 100644 (file)
index 0000000..248b05a
--- /dev/null
@@ -0,0 +1,234 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorSearch",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/khlau/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorSearch.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "77587239bf4c54ea493c7033e1dbf636" : "Last Name",
+  "13348442cc6a27032d2b4aa28b75a5d3" : "Search",
+  "e5676ba19f12f141c9d199c36ee5fde6" : "please select the fund related to the investor",
+  "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
+  "0715d4a63b8542504b1b1b2af082240e" : "Search Investor",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "ae9e6ac49d4f451b1ebf440619f595b5" : "please select the type of the investor",
+  "c1098dd48f0fb20eeea79235055d02ca" : "Fund",
+  "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
+  "bc910f8bdf70f29374f496f05be0330c" : "First Name",
+  "e456949630edb405fba2217ddeef7f3c" : "Primary contact email"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "render" : "function (_self)\n{\n    _this.option = {};\n    _this.option.params = {};\n}"
+   },
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Search Investor",
+   "items" : [
+    {
+     "listeners" : {
+      "show" : "function (_self)\n{\n    if(_this.fund_name) {\n        _this.fund_name.store.load({});\n    }\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : true,
+           "String name" : "type",
+           "xtype" : "ComboBox",
+           "Boolean editable" : false,
+           "String triggerAction" : "all",
+           "string fieldLabel" : "Type",
+           "string placeholder" : "please select the type of the investor",
+           "String labelAlign" : "top",
+           "$ xns" : "Roo.bootstrap",
+           "String displayField" : "value",
+           "items" : [
+            {
+             "xtype" : "SimpleStore",
+             "$ data" : "[\n    ['individual', 'Individual'],\n    ['corporate', 'Corporate'],\n    ['joint', 'Joint']\n]",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[ 'code', 'value' ]",
+             "* prop" : "store"
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.fund_name = _self;\n}"
+           },
+           "Boolean allowBlank" : true,
+           "String name" : "fund_name",
+           "xtype" : "ComboBox",
+           "Boolean editable" : false,
+           "String triggerAction" : "all",
+           "string fieldLabel" : "Fund",
+           "string placeholder" : "please select the fund related to the investor",
+           "String labelAlign" : "top",
+           "$ xns" : "Roo.bootstrap",
+           "String displayField" : "name",
+           "items" : [
+            {
+             "xtype" : "Store",
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Roo/Modx_accountmgmts' ",
+               "xtype" : "HttpProxy",
+               "$ xns" : "Roo.data",
+               "String method" : "GET",
+               "* prop" : "proxy"
+              },
+              {
+               "xtype" : "JsonReader",
+               "$ xns" : "Roo.data",
+               "$ fields" : "[{'name':'name','type':'string'},{'name':'id',type:'string'}]",
+               "* prop" : "reader"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : true,
+           "String name" : "email",
+           "xtype" : "Input",
+           "string fieldLabel" : "Primary contact email",
+           "String labelAlign" : "top",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : true,
+           "String name" : "firstname",
+           "xtype" : "Input",
+           "string fieldLabel" : "First Name",
+           "String labelAlign" : "top",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : true,
+           "String name" : "lastname",
+           "xtype" : "Input",
+           "string fieldLabel" : "Last Name",
+           "String labelAlign" : "top",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "Number xs" : 12,
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : true,
+           "String name" : "phone",
+           "xtype" : "Input",
+           "string fieldLabel" : "Phone",
+           "String labelAlign" : "top",
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Cancel",
+     "String style" : "float: right; margin: 10px;",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.option = {};\n    _this.option.params = {};\n    \n    var fund_name = _this.form.findField('fund_name').getValue();\n    var email = _this.form.findField('email').getValue();\n    var account_type = _this.form.findField('type').getValue();  \n    var firstname = _this.form.findField('firstname').getValue();  \n    var lastname = _this.form.findField('lastname').getValue();  \n    var phone = _this.form.findField('phone').getValue();  \n    \n    if(fund_name!=''){\n        _this.option.params.fund_name = fund_name;\n    }\n\n    if(email!=''){\n        _this.option.params.email = email;\n    }\n\n    if(account_type!=''){\n        _this.option.params.account_type = account_type;\n    }\n\n    if(phone!=''){\n        _this.option.params.phone = phone;\n    }\n\n    if(firstname!=''){\n        _this.option.params.firstname = firstname;\n    }\n\n\n    if(lastname!=''){\n        _this.option.params.lastname = lastname;\n    }\n\n\n\n    if (_this.callback) {\n        _this.callback.call(this, _this.option);                \n        console.log(_this.option);\n   }\n  \n    _this.dialog.hide({});\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Search",
+     "String style" : "float: right; margin: 10px;",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorSearch.js b/Pman/Coba/Pman.Dialog.CobaInvestorSearch.js
new file mode 100644 (file)
index 0000000..23b904c
--- /dev/null
@@ -0,0 +1,343 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorSearch= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorSearch.prototype, {
+
+ _strings : {
+  '77587239bf4c54ea493c7033e1dbf636' :"Last Name",
+  '13348442cc6a27032d2b4aa28b75a5d3' :"Search",
+  'e5676ba19f12f141c9d199c36ee5fde6' :"please select the fund related to the investor",
+  'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
+  '0715d4a63b8542504b1b1b2af082240e' :"Search Investor",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'ae9e6ac49d4f451b1ebf440619f595b5' :"please select the type of the investor",
+  'c1098dd48f0fb20eeea79235055d02ca' :"Fund",
+  'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
+  'bc910f8bdf70f29374f496f05be0330c' :"First Name",
+  'e456949630edb405fba2217ddeef7f3c' :"Primary contact email"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    title : _this._strings['0715d4a63b8542504b1b1b2af082240e'] /* Search Investor */,
+    listeners : {
+     render : function (_self)
+      {
+          _this.option = {};
+          _this.option.params = {};
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      style : 'float: right; margin: 10px;',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['13348442cc6a27032d2b4aa28b75a5d3'] /* Search */,
+      style : 'float: right; margin: 10px;',
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.option = {};
+            _this.option.params = {};
+            
+            var fund_name = _this.form.findField('fund_name').getValue();
+            var email = _this.form.findField('email').getValue();
+            var account_type = _this.form.findField('type').getValue();  
+            var firstname = _this.form.findField('firstname').getValue();  
+            var lastname = _this.form.findField('lastname').getValue();  
+            var phone = _this.form.findField('phone').getValue();  
+            
+            if(fund_name!=''){
+                _this.option.params.fund_name = fund_name;
+            }
+        
+            if(email!=''){
+                _this.option.params.email = email;
+            }
+        
+            if(account_type!=''){
+                _this.option.params.account_type = account_type;
+            }
+        
+            if(phone!=''){
+                _this.option.params.phone = phone;
+            }
+        
+            if(firstname!=''){
+                _this.option.params.firstname = firstname;
+            }
+        
+        
+            if(lastname!=''){
+                _this.option.params.lastname = lastname;
+            }
+        
+        
+        
+            if (_this.callback) {
+                _this.callback.call(this, _this.option);                
+                console.log(_this.option);
+           }
+          
+            _this.dialog.hide({});
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      listeners : {
+       render : function (_self)
+        {
+            _this.form = _self;
+        },
+       show : function (_self)
+        {
+            if(_this.fund_name) {
+                _this.fund_name.store.load({});
+            }
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'ComboBox',
+            allowBlank : true,
+            displayField : 'value',
+            editable : false,
+            fieldLabel : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
+            labelAlign : 'top',
+            name : 'type',
+            placeholder : _this._strings['ae9e6ac49d4f451b1ebf440619f595b5'] /* please select the type of the investor */,
+            triggerAction : 'all',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'SimpleStore',
+             data : [
+                 ['individual', 'Individual'],
+                 ['corporate', 'Corporate'],
+                 ['joint', 'Joint']
+             ],
+             fields : [ 'code', 'value' ],
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'ComboBox',
+            allowBlank : true,
+            displayField : 'name',
+            editable : false,
+            fieldLabel : _this._strings['c1098dd48f0fb20eeea79235055d02ca'] /* Fund */,
+            labelAlign : 'top',
+            name : 'fund_name',
+            placeholder : _this._strings['e5676ba19f12f141c9d199c36ee5fde6'] /* please select the fund related to the investor */,
+            triggerAction : 'all',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.fund_name = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'Store',
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             proxy : {
+              xtype : 'HttpProxy',
+              method : 'GET',
+              url : baseURL + '/Roo/Modx_accountmgmts',
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             },
+             reader : {
+              xtype : 'JsonReader',
+              fields : [{'name':'name','type':'string'},{'name':'id',type:'string'}],
+              xns : Roo.data,
+              '|xns' : 'Roo.data'
+             }
+            }
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : true,
+            fieldLabel : _this._strings['e456949630edb405fba2217ddeef7f3c'] /* Primary contact email */,
+            labelAlign : 'top',
+            name : 'email',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : true,
+            fieldLabel : _this._strings['bc910f8bdf70f29374f496f05be0330c'] /* First Name */,
+            labelAlign : 'top',
+            name : 'firstname',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : true,
+            fieldLabel : _this._strings['77587239bf4c54ea493c7033e1dbf636'] /* Last Name */,
+            labelAlign : 'top',
+            name : 'lastname',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Input',
+            allowBlank : true,
+            fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
+            labelAlign : 'top',
+            name : 'phone',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorSearch, Pman.Dialog.CobaInvestorSearch.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.bjs b/Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.bjs
new file mode 100644 (file)
index 0000000..521aa50
--- /dev/null
@@ -0,0 +1,68 @@
+{
+ "name" : "Pman.Dialog.CobaInvestorViewDocument",
+ "parent" : "",
+ "title" : "View",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "d3d2e617335f08df83599665eef8a418" : "Close",
+  "e8e7ffc6c93c719011760eefa8b92621" : "Download Original",
+  "91fe4cf4aa01a04fe3cc52827c526097" : "View Document"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    if(typeof(_this.data.file) == 'undefined' || _this.data.file.id * 1 < 1){\n        _this.dialog.hide();\n        return;\n    }\n    \n    var width = _this.viewer.thumbEl.getWidth();\n    \n    var files = [\n        baseURL +'/Images/Thumb/' + width + '/' + _this.data.file.id + '/' + _this.data.file.filename\n    ];\n    \n    if(_this.data.file.no_of_pages * 1 > 1){\n        \n        files = [];\n        \n        for ( var i = 1; i <= _this.data.file.no_of_pages * 1; i++){\n            files.push(baseURL +'/Images/Thumb/' + width + '/' + _this.data.file.id + '/' + _this.data.file.filename + '?page=' + i);\n        }\n        \n    }\n    \n    window.addEventListener(\"resize\", _this.viewer.resize);\n    \n    _this.viewer.files = files;\n    \n    _this.viewer.initial();\n    \n    _this.viewer.resize();\n    \n}"
+   },
+   "String cls" : "enable-overflow document-slider-dialog",
+   "Boolean allow_close" : false,
+   "xtype" : "Modal",
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "View Document",
+   "items" : [
+    {
+     "xtype" : "Row",
+     "$ xns" : "Roo.bootstrap",
+     "items" : [
+      {
+       "xtype" : "Column",
+       "Number xs" : 12,
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "listeners" : {
+          "render" : "function (_self)\n{\n    _this.viewer = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n}"
+         },
+         "| function resize" : "function() \n{ \n    var view_height = Roo.lib.Dom.getViewHeight();\n    \n    var dialog_margins = _this.dialog.dialogEl.getMargins();\n    \n    var dialog_header = _this.dialog.headerEl.getHeight();\n\n    var dialog_footer = _this.dialog.footerEl.getHeight();\n    \n    var dialog_usage = dialog_margins.top + dialog_margins.bottom + dialog_header + dialog_footer;\n\n    var available_height = view_height - dialog_usage - _this.viewer.headerEl.getHeight();;\n    \n    _this.viewer.bodyEl.setHeight(available_height);\n    \n}",
+         "xtype" : "DocumentSlider",
+         "$ xns" : "Roo.bootstrap",
+         "bool showTrash" : false
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    if(typeof(_this.data.file) == 'undefined' || _this.data.file.id * 1 < 1){\n        return;\n    }\n    \n    new Pman.Download({\n        url: baseURL + '/Images/Download/' + _this.data.file.id\n    });\n    \n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Download Original",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Close",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.js b/Pman/Coba/Pman.Dialog.CobaInvestorViewDocument.js
new file mode 100644 (file)
index 0000000..8a38b9e
--- /dev/null
@@ -0,0 +1,166 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaInvestorViewDocument= function() {}
+Roo.apply(Pman.Dialog.CobaInvestorViewDocument.prototype, {
+
+ _strings : {
+  'd3d2e617335f08df83599665eef8a418' :"Close",
+  'e8e7ffc6c93c719011760eefa8b92621' :"Download Original",
+  '91fe4cf4aa01a04fe3cc52827c526097' :"View Document"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    allow_close : false,
+    cls : 'enable-overflow document-slider-dialog',
+    title : _this._strings['91fe4cf4aa01a04fe3cc52827c526097'] /* View Document */,
+    listeners : {
+     show : function (_self)
+      {
+          if(typeof(_this.data.file) == 'undefined' || _this.data.file.id * 1 < 1){
+              _this.dialog.hide();
+              return;
+          }
+          
+          var width = _this.viewer.thumbEl.getWidth();
+          
+          var files = [
+              baseURL +'/Images/Thumb/' + width + '/' + _this.data.file.id + '/' + _this.data.file.filename
+          ];
+          
+          if(_this.data.file.no_of_pages * 1 > 1){
+              
+              files = [];
+              
+              for ( var i = 1; i <= _this.data.file.no_of_pages * 1; i++){
+                  files.push(baseURL +'/Images/Thumb/' + width + '/' + _this.data.file.id + '/' + _this.data.file.filename + '?page=' + i);
+              }
+              
+          }
+          
+          window.addEventListener("resize", _this.viewer.resize);
+          
+          _this.viewer.files = files;
+          
+          _this.viewer.initial();
+          
+          _this.viewer.resize();
+          
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['e8e7ffc6c93c719011760eefa8b92621'] /* Download Original */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            if(typeof(_this.data.file) == 'undefined' || _this.data.file.id * 1 < 1){
+                return;
+            }
+            
+            new Pman.Download({
+                url: baseURL + '/Images/Download/' + _this.data.file.id
+            });
+            
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['d3d2e617335f08df83599665eef8a418'] /* Close */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Row',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Column',
+        xs : 12,
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'DocumentSlider',
+          resize : function() 
+          { 
+              var view_height = Roo.lib.Dom.getViewHeight();
+              
+              var dialog_margins = _this.dialog.dialogEl.getMargins();
+              
+              var dialog_header = _this.dialog.headerEl.getHeight();
+          
+              var dialog_footer = _this.dialog.footerEl.getHeight();
+              
+              var dialog_usage = dialog_margins.top + dialog_margins.bottom + dialog_header + dialog_footer;
+          
+              var available_height = view_height - dialog_usage - _this.viewer.headerEl.getHeight();;
+              
+              _this.viewer.bodyEl.setHeight(available_height);
+              
+          },
+          showTrash : false,
+          listeners : {
+           render : function (_self)
+            {
+                _this.viewer = this;
+                
+                this.el.setVisibilityMode(Roo.Element.DISPLAY);
+                
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaInvestorViewDocument, Pman.Dialog.CobaInvestorViewDocument.prototype);
diff --git a/Pman/Coba/Pman.Dialog.CobaLexisNexisReject.bjs b/Pman/Coba/Pman.Dialog.CobaLexisNexisReject.bjs
new file mode 100644 (file)
index 0000000..d57b497
--- /dev/null
@@ -0,0 +1,119 @@
+{
+ "name" : "Pman.Dialog.CobaLexisNexisReject",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Dialog.CobaLexisNexisReject.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "faaa46e5416608c7bd60089125d8ad37" : "explain why you do not think this match is relivant - please quote from the text if necessary.",
+  "6bb61e3b7bce0931da574d19d1d82c88" : "-1",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "1556cbebad269b3687e8b7265acd8530" : "Please explain why this match is not relivant",
+  "e0aa021e21dddbd6d8cecec71e9cf564" : "OK"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n    window.addEventListener(\"resize\", _this.lexis_nexis_frame.resize);\n    \n    _this.lexis_nexis_frame.resize();\n    \n    var url = 'about:blank';\n    \n    if(_this.data.id * 1 > 0){\n        url = baseURL + '/Coba/Reports/LexisNexisDetail/' + _this.data.id;\n    }\n    \n    _this.lexis_nexis_frame.el.dom.src = url;\n}"
+   },
+   "String cls" : "enable-overflow",
+   "xtype" : "Modal",
+   "Boolean fitwindow" : true,
+   "$ xns" : "Roo.bootstrap",
+   "String title" : "Please explain why this match is not relivant",
+   "items" : [
+    {
+     "listeners" : {
+      "actionfailed" : "function (_self, action)\n{\n    Roo.log(action);\n    \n    var err = 'Please Correct all the errors in red';\n   \n    if (\n            typeof(action) != 'undefined' && \n            (\n                action.failureType == 'server' ||\n                action.failureType == 'load'\n            )\n    ) {\n        err = action.result.errorMsg;\n    }\n    \n    Roo.bootstrap.MessageBox.alert('Error', err);\n    return;\n    \n}",
+      "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n    \n        return;\n    }\n\n\n    if (action.type =='submit') {\n        \n        _this.dialog.hide();\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.form.reset();\n        \n        return;\n    }\n\n}",
+      "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+     },
+     "$ url" : "baseURL+'/Roo/Coba_investor_lexis_results'",
+     "xtype" : "Form",
+     "$ xns" : "Roo.bootstrap",
+     "String style" : "margin:15px;",
+     "String method" : "POST",
+     "Boolean loadMask" : false,
+     "items" : [
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "Boolean allowBlank" : false,
+           "String name" : "reason",
+           "xtype" : "TextArea",
+           "string placeholder" : "explain why you do not think this match is relivant - please quote from the text if necessary.",
+           "Number rows" : 2,
+           "$ xns" : "Roo.bootstrap"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "Row",
+       "$ xns" : "Roo.bootstrap",
+       "String style" : "margin-top: 15px;",
+       "items" : [
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.bootstrap",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.lexis_nexis_frame = this;\n    \n}"
+           },
+           "String tag" : "iframe",
+           "| function resize" : "function() \n{ \n    var height = _this.dialog.bodyEl.getHeight(true);\n    \n    var reason_height = _this.form.findField('reason').el.getHeight();\n    \n    _this.lexis_nexis_frame.el.setHeight(height - reason_height);\n    \n}",
+           "xtype" : "Element",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "width:100%;border:none;"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "String name" : "id",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap"
+      },
+      {
+       "String name" : "status",
+       "xtype" : "Input",
+       "String inputType" : "hidden",
+       "$ xns" : "Roo.bootstrap",
+       "string value" : "-1"
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "Cancel",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.form.doAction('submit');\n}"
+     },
+     "String weight" : "primary",
+     "xtype" : "Button",
+     "$ xns" : "Roo.bootstrap",
+     "String html" : "OK",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Dialog.CobaLexisNexisReject.js b/Pman/Coba/Pman.Dialog.CobaLexisNexisReject.js
new file mode 100644 (file)
index 0000000..437da2a
--- /dev/null
@@ -0,0 +1,231 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.CobaLexisNexisReject= function() {}
+Roo.apply(Pman.Dialog.CobaLexisNexisReject.prototype, {
+
+ _strings : {
+  'faaa46e5416608c7bd60089125d8ad37' :"explain why you do not think this match is relivant - please quote from the text if necessary.",
+  '6bb61e3b7bce0931da574d19d1d82c88' :"-1",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '1556cbebad269b3687e8b7265acd8530' :"Please explain why this match is not relivant",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    cls : 'enable-overflow',
+    fitwindow : true,
+    title : _this._strings['1556cbebad269b3687e8b7265acd8530'] /* Please explain why this match is not relivant */,
+    listeners : {
+     show : function (_self)
+      {
+          window.addEventListener("resize", _this.lexis_nexis_frame.resize);
+          
+          _this.lexis_nexis_frame.resize();
+          
+          var url = 'about:blank';
+          
+          if(_this.data.id * 1 > 0){
+              url = baseURL + '/Coba/Reports/LexisNexisDetail/' + _this.data.id;
+          }
+          
+          _this.lexis_nexis_frame.el.dom.src = url;
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.form.doAction('submit');
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      loadMask : false,
+      method : 'POST',
+      style : 'margin:15px;',
+      url : baseURL+'/Roo/Coba_investor_lexis_results',
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+            if(action.type == 'setdata'){
+            
+                return;
+            }
+        
+        
+            if (action.type =='submit') {
+                
+                _this.dialog.hide();
+                
+                if (_this.callback) {
+                    _this.callback.call(_this, action.result);
+                }
+                
+                _this.form.reset();
+                
+                return;
+            }
+        
+        },
+       actionfailed : function (_self, action)
+        {
+            Roo.log(action);
+            
+            var err = 'Please Correct all the errors in red';
+           
+            if (
+                    typeof(action) != 'undefined' && 
+                    (
+                        action.failureType == 'server' ||
+                        action.failureType == 'load'
+                    )
+            ) {
+                err = action.result.errorMsg;
+            }
+            
+            Roo.bootstrap.MessageBox.alert('Error', err);
+            return;
+            
+        },
+       render : function (_self)
+        {
+            _this.form = _self;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Row',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'TextArea',
+            allowBlank : false,
+            name : 'reason',
+            placeholder : _this._strings['faaa46e5416608c7bd60089125d8ad37'] /* explain why you do not think this match is relivant - please quote from the text if necessary. */,
+            rows : 2,
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Row',
+        style : 'margin-top: 15px;',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Column',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Element',
+            resize : function() 
+            { 
+                var height = _this.dialog.bodyEl.getHeight(true);
+                
+                var reason_height = _this.form.findField('reason').el.getHeight();
+                
+                _this.lexis_nexis_frame.el.setHeight(height - reason_height);
+                
+            },
+            style : 'width:100%;border:none;',
+            tag : 'iframe',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.lexis_nexis_frame = this;
+                  
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap'
+           }
+          ]
+         }
+        ]
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'id',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       },
+       {
+        xtype : 'Input',
+        inputType : 'hidden',
+        name : 'status',
+        value : _this._strings['6bb61e3b7bce0931da574d19d1d82c88'] /* -1 */,
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.CobaLexisNexisReject, Pman.Dialog.CobaLexisNexisReject.prototype);
diff --git a/Pman/Coba/Pman.Dialog.FundManagerEdit.bjs b/Pman/Coba/Pman.Dialog.FundManagerEdit.bjs
new file mode 100644 (file)
index 0000000..4d87a2a
--- /dev/null
@@ -0,0 +1,10 @@
+{
+ "name" : "Pman.Dialog.FundManagerEdit",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Pman.Dialog.FundManagerEdit.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "items" : [
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Tab.Coba.bjs b/Pman/Coba/Pman.Tab.Coba.bjs
new file mode 100644 (file)
index 0000000..c0e7013
--- /dev/null
@@ -0,0 +1,34 @@
+{
+ "name" : "Pman.Tab.Coba",
+ "parent" : "Pman.Tab",
+ "title" : "",
+ "path" : "/home/khlau/gitlive/web.coba/Pman/Coba/Pman.Tab.Coba.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "c86da96c0a7fe822201f7847c7ad09f2" : "Coba"
+ },
+ "items" : [
+  {
+   "xtype" : "Nest",
+   "String region" : "center",
+   "$ xns" : "Roo.bootstrap.panel",
+   "String title" : "Coba",
+   "items" : [
+    {
+     "xtype" : "Border",
+     "$ xns" : "Roo.bootstrap.layout",
+     "* prop" : "layout",
+     "items" : [
+      {
+       "String tabPosition" : "top",
+       "xtype" : "Region",
+       "$ xns" : "Roo.bootstrap.layout",
+       "* prop" : "center"
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Tab.Coba.js b/Pman/Coba/Pman.Tab.Coba.js
new file mode 100644 (file)
index 0000000..6f9212c
--- /dev/null
@@ -0,0 +1,42 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Tab');
+
+Pman.Tab.Coba = new Roo.XComponent({
+
+ _strings : {
+  'c86da96c0a7fe822201f7847c7ad09f2' :"Coba"
+ },
+
+  part     :  ["Coba", "Coba" ],
+  order    : '001-Pman.Tab.Coba',
+  region   : 'center',
+  parent   : 'Pman.Tab',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'Nest',
+   region : 'center',
+   title : _this._strings['c86da96c0a7fe822201f7847c7ad09f2'] /* Coba */,
+   xns : Roo.bootstrap.panel,
+   '|xns' : 'Roo.bootstrap.panel',
+   layout : {
+    xtype : 'Border',
+    xns : Roo.bootstrap.layout,
+    '|xns' : 'Roo.bootstrap.layout',
+    center : {
+     xtype : 'Region',
+     tabPosition : 'top',
+     xns : Roo.bootstrap.layout,
+     '|xns' : 'Roo.bootstrap.layout'
+    }
+   }
+  };  }
+});
diff --git a/Pman/Coba/Pman.Tab.CobaFundManager.bjs b/Pman/Coba/Pman.Tab.CobaFundManager.bjs
new file mode 100644 (file)
index 0000000..73e84c5
--- /dev/null
@@ -0,0 +1,202 @@
+{
+ "name" : "Pman.Tab.CobaFundManager",
+ "parent" : "Pman.Tab.Coba",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Pman.Tab.CobaFundManager.bjs",
+ "permname" : "",
+ "modOrder" : "002",
+ "strings" : {
+  "cdb6b6bab1fd18b9dbfe3fb84a5d34ae" : "<i class=\"fa fa-search\"></i>",
+  "b718adec73e04ce3ec720dd11a06a308" : "ID",
+  "f9a6fb555aa3dd3b3fa8fa13420075a2" : "Fund Manager",
+  "fd5293a712d172f5c556a83c62d44bd6" : "<i class=\"fa fa-plus\"></i> Add",
+  "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
+  "2efbd104fbdac27979de616938992e78" : "Fund Code",
+  "422918621aa6642c26d5ee9222765ddf" : "Fund Name"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "activate" : "function (_self)\n{\n    if(_this.table) {\n        \n        _this.table.footer.onClick('first');\n        \n    }\n    \n    /*\n    if(_this.delete_btn) {\n        if(Pman.Login.authUser.groups.indexOf(\"Administrators\") >=0) {\n            _this.delete_btn.show();\n        } else {\n            _this.delete_btn.hide();\n        }\n    }\n    */\n} "
+   },
+   "xtype" : "Grid",
+   "Boolean fitToFrame" : true,
+   "string fitContainer" : true,
+   "$ xns" : "Roo.bootstrap.panel",
+   "String region" : "center",
+   "String title" : "Fund Manager",
+   "Boolean autoScroll" : true,
+   "Boolean background" : false,
+   "Boolean closable" : false,
+   "items" : [
+    {
+     "listeners" : {
+      "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    /*\n    if (!Pman.Dialog.CobaInvestorModify) {\n        return;\n    }\n    \n    var row = _this.table.store.getAt(rowIndex);\n    \n    Pman.Dialog.CobaInvestorModify.show( {id : row.data.id}, function() {\n        _this.table.footer.onClick('refresh');\n    });\n    */\n\n}",
+      "render" : "function (_self)\n{\n    _this.table = this;\n}"
+     },
+     "Boolean footerShow" : true,
+     "String cls" : "table-fixed",
+     "boolean hover" : true,
+     "xtype" : "Table",
+     "boolean responsive" : true,
+     "Boolean rowSelection" : true,
+     "$ xns" : "Roo.bootstrap",
+     "Boolean loadMask" : true,
+     "* prop" : "grid",
+     "items" : [
+      {
+       "listeners" : {
+        "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    \n    /*\n    o.params._with_status= 1;\n    o.params.deleted_by = 0;\n   // o.params.limit =   _this.table.footer.pageSize *1; \n    \n    var filter = _this.form.findField('search_filter').getValue();  \n    if(filter !='') {\n        o.params._search_filter = filter;\n    }\n    */\n\n}"
+       },
+       "$ Object sortInfo" : "{field: 'name', direction: 'ASC'}",
+       "xtype" : "Store",
+       "boolean remoteSort" : true,
+       "$ xns" : "Roo.data",
+       "* prop" : "store",
+       "items" : [
+        {
+         "xtype" : "HttpProxy",
+         "$ xns" : "Roo.data",
+         "String method" : "GET",
+         "* prop" : "proxy",
+         "$ String url" : "baseURL + '/Roo/Modx_accountmgmts'"
+        },
+        {
+         "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'isin_code',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'is_active',\n        'type': 'int'\n    }\n]\n",
+         "xtype" : "JsonReader",
+         "$ xns" : "Roo.data",
+         "String id" : "id",
+         "* prop" : "reader",
+         "String totalProperty" : "total"
+        }
+       ]
+      },
+      {
+       "String header" : "ID",
+       "String dataIndex" : "id",
+       "Number md" : 3,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : true,
+       "* prop" : "cm[]"
+      },
+      {
+       "String header" : "Fund Code",
+       "String dataIndex" : "isin_code",
+       "Number md" : 3,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : true,
+       "* prop" : "cm[]"
+      },
+      {
+       "String header" : "Fund Name",
+       "String dataIndex" : "name",
+       "Number md" : 3,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : true,
+       "* prop" : "cm[]"
+      },
+      {
+       "String header" : "Active",
+       "String dataIndex" : "is_active",
+       "Number md" : 3,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : true,
+       "* prop" : "cm[]"
+      },
+      {
+       "Number pageSize" : 15,
+       "xtype" : "PagingToolbar",
+       "$ xns" : "Roo.bootstrap",
+       "* prop" : "footer"
+      }
+     ]
+    },
+    {
+     "xtype" : "NavSimplebar",
+     "$ xns" : "Roo.bootstrap",
+     "* prop" : "toolbar",
+     "items" : [
+      {
+       "xtype" : "NavGroup",
+       "$ xns" : "Roo.bootstrap",
+       "String style" : "width: 100%",
+       "items" : [
+        {
+         "xtype" : "NavItem",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "width: 100%;",
+         "items" : [
+          {
+           "xtype" : "Container",
+           "$ xns" : "Roo.bootstrap",
+           "String style" : "width: 100%;",
+           "items" : [
+            {
+             "xtype" : "Row",
+             "$ xns" : "Roo.bootstrap",
+             "String style" : "padding: 10px;",
+             "items" : [
+              {
+               "Number md" : 2,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "xtype" : "Input",
+                 "$ xns" : "Roo.bootstrap",
+                 "items" : [
+                  {
+                   "xtype" : "Button",
+                   "$ xns" : "Roo.bootstrap",
+                   "String html" : "<i class=\"fa fa-search\"></i>",
+                   "* prop" : "after"
+                  }
+                 ]
+                }
+               ]
+              },
+              {
+               "Number md" : 7,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap"
+              },
+              {
+               "Number md" : 3,
+               "xtype" : "Column",
+               "$ xns" : "Roo.bootstrap",
+               "items" : [
+                {
+                 "xtype" : "ButtonGroup",
+                 "$ xns" : "Roo.bootstrap",
+                 "String style" : "float: right",
+                 "items" : [
+                  {
+                   "listeners" : {
+                    "click" : "function (_self, e)\n{\n    Pman.Dialog.CobaFundManagerEdit.show({});\n}"
+                   },
+                   "xtype" : "Button",
+                   "$ xns" : "Roo.bootstrap",
+                   "String html" : "<i class=\"fa fa-plus\"></i> Add"
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Tab.CobaFundManager.js b/Pman/Coba/Pman.Tab.CobaFundManager.js
new file mode 100644 (file)
index 0000000..86d76fe
--- /dev/null
@@ -0,0 +1,288 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Tab');
+
+Pman.Tab.CobaFundManager = new Roo.XComponent({
+
+ _strings : {
+  'cdb6b6bab1fd18b9dbfe3fb84a5d34ae' :"<i class=\"fa fa-search\"></i>",
+  'b718adec73e04ce3ec720dd11a06a308' :"ID",
+  'f9a6fb555aa3dd3b3fa8fa13420075a2' :"Fund Manager",
+  'fd5293a712d172f5c556a83c62d44bd6' :"<i class=\"fa fa-plus\"></i> Add",
+  '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
+  '2efbd104fbdac27979de616938992e78' :"Fund Code",
+  '422918621aa6642c26d5ee9222765ddf' :"Fund Name"
+ },
+
+  part     :  ["Coba", "FundManager" ],
+  order    : '002-Pman.Tab.CobaFundManager',
+  region   : 'center',
+  parent   : 'Pman.Tab.Coba',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'Grid',
+   autoScroll : true,
+   background : false,
+   closable : false,
+   fitContainer : true,
+   fitToFrame : true,
+   region : 'center',
+   title : _this._strings['f9a6fb555aa3dd3b3fa8fa13420075a2'] /* Fund Manager */,
+   listeners : {
+    activate : function (_self)
+     {
+         if(_this.table) {
+             
+             _this.table.footer.onClick('first');
+             
+         }
+         
+         /*
+         if(_this.delete_btn) {
+             if(Pman.Login.authUser.groups.indexOf("Administrators") >=0) {
+                 _this.delete_btn.show();
+             } else {
+                 _this.delete_btn.hide();
+             }
+         }
+         */
+     }
+   },
+   xns : Roo.bootstrap.panel,
+   '|xns' : 'Roo.bootstrap.panel',
+   toolbar : {
+    xtype : 'NavSimplebar',
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    items  : [
+     {
+      xtype : 'NavGroup',
+      style : 'width: 100%',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'NavItem',
+        style : 'width: 100%;',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Container',
+          style : 'width: 100%;',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Row',
+            style : 'padding: 10px;',
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Column',
+              md : 2,
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap',
+              items  : [
+               {
+                xtype : 'Input',
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap',
+                after : {
+                 xtype : 'Button',
+                 html : _this._strings['cdb6b6bab1fd18b9dbfe3fb84a5d34ae'] /* <i class="fa fa-search"></i> */,
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               }
+              ]
+             },
+             {
+              xtype : 'Column',
+              md : 7,
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             },
+             {
+              xtype : 'Column',
+              md : 3,
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap',
+              items  : [
+               {
+                xtype : 'ButtonGroup',
+                style : 'float: right',
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap',
+                items  : [
+                 {
+                  xtype : 'Button',
+                  html : _this._strings['fd5293a712d172f5c556a83c62d44bd6'] /* <i class="fa fa-plus"></i> Add */,
+                  listeners : {
+                   click : function (_self, e)
+                    {
+                        Pman.Dialog.CobaFundManagerEdit.show({});
+                    }
+                  },
+                  xns : Roo.bootstrap,
+                  '|xns' : 'Roo.bootstrap'
+                 }
+                ]
+               }
+              ]
+             }
+            ]
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   },
+   grid : {
+    xtype : 'Table',
+    cls : 'table-fixed',
+    footerShow : true,
+    hover : true,
+    loadMask : true,
+    responsive : true,
+    rowSelection : true,
+    listeners : {
+     render : function (_self)
+      {
+          _this.table = this;
+      },
+     rowdblclick : function (_self, el, rowIndex, e)
+      {
+          /*
+          if (!Pman.Dialog.CobaInvestorModify) {
+              return;
+          }
+          
+          var row = _this.table.store.getAt(rowIndex);
+          
+          Pman.Dialog.CobaInvestorModify.show( {id : row.data.id}, function() {
+              _this.table.footer.onClick('refresh');
+          });
+          */
+      
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    footer : {
+     xtype : 'PagingToolbar',
+     pageSize : 15,
+     xns : Roo.bootstrap,
+     '|xns' : 'Roo.bootstrap'
+    },
+    store : {
+     xtype : 'Store',
+     remoteSort : true,
+     sortInfo : {field: 'name', direction: 'ASC'},
+     listeners : {
+      beforeload : function (_self, o)
+       {
+           o.params = o.params || {};
+           
+           
+           /*
+           o.params._with_status= 1;
+           o.params.deleted_by = 0;
+          // o.params.limit =   _this.table.footer.pageSize *1; 
+           
+           var filter = _this.form.findField('search_filter').getValue();  
+           if(filter !='') {
+               o.params._search_filter = filter;
+           }
+           */
+       
+       }
+     },
+     xns : Roo.data,
+     '|xns' : 'Roo.data',
+     proxy : {
+      xtype : 'HttpProxy',
+      method : 'GET',
+      url : baseURL + '/Roo/Modx_accountmgmts',
+      xns : Roo.data,
+      '|xns' : 'Roo.data'
+     },
+     reader : {
+      xtype : 'JsonReader',
+      fields : [
+          {
+              'name': 'id',
+              'type': 'int'
+          },
+          {
+              'name': 'isin_code',
+              'type': 'string'
+          },
+          {
+              'name': 'name',
+              'type': 'string'
+          },
+          {
+              'name': 'is_active',
+              'type': 'int'
+          }
+      ],
+      id : 'id',
+      totalProperty : 'total',
+      xns : Roo.data,
+      '|xns' : 'Roo.data'
+     }
+    },
+    cm : [
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'id',
+      header : _this._strings['b718adec73e04ce3ec720dd11a06a308'] /* ID */,
+      md : 3,
+      sortable : true,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'isin_code',
+      header : _this._strings['2efbd104fbdac27979de616938992e78'] /* Fund Code */,
+      md : 3,
+      sortable : true,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'name',
+      header : _this._strings['422918621aa6642c26d5ee9222765ddf'] /* Fund Name */,
+      md : 3,
+      sortable : true,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'is_active',
+      header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
+      md : 3,
+      sortable : true,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     }
+    ]
+   }
+  };  }
+});
diff --git a/Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.bjs b/Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.bjs
new file mode 100644 (file)
index 0000000..b5cb1ba
--- /dev/null
@@ -0,0 +1,16 @@
+{
+ "name" : "Pman.Tab.CobaInvestorModifyOverview",
+ "parent" : "Pman.Dialog.CobaInvestorModify",
+ "title" : "",
+ "path" : "/home/johns/gitlive/web.coba/Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "items" : [
+  {
+   "xtype" : "Body",
+   "$ xns" : "Roo.bootstrap",
+   "string name" : "tabtab",
+   "$ string region" : "center"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.js b/Pman/Coba/Pman.Tab.CobaInvestorModifyOverview.js
new file mode 100644 (file)
index 0000000..3878371
--- /dev/null
@@ -0,0 +1,29 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Tab');
+
+Pman.Tab.CobaInvestorModifyOverview = new Roo.XComponent({
+
+
+
+  part     :  ["Coba", "InvestorModifyOverview" ],
+  order    : '001-Pman.Tab.CobaInvestorModifyOverview',
+  region   : 'center',
+  parent   : 'Pman.Dialog.CobaInvestorModify',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'Body',
+   name : 'tabtab',
+   region : center,
+   xns : Roo.bootstrap,
+   '|xns' : 'Roo.bootstrap'
+  };  }
+});
diff --git a/Pman/Coba/Pman.Tab.CobaInvestors.bjs b/Pman/Coba/Pman.Tab.CobaInvestors.bjs
new file mode 100644 (file)
index 0000000..b04ec28
--- /dev/null
@@ -0,0 +1,272 @@
+{
+ "name" : "Pman.Tab.CobaInvestors",
+ "parent" : "Pman.Tab.Coba",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.coba/Pman/Coba/Pman.Tab.CobaInvestors.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
+  "c55bb3f1897a02f7c3be32fc933b0e0c" : "Create Investor",
+  "801d0ba359252756108ad71d7032a67e" : "Investors",
+  "ec53a8c4f07baed5d8825072c89799be" : "Status",
+  "b718adec73e04ce3ec720dd11a06a308" : "ID",
+  "52c649c38236206862e79e77f735902d" : "Investment Advisor",
+  "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
+  "58c98266099a5f6f52e211870dd620d6" : "Delete Investor",
+  "679b01485de24a379e37b7023bd36116" : "Search for investor",
+  "e7b47c58815acf1d3afa59a84b5db7fb" : "Company Name",
+  "913ddd7613d305b4879b376adf3f798c" : "Import Investor",
+  "49ee3087348e8d44e1feda1917443987" : "Name",
+  "a1fa27779242b4902f7ae3bdd5c6d508" : "Type"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "activate" : "function (_self)\n{\n    if(_this.table) {\n        _this.table.footer.onClick('first');\n    }\n    \n    if(_this.delete_btn) {\n        if(Pman.Login.authUser.groups.indexOf(\"Administrators\") >=0) {\n            _this.delete_btn.show();\n        } else {\n            _this.delete_btn.hide();\n        }\n    }\n    \n} "
+   },
+   "xtype" : "Grid",
+   "Boolean fitToFrame" : true,
+   "$ xns" : "Roo.bootstrap.panel",
+   "String region" : "center",
+   "String title" : "Investors",
+   "Boolean autoScroll" : true,
+   "Boolean closable" : false,
+   "items" : [
+    {
+     "listeners" : {
+      "rowdblclick" : "function (_self, el, rowIndex, e)\n{\n    if (!Pman.Dialog.CobaInvestorModify) {\n        return;\n    }\n    \n    var row = _this.table.store.getAt(rowIndex);\n    \n    Pman.Dialog.CobaInvestorModify.show( {id : row.data.id}, function() {\n        _this.table.footer.onClick('refresh');\n    });\n    \n\n}",
+      "render" : "function (_self)\n{\n    _this.table = this;\n}"
+     },
+     "Boolean footerShow" : true,
+     "String cls" : "table-fixed",
+     "boolean hover" : true,
+     "boolean striped" : false,
+     "xtype" : "Table",
+     "boolean responsive" : true,
+     "Boolean rowSelection" : true,
+     "$ xns" : "Roo.bootstrap",
+     "Boolean loadMask" : true,
+     "* prop" : "grid",
+     "items" : [
+      {
+       "listeners" : {
+        "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params._with_status= 1;\n    o.params.deleted_by = 0;\n   // o.params.limit =   _this.table.footer.pageSize *1; \n    \n    var filter = _this.form.findField('search_filter').getValue();  \n    if(filter !='') {\n        o.params._search_filter = filter;\n    }\n\n}"
+       },
+       "$ Object sortInfo" : "{field: 'full_name', direction: 'ASC'}",
+       "xtype" : "Store",
+       "boolean remoteSort" : true,
+       "$ xns" : "Roo.data",
+       "* prop" : "store",
+       "items" : [
+        {
+         "xtype" : "HttpProxy",
+         "$ xns" : "Roo.data",
+         "String method" : "GET",
+         "* prop" : "proxy",
+         "$ String url" : "baseURL + '/Roo/Ext_data'"
+        },
+        {
+         "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'userdata_id',\n        'type': 'int'\n    },\n    {\n        'name': 'full_name',\n        'type': 'string'\n    },\n    {\n        'name': 'company_name',\n        'type': 'string'\n    },\n    {\n        'name': 'account_type',\n        'type': 'string'\n    },\n    {\n        'name': 'in_email',\n        'type': 'string'\n    },\n    {\n        'name': 'in_contact_number',\n        'type': 'string'\n    },\n    {\n        'name': 'investment_advisor_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'fund_name',\n        'type': 'string'\n    },\n    {\n        'name': 'is_submit',\n        'type': 'int'\n    },\n    {\n        'name': 'check_complete',\n        'type': 'string'\n    },\n    {\n        'name': 'is_missing_document',\n        'type': 'int'\n    }\n]\n",
+         "xtype" : "JsonReader",
+         "$ xns" : "Roo.data",
+         "String id" : "id",
+         "* prop" : "reader",
+         "String totalProperty" : "total"
+        }
+       ]
+      },
+      {
+       "String header" : "ID",
+       "String dataIndex" : "userdata_id",
+       "Number width" : 50,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean hidden" : false
+      },
+      {
+       "String header" : "Name",
+       "String dataIndex" : "full_name",
+       "Number width" : 300,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean locked" : false
+      },
+      {
+       "String header" : "Company Name",
+       "String dataIndex" : "company_name",
+       "Number width" : 300,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean hidden" : true,
+       "Boolean locked" : false
+      },
+      {
+       "String header" : "Type",
+       "String dataIndex" : "account_type",
+       "Number width" : 100,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean locked" : false
+      },
+      {
+       "String header" : "Email",
+       "String dataIndex" : "in_email",
+       "Number width" : 300,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "$ renderer" : "function (v) {\n        return (v.length && v.indexOf('@') > 0 ) ? \n            String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n            \n    }",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]"
+      },
+      {
+       "String header" : "Phone",
+       "String dataIndex" : "in_contact_number",
+       "Number width" : 150,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]"
+      },
+      {
+       "String header" : "Investment Advisor",
+       "String dataIndex" : "investment_advisor_id_name",
+       "Number width" : 150,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]"
+      },
+      {
+       "String dataIndex" : "account_type",
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean hidden" : true
+      },
+      {
+       "String dataIndex" : "fund_name",
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean hidden" : true
+      },
+      {
+       "String header" : "Status",
+       "String dataIndex" : "is_submit",
+       "Number width" : 300,
+       "xtype" : "ColumnModel",
+       "$ xns" : "Roo.grid",
+       "$ renderer" : "function(v,x,r) {  \n\n    if(v * 1 > 0) {\n    \n        /*\n        * Submitted but missing the documents...\n        */\n        \n        if(r.data.is_missing_document * 1 == 1){\n            return String.format(\n                '<i style=\"color:green;\" class=\"fa fa-check\"></i> <span style=\"color:green;\">Submitted</span>' +\n                ' <i style=\"color:#941B0C;\" class=\"fa fa-times\"></i> Missing : Document'\n            );\n        }\n        \n        /*\n        * Submitted and all documents have been upload...\n        */\n        \n        return String.format(\n            '<i style=\"color:green;\" class=\"fa fa-check\"></i> <span style=color:green;\">Submitted</span>'\n        );\n    }\n    \n    var fmt = '<i style=\"color:#941B0C;\" class=\"fa fa-times\"></i> Missing : {0}';\n    \n    if(!r.data.check_complete.length){\n        fmt = 'Form Completed, but not Submitted';\n    }\n    \n    return String.format(\n        fmt, \n        r.data.check_complete.split(',').join(', ')\n    );\n }",
+       "Boolean sortable" : false,
+       "* prop" : "cm[]",
+       "Boolean locked" : false
+      },
+      {
+       "Number pageSize" : 15,
+       "xtype" : "PagingToolbar",
+       "$ xns" : "Roo.bootstrap",
+       "* prop" : "footer"
+      }
+     ]
+    },
+    {
+     "xtype" : "NavSimplebar",
+     "$ xns" : "Roo.bootstrap",
+     "* prop" : "toolbar",
+     "items" : [
+      {
+       "xtype" : "NavGroup",
+       "$ xns" : "Roo.bootstrap",
+       "items" : [
+        {
+         "xtype" : "NavItem",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "float: left",
+         "items" : [
+          {
+           "listeners" : {
+            "click" : "function ()\n{\n    if(Pman.Dialog.CobaInvestorCreate) {\n        Pman.Dialog.CobaInvestorCreate.show({}, function() {\n            if(_this.table){\n                _this.table.footer.onClick('first');\n            }\n        });\n    } \n}"
+           },
+           "String weight" : "primary",
+           "xtype" : "Button",
+           "$ xns" : "Roo.bootstrap",
+           "String html" : "Create Investor",
+           "String style" : "margin:10px;"
+          },
+          {
+           "listeners" : {
+            "click" : "function (_self, e)\n{\n\n    if(Pman.Dialog.CobaInvestorImport) {\n        Pman.Dialog.CobaInvestorImport.show({}, function() {\n            if(_this.table){\n                _this.table.footer.onClick('last');\n            }\n        });\n    } \n}"
+           },
+           "String weight" : "primary",
+           "xtype" : "Button",
+           "$ xns" : "Roo.bootstrap",
+           "String html" : "Import Investor",
+           "String style" : "margin:10px;"
+          },
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.delete_btn=_self;\n}",
+            "click" : "function (_self, e)\n{\n\n    var s = _this.table.selModel.getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.bootstrap.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    \n    var sel = _this.table.getSelectionModel().getSelected();\n    \n    if(!sel){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a Investor');\n        return;\n    }\n    \n    if(sel.data.userdata_id * 1 < 1){\n        Roo.bootstrap.MessageBox.alert('Error', 'The selected Investor is not editable');\n        return;\n    }\n    \n    var deleteIt = function()\n    {    \n        new Pman.Request({\n            url: baseURL + '/Roo/Ext_data',\n            method: 'POST',\n            params: {\n                id : sel.data.id ,\n                _is_delete:1\n            },\n            success: function(res){\n                _this.table.footer.onClick('first');    \n                return;\n            }\n        });\n    }\n    \n    Roo.bootstrap.MessageBox.confirm('Confirm', 'Are you sure to delete the Investor?',function(ret) {\n        //console.log(sel.data);\n        if(ret == 'no'){\n            return;\n        }\n         \n        deleteIt();\n        \n     }, this);\n}"
+           },
+           "String weight" : "primary",
+           "xtype" : "Button",
+           "$ xns" : "Roo.bootstrap",
+           "String html" : "Delete Investor",
+           "String style" : "margin:10px;"
+          }
+         ]
+        },
+        {
+         "xtype" : "NavItem",
+         "$ xns" : "Roo.bootstrap",
+         "String style" : "float: right; width: 250px",
+         "items" : [
+          {
+           "xtype" : "Element",
+           "$ xns" : "Roo.bootstrap",
+           "items" : [
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+             },
+             "xtype" : "Form",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "listeners" : {
+                "keyup" : "function (_self, e)\n{\n    if(_self.keyCode == _self.ENTER) {\n        /*\n        options = {}\n        options.params = {};\n        options.params._with_status= 1;\n\n        var filter = _this.search_filter.getValue();  \n        if(filter !='') {\n            options.params._search_filter = filter;\n        }\n        */\n        \n        if (_this.table) {\n            //_this.table.store.load(options);\n            _this.table.footer.onClick('first'); \n        }\n    \n    }\n}",
+                "render" : "function (_self)\n{\n\n}"
+               },
+               "String name" : "search_filter",
+               "xtype" : "Input",
+               "string placeholder" : "Search for investor",
+               "String inputType" : "input",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "margin:10px;",
+               "string after" : "<i class=\"fa fa-search\" arian-hidden=\"true\"></i>"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Pman/Coba/Pman.Tab.CobaInvestors.js b/Pman/Coba/Pman.Tab.CobaInvestors.js
new file mode 100644 (file)
index 0000000..fe96df7
--- /dev/null
@@ -0,0 +1,512 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Tab');
+
+Pman.Tab.CobaInvestors = new Roo.XComponent({
+
+ _strings : {
+  'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
+  'c55bb3f1897a02f7c3be32fc933b0e0c' :"Create Investor",
+  '801d0ba359252756108ad71d7032a67e' :"Investors",
+  'ec53a8c4f07baed5d8825072c89799be' :"Status",
+  'b718adec73e04ce3ec720dd11a06a308' :"ID",
+  '52c649c38236206862e79e77f735902d' :"Investment Advisor",
+  'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
+  '58c98266099a5f6f52e211870dd620d6' :"Delete Investor",
+  '679b01485de24a379e37b7023bd36116' :"Search for investor",
+  'e7b47c58815acf1d3afa59a84b5db7fb' :"Company Name",
+  '913ddd7613d305b4879b376adf3f798c' :"Import Investor",
+  '49ee3087348e8d44e1feda1917443987' :"Name",
+  'a1fa27779242b4902f7ae3bdd5c6d508' :"Type"
+ },
+
+  part     :  ["Coba", "Investors" ],
+  order    : '001-Pman.Tab.CobaInvestors',
+  region   : 'center',
+  parent   : 'Pman.Tab.Coba',
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function(_data)
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'Grid',
+   autoScroll : true,
+   closable : false,
+   fitToFrame : true,
+   region : 'center',
+   title : _this._strings['801d0ba359252756108ad71d7032a67e'] /* Investors */,
+   listeners : {
+    activate : function (_self)
+     {
+         if(_this.table) {
+             _this.table.footer.onClick('first');
+         }
+         
+         if(_this.delete_btn) {
+             if(Pman.Login.authUser.groups.indexOf("Administrators") >=0) {
+                 _this.delete_btn.show();
+             } else {
+                 _this.delete_btn.hide();
+             }
+         }
+         
+     }
+   },
+   xns : Roo.bootstrap.panel,
+   '|xns' : 'Roo.bootstrap.panel',
+   toolbar : {
+    xtype : 'NavSimplebar',
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    items  : [
+     {
+      xtype : 'NavGroup',
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'NavItem',
+        style : 'float: left',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Button',
+          html : _this._strings['c55bb3f1897a02f7c3be32fc933b0e0c'] /* Create Investor */,
+          style : 'margin:10px;',
+          weight : 'primary',
+          listeners : {
+           click : function ()
+            {
+                if(Pman.Dialog.CobaInvestorCreate) {
+                    Pman.Dialog.CobaInvestorCreate.show({}, function() {
+                        if(_this.table){
+                            _this.table.footer.onClick('first');
+                        }
+                    });
+                } 
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         },
+         {
+          xtype : 'Button',
+          html : _this._strings['913ddd7613d305b4879b376adf3f798c'] /* Import Investor */,
+          style : 'margin:10px;',
+          weight : 'primary',
+          listeners : {
+           click : function (_self, e)
+            {
+            
+                if(Pman.Dialog.CobaInvestorImport) {
+                    Pman.Dialog.CobaInvestorImport.show({}, function() {
+                        if(_this.table){
+                            _this.table.footer.onClick('last');
+                        }
+                    });
+                } 
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         },
+         {
+          xtype : 'Button',
+          html : _this._strings['58c98266099a5f6f52e211870dd620d6'] /* Delete Investor */,
+          style : 'margin:10px;',
+          weight : 'primary',
+          listeners : {
+           click : function (_self, e)
+            {
+            
+                var s = _this.table.selModel.getSelections();
+                if (!s.length || (s.length > 1))  {
+                    Roo.bootstrap.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                    return;
+                }
+                
+                var sel = _this.table.getSelectionModel().getSelected();
+                
+                if(!sel){
+                    Roo.bootstrap.MessageBox.alert('Error', 'Please select a Investor');
+                    return;
+                }
+                
+                if(sel.data.userdata_id * 1 < 1){
+                    Roo.bootstrap.MessageBox.alert('Error', 'The selected Investor is not editable');
+                    return;
+                }
+                
+                var deleteIt = function()
+                {    
+                    new Pman.Request({
+                        url: baseURL + '/Roo/Ext_data',
+                        method: 'POST',
+                        params: {
+                            id : sel.data.id ,
+                            _is_delete:1
+                        },
+                        success: function(res){
+                            _this.table.footer.onClick('first');    
+                            return;
+                        }
+                    });
+                }
+                
+                Roo.bootstrap.MessageBox.confirm('Confirm', 'Are you sure to delete the Investor?',function(ret) {
+                    //console.log(sel.data);
+                    if(ret == 'no'){
+                        return;
+                    }
+                     
+                    deleteIt();
+                    
+                 }, this);
+            },
+           render : function (_self)
+            {
+                _this.delete_btn=_self;
+            }
+          },
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap'
+         }
+        ]
+       },
+       {
+        xtype : 'NavItem',
+        style : 'float: right; width: 250px',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap',
+        items  : [
+         {
+          xtype : 'Element',
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'Form',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.form = _self;
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            items  : [
+             {
+              xtype : 'Input',
+              after : '<i class=\"fa fa-search\" arian-hidden=\"true\"></i>',
+              inputType : 'input',
+              name : 'search_filter',
+              placeholder : _this._strings['679b01485de24a379e37b7023bd36116'] /* Search for investor */,
+              style : 'margin:10px;',
+              listeners : {
+               keyup : function (_self, e)
+                {
+                    if(_self.keyCode == _self.ENTER) {
+                        /*
+                        options = {}
+                        options.params = {};
+                        options.params._with_status= 1;
+                
+                        var filter = _this.search_filter.getValue();  
+                        if(filter !='') {
+                            options.params._search_filter = filter;
+                        }
+                        */
+                        
+                        if (_this.table) {
+                            //_this.table.store.load(options);
+                            _this.table.footer.onClick('first'); 
+                        }
+                    
+                    }
+                },
+               render : function (_self)
+                {
+                
+                }
+              },
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap'
+             }
+            ]
+           }
+          ]
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   },
+   grid : {
+    xtype : 'Table',
+    cls : 'table-fixed',
+    footerShow : true,
+    hover : true,
+    loadMask : true,
+    responsive : true,
+    rowSelection : true,
+    striped : false,
+    listeners : {
+     render : function (_self)
+      {
+          _this.table = this;
+      },
+     rowdblclick : function (_self, el, rowIndex, e)
+      {
+          if (!Pman.Dialog.CobaInvestorModify) {
+              return;
+          }
+          
+          var row = _this.table.store.getAt(rowIndex);
+          
+          Pman.Dialog.CobaInvestorModify.show( {id : row.data.id}, function() {
+              _this.table.footer.onClick('refresh');
+          });
+          
+      
+      }
+    },
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    footer : {
+     xtype : 'PagingToolbar',
+     pageSize : 15,
+     xns : Roo.bootstrap,
+     '|xns' : 'Roo.bootstrap'
+    },
+    store : {
+     xtype : 'Store',
+     remoteSort : true,
+     sortInfo : {field: 'full_name', direction: 'ASC'},
+     listeners : {
+      beforeload : function (_self, o)
+       {
+           o.params = o.params || {};
+           o.params._with_status= 1;
+           o.params.deleted_by = 0;
+          // o.params.limit =   _this.table.footer.pageSize *1; 
+           
+           var filter = _this.form.findField('search_filter').getValue();  
+           if(filter !='') {
+               o.params._search_filter = filter;
+           }
+       
+       }
+     },
+     xns : Roo.data,
+     '|xns' : 'Roo.data',
+     proxy : {
+      xtype : 'HttpProxy',
+      method : 'GET',
+      url : baseURL + '/Roo/Ext_data',
+      xns : Roo.data,
+      '|xns' : 'Roo.data'
+     },
+     reader : {
+      xtype : 'JsonReader',
+      fields : [
+          {
+              'name': 'id',
+              'type': 'int'
+          },
+          {
+              'name': 'userdata_id',
+              'type': 'int'
+          },
+          {
+              'name': 'full_name',
+              'type': 'string'
+          },
+          {
+              'name': 'company_name',
+              'type': 'string'
+          },
+          {
+              'name': 'account_type',
+              'type': 'string'
+          },
+          {
+              'name': 'in_email',
+              'type': 'string'
+          },
+          {
+              'name': 'in_contact_number',
+              'type': 'string'
+          },
+          {
+              'name': 'investment_advisor_id_name',
+              'type': 'string'
+          },
+          {
+              'name': 'fund_name',
+              'type': 'string'
+          },
+          {
+              'name': 'is_submit',
+              'type': 'int'
+          },
+          {
+              'name': 'check_complete',
+              'type': 'string'
+          },
+          {
+              'name': 'is_missing_document',
+              'type': 'int'
+          }
+      ],
+      id : 'id',
+      totalProperty : 'total',
+      xns : Roo.data,
+      '|xns' : 'Roo.data'
+     }
+    },
+    cm : [
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'userdata_id',
+      header : _this._strings['b718adec73e04ce3ec720dd11a06a308'] /* ID */,
+      hidden : false,
+      sortable : false,
+      width : 50,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'full_name',
+      header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+      locked : false,
+      sortable : false,
+      width : 300,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'company_name',
+      header : _this._strings['e7b47c58815acf1d3afa59a84b5db7fb'] /* Company Name */,
+      hidden : true,
+      locked : false,
+      sortable : false,
+      width : 300,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'account_type',
+      header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
+      locked : false,
+      sortable : false,
+      width : 100,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'in_email',
+      header : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
+      renderer : function (v) {
+              return (v.length && v.indexOf('@') > 0 ) ? 
+                  String.format('<a href="mailto:{0}">{0}</a>',v) : v;
+                  
+          },
+      sortable : false,
+      width : 300,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'in_contact_number',
+      header : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
+      sortable : false,
+      width : 150,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'investment_advisor_id_name',
+      header : _this._strings['52c649c38236206862e79e77f735902d'] /* Investment Advisor */,
+      sortable : false,
+      width : 150,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'account_type',
+      hidden : true,
+      sortable : false,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'fund_name',
+      hidden : true,
+      sortable : false,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     },
+     {
+      xtype : 'ColumnModel',
+      dataIndex : 'is_submit',
+      header : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
+      locked : false,
+      renderer : function(v,x,r) {  
+      
+          if(v * 1 > 0) {
+          
+              /*
+              * Submitted but missing the documents...
+              */
+              
+              if(r.data.is_missing_document * 1 == 1){
+                  return String.format(
+                      '<i style="color:green;" class="fa fa-check"></i> <span style="color:green;">Submitted</span>' +
+                      ' <i style="color:#941B0C;" class="fa fa-times"></i> Missing : Document'
+                  );
+              }
+              
+              /*
+              * Submitted and all documents have been upload...
+              */
+              
+              return String.format(
+                  '<i style="color:green;" class="fa fa-check"></i> <span style=color:green;">Submitted</span>'
+              );
+          }
+          
+          var fmt = '<i style="color:#941B0C;" class="fa fa-times"></i> Missing : {0}';
+          
+          if(!r.data.check_complete.length){
+              fmt = 'Form Completed, but not Submitted';
+          }
+          
+          return String.format(
+              fmt, 
+              r.data.check_complete.split(',').join(', ')
+          );
+       },
+      sortable : false,
+      width : 300,
+      xns : Roo.grid,
+      '|xns' : 'Roo.grid'
+     }
+    ]
+   }
+  };  }
+});
diff --git a/Pman/Coba/Reports/ApplicationSummary.php b/Pman/Coba/Reports/ApplicationSummary.php
new file mode 100644 (file)
index 0000000..8b3f492
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'ReportShare.php';
+
+class Pman_Coba_Reports_ApplicationSummary extends Pman_Coba_ReportShare
+{
+    var $masterTemplate = "application-summary-master-simple.html";
+    var $tempalte_prefix = "compliance-report-";
+         
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {        
+        parent::get($userdata_id,$opts);             
+    }
+
+  
+    
+}
diff --git a/Pman/Coba/Reports/ClientSummary.php b/Pman/Coba/Reports/ClientSummary.php
new file mode 100644 (file)
index 0000000..052ded7
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'ReportShare.php';
+
+class Pman_Coba_Reports_ClientSummary extends Pman_Coba_ReportShare
+{
+    var $masterTemplate = "application-summary-master-simple.html";
+    var $tempalte_prefix = "client-summary-";
+
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {                     
+        parent::get($userdata_id,$opts);
+    }
+
+}
diff --git a/Pman/Coba/Reports/ComplianceReport.php b/Pman/Coba/Reports/ComplianceReport.php
new file mode 100644 (file)
index 0000000..62a0faf
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'ReportShare.php';
+
+class Pman_Coba_Reports_ComplianceReport extends Pman_Coba_ReportShare
+{
+    var $masterTemplate = "application-summary-master.html";
+    var $tempalte_prefix = "compliance-report-";
+         
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {        
+        parent::get($userdata_id,$opts);             
+    }
+
+  
+    
+}
diff --git a/Pman/Coba/Reports/InvestorRiskProfile.php b/Pman/Coba/Reports/InvestorRiskProfile.php
new file mode 100644 (file)
index 0000000..fffb430
--- /dev/null
@@ -0,0 +1,440 @@
+<?php
+
+require_once 'Pman.php';
+require_once 'Pman/Coba/Schema.php';
+
+class Pman_Coba_Reports_InvestorRiskProfile extends Pman
+{
+
+    var $masterTemplate = "application-summary-master.html";
+    var $tempalte = "individual.html";
+    var $client_css;
+
+    var $summary;
+    var $declarations;
+    var $documents;
+
+    var $modx_user_id;
+    var $dependentRow;
+    var $report_date;
+    var $user_name;
+    var $name_advisor1;
+    var $name_advisor2;    
+
+    //schema buffer for matching the data with shareholder of shareholder
+    
+    var $totalScore;
+    var $questions;     
+    //var $investor_profile = 'Enum_Schema_InvestorProfile.csv';
+    var $risk_profile = 'InvestorRiskProfileQuestions.csv';
+    var $profile_comment = 'InvestorRiskProfileComment.csv';    
+        
+    var $sections;
+    var $layout_map;   
+    var $comments;
+     
+    var $ret;
+    var $risk_profile_mapping;   
+    var $show_profile_html = true;     
+   
+    var $comment_mapping = array ();
+        
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {
+        // load profile
+        $p = DB_DataObject::factory('coba_person_investor_profile');
+        $p->autojoin();
+        $p->modx_user_id = $userdata_id;
+                                        
+        //print_r(sizeof($p));                                        
+        foreach ($p->fetchAll() as $c){        
+            $this->ret[] = $c->toArray();
+        }        
+        //print_r($this->ret);
+        if(sizeof($this->ret) ==0){
+            die('No Record found');        
+        }
+        
+        $this->ext_data = PDO_DataObject::factory('ext_data')->load('userdata_id',$this->ret[0]['modx_user_id'])->toArray();
+        //print_r($this->ext_data);
+        $account_type = $this->ext_data['account_type'];
+        $x = new Pman_Coba_Schema();
+        $this->summary = $x->modifySummary($this->ext_data);
+
+        $this->template = "investor-risk-profile-{$this->ext_data['account_type']}.html";
+        $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+        
+        switch ($account_type) {
+            case 'individual':
+                $account_type_for_declaration = 'I';
+                break;
+                
+            case 'joint':
+                $account_type_for_declaration = 'J';
+                 if($this->ret[0]['is_second_ap']==1) {
+                    $this->user_name = $this->ext_data['firstname_second_ap']." ".$this->ext_data['lastname_second_ap'];       
+                } else {
+                    $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                }
+                break;
+                
+            case 'corporate':
+                $account_type_for_declaration = 'C';
+                $this->user_name = $this->ext_data['company_name'];                
+                //$this->modx_user_id = $userdata_id;
+                break;
+                
+            default:
+                $account_type_for_declaration = 'I';                
+                break;
+        }
+        
+        $this->report_date = date('F j, Y, h:i A');
+
+        $commentCSV = $this->readCSV($this->profile_comment);       
+        $this->comment_mapping = $this->modifyCommentArray($commentCSV);
+         
+        $rowsCSV = $this->readCSV($this->risk_profile);
+        $questions = $this->modifyMappingArray($rowsCSV);
+                        
+        foreach($this->ret as $investor => $inv_value) { 
+            $this->totalScore[$investor] = 0;                  
+            foreach($questions as $stepKey => $step ) {
+                foreach($step as $secKey => $sec) {
+                   foreach($sec as $q) {                               
+                                                       
+                       
+                       $score=0;
+                       if($q['show_score']){                                                      
+                           $score = $this->ret[$investor][$q['column_name'] . '_seqid'];   
+                           $this->totalScore[$investor] += $score;                                                                                                                            
+                       }
+                       
+                       if($q['type']=='checkbox' || $q['type']=='text'){
+                           $answer = $this->ret[$investor][$q['column_name']];
+                       } else {
+                          $answer = $this->ret[$investor][$q['column_name'] . '_display_name'];
+                       }
+                       
+                       if(!isset($this->layout_map[$stepKey][$secKey]['show_score'])) 
+                       {
+                           $this->layout_map[$stepKey][$secKey]['show_score'] =$q['show_score'];
+                       }       
+                                                        
+                       if(!isset($this->layout_map[$stepKey][$secKey]['show_template'])) 
+                       {
+                           $this->layout_map[$stepKey][$secKey]['show_template'] =$q['show_template'];
+                       }                                                        
+                      
+                       if(!isset($this->layout_map[$stepKey][$secKey]['template_name'])) 
+                       {
+                           $this->layout_map[$stepKey][$secKey]['template_name'] =$q['template_name'];
+                       }   
+                       
+                       if(!isset($this->layout_map[$stepKey][$secKey]['heading'])) 
+                       { 
+                           $this->layout_map[$stepKey][$secKey]['heading'] =$q['Section'];
+                       }
+                       
+                       if(!isset($this->layout_map[$stepKey][$secKey]['show_info'])) 
+                       { 
+                           $this->layout_map[$stepKey][$secKey]['show_info'] =$q['show_info'];
+                       }
+                       
+                       if(!isset($this->layout_map[$stepKey][$secKey]['layout_dependent_column_name'])) 
+                       { 
+                           $this->layout_map[$stepKey][$secKey]['layout_dependent_column_name'] =$q['layout_dependent_column_name'];
+                       }
+
+                       if(!isset($this->layout_map[$stepKey][$secKey]['layout_dependent_val'])) 
+                       { 
+                           $this->layout_map[$stepKey][$secKey]['layout_dependent_val'] =$q['layout_dependent_val'];
+                       }                       
+                       
+                       if(!isset($this->layout_map[$stepKey]['column_group'])) 
+                       { 
+                           $this->layout_map[$stepKey]['column_group'] =$q['column_group'];
+                       }
+                          
+                       if($this->layout_map[$stepKey]['column_group'] =='Y') {
+                           $this->sections[$stepKey][$investor][$secKey][$q['column_name']] =  array(
+                                                                                 'display_name' => $q['Label'],
+                                                                                 'answer' => $answer,
+                                                                                 'score' => $score,
+                                                                                 'type' => $q['type'],
+                                                                                 'row' => $q                                                                                 
+                                                                                );                                                                                                                            
+                       
+                       } else {
+                           $this->sections[$stepKey][$secKey][$investor][$q['column_name']] =  array(
+                                                                                 'display_name' => $q['Label'],
+                                                                                 'answer' => $answer,
+                                                                                 'score' => $score,
+                                                                                 'type' => $q['type'],
+                                                                                 'row' => $q                                                                                 
+                                                                                );                                                                                                                            
+                       
+                       }
+                    }     
+                
+                 }
+            }                  
+            $this->comments[$investor] = $this->findInRange($this->totalScore[$investor],$this->comment_mapping);
+                      
+        }
+        
+        //print_r($this->sections);
+                                 
+        $profileCSV = $this->readCSV($this->risk_profile);
+        $this->risk_profile_mapping = $this->modifyMappingArray($profileCSV);              
+                            
+        $ff = HTML_FlexyFramework2::get();
+        //$this->ref_code = $this->ret[0]['modx_user_id'];
+        $this->ref_code = $ff->Coba['default_fund']."-".$this->ret[0]['modx_user_id'];
+        
+        $this->client_dir = $ff->Coba['client_dir'];
+    }
+
+    function findInRange($number, $array)
+    {
+        foreach ($array as $key => $value) {
+            list($min, $max) = explode('-', $key);
+            if ($number >= $min && $number <= $max) {
+                return $value;
+            }
+        }
+
+        return null;
+    }    
+    
+    function getTotalScore($investor)
+    { 
+       $result = 0;
+       foreach ( $this->sections['section_3'][$investor] as $key => $value) {
+            $result += $value['score'];                 
+       }
+       return $result;
+    }
+
+    function readCSV($filename)
+    {
+        $ff = HTML_FlexyFramework2::get();
+        $file = __DIR__ . "/../../../Coba/Clients/{$ff->Coba['client_dir']}/{$filename}";
+        $fp = fopen($file,"r");
+         
+        $header = null;
+        while ($row = fgetcsv($fp)) {
+            if ($header === null) {
+                $header = $row;
+                continue;
+            }
+            $rowsCSV[] = array_combine($header, $row);            
+        }
+        
+        fclose($fp);        
+        return $rowsCSV;
+    }
+
+    function modifyEnumArray($rowsCSV) {
+
+        foreach ($rowsCSV as $rowCSV) {
+            $key = str_replace("coba.","",$rowCSV['etype']); 
+            if(!isset($etypes[$key])){
+                $etypes[$key] = array(                   
+                    'name' => $key,
+                    'display_name' => $rowCSV['question']
+                );
+
+            }
+
+        }        
+        return array_values($etypes);
+        //return $etypes;
+
+    }
+
+     function modifyMappingArray($rowsCSV) {
+
+        foreach ($rowsCSV as $rowCSV) {
+            if(!isset($etypes[$rowCSV['Step']][$rowCSV['Section']][$rowCSV['column_name']])){
+                $etypes[$rowCSV['Step']][$rowCSV['Section']][$rowCSV['column_name']] = $rowCSV;
+            }
+        }        
+        return $etypes;        
+    }
+    
+    function modifyCommentArray($rowsCSV) {
+
+        foreach ($rowsCSV as $rowCSV) {
+            if(!isset($r[$rowCSV['range']])){
+                $r[$rowCSV['range']] = $rowCSV;
+            }
+        }        
+        return $r;        
+    }
+
+    //output question from each section && switch the output for different questions' type
+    function outputQuestionByType($row,$investor)
+    {        
+        $checked = 'check';
+        $str ='';
+        switch ($row['type']) {
+        case 'checkbox':
+            if ($this->ret[$investor][$row['column_name']]){
+                $checked ='unchecked';
+            }
+            $str = "<span class='glyphicon glyphicon-{$checked} text-primary'></span>";
+            break;
+            
+        default:            
+            $str = $this->ret[$investor][$row['column_name']];
+            break;
+        }        
+        return $str;
+    }
+   
+   function outputField($row)
+    {        
+        $checked = 'check';
+        $str ='';
+        switch ($row['type']) {
+        case 'checkbox':
+            if ($row['answer'] ==0){
+                $checked ='unchecked';
+            }
+            $str = "<span class='glyphicon glyphicon-{$checked} text-primary'></span>";
+            break;
+            
+        default:            
+            $str = $row['answer'];
+            break;
+        }        
+        return $str;
+    }   
+   
+    //check the field dependency
+    function checkDependency($row,$investor)
+    {            
+        if (empty($row['row']['dependent_column_name'])) {
+            return true;
+        }
+         
+        if ($row['row']['dependent_val'] == $this->ret[$investor][$row['row']['dependent_column_name']]) {                              
+                return true;
+                                   
+        }        
+    }
+    
+    function decodeEnum($value) {
+         $arr = explode(",", $value);
+         $result = "";                 
+         foreach($arr as $str){                                
+            $temp = PDO_DataObject::factory('core_enum');                                              
+            $temp->get('id',$str);                             
+            $result .= $temp->display_name . ", ";                                             
+         }  
+                       
+         return substr($result, 0, -2) ;  
+    }
+    
+   function getApplicationKey($value) {
+        return $value + 1;                                     
+   }  
+                       
+   function get_inv_info($investor){      
+      if($this->ret[$investor]['is_second_ap']){
+         return $this->renderRow('Title',$this->ext_data['title_second_ap']) .
+                $this->renderRow('First Name',$this->ext_data['firstname_second_ap']) .
+                $this->renderRow('Middle Name',$this->ext_data['middlename_second_ap']) .
+                $this->renderRow('Last Name',$this->ext_data['lastname_second_ap']);
+      } else {
+         return  $this->renderRow('Title',$this->ext_data['in_title']) .
+                 $this->renderRow('First Name',$this->ext_data['in_firstname']) .
+                 $this->renderRow('Middle Name',$this->ext_data['in_middlename']) .
+                 $this->renderRow('Last Name',$this->ext_data['in_lastname']);
+      }      
+   }       
+
+   function display_score($investor)
+   {
+      return $this->totalScore[$investor];
+   }
+
+   function display_comments($investor,$key)
+   {
+      return $this->comments[$investor][$key];
+   }
+
+   function renderRow($key,$value){
+       return "<tr class='app-sum-body-indi-data-row'>
+            <td class='col-md-6 app-sum-body-indi-data'>               
+                {$key}
+            </td>
+            <td class='col-md-6 app-sum-body-indi-data'>
+                {$value}
+            </td>
+            </tr>";       
+   }
+
+   function renderField($str){
+       return htmlspecialchars($str);
+   }
+   
+   function is_show_score($stepKey,$secKey) {
+       return $this->layout_map[$stepKey][$secKey]['show_score'];
+   }
+   
+   function is_show_info($stepKey,$secKey) {
+       if ($this->ext_data['account_type'] != 'joint') {
+          return false;        
+       }
+       return $this->layout_map[$stepKey][$secKey]['show_info'];
+   }   
+   
+   function get_template_name($stepKey,$secKey) {
+      //print_r($this->layout_map[$stepKey][$secKey]['template_name']);
+       $this->html_template =  $this->layout_map[$stepKey][$secKey]['template_name'];           
+   }       
+   
+   function get_heading($stepKey,$secKey,$investor) {
+      if($this->layout_map[$stepKey][$secKey]['layout_dependent_column_name'] !='') 
+      {              
+          if ($this->layout_map[$stepKey][$secKey]['layout_dependent_val'] != 
+              $this->ret[$investor][$this->layout_map[$stepKey][$secKey]['layout_dependent_column_name']]) {                            
+                return ;                                   
+          } 
+      }
+      
+      if($this->layout_map[$stepKey][$secKey]['heading'] !='N/A') {
+         return $this->layout_map[$stepKey][$secKey]['heading'];      
+      }         
+   }      
+   
+   function is_show_section($stepKey,$secKey,$investor) {
+      if($this->layout_map[$stepKey][$secKey]['layout_dependent_column_name'] =='') 
+      {              
+          return true;  
+      }   
+      if ($this->layout_map[$stepKey][$secKey]['layout_dependent_val'] == 
+          $this->ret[$investor][$this->layout_map[$stepKey][$secKey]['layout_dependent_column_name']]) {                                
+          return true;                                   
+      }                 
+   }         
+   
+   function is_show_template($stepKey,$secKey) {
+       return $this->layout_map[$stepKey][$secKey]['show_template']; 
+                                      
+   }
+   
+   function is_column_group($stepKey) {        
+        if($this->layout_map[$stepKey]['column_group']=='Y') {
+           return true;
+       }  
+                                      
+   }
+}
diff --git a/Pman/Coba/Reports/LexisNexis.php b/Pman/Coba/Reports/LexisNexis.php
new file mode 100644 (file)
index 0000000..145e6f7
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Coba_Reports_LexisNexis extends Pman
+{
+    var $masterTemplate = "lexis-nexis-master.html";
+    
+    var $template = "lexis-nexis.html";
+
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($id, $opts = array())
+    {
+        $this->modx_user = DB_DataObject::factory('modx_users');
+        
+        $this->completed = false;
+        
+        if(empty($id) || !$this->modx_user->get($id)){
+            return;
+        }
+        
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba) || empty($ff->Coba['LexisNexis'])){
+            return;
+        }
+        
+        $file = "{$ff->Pman['storedir']}/soap/responses/{$this->modx_user->id}.json";
+        
+        if(!file_exists($file)){
+            return;
+        }
+        
+        $this->reportDate = date('F j, Y, h:i A', filemtime($file));
+        
+        $this->completed = true;
+        
+        $response = json_decode(file_get_contents($file));
+        
+        if(
+                empty($response->SearchResult) || 
+                empty($response->SearchResult->Records) || 
+                empty($response->SearchResult->Records->ResultRecord) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch)
+        ) {
+            return;
+        }
+        
+        $matches = $response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch;
+        $matches = is_array($matches) ? $matches : array($matches);
+
+        $total = count($matches);
+        
+        $this->matches = array();
+        
+        if($total < 1){
+            return;
+        }
+        
+        $processed = array();
+        
+        foreach ($matches as $k => $v){
+            
+            if(in_array($v->EntityUniqueID, $processed)){
+                continue;
+            }
+            
+            $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+            $coba_investor_lexis_results->autoJoin();
+            $coba_investor_lexis_results->setFrom(array(
+                'investor_id' => $this->modx_user->id,
+                'match_id' => $v->EntityUniqueID,
+                'is_active' => 1
+            ));
+            
+            if(!$coba_investor_lexis_results->find(true)){
+                continue;
+            }
+            
+            $processed[] = $v->EntityUniqueID;
+            
+            $v->coba_investor_lexis_result = clone ($coba_investor_lexis_results);
+            
+            $this->matches[] = $v;
+            
+        }
+        
+    }
+    
+    function formatDate($date, $format = 'Y-m-d')
+    {
+        return date($format, strtotime($date));
+    }
+    
+    function comments($comments)
+    {
+        $c = array_map('trim', explode("\n", $comments));
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        $c = array_map('trim', explode('||', $c));
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        $c = array_map('trim', explode('|', $c));
+        
+        $c = array_map(function($str){
+            $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
+         
+            if(preg_match($reg_exUrl, $str, $url)) {
+                
+                if(parse_url($str, PHP_URL_HOST) == 'members.worldcompliance.com'){
+                    return '';
+                }
+                
+                return preg_replace($reg_exUrl, '<a href="'.$url[0].'" target="_blank">'. wordwrap($url[0], 40, ' ', true).'</a>', $str);
+            }
+
+            return $str;
+        }, $c);
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        $c = array_map('trim', explode(';', $c));
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        return $c;
+        
+    }
+    
+    function infoKey($info)
+    {
+        $key = $info->Type;
+        
+        if($info->Type == 'DOB'){
+            $key = 'Date of Birth';
+        }
+        
+        if($info->Type == 'Other'){
+            $key = 'Other Information';
+        }
+        
+        if($info->Type == 'PlaceOfBirth'){
+            $key = 'Place of Birth';
+        }
+        
+        return $key;
+        
+    }
+    
+    function is_pending($status)
+    {
+        return ($status == 0) ? true : false;
+    }
+    
+    function is_accepted($status)
+    {
+        return ($status == 1) ? true : false;
+    }
+    
+    function is_rejected($status)
+    {
+        return ($status == -1) ? true : false;
+    }
+    
+}
diff --git a/Pman/Coba/Reports/LexisNexisDetail.php b/Pman/Coba/Reports/LexisNexisDetail.php
new file mode 100644 (file)
index 0000000..65fa3a4
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+
+require_once 'Pman/Coba/Reports/LexisNexis.php';
+
+class Pman_Coba_Reports_LexisNexisDetail extends Pman_Coba_Reports_LexisNexis
+{
+    var $template = "lexis-nexis-detail.html";
+
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($id, $opts = array())
+    {
+        $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+        
+        if(empty($id) || !$coba_investor_lexis_results->get($id)){
+            return;
+        }
+        
+        $this->modx_user = DB_DataObject::factory('modx_users');
+        
+        if(!$this->modx_user->get($coba_investor_lexis_results->investor_id)){
+            return;
+        }
+        
+        $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba) || empty($ff->Coba['LexisNexis'])){
+            return;
+        }
+        
+        $file = "{$ff->Pman['storedir']}/soap/responses/{$this->modx_user->id}.json";
+        
+        if(!file_exists($file)){
+            return;
+        }
+        
+        $response = json_decode(file_get_contents($file));
+        
+        if(
+                empty($response->SearchResult) || 
+                empty($response->SearchResult->Records) || 
+                empty($response->SearchResult->Records->ResultRecord) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch)
+        ) {
+            return;
+        }
+        
+        $matches = $response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch;
+        $matches = is_array($matches) ? $matches : array($matches);
+
+        $this->detail = array();
+        
+        foreach ($matches as $k => $v){
+            
+            if(empty($v->EntityUniqueID) || $v->EntityUniqueID != $coba_investor_lexis_results->match_id){
+                continue;
+            }
+            
+            $this->detail = $v;
+            
+        }
+        
+    }
+}
diff --git a/Pman/Coba/Reports/ReportShare.php b/Pman/Coba/Reports/ReportShare.php
new file mode 100644 (file)
index 0000000..b59839b
--- /dev/null
@@ -0,0 +1,929 @@
+<?php
+
+require_once 'Pman.php';
+require_once 'Pman/Coba/Schema.php';
+
+class Pman_Coba_ReportShare extends Pman
+{
+
+    var $masterTemplate = '';
+    var $tempalte = "individual.html";
+    //var $tempalte_prefix = "compliance-report-";
+    var $tempalte_prefix = '';
+    var $client_css;
+    var $summary;
+    var $declarations;
+    var $documents;
+
+    var $modx_user_id;
+    var $dependentRow;
+    var $report_date;
+    var $user_name;
+    var $name_advisor1;
+    var $name_advisor2;
+    
+    //schema buffer for matching the data with shareholder of shareholder
+    var $schema_data_individual;
+    var $schema_data_company;
+
+    var $check_completed_declaration;
+    var $check_completed_document;
+    var $account_type;
+    var $field_def ;
+    
+    var $report_schema = 'accreditationSchema.csv';
+    var $section_layout = 'summaryReportLayout.csv';
+    var $field_dependency = 'summaryReportFieldDepend.csv';
+    
+    var $section_map = array();
+    
+    var $country_map = array();
+    
+    var $depend_map = array();
+    
+    var $state_map = array();
+    
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {        
+        $this->ext_data = PDO_DataObject::factory('ext_data');
+        $this->ext_data->autoJoin();        
+        $this->ext_data->get('userdata_id',$userdata_id);
+       
+        //split the string value and lookup        
+        $this->ext_data->anti_money_laundering = $this->decodeEnum($this->ext_data->anti_money_laundering);
+        $this->ext_data->anti_money_laundering_second_ap = $this->decodeEnum($this->ext_data->anti_money_laundering_second_ap);
+        
+        $x = new Pman_Coba_Schema();
+        $this->summary = $x->modifySummary($this->ext_data->toArray());
+        
+        $this->name_advisor = $this->ext_data->investment_advisor_id_name;
+        $this->user_name = $this->ext_data->in_firstname." ".$this->ext_data->in_lastname;
+        
+        $this->template = "{$this->tempalte_prefix}{$this->ext_data->account_type}.html";        
+        
+        switch ($this->ext_data->account_type) {
+            case 'individual':
+                $this->used_by = 'I';                                
+                break;
+                
+            case 'joint':
+                $this->used_by = 'J';                                
+                break;
+                
+            case 'corporate':
+                $this->used_by = 'C';
+                if($this->ext_data->is_listed_company == 'yes'){
+                    $this->used_by = 'CL';
+                }
+                $this->user_name = $this->ext_data->company_name;                
+                $this->modx_user_id = $userdata_id;
+                break;
+                
+            default:
+                $this->used_by = 'I';                
+                break;
+        }
+        
+        
+                
+        //init ref code
+        $ff = HTML_FlexyFramework2::get();
+        $this->ref_code = $ff->Coba['default_fund']."-".$userdata_id;
+        //$this->ref_code = $userdata_id;        
+        
+        $this->client_dir = $ff->Coba['client_dir'];
+
+        
+        //load declaration        
+        $this->declarations = $this->load_inv_declaration('declaration');     
+        //print_r($this->declarations);
+        
+        //load document                
+        $this->documents = $this->load_inv_declaration('checklist');
+        //print_r($this->documents);
+        
+        $this->report_date = date('F j, Y, h:i A');
+
+        $rowsCSV = $this->readCSV($this->report_schema);
+        $this->field_def = $this-> modifyEnumArray($rowsCSV);
+        
+        
+        $rowsLayout = $this->readCSV($this->section_layout);
+        $this->section_map = $this->modifyLayoutArray($rowsLayout);
+               
+        $rowsDepend = $this->readCSV($this->field_dependency);
+        $this->depend_map = $this->modifyDependArray($rowsDepend);             
+        //print_r($this->ext_data);
+        $this->load_com_shareholder();
+        $this->load_ind_shareholder();
+        $this->load_director();
+                       
+        $this->load_LexisNexis();
+        
+    }
+
+    function is_show_section($sectionKey){
+        // no varible set, display section
+        
+        if(!isset($this->section_map[$sectionKey])){
+            return true;       
+        }
+        
+        if(strtolower($this->section_map[$sectionKey][$this->ext_data->account_type]) !='y'){
+            return true;       
+        }
+
+        // check for joint account
+        if($this->ext_data->account_type =='joint')
+        {
+            if($this->ext_data->{$this->section_map[$sectionKey]['dependent_column_name']} == $this->section_map[$sectionKey]['dependent_val'] && 
+               $this->ext_data->{$this->section_map[$sectionKey]['dependent_column_name_sec_ap']} == $this->section_map[$sectionKey]['dependent_val_sec_ap']
+              )
+            {
+                if($this->section_map[$sectionKey]['dependent_action'] == 'show'){                       
+                    return true;                                  
+                }
+       
+            }
+            return true;
+        }
+        if(strtolower($this->section_map[$sectionKey]['condition']) =='count'){
+            if($this->section_map[$sectionKey]['dependent_column_name'] =='com_shareholder')
+            {
+               if(sizeof($this->data_company_shareholder) == $this->section_map[$sectionKey]['dependent_val'] &&
+                  $this->section_map[$sectionKey]['dependent_action'] == 'hide' 
+                 )
+               {
+                  return false;
+               }
+               return true; 
+            }  
+        }
+         
+        if($this->ext_data->{$this->section_map[$sectionKey]['dependent_column_name']} == $this->section_map[$sectionKey]['dependent_val']){
+
+            if($this->section_map[$sectionKey]['dependent_action'] == 'show'){        
+                return true;              
+            }
+       
+        }
+                        
+    }
+    //check the field dependency
+    function checkDependency($row)
+    {
+      return $this->checkDependencyData($row,null);
+    }
+    
+    function checkDependencyData($row,$obj)
+    {
+        if ($row['being_dependent'] == 'Y') {                   
+            //buffering the data for dependency checking
+            $this->dependentRow[$row['Section']][$row['Data Table']][$row['column_name']] = $row['data'];                                        
+            if ($row['if_checked'] == 'show') {
+                if (!$row['data']) {
+                    return false;
+                }
+            } else {
+                if($row['data']) {
+                    return false;
+                }
+            }
+        }
+        
+        if (empty($row['dependent_column_name'])) {            
+            return true;
+        }        
+        // check for denepdency not covered in schema         
+        if(isset($this->depend_map[$row['column_name']]))
+        {
+            if(strtolower($this->depend_map[$row['column_name']][$this->ext_data->account_type]) !='y'){
+                return true;   
+            }
+            if(strtolower($this->depend_map[$row['column_name']]['condition']) =='equal'){
+               if($obj){
+                  if($row['dependent_table']!='ext_data') {                                                                                    
+                      if($obj->{$row['dependent_table'] . '_id_' . $row['dependent_column_name']} == $this->depend_map[$row['column_name']]['dependent_val']){
+                          if($this->depend_map[$row['column_name']]['dependent_action'] == 'show'){                      
+                             return true;                                 
+                          }
+                          return false;
+                      }                  
+                  }
+               }
+               
+               if($this->ext_data->{$this->depend_map[$row['column_name']]['dependent_column_name']} == $this->depend_map[$row['column_name']]['dependent_val']){
+                          if($this->depend_map[$row['column_name']]['dependent_action'] == 'show'){                      
+                             return true;                                 
+                          }
+                          return false;
+              }      
+            }
+       
+            if(strtolower($this->depend_map[$row['column_name']]['condition']) =='contain'){
+               //print_r($this->depend_map[$row['column_name']]);                                            
+               $pos = strpos($this->ext_data->{$this->depend_map[$row['column_name']]['dependent_column_name']}, $this->depend_map[$row['column_name']]['dependent_val']);
+               if ($pos !== false) {
+                   if($this->depend_map[$row['column_name']]['dependent_action'] == 'show'){                     
+                       return true;                               
+                   }
+                   return false; 
+               }         
+                      
+            }
+            
+            if(strtolower($this->depend_map[$row['column_name']]['condition']) =='and'){               
+                if($this->ext_data->{$this->depend_map[$row['column_name']]['dependent_column_name']} == $this->depend_map[$row['column_name']]['dependent_val'] && 
+                   $this->ext_data->{$this->depend_map[$row['column_name']]['dependent_column_name_sec']} == $this->depend_map[$row['column_name']]['dependent_val_sec']
+                  )
+                {
+                    if($this->depend_map[$row['column_name']]['dependent_action'] == 'show'){                    
+                        return true;                              
+                    } 
+                    return false;                        
+                }
+                return false;                  
+            }
+            
+            if(strtolower($this->depend_map[$row['column_name']]['condition']) =='or'){                
+                if($this->ext_data->{$this->depend_map[$row['column_name']]['dependent_column_name']} == $this->depend_map[$row['column_name']]['dependent_val'] || 
+                   $this->ext_data->{$this->depend_map[$row['column_name']]['dependent_column_name_sec']} == $this->depend_map[$row['column_name']]['dependent_val_sec']
+                  )
+                {
+                    if($this->depend_map[$row['column_name']]['dependent_action'] == 'show'){                                                            
+                        return true;   
+                                                  
+                    }                     
+                    return false;                        
+                }      
+            }             
+            
+           
+        }
+        
+        if ($row['dependent_val'] == $this->dependentRow[$row['Section']][$row['dependent_table']][$row['dependent_column_name']]) {                            
+            return true;
+        } else {                
+            if($this->field_def[$row['dependent_column_name']][$this->account_type] == 'M') {
+                return true;                
+            }                
+        }
+    }
+
+    //------check specific section for corporate------
+    function is_director_section($sectionKey)
+    {
+        if ($sectionKey == "Directors") {
+            return true;
+        }        
+    }
+
+    function is_individual_shareholder($sectionKey)
+    {
+        if ($sectionKey == 'KYC: Shareholders: Individual') {
+            return true;
+        }       
+    }
+
+    function is_company_shareholder($sectionKey)
+    {
+        if ($sectionKey == 'KYC: Shareholders: Company') {
+            return true;
+        }        
+    }
+
+    //------saving buffer for specific section------
+    function save_buffer_for_individual_shareholder($row)
+    {
+        if (!isset($this->schema_data_individual)) {
+            $this->schema_data_individual = $row;
+        }
+    }
+
+    function save_buffer_for_company_shareholder($row)
+    {
+        if (!isset($this->schema_data_company)) {
+            $this->schema_data_company = $row;
+        }
+    }
+
+    function print_label_and_data($client_data,$row,$tab_num)
+    {
+        $field_name = $row['Data Table']."_id_".$row['column_name'];
+        
+        //var_dump($client_data);
+        $row['data'] = $client_data->$field_name;
+                
+        if ($this->checkDependencyData($row,$client_data)) {
+            //$str = $this->renderTblRow($this->tabbing($tab_num) . $row['Label'] ,$this->renderOutputQuestion($row));
+            $str = $this->renderTblRowTab($this->tabbing($tab_num), $row ,$this->renderOutputQuestion($row));            
+            echo $str;
+        }
+    }
+
+
+    function print_com_label_and_data($client_data,$row,$tab_num)
+    {
+        $field_name = $row['Data Table']."_id_".$row['column_name'];        
+        $display_row=true;
+        $row['data'] = $client_data->$field_name;        
+        if($client_data->coba_company_id_is_listed_company){              
+            if($field_name != 'coba_company_id_is_listed_company' &&  
+               $field_name != 'coba_company_id_exchange_traded_on' &&
+               $field_name != 'coba_company_id_stock_symbol' ) 
+            {
+                $display_row=false;
+            }                                                                                                         
+        }        
+        
+        
+        if ($this->checkDependencyData($row,$client_data) && $display_row) {
+            //$str = $this->renderTblRow($this->tabbing($tab_num) . $row['Label'] ,$this->renderOutputQuestion($row));
+            $str = $this->renderTblRowTab($this->tabbing($tab_num), $row ,$this->renderOutputQuestion($row));            
+            echo $str;
+        }
+    }
+    //output question from each section && switch the output for different questions' type
+    function outputQuestionByType($row)
+    {
+        $checked = 'check';
+        $str ='';
+        switch ($row['type']) {
+        case 'checkbox':
+            if (!$row['data']){
+                $checked ='unchecked';
+            }
+            $str = "<span class='glyphicon glyphicon-{$checked} text-primary'></span>";
+            break;
+        case 'radio':
+            $str = ucfirst($row['data']);
+            break;
+        default:
+            $str = $this->renderField($row);
+            //$str = $row['data'];
+            break;
+        }        
+        return $str;
+    }
+
+    function print_shareholder_of_shareholder($com_shareholder,$tab_num)
+    {
+        $tab_num ++;
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+        $x->autoJoinPersonAddr();
+                
+        $x->selectAddCountryStates(); 
+        $x->relation = 'SHAREHOLDER';
+        $x->parent_company_id = $com_shareholder->coba_company_id;
+        $x->coba_company_id = '0';
+        
+        $data_ind_shareholder = $x->fetchAll();
+        
+        foreach ($data_ind_shareholder as $ind_shareholder_key
+                  => $ind_shareholder) {
+            //print_r($ind_shareholder);
+            $this->setMapping($ind_shareholder);  
+            $str = $this->renderTblHeading($this->tabbing($tab_num), 
+                      'Shareholder : Individual '  .
+                      $this->modifyClientNumber($ind_shareholder_key));
+            echo $str;                                        
+            
+            foreach ($this->schema_data_individual as $ind_row) {
+                $this->print_label_and_data($ind_shareholder,$ind_row,$tab_num);
+            }
+            
+            echo "</table>";
+        }
+
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+        $x->autoJoinComAddr();
+        $x->selectAddCountryStates(); 
+        
+        $x->relation = 'SHAREHOLDER';
+        $x->parent_company_id = $com_shareholder->coba_company_id;
+        $x->coba_person_id = '0';
+        
+        $data_com_shareholder = $x->fetchAll();
+        
+        if (count($data_com_shareholder)) {
+            foreach ($data_com_shareholder as $com_shareholder_key
+                      => $com_shareholder) {
+                //print_r($com_shareholder);
+                $this->setMapping($com_shareholder);  
+                $str = $this->renderTblHeading($this->tabbing($tab_num), 
+                           'Shareholder : Company '  .
+                            $this->modifyClientNumber($com_shareholder_key));
+                echo $str;
+                                                                       
+                foreach ($this->schema_data_company as $com_row) {                       
+                    $this->print_com_label_and_data    ($com_shareholder,$com_row,$tab_num);
+                }
+                
+                echo "</table>";
+                $this->print_shareholder_of_shareholder($com_shareholder,$tab_num);
+            }
+        }
+    }
+
+    function tabbing($tab_num)
+    {
+        $n = 0;
+        $tabbing_class_string = "";
+        while ($n < $tab_num) {
+            $tabbing_class_string.="<span class='app-sum-body-tabbing'></span>";
+            $n++;
+        };
+        return $tabbing_class_string;
+    }
+
+    function modifyClientNumber($n)
+    {
+        return $n+1;
+    }
+    
+    function readCSV($filename)
+    {
+        $ff = HTML_FlexyFramework2::get();
+        $file = __DIR__ . "/../../../Coba/Clients/{$ff->Coba['client_dir']}/{$filename}";
+        $fp = fopen($file,"r");
+         
+        $header = null;
+        while ($row = fgetcsv($fp)) {
+            if ($header === null) {
+                $header = $row;
+                continue;
+            }
+            $rowsCSV[] = array_combine($header, $row);            
+        }
+        
+        fclose($fp);        
+        return $rowsCSV;
+    }    
+   
+    function modifyEnumArray($rowsCSV) {
+
+        foreach ($rowsCSV as $rowCSV) {
+            if(strtolower($rowCSV['being_dependent'])=='y') {
+                if(!isset($etypes[$rowCSV['column_name']])){
+                    $etypes[$rowCSV['column_name']] = array(                        
+                        'Individual' => $rowCSV['Individual'],
+                        'Corporate' => $rowCSV['Corporate'],
+                        'Joint' => $rowCSV['Joint'],
+                        'dependent_val' => $rowCSV['dependent_val']                        
+                    );
+                }
+            }
+            
+        }
+        
+        return $etypes;
+    }
+       
+    function modifyLayoutArray($rowsCSV) {
+
+        foreach ($rowsCSV as $rowCSV) {
+            if(!isset($r[$rowCSV['Section']])){
+                $r[$rowCSV['Section']] = $rowCSV;
+            }
+        }        
+        return $r;        
+    }
+    
+    function modifyDependArray($rowsCSV) {
+
+        foreach ($rowsCSV as $rowCSV) {
+            if(!isset($r[$rowCSV['column_name']])){
+                $r[$rowCSV['column_name']] = $rowCSV;
+            }
+        }        
+        return $r;        
+    }    
+    
+    function formatDate($date, $format = 'Y-m-d')
+    {
+        return date($format, strtotime($date));
+    }    
+    
+    function load_LexisNexis()
+    {
+       $ff = HTML_FlexyFramework::get();
+        
+        if(empty($ff->Coba) || empty($ff->Coba['LexisNexis'])){
+            return;
+        }
+        
+        $this->nexisCompleted = false;
+        
+        $file = "{$ff->Pman['storedir']}/soap/responses/{$this->ext_data->userdata_id}.json";
+        
+        if(!file_exists($file)){
+            return;
+        }
+        
+        $this->nexisReportDate = date('F j, Y, h:i A', filemtime($file));
+        
+        $this->nexisCompleted = true;        
+        
+        $response = json_decode(file_get_contents($file));
+        
+        if(
+                empty($response->SearchResult) || 
+                empty($response->SearchResult->Records) || 
+                empty($response->SearchResult->Records->ResultRecord) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches) || 
+                empty($response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch)
+        ) {
+            return;
+        }
+        
+        $matches = $response->SearchResult->Records->ResultRecord->Watchlist->Matches->WLMatch;
+        $matches = is_array($matches) ? $matches : array($matches);
+        $total = count($matches);
+        
+        $this->nexis_has_matches = false;
+        
+        if($total < 1){
+            return;
+        }
+        
+        
+        $this->nexis_has_matches = true;
+        
+        $this->nexisMatches = array();
+        
+        $this->nexisRejected = array();
+        
+        $processed = array();
+        
+        foreach ($matches as $k => $v){
+            
+            if(in_array($v->EntityUniqueID, $processed)){
+                continue;
+            }
+            
+            $coba_investor_lexis_results = DB_DataObject::factory('coba_investor_lexis_results');
+            $coba_investor_lexis_results->autoJoin();
+            $coba_investor_lexis_results->setFrom(array(
+                'investor_id' => $this->ext_data->userdata_id,
+                'match_id' => $v->EntityUniqueID,
+                'is_active' => 1
+            ));
+            
+            if(!$coba_investor_lexis_results->find(true)){
+                continue;
+            }
+            
+            $processed[] = $v->EntityUniqueID;
+            
+            $v->coba_investor_lexis_result = clone ($coba_investor_lexis_results);
+            
+            if($coba_investor_lexis_results->status == -1){
+                $this->nexisRejected[] = $v;
+                continue;
+            }
+            
+            $this->nexisMatches[] = $v;
+            
+        }
+        
+    }    
+    
+    function nexis_comments($comments)
+    {    
+        $c = array_map('trim', explode("\n", $comments));
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        $c = array_map('trim', explode('||', $c));
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        $c = array_map('trim', explode('|', $c));
+        
+        $c = array_map(function($str){
+            $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
+         
+            if(preg_match($reg_exUrl, $str, $url)) {
+                
+                if(parse_url($str, PHP_URL_HOST) == 'members.worldcompliance.com'){
+                    return '';
+                }
+                
+                return preg_replace($reg_exUrl, '<a href="'.$url[0].'" target="_blank">'. wordwrap($url[0], 40, ' ', true).'</a>', $str);
+            }
+            
+            if(preg_match($reg_exUrl, $str, $url)) {
+                return preg_replace($reg_exUrl, '<a href="'.$url[0].'" target="_blank">'. wordwrap($url[0], 40, ' ', true).'</a>', $str);
+            }
+
+            return $str; 
+        }, $c);
+     
+        $c = implode("<br/>", array_filter($c));
+        
+        $c = array_map('trim', explode(';', $c));
+        
+        $c = implode("<br/>", array_filter($c));
+        
+        return $c;
+        
+    }
+    
+    function nexis_infoKey($info)
+    {
+        $key = $info->Type;
+        
+        if($info->Type == 'DOB'){
+            $key = 'Date of Birth';
+        }
+        
+        if($info->Type == 'Other'){
+            $key = 'Other Information';
+        }
+        
+        if($info->Type == 'PlaceOfBirth'){
+            $key = 'Place of Birth';
+        }
+        
+        return $key;
+        
+    }    
+    
+    function load_director()
+    {
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+        $x->autoJoinPersonAddr();
+                                     
+        $x->selectAddCountryStates();                                                                                          
+        $x->relation = 'DIRECTOR';
+        $x->modx_user_id = $this->modx_user_id;                
+
+        $this->data_director = $x->fetchAll();
+            
+        foreach($this->data_director as $director){  
+           //print_r($director);              
+           $this->setMapping($director);                                                                         
+        }        
+    }    
+    
+    function load_ind_shareholder()
+    {
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+        $x->autoJoinPersonAddr();
+              
+        $x->selectAddCountryStates();
+        $x->relation = 'SHAREHOLDER';
+        $x->modx_user_id = $this->modx_user_id;
+        $x->coba_company_id = 0;    
+            
+        $this->data_individual_shareholder = $x->fetchAll();
+        foreach($this->data_individual_shareholder as $shareholder){      
+           //print_r($shareholder);  
+           $this->setMapping($shareholder);                            
+        }        
+    }
+    
+    function load_com_shareholder()
+    {
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();        
+        $x->autoJoinComAddr();
+              
+        $x->selectAddCountryStates();
+        $x->relation = 'SHAREHOLDER';
+        $x->modx_user_id = $this->modx_user_id;
+        $x->coba_person_id = 0;
+        $x->parent_company_id = 0;
+                
+        $this->data_company_shareholder = $x->fetchAll();
+        //$this->com_shareholder_count=0;
+        foreach($this->data_company_shareholder as $shareholder){  
+           //$this->com_shareholder_count ++;
+           $this->setMapping($shareholder);                    
+               
+        }        
+           
+    }    
+    
+    function renderTblHeading($col_1, $col_2){
+         return "<table class='app-sum-body-indi-data-table'>
+                   <tr class='app-sum-body-indi-data-row'>
+                     <td class='col-md-6 app-sum-body-indi-data'>
+                       {$col_1}
+                       <span class='app-sum-body-corp-title'>                                    
+                         {$col_2}
+                       </span>
+                     </td>
+                     <td class='col-md-6 app-sum-body-indi-data'>
+                     </td>
+                   </tr>";                        
+    }
+        
+    function renderTblRowTab($tab,$row,$col_2){          
+        return "<tr class='app-sum-body-indi-data-row'>                
+                <td class='col-md-6 app-sum-body-indi-data'>
+                    {$tab}{$this->renderRowLabel($row)}                    
+                    </td>
+                <td class='col-md-6 app-sum-body-indi-data'>
+                   {$col_2}
+                    </td>
+               </tr>";                                         
+    }    
+    
+   function renderRowLabel($row){
+        if($this->ext_data->account_type=='corporate' && $row['column_name']=='in_correspondence_address' ) {
+            return 'Registered Address is correspondence Address';
+        }           
+        return htmlspecialchars($row['Label']);                                                                      
+    }        
+    
+    function renderOutputQuestion($row)
+    {
+        $checked = 'check';
+        $str ='';
+        //print_r($row);
+        switch ($row['type']) {
+        case 'checkbox':
+            if (!$row['data']){
+                $checked ='unchecked';
+            }
+            $str = "<span class='glyphicon glyph icon-{$checked} text-primary'></span>";
+            break;
+        case 'radio':
+            $str = ucfirst($row['data']);
+            break;            
+        default:
+            $str = $this->renderField($row);
+            break;
+        }
+               
+        return $str;
+    }    
+    
+    function renderSectionKey($key){   
+    
+        if($this->ext_data->account_type=='corporate' && strtolower($key)=='residential address' ) {
+            return 'Registered Address';
+        }        
+        return htmlspecialchars($key);                                        
+    }        
+    
+    function renderField($row) {
+        $str ='';
+        //$other_val='ot';
+        switch ($row['column_name']) {                    
+            case 'nationality':                                                 
+            case 'country':                   
+            case 'place_of_birth':
+            case 'domicile':     
+            //case 'companies_domicile':
+                if($row['data'] == 'ot'|| $row['data'] == '**' || $row['data'] == 'Others' ) {
+                    $str='<b>Others</b>';
+                } else {
+                    $str = $this->country_map[strtolower($row['data'])];                
+                }                                      
+                break;
+                
+            case 'in_nationality':
+            case 'nationality_second_ap':     
+            case 'in_country':
+            case 'in_correspondence_country':
+            case 'correspondence_country_second_ap':
+            case 'country_second_ap':   
+            case 'companies_domicile':  
+                if($row['data'] == 'ot'|| $row['data'] == '**' || $row['data'] == 'Others' ) {
+                    $str='<b>Others</b>';
+                } else {
+                    $str = htmlspecialchars($row['data']);                
+                }     
+                break;
+                              
+            case 'countries_of_tax_residence':
+            case 'countries_of_tax_residence_second':   
+                $pos = strpos($row['data'], 'Others');
+                if($pos !== false){
+                    $str='<b>' . htmlspecialchars($row['data']). '</b>';
+                } else {
+                    $str = htmlspecialchars($row['data']);
+                }                                                    
+                break;          
+                   
+            case 'other_country':
+            case 'in_other_country':  
+            case 'other_country_second_ap':
+            case 'in_other_corrcountry':
+            case 'other_corr_country_second_ap':  
+            case 'other_companies_domicile':
+            case 'other_domicile':
+            case 'in_other_nationality':
+            case 'other_nationality_second_ap':
+            case 'other_nationality':
+            case 'countries_of_tax_residence_second_other':
+            case 'countries_of_tax_residence_other':
+                $str = "<b>" . htmlspecialchars($row['data']). "</b>";                                     
+                break;
+                       
+            case 'state':
+                $str = $this->state_map[strtolower($row['data'])];                                                             
+                break;             
+            default:
+                $str = htmlspecialchars($row['data']);
+                break;
+        }        
+        return $str;
+    }    
+    
+    function setMapping($row)
+    {                     
+        if(isset($row->coba_person_id_place_of_birth) && 
+           isset($row->place_of_birth_name)) {
+                       
+            if (!in_array(strtolower($row->coba_person_id_place_of_birth), $this->country_map)) {                              
+                $this->country_map[strtolower($row->coba_person_id_place_of_birth)] = $row->place_of_birth_name;
+            }
+        }
+               
+        if(isset($row->coba_person_id_nationality) && 
+           isset($row->nationality_name)) {
+                       
+            if (!in_array(strtolower($row->coba_person_id_nationality), $this->country_map)) {                         
+                $this->country_map[strtolower($row->coba_person_id_nationality)] = $row->nationality_name;
+            }
+        }              
+               
+        if(isset($row->coba_address_id_country) && 
+           isset($row->country_name)) {
+                       
+            if (!in_array(strtolower($row->coba_address_id_country), $this->country_map)) {                            
+               $this->country_map[strtolower($row->coba_address_id_country)] = $row->country_name;
+            }
+        }                              
+               
+        if(isset($row->coba_company_id_domicile) && 
+           isset($row->domicile_name)) {
+                       
+            if (!in_array(strtolower($row->coba_company_id_domicile), $this->country_map)) {                           
+               $this->country_map[strtolower($row->coba_company_id_domicile)] = $row->domicile_name;
+            }
+        }              
+               
+        if(isset($row->coba_address_id_state) && 
+           isset($row->state_name)) {
+                       
+            if (!in_array(strtolower($row->coba_address_id_state), $this->state_map)) {                                
+               $this->state_map[strtolower($row->coba_address_id_state)] = $row->state_name;
+            }
+        }              
+               
+    }    
+    
+    function decodeEnum($value) {
+         $arr = explode(",", $value);
+         $result = "";                 
+         foreach($arr as $str){                                
+            $temp = PDO_DataObject::factory('core_enum');                                              
+            $temp->get('id',$str);                             
+            $result .= $temp->display_name . ", ";                                             
+         }  
+                       
+         return substr($result, 0, -2) ;  
+    }
+    
+    function load_inv_declaration($type){
+        $z = PDO_DataObject::factory('coba_investor_declarations');
+        $z->user_id = $this->ext_data->userdata_id;        
+        
+        $u = PDO_DataObject::factory('coba_declarations');
+        
+        if($type=='checklist'){
+            $u->whereAddUserFilter($this->ext_data);                
+        }              
+        $z->joinAdd($u, 'LEFT');                                               
+        $z->whereAdd("
+                     ({$u->tableName()}.dec_type = '{$type}') 
+                     AND
+                     ({$u->tableName()}.used_by = '{$this->used_by}')
+                     AND
+                     ({$u->tableName()}.is_active = 1)
+                     ");
+                     
+        if($type=='checklist'){
+            $z->selectAdd("(SELECT GROUP_CONCAT(id) FROM Images WHERE Images.onid = {$z->tableName()}.id) AS images_ids");        
+        }                     
+                                             
+        return $z->fetchAll();    
+    }
+    
+}
diff --git a/Pman/Coba/Reports/Summary.php b/Pman/Coba/Reports/Summary.php
new file mode 100644 (file)
index 0000000..467f901
--- /dev/null
@@ -0,0 +1,404 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Coba_Reports_Summary extends Pman
+{
+
+    var $masterTemplate = "application-summary-master.html";
+    var $tempalte = "individual.html";
+    var $client_css;
+
+    var $summary;
+    var $declarations;
+    var $documents;
+
+    var $modx_user_id;
+    var $dependentRow;
+    var $report_date;
+    var $user_name;
+    var $name_advisor1;
+    var $name_advisor2;
+    var $data_director;
+    var $data_individual_shareholder;
+    var $data_company_shareholder;
+
+    //schema buffer for matching the data with shareholder of shareholder
+    var $schema_data_individual;
+    var $schema_data_company;
+
+    var $check_completed_declaration;
+    var $check_completed_document;
+
+    function getAuth()
+    {
+        return true;
+    }
+
+    function get($userdata_id,$opts = Array())
+    {
+        // ------load data for template-------
+        //phpinfo();
+        require_once 'Pman/Coba/Schema.php';
+
+        //load ext_data
+        $this->ext_data = PDO_DataObject::factory('ext_data')
+                      ->load('userdata_id',$userdata_id)->toArray();
+
+        $account_type = $this->ext_data['account_type'];
+        $x = new Pman_Coba_Schema();
+        $this->summary = $x->modifySummary($this->ext_data);
+
+        $this->name_advisor1 = $this->ext_data['investment_advisor'];
+
+        //switch template && init name for diff account type
+        switch ($account_type) {
+            case 'individual':
+                $account_type_for_declaration = 'I';
+                $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                break;
+            case 'joint':
+                $account_type_for_declaration = 'J';
+                $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                $this->name_advisor2 = $this->ext_data['investment_advisor_second_ap'];
+                break;
+            case 'corporate':
+                $account_type_for_declaration = 'C';
+                $this->user_name = $this->ext_data['company_name'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                $this->modx_user_id = $userdata_id;
+                break;
+            default:
+                $account_type_for_declaration = 'I';
+                $this->user_name = $this->ext_data['in_firstname']." ".$this->ext_data['in_lastname'];
+                $this->template = "application-summary-{$this->ext_data['account_type']}.html";
+                break;
+        }
+
+        //load declaration
+        $y = PDO_DataObject::factory('coba_declarations');
+        $t = PDO_DataObject::factory('coba_investor_declarations');
+        $y->joinAdd($t);
+        $y->set
+              (
+                  [
+                      'dec_type' => 'declaration',
+                      'user_id' => $userdata_id,
+                      'used_by' => $account_type_for_declaration
+                  ]
+              );
+        $this->declarations = $y->fetchAll();
+        $this->check_completed_declaration = $this->checkCompleteness($this->declarations);
+
+        //load document
+        $z = PDO_DataObject::factory('coba_declarations');
+        $u = PDO_DataObject::factory('coba_investor_declarations');
+        $z->joinAdd($u);
+        $z->set
+              (
+                  [
+                      'dec_type' => 'checklist',
+                      'user_id' => $userdata_id,
+                      'used_by' => $account_type_for_declaration
+                  ]
+              );
+        $this->documents = $z->fetchAll();
+        $this->check_completed_document = $this->checkCompleteness($this->documents);
+
+        $this->report_date = date('F j, Y, h:i A');
+
+
+
+        $ff = HTML_FlexyFramework2::get();
+    }
+
+    //check the field dependency
+    function checkDependency($row)
+    {
+        if ($row['being_dependent'] == 'Y') {
+            //buffering the data for dependency checking
+            $this->dependentRow[$row['Section']][$row['Data Table']][$row['column_name']]
+                = $row['data']; //dependentRow[section][data table][column_name] = data
+
+            //checking for check_box hide or show property when the box if checked
+            if ($row['if_checked'] == 'show') {
+                if (!$row['data']) {
+                    return FALSE;
+                }
+            } else {
+                if($row['data']) {
+                    return FALSE;
+                }
+            }
+        }
+
+        //checking the data with the corresponding dependent row in the buffer
+        if (!empty($row['dependent_column_name'])) {
+            if ($row['dependent_val']
+                    == $this->dependentRow[$row['Section']][$row['dependent_table']][$row['dependent_column_name']]) {
+                return TRUE;
+            } else {
+                return FALSE;
+            }
+        } else {
+            return TRUE;
+        }
+    }
+
+    //------check specific section for corporate------
+    function is_director_section($sectionKey)
+    {
+        if ($sectionKey == "Directors") {
+            $x = PDO_DataObject::factory('coba_investor_relation');
+            $x->autoJoin();
+            $x->_join .= "
+              LEFT JOIN
+                  coba_address
+              ON
+                  coba_address.id = join_coba_person_id_id.coba_address_id
+            ";
+            $address = DB_DataObject::factory('coba_address');
+            $x->selectAs($address, 'coba_address_id_%s');
+
+            $x->set(array(
+                'relation' => 'DIRECTOR',
+                'modx_user_id' => $this->modx_user_id
+            ));
+
+            $this->data_director = $x->fetchAll();
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function is_individual_shareholder($sectionKey)
+    {
+        if ($sectionKey == 'KYC: Shareholders: Individual') {
+            $x = PDO_DataObject::factory('coba_investor_relation');
+            $x->autoJoin();
+            $x->_join .= "
+              LEFT JOIN
+                  coba_address
+              ON
+                  coba_address.id = join_coba_person_id_id.coba_address_id
+            ";
+            $address = DB_DataObject::factory('coba_address');
+            $x->selectAs($address, 'coba_address_id_%s');
+
+            $x->set(array(
+                'relation' => 'SHAREHOLDER',
+                'modx_user_id' => $this->modx_user_id,
+                'coba_company_id' => '0'
+            ));
+
+            $this->data_individual_shareholder = $x->fetchAll();
+
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function is_company_shareholder($sectionKey)
+    {
+        if ($sectionKey == 'KYC: Shareholders: Company') {
+            $x = PDO_DataObject::factory('coba_investor_relation');
+            $x->autoJoin();
+            $x->_join .= "
+              LEFT JOIN
+                  coba_address
+              ON
+                  coba_address.id = join_coba_company_id_id.coba_address_id
+            ";
+
+            $address = DB_DataObject::factory('coba_address');
+            $x->selectAs($address, 'coba_address_id_%s');
+            $x->set(array(
+                'relation' => 'SHAREHOLDER',
+                'modx_user_id' => $this->modx_user_id,
+                'coba_person_id' => '0',
+                'parent_company_id' => '0'
+            ));
+            $this->data_company_shareholder = $x->fetchAll();
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    //------saving buffer for specific section------
+    function save_buffer_for_individual_shareholder($row)
+    {
+        if (!isset($this->schema_data_individual)) {
+            $this->schema_data_individual = $row;
+        }
+    }
+
+    function save_buffer_for_company_shareholder($row)
+    {
+        if (!isset($this->schema_data_company)) {
+            $this->schema_data_company = $row;
+        }
+    }
+
+    function print_label_and_data($client_data,$row,$tab_num)
+    {
+        $field_name = $row['Data Table']."_id_".$row['column_name'];
+        //var_dump($client_data);
+        $row['data'] = $client_data->$field_name;
+        if ($this->checkDependency($row)) {
+            echo "
+                <tr class='app-sum-body-indi-data-row'>
+                    <td class='col-md-6 app-sum-body-indi-data'>
+                    {$this->tabbing($tab_num)}
+                    {$row['Label']}
+                    </td>
+                    <td class='col-md-6 app-sum-body-indi-data'>
+                 ";
+            $this->outputQuestionByType($row);
+            echo "</td></tr>";
+        }
+    }
+
+    //output question from each section && switch the output for different questions' type
+    function outputQuestionByType($row)
+    {
+        switch ($row['type']) {
+        case 'checkbox':
+            if ($row['data']){
+                echo "<span class='glyphicon glyphicon-check app-sum-icon'></span>";
+            } else {
+                echo "<span class='glyphicon glyphicon-unchecked app-sum-icon'></span>";
+            }
+            break;
+        default:
+            echo $row['data'];
+            break;
+        }
+    }
+
+    function print_shareholder_of_shareholder($company_shareholder,$tab_num)
+    {
+        $tab_num ++;
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+
+        $x->_join .= "
+          LEFT JOIN
+              coba_address
+          ON
+              coba_address.id = join_coba_person_id_id.coba_address_id
+        ";
+
+        $address = DB_DataObject::factory('coba_address');
+        $x->selectAs($address, 'coba_address_id_%s');
+
+
+        $x->set(array(
+            'relation' => 'SHAREHOLDER',
+            'parent_company_id' => $company_shareholder->coba_company_id,
+            'coba_company_id' => '0'
+        ));
+        $data_individual_shareholder = $x->fetchAll();
+
+        foreach ($data_individual_shareholder as $individual_shareholder_key
+                  => $individual_shareholder) {
+            echo "
+                <table class='app-sum-body-indi-data-table'>
+                    <tr class='app-sum-body-indi-data-row'>
+                        <td class='col-md-6 app-sum-body-indi-data'>
+                            {$this->tabbing($tab_num)}
+                            <span class='app-sum-body-corp-title'>
+                                Individual Shareholder
+                                {$this->modifyClientNumber($individual_shareholder_key)}
+                            </span>
+                        </td>
+                        <td class='col-md-6 app-sum-body-indi-data'>
+                        </td>
+                    </tr>
+            ";
+            foreach ($this->schema_data_individual as $individual_row) {
+                $this->print_label_and_data($individual_shareholder,$individual_row,$tab_num);
+            }
+            echo "</table>";
+        }
+
+        $x = PDO_DataObject::factory('coba_investor_relation');
+        $x->autoJoin();
+
+        $x->_join .= "
+          LEFT JOIN
+              coba_address
+          ON
+              coba_address.id = join_coba_company_id_id.coba_address_id
+        ";
+
+        $address = DB_DataObject::factory('coba_address');
+        $x->selectAs($address, 'coba_address_id_%s');
+
+        $x->set(array(
+            'relation' => 'SHAREHOLDER',
+            'parent_company_id' => $company_shareholder->coba_company_id,
+            'coba_person_id' => '0',
+        ));
+        $data_company_shareholder = $x->fetchAll();
+
+
+        if (count($data_company_shareholder)) {
+            foreach ($data_company_shareholder as $company_shareholder_key
+                      => $company_shareholder) {
+                echo "
+                    <table class='app-sum-body-indi-data-table'>
+                        <tr class='app-sum-body-indi-data-row'>
+                            <td class='col-md-6 app-sum-body-indi-data'>
+                                {$this->tabbing($tab_num)}
+                                <span class='app-sum-body-corp-title'>
+                                    Company Shareholder
+                                    {$this->modifyClientNumber($company_shareholder_key)}
+                                </span>
+                            </td>
+                            <td class='col-md-6 app-sum-body-indi-data'>
+                            </td>
+                        </tr>
+                ";
+                foreach ($this->schema_data_company as $company_row) {
+                    $this->print_label_and_data($company_shareholder,$company_row,$tab_num);
+                }
+                echo "</table>";
+                $this->print_shareholder_of_shareholder($company_shareholder,$tab_num);
+            }
+        }
+    }
+
+    function tabbing($tab_num)
+    {
+        $n = 0;
+        $tabbing_class_string = "";
+        while ($n < $tab_num) {
+            $tabbing_class_string.="<span class='app-sum-body-tabbing'></span>";
+            $n++;
+        };
+        return $tabbing_class_string;
+    }
+
+    function modifyClientNumber($n)
+    {
+        return $n+1;
+    }
+
+    function checkCompleteness($doc)
+    {
+        foreach ($doc as $item) {
+           if ($item->is_agreed) {
+              continue;
+           }
+           else {
+              return false;
+           }
+        }
+        return true;
+    }
+}
diff --git a/Pman/Coba/Schema.php b/Pman/Coba/Schema.php
new file mode 100644 (file)
index 0000000..f55d691
--- /dev/null
@@ -0,0 +1,1067 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Coba_Schema extends Pman 
+{
+    var $form_doc_data;
+    
+    var $config = array();
+    
+    var $related = array();
+    
+    var $binary_mapping = array(
+        'Contact' => 1,
+        'KYC' => 2,
+        'Declarations' => 4
+    );
+    
+    var $table = '';
+    
+    var $ignore = array(
+        'Individual' => array(
+            'in_prohibited_activities',
+            'in_capital_summary',
+            'social_security_number',
+            'in_other_corrcountry',
+            'in_correspondence_country',
+            'in_correspondence_postalcode',
+            'countries_of_tax_residence_other'
+        ),
+        'Joint' => array(
+            'in_prohibited_activities',
+            'prohibited_activities_second_ap',
+            'in_capital_summary',
+            'capital_summary_second_ap',
+            'social_security_number',
+            'social_security_number_second_ap',
+            'in_other_corrcountry',
+            'in_correspondence_country',
+            'in_correspondence_postalcode',
+            'correspondence_postalcode_second_ap',
+            'countries_of_tax_residence_other',
+            'countries_of_tax_residence_second_other'
+        ),
+        'Corporate' => array(
+            'in_uscitizen',
+            'in_usa_tin_number',
+            'countries_of_tax_residence',
+            'in_prohibited_activities',
+            
+            'in_addressline1',
+            'in_addressline2',
+            'in_district',
+            'in_country',
+            'in_other_country',
+            'in_postalcode',
+            'in_correspondence_addressline1',
+            'in_correspondence_addressline2',
+            'in_correspondence_district',
+            'in_correspondence_country',
+            'in_other_corrcountry',
+            'in_correspondence_postalcode',
+            'countries_of_tax_residence_other'
+            
+        ),
+        'coba_person' => array(
+            'other_country',
+            'other_nationality'
+        ),
+        'coba_company' => array(
+            'is_listed_company',
+            'not_domociled_usa',
+            'giin_number'
+        ),
+        'coba_address' => array(
+            'state'
+        )
+    );
+    
+    function loadFormsDoc($user) 
+    {
+        // $user == a PDO dataojbect of modx_users
+        // Call $user->ext_data() to return the related ext_data dataobject..
+        // load the forsm_docs_checklist.csv
+        // only store data in form_doc_data related to users fund / investor_type.
+    }
+
+    function formSection($user, $section) 
+    {
+        if (empty($this->form_doc_data)) {
+            $this->loadFormsDoc($user);
+        }
+        return $this->form_doc_data[$section];
+    }
+
+    //check the completeness of the accreditation by selectAdd
+    function modifySelectAdd($do) 
+    {
+        $this->table = $do->tableName();
+        
+        $rowsCSV = $this->readCSV('all'); //read all mandatory CSV rows
+
+        $this->buildConfig();
+        
+        $query = $this->buildQuery();
+        
+        $do->selectAdd($query);
+        
+    }
+
+    //modify the summary according to different account type
+    function modifySummary($data) 
+    {
+        $rowsCSV = $this->readCSV($data['account_type']); //read mandatory CSV row by account type
+        $summary = array();
+        $req_field = array('Label', 'type', 'Data Table', 'column_name', 'dependent_column_name', 'dependent_val', 'dependent_table', 'being_dependent', 'if_checked');
+        foreach ($rowsCSV as $rowNum => $rowCSV) {
+            foreach ($req_field as $field) {
+                $summary[$rowCSV['Step']][$rowCSV['Section']][$rowCSV['Applicant']][$rowNum][$field] = isset($rowCSV[$field]) ? $rowCSV[$field] : null;
+            }
+            //assign data from ext_data to the schema var
+            $summary[$rowCSV['Step']][$rowCSV['Section']][$rowCSV['Applicant']][$rowNum]['data'] = isset($data[$rowCSV['column_name']]) ? $data[$rowCSV['column_name']] : null;
+        }
+        return $summary;
+        //$summary[step][section][Applicant][question number][Label/data/type...] <---5D array
+    }
+
+    //open CSV file & get mandatory rows for different account types - $t
+    //$t can be 'all', 'individual', 'joint', 'company'
+    function readCSV($t) 
+    {
+        $ff = HTML_FlexyFramework2::get();
+        
+        $file = __DIR__ . "/../../Coba/Clients/{$ff->Coba['client_dir']}/accreditationSchema.csv";
+        
+        if(!file_exists($file)){
+            die("{$file} not exist?!\n");
+        }
+        
+        $fp = fopen($file, "r");
+        
+        $header = null;
+        //TODO change to switch
+        if ($t == "all") {
+            while ($row = fgetcsv($fp)) {
+                if ($header === null) {
+                    $header = $row;
+                    continue;
+                }
+                $rowsCSV[] = array_combine($header, $row);
+            }
+        } else {
+            $t = ucfirst($t);
+            while ($row = fgetcsv($fp)) {
+                if ($header === null) {
+                    $header = $row;
+                    continue;
+                } else {
+                    $tempRow = array_combine($header, $row);
+                    if (!empty($tempRow[$t])) {
+                        $rowsCSV[] = array_combine($header, $row);
+                    }
+                }
+            }
+        }
+        
+        fclose($fp);
+        return $rowsCSV;
+    }
+    
+    function buildConfig()
+    {
+        $data = $this->readCSV('all');
+        
+        $this->config = array();
+        
+        $types = array(
+            'Individual',
+            'Corporate',
+            'Joint'
+        );
+        
+        foreach ($data as $d){
+            
+            foreach ($types as $t){
+                
+                if(!isset($this->config[$t])){
+                    $this->config[$t] = array();
+                }
+                
+                if(
+                        empty($d[$t]) || 
+                        $d[$t] != 'M' ||
+                        empty($d['Data Table'])
+                ){
+                    continue;
+                }
+                
+                if(!isset($this->config[$t][$d['Step']])){
+                    $this->config[$t][$d['Step']] = array();
+                }
+                
+                $cfg = array(
+                    'table' => $d['Data Table'],
+                    'column' => $d['column_name'],
+                    'type' => strtolower($d['Data Type']),
+                    'represent' => strtolower($d['type']),
+                    'dependent' => array()
+                );
+                
+                if(!empty($d['dependent_column_name'])){
+                    $cfg['dependent'] = array(
+                        'table' => $d['dependent_table'],
+                        'column' => $d['dependent_column_name'],
+                        'value' => $d['dependent_val']
+                    );
+                }
+                
+                if($d['Data Table'] != $this->table){
+                    
+                    if(!isset($this->related[$d['Data Table']])){
+                        $this->related[$d['Data Table']] = array();
+                    }
+                    
+                    if(isset($this->related[$d['Data Table']][$d['column_name']])){
+                        continue;
+                    }
+                    
+                    $this->related[$d['Data Table']][$d['column_name']] = $cfg;
+                    continue;
+                    
+                }
+                
+                $this->config[$t][$d['Step']][] = $cfg;
+                
+            }
+            
+        }
+        
+        return;
+        
+    }
+    
+    function buildQuery()
+    {
+        $query = array();
+        $query[] = "CASE";
+        
+        foreach (array_keys($this->config) as $type){
+            
+            $account_type = strtolower($type);
+            
+            $query[] = "WHEN {$this->table}.account_type = '{$account_type}' THEN";
+            
+            $data = $this->buildQueryData($type);
+            $data['Declarations'] = $this->buildDeclarationQuery();
+            
+            $subquery = array();
+            
+            foreach ($data as $k => $v){
+                foreach ($v as $vv){
+                    $subquery[] = "(CASE WHEN {$vv} THEN {$this->binary_mapping[$k]} ELSE 0 END)"; 
+                }
+            }
+            
+            $query[] = "CASE (" . implode(" | ", $subquery) . ")";
+            
+            $query[] = "
+                WHEN 1 THEN 
+                    'Contact' 
+                WHEN 2 THEN 
+                    'KYC' 
+                WHEN 3 THEN 
+                    'Contact,KYC' 
+                WHEN 4 THEN 
+                    'Declarations' 
+                WHEN 5 THEN 
+                    'Contact,Declarations' 
+                WHEN 6 THEN 
+                    'KYC,Declarations' 
+                WHEN 7 THEN 
+                    'Contact,KYC,Declarations' 
+                ELSE 
+                    '' 
+                END
+            ";
+        }
+        
+        $query[] = "END AS check_complete";
+        
+        return implode(' ', $query);
+        
+    }
+    
+    function buildQueryData($type)
+    {
+        if(empty($this->config) || empty($this->config[$type])){
+            return;
+        }
+        
+        $query = array();
+        
+        foreach ($this->config[$type] as $step => $fields){
+            
+            if(!isset($query[$step])){
+                $query[$step] = array();
+            }
+            
+            $extraMethod = "build{$type}{$step}Extra";
+            
+            if(method_exists($this, $extraMethod)){
+                
+                $query[$step] = array_merge($query[$step], $this->{$extraMethod}());
+            }
+            
+            foreach ($fields as $k => $v){
+                
+                if(in_array($v['column'], $this->ignore[$type])){
+                    continue;
+                }
+                
+                if($v['table'] != $this->table){
+                    continue;
+                }
+                
+                $equation = $this->data_type_equation($v['type']);
+                
+                if(!empty($v['represent']) && $v['represent'] == 'checkbox'){
+                    $equation = array("IS NULL", "= ''");
+                }
+                
+                $q = array();
+                
+                foreach ($equation as $e){
+                    $q[] = "{$v['table']}.{$v['column']} {$e}";
+                }
+                
+                if(empty($v['dependent'])){
+                    $query[$step][] = '(' . implode(' OR ', $q) . ')';
+                    continue;
+                }
+                
+                $q = array(
+                    '(' . implode(' OR ', $q) . ')'
+                );
+                
+                $q[] = "{$v['dependent']['table']}.{$v['dependent']['column']} = '{$v['dependent']['value']}'";
+                
+                $query[$step][] = '(' . implode(' AND ', $q) . ')';
+                
+            }
+            
+        }
+        
+        return $query;
+        
+    }
+    
+    function buildIndividualContactExtra()
+    {
+        $extra = array();
+        
+        $tn = $this->table;
+        
+        $extra[] = "
+            (
+                    {$tn}.not_have_passport = 1 
+                AND 
+                    {$tn}.not_have_id_card = 1
+            )
+        ";
+        $extra[] = "
+            (
+                    {$tn}.in_nationality = 'Others' 
+                AND 
+                    {$tn}.in_other_nationality = ''
+            )
+        ";
+        $extra[] = "
+            (
+                    {$tn}.in_correspondence_address = 'no' 
+                AND 
+                    {$tn}.in_correspondence_country = 'Others' 
+                AND 
+                    {$tn}.in_other_corrcountry = ''
+            )
+        ";
+        $extra[] = "
+            (
+                    {$tn}.in_correspondence_address = 'no' 
+                AND 
+                    {$tn}.post_code_na_corr = '0' 
+                AND 
+                    {$tn}.in_correspondence_postalcode = ''
+            )";
+        
+        return $extra;
+    }
+    
+    function buildIndividualKYCExtra()
+    {
+        $extra = array();
+        
+        $tn = $this->table;
+        
+        $extra[] = "
+            (
+                    (
+                            {$tn}.in_uscitizen = 'yes' 
+                        OR 
+                            {$tn}.in_have_us_tax_id = 'yes'
+                    ) 
+                AND 
+                    {$tn}.social_security_number = ''
+            )
+            OR
+            (
+                    {$tn}.in_uscitizen = 'no' 
+                AND 
+                    {$tn}.countries_of_tax_residence != ''
+                AND
+                    INSTR({$tn}.countries_of_tax_residence, 'Others') != 0
+                AND
+                    {$tn}.countries_of_tax_residence_other = ''
+            )
+        ";
+        $extra[] = "({$tn}.in_prohibited_activities != 1)";
+        $extra[] = "
+            (
+                INSTR(
+                    {$tn}.anti_money_laundering,
+                    (SELECT core_enum.id FROM core_enum WHERE core_enum.etype = 'Coba-Laundering' AND name = 'OTHER' )
+                ) != 0
+                AND 
+                {$tn}.in_capital_summary = ''
+            )
+        ";
+        
+        return $extra;
+    }
+    
+    function buildJointContactExtra()
+    {
+        $extra = array();
+        
+        $tn = $this->table;
+        
+        $extra[] = "
+                (
+                        {$tn}.not_have_passport = 1 
+                    AND 
+                        {$tn}.not_have_id_card = 1
+                )
+            OR
+                (
+                        {$tn}.in_nationality = 'Others' 
+                    AND 
+                        {$tn}.in_other_nationality = ''
+                )
+            OR
+                (
+                        {$tn}.in_correspondence_address = 'no' 
+                    AND 
+                        (
+                            (
+                                    {$tn}.in_correspondence_country = 'Others' 
+                                AND 
+                                    {$tn}.in_other_corrcountry = ''
+                            )
+                        OR
+                            (
+                                    {$tn}.post_code_na_corr = '0' 
+                                AND 
+                                    {$tn}.in_correspondence_postalcode = ''
+                            )
+                        )
+                )
+            OR
+                (
+                        {$tn}.not_have_passport_ap2 = 1 
+                    AND 
+                        {$tn}.not_have_id_card_ap2 = 1
+                )
+            OR
+                (
+                        {$tn}.nationality_second_ap = 'Others' 
+                    AND 
+                        {$tn}.other_nationality_second_ap = ''
+                )
+            OR
+                (
+                        {$tn}.is_same_as_ap1 = 'no' 
+                    AND 
+                        {$tn}.country_second_ap = 'Others' 
+                    AND 
+                        {$tn}.other_country_second_ap = ''
+                )
+            OR
+                (
+                        {$tn}.correspondence_address_second_ap = 'no' 
+                    AND 
+                        (
+                                (
+                                        {$tn}.correspondence_country_second_ap = 'Others' 
+                                    AND 
+                                        {$tn}.other_corr_country_second_ap = ''
+                                )
+                            OR
+                                (
+                                        {$tn}.post_code_na_corr_ap2 = '0' 
+                                    AND 
+                                        {$tn}.correspondence_postalcode_second_ap = ''
+                                )
+                        )
+                )
+                
+        ";
+             
+        return $extra;
+    }
+    
+    function buildJointKYCExtra()
+    {
+        $extra = array();
+        
+        $tn = $this->table;
+        
+        $extra[] = "
+                (
+                        (
+                                {$tn}.in_uscitizen = 'yes' 
+                            OR 
+                                {$tn}.in_have_us_tax_id = 'yes'
+                        ) 
+                    AND 
+                        {$tn}.social_security_number = ''
+                )
+            OR
+                (
+                        (
+                                {$tn}.uscitizen_second_ap = 'yes' 
+                            OR 
+                                {$tn}.in_have_us_tax_id_second = 'yes'
+                        ) 
+                    AND 
+                        {$tn}.social_security_number_second_ap = ''
+                )
+            OR
+                (
+                        {$tn}.in_uscitizen = 'no' 
+                    AND 
+                        {$tn}.countries_of_tax_residence != ''
+                    AND
+                        INSTR({$tn}.countries_of_tax_residence, 'Others') != 0
+                    AND
+                        {$tn}.countries_of_tax_residence_other = ''
+                )
+            OR
+                (
+                        {$tn}.uscitizen_second_ap = 'no' 
+                    AND 
+                        {$tn}.countries_of_tax_residence_second != ''
+                    AND
+                        INSTR({$tn}.countries_of_tax_residence_second, 'Others') != 0
+                    AND
+                        {$tn}.countries_of_tax_residence_second_other = ''
+                )
+            OR
+                (
+                        {$tn}.in_prohibited_activities != 1
+                )
+            OR
+                (
+                        {$tn}.prohibited_activities_second_ap != 1
+                )
+        ";
+                    
+        $extra[] = "
+            (
+                INSTR(
+                    {$tn}.anti_money_laundering,
+                    (SELECT core_enum.id FROM core_enum WHERE core_enum.etype = 'Coba-Laundering' AND name = 'OTHER' )
+                ) != 0
+                AND 
+                {$tn}.in_capital_summary = ''
+            )
+        ";
+        $extra[] = "
+            (
+                INSTR(
+                    {$tn}.anti_money_laundering_second_ap,
+                    (SELECT core_enum.id FROM core_enum WHERE core_enum.etype = 'Coba-Laundering' AND name = 'OTHER' )
+                ) != 0
+                AND 
+                {$tn}.capital_summary_second_ap = ''
+            )
+        ";
+        
+        return $extra;
+    }
+    
+    function buildCorporateContactExtra()
+    {
+        $extra = array();
+        
+        $tn = $this->table;
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no' 
+                AND 
+                    (
+                            {$tn}.in_addressline1 = '' 
+                        OR
+                            {$tn}.in_addressline2 = ''
+                        OR
+                            {$tn}.in_district = ''
+                        OR
+                            {$tn}.in_country = ''
+                        OR
+                            (
+                                    {$tn}.in_correspondence_address = 'no' 
+                                AND 
+                                    (
+                                            {$tn}.in_correspondence_addressline1 = ''
+                                        OR
+                                            {$tn}.in_correspondence_addressline2 = ''
+                                        OR
+                                            {$tn}.in_correspondence_district = ''
+                                        OR
+                                            {$tn}.in_correspondence_country = ''
+                                        OR
+                                            (
+                                                    {$tn}.in_correspondence_country = 'Others' 
+                                                AND 
+                                                    {$tn}.in_other_corrcountry = ''
+                                            )
+                                        OR
+                                            (
+                                                    {$tn}.post_code_na_corr = '0' 
+                                                AND 
+                                                    {$tn}.in_correspondence_postalcode = ''
+                                            )
+                                    )
+                            )
+                        OR
+                            (
+                                    {$tn}.companies_domicile = 'Others' 
+                                AND 
+                                    {$tn}.in_other_nationality = ''
+                            )
+                        OR
+                            (
+                                    {$tn}.in_country = 'Others' 
+                                AND 
+                                    {$tn}.in_other_country = ''
+                            )
+                        OR
+                            (
+                                    {$tn}.post_code_na = '0' 
+                                AND 
+                                    {$tn}.in_postalcode = ''
+                            )
+                    )
+            )
+        ";
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no'
+                AND
+                    (
+                        SELECT 
+                                COUNT(coba_investor_relation.id)
+                        FROM
+                                coba_investor_relation
+                        WHERE
+                                coba_investor_relation.modx_user_id = ext_data.userdata_id
+                            AND
+                                coba_investor_relation.relation = 'DIRECTOR'
+                    ) < 1
+            )
+        ";
+        
+        $related = $this->buildRelatedQuery();
+        
+        $where = array_merge($related['coba_person'], $related['coba_address']);
+        
+        $where = '(' . implode(" \nOR\n ", $where) . ')';
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no'
+                AND
+                    (
+                        SELECT 
+                                COUNT(coba_person.id)
+                        FROM
+                                coba_person
+                        LEFT JOIN
+                                coba_address
+                        ON
+                                coba_address.id = coba_person.coba_address_id
+                        WHERE
+                                $where
+                            AND
+                                coba_person.id IN (
+                                    SELECT 
+                                            coba_investor_relation.coba_person_id
+                                    FROM
+                                            coba_investor_relation
+                                    WHERE
+                                            coba_investor_relation.modx_user_id = ext_data.userdata_id
+                                        AND
+                                            coba_investor_relation.relation = 'DIRECTOR'
+
+                                )
+                    ) > 0
+            )
+        ";
+        
+        return $extra;
+    }
+    
+    function buildCorporateKYCExtra()
+    {
+        $extra = array();
+        
+        $tn = $this->table;
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no' 
+                AND 
+                    (
+                            {$tn}.in_uscitizen = ''
+                        OR
+                            (
+                                    {$tn}.in_uscitizen = 'yes' 
+                                AND 
+                                    {$tn}.in_usa_tin_number = ''
+                            )
+                        OR
+                            (
+                                    {$tn}.in_uscitizen = 'no' 
+                                AND 
+                                    {$tn}.countries_of_tax_residence = ''
+                            )
+                        OR
+                            (
+                                    {$tn}.in_uscitizen = 'no' 
+                                AND 
+                                    {$tn}.countries_of_tax_residence != ''
+                                AND
+                                    INSTR({$tn}.countries_of_tax_residence, 'Others') != 0
+                                AND
+                                    {$tn}.countries_of_tax_residence_other = ''
+                            )
+                    )
+            )
+        ";
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'yes' 
+                AND 
+                    (
+                            {$tn}.countries_of_tax_residence = ''
+                        OR
+                            (
+                                    {$tn}.in_uscitizen = 'no' 
+                                AND 
+                                    {$tn}.countries_of_tax_residence != ''
+                                AND
+                                    INSTR({$tn}.countries_of_tax_residence, 'Others') != 0
+                                AND
+                                    {$tn}.countries_of_tax_residence_other = ''
+                            )
+                    )
+            )
+        ";
+        $extra[] = "({$tn}.in_prohibited_activities != 1)";
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no'
+                AND
+                    (
+                        SELECT 
+                                COUNT(coba_investor_relation.id)
+                        FROM
+                                coba_investor_relation
+                        WHERE
+                                coba_investor_relation.modx_user_id = ext_data.userdata_id
+                            AND
+                                coba_investor_relation.relation = 'SHAREHOLDER'
+                    ) < 1
+            )
+        ";
+        
+        $related = $this->buildRelatedQuery();
+        
+        $where = array_merge($related['coba_person'], $related['coba_address']);
+        
+        $where = '(' . implode(" \nOR\n ", $where) . ')';
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no'
+                AND
+                    (
+                        SELECT 
+                                COUNT(coba_person.id)
+                        FROM
+                                coba_person
+                        LEFT JOIN
+                                coba_address
+                        ON
+                                coba_address.id = coba_person.coba_address_id
+                        WHERE
+                                $where
+                            AND
+                                coba_person.id IN (
+                                    SELECT 
+                                            coba_investor_relation.coba_person_id
+                                    FROM
+                                            coba_investor_relation
+                                    WHERE
+                                            coba_investor_relation.modx_user_id = ext_data.userdata_id
+                                        AND
+                                            coba_investor_relation.relation = 'SHAREHOLDER'
+
+                                )
+                    ) > 0
+            )
+        ";
+        
+        $coba_company = '(' . implode(" \nOR\n ", $related['coba_company']) . ')';
+        $coba_address = '(' . implode(" \nOR\n ", $related['coba_address']) . ')';
+        
+        $extra[] = "
+            (
+                    {$tn}.is_listed_company = 'no'
+                AND
+                    (
+                        SELECT 
+                                COUNT(coba_company.id)
+                        FROM
+                                coba_company
+                        LEFT JOIN
+                                coba_address
+                        ON
+                                coba_address.id = coba_company.coba_address_id
+                        WHERE
+                            (
+                                    $coba_company
+                                OR
+                                    CASE WHEN coba_company.is_listed_company = '0' THEN
+                                        $coba_address
+                                    ELSE
+                                        FALSE
+                                    END
+                            )   
+                            AND
+                                coba_company.id IN (
+                                    SELECT 
+                                            coba_investor_relation.coba_company_id
+                                    FROM
+                                            coba_investor_relation
+                                    WHERE
+                                            coba_investor_relation.modx_user_id = ext_data.userdata_id
+                                        AND
+                                            coba_investor_relation.relation = 'SHAREHOLDER'
+
+                                )
+                    ) > 0
+            )
+        ";
+        
+        return $extra;
+    }
+    
+    function buildRelatedQuery()
+    {
+        $query = array();
+        
+        foreach ($this->related as $k => $v){
+            
+            if(!isset($query[$k])){
+                $query[$k] = array();
+            }
+            
+            foreach ($v as $vv){
+                
+                if(!empty($this->ignore[$k]) && in_array($vv['column'], $this->ignore[$k])){
+                    continue;
+                }
+                
+                $equation = $this->data_type_equation($vv['type']);
+                
+                if(!empty($vv['represent']) && $vv['represent'] == 'checkbox'){
+                    $equation = array("IS NULL", "= ''");
+                }
+                
+                $q = array();
+                
+                foreach ($equation as $e){
+                    $q[] = "{$vv['table']}.{$vv['column']} {$e}";
+                }
+                
+                if(empty($vv['dependent'])){
+                    $query[$k][] = '(' . implode(' OR ', $q) . ')';
+                    continue;
+                }
+                
+                $q = array(
+                    '(' . implode(' OR ', $q) . ')'
+                );
+                
+                $q[] = "{$vv['dependent']['table']}.{$vv['dependent']['column']} = '{$vv['dependent']['value']}'";
+                
+                $query[$k][] = '(' . implode(' AND ', $q) . ')';
+            }
+            
+            if($k == 'coba_person'){
+                $query[$k][] = "
+                    (
+                            coba_person.not_have_passport = 1 
+                        AND 
+                            coba_person.not_have_id_card = 1
+                    )
+                ";
+                $query[$k][] = "
+                    (
+                            coba_person.nationality = 'ot' 
+                        AND 
+                            coba_person.other_nationality = ''
+                    )
+                ";
+                $query[$k][] = "(coba_person.coba_address_id = '0')";
+            }
+            
+            if($k == 'coba_company'){
+                $query[$k][] = "(coba_company.is_listed_company = '-1')";
+                $query[$k][] = "
+                    (
+                            coba_company.is_listed_company = '0' 
+                        AND 
+                            (
+                                    coba_company.not_domociled_usa IS NULL 
+                                OR 
+                                    coba_company.not_domociled_usa = ''
+                                OR
+                                    (
+                                            coba_company.not_domociled_usa = '0'
+                                        AND
+                                            coba_company.giin_number = ''
+                                    )
+                                OR
+                                    coba_company.coba_address_id = '0'
+                            )
+                    )
+                ";
+            }
+            
+            if($k == 'coba_address'){
+                $query[$k][] = "
+                    (
+                            coba_address.country != 'ot' 
+                        AND 
+                            coba_address.state = '0'
+                    )
+                ";
+                $query[$k][] = "
+                    (
+                            coba_address.country = 'ot' 
+                        AND 
+                            (
+                                    coba_address.other_country = '' 
+                                OR 
+                                    coba_address.other_state = ''
+                            )
+                    )
+                ";
+            }
+            
+        }
+        
+        return $query;
+        
+    }
+    
+    function buildDeclarationQuery()
+    {
+        $query = array();
+        
+        $query[] = "
+            (
+                SELECT
+                        COUNT(coba_investor_declarations.id)
+                FROM
+                        coba_investor_declarations
+                WHERE
+                        coba_investor_declarations.user_id = ext_data.userdata_id
+                    AND
+                        coba_investor_declarations.is_agreed = 0
+                    AND
+                        coba_investor_declarations.dec_id IN (
+                            SELECT
+                                    id
+                            FROM
+                                    coba_declarations
+                            WHERE
+                                    coba_declarations.dec_type = 'declaration'
+                                AND
+                                    coba_declarations.is_active = 1
+                                AND
+                                    (
+                                        CASE WHEN ext_data.account_type = 'individual' THEN
+                                            coba_declarations.used_by = 'I'
+                                        WHEN ext_data.account_type = 'joint' THEN
+                                            coba_declarations.used_by = 'J'
+                                        WHEN ext_data.account_type = 'corporate' AND ext_data.is_listed_company != 'yes' THEN
+                                            coba_declarations.used_by = 'C'
+                                        WHEN ext_data.account_type = 'corporate' AND ext_data.is_listed_company = 'yes' THEN
+                                            coba_declarations.used_by = 'CL'
+                                        END
+                                    )
+                        )
+            ) > 0
+            
+        ";
+        
+        return $query;
+        
+    }
+    
+    function data_type_equation($type)
+    {
+        $type = strtolower(preg_replace('/\(.*\)/', '', $type));
+        
+        $equation = array();
+        
+        switch ($type) {
+            case 'varchar' :
+            case 'enum' :
+            case 'mediumtext' :
+            case 'text' :
+                $equation[] = "= ''";
+                break;
+            case 'date' :
+                $equation[] = "= ''";
+                $equation[] = "= '0000-00-00'";
+                break;
+            case 'int' :
+            case 'tinyint' :
+                $equation[] = "= 0";
+                break;
+            default :
+                $equation[] = 'IS NULL';
+                break;
+                
+        }
+        
+        return $equation;
+    }
+
+}
diff --git a/Pman/Coba/UpdateDatabase.php b/Pman/Coba/UpdateDatabase.php
new file mode 100644 (file)
index 0000000..ee2d51e
--- /dev/null
@@ -0,0 +1,1224 @@
+<?php
+
+require_once 'Pman/Core/UpdateDatabase.php';
+
+class Pman_Coba_UpdateDatabase extends Pman_Core_UpdateDatabase
+{
+
+    static $cli_desc = "Update SQL - Beta";
+
+    static $cli_opts = array(
+
+    );
+
+    var $cli = false;
+
+    var $opts;
+
+    var $country_mapping = array();
+
+    var $client_path = '';
+
+    var $imageURI = '';
+
+    function getAuth()
+    {
+        $ff = HTML_FlexyFramework::get();
+        if (!empty($ff->cli)) {
+            $this->cli = true;
+            return true;
+        }
+
+        parent::getAuth(); // load company!
+        $au = $this->getAuthUser();
+        if (!$au || $au->company()->comptype != 'OWNER') {
+            $this->jerr("Not authenticated", array('authFailure' => true));
+        }
+        $this->authUser = $au;
+        return true;
+    }
+
+    function get($tbl,   $opts = Array())
+    {
+        $this->updateData();
+    }
+
+    function updateData()
+    {
+        $ff = HTML_FlexyFramework2::get();
+
+        if(!isset($ff->Pman) || !isset($ff->Pman['local_base_url'])){
+            die("Please setup local_base_url");
+        }
+
+        $this->local_base_url = $ff->Pman['local_base_url'];
+
+        if(!empty($ff->Coba['client_dir'])){
+            $this->client_path = __DIR__ . "/../../Coba/Clients/{$ff->Coba['client_dir']}";
+        }
+        // reqired / prefered binaries..
+        $this->checkSystem(array('pdftk'), array());
+
+        $this->imageURI = "http://localhost{$this->local_base_url}/Roo/Images";
+
+        $this->updateImagesNoOfPage();
+        
+        $this->initFund();
+
+        $this->initCountry();
+
+        $this->initState();
+
+        $this->initCoreCompany();
+
+        $this->initEnums();
+        
+        $this->initGroups();
+
+        $this->initDeclarations();
+
+        $this->initUserDeclarations();
+
+        $this->initAdviserStaff();
+
+        $this->validateUserProfile();
+
+        $this->i18nSetPrefer();
+        
+    }
+
+    function initFund()
+    {
+        $ff = HTML_FlexyFramework2::get();
+
+        if(empty($ff->Coba['default_fund'])){
+            die('Please setup default fund');
+        }
+
+        $fund = $ff->Coba['default_fund'];
+
+        $modx_accountmgmts = DB_DataObject::factory('modx_accountmgmts');
+
+        if($modx_accountmgmts->get('isin_code', $fund)){
+            return;
+        }
+
+        $modx_accountmgmts->setFrom(array(
+            'isin_code' => $fund,
+            'name' => $fund
+        ));
+
+        $modx_accountmgmts->insert();
+    }
+
+    function initCountry()
+    {
+        $modx_country = DB_DataObject::factory('modx_country');
+
+        foreach ($modx_country->fetchAll() as $mc){
+
+            $coba_country = DB_DataObject::factory('coba_country');
+            $coba_country->setFrom(array(
+                'abbrv' => $mc->country_abbrv
+            ));
+
+            if($coba_country->find(true)){
+                $this->country_mapping[$mc->id] = $coba_country->id;
+                continue;
+            }
+
+            $coba_country->setFrom(array(
+                'name' => $mc->country
+            ));
+
+            $coba_country->insert();
+
+            $this->country_mapping[$mc->id] = $coba_country->id;
+
+        }
+
+    }
+
+    function initState()
+    {
+        $modx_state = DB_DataObject::factory('modx_state');
+
+        foreach ($modx_state->fetchAll() as $ms){
+
+            if(empty($this->country_mapping[$ms->country_id])){
+                continue;
+            }
+
+            $coba_state = DB_DataObject::factory('coba_state');
+            $coba_state->setFrom(array(
+                'name' => $ms->state,
+                'country_id' => $this->country_mapping[$ms->country_id]
+            ));
+
+            if($coba_state->find(true)){
+                continue;
+            }
+
+            $coba_state->insert();
+
+        }
+
+    }
+
+    function initCoreCompany()
+    {
+        if(empty($this->client_path)){
+            return;
+        }
+
+        $file = "{$this->client_path}/configuration.json";
+
+        if(!file_exists($file)){
+            $this->jerr("Missing configuration file");
+        }
+
+        $cfg = json_decode(file_get_contents($file), true);
+
+        /*
+         * Make sure the necessary files have been set...
+         */
+
+        if(
+                empty($cfg['code']) ||
+                empty($cfg['name']) ||
+                empty($cfg['country'])
+        ) {
+            $this->jerr("Invalid configuration file");
+        }
+
+        $owner = DB_DataObject::factory('core_enum');
+
+        $owner->setFrom(array(
+            'etype' => 'COMPTYPE',
+            'name' => 'OWNER',
+            'active' => 1
+        ));
+
+        if(!$owner->find(true)){
+            $this->jerr("Missing COMPTYPE configuration");
+        }
+
+        $core_company = DB_DataObject::factory('core_company');
+
+        if($core_company->get('code', $cfg['code'])){
+            return;
+        }
+
+        $core_company->setFrom($cfg);
+
+        $core_company->setFrom(array(
+            'created_dt' => date('Y-m-d H:i:s'),
+            'comptype_id' => $owner->id
+        ));
+
+        $core_company->insert();
+
+    }
+
+    var $declaration_types = array(
+        'declaration',
+        'forms',
+        'checklist',
+        'popup'
+    );
+
+    var $declaration_seq = array();
+
+    function initDeclarations()
+    {
+        if(empty($this->client_path)){
+            return;
+        }
+
+        $csv = $this->clientFilename('forms_docs_checklist.csv',$this);
+
+//        $csv = '/home/edward/Downloads/forms_docs_checklist.csv';
+//
+//        if(!file_exists($csv)){
+//            $this->jerr("Missing Declarations configuration file");
+//        }
+
+        ini_set("auto_detect_line_endings", true);
+
+        $fh = fopen($csv, 'r');
+
+        if (!$fh) {
+            $this->jerr("invalid file");
+        }
+
+        $req = array('FUND','SECTION', 'DATABASE_COL', 'TITLE', 'INDIVIDUAL', 'JOINT', 'COMPANY', 'COMPANY LISTED');
+
+        $cols = false;
+        $rows = array();
+
+        while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
+
+            if(!array_filter($n)){ // empty row
+                continue;
+            }
+
+            if (!$cols) {
+
+                $cols = array();
+
+                foreach($n as $k) {
+                    $cols[] = strtoupper(trim($k));
+                }
+
+                if (empty($cols)) {
+                    continue;
+                }
+
+                foreach($req as $r) {
+
+                    if (!in_array($r,$cols)) {
+                        $cols = false;
+                        break;
+                    }
+                }
+
+                continue;
+            }
+
+            foreach($cols as $i => $k) {
+                $row[$k] = trim($n[$i]);
+            }
+
+            $rows[] = $row;
+        }
+
+        if (empty($cols)) {
+            $this->jerr("could not find a row with " . implode(' / ', $req));
+        }
+
+        fclose($fh);
+
+        $coba_declarations = DB_DataObject::factory('coba_declarations');
+        $coba_declarations->setFrom(array(
+            'is_active' => 1
+        ));
+
+        $this->coba_declarations = array();
+
+        foreach ($coba_declarations->fetchAll() as $c){
+            $target = "{$c->dec_type}-{$c->nickname}-{$c->used_by}";
+
+            if(array_key_exists($target, $this->coba_declarations)){
+                continue;
+            }
+
+            $this->coba_declarations[$target] = clone ($c);
+        }
+
+        $coba_declarations = DB_DataObject::factory('coba_declarations');
+        $coba_declarations->setFrom(array(
+            'is_active' => 1
+        ));
+
+        $coba_declarations->selectAdd();
+        $coba_declarations->selectAdd("
+            coba_declarations.dec_type AS dec_type,
+            MAX(coba_declarations.seq_order) AS max_seq
+        ");
+
+        $coba_declarations->groupBy('coba_declarations.dec_type');
+
+        $this->declaration_seq = $coba_declarations->fetchAll('dec_type', 'max_seq');
+
+        foreach ($rows as $r){
+
+            if(
+                    empty($r['SECTION']) ||
+                    empty($r['TITLE']) ||
+                    $r['SECTION'] == 'Passcode' // not handle this at present...
+            ){
+                continue;
+            }
+
+            $fund_id = 0;
+
+            if(!empty($row['FUND']) && $row['FUND'] != '*'){
+
+                $modx_accountmgmts = DB_DataObject::factory('modx_accountmgmts');
+
+                if(!$modx_accountmgmts->get('isin_code', $row['FUND'])){
+                    echo "Invalid Fund : {$r['FUND']} \n";
+                    continue;
+                }
+
+                $fund_id = $modx_accountmgmts->id;
+            }
+
+            $dec_type = strtolower($r['SECTION']);
+
+            if(empty($dec_type) || !in_array($dec_type, $this->declaration_types)){
+                echo "Invalid Declaration Type : {$r['SECTION']} \n";
+                continue;
+            }
+
+            $method = "process_{$dec_type}";
+
+            if(!method_exists($this, $method)){
+                echo "Invalid method : {$method} \n";
+                continue;
+            }
+
+            $this->{$method}($fund_id, $dec_type, $r);
+
+        }
+
+        foreach ($this->coba_declarations as $c){
+            $o = clone ($c);
+            $c->is_active = 0;
+            $c->update($o);
+        }
+
+    }
+
+    var $field_mapping = array(
+        'INDIVIDUAL' => 'I',
+        'JOINT' => 'J',
+        'COMPANY' => 'C',
+        'COMPANY LISTED' => 'CL'
+    );
+
+    function process_declaration($fund_id, $dec_type, $row)
+    {
+        if(!isset($this->declaration_seq[$dec_type])){
+            $this->declaration_seq[$dec_type] = 0;
+        }
+
+        $this->declaration_seq[$dec_type] = $this->declaration_seq[$dec_type] + 1;
+
+        foreach ($this->field_mapping as $k => $v){
+
+            $target = "{$dec_type}-{$row['DATABASE_COL']}-{$v}";
+
+            if(array_key_exists($target, $this->coba_declarations)){
+                unset($this->coba_declarations[$target]);
+            }
+
+            
+            
+            $file = self::clientFilename($row[$k], $this);
+
+            echo "Declaration ({$k}) : {$file}\n";
+
+            $coba_declarations = DB_DataObject::factory('coba_declarations');
+            $coba_declarations->setFrom(array(
+                'fund_id' => $fund_id,
+                'dec_type' => $dec_type,
+                'nickname' => empty($row['DATABASE_COL']) ? '' : $row['DATABASE_COL'],
+                'is_active' => 1,
+                'used_by' => $v
+            ));
+
+            $o = false;
+
+            if($coba_declarations->find(true)){
+                $o = clone ($coba_declarations);
+            }
+
+            if(empty($row[$k]) || !file_exists($file)){
+
+                if(!empty($o)){
+                    $coba_declarations->is_active = 0;
+                    $coba_declarations->update($o);
+                }
+
+                echo "Ignore : File not found\n";
+
+                continue;
+            }
+
+            $coba_declarations->setFrom(array(
+                'title' => (empty($row['TITLE'])) ? '' : $row['TITLE'],
+                'seq_order' => $this->declaration_seq[$dec_type]
+            ));
+
+            if(empty($o)){
+                $coba_declarations->setFrom(array(
+                    'created_dt' => date('Y-m-d')
+                ));
+            }
+
+            (empty($o)) ? $coba_declarations->insert() : $coba_declarations->update($o);
+
+            $images = DB_DataObject::factory('Images');
+            $images->setFrom(array(
+                'onid' => $coba_declarations->id,
+                'ontable' => $coba_declarations->tableName()
+            ));
+
+            $images->find(true);
+
+            if($this->verifyDeclarationFile($images, $file)){
+                $this->uploadDeclarationFile($coba_declarations, $file);
+            }
+
+        }
+
+    }
+
+    function process_forms($fund_id, $dec_type, $row)
+    {
+        if(!isset($this->declaration_seq[$dec_type])){
+            $this->declaration_seq[$dec_type] = 0;
+        }
+
+        $this->declaration_seq[$dec_type] = $this->declaration_seq[$dec_type] + 1;
+
+        foreach ($this->field_mapping as $k => $v){
+
+            $target = "{$dec_type}-{$row['DATABASE_COL']}-{$v}";
+
+            if(array_key_exists($target, $this->coba_declarations)){
+                unset($this->coba_declarations[$target]);
+            }
+
+            $file = self::clientFilename($row[$k], $this);
+
+            echo "Form ({$k}) : {$file}\n";
+
+            $coba_declarations = DB_DataObject::factory('coba_declarations');
+            $coba_declarations->setFrom(array(
+                'fund_id' => $fund_id,
+                'dec_type' => $dec_type,
+                'nickname' => empty($row['DATABASE_COL']) ? '' : $row['DATABASE_COL'],
+                'is_active' => 1,
+                'used_by' => $v
+            ));
+
+            $o = false;
+
+            if($coba_declarations->find(true)){
+                $o = clone ($coba_declarations);
+            }
+
+            if(empty($row[$k]) || !file_exists($file)){
+
+                if(!empty($o)){
+                    $coba_declarations->is_active = 0;
+                    $coba_declarations->update($o);
+                }
+
+                echo "Ignore : File not found\n";
+
+                continue;
+            }
+
+            $coba_declarations->setFrom(array(
+                'title' => (empty($row['TITLE'])) ? '' : $row['TITLE'],
+                'seq_order' => $this->declaration_seq[$dec_type]
+            ));
+
+            if(empty($o)){
+                $coba_declarations->setFrom(array(
+                    'created_dt' => date('Y-m-d')
+                ));
+            }
+
+            (empty($o)) ? $coba_declarations->insert() : $coba_declarations->update($o);
+
+            $images = DB_DataObject::factory('Images');
+            $images->setFrom(array(
+                'onid' => $coba_declarations->id,
+                'ontable' => $coba_declarations->tableName(),
+                'imgtype' => ''
+            ));
+
+            $images->find(true);
+
+            if($this->verifyDeclarationFile($images, $file)){
+                $this->uploadDeclarationFile($coba_declarations, $file);
+            }
+
+            $ext = pathinfo($file);
+
+            $dn = dirname($file);
+
+            $instructions = "{$dn}/{$ext['filename']}.instructions.{$ext['extension']}";
+
+            echo "Form Instructions : {$instructions}\n";
+
+            $images = DB_DataObject::factory('Images');
+            $images->setFrom(array(
+                'onid' => $coba_declarations->id,
+                'ontable' => $coba_declarations->tableName(),
+                'imgtype' => 'instructions'
+            ));
+
+            $images->find(true);
+
+            if($this->verifyDeclarationFile($images, $instructions)){
+                $this->uploadDeclarationFile($coba_declarations, $instructions, 'instructions');
+            }
+
+
+        }
+
+    }
+
+    function process_checklist($fund_id, $dec_type, $row)
+    {
+        if(!isset($this->declaration_seq[$dec_type])){
+            $this->declaration_seq[$dec_type] = 0;
+        }
+
+        $this->declaration_seq[$dec_type] = $this->declaration_seq[$dec_type] + 1;
+
+        foreach ($this->field_mapping as $k => $v){
+
+            $target = "{$dec_type}-{$row['DATABASE_COL']}-{$v}";
+
+            if(array_key_exists($target, $this->coba_declarations)){
+                unset($this->coba_declarations[$target]);
+            }
+
+            $coba_declarations = DB_DataObject::factory('coba_declarations');
+            $coba_declarations->setFrom(array(
+                'fund_id' => $fund_id,
+                'dec_type' => $dec_type,
+                'nickname' => empty($row['DATABASE_COL']) ? '' : $row['DATABASE_COL'],
+                'is_active' => 1,
+                'used_by' => $v
+            ));
+
+            $o = false;
+
+            if($coba_declarations->find(true)){
+                $o = clone ($coba_declarations);
+            }
+
+            if(empty($row[$k]) || $row[$k] != 'y'){
+
+                if(!empty($o)){
+                    $coba_declarations->is_active = 0;
+                    $coba_declarations->update($o);
+                }
+
+                continue;
+            }
+
+            $coba_declarations->setFrom(array(
+                'title' => (empty($row['TITLE'])) ? '' : $row['TITLE'],
+                'seq_order' => $this->declaration_seq[$dec_type]
+            ));
+
+            if(empty($o)){
+                $coba_declarations->setFrom(array(
+                    'created_dt' => date('Y-m-d')
+                ));
+            }
+
+            (empty($o)) ? $coba_declarations->insert() : $coba_declarations->update($o);
+
+        }
+
+    }
+
+    function process_popup($fund_id, $dec_type, $row)
+    {
+        if(!isset($this->declaration_seq[$dec_type])){
+            $this->declaration_seq[$dec_type] = 0;
+        }
+
+        $this->declaration_seq[$dec_type] = $this->declaration_seq[$dec_type] + 1;
+
+        foreach ($this->field_mapping as $k => $v){
+
+            $target = "{$dec_type}-{$row['DATABASE_COL']}-{$v}";
+
+            if(array_key_exists($target, $this->coba_declarations)){
+                unset($this->coba_declarations[$target]);
+            }
+
+            $file = self::clientFilename($row[$k], $this);
+
+            echo "Popup ({$k}) : {$file}\n";
+
+            $coba_declarations = DB_DataObject::factory('coba_declarations');
+            $coba_declarations->setFrom(array(
+                'fund_id' => $fund_id,
+                'dec_type' => $dec_type,
+                'nickname' => empty($row['DATABASE_COL']) ? '' : $row['DATABASE_COL'],
+                'is_active' => 1,
+                'used_by' => $v
+            ));
+
+            $o = false;
+
+            if($coba_declarations->find(true)){
+                $o = clone ($coba_declarations);
+            }
+
+            if(empty($row[$k]) || !file_exists($file)){
+
+                if(!empty($o)){
+                    $coba_declarations->is_active = 0;
+                    $coba_declarations->update($o);
+                }
+
+                echo "Ignore : File not found\n";
+
+                continue;
+            }
+
+            $coba_declarations->setFrom(array(
+                'title' => (empty($row['TITLE'])) ? '' : $row['TITLE'],
+                'seq_order' => $this->declaration_seq[$dec_type]
+            ));
+
+            if(empty($o)){
+                $coba_declarations->setFrom(array(
+                    'created_dt' => date('Y-m-d')
+                ));
+            }
+
+            (empty($o)) ? $coba_declarations->insert() : $coba_declarations->update($o);
+
+            $images = DB_DataObject::factory('Images');
+            $images->setFrom(array(
+                'onid' => $coba_declarations->id,
+                'ontable' => $coba_declarations->tableName()
+            ));
+
+            $images->find(true);
+
+            if($this->verifyDeclarationFile($images, $file)){
+                $this->uploadDeclarationFile($coba_declarations, $file);
+            }
+
+        }
+    }
+
+    function verifyDeclarationFile($image, $file)
+    {
+        if(empty($image->id)){
+            return true;
+        }
+
+        $ofile = $image->getStoreName();
+
+        /*
+         * File is already up to date
+         */
+        if(file_exists($file) && file_exists($ofile) && md5(file_get_contents($ofile)) == md5(file_get_contents($file))){
+            echo "Ignore : Already up-to-date\n";
+            return false;
+        }
+
+        echo "Deleting : {$ofile}\n";
+
+        /*
+         * Otherwise, delete it...
+         */
+
+        $ff = HTML_FlexyFramework2::get();
+
+        if(empty($ff->Pman['local_autoauth'])){
+            $ff->page->jerr('Please set up local_autoauth');
+        }
+
+        $res = $this->curl($this->imageURI, array(
+            '_delete' => $image->id
+        ), 'POST');
+
+        $response = str_replace('<HTML><HEAD></HEAD><BODY>', '', $res);
+        $response = str_replace('</BODY></HTML>', '', $response);
+        $response = json_decode($response, true);
+
+        if(!is_array($response) || empty($response['success'])){
+            echo "Error occur on deleting image => {$this->imageURI}\n";
+            print_R($res);
+            print_r($image);
+            print_R($response);
+            exit;
+        }
+
+        return true;
+    }
+
+    function uploadDeclarationFile($coba_declarations, $file, $imgtype = '')
+    {
+        if(!file_exists($file)){
+            echo "Ignore : file not found\n";
+            return;
+        }
+
+        echo "Uploading : {$file}\n";
+
+        if (function_exists('curl_file_create')) {
+            $cFile = curl_file_create(realpath($file));
+        } else {
+            $cFile = '@' . realpath($file);
+        }
+
+        $ff = HTML_FlexyFramework2::get();
+
+        if(empty($ff->Pman['local_autoauth'])){
+            $ff->page->jerr('Please set up local_autoauth');
+        }
+
+        $res = $this->curl($this->imageURI, array(
+            'onid' => $coba_declarations->id,
+            'ontable' => $coba_declarations->tableName(),
+            'imgtype' => $imgtype,
+            'imageUpload' => $cFile
+        ), 'POST');
+
+        $response = str_replace('<HTML><HEAD></HEAD><BODY>', '', $res);
+        $response = str_replace('</BODY></HTML>', '', $response);
+        $response = json_decode($response, true);
+
+        if(!is_array($response) || empty($response['success'])){
+            echo "Error occur on uploading file => {$this->imageURI}\n";
+            echo "{$file}\n";
+            print_r($res);
+            print_r($coba_declarations);
+            print_R($response);
+            exit;
+        }
+    }
+
+    function initUserDeclarations()
+    {
+        $users = array();
+
+        $ext_data = DB_DataObject::factory('ext_data');
+        $ext_data->autoJoin();
+
+        $ext_data->whereAdd("
+            join_userdata_id_id.active = 1
+        ");
+
+        foreach ($ext_data->fetchAll() as $e){
+
+            if(!isset($users[$e->account_type])){
+                $users[$e->account_type] = array();
+            }
+
+            $users[$e->account_type][] = clone ($e);
+
+        }
+
+        $coba_declarations = DB_DataObject::factory('coba_declarations');
+        $coba_declarations->setFrom(array(
+            'dec_type' => 'declaration',
+            'is_active' => 1
+        ));
+
+        $account_type_mapping = array(
+            'I' => 'individual',
+            'J' => 'joint',
+            'C' => 'corporate',
+            'CL' => 'corporate'
+        );
+
+        foreach ($coba_declarations->fetchAll() as $c){
+
+            if(empty($account_type_mapping[$c->used_by]) || empty($users[$account_type_mapping[$c->used_by]])){
+                continue;
+            }
+
+            foreach ($users[$account_type_mapping[$c->used_by]] as $u){
+
+                $coba_investor_declarations = DB_DataObject::factory('coba_investor_declarations');
+                $coba_investor_declarations->setFrom(array(
+                    'user_id' => $u->userdata_id,
+                    'dec_id' => $c->id
+                ));
+
+                if($coba_investor_declarations->find(true)){
+                    continue;
+                }
+
+                $coba_investor_declarations->setFrom(array(
+                    'is_agreed' => 0
+                ));
+
+                $coba_investor_declarations->insert();
+
+            }
+
+        }
+
+    }
+
+    function initEnums()
+    {
+        $enum = DB_DataObject::factory('core_enum');
+
+        $enum->initEnums(
+            array(
+                array(
+                    'etype' => '',
+                    'name' => 'Coba-Laundering',
+                    'display_name' =>  'Coba Anti-Money Laundering',
+                    'cn' => array(
+                        array(
+                            'name' => 'SALARY',
+                            'display_name' => 'Salary/Employment Income',
+                            'seqid' => 1
+                        ),
+                        array(
+                            'name' => 'INHERITANCE',
+                            'display_name' => 'Inheritance',
+                            'seqid' => 2
+                        ),
+                        array(
+                            'name' => 'GIFTS',
+                            'display_name' => 'Gifts',
+                            'seqid' => 3
+                        ),
+                        array(
+                            'name' => 'SALEOFASSETS',
+                            'display_name' => 'Sale of assets',
+                            'seqid' => 4
+                        ),
+                        array(
+                            'name' => 'OTHER',
+                            'display_name' => 'Other',
+                            'seqid' => 5
+                        )
+                    )
+                ),
+            )
+        );
+
+        $data_enum_investor_profile = $this->readCSV();
+        $data_enum_investor_profile = $this->modifyEnumArray($data_enum_investor_profile);
+        foreach ($data_enum_investor_profile as $questionKey => $question) {
+            $enum->initEnums(array($question));
+        }
+
+    }
+
+    function readCSV()
+    {
+        $ff = HTML_FlexyFramework2::get();
+        $filename =
+        $fp = fopen($this->clientFilename("Enum_Schema_InvestorProfile.csv",$this),"r");
+        $header = null;
+        while ($row = fgetcsv($fp)) {
+            if ($header === null) {
+                $header = $row;
+                continue;
+            }
+            $rowsCSV[] = array_combine($header, $row);
+        }
+        fclose($fp);
+        return $rowsCSV;
+    }
+
+    function modifyEnumArray($rowsCSV)
+     {
+      foreach ($rowsCSV as $rowCSV) {
+          if(!isset($etypes[$rowCSV['etype']])){
+              $etypes[$rowCSV['etype']] = array(
+                  'etype' => '',
+                  'name' => $rowCSV['etype'],
+                  'display_name' => $rowCSV['question'],
+                  'cn' => []
+              );
+          }
+
+          $etypes[$rowCSV['etype']]['cn'][] = array(
+              'name' => $rowCSV['name'],
+              'display_name' => $rowCSV['display_name'],
+              'seqid' => $rowCSV['seqid']
+          );
+      }
+        return array_values($etypes);
+    }
+    
+    static function clientFilename($doc, $pman)
+    {
+        $csv = "{$pman->client_path}/{$doc}";
+        $csv_default = __DIR__ . "/../../Coba/Clients/default/{$doc}";
+        
+        if(file_exists($csv)) {
+            return $csv;
+        }
+
+        if (file_exists($csv_default)) {
+            return $csv_default;
+        }
+        if ($pman == false) {
+            return false;
+        }
+        
+        $pman->jerr("Missing client File: $doc");
+
+    }
+
+    function initAdviserStaff()
+    {
+        if(empty($this->client_path)){
+            return;
+        }
+
+        $csv = $this->clientFilename('staff.csv', $this);
+
+        ini_set("auto_detect_line_endings", true);
+
+        $fh = fopen($csv, 'r');
+
+        if (!$fh) {
+            $this->jerr("invalid file");
+        }
+
+        $req = array('NAME', 'EMAIL', 'ROLE');
+
+        $cols = false;
+        $rows = array();
+
+        while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
+
+            if(!array_filter($n)){ // empty row
+                continue;
+            }
+
+            if (!$cols) {
+
+                $cols = array();
+
+                foreach($n as $k) {
+                    $cols[] = strtoupper(trim($k));
+                }
+
+                if (empty($cols)) {
+                    continue;
+                }
+
+                foreach($req as $r) {
+
+                    if (!in_array($r,$cols)) {
+                        $cols = false;
+                        break;
+                    }
+                }
+
+                continue;
+            }
+
+            foreach($cols as $i => $k) {
+                $row[$k] = trim($n[$i]);
+            }
+
+            $rows[] = $row;
+        }
+
+        if (empty($cols)) {
+            $this->jerr("could not find a row with " . implode(' / ', $req));
+        }
+
+        fclose($fh);
+
+        $this->adviserGroup = $this->lookupAdviserGroup();
+
+        $this->adviserCompany = $this->lookupAdviserCompany();
+
+        foreach ($rows as $row){
+
+            if(
+                    empty($row['NAME']) ||
+                    empty($row['EMAIL']) ||
+                    !filter_var($row['EMAIL'], FILTER_VALIDATE_EMAIL)
+            ){
+                echo "Invalid Data : \n";
+                print_r($row);
+                continue;
+            }
+
+            $this->process_adviser($row);
+
+        }
+
+    }
+
+    function lookupAdviserGroup()
+    {
+        $core_group = DB_DataObject::factory('core_group');
+        $core_group->setFrom(array(
+            'name' => 'Adviser'
+        ));
+
+        if(!$core_group->find(true)){
+            $core_group->insert();
+        }
+
+        return $core_group;
+    }
+
+    function lookupAdviserCompany()
+    {
+        $core_company = DB_DataObject::factory('core_company');
+        $core_company->setFrom(array(
+            'comptype' => 'OWNER'
+        ));
+
+        if(!$core_company->find(true)){
+            $this->jerr('Error occur on lookup adviser company?!');
+        }
+
+        return $core_company;
+    }
+
+    function process_adviser($row)
+    {
+        $core_person = DB_DataObject::factory('core_person');
+        $core_person->setFrom(array(
+            'email' => $row['EMAIL']
+        ));
+
+        if(!$core_person->find(true)){
+
+            $name = $core_person->escape($row['NAME']);
+
+            $core_person->setFrom(array(
+                'name' => $name,
+                'company_id' => $this->adviserCompany->id,
+                'role' => empty($row['ROLE']) ? '' : $row['ROLE'],
+                'active' => 1
+            ));
+
+            $core_person->insert();
+
+        }
+
+        if (empty($row['ROLE']) || $row['ROLE'] != 'Adviser') {
+            $this->adviserGroup->removeMember($core_person);
+            return;
+        }
+
+        $this->adviserGroup->addMember($core_person);
+
+    }
+
+    function validateUserProfile()
+    {
+        $ext_data = DB_DataObject::factory('ext_data');
+
+        foreach ($ext_data->fetchAll() as $d){
+
+            $modx_user_attributes = DB_DataObject::factory('modx_user_attributes');
+
+            if($modx_user_attributes->get('internalKey', $d->userdata_id)){
+                continue;
+            }
+
+            $fullname = array();
+
+            foreach (array('in_firstname', 'in_middlename', 'in_lastname') as $k) {
+                if (empty($d->{$k})) {
+                    continue;
+                }
+                $fullname[] = $d->{$k};
+            }
+
+            $fullname = implode(' ', $fullname);
+
+            echo "Creating modx_user_attributes for {$fullname}...\n";
+
+            $modx_user_attributes = PDO_DataObject::factory('modx_user_attributes');
+            $modx_user_attributes->setFrom(array(
+                'internalKey' => $d->userdata_id,
+                'fullname' => $fullname,
+                'email' => $d->in_email
+            ));
+
+            $modx_user_attributes->insert();
+
+        }
+    }
+
+    function i18nSetPrefer()
+    {
+        $a = [
+            'USD',
+            'HKD',
+            'GBP',
+            'AUD',
+            'EUR',
+            'CNY',
+            'CHF',
+            'NZD',
+            'INR',
+            'SGD',
+            'JPY'
+        ];
+
+        $x  = DB_DataObject::factory('i18n');
+        $x->ltype = 'm';
+        $x->is_prefer = 1;
+        if ($x->count() >0) {
+            return;
+        }
+        foreach ($a as $i => $cur) {
+            $y = DB_DataObject::factory('i18n');
+            $y->is_active = 1;
+            $y->inlang = 'en';
+            $y->ltype = 'm';
+            if (!$y->get("lkey",$cur)) {
+                $this->jerr("could not find currency $cur in i18n");
+            }
+            $yy = clone($y);
+            $y->is_prefer = 1;
+            if (!$y->update($yy)) {
+                
+                $this->jerr("update is_prefer failed");
+            }
+        }
+        
+
+    }
+    
+    function initGroups()
+    {
+        $groups = array(
+            array(
+                'name' => 'Adviser'
+            ),
+            array(
+                'name' => 'Advisor - not public'
+            )
+        );
+        
+        $core_group = DB_DataObject::factory('core_group');
+        
+        $core_group->initDatabase($this, $groups);
+    }
+    
+    function updateImagesNoOfPage()
+    {
+        $images = DB_DataObject::factory('Images');
+        $images->setFrom(array(
+            'mimetype' => 'application/pdf',
+            'no_of_pages' => 0
+        ));
+        
+        foreach ($images->fetchAll() as $i){
+            
+            $file = $i->getStoreName();
+            
+            if(!file_exists($file)){
+                continue;
+            }
+            
+            $o = clone($i);
+            
+            $i->no_of_pages = $i->getPdfPages($file);
+            
+            $i->update($o);
+            
+        }
+    }
+
+}
diff --git a/Pman/Coba/UploadDocument.php b/Pman/Coba/UploadDocument.php
new file mode 100644 (file)
index 0000000..c970e4e
--- /dev/null
@@ -0,0 +1,256 @@
+<?php
+
+require_once 'Pman.php';
+
+class Pman_Coba_UploadDocument extends Pman
+{
+    
+    /**
+     *  get .. same as roo... 
+     * 
+     */
+    
+    function getAuth()
+    {
+        if (HTML_FlexyFramework::get()->cli) {
+            return true;
+        }
+        return parent::getAuth();
+    }
+    
+    
+    function get()
+    {
+        // fixme...
+        //PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
+
+        //DB_DataObject::DebugLevel(1);
+        require_once 'File/Convert.php';
+        $fc = new File_Convert('/tmp/clients.xls', 'application/vnd.ms-excel');
+        //var_Dump($img->getStoreName());
+        $csv = $fc->convert('text/csv');
+        $this->importCsv($csv);
+    }
+    
+    
+    function post( )
+    {
+        //PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
+
+         
+        $img = DB_DataObject::Factory('images');
+        //$img->setFrom(array(
+        //    'onid' => 0,
+        //    'ontable' => 'ipshead'
+        //));
+       $img->filename = $_FILES['filename']['name'];
+       $img->mime_type = $_FILES['filename']['type'];
+       $img->filesize = $_FILES['filename']['size'];
+       $img->ontable = 'coba_declarations';
+       $img->created = date('Y-m-d H:i:s');
+        $img->onUpload(false);
+       $img->insert();
+        
+        //require_once 'File/Convert.php';
+        //$fc = new File_Convert($img->getStoreName(), $img->mimetype );
+        var_Dump($img->getStoreName());
+        print_r($_FILES);
+       //$csv = $fc->convert('text/csv');
+       //if (empty($_REQUEST['as'])) {
+        //   $this->jerr("missing target type");
+        //}
+        //if (empty($_REQUEST['Content-Type'])) {
+        //    $this->jerr("missing content-type");
+        //}
+        //if (empty($_REQUEST['data'])) {
+        //    $this->jerr("missing data");
+        //}
+        
+       
+       $this->jok($img->id);
+
+        
+        //$img->as_mimetype = $_REQUEST['as'];
+        //$img->mimetype = $_REQUEST['mimetype'];
+        //require_once 'File/MimeType.php';
+        //$y = new File_MimeType();
+        //$src_ext = $y->toExt( $this->mimetype );
+        
+        
+        //$tmp = $img->tempName($src_ext);
+        //file_put_contents($tmp, $_REQUEST['data']);        
+       
+
+
+       //print_R($fc);exit;
+        //var_dump($csv);exit;
+        //$this->importCsv($csv);
+    }
+    function importCsv($csv)
+    {
+        
+        $co = DB_DataObject::Factory('I18n');
+        $co->buildDB();
+        
+        ini_set("auto_detect_line_endings", true);
+
+         
+        
+        $fh = fopen($csv, 'r');
+        if (!$fh) {
+            $this->jerr("invalid file");
+        }
+        $bom = "\xEF\xBB\xBF";
+        for ($i = 0; $i< 3;$i++) {
+            if ($bom[$i] != fgetc($fh)) {
+                fseek($fh,0);
+                break;
+            }
+            
+        }
+        
+        
+        
+        // we need to break this into cols..
+        $cols = false;
+        $rows = array();
+        while(false !== ($n = fgetcsv($fh,10000, ',', '"'))) {
+             
+            if (!$cols) {
+                
+                $cols = array();
+                foreach($n as $k) {
+                    $cols[] = strtoupper(trim($k));
+                }
+                /*
+                foreach($req as $r) {
+                    if (!in_array($r,$cols)) {
+                        $this->jerr('missing ' .  $r . ' : ' . implode(' , ' , $cols));
+                    }
+                }
+                */
+                continue;
+            }
+            foreach($cols as $i=>$k) {
+                $row[$k] = $n[$i];
+            }
+            $rows[] = $row;
+        }
+         
+        fclose($fh);
+        // 
+        
+        
+         
+        foreach($rows as $i => $row) {
+            
+            $this->importRow($row);
+             
+        }
+        $this->jok( "DONE " . count($rows)); 
+        
+        
+    
+    }
+    
+    function importRow($row)
+    {
+       // echo '<PRE>';print_R($row);
+        //DB_DataObject::DebugLevel(1);
+        $t = DB_DataObject::Factory('core_person');
+        $map = array(
+            
+            // 'TYPE OF CLIENT'
+            // company
+            'NAME' => 'name',
+            'SURNAME' => 'lastname',
+            'TITLE' => 'role',
+            'EMAIL' => 'email',
+            'PHONE1--- DIRECT LINE' => 'phone',
+            'MOBILE' => 'phone_mobile',
+            'GENERAL LINE' => 'phone_direct',
+         //   'ADDRESS1' => 'address',
+         //   'ADDRESS2' => 'address',
+         //   'ADDRESS3' => 'address',
+         //   'COUNTRY' => 'address',
+           // 'WEBSITE' => 'url',
+            'COMMENTS' => 'remarks'
+            
+        );
+        
+        if (empty($row['EMAIL'])) {
+            return;
+        }
+        if ($t->get('email', $row['EMAIL'])) {
+            if ($t->company()->comptype == 'OWNER') {
+                return;
+            }
+        }
+        foreach($map as $k=>$v) {
+            $t->{$v} = $row[$k];
+        }
+        $t->id ? $t->update() : $t->insert();
+        
+        
+        
+        $tt = DB_DataObject::Factory('core_person');
+        $tt->get($t->id);
+        // next company..
+        if (empty($row['COMPANY'])) {
+            return;
+        }
+        if ($row['TYPE OF CLIENT'] == 'OWNER') {
+            return;
+        }
+        $c = DB_DAtaObject::Factory('Companies');
+        if ($c->get('name', $row['COMPANY']) && $c->comptype == 'OWNER') {
+            return;
+        }
+        $map = array(
+            'COMPANY' => 'name',
+            'ADDRESS1' => 'address1',
+            'ADDRESS2' => 'address2',
+            'ADDRESS3' => 'address3',
+            'TYPE OF CLIENT' => 'comptype',
+            //'COUNTRY' => 'country',
+            'WEBSITE' => 'url',
+        );
+        $ce = DB_DataObject::Factory('core_enum');
+        $ce->lookupObject('COMPTYPE', $row['TYPE OF CLIENT'] , true);
+        
+        $co = DB_DataObject::Factory('I18n');
+        $co->ltype = 'c';
+        $co->lval = $row['COUNTRY'];
+        $co->inlang = 'en';
+        if ($co->find(true)) {
+            
+            $c->country = $co->lkey;
+        }
+        
+        foreach($map as $k=>$v) {
+            $c->{$v} = $row[$k];
+        }
+        $c->id ? $c->update() : $c->insert();
+        
+        
+        $t =clone($tt);
+        $t->company_id = $c->id;
+        $t->update($tt);
+        //var_dump($t->company_id);exit;
+
+        // create the crm record for this user..
+        $crm = DB_DataObject::Factory('crm_person_relation');
+        $crm->person_id = $t->id;
+        $crm->staff_id = $this->authUser->id;
+        if (!$crm->count()) {
+            $crm->insert();
+        }
+        
+        
+        
+        
+    }
+    
+    
+}
+
diff --git a/Pman/Coba/coba.css b/Pman/Coba/coba.css
new file mode 100644 (file)
index 0000000..d8357ee
--- /dev/null
@@ -0,0 +1,13 @@
+
+.roo-document-manager-uploader, .roo-document-manager-loading, .roo-document-manager-preview {
+    margin-top: 0px;
+}
+
+.coba-document-table thead th:first-child,
+.coba-document-table tbody td:first-child {
+    padding-left: 15px;
+}
+
+.enable-overflow {
+    overflow : auto;
+}
\ No newline at end of file
diff --git a/Pman/Coba/investorLoginCheck.php b/Pman/Coba/investorLoginCheck.php
new file mode 100644 (file)
index 0000000..4bc3332
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'Pman.php';
+require_once 'Coba.php';
+
+class Pman_Coba_investorLoginCheck extends Pman 
+{
+    function get()
+    {
+        $p = DB_DataObject::factory('core_person');
+               if($p->isAuth())
+               {
+               $this->jok('Logged in');
+        }
+               $this->jerr('Not Logged in');
+        
+    }
+    
+    
+}
diff --git a/Pman/Coba/is_bootstrap b/Pman/Coba/is_bootstrap
new file mode 100644 (file)
index 0000000..396a0ba
--- /dev/null
@@ -0,0 +1 @@
+yes
\ No newline at end of file
diff --git a/Pman/Coba/sql/README.txt b/Pman/Coba/sql/README.txt
new file mode 100644 (file)
index 0000000..e000868
--- /dev/null
@@ -0,0 +1,65 @@
+Database Overview for coba.
+
+
+api_result: - Probably related to api queries.. '
+see: core/components/extendeduser/processors/mgr/custom/checkapi.php
+
+
+Applications
+-----------------------------
+ext_data:
+Currently where the 'user' data is stored.
+userdata_id -> points to modx_user.
+
+** will be replaced eventually by coba_person
+(a dual account will involve 2 'coba_person')
+?? coba_company ?? = for the company ones?
+
+coba_application ?? core holder of application ?
+??? big rethink here...
+
+modx_accounts:
+-- appears to be the upload of user documents related to finds
+-- also appears to map the fund???
+
+?? modx_documents ?? not sure where it's used..
+
+Access control / User managmenet
+----------------------------
+modx_access_* - can be removed..
+modx_member_groups (membership of groups)
+modx_membergroups_names (groups and their names)
+modx_user_attributes - includes email / session id / login count...
+modx_user_group_rules = groups?
+modx_users - passwords + username
+
+
+Fund Descriptions
+--------------------------------
+modx_accountmgmts => rename to coba_fund_types + core_images ???
+--> 
+  Describes the account name / documents / terms_text
+  
+---------------------------
+
+Notifications / Messages
+----------------------------------
+modx_backend_notifications
+-> appears to notifications to admin generally?
+modx_frontned_notifications
+-> appears to be notifications targeted at specific users?
+modx_loginfos
+-> a generic log of events?
+modx_manager_log
+-> log of management operations , eg. update XXx/ login ...
+modx_user_messages ?
+-> user to user messaging?
+
+
+
+Old content mangement
+--------------------------
+categories  - the nav tree...
+modx_media_* - relates to how resources are found on file system etc.
+modx_menus - backend menu tree..
+modx_site_*
\ No newline at end of file
diff --git a/Pman/Coba/sql/coba_address.sql b/Pman/Coba/sql/coba_address.sql
new file mode 100644 (file)
index 0000000..6fda813
--- /dev/null
@@ -0,0 +1,19 @@
+
+CREATE TABLE coba_address (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_address ADD COLUMN country VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_address ADD COLUMN other_country VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_address ADD COLUMN state INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_address ADD COLUMN other_state VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_address ADD COLUMN city VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_address ADD COLUMN without_post_code INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_address ADD COLUMN post_code VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_address ADD COLUMN address_line_1 TEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_address ADD COLUMN address_line_2 TEXT NOT NULL DEFAULT '';
diff --git a/Pman/Coba/sql/coba_application_signup.sql b/Pman/Coba/sql/coba_application_signup.sql
new file mode 100644 (file)
index 0000000..dc97730
--- /dev/null
@@ -0,0 +1,30 @@
+
+CREATE TABLE coba_application_signup (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_application_signup ADD COLUMN   firstname varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   middlename varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   lastname varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   firstname_sec_ap varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   middlename_sec_ap varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   lastname_sec_ap varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   email varchar(256)  NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   adviser_id int(11) NOT NULL  default 0;
+
+ALTER TABLE coba_application_signup ADD COLUMN   fund_id int(11) NOT NULL  default 0;
+ALTER TABLE coba_application_signup CHANGE COLUMN fund_id fund_code varchar(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   account_type varchar(32) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   verify_key varchar(256)  NOT NULL DEFAULT '';
+
+ALTER TABLE coba_application_signup ADD COLUMN   created_dt DATETIME  NOT NULL;
diff --git a/Pman/Coba/sql/coba_company.sql b/Pman/Coba/sql/coba_company.sql
new file mode 100644 (file)
index 0000000..c9ae33e
--- /dev/null
@@ -0,0 +1,91 @@
+
+CREATE TABLE coba_company (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_company ADD COLUMN name VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_company ADD COLUMN domicile VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_company ADD COLUMN registration_number VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_company ADD COLUMN date_of_incorporation DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_company ADD COLUMN not_domociled_usa INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_company ADD COLUMN giin_number VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_company ADD COLUMN other_domicile VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_company ADD COLUMN coba_address_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_company ADD COLUMN exchange_traded_on VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_company ADD COLUMN stock_symbol VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_company ADD COLUMN is_listed_company INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_company CHANGE COLUMN not_domociled_usa not_domociled_usa INT(2) NOT NULL DEFAULT -1;
+ALTER TABLE coba_company CHANGE COLUMN is_listed_company is_listed_company INT(2) NOT NULL DEFAULT -1;
+
+
+
+-- DROP TRIGGER IF EXISTS coba_company_before_insert; 
+-- 
+-- DELIMITER $$
+-- CREATE TRIGGER coba_company_before_insert 
+--     BEFORE INSERT ON coba_company
+-- FOR EACH ROW
+-- BEGIN
+-- 
+--     DECLARE user_id INT(11);
+--     DECLARE mid INT(1);
+--     
+--     SELECT modx_user_id INTO user_id FROM coba_investor_relation WHERE coba_company_id = NEW.id LIMIT 1;
+--     SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = NEW.modx_user_id LIMIT 1;
+-- 
+--     IF mid > 0 THEN
+--         UPDATE `Fail: INSERT referenced ext_data:is_submit` SET x = 1;
+--     END IF;
+--     
+-- END$$
+-- DELIMITER ;
+
+
+DROP TRIGGER IF EXISTS coba_company_before_update; 
+
+DELIMITER $$
+CREATE TRIGGER coba_company_before_update
+    BEFORE UPDATE ON coba_company
+FOR EACH ROW
+BEGIN
+
+    DECLARE user_id INT(11);
+    DECLARE mid INT(1);
+    
+    SELECT modx_user_id INTO user_id FROM coba_investor_relation WHERE coba_company_id = NEW.id LIMIT 1;
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = user_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: UPDATE referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
+
+DROP TRIGGER IF EXISTS coba_company_before_delete; 
+
+DELIMITER $$
+CREATE TRIGGER coba_company_before_delete
+    BEFORE DELETE ON coba_company
+FOR EACH ROW
+BEGIN
+
+    DECLARE user_id INT(11);
+    DECLARE mid INT(1);
+    
+    SELECT modx_user_id INTO user_id FROM coba_investor_relation WHERE coba_company_id = OLD.id LIMIT 1;
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = user_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: DELETE referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
diff --git a/Pman/Coba/sql/coba_country.sql b/Pman/Coba/sql/coba_country.sql
new file mode 100644 (file)
index 0000000..1c47954
--- /dev/null
@@ -0,0 +1,9 @@
+
+CREATE TABLE coba_country (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_country ADD COLUMN name VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_country ADD COLUMN abbrv VARCHAR(254) NOT NULL DEFAULT '';
+
diff --git a/Pman/Coba/sql/coba_declarations.sql b/Pman/Coba/sql/coba_declarations.sql
new file mode 100644 (file)
index 0000000..cbb73cb
--- /dev/null
@@ -0,0 +1,16 @@
+
+CREATE TABLE coba_declarations (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_declarations ADD COLUMN fund_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_declarations ADD COLUMN dec_type VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_declarations ADD COLUMN nickname VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_declarations ADD COLUMN title TEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_declarations ADD COLUMN created_dt DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_declarations ADD COLUMN created_by INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_declarations ADD COLUMN is_active INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_declarations ADD COLUMN used_by VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_declarations ADD COLUMN seq_order INT(11) NOT NULL DEFAULT 0;
+
diff --git a/Pman/Coba/sql/coba_investor_lexis_results.sql b/Pman/Coba/sql/coba_investor_lexis_results.sql
new file mode 100644 (file)
index 0000000..6e2dbdd
--- /dev/null
@@ -0,0 +1,20 @@
+
+CREATE TABLE coba_investor_lexis_results (
+    id int(11) NOT NULL auto_increment,
+    PRIMARY KEY  (id)
+);
+
+ALTER TABLE coba_investor_lexis_results ADD COLUMN investor_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_lexis_results ADD COLUMN match_id BIGINT(20) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_lexis_results ADD COLUMN updated_by INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_lexis_results ADD COLUMN updated_dt DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_investor_lexis_results ADD COLUMN reason TEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_investor_lexis_results ADD COLUMN is_active INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_lexis_results ADD COLUMN status INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_investor_lexis_results CHANGE COLUMN person_id updated_by INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_lexis_results CHANGE COLUMN when_dt updated_dt DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_investor_lexis_results CHANGE COLUMN match_id match_id VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_investor_lexis_results ADD COLUMN json_detail TEXT NOT NULL DEFAULT '';
diff --git a/Pman/Coba/sql/coba_investor_notes.sql b/Pman/Coba/sql/coba_investor_notes.sql
new file mode 100644 (file)
index 0000000..4581cf1
--- /dev/null
@@ -0,0 +1,12 @@
+
+CREATE TABLE coba_investor_notes (
+    id INT(11) NOT NULL AUTO_INCREMENT,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE coba_investor_notes ADD COLUMN investor_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_notes ADD COLUMN created_by INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_notes ADD COLUMN created_dt DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_investor_notes ADD COLUMN notes LONGTEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_investor_notes ADD COLUMN note_type VARCHAR(254) NOT NULL DEFAULT '';
+
diff --git a/Pman/Coba/sql/coba_investor_relation.sql b/Pman/Coba/sql/coba_investor_relation.sql
new file mode 100644 (file)
index 0000000..65d0def
--- /dev/null
@@ -0,0 +1,78 @@
+
+CREATE TABLE coba_investor_relation (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_investor_relation ADD COLUMN modx_user_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_investor_relation CHANGE COLUMN primary_id modx_user_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_investor_relation ADD COLUMN coba_person_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_investor_relation ADD COLUMN relation VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_investor_relation ADD COLUMN parent_company_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_investor_relation CHANGE COLUMN primary_company_id parent_company_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_investor_relation ADD COLUMN coba_company_id INT(11) NOT NULL DEFAULT 0;
+
+
+DROP TRIGGER IF EXISTS coba_investor_relation_before_insert; 
+
+DELIMITER $$
+CREATE TRIGGER coba_investor_relation_before_insert 
+    BEFORE INSERT ON coba_investor_relation
+FOR EACH ROW
+BEGIN
+
+    DECLARE mid INT(1);
+    
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = NEW.modx_user_id LIMIT 1;
+
+    IF mid > 0 THEN
+        UPDATE `Fail: INSERT referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
+
+
+DROP TRIGGER IF EXISTS coba_investor_relation_before_update; 
+
+DELIMITER $$
+CREATE TRIGGER coba_investor_relation_before_update
+    BEFORE UPDATE ON coba_investor_relation
+FOR EACH ROW
+BEGIN
+
+    DECLARE mid INT(1);
+    
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = NEW.modx_user_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: UPDATE referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
+
+DROP TRIGGER IF EXISTS coba_investor_relation_before_delete; 
+
+DELIMITER $$
+CREATE TRIGGER coba_investor_relation_before_delete
+    BEFORE DELETE ON coba_investor_relation
+FOR EACH ROW
+BEGIN
+
+    DECLARE mid INT(1);
+    
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = OLD.modx_user_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: DELETE referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
diff --git a/Pman/Coba/sql/coba_person.sql b/Pman/Coba/sql/coba_person.sql
new file mode 100644 (file)
index 0000000..aa2bc4e
--- /dev/null
@@ -0,0 +1,133 @@
+
+CREATE TABLE coba_person (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_person ADD COLUMN name VARCHAR(128)  NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN honor VARCHAR(32) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN firstname VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN middlename VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN lastname VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN firstname_alt VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN lastname_alt VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN chosen_title TEXT NOT NULL DEFAULT ''; 
+ALTER TABLE coba_person ADD COLUMN role VARCHAR(254)  NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN remarks TEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN lang VARCHAR(8) DEFAULT 'en';
+ALTER TABLE coba_person ADD COLUMN country VARCHAR(8) DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN birth_date DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_person ADD COLUMN email VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN phone VARCHAR(32) NOT NULL  DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN phone_mobile VARCHAR(32) NOT NULL  DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN phone_direct VARCHAR(32) NOT NULL  DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN fax VARCHAR(32) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN alt_email VARCHAR(254) NULL DEFAULT '' ;
+ALTER TABLE coba_person ADD COLUMN office_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person ADD COLUMN company_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person ADD COLUMN owner_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person ADD COLUMN active INT(11) NOT NULL DEFAULT 1;
+ALTER TABLE coba_person ADD COLUMN project_id INT(11) DEFAULT 0;
+ALTER TABLE coba_person ADD COLUMN passwd VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN no_reset_sent int(11) DEFAULT 0;
+ALTER TABLE coba_person ADD COLUMN deleted_by INT(11) NOT NULL default 0 ;
+ALTER TABLE coba_person ADD COLUMN deleted_dt DATETIME NOT NULL DEFAULT '0000-00-00 00-00-00';
+ALTER TABLE coba_person ADD COLUMN name_facebook VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN url_blog VARCHAR(254) NOT NULL DEFAULT '' ;
+ALTER TABLE coba_person ADD COLUMN url_twitter VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN linkedin_id VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN url_linkedin VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN url_google_plus TEXT NOT NULL DEFAULT ''; 
+ALTER TABLE coba_person ADD COLUMN url_blog2 TEXT NOT NULL DEFAULT ''; 
+ALTER TABLE coba_person ADD COLUMN url_blog3 TEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN countries VARCHAR(128) NOT NULL DEFAULT ''; 
+ALTER TABLE coba_person ADD COLUMN action_type VARCHAR(32) NOT NULL DEFAULT ''; 
+ALTER TABLE coba_person ADD COLUMN point_score INT(11) NOT NULL DEFAULT 0; 
+ALTER TABLE coba_person ADD COLUMN authorize_md5 VARCHAR(254)  NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN post_code VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN passport_number VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN passport_date_of_issue DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_person ADD COLUMN passport_date_of_expiry DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE coba_person ADD COLUMN nationality VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE coba_person ADD COLUMN place_of_birth VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person ADD COLUMN investor_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person ADD COLUMN other_nationality VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person ADD COLUMN credentials_type VARCHAR(128) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person ADD COLUMN coba_address_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person ADD COLUMN id_card_number VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person ADD COLUMN id_card_date_of_issue DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person ADD COLUMN not_have_passport INT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person ADD COLUMN not_have_id_card INT(1) NOT NULL DEFAULT 0; 
+
+
+ALTER TABLE coba_person ADD INDEX lookup_authorize_md5_active(authorize_md5, active);
+ALTER TABLE coba_person ADD INDEX lookup_a(email, active);
+ALTER TABLE coba_person ADD INDEX lookup_b(email, active, company_id);
+ALTER TABLE coba_person ADD INDEX lookup_owner(owner_id);
+
+
+DROP TRIGGER IF EXISTS coba_person_before_insert; 
+
+DELIMITER $$
+CREATE TRIGGER coba_person_before_insert 
+    BEFORE INSERT ON coba_person
+FOR EACH ROW
+BEGIN
+
+    DECLARE mid INT(1);
+    
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = NEW.investor_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: INSERT referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
+
+
+DROP TRIGGER IF EXISTS coba_person_before_update; 
+
+DELIMITER $$
+CREATE TRIGGER coba_person_before_update
+    BEFORE UPDATE ON coba_person
+FOR EACH ROW
+BEGIN
+
+    DECLARE mid INT(1);
+    
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = NEW.investor_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: UPDATE referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
+
+DROP TRIGGER IF EXISTS coba_person_before_delete; 
+
+DELIMITER $$
+CREATE TRIGGER coba_person_before_delete
+    BEFORE DELETE ON coba_person
+FOR EACH ROW
+BEGIN
+
+    DECLARE mid INT(1);
+    
+    SELECT is_submit INTO mid FROM ext_data WHERE userdata_id = OLD.investor_id LIMIT 1;
+    
+    IF mid > 0 THEN
+        UPDATE `Fail: DELETE referenced ext_data:is_submit` SET x = 1;
+    END IF;
+    
+END$$
+DELIMITER ;
\ No newline at end of file
diff --git a/Pman/Coba/sql/coba_person_investor_profile.sql b/Pman/Coba/sql/coba_person_investor_profile.sql
new file mode 100644 (file)
index 0000000..8ae3d9e
--- /dev/null
@@ -0,0 +1,198 @@
+CREATE TABLE coba_person_investor_profile (
+    id INT(11) NOT NULL auto_increment,
+    PRIMARY KEY (id)
+);
+
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN investor_id id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN id id INT(11) NOT NULL auto_increment;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN coba_person_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN coba_person_id modx_user_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN is_completed INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN completed_dt DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN started_dt DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN dependent_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN info_year_invest_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN info_is_leveraged INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN info_is_leveraged info_is_leveraged INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN info_income_require_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN info_to_do_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN info_regular_invest_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN info_rate_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN exp_type_id INT(11) NOT NULL DEFAULT 0;
+
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN exp_currency_primary_id INT(11) NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN exp_currency_primary VARCHAR(8) NOT NULL DEFAULT '';
+UPDATE coba_person_investor_profile SET exp_currency_primary = (SELECT name FROM core_enum WHERE id = exp_currency_primary_id ) WHERE  exp_currency_primary_id > 0;
+ALTER TABLE coba_person_investor_profile DROP COLUMN exp_currency_primary_id;
+
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN exp_currency_second_id INT(11) NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN exp_currency_second VARCHAR(8) NOT NULL DEFAULT '';
+UPDATE coba_person_investor_profile SET exp_currency_second = (SELECT name FROM core_enum WHERE id = exp_currency_second_id ) WHERE  exp_currency_second_id > 0;
+ALTER TABLE coba_person_investor_profile DROP COLUMN exp_currency_second_id;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN exp_household_currency VARCHAR(128) NOT NULL DEFAULT '';
+UPDATE coba_person_investor_profile SET exp_household_currency = CONCAT(exp_currency_primary,IF(exp_currency_second!='' AND exp_currency_primary!='',',',''),IF(exp_currency_second!='',exp_currency_second,''));
+ALTER TABLE coba_person_investor_profile DROP COLUMN exp_currency_primary;
+ALTER TABLE coba_person_investor_profile DROP COLUMN exp_currency_second;
+ALTER TABLE coba_person_investor_profile ADD COLUMN exp_pri_cur VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE coba_person_investor_profile ADD COLUMN exp_sec_cur VARCHAR(128) NOT NULL DEFAULT '';
+
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_fluctuate_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_more_risk_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_willing_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_risk_taker_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_familiar_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_security_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_suit_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_year_income_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_goal_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_expect_normal_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_expect_poor_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_attitude_year_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN risk_attitude_month_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_is_derivative INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_is_derivative know_is_derivative INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_training INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_training know_training INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp know_exp INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_work_exp INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_work_exp know_work_exp INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_is_qualified INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_is_qualified know_acquire_is_qualified INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_hksi INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_hksi know_acquire_hksi INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_iiqe INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_iiqe know_acquire_iiqe INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_frme INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_frme know_acquire_frme INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_cfae INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_cfae know_acquire_cfae INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_from_caiae INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_from_caiae know_from_caiae INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_from_cert_planner INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_from_cert_planner know_from_cert_planner INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_from_master_degree INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_from_master_degree know_from_master_degree INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_from_degree INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_from_degree know_from_degree INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_diploma INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_diploma know_acquire_diploma INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_acquire_qualified_other TEXT NOT NULL DEFAULT '';
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_acquire_qualified_other know_acquire_qualified_other VARCHAR(64) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_equity_linked INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_equity_linked know_exp_equity_linked INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_credit_linked INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_credit_linked know_exp_credit_linked INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_structured_deposit INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_structured_deposit know_exp_structured_deposit INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_currency_link INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_currency_link know_exp_currency_link INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_currency_forward INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_currency_forward know_exp_currency_forward INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_warrant INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_warrant know_exp_warrant INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_stock_option INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_stock_option know_exp_stock_option INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_index_future INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_index_future know_exp_index_future INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_non_auth INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_non_auth know_exp_non_auth INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_auth INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_auth know_exp_auth INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_exp_auth_with_know INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_exp_auth_with_know know_exp_auth_with_know INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_is_licensed INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_is_licensed know_is_licensed INT(2) NOT NULL DEFAULT -1;
+
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN know_is_read_disclosure INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN know_is_read_disclosure know_is_read_disclosure INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE coba_person_investor_profile ADD COLUMN is_second_ap INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_person_investor_profile CHANGE COLUMN is_second_ap  is_second_ap  INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_investor_profile ADD UNIQUE unique_index (modx_user_id, is_second_ap);
+
+-- moved to ext_data
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_is_invest_irp INT(2) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_is_joint_invest INT(2) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_joint_invest_profile VARCHAR(254) NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_is_invest_diff INT(2) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_invest_diff_profile VARCHAR(254) NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_is_invest_more INT(2) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_invest_more_profile VARCHAR(254) NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_is_satellite INT(2) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_is_impose INT(2) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_impose MEDIUMTEXT NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_license MEDIUMTEXT NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_recommend VARCHAR(254) NOT NULL DEFAULT '';
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_recommend_currency_id INT(11) NOT NULL DEFAULT 0;
+-- ALTER TABLE coba_person_investor_profile ADD COLUMN sum_agreed_currency_id TEXT NOT NULL DEFAULT "";
+
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_is_invest_irp;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_is_joint_invest;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_joint_invest_profile;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_is_invest_diff;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_invest_diff_profile;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_is_invest_more;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_invest_more_profile;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_is_satellite;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_is_impose;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_impose;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_license;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_recommend;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_recommend_currency_id;
+ALTER TABLE coba_person_investor_profile DROP COLUMN sum_agreed_currency_id;
diff --git a/Pman/Coba/sql/coba_person_notes.sql b/Pman/Coba/sql/coba_person_notes.sql
new file mode 100644 (file)
index 0000000..a77d616
--- /dev/null
@@ -0,0 +1,11 @@
+
+CREATE TABLE coba_person_notes (
+    `id` INT(11) NOT NULL AUTO_INCREMENT,
+    PRIMARY KEY (`id`)
+);
+
+ALTER TABLE coba_person_notes ADD COLUMN `coba_person_id` INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_notes ADD COLUMN `date_created` DATE NOT NULL DEFAULT '0000-00-00' ;
+
+ALTER TABLE coba_person_notes ADD COLUMN `notes` LONGTEXT CHARACTER SET 'utf8' NOT NULL ;
diff --git a/Pman/Coba/sql/coba_person_risk.sql b/Pman/Coba/sql/coba_person_risk.sql
new file mode 100644 (file)
index 0000000..70dcd05
--- /dev/null
@@ -0,0 +1,181 @@
+
+CREATE TABLE coba_person_risk (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk ADD COLUMN coba_person_risk_dependent_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN modx_user_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN info_year_lived_asia INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN info_year_to_live_asia INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN info_marital ENUM('single','married','divorced','widowed', '') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN info_level_edu ENUM('elementary school','high school','tertiary education','post-graduate','') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN info_is_smoker INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN info_phone_business VARCHAR(32) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN info_phone_fax VARCHAR(32) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN info_status_employ ENUM('employee','self-employed','unemployed','') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN info_occupation MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN info_name_employer VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN health_age_retire INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN health_status MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN health_is_aware_underwrite INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN health_aware_underwrite VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN health_is_aware INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN health_aware VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN health_name_insurance ENUM('none','standard health','decline or defer','loading','exclusion','') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN health_is_private_patient INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN tax_name_company MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN tax_name_trust MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN tax_name_fund MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN tax_name_business MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN tax_note MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN income_salary NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_house_allowance NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_bonus NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_investment NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_rental NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_other NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_expense NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_surplus NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN income_currency VARCHAR(8) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN income_note MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN property_note MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_reason_advice MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_reason_short_term MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_reason_medium_term MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_reason_longterm MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_age_retire INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN future_place_retire VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_income_retire NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN future_intend_retire ENUM('yes','full-time','part-time','no','') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_expense_retire MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN future_reserve_retire NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN future_note MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_liability_family NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_expense_edu_family NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_income_replace_family NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_year_replace_family INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_expense_funeral_family NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_fund_emergency_family NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_liability_critical NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_expense_critical NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_income_replace_critical NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_income_other_critical NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_income_cover_serious NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_year_sustain_serious INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_year_benefit_serious INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_income_other_serious NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_expense_share_business NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_expense_guarantor_business NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN insurance_is_require_keyperson INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_is_will INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_year_will INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_is_testamentary INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_is_enduring_power INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_is_health_directive INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_is_special_need INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_reason_special_need MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN estate_is_charitable INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN client_best_investment MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_worst_investment MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_areas_help MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_plan MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_sell_property MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_happy_about MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_things_to_do MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN client_expect_advisor MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk ADD COLUMN acknowledge_is_accurate INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN acknowledge_is_not_proceed INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN acknowledge_is_receive_copy INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN acknowledge_is_full_financial_info INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN acknowledge_is_limited_financial_info INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN acknowledge_is_limited_advise INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk ADD COLUMN notes_note MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk CHANGE health_age_retire info_age_retire INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_advisor.sql b/Pman/Coba/sql/coba_person_risk_advisor.sql
new file mode 100644 (file)
index 0000000..2eeb05d
--- /dev/null
@@ -0,0 +1,17 @@
+
+CREATE TABLE coba_person_risk_advisor (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_advisor ADD COLUMN profession VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_advisor ADD COLUMN name_advisor VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_advisor ADD COLUMN name_company VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_advisor ADD COLUMN address VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_advisor ADD COLUMN phone VARCHAR(32) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_advisor ADD COLUMN coba_person_risk_id INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_asset.sql b/Pman/Coba/sql/coba_person_risk_asset.sql
new file mode 100644 (file)
index 0000000..ae5a052
--- /dev/null
@@ -0,0 +1,17 @@
+
+CREATE TABLE coba_person_risk_asset (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_asset ADD COLUMN name_asset VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_asset ADD COLUMN name_owner VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_asset ADD COLUMN currency VARCHAR(8) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_asset ADD COLUMN country  VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_asset ADD COLUMN amount_usd NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_asset ADD COLUMN coba_person_risk_id INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_child.sql b/Pman/Coba/sql/coba_person_risk_child.sql
new file mode 100644 (file)
index 0000000..bbb55e8
--- /dev/null
@@ -0,0 +1,35 @@
+
+CREATE TABLE coba_person_risk_child (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_child ADD COLUMN firstname VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN lastname VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN relationship VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN gender ENUM('male','female','') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN level_edu ENUM('elementary school','high school','tertiary education','post-graduate','') NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN dob DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN is_dependent INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN requirement MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_child ADD COLUMN amount_sponsor NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN age_to INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN expense_current NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN expense_future NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN saving NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN rate_inflat_protect NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_child ADD COLUMN coba_person_risk_id INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_insurance.sql b/Pman/Coba/sql/coba_person_risk_insurance.sql
new file mode 100644 (file)
index 0000000..83d04f3
--- /dev/null
@@ -0,0 +1,21 @@
+
+CREATE TABLE coba_person_risk_insurance (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN name_company VARCHAR(254) NOT NULL DEFAULT "";
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN policy_no INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN type_policy VARCHAR(254) NOT NULL DEFAULT "";
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN name_owner VARCHAR(254) NOT NULL DEFAULT "";
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN insure_life INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN insure_sum NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN premium_annual NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_insurance ADD COLUMN coba_person_risk_id INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_liability.sql b/Pman/Coba/sql/coba_person_risk_liability.sql
new file mode 100644 (file)
index 0000000..e2e820e
--- /dev/null
@@ -0,0 +1,13 @@
+
+CREATE TABLE coba_person_risk_liability (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_liability ADD COLUMN name_liability       VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_liability ADD COLUMN amount       NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_liability ADD COLUMN name_bank    VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_liability ADD COLUMN coba_person_risk_id  INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_pension.sql b/Pman/Coba/sql/coba_person_risk_pension.sql
new file mode 100644 (file)
index 0000000..5ef8bff
--- /dev/null
@@ -0,0 +1,19 @@
+
+CREATE TABLE coba_person_risk_pension (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN name_client VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN is_employer INT(2) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN name_company VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN policy_no INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN value NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN amount_contribute NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_pension ADD COLUMN coba_person_risk_id INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_person_risk_property.sql b/Pman/Coba/sql/coba_person_risk_property.sql
new file mode 100644 (file)
index 0000000..67cf0dd
--- /dev/null
@@ -0,0 +1,41 @@
+
+CREATE TABLE coba_person_risk_property (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY   (id)
+);
+
+ALTER TABLE coba_person_risk_property ADD COLUMN name_property VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN address VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN amount NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN price_purchase NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN date_acquire DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN name_owner VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN income_rental NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN amount_loan NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN rate_loan_to_value NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN month_loan INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN rate_current_interest NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN name_bank VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN date_started DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN date_sale DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN rate_growth NUMERIC NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN renovation MEDIUMTEXT NOT NULL DEFAULT '';
+
+ALTER TABLE coba_person_risk_property ADD COLUMN break_even INT NOT NULL DEFAULT 0;
+
+ALTER TABLE coba_person_risk_property ADD COLUMN coba_person_risk_id INT(11) NOT NULL DEFAULT 0;
diff --git a/Pman/Coba/sql/coba_state.sql b/Pman/Coba/sql/coba_state.sql
new file mode 100644 (file)
index 0000000..5450e3e
--- /dev/null
@@ -0,0 +1,9 @@
+
+CREATE TABLE coba_state (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_state ADD COLUMN country_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_state ADD COLUMN name VARCHAR(254) NOT NULL DEFAULT '';
+
diff --git a/Pman/Coba/sql/coba_user_declarations.sql b/Pman/Coba/sql/coba_user_declarations.sql
new file mode 100644 (file)
index 0000000..c72c90e
--- /dev/null
@@ -0,0 +1,13 @@
+
+RENAME TABLE coba_user_declarations TO coba_investor_declarations;
+
+CREATE TABLE coba_investor_declarations (
+  id int(11) NOT NULL auto_increment,
+  PRIMARY KEY  (id)
+) ;
+
+ALTER TABLE coba_investor_declarations ADD COLUMN user_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_declarations ADD COLUMN dec_id INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_declarations ADD COLUMN is_agreed INT(2) NOT NULL DEFAULT 0;
+ALTER TABLE coba_investor_declarations ADD COLUMN agreed_dt DATE NOT NULL DEFAULT '0000-00-00';
+
diff --git a/Pman/Coba/sql/events.sql b/Pman/Coba/sql/events.sql
new file mode 100644 (file)
index 0000000..fa0d432
--- /dev/null
@@ -0,0 +1,7 @@
+
+-- ALTER TABLE Events ADD COLUMN coba_investor_id int(11)  NOT NULL;
+
+ALTER TABLE Events DROP COLUMN coba_investor_id;
+
+ALTER TABLE Events ADD COLUMN modx_users_id int(11)  NOT NULL;
+
diff --git a/Pman/Coba/sql/ext_data.sql b/Pman/Coba/sql/ext_data.sql
new file mode 100644 (file)
index 0000000..88b4baf
--- /dev/null
@@ -0,0 +1,197 @@
+-- schema modifications for ext_data ... since modx does not appear to have a 'update database' method..
+
+ALTER TABLE ext_data ADD COLUMN date_of_issue DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE ext_data ADD COLUMN date_of_issue_partner DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE ext_data ADD COLUMN in_lived_in_us enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_lived_in_us in_lived_in_us enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_owner_of_us_business enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_owner_of_us_business in_owner_of_us_business enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_filing_us_tax_return enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_filing_us_tax_return in_filing_us_tax_return enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_have_us_tax_id enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_have_us_tax_id in_have_us_tax_id enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_lived_in_us_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_lived_in_us_second in_lived_in_us_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_owner_of_us_business_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_owner_of_us_business in_owner_of_us_business enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_filing_us_tax_return_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_filing_us_tax_return_second in_filing_us_tax_return_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN in_have_us_tax_id_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN in_have_us_tax_id_second in_have_us_tax_id_second enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN companies_domicile VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN companies_registration_number VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN date_of_incorporation DATE NOT NULL;
+
+ALTER TABLE ext_data ADD COLUMN exchange_traded_on VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN stock_symbol VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN is_listed_company enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN is_listed_company is_listed_company enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN other_companies_domicile VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN countries_of_tax_residence TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN countries_of_tax_residence_second TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN countries_of_tax_residence_other TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN countries_of_tax_residence_second_other TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data CHANGE COLUMN date_of_expiry date_of_expiry DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE ext_data CHANGE COLUMN date_of_expiry_partner date_of_expiry_partner DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE ext_data CHANGE COLUMN name_of_director name_of_director TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN kyc_industry TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN kyc_product_services TEXT NOT NULL DEFAULT '';
+
+-- ALTER TABLE ext_data ADD COLUMN investment_advisor TEXT NOT NULL DEFAULT '';
+--
+-- ALTER TABLE ext_data ADD COLUMN investment_advisor_second_ap TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN social_security_number VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN social_security_number_second_ap VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN id_card_number VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN id_card_date_of_issue DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE ext_data ADD COLUMN not_have_passport INT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE ext_data ADD COLUMN not_have_id_card INT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE ext_data ADD COLUMN id_card_number_ap2 VARCHAR(100) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN id_card_date_of_issue_ap2 DATE NOT NULL DEFAULT '0000-00-00';
+
+ALTER TABLE ext_data ADD COLUMN not_have_passport_ap2 INT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE ext_data ADD COLUMN not_have_id_card_ap2 INT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE ext_data ADD COLUMN current_occupation VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN employers_name VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN current_occupation_ap2 VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN employers_name_ap2 VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN anti_money_laundering VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN anti_money_laundering_second_ap VARCHAR(254) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN is_third_party_account enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN is_third_party_account_second_ap enum('yes','no', '') NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN third_party_account_explanation TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN third_party_account_explanation_second_ap TEXT NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data DROP COLUMN stepfour;
+ALTER TABLE ext_data DROP COLUMN stepfive;
+ALTER TABLE ext_data DROP COLUMN stepsix;
+ALTER TABLE ext_data DROP COLUMN stepseven;
+
+ALTER TABLE ext_data ADD COLUMN is_submit INT(1) NOT NULL DEFAULT 0;
+
+ALTER TABLE ext_data ADD COLUMN submit_dt DATE NOT NULL DEFAULT '0000-00-00';
+
+
+ALTER TABLE ext_data CHANGE COLUMN in_username in_username VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_middlename in_middlename VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN company_name company_name VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_other_nationality in_other_nationality VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_district in_district VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_other_country in_other_country VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_correspondence_addressline1 in_correspondence_addressline1 VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_correspondence_addressline2 in_correspondence_addressline2 VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_correspondence_district in_correspondence_district VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_correspondence_city in_correspondence_city VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_correspondence_country in_correspondence_country VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_other_corrcountry in_other_corrcountry VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_correspondence_postalcode in_correspondence_postalcode VARCHAR(25) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_usa_tin_number in_usa_tin_number VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_professional_investor_file in_professional_investor_file VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_pro_investor_original_file in_pro_investor_original_file VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_hk_sfc_file in_hk_sfc_file VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_hk_sfc_original_file in_hk_sfc_original_file VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_capital_summary in_capital_summary TEXT NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_bank_swift_code in_bank_swift_code VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_bank_iba in_bank_iba VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_bank_iban in_bank_iban VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_bank_district in_bank_district VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN in_bank_othercountry in_bank_othercountry VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN middlename_second_ap middlename_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN other_nationality_second_ap other_nationality_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN district_second_ap district_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN other_country_second_ap other_country_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN other_corr_country_second_ap other_corr_country_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN usa_tnumber_second_ap usa_tnumber_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN pofessional_investor_file_second_ap pofessional_investor_file_second_ap VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN pro_investor_original_file_second_ap pro_investor_original_file_second_ap VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN hk_sfc_file_second_ap hk_sfc_file_second_ap VARCHAR(254) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN hk_sfc_original_file_second_ap hk_sfc_original_file_second_ap VARCHAR(100) NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN capital_summary_second_ap capital_summary_second_ap TEXT NOT NULL DEFAULT '';
+
+
+ALTER TABLE ext_data DROP COLUMN investment_advisor;
+ALTER TABLE ext_data DROP COLUMN investment_advisor_second_ap;
+ALTER TABLE ext_data DROP COLUMN investment_advisor_second_id;
+
+ALTER TABLE ext_data ADD COLUMN investment_advisor_id INT(11) NOT NULL DEFAULT 0;
+
+
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_is_invest_acc_to_score INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_is_invest_to_diff_profile INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_invest_profile_id INT(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_is_consider_satellite INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_is_impose_restriction INT(2) NOT NULL DEFAULT -1;
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_restriction TEXT NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN risk_profile_restriction risk_profile_restriction VARCHAR(64) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_agreed_currency_id TEXT NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN risk_profile_agreed_currency_id risk_profile_agreed_currency_ids VARCHAR(64) NOT NULL DEFAULT '';
+
+ALTER TABLE ext_data ADD COLUMN risk_profile_agreed_portfolio TEXT NOT NULL DEFAULT '';
+ALTER TABLE ext_data CHANGE COLUMN risk_profile_agreed_portfolio risk_profile_agreed_portfolio VARCHAR(64) NOT NULL DEFAULT '';
+
+-- old version..
+ALTER TABLE ext_data DROP COLUMN mark_deleted_by;
+ALTER TABLE ext_data DROP COLUMN mark_deleted_date;
+
+ALTER TABLE ext_data ADD COLUMN deleted_by INT(11) NOT NULL DEFAULT 0;
+ALTER TABLE ext_data ADD COLUMN deleted_dt DATETIME NOT NULL DEFAULT '0000-00-00';
+
diff --git a/Pman/Coba/sql/modx_accountmgmts.sql b/Pman/Coba/sql/modx_accountmgmts.sql
new file mode 100644 (file)
index 0000000..a979b75
--- /dev/null
@@ -0,0 +1,74 @@
+ALTER TABLE modx_accountmgmts 
+    DROP COLUMN fund_term_ten_display,
+    DROP COLUMN fund_term_ten_desc,
+    DROP COLUMN fund_term_ten_title,
+    DROP COLUMN fund_term_nine_display,
+    DROP COLUMN fund_term_nine_desc,
+    DROP COLUMN fund_term_nine_title,
+    DROP COLUMN fund_term_eight_display,
+    DROP COLUMN fund_term_eight_desc,
+    DROP COLUMN fund_term_eight_title,
+    DROP COLUMN fund_term_seven_display,
+    DROP COLUMN fund_term_seven_desc,
+    DROP COLUMN fund_term_seven_title,
+    DROP COLUMN fund_term_six_display,
+    DROP COLUMN fund_term_six_desc,
+    DROP COLUMN fund_term_six_title,
+    DROP COLUMN fund_term_five_display,
+    DROP COLUMN fund_term_five_desc,
+    DROP COLUMN fund_term_five_title,
+    DROP COLUMN fund_term_four_display,
+    DROP COLUMN fund_term_four_desc,
+    DROP COLUMN fund_term_four_title,
+    DROP COLUMN fund_term_three_display,
+    DROP COLUMN fund_term_three_desc,
+    DROP COLUMN fund_term_three_title,
+    DROP COLUMN fund_term_two_display,
+    DROP COLUMN fund_term_two_desc,
+    DROP COLUMN fund_term_two_title,
+    DROP COLUMN fund_term_one_display,
+    DROP COLUMN fund_term_one_desc,
+    DROP COLUMN fund_term_one_title,
+    DROP COLUMN isin_original_code,
+    DROP COLUMN isin_document_ten_type,
+    DROP COLUMN isin_document_ten_title,
+    DROP COLUMN isin_document_ten_original_name,
+    DROP COLUMN isin_document_ten_name,
+    DROP COLUMN isin_document_nine_type,
+    DROP COLUMN isin_document_nine_title,
+    DROP COLUMN isin_document_nine_original_name,
+    DROP COLUMN isin_document_nine_name,
+    DROP COLUMN isin_document_eight_type,
+    DROP COLUMN isin_document_eight_title,
+    DROP COLUMN isin_document_eight_original_name,
+    DROP COLUMN isin_document_eight_name,
+    DROP COLUMN isin_document_seven_type,
+    DROP COLUMN isin_document_seven_title,
+    DROP COLUMN isin_document_seven_original_name,
+    DROP COLUMN isin_document_seven_name,
+    DROP COLUMN isin_document_six_type,
+    DROP COLUMN isin_document_six_title,
+    DROP COLUMN isin_document_six_original_name,
+    DROP COLUMN isin_document_six_name,
+    DROP COLUMN isin_document_five_type,
+    DROP COLUMN isin_document_five_title,
+    DROP COLUMN isin_document_five_original_name,
+    DROP COLUMN isin_document_five_name,
+    DROP COLUMN isin_document_four_type,
+    DROP COLUMN isin_document_four_title,
+    DROP COLUMN isin_document_four_original_name,
+    DROP COLUMN isin_document_four_name,
+    DROP COLUMN isin_document_three_type,
+    DROP COLUMN isin_document_three_title,
+    DROP COLUMN isin_document_three_original_name,
+    DROP COLUMN isin_document_three_name,
+    DROP COLUMN isin_document_two_type,
+    DROP COLUMN isin_document_two_title,
+    DROP COLUMN isin_document_two_original_name,
+    DROP COLUMN isin_document_two_name,
+    DROP COLUMN isin_document_one_type,
+    DROP COLUMN isin_document_one_title,
+    DROP COLUMN isin_document_one_original_name,
+    DROP COLUMN isin_document_one_name;
+    
+ALTER TABLE modx_accountmgmts ADD COLUMN is_active INT(2) NOT NULL DEFAULT 0;
\ No newline at end of file
diff --git a/Pman/Coba/sql/modx_site_content.sql b/Pman/Coba/sql/modx_site_content.sql
new file mode 100644 (file)
index 0000000..1c484ef
--- /dev/null
@@ -0,0 +1,3 @@
+
+-- full text indexes not supported...
+alter table  modx_site_content drop index content_ft_idx;
diff --git a/Pman/Coba/sql/modx_users.sql b/Pman/Coba/sql/modx_users.sql
new file mode 100644 (file)
index 0000000..c820d78
--- /dev/null
@@ -0,0 +1,4 @@
+-- schema modifications for modx_users
+
+-- ALTER TABLE modx_users ADD COLUMN investment_advisor TEXT DEFAULT '';
+ALTER TABLE modx_users DROP COLUMN investment_advisor;
diff --git a/Pman/Coba/templates/Pman.Tab.Coba.html b/Pman/Coba/templates/Pman.Tab.Coba.html
new file mode 100644 (file)
index 0000000..bd077bd
--- /dev/null
@@ -0,0 +1,34 @@
+  
+       
+         
+    
+
+        
+  <DIV class=" roo-layout-region roo-layout-panel roo-layout-panel-center" xbuilderid="roo-gen6" style="left: 0px; top: 0px; width: 1465px; height: 569px;">
+    <DIV unselectable="on" class="roo-unselectable roo-layout-panel-hd breadcrumb roo-layout-title-center" xbuilderid="roo-gen7" style="display: none;">
+      <SPAN class="roo-unselectable roo-layout-panel-hd-text" unselectable="on">Coba</SPAN>
+      <DIV class="roo-unselectable roo-layout-panel-hd-tools" unselectable="on" xbuilderid="roo-gen8"></DIV>
+    </DIV>
+    <DIV class="roo-layout-panel-body tab-content roo-tabs-top" xbuilderid="roo-gen9" style="overflow: hidden; height: 569px;">
+      <NAV class="navbar navbar-default" xbuilderid="roo-gen17">
+        <UL class="nav nav-tabs" role="tablist" xbuilderid="roo-gen18">
+          <LI xbuilderid="roo-gen22" class=" active">
+            <A href="#" xbuilderid="roo-gen20">
+              <SPAN unselectable="on" title="" xbuilderid="roo-gen21">Coba</SPAN>
+            </A>
+          </LI>
+        </UL>
+      </NAV>
+      <DIV id="tab-body19" class=" tab-content roo-layout-tabs-body" style="position: relative; height: 516px;">
+        <DIV xbuilderid="roo-gen10" class=" roo-layout-container roo-layout-nested-layout roo-layout-active-content tab-pane " xtype="Roo.bootstrap.panel.Nest" style="position: relative; display: block; zoom: 1; visibility: visible; width: 1465px; height: 516px;">
+          <DIV class=" roo-layout-region roo-layout-panel roo-layout-panel-center" xbuilderid="roo-gen13" style="left: 0px; top: 0px; width: 1465px; height: 516px;">
+            <DIV unselectable="on" class="roo-unselectable roo-layout-panel-hd breadcrumb roo-layout-title-center" xbuilderid="roo-gen14" style="display: none;">
+              <SPAN class="roo-unselectable roo-layout-panel-hd-text" unselectable="on"> </SPAN>
+              <DIV class="roo-unselectable roo-layout-panel-hd-tools" unselectable="on" xbuilderid="roo-gen15"></DIV>
+            </DIV>
+            <DIV class="roo-layout-panel-body tab-content" xbuilderid="roo-gen16" style="overflow: hidden; height: 516px;"></DIV>
+          </DIV>
+        </DIV>
+      </DIV>
+    </DIV>
+  </DIV>
diff --git a/Pman/Coba/templates/Pman.Tab.CobaFundManager.html b/Pman/Coba/templates/Pman.Tab.CobaFundManager.html
new file mode 100644 (file)
index 0000000..bbb4d82
--- /dev/null
@@ -0,0 +1,141 @@
+  
+       
+         
+    
+
+        
+  <DIV class=" roo-layout-region roo-layout-panel roo-layout-panel-center" xbuilderid="roo-gen6" style="left: 0px; top: 0px; width: 1465px; height: 503px;">
+    <DIV unselectable="on" class="roo-unselectable roo-layout-panel-hd breadcrumb roo-layout-title-center" xbuilderid="roo-gen7" style="display: none;">
+      <SPAN class="roo-unselectable roo-layout-panel-hd-text" unselectable="on">Fund Manager</SPAN>
+      <DIV class="roo-unselectable roo-layout-panel-hd-tools" unselectable="on" xbuilderid="roo-gen8"></DIV>
+    </DIV>
+    <DIV class="roo-layout-panel-body tab-content roo-tabs-top" xbuilderid="roo-gen9" style="overflow: hidden; height: 503px;">
+      <NAV class="navbar navbar-default" xbuilderid="roo-gen61">
+        <UL class="nav nav-tabs" role="tablist" xbuilderid="roo-gen62">
+          <LI xbuilderid="roo-gen66" class=" active">
+            <A href="#" xbuilderid="roo-gen64">
+              <SPAN unselectable="on" title="" xbuilderid="roo-gen65">Fund Manager</SPAN>
+            </A>
+          </LI>
+        </UL>
+      </NAV>
+      <DIV id="tab-body63" class=" tab-content roo-layout-tabs-body" style="position: relative; height: 450px;">
+        <DIV class="roo-layout-grid-wrapper  roo-layout-active-content tab-pane" xbuilderid="roo-gen10" xtype="Roo.bootstrap.panel.Grid" style="overflow: auto; position: relative; display: block; zoom: 1; visibility: visible;">
+          <DIV xbuilderid="roo-gen11">
+            <DIV class="navbar" xbuilderid="roo-comp-1002" style="width: 1463px;">
+              <UL class="nav navbar-nav"></UL>
+              <DIV class="x-dlg-mask" xbuilderid="roo-gen12" style="width: 3px; height: 50px; display: none;"></DIV>
+              <UL class="nav navbar-nav" xbuilderid="roo-comp-1004" style="width: 100%">
+                <LI class="nav-item" xbuilderid="roo-comp-1006" style="width: 100%;">
+                  <DIV class="container" xbuilderid="roo-comp-1008" style="width: 100%;">
+                    <DIV class="row clearfix" xbuilderid="roo-comp-1010" style="padding: 10px;">
+                      <DIV class="column col-md-2" xbuilderid="roo-comp-1012">
+                        <DIV class="form-group" xbuilderid="roo-comp-1014">
+                          <DIV class="input-group">
+                            <INPUT xbuilderid="roo-gen13" type="text" value="" class="form-control" placeholder="" autocomplete="new-password"></INPUT>
+                            <SPAN class="roo-input-after input-group-btn" xbuilderid="roo-gen20">
+                              <BUTTON class="btn roo-button btn-default" xbuilderid="roo-comp-1015">
+                                <SPAN class="roo-button-text">
+                                  <I class="fa fa-search"></I>
+                                </SPAN>
+                              </BUTTON>
+                            </SPAN>
+                          </DIV>
+                        </DIV>
+                      </DIV>
+                      <DIV class="column col-md-7" xbuilderid="roo-comp-1017"></DIV>
+                      <DIV class="column col-md-3" xbuilderid="roo-comp-1019">
+                        <DIV class="btn-group" xbuilderid="roo-comp-1021" style="float: right">
+                          <BUTTON class="btn roo-button btn-default" xbuilderid="roo-comp-1023">
+                            <SPAN class="roo-button-text">
+                              <I class="fa fa-plus"></I> Add
+                            </SPAN>
+                          </BUTTON>
+                        </DIV>
+                      </DIV>
+                    </DIV>
+                  </DIV>
+                </LI>
+              </UL>
+            </DIV>
+          </DIV>
+          <DIV xbuilderid="roo-comp-1025" class="table-fixed roo-layout-component-panel " style="width: 1465px; height: 379px;">
+            <TABLE class="table table-body-fixed table-hover table-responsive table-fixed">
+              <THEAD xbuilderid="roo-gen30">
+                <TR xbuilderid="roo-gen72" style="width: 1465px;">
+                  <TH style="" class="sortable col-md-3" sort="id" xbuilderid="roo-gen31">
+                    <I class="glyphicon"></I>ID
+                  </TH>
+                  <TH style="" class="sortable col-md-3" sort="isin_code" xbuilderid="roo-gen32">
+                    <I class="glyphicon"></I>Fund Code
+                  </TH>
+                  <TH style="" class="sortable col-md-3" sort="name" xbuilderid="roo-gen33">
+                    <I class="glyphicon"></I>Fund Name
+                  </TH>
+                  <TH style="" class="sortable col-md-3" sort="is_active" xbuilderid="roo-gen34">
+                    <I class="glyphicon"></I>Active
+                  </TH>
+                </TR>
+              </THEAD>
+              <TBODY xbuilderid="roo-gen29" style="width: 1465px; height: 276px;">
+                <TR xbuilderid="roo-gen73" style="width: 1465px;">
+                  <TD colspan="4"></TD>
+                </TR>
+              </TBODY>
+              <TFOOT xbuilderid="roo-gen71">
+                <TR xbuilderid="roo-gen74" style="width: 1465px;">
+                  <TD colspan="4">
+                    <DIV class="navbar" xbuilderid="roo-comp-1026">
+                      <UL class="nav navbar-nav"></UL>
+                      <DIV class="x-dlg-mask" xbuilderid="roo-gen41" style="width: 4066px; height: 50px; display: none;"></DIV>
+                      <UL class="nav navbar-nav pagination" xbuilderid="roo-comp-1027">
+                        <LI class="nav-item disabled prev" xbuilderid="roo-comp-1028">
+                          <A href="#" xbuilderid="roo-gen42" tooltip="First Page">
+                            <I class="fa fa-backward"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                        <LI class="nav-item disabled prev" xbuilderid="roo-comp-1029">
+                          <A href="#" xbuilderid="roo-gen44" tooltip="Previous Page">
+                            <I class="fa fa-step-backward"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                        <LI class="nav-item x-paging-position" xbuilderid="roo-comp-1030">
+                          <SPAN href="#" xbuilderid="roo-gen46">Page
+                            <INPUT type="text" size="3" value="1" class="x-grid-page-number" xbuilderid="roo-gen50"></INPUT>
+                            <SPAN class="x-paging-after" xbuilderid="roo-gen47">of 1</SPAN>
+                          </SPAN>
+                        </LI>
+                        <LI class="nav-item disabled next" xbuilderid="roo-comp-1031">
+                          <A href="#" xbuilderid="roo-gen53" tooltip="Next Page"> 
+                            <I class="fa fa-step-forward"></I>
+                          </A>
+                        </LI>
+                        <LI class="nav-item disabled next" xbuilderid="roo-comp-1032">
+                          <A href="#" xbuilderid="roo-gen55" tooltip="Last Page">
+                            <I class="fa fa-forward"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                        <LI class="nav-item" xbuilderid="roo-comp-1033">
+                          <A href="#" xbuilderid="roo-gen57" tooltip="Refresh">
+                            <I class="fa fa-refresh"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                      </UL>
+                    </DIV>
+                  </TD>
+                </TR>
+              </TFOOT>
+            </TABLE>
+            <DIV class="roo-el-mask" xbuilderid="roo-gen69" style="z-index: 100; display: none;"></DIV>
+            <DIV class="roo-el-mask-msg roo-el-mask-msg" xbuilderid="roo-gen70" style="left: -15px; top: 69px; z-index: 102; display: none;">
+              <DIV>Loading...</DIV>
+            </DIV>
+          </DIV>
+        </DIV>
+      </DIV>
+    </DIV>
+  </DIV>
diff --git a/Pman/Coba/templates/Pman.Tab.CobaInvestors.html b/Pman/Coba/templates/Pman.Tab.CobaInvestors.html
new file mode 100644 (file)
index 0000000..742f12a
--- /dev/null
@@ -0,0 +1,131 @@
+  
+       
+         
+    
+
+        
+  <DIV class=" roo-layout-region roo-layout-panel roo-layout-panel-center" xbuilderid="roo-gen6" style="left: 0px; top: 0px; width: 1462px; height: 512px;">
+    <DIV unselectable="on" class="roo-unselectable roo-layout-panel-hd breadcrumb roo-layout-title-center" xbuilderid="roo-gen7" style="display: none;">
+      <SPAN class="roo-unselectable roo-layout-panel-hd-text" unselectable="on">Investors</SPAN>
+      <DIV class="roo-unselectable roo-layout-panel-hd-tools" unselectable="on" xbuilderid="roo-gen8"></DIV>
+    </DIV>
+    <DIV class="roo-layout-panel-body tab-content roo-tabs-top" xbuilderid="roo-gen9" style="overflow: hidden; height: 512px;">
+      <NAV class="navbar navbar-default" xbuilderid="roo-gen60">
+        <UL class="nav nav-tabs" role="tablist" xbuilderid="roo-gen61">
+          <LI xbuilderid="roo-gen65" class=" active">
+            <A href="#" xbuilderid="roo-gen63">
+              <SPAN unselectable="on" title="" xbuilderid="roo-gen64">Investors</SPAN>
+            </A>
+          </LI>
+        </UL>
+      </NAV>
+      <DIV id="tab-body62" class=" tab-content roo-layout-tabs-body" style="position: relative; height: 459px;">
+        <DIV class="roo-layout-grid-wrapper  roo-layout-active-content tab-pane" xbuilderid="roo-gen10" xtype="Roo.bootstrap.panel.Grid" style="overflow: auto; position: relative; display: block; zoom: 1; visibility: visible;">
+          <DIV xbuilderid="roo-gen11">
+            <DIV class="navbar" xbuilderid="roo-comp-1002" style="width: 1460px;">
+              <UL class="nav navbar-nav"></UL>
+              <DIV class="x-dlg-mask" xbuilderid="roo-gen12" style="width: 3px; height: 50px; display: none;"></DIV>
+              <UL class="nav navbar-nav" xbuilderid="roo-comp-1004">
+                <LI class="nav-item" xbuilderid="roo-comp-1006" style="float: left">
+                  <BUTTON class="btn roo-button btn-primary" xbuilderid="roo-comp-1008" style="margin:10px;">
+                    <SPAN class="roo-button-text">Create Investor</SPAN>
+                  </BUTTON>
+                  <BUTTON class="btn roo-button btn-primary" xbuilderid="roo-comp-1010" style="margin:10px;">
+                    <SPAN class="roo-button-text">Import Investor</SPAN>
+                  </BUTTON>
+                </LI>
+                <LI class="nav-item" xbuilderid="roo-comp-1012" style="float: right; width: 250px">
+                  <DIV class="" xbuilderid="roo-comp-1014">
+                    <FORM method="POST" xbuilderid="roo-comp-1016" class="">
+                      <DIV class="form-group" xbuilderid="roo-comp-1018" style="margin:10px;" name="search_filter">
+                        <DIV class="input-group">
+                          <INPUT xbuilderid="roo-gen17" type="input" value="" class="form-control" placeholder="Search for investor" autocomplete="new-password" name="search_filter"></INPUT>
+                          <SPAN class="roo-input-after input-group-addon">
+                            <I class="fa fa-search" arian-hidden="true"></I>
+                          </SPAN>
+                        </DIV>
+                      </DIV>
+                    </FORM>
+                  </DIV>
+                </LI>
+              </UL>
+            </DIV>
+          </DIV>
+          <DIV xbuilderid="roo-comp-1020" class="table-fixed roo-layout-component-panel " style="width: 1462px; height: 403px;">
+            <TABLE class="table table-body-fixed table-hover table-responsive table-fixed">
+              <THEAD xbuilderid="roo-gen37">
+                <TR xbuilderid="roo-gen71" style="width: 1850px;">
+                  <TH style=" width:50px;" sort="userdata_id">ID</TH>
+                  <TH style=" width:300px;" sort="full_name">Name</TH>
+                  <TH style=" display:none; width:300px;" sort="company_name">Company Name</TH>
+                  <TH style=" width:100px;" sort="account_type">Type</TH>
+                  <TH style=" width:300px;" sort="in_email">Email</TH>
+                  <TH style=" width:150px;" sort="in_contact_number">Phone</TH>
+                  <TH style=" width:150px;" sort="investment_advisor_id_name">Investment Advisor</TH>
+                  <TH style=" display:none;" sort="account_type"></TH>
+                  <TH style=" display:none;" sort="fund_name"></TH>
+                  <TH style=" width:300px;" sort="is_submit">Status</TH>
+                </TR>
+              </THEAD>
+              <TBODY xbuilderid="roo-gen36" style="width: 1462px; height: 300px;">
+                <TR xbuilderid="roo-gen72" style="width: 1850px;">
+                  <TD colspan="10"></TD>
+                </TR>
+              </TBODY>
+              <TFOOT xbuilderid="roo-gen70">
+                <TR xbuilderid="roo-gen73" style="width: 1850px;">
+                  <TD colspan="10">
+                    <DIV class="navbar" xbuilderid="roo-comp-1021">
+                      <UL class="nav navbar-nav"></UL>
+                      <DIV class="x-dlg-mask" xbuilderid="roo-gen40" style="width: 1334px; height: 50px; display: none;"></DIV>
+                      <UL class="nav navbar-nav pagination" xbuilderid="roo-comp-1022">
+                        <LI class="nav-item disabled prev" xbuilderid="roo-comp-1023">
+                          <A href="#" xbuilderid="roo-gen41" tooltip="First Page">
+                            <I class="fa fa-backward"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                        <LI class="nav-item disabled prev" xbuilderid="roo-comp-1024">
+                          <A href="#" xbuilderid="roo-gen43" tooltip="Previous Page">
+                            <I class="fa fa-step-backward"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                        <LI class="nav-item x-paging-position" xbuilderid="roo-comp-1025">
+                          <SPAN href="#" xbuilderid="roo-gen45">Page
+                            <INPUT type="text" size="3" value="1" class="x-grid-page-number" xbuilderid="roo-gen49"></INPUT>
+                            <SPAN class="x-paging-after" xbuilderid="roo-gen46">of 1</SPAN>
+                          </SPAN>
+                        </LI>
+                        <LI class="nav-item disabled next" xbuilderid="roo-comp-1026">
+                          <A href="#" xbuilderid="roo-gen52" tooltip="Next Page"> 
+                            <I class="fa fa-step-forward"></I>
+                          </A>
+                        </LI>
+                        <LI class="nav-item disabled next" xbuilderid="roo-comp-1027">
+                          <A href="#" xbuilderid="roo-gen54" tooltip="Last Page">
+                            <I class="fa fa-forward"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                        <LI class="nav-item" xbuilderid="roo-comp-1028">
+                          <A href="#" xbuilderid="roo-gen56" tooltip="Refresh">
+                            <I class="fa fa-refresh"></I> 
+                            <SPAN></SPAN>
+                          </A>
+                        </LI>
+                      </UL>
+                    </DIV>
+                  </TD>
+                </TR>
+              </TFOOT>
+            </TABLE>
+            <DIV class="roo-el-mask" xbuilderid="roo-gen68" style="z-index: 100; display: none;"></DIV>
+            <DIV class="roo-el-mask-msg roo-el-mask-msg" xbuilderid="roo-gen69" style="left: -15px; top: 69px; z-index: 102; display: none;">
+              <DIV>Loading...</DIV>
+            </DIV>
+          </DIV>
+        </DIV>
+      </DIV>
+    </DIV>
+  </DIV>
diff --git a/Pman/Coba/templates/application-summary-corporate.html b/Pman/Coba/templates/application-summary-corporate.html
new file mode 100644 (file)
index 0000000..7552ce8
--- /dev/null
@@ -0,0 +1,169 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12 app-sum-body-user-name-container">
+            <span class="app-sum-body-user-name">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="app-sum-body-ref">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="app-sum-body-ref">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+                {sectionKey}
+            </span>
+        </div>
+    </div>
+
+    {foreach:sections,applicants}
+        <!-- switching for specific sections -->
+
+        <!-- director section -->
+        {if:is_director_section(sectionKey)}
+            {foreach:data_director,directorKey,director}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">
+                            Director {modifyClientNumber(directorKey)}
+                        </span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(director,row,0)}
+                {end:}
+            </table>
+            {end:}
+
+        <!-- individual shareholder section -->
+        {else:}
+        {if:is_individual_shareholder(sectionKey)}
+            {save_buffer_for_individual_shareholder(applicants)}
+            {foreach:data_individual_shareholder,individual_shareholder_key,individual_shareholder}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">Individual Shareholder {modifyClientNumber(individual_shareholder_key)}</span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(individual_shareholder,row,0)}
+                {end:}
+            </table>
+            {end:}
+
+        <!-- corporate shareholder section -->
+        {else:}
+        {if:is_company_shareholder(sectionKey)}
+            {save_buffer_for_company_shareholder(applicants)}
+            {foreach:data_company_shareholder,company_shareholder_key,company_shareholder}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">Company Shareholder {modifyClientNumber(company_shareholder_key)}</span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(company_shareholder,row,0)}
+                {end:}
+            </table>
+                {print_shareholder_of_shareholder(company_shareholder,0)}
+            {end:}
+
+        <!-- default section -->
+        {else:}
+        <table class="app-sum-body-indi-data-table">
+            {foreach:applicants,row}
+            {if:checkDependency(row)}
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {row[Label]}
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {outputQuestionByType(row)}
+                    </td>
+                </tr>
+            {end:}
+            {end:}
+
+        </table>
+        {end:}
+        {end:}
+        {end:}
+        <!-- swiching end -->
+    {end:}
+
+    {end:}
+    {end:}
+
+    <!--declaration section-->
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+                Declaration
+            </span>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:declarations,declaration}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {declaration.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:declaration.is_agreed}
+                <span class='glyphicon glyphicon-check app-sum-icon'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+    <!--document section-->
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+                Documents
+            </span>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:documents,document}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {document.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                 {if:document.images_ids}
+                <span class='glyphicon glyphicon-check app-sum-icon'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+
+    </div>
diff --git a/Pman/Coba/templates/application-summary-individual.html b/Pman/Coba/templates/application-summary-individual.html
new file mode 100644 (file)
index 0000000..60fc1be
--- /dev/null
@@ -0,0 +1,101 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12 app-sum-body-user-name-container">
+            <span class="app-sum-body-user-name">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="app-sum-body-ref">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="app-sum-body-ref">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+            {sectionKey}
+            </span>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:sections,applicants}
+    {foreach:applicants,row}
+    {if:checkDependency(row)}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {row[Label]}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {outputQuestionByType(row)}
+            </td>
+        </tr>
+    {end:}
+    {end:}
+    {end:}
+    </table>
+{end:}
+{end:}
+
+<!--declaration section-->
+<div class="row">
+    <div class="col-md-12 app-sum-body-section-container">
+        <span class="app-sum-body-section">
+            Declaration
+        </span>
+    </div>
+</div>
+<table class="app-sum-body-indi-data-table">
+{foreach:declarations,declaration}
+    <tr class="app-sum-body-indi-data-row">
+        <td class="col-md-6 app-sum-body-indi-data">
+            {declaration.title}
+        </td>
+        <td class="col-md-6 app-sum-body-indi-data">
+            {if:declaration.is_agreed}
+            <span class='glyphicon glyphicon-check app-sum-icon'></span>
+            {else:}
+            <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+            {end:}
+        </td>
+    </tr>
+{end:}
+</table>
+
+<!--document section-->
+<div class="row">
+    <div class="col-md-12 app-sum-body-section-container">
+        <span class="app-sum-body-section">
+            Documents
+        </span>
+    </div>
+</div>
+<table class="app-sum-body-indi-data-table">
+{foreach:documents,document}
+    <tr class="app-sum-body-indi-data-row">
+        <td class="col-md-6 app-sum-body-indi-data">
+            {document.title}
+        </td>
+        <td class="col-md-6 app-sum-body-indi-data">
+             {if:document.images_ids}
+            <span class='glyphicon glyphicon-check app-sum-icon'></span>
+            {else:}
+            <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+            {end:}
+        </td>
+    </tr>
+{end:}
+</table>
+
+
+</div>
diff --git a/Pman/Coba/templates/application-summary-joint.html b/Pman/Coba/templates/application-summary-joint.html
new file mode 100644 (file)
index 0000000..99d3e52
--- /dev/null
@@ -0,0 +1,110 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12 app-sum-body-user-name-container">
+            <span class="app-sum-body-user-name">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="app-sum-body-ref">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="app-sum-body-ref">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+                {sectionKey}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+    {foreach:sections,applicantNum,applicants}
+        <div class="col-md-6">
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        Client {applicantNum}
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                {if:checkDependency(row)}
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {row[Label]}
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {outputQuestionByType(row)}
+                    </td>
+                </tr>
+                {end:}
+                {end:}
+            </table>
+        </div>
+    {end:}
+    </div>
+    {end:}
+    {end:}
+
+    <!--declaration section-->
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+                Declaration
+            </span>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:declarations,declaration}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {declaration.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:declaration.is_agreed}
+                <span class='glyphicon glyphicon-check app-sum-icon'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+    <!--document section-->
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+                Documents
+            </span>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:documents,document}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {document.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                 {if:document.images_ids}
+                <span class='glyphicon glyphicon-check app-sum-icon'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+
+    </div>
diff --git a/Pman/Coba/templates/application-summary-master-footer.html b/Pman/Coba/templates/application-summary-master-footer.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Pman/Coba/templates/application-summary-master-head.html b/Pman/Coba/templates/application-summary-master-head.html
new file mode 100644 (file)
index 0000000..9a52fb4
--- /dev/null
@@ -0,0 +1,10 @@
+
+<head>
+    <title>Application Summary</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <link href='{rootURL}/Coba/Clients/{client_dir}/css/custom.css' rel='stylesheet' />
+    <link href='{rootURL}/Coba/Clients/{client_dir}/css/theme.css' rel='stylesheet' />  
+    <link href='{rootURL}/roojs1/css-bootstrap/bootstrap.min.css' rel='stylesheet'>
+    <link href='{rootURL}/Pman/Coba/templates/css/lexis-nexis.css' rel='stylesheet'>
+    <link href='{rootURL}/Pman/Coba/templates/css/report.css' rel='stylesheet'>
+</head>
diff --git a/Pman/Coba/templates/application-summary-master-simple.html b/Pman/Coba/templates/application-summary-master-simple.html
new file mode 100644 (file)
index 0000000..16e96cf
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:html="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+    <flexy:include src="application-summary-master-head.html"></flexy:include>
+
+    <body class="ytheme-gray app-sum-body" xtype="Roo.bootstrap.Body">
+
+        
+        <!--header end-->
+
+        <!--body for different account_types-->
+        {outputBody()}
+        <!--body end-->
+
+        <!--footer start-->
+        
+        <!--footer end-->
+    </body>
+
+    <flexy:include src="application-summary-master-footer.html"></flexy:include>
+
+</html>
diff --git a/Pman/Coba/templates/application-summary-master.html b/Pman/Coba/templates/application-summary-master.html
new file mode 100644 (file)
index 0000000..53eefdd
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:html="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+    <flexy:include src="application-summary-master-head.html"></flexy:include>
+
+    <body class="ytheme-gray app-sum-body" xtype="Roo.bootstrap.Body">
+
+        <!--header start-->
+        <div class="container">
+            <div class="row">
+                <div class="col-md-12 app-sum-header-logo-container">                    
+                    <div class="col-md-12 app-logo">
+                    </div>                                        
+                </div>
+            </div>            
+            <div class="row">
+                <div class="col-md-12 app-sum-header-address-container">
+                    <span class="client-company-name"></span> <span class="client-parent-company-name"></span><br />
+                        <span class="client-address"></span>
+                </div>
+            </div>
+            <div class="row">
+                <div class="col-md-12 app-sum-header-note-container">
+                <strong>Note: </strong>
+                    <span class="client-company-name"></span> are committed to ensuring that any personal data received is safeguarded against unauthorized disclosure.  
+                    The data provided herein is subject to the provisions of the Personal Data (Privacy) Ordinance (Cap. 486, Laws of Hong Kong).  
+                    This means that we will not disclose any personal data unless we have given written authorization to do so, or unless the disclosure is 
+                    otherwise permitted under the provisions of the Personal Data (Privacy) Ordinance.<br />
+                    The information collected in this report has been submitted on a voluntary basis. In no event, will <span class="client-company-name"></span>, 
+                    its related entities, or the partners or employees thereof be liable to the recipient or anyone else for any decision made or action taken in 
+                    reliance on the information supplied below.
+               </div>
+           </div>
+            <div class="row">
+                <div class="col-md-12 text-primary text-uppercase">
+                    <span class="app-sum-header-date">REPORT DATE: {report_date}</span>
+                </div>
+            </div>
+            <br>
+        </div>
+        <!--header end-->
+
+        <!--body for different account_types-->
+        {outputBody()}
+        <!--body end-->
+
+        <!--footer start-->
+        <flexy:include src="{client_dir}/report-footer.html"></flexy:include>        
+        <!--footer end-->
+    </body>
+
+    <flexy:include src="application-summary-master-footer.html"></flexy:include>
+
+</html>
diff --git a/Pman/Coba/templates/application_summary.html b/Pman/Coba/templates/application_summary.html
new file mode 100644 (file)
index 0000000..3fe35e4
--- /dev/null
@@ -0,0 +1,26 @@
+<html>
+
+<div class = "container summary-container">
+    <!--header-->
+    <div class = "row summary-header">
+        <div class = "col-md-12">
+            <img src="{rootURL}/assets/themes/img/logo.png" width='200px'>
+        </div>
+    </div>
+    <!--body-->
+    {outputSection(summary)}
+    <!--footer-->
+    <div class = "row summary-footer">
+        <div class = "col-md-4 summary-footer-address">
+            <h5>1001-2 Wilson House,</h5>
+            <h5>19 Wyndham Street,</h5>
+            <h5>Central, Hong Kong</h5>
+        </div>
+        <div class = "col-md-4 summary-footer-email">
+            <h5>E: info@veridate.asia</h5>
+        </div>
+        <div class = "col-md-4 summary-footer-web">
+            <h5>www.veridate.asia</h5>
+        </div>
+    </div>
+</div>
diff --git a/Pman/Coba/templates/capital_company/report-footer.html b/Pman/Coba/templates/capital_company/report-footer.html
new file mode 100644 (file)
index 0000000..04c3f71
--- /dev/null
@@ -0,0 +1,19 @@
+        <div class="container">
+            <div class="row app-sum-footer-container">
+                <div class="col-md-12">
+                    <table>
+                        <tr>
+                            <td class="col-md-2 app-sum-footer-cib-container">
+                                <img class="app-sum-footer-cib" src="{rootURL}/Coba/Clients/capital_company/cib.png" />
+                            </td>
+                            <td class="col-md-10 app-sum-footer-text">
+                                <span class="app-sum-footer-capcomp"><span class="client-company-name"></span></span>.                                                                 
+                                Licensed by the Hong Kong Securities and Futures Commission. CE. No BIH 055
+                                <br />
+                                <span class="app-sum-footer-procomp">The Protection Company Hong Kong Limited</span>. Member of the Hong Kong Confederation of Insurance Brokers. Reg. 0442
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+        </div>
\ No newline at end of file
diff --git a/Pman/Coba/templates/capital_company/report-header.html b/Pman/Coba/templates/capital_company/report-header.html
new file mode 100644 (file)
index 0000000..f52fc76
--- /dev/null
@@ -0,0 +1,18 @@
+<div class="row">
+    <div class="col-md-12 app-sum-header-address-container">
+    <span class="client-company-name"></span> <span class="client-parent-company-name"></span><br />
+                    <span class="client-address"></span>
+    </div>
+</div>
+<div class="row">
+    <div class="col-md-12 app-sum-header-note-container">
+    <strong>Note: </strong>
+    <span class="client-company-name"></span> are committed to ensuring that any personal data received is safeguarded against unauthorized disclosure.  
+                    The data provided herein is subject to the provisions of the Personal Data (Privacy) Ordinance (Cap. 486, Laws of Hong Kong).  
+                    This means that we will not disclose any personal data unless we have given written authorization to do so, or unless the disclosure is 
+                    otherwise permitted under the provisions of the Personal Data (Privacy) Ordinance.<br />
+                    The information collected in this report has been submitted on a voluntary basis. In no event, will <span class="client-company-name"></span>, 
+                    its related entities, or the partners or employees thereof be liable to the recipient or anyone else for any decision made or action taken in 
+                    reliance on the information supplied below.
+    </div>
+</div>
diff --git a/Pman/Coba/templates/client-summary-corporate.html b/Pman/Coba/templates/client-summary-corporate.html
new file mode 100644 (file)
index 0000000..8c2e2ed
--- /dev/null
@@ -0,0 +1,158 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="text-primary text-uppercase">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    {if:is_show_section(sectionKey)}
+     <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                {renderSectionKey(sectionKey):h}
+            </span>
+            </div>
+        </div>
+    </div>
+    {end:}
+     
+    {foreach:sections,applicants}
+       
+        {if:is_show_section(sectionKey)}                 
+         <!-- switching for specific sections -->                 
+        <!-- director section -->
+        {if:is_director_section(sectionKey)}
+            {foreach:data_director,directorKey,director}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">
+                            Director {modifyClientNumber(directorKey)}
+                        </span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(director,row,0)}
+                {end:}
+            </table>
+            {end:}
+
+        <!-- individual shareholder section -->
+        {else:}
+        {if:is_individual_shareholder(sectionKey)}
+            {save_buffer_for_individual_shareholder(applicants)}
+            {foreach:data_individual_shareholder,individual_shareholder_key,individual_shareholder}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">Shareholder : Individual {modifyClientNumber(individual_shareholder_key)}</span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(individual_shareholder,row,0)}
+                {end:}
+            </table>
+            {end:}
+
+        <!-- corporate shareholder section -->
+        {else:}
+        {if:is_company_shareholder(sectionKey)}
+            {save_buffer_for_company_shareholder(applicants)}
+            {foreach:data_company_shareholder,company_shareholder_key,company_shareholder}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">Shareholder : Company {modifyClientNumber(company_shareholder_key)}</span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_com_label_and_data(company_shareholder,row,0)}
+                {end:}
+            </table>
+                {print_shareholder_of_shareholder(company_shareholder,0)}
+            {end:}
+
+        <!-- default section -->
+        {else:}
+        <table class="app-sum-body-indi-data-table">
+            {foreach:applicants,row}
+            {if:checkDependency(row)}
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {renderRowLabel(row):h}
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {outputQuestionByType(row):h}
+                    </td>
+                </tr>
+            {end:}
+            {end:}
+
+        </table>
+        {end:}
+        {end:}
+        {end:}
+        <!-- swiching end -->
+        
+         <!-- section check end -->        
+        {end:}
+
+    {end:}
+
+    {end:}
+    {end:}
+
+    <!--declaration section-->
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                Declaration
+            </span>
+            </div>
+        </div>    
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:declarations,declaration}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {declaration.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:declaration.is_agreed}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+
+
+
+
+    </div>
diff --git a/Pman/Coba/templates/client-summary-individual.html b/Pman/Coba/templates/client-summary-individual.html
new file mode 100644 (file)
index 0000000..9102d94
--- /dev/null
@@ -0,0 +1,90 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+     {if:is_show_section(sectionKey)}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+            {sectionKey}
+            </span>
+            </div>
+        </div>
+    </div>
+  
+    
+    <table class="app-sum-body-indi-data-table">
+    {foreach:sections,applicants}
+    {foreach:applicants,row}
+    {if:checkDependency(row)}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {renderRowLabel(row):h}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {outputQuestionByType(row):h}
+            </td>
+        </tr>
+    {end:}
+    {end:}
+    {end:}
+    
+    {end:}
+      <!-- section check end --> 
+    </table>
+{end:}
+{end:}
+
+<!--declaration section-->
+<div class="row">
+    <div class="col-md-12 panel-primary report_heading text-uppercase">
+        <div class="panel-heading">
+        <span>
+            Declaration
+        </span>
+        </div>
+    </div>
+</div>
+
+<table class="app-sum-body-indi-data-table">
+{foreach:declarations,declaration}
+    <tr class="app-sum-body-indi-data-row">
+        <td class="col-md-6 app-sum-body-indi-data">
+            {declaration.title}
+        </td>
+        <td class="col-md-6 app-sum-body-indi-data">
+            {if:declaration.is_agreed}
+            <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+            <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+        </td>
+    </tr>
+{end:}
+</table>
+
+
+
+
+
+</div>
diff --git a/Pman/Coba/templates/client-summary-joint.html b/Pman/Coba/templates/client-summary-joint.html
new file mode 100644 (file)
index 0000000..482e4a6
--- /dev/null
@@ -0,0 +1,98 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">            
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="text-primary text-uppercase">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="app-sum-body-ref">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+     {if:is_show_section(sectionKey)}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                {sectionKey}
+            </span>
+            </div>
+        </div>
+    </div>
+   
+     
+    <div class="row">
+    {foreach:sections,applicantNum,applicants}
+        <div class="col-md-6">
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        Client {applicantNum}
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                {if:checkDependency(row)}
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {renderRowLabel(row):h}
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {outputQuestionByType(row):h}
+                    </td>
+                </tr>
+                {end:}
+                {end:}
+            </table>
+        </div>
+    {end:}
+    </div>
+      <!-- section check end -->      
+      {end:}
+    
+    
+    {end:}
+    {end:}
+
+    <!--declaration section-->
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                Declaration
+            </span>
+            </div>
+        </div>    
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:declarations,declaration}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {declaration.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:declaration.is_agreed}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+
+
+
+    </div>
diff --git a/Pman/Coba/templates/compliance-individual.html b/Pman/Coba/templates/compliance-individual.html
new file mode 100644 (file)
index 0000000..1ac9132
--- /dev/null
@@ -0,0 +1,79 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12 app-sum-body-user-name-container">
+            <span class="app-sum-body-user-name">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="app-sum-body-ref">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="app-sum-body-ref">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    <div class="row">
+        <div class="col-md-12 app-sum-body-section-container">
+            <span class="app-sum-body-section">
+            {sectionKey}
+            </span>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:sections,applicants}
+    {foreach:applicants,row}
+    {if:checkDependency(row)}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {renderRowLabel(row):h}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {outputQuestionByType(row):h}
+            </td>
+        </tr>
+    {end:}
+    {end:}
+    {end:}
+    </table>
+{end:}
+{end:}
+
+<!--declaration section-->
+<div class="row">
+    <div class="col-md-12 app-sum-body-section-container">
+        <span class="app-sum-body-section">
+            Declaration
+        </span>
+    </div>
+</div>
+<table class="app-sum-body-indi-data-table">
+{foreach:declarations,declaration}
+    <tr class="app-sum-body-indi-data-row">
+        <td class="col-md-6 app-sum-body-indi-data">
+            {declaration.title}
+        </td>
+        <td class="col-md-6 app-sum-body-indi-data">
+            {if:declaration.is_agreed}
+            <span class='glyphicon glyphicon-check app-sum-icon'></span>
+            {else:}
+            <span class='glyphicon glyphicon-unchecked app-sum-icon'></span>
+            {end:}
+        </td>
+    </tr>
+{end:}
+</table>
+
+
+
+
+
+</div>
diff --git a/Pman/Coba/templates/compliance-report-corporate.html b/Pman/Coba/templates/compliance-report-corporate.html
new file mode 100644 (file)
index 0000000..9fa88b2
--- /dev/null
@@ -0,0 +1,534 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>  
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="text-primary text-uppercase">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    {if:is_show_section(sectionKey)}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">        
+            <span>
+                {renderSectionKey(sectionKey):h}
+            </span>
+            </div>
+        </div>
+    </div>
+    {end:}
+    
+    {foreach:sections,applicants}
+        <!-- switching for specific sections -->
+       
+       {if:is_show_section(sectionKey)}                
+        <!-- director section -->
+        {if:is_director_section(sectionKey)}
+            {foreach:data_director,directorKey,director}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">
+                            Director {modifyClientNumber(directorKey)}
+                        </span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(director,row,0)}
+                {end:}
+            </table>
+            {end:}
+
+        <!-- individual shareholder section -->
+        {else:}
+        {if:is_individual_shareholder(sectionKey)}
+            {save_buffer_for_individual_shareholder(applicants)}
+            {foreach:data_individual_shareholder,individual_shareholder_key,individual_shareholder}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">Shareholder : Individual {modifyClientNumber(individual_shareholder_key)}</span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_label_and_data(individual_shareholder,row,0)}
+                {end:}
+            </table>
+            {end:}
+
+        <!-- corporate shareholder section -->
+        {else:}
+        {if:is_company_shareholder(sectionKey)}
+            {save_buffer_for_company_shareholder(applicants)}
+            {foreach:data_company_shareholder,company_shareholder_key,company_shareholder}
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        <span class="app-sum-body-corp-title">Shareholder : Company {modifyClientNumber(company_shareholder_key)}</span>
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                    {print_com_label_and_data(company_shareholder,row,0)}                    
+                {end:}
+            </table>
+                {print_shareholder_of_shareholder(company_shareholder,0)}
+            {end:}
+
+        <!-- default section -->
+        {else:}
+        <table class="app-sum-body-indi-data-table">
+            {foreach:applicants,row}
+            {if:checkDependency(row)}
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {renderRowLabel(row):h}
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {outputQuestionByType(row):h}
+                    </td>
+                </tr>
+            {end:}
+            {end:}
+
+        </table>
+        {end:}
+        {end:}
+        {end:}
+        <!-- swiching end -->
+        
+         <!-- section check end -->        
+        {end:}
+    {end:}
+
+    {end:}
+    {end:}
+
+    <!--declaration section-->
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">        
+            <span>        
+                Declaration
+            </span>
+            </div>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:declarations,declaration}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {declaration.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:declaration.is_agreed}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+   <!--document section-->
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">        
+            <span>
+                Documents                        
+            </span>
+            </div>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:documents,document}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {document.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                 {if:document.images_ids}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    
+    </table>
+    
+    <!--3rd party compliance check section with page break-->
+   <p style="page-break-after: always;">&nbsp;</p>
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">            
+                3<SUP>RD</SUP> PARTY COMPLIANCE CHECK
+            </span>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12">           
+            <span class="text-primary text-uppercase">
+                <br>
+                Information Provider: LexisNexis Risk Solutions
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">           
+            <span class="app-sum-body-ref">
+            {if:t.nexisCompleted}
+                REPORT DATE: {t.nexisReportDate}
+            {end:}                
+            </span>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12 app-sum-header-note-container">
+            <br>
+            <strong>Disclaimer: </strong>
+           The information contained in the profile is derived from public sources. As certain content may be summarized, 
+           all information should be considered within the full content available in the third-party sources to which source links are provided. 
+           LexisNexis® is not responsible for content of third party sources. Relationships and categories are based on
+           information provided by third party sources and users should not draw negative conclusions from the display of relationships or categories.
+        </div>
+    </div>
+
+
+    <!--document section-->
+    {if:!t.nexisCompleted}
+        <div class="container">
+            <div class="row">
+                <div class="col-xs-12">
+                    <div class="alert alert-danger"><i class="glyphicon glyphicon-warning-sign"></i> Lexis Nexis has not been run yet</div>
+                </div>
+            </div>
+        </div>
+   {else:}
+        {if:!t.nexis_has_matches}
+            <div class="container well">
+                <div class="row">
+                    <div class="col-sm-12">
+                        No matches where found in the Database
+                    </div>
+                </div>
+            </div>
+        {else:}
+            
+            <div flexy:if="nexisMatches">
+
+                <div class="container well" flexy:foreach="nexisMatches,m">
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Source Date:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {t.formatDate(m.ResultDate,#m/d/Y#)}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Entity Type:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.EntityType}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Gender:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.Gender}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Entity Date:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Number:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.ListReferenceNumber}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Reason Listed:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.ReasonListed}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Comments:
+                        </div>
+                        <div class="col-sm-9">
+                            {t.comments(m.EntityDetails.Comments):h}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            IDs
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3 text-bold">
+                            {m.EntityDetails.IDs.EntityID.Type}:
+                        </div>
+                        <div class="col-sm-9">
+                            {m.EntityDetails.IDs.EntityID.Number}
+                        </div>
+                    </div>
+
+                    <div class="row" style="margin-top: 15px;">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            Addresses
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold">
+                            Address:
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3" style="padding-left: 30px;">
+                            Country:
+                        </div>
+                        <div class="col-sm-9">
+                            {m.EntityDetails.Addresses.EntityAddress.Country}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            Additional Information
+                        </div>
+                    </div>
+
+                    <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                        <div class="row">
+                            <div class="col-sm-3 text-bold">
+                                {t.nexis_infoKey(info)}
+                            </div>
+                            <div class="col-sm-9">
+                                {info.Value}
+                            </div>
+                        </div>
+
+                        <div class="row" flexy:if='info.Comments'>
+                            <div class="col-sm-3" style="padding-left: 30px;">
+                                Comments:
+                            </div>
+                            <div class="col-sm-9">
+                                {t.nexis_comments(info.Comments):h}
+                            </div>
+                        </div>
+
+                    </div>
+
+
+                </div>
+            </div>
+        
+            <div flexy:if="nexisRejected">
+
+                <div flexy:foreach="nexisRejected,m">
+                    
+                    <div class="container well">
+                        <div class="row">
+                            <div class="col-sm-12">
+                                <span>Result {m.EntityUniqueID} was flagged as not a match by {m.coba_investor_lexis_result.updated_by_name}</span>
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12">
+                                {m.coba_investor_lexis_result.reason:h}
+                            </div>
+                        </div>
+                        
+                        <div class="row">
+                            <div class="col-sm-12" style="background-color: #fff; color: #666666; margin-top: 10px;">
+                                
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Source Date:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {t.formatDate(m.ResultDate,#m/d/Y#)}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Entity Type:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.EntityType}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Gender:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.Gender}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Entity Date:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Number:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.ListReferenceNumber}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Reason Listed:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.ReasonListed}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Comments:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {t.comments(m.EntityDetails.Comments):h}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        IDs
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3 text-bold">
+                                        {m.EntityDetails.IDs.EntityID.Type}:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {m.EntityDetails.IDs.EntityID.Number}
+                                    </div>
+                                </div>
+
+                                <div class="row" style="margin-top: 15px;">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        Addresses
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold">
+                                        Address:
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3" style="padding-left: 30px;">
+                                        Country:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {m.EntityDetails.Addresses.EntityAddress.Country}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        Additional Information
+                                    </div>
+                                </div>
+
+                                <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                                    <div class="row">
+                                        <div class="col-sm-3 text-bold">
+                                            {t.nexis_infoKey(info)}
+                                        </div>
+                                        <div class="col-sm-9">
+                                            {info.Value}
+                                        </div>
+                                    </div>
+
+                                    <div class="row" flexy:if='info.Comments'>
+                                        <div class="col-sm-3" style="padding-left: 30px;">
+                                            Comments:
+                                        </div>
+                                        <div class="col-sm-9">
+                                            {t.nexis_comments(info.Comments):h}
+                                        </div>
+                                    </div>
+
+                                </div>
+
+                            </div>
+                            
+                        </div>
+                    </div>
+                    
+                </div>
+                
+            </div>
+        
+            
+        {end:}
+    
+   {end:}
+    
+</div>
diff --git a/Pman/Coba/templates/compliance-report-individual.html b/Pman/Coba/templates/compliance-report-individual.html
new file mode 100644 (file)
index 0000000..8a18964
--- /dev/null
@@ -0,0 +1,463 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>        
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="text-primary text-uppercase">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+
+
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+     {if:is_show_section(sectionKey)}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+            {sectionKey}
+            </span>
+            </div>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:sections,applicants}
+    {foreach:applicants,row}
+    {if:checkDependency(row)}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {renderRowLabel(row):h}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {outputQuestionByType(row):h}
+            </td>
+        </tr>
+    {end:}
+    {end:}
+    {end:}
+    
+    {end:}
+      <!-- section check end --> 
+    </table>
+{end:}
+{end:}
+
+<!--declaration section-->
+<div class="row">
+    <div class="col-md-12 panel-primary report_heading text-uppercase">
+        <div class="panel-heading">
+        <span>
+            Declaration
+        </span>
+        </div>
+    </div>
+</div>
+<table class="app-sum-body-indi-data-table">
+{foreach:declarations,declaration}
+    <tr class="app-sum-body-indi-data-row">
+        <td class="col-md-6 app-sum-body-indi-data">
+            {declaration.title}
+        </td>
+        <td class="col-md-6 app-sum-body-indi-data">
+            {if:declaration.is_agreed}
+            <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+            <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+        </td>
+    </tr>
+{end:}
+</table>
+
+    <!--document section-->
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                Documents
+            </span>
+            </div>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:documents,document}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {document.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:document.images_ids}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+    
+   <!--3rd party compliance check section with page break-->
+   <p style="page-break-after: always;">&nbsp;</p>
+   <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">            
+                3<SUP>RD</SUP> PARTY COMPLIANCE CHECK
+            </span>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12">           
+            <span class="text-primary text-uppercase">
+                <br>
+                Information Provider: LexisNexis Risk Solutions
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">           
+            <span class="app-sum-body-ref">
+            {if:t.nexisCompleted}
+                REPORT DATE: {t.nexisReportDate}
+            {end:}   
+            </span>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12 app-sum-header-note-container">
+            <br>
+            <strong>Disclaimer: </strong>
+           The information contained in the profile is derived from public sources. As certain content may be summarized, 
+           all information should be considered within the full content available in the third-party sources to which source links are provided. 
+           LexisNexis® is not responsible for content of third party sources. Relationships and categories are based on
+           information provided by third party sources and users should not draw negative conclusions from the display of relationships or categories.
+        </div>
+    </div>
+
+
+    <!--document section-->    
+    {if:!t.nexisCompleted}
+    <div class="container">
+        <div class="row">
+            <div class="col-xs-12">
+                <div class="alert alert-danger"><i class="glyphicon glyphicon-warning-sign"></i> Lexis Nexis has not been run yet</div>
+            </div>
+        </div>
+    </div>
+   {else:}
+        {if:!t.nexis_has_matches}
+            <div class="container well">
+                <div class="row">
+                    <div class="col-sm-12">
+                        No matches where found in the Database
+                    </div>
+                </div>
+            </div>
+        {else:}
+            
+            <div flexy:if="nexisMatches">
+
+                <div class="container well" flexy:foreach="nexisMatches,m">
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Source Date:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {t.formatDate(m.ResultDate,#m/d/Y#)}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Entity Type:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.EntityType}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Gender:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.Gender}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Entity Date:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Number:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.ListReferenceNumber}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Reason Listed:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.ReasonListed}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Comments:
+                        </div>
+                        <div class="col-sm-9">
+                            {t.comments(m.EntityDetails.Comments):h}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            IDs
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3 text-bold">
+                            {m.EntityDetails.IDs.EntityID.Type}:
+                        </div>
+                        <div class="col-sm-9">
+                            {m.EntityDetails.IDs.EntityID.Number}
+                        </div>
+                    </div>
+
+                    <div class="row" style="margin-top: 15px;">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            Addresses
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold">
+                            Address:
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3" style="padding-left: 30px;">
+                            Country:
+                        </div>
+                        <div class="col-sm-9">
+                            {m.EntityDetails.Addresses.EntityAddress.Country}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            Additional Information
+                        </div>
+                    </div>
+
+                    <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                        <div class="row">
+                            <div class="col-sm-3 text-bold">
+                                {t.nexis_infoKey(info)}
+                            </div>
+                            <div class="col-sm-9">
+                                {info.Value}
+                            </div>
+                        </div>
+
+                        <div class="row" flexy:if='info.Comments'>
+                            <div class="col-sm-3" style="padding-left: 30px;">
+                                Comments:
+                            </div>
+                            <div class="col-sm-9">
+                                {t.nexis_comments(info.Comments):h}
+                            </div>
+                        </div>
+
+                    </div>
+
+
+                </div>
+            </div>
+        
+            <div flexy:if="nexisRejected">
+
+                <div flexy:foreach="nexisRejected,m">
+                    
+                    <div class="container well">
+                        <div class="row">
+                            <div class="col-sm-12">
+                                <span>Result {m.EntityUniqueID} was flagged as not a match by {m.coba_investor_lexis_result.updated_by_name}</span>
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12">
+                                {m.coba_investor_lexis_result.reason:h}
+                            </div>
+                        </div>
+                        
+                        <div class="row">
+                            <div class="col-sm-12" style="background-color: #fff; color: #666666; margin-top: 10px;">
+                                
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Source Date:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {t.formatDate(m.ResultDate,#m/d/Y#)}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Entity Type:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.EntityType}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Gender:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.Gender}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Entity Date:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Number:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.ListReferenceNumber}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Reason Listed:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.ReasonListed}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Comments:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {t.comments(m.EntityDetails.Comments):h}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        IDs
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3 text-bold">
+                                        {m.EntityDetails.IDs.EntityID.Type}:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {m.EntityDetails.IDs.EntityID.Number}
+                                    </div>
+                                </div>
+
+                                <div class="row" style="margin-top: 15px;">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        Addresses
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold">
+                                        Address:
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3" style="padding-left: 30px;">
+                                        Country:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {m.EntityDetails.Addresses.EntityAddress.Country}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        Additional Information
+                                    </div>
+                                </div>
+
+                                <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                                    <div class="row">
+                                        <div class="col-sm-3 text-bold">
+                                            {t.nexis_infoKey(info)}
+                                        </div>
+                                        <div class="col-sm-9">
+                                            {info.Value}
+                                        </div>
+                                    </div>
+
+                                    <div class="row" flexy:if='info.Comments'>
+                                        <div class="col-sm-3" style="padding-left: 30px;">
+                                            Comments:
+                                        </div>
+                                        <div class="col-sm-9">
+                                            {t.nexis_comments(info.Comments):h}
+                                        </div>
+                                    </div>
+
+                                </div>
+
+                            </div>
+                            
+                        </div>
+                    </div>
+                    
+                </div>
+                
+            </div>
+        
+            
+        {end:}
+    
+   {end:}
+
+</div>
diff --git a/Pman/Coba/templates/compliance-report-joint.html b/Pman/Coba/templates/compliance-report-joint.html
new file mode 100644 (file)
index 0000000..4d0d719
--- /dev/null
@@ -0,0 +1,472 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+         <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>  
+    </div>
+    <div class="row">
+         <div class="col-md-12 app-sum-body-ref-container">
+            <span class="text-primary text-uppercase">
+                Investment Advisor: {name_advisor}
+            </span>
+            <br />
+            <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+    {foreach:summary,stepKey,steps}
+    {foreach:steps,sectionKey,sections}
+    {if:is_show_section(sectionKey)}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">        
+            <span>
+                {sectionKey}
+            </span>
+            </div>
+        </div>
+    </div>
+    <div class="row">
+    {foreach:sections,applicantNum,applicants}
+        <div class="col-md-6">
+            <table class="app-sum-body-indi-data-table">
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        Client {applicantNum}
+                    </td>
+                </tr>
+                {foreach:applicants,row}
+                {if:checkDependency(row)}
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {renderRowLabel(row):h}                        
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        {outputQuestionByType(row):h}
+                    </td>
+                </tr>
+                {end:}
+                {end:}
+            </table>
+        </div>
+    {end:}
+    </div>
+      <!-- section check end -->      
+      {end:}    
+    
+    {end:}
+    {end:}
+
+    <!--declaration section-->
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">        
+            <span>        
+                Declaration
+            </span>
+            </div>
+        </div>
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:declarations,declaration}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {declaration.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {if:declaration.is_agreed}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+    <!--document section-->
+    <div class="row">
+       <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">        
+            <span>
+                Documents                       
+            </span>
+            </div>
+        </div>        
+    </div>
+    <table class="app-sum-body-indi-data-table">
+    {foreach:documents,document}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {document.title}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">                
+                {if:document.images_ids}
+                <span class='glyphicon glyphicon-check text-primary'></span>
+                {else:}
+                <span class='glyphicon glyphicon-unchecked text-primary'></span>
+                {end:}
+            </td>
+        </tr>
+    {end:}
+    </table>
+
+   <!--3rd party compliance check section with page break-->
+   <p style="page-break-after: always;">&nbsp;</p>
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">            
+                3<SUP>RD</SUP> PARTY COMPLIANCE CHECK
+            </span>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12">           
+            <span class="text-primary text-uppercase">
+                <br>
+                Information Provider: LexisNexis Risk Solutions
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">           
+            <span class="app-sum-body-ref">
+            {if:t.nexisCompleted}
+                REPORT DATE: {t.nexisReportDate}
+            {end:}   
+            </span>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12 app-sum-header-note-container">
+            <br>
+            <strong>Disclaimer: </strong>
+           The information contained in the profile is derived from public sources. As certain content may be summarized, 
+           all information should be considered within the full content available in the third-party sources to which source links are provided. 
+           LexisNexis® is not responsible for content of third party sources. Relationships and categories are based on
+           information provided by third party sources and users should not draw negative conclusions from the display of relationships or categories.
+        </div>
+    </div>
+
+
+    <!--document section-->
+    {if:!t.nexisCompleted}
+        <div class="container">
+            <div class="row">
+                <div class="col-xs-12">
+                    <div class="alert alert-danger"><i class="glyphicon glyphicon-warning-sign"></i> Lexis Nexis has not been run yet</div>
+                </div>
+            </div>
+        </div>
+    {else:}
+        {if:!t.nexis_has_matches}
+            <div class="container well">
+                <div class="row">
+                    <div class="col-sm-12">
+                        No matches where found in the Database
+                    </div>
+                </div>
+            </div>
+        {else:}
+
+            <div flexy:if="nexisMatches">
+
+                <div class="container well" flexy:foreach="nexisMatches,m">
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Source Date:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {t.formatDate(m.ResultDate,#m/d/Y#)}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Entity Type:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.EntityType}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Gender:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.Gender}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Entity Date:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Number:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.ListReferenceNumber}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Reason Listed:
+                        </div>
+                        <div class="col-sm-9 text-bold">
+                            {m.EntityDetails.ReasonListed}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            Comments:
+                        </div>
+                        <div class="col-sm-9">
+                            {t.comments(m.EntityDetails.Comments):h}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            IDs
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3 text-bold">
+                            {m.EntityDetails.IDs.EntityID.Type}:
+                        </div>
+                        <div class="col-sm-9">
+                            {m.EntityDetails.IDs.EntityID.Number}
+                        </div>
+                    </div>
+
+                    <div class="row" style="margin-top: 15px;">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            Addresses
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold">
+                            Address:
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-3" style="padding-left: 30px;">
+                            Country:
+                        </div>
+                        <div class="col-sm-9">
+                            {m.EntityDetails.Addresses.EntityAddress.Country}
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12 text-bold bottom-dotted">
+                            Additional Information
+                        </div>
+                    </div>
+
+                    <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                        <div class="row">
+                            <div class="col-sm-3 text-bold">
+                                {t.nexis_infoKey(info)}
+                            </div>
+                            <div class="col-sm-9">
+                                {info.Value}
+                            </div>
+                        </div>
+
+                        <div class="row" flexy:if='info.Comments'>
+                            <div class="col-sm-3" style="padding-left: 30px;">
+                                Comments:
+                            </div>
+                            <div class="col-sm-9">
+                                {t.nexis_comments(info.Comments):h}
+                            </div>
+                        </div>
+
+                    </div>
+
+
+                </div>
+            </div>
+
+            <div flexy:if="nexisRejected">
+
+                <div flexy:foreach="nexisRejected,m">
+
+                    <div class="container well">
+                        <div class="row">
+                            <div class="col-sm-12">
+                                <span>Result {m.EntityUniqueID} was flagged as not a match by {m.coba_investor_lexis_result.updated_by_name}</span>
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12">
+                                {m.coba_investor_lexis_result.reason:h}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12" style="background-color: #fff; color: #666666; margin-top: 10px;">
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Source Date:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {t.formatDate(m.ResultDate,#m/d/Y#)}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Entity Type:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.EntityType}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Gender:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.Gender}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Entity Date:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Number:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.ListReferenceNumber}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Reason Listed:
+                                    </div>
+                                    <div class="col-sm-9 text-bold">
+                                        {m.EntityDetails.ReasonListed}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3">
+                                        Comments:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {t.comments(m.EntityDetails.Comments):h}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        IDs
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3 text-bold">
+                                        {m.EntityDetails.IDs.EntityID.Type}:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {m.EntityDetails.IDs.EntityID.Number}
+                                    </div>
+                                </div>
+
+                                <div class="row" style="margin-top: 15px;">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        Addresses
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold">
+                                        Address:
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-3" style="padding-left: 30px;">
+                                        Country:
+                                    </div>
+                                    <div class="col-sm-9">
+                                        {m.EntityDetails.Addresses.EntityAddress.Country}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="col-sm-12 text-bold bottom-dotted">
+                                        Additional Information
+                                    </div>
+                                </div>
+
+                                <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                                    <div class="row">
+                                        <div class="col-sm-3 text-bold">
+                                            {t.nexis_infoKey(info)}
+                                        </div>
+                                        <div class="col-sm-9">
+                                            {info.Value}
+                                        </div>
+                                    </div>
+
+                                    <div class="row" flexy:if='info.Comments'>
+                                        <div class="col-sm-3" style="padding-left: 30px;">
+                                            Comments:
+                                        </div>
+                                        <div class="col-sm-9">
+                                            {t.nexis_comments(info.Comments):h}
+                                        </div>
+                                    </div>
+
+                                </div>
+
+                            </div>
+
+                        </div>
+                    </div>
+
+                </div>
+
+            </div>
+
+
+        {end:}
+
+    {end:}
+
+</div>
diff --git a/Pman/Coba/templates/css/lexis-nexis.css b/Pman/Coba/templates/css/lexis-nexis.css
new file mode 100644 (file)
index 0000000..b5ba863
--- /dev/null
@@ -0,0 +1,28 @@
+
+.text-bold {
+    font-weight: bold;
+}
+
+.bottom-dotted {
+    border-bottom: 1px dotted #ccc;
+}
+
+.rejected .trigger {
+    cursor: pointer;
+}
+
+.rejected .trigger:before {
+    content: "\f067";
+}
+
+.rejected .details {
+    display: none;
+}
+
+.rejected.expanded .details {
+    display: block;
+}
+
+.rejected.expanded .trigger:before {
+    content: "\f068";
+}
\ No newline at end of file
diff --git a/Pman/Coba/templates/css/report.css b/Pman/Coba/templates/css/report.css
new file mode 100644 (file)
index 0000000..1431f39
--- /dev/null
@@ -0,0 +1,4 @@
+
+.report_heading {
+    margin: 20px 0px 20px 0px; 
+}
diff --git a/Pman/Coba/templates/investor-risk-profile-corporate.html b/Pman/Coba/templates/investor-risk-profile-corporate.html
new file mode 100644 (file)
index 0000000..cf0d3a0
--- /dev/null
@@ -0,0 +1,276 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12">
+             <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+  <!--display content-->
+   {foreach:sections,sectionKey,steps}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+            {sectionKey}
+            </span>
+            </div>
+        </div>  
+    </div>
+   {foreach:steps,subSecKey,subSec}
+       {if:is_show_template(sectionKey,subSecKey)}
+       {get_template_name(sectionKey,subSecKey)}
+       <flexy:include src="{html_template}"></flexy:include>
+       {end:}
+
+
+       {foreach:subSec,applicantKey,applicant}
+       {if:is_show_score(sectionKey,subSecKey)}
+       <!--table with score-->
+
+
+       <div class="col-md-12">
+         {foreach:applicant,question}
+
+         {question[display_name]}
+         <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="width:80%;">
+
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                Score
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data">
+                {question[answer]}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {question[score]}
+            </td>
+        </tr>
+        </table>
+         <br>
+
+          {end:}
+           <!-- total score -->
+          <table class="app-sum-body-indi-data-table">
+           <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="width:80%;">
+                Add up totals for each question and write the total for each client or for joint as appropriate
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                TOTAL SCORE
+            </td>
+           </tr>
+           <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data">
+
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+              {display_score(applicantKey)}
+            </td>
+            </tr>
+          </table>
+           <!-- end total score -->
+           <!-- comment -->
+         <span class="app-sum-header-note-container">See below the scores for each “Risk Profile” and tick that you agree
+        to your corresponding score:</span>
+        <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="text-align:center; width:10%;">
+                SCORE
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:30%;">
+                RISK PROFILE
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                TIME HORIZON
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                FOCUS
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                DEFENSIVE INVESTMENTS
+            </td>
+        </tr>
+       <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="text-align:center; width:10%;">
+                {display_comments(applicantKey,#score#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:30%;">
+                <span class="app-sum-body-ref"><strong>{display_comments(applicantKey,#profile_key#)}</strong></span><br>
+                {display_comments(applicantKey,#profile#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#time#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#focus#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#def_inv#)}
+            </td>
+        </tr>
+       </table>
+           <!-- end comment -->
+         </div>
+
+
+
+       {else:}
+       <!--table without score-->
+       {if:is_show_section(sectionKey,subSecKey,applicantKey)}
+       <div class="col-md-12">
+       {get_heading(sectionKey,subSecKey,applicantKey)}
+       <table class="app-sum-body-indi-data-table">
+         {if:is_show_info(sectionKey,subSecKey)}
+         {get_inv_info(applicantKey):h}
+         {end:}
+         {foreach:applicant,question}
+         {if:checkDependency(question,applicantKey)}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {question[display_name]}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {outputField(question):h}
+            </td>
+        </tr>
+        {end:}
+        {end:}
+      </table>
+     </div>
+      {end:}
+      {end:}
+      {end:}
+
+   {end:}
+   {end:}
+
+
+    <div class="row">
+       <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                    Summary of your risk profile and your ideal portfolio            
+            </span>
+            </div>
+        </div>     
+    </div>
+     <div class="row">
+        <div class="col-md-12">
+            <span class="col-md-6">
+            Please tick which statement applies to you:
+            </span>
+        </div>
+    </div>
+    <br>
+    <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to invest according to my investor risk profile score
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {if:ext_data[risk_profile_is_invest_acc_to_score]}
+               <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+       </tr>
+        {if:!ext_data[risk_profile_is_invest_acc_to_score]}
+          <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to be invested according to a different risk profile.
+                For this investment please invest according to the following risk profile
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {decodeEnum(ext_data[risk_profile_invest_profile_id])}
+            </td>
+          </tr>
+       {end:}
+        <tr class="app-sum-body-indi-data-row">
+
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to consider satellite positions in addition to my core portfolios
+                and understand these positions may be higher risk and show higher volatility
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {if:ext_data[risk_profile_is_consider_satellite]}
+               <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to impose additional restrictions on my investment portfolio and
+                investment recommendations (see details below)
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+             {if:ext_data[risk_profile_is_impose_restriction]}
+               <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+        </tr>
+         {if:ext_data[risk_profile_is_impose_restriction]}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Additional restrictions:
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+                {renderField(ext_data[risk_profile_restriction])}
+            </td>
+        </tr>
+         {end:}
+         <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Client and Adviser agreed the following Portfolio(s):
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+                {renderField(ext_data[risk_profile_agreed_portfolio])}
+            </td>
+        </tr>
+    </table>
+
+      <div class="row">
+        <div class="col-md-12">
+            <span class="col-md-6">
+            Client and Adviser agreed the following currency for the portfolio
+            </span>
+        </div>
+    </div>
+    <br>
+    <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Portfolio Recommended
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {decodeEnum(ext_data[risk_profile_agreed_currency_ids])}                           
+            </td>
+       </tr>
+    </table>
+
+     <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                    Client acknowledgement           
+            </span>
+            </div>
+        </div>                   
+    </div>
+</div>
diff --git a/Pman/Coba/templates/investor-risk-profile-individual.html b/Pman/Coba/templates/investor-risk-profile-individual.html
new file mode 100644 (file)
index 0000000..3456009
--- /dev/null
@@ -0,0 +1,276 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12">
+             <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+  <!--display content-->
+   {foreach:sections,sectionKey,steps}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+            {sectionKey}
+            </span>
+            </div>
+        </div>        
+    </div>
+   {foreach:steps,subSecKey,subSec}
+       {if:is_show_template(sectionKey,subSecKey)}
+       {get_template_name(sectionKey,subSecKey)}
+       <flexy:include src="{html_template}"></flexy:include>
+       {end:}
+
+
+       {foreach:subSec,applicantKey,applicant}
+       {if:is_show_score(sectionKey,subSecKey)}
+       <!--table with score-->
+
+
+       <div class="col-md-12">
+         {foreach:applicant,question}
+
+         {question[display_name]}
+         <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="width:80%;">
+
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                Score
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data">
+                {question[answer]}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {question[score]}
+            </td>
+        </tr>
+        </table>
+         <br>
+
+          {end:}
+           <!-- total score -->
+          <table class="app-sum-body-indi-data-table">
+           <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="width:80%;">
+                Add up totals for each question and write the total for each client or for joint as appropriate
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                TOTAL SCORE
+            </td>
+           </tr>
+           <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data">
+
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+              {display_score(applicantKey)}
+            </td>
+            </tr>
+          </table>
+           <!-- end total score -->
+           <!-- comment -->
+         <span class="app-sum-header-note-container">See below the scores for each “Risk Profile” and tick that you agree
+        to your corresponding score:</span>
+        <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="text-align:center; width:10%;">
+                SCORE
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:30%;">
+                RISK PROFILE
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                TIME HORIZON
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                FOCUS
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                DEFENSIVE INVESTMENTS
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="text-align:center; width:10%;">
+                {display_comments(applicantKey,#score#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:30%;">
+                <span class="app-sum-body-ref"><strong>{display_comments(applicantKey,#profile_key#)}</strong></span><br>
+                {display_comments(applicantKey,#profile#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#time#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#focus#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#def_inv#)}
+            </td>
+        </tr>
+       </table>
+           <!-- end comment -->
+         </div>
+
+
+
+       {else:}
+       <!--table without score-->
+       {if:is_show_section(sectionKey,subSecKey,applicantKey)}
+       <div class="col-md-12">
+       {get_heading(sectionKey,subSecKey,applicantKey)}
+       <table class="app-sum-body-indi-data-table">
+         {if:is_show_info(sectionKey,subSecKey)}
+         {get_inv_info(applicantKey):h}
+         {end:}
+         {foreach:applicant,question}
+         {if:checkDependency(question,applicantKey)}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-6 app-sum-body-indi-data">
+                {question[display_name]}
+            </td>
+            <td class="col-md-6 app-sum-body-indi-data">
+                {outputField(question):h}
+            </td>
+        </tr>
+        {end:}
+        {end:}
+      </table>
+     </div>
+      {end:}
+      {end:}
+      {end:}
+      
+   {end:}
+   {end:}
+
+
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                    Summary of your risk profile and your ideal portfolio            
+            </span>
+            </div>
+        </div>        
+    </div>
+     <div class="row">
+        <div class="col-md-12">
+            <span class="col-md-6">
+            Please tick which statement applies to you:
+            </span>
+        </div>
+    </div>
+    <br>
+    <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to invest according to my investor risk profile score
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {if:ext_data[risk_profile_is_invest_acc_to_score]}
+                                       <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+       </tr>
+        {if:!ext_data[risk_profile_is_invest_acc_to_score]}
+          <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to be invested according to a different risk profile.
+                For this investment please invest according to the following risk profile
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {decodeEnum(ext_data[risk_profile_invest_profile_id])}
+            </td>
+          </tr>
+       {end:}
+        <tr class="app-sum-body-indi-data-row">
+
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to consider satellite positions in addition to my core portfolios
+                and understand these positions may be higher risk and show higher volatility
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {if:ext_data[risk_profile_is_consider_satellite]}
+                                       <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                I wish to impose additional restrictions on my investment portfolio and
+                investment recommendations (see details below)
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+             {if:ext_data[risk_profile_is_impose_restriction]}
+                                       <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+        </tr>
+         {if:ext_data[risk_profile_is_impose_restriction]}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Additional restrictions:
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+                {renderField(ext_data[risk_profile_restriction])}
+            </td>
+        </tr>
+         {end:}
+         <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Client and Adviser agreed the following Portfolio(s):
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+                {renderField(ext_data[risk_profile_agreed_portfolio])}
+            </td>
+        </tr>
+    </table>
+
+      <div class="row">
+        <div class="col-md-12">
+            <span class="col-md-6">
+            Client and Adviser agreed the following currency for the portfolio
+            </span>
+        </div>
+    </div>
+    <br>
+    <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Portfolio Recommended
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {decodeEnum(ext_data[risk_profile_agreed_currency_ids])}                           
+            </td>
+       </tr>
+    </table>
+
+     <div class="row">
+         <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                    Client acknowledgement           
+            </span>
+            </div>
+        </div>           
+    </div>
+</div>
diff --git a/Pman/Coba/templates/investor-risk-profile-joint.html b/Pman/Coba/templates/investor-risk-profile-joint.html
new file mode 100644 (file)
index 0000000..75b6cec
--- /dev/null
@@ -0,0 +1,354 @@
+<div class="container app-sum-body-container">
+    <div class="row">
+        <div class="col-md-12">
+            <span class="text-primary text-uppercase" style="font-size: 40px;">
+                {user_name}
+            </span>
+        </div> 
+    </div>
+    <div class="row">
+        <div class="col-md-12">
+             <span class="text-primary text-uppercase">
+                Reference Code: {ref_code}
+            </span>
+        </div>
+    </div>
+    <!--display content-->
+   {foreach:sections,sectionKey,steps}
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+            {sectionKey}
+            </span>
+            </div>
+        </div>  
+    </div>
+       {if:!is_column_group(sectionKey)}
+   
+           {foreach:steps,subSecKey,subSec}
+       
+           {if:is_show_template(sectionKey,subSecKey)}
+           {get_template_name(sectionKey,subSecKey)}
+           <flexy:include src="{html_template}"></flexy:include>
+           {end:}
+
+           {foreach:subSec,applicantKey,applicant}
+           {if:is_show_score(sectionKey,subSecKey)}
+           <!--table with score-->
+
+
+       <div class="col-md-6">
+             {foreach:applicant,question}
+
+             {question[display_name]}
+         <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data" style="text-align:center; width:20%;">
+               Client {getApplicationKey(applicantKey)}
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="width:80%;">
+
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                Score
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data">
+                {question[answer]}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {question[score]}
+            </td>
+        </tr>
+        </table>
+         <br>
+
+              {end:}
+           <!-- total score -->
+          <table class="app-sum-body-indi-data-table">
+          <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data" style="text-align:center; width:20%;">
+               Client {getApplicationKey(applicantKey)}
+            </td>
+           </tr>
+           <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="width:80%;">
+                Add up totals for each question and write the total for each client or for joint as appropriate
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                TOTAL SCORE
+            </td>
+           </tr>
+           <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data">
+
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+              {display_score(applicantKey)}
+            </td>
+            </tr>
+          </table>
+           <!-- end total score -->
+           <!-- comment -->
+         <span class="app-sum-header-note-container">See below the scores for each “Risk Profile” and tick that you agree
+        to your corresponding score:</span>
+        <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row" >
+            <td class="col-md-8 app-sum-body-indi-data" colspan="4">
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data" style="text-align:center; width:20%;">
+               Client {getApplicationKey(applicantKey)}
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="text-align:center; width:10%;">
+                SCORE
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:30%;">
+                RISK PROFILE
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                TIME HORIZON
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                FOCUS
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                DEFENSIVE INVESTMENTS
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="app-sum-body-indi-data" style="text-align:center; width:10%;">
+                {display_comments(applicantKey,#score#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:30%;">
+                <span class="app-sum-body-ref"><strong>{display_comments(applicantKey,#profile_key#)}</strong></span><br>
+                {display_comments(applicantKey,#profile#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#time#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#focus#)}
+            </td>
+            <td class="app-sum-body-indi-data" style="text-align:center; width:20%;">
+                {display_comments(applicantKey,#def_inv#)}
+            </td>
+        </tr>
+       </table>
+           <!-- end comment -->
+         </div>
+
+           {else:}
+           <!--table without score-->
+               {if:is_show_section(sectionKey,subSecKey,applicantKey)}
+               <div class="col-md-6">
+               {get_heading(sectionKey,subSecKey,applicantKey)}       
+               <table class="app-sum-body-indi-data-table" >
+                <tr class="app-sum-body-indi-data-row">
+                    <td class="col-md-6 app-sum-body-indi-data">
+                    </td>
+                    <td class="col-md-6 app-sum-body-indi-data">
+                        Client {getApplicationKey(applicantKey)}
+                    </td>
+               </tr>
+               {if:is_show_info(sectionKey,subSecKey)}
+                   {get_inv_info(applicantKey):h}
+               {end:}
+               
+               {foreach:applicant,question}
+               {if:checkDependency(question,applicantKey)}
+               <tr class="app-sum-body-indi-data-row">
+                   <td class="col-md-6 app-sum-body-indi-data">
+                   {question[display_name]}
+                   </td>
+                   <td class="col-md-6 app-sum-body-indi-data">
+                   {outputField(question):h}
+                   </td>
+               </tr>                 
+               {end:}
+               {end:}
+               </table>
+               </div>
+              {else:}
+              <div class="col-md-6">     
+              </div>
+              {end:}
+         {end:} <!--end show score check-->                       
+         {end:} <!--end foreach-->      
+         {end:}  <!--end foreach--> 
+   
+   
+       {else:}
+       <!-- column group start-->        
+        {foreach:steps,applicantKey,applicant}
+                               
+                               <div class="col-md-6">                          
+                               {foreach:applicant,subSecKey,subSec}                            
+                               
+                               {if:is_show_section(sectionKey,subSecKey,applicantKey)}
+                               {get_heading(sectionKey,subSecKey,applicantKey)}
+                               <table class="app-sum-body-indi-data-table" >
+                 <tr class="app-sum-body-indi-data-row">
+                <td class="col-md-6 app-sum-body-indi-data">
+                </td>
+                <td class="col-md-6 app-sum-body-indi-data">
+                 Client {getApplicationKey(applicantKey)}
+                </td>
+                </tr>
+                {if:is_show_info(sectionKey,subSecKey)}
+                {get_inv_info(applicantKey):h}
+                {end:}
+                {foreach:subSec,question}
+                {if:checkDependency(question,applicantKey)}
+                <tr class="app-sum-body-indi-data-row">
+                <td class="col-md-6 app-sum-body-indi-data">
+                {question[display_name]}
+                </td>
+                <td class="col-md-6 app-sum-body-indi-data">
+                {outputField(question):h}
+                </td>
+                </tr>                 
+                {end:}
+                {end:}
+            </table>
+                               {end:}
+                               
+                          {end:}
+                          </div>        
+        {end:}
+        
+       
+  
+       <!-- column group end-->
+       {end:}
+       
+
+   {end:}
+
+
+    <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                    Summary of your risk profile and your ideal portfolio            
+            </span>
+            </div>
+        </div>        
+    </div>
+     <div class="row">
+        <div class="col-md-12">
+            <span class="col-md-6">
+            Please tick which statement applies to you:
+            </span>
+        </div>
+    </div>
+    <br>
+    <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                We wish to invest according to my investor risk profile score
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {if:ext_data[risk_profile_is_invest_acc_to_score]}
+                                       <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+       </tr>
+        {if:!ext_data[risk_profile_is_invest_acc_to_score]}
+          <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                We wish to be invested according to a different risk profile.
+                For this investment please invest according to the following risk profile
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {decodeEnum(ext_data[risk_profile_invest_profile_id])}
+            </td>
+          </tr>
+       {end:}
+        <tr class="app-sum-body-indi-data-row">
+
+            <td class="col-md-8 app-sum-body-indi-data">
+                We wish to consider satellite positions in addition to my core portfolios
+                and understand these positions may be higher risk and show higher volatility
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {if:ext_data[risk_profile_is_consider_satellite]}
+                                       <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+        </tr>
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                We wish to impose additional restrictions on my investment portfolio and
+                investment recommendations (see details below)
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+             {if:ext_data[risk_profile_is_impose_restriction]}
+                                       <span class='glyphicon glyphicon-check text-primary'></span>
+            {else:}
+               <span class='glyphicon glyphicon-unchecked text-primary'></span>
+            {end:}
+            </td>
+        </tr>
+         {if:ext_data[risk_profile_is_impose_restriction]}
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Additional restrictions:
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+                {renderField(ext_data[risk_profile_restriction])}
+            </td>
+        </tr>
+         {end:}
+          <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Client and Adviser agreed the following Portfolio(s):
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+                {renderField(ext_data[risk_profile_agreed_portfolio])}
+            </td>
+        </tr>
+    </table>
+
+      <div class="row">
+        <div class="col-md-12">
+            <span class="col-md-6">
+            Client and Adviser agreed the following currency for the portfolio
+            </span>
+        </div>
+    </div>
+    <br>
+    <table class="app-sum-body-indi-data-table">
+        <tr class="app-sum-body-indi-data-row">
+            <td class="col-md-8 app-sum-body-indi-data">
+                Portfolio Recommended
+            </td>
+            <td class="col-md-4 app-sum-body-indi-data">
+            {decodeEnum(ext_data[risk_profile_agreed_currency_ids])}                           
+            </td>
+       </tr>
+    </table>
+
+     <div class="row">
+        <div class="col-md-12 panel-primary report_heading text-uppercase">
+            <div class="panel-heading">
+            <span>
+                    Client acknowledgement           
+            </span>
+            </div>
+        </div>                           
+    </div>
+</div>
diff --git a/Pman/Coba/templates/investor-risk-profile-score.html b/Pman/Coba/templates/investor-risk-profile-score.html
new file mode 100644 (file)
index 0000000..8f4c180
--- /dev/null
@@ -0,0 +1,32 @@
+<div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">           
+            <span class="app-sum-header-note-container">
+            Your attitude to risk is probably the most important factor to consider before investing.  
+            To achieve higher returns, you will have to be prepared to accept a higher risk of capital loss.  
+            This is because the assets that offer high returns are generally more volatile than those producing lower returns.  
+            It is what we call ‘risk/return trade off’.
+            </span>
+            <br>   
+            <br>                     
+            <span class="app-sum-header-note-container">
+            We will recommend investment strategies to match your investments to your risk profile.  
+            Investing across the various investment sectors according to your risk profile is called diversification.  
+            For example, instead of investing only in property, or only in shares, you might invest a proportion in both, 
+            or even include cash or fixed interest to create a balanced portfolio.
+            </span>
+            <br>   
+            <br>                     
+            <span class="app-sum-header-note-container">
+            To determine the most appropriate mix of assets for you to invest in, we need to ask you more detailed 
+            questions about investment goals and the exact timeframe in which you want to achieve them.
+            </span>
+            <br>  
+            <br>                                    
+            <span class="app-sum-header-note-container">
+            By answering the questions below, you will have a good idea about your attitude to risk and what investment 
+            sectors are best suited to you. Write your score number in each question so you can more easily calculate 
+            your total score at the end.
+            </span>
+        </div>
+    </div>
+    <br>
\ No newline at end of file
diff --git a/Pman/Coba/templates/investor-risk-profile-types.html b/Pman/Coba/templates/investor-risk-profile-types.html
new file mode 100644 (file)
index 0000000..2dd5db8
--- /dev/null
@@ -0,0 +1,45 @@
+     <div class="row">
+        <div class="col-md-12 app-sum-body-ref-container">
+            <span class="app-sum-body-ref">
+             Inexperienced Investor   
+            </span>
+            <br>
+            <span class="app-sum-header-note-container">
+            You have invested in a limited range of assets classes for a period of less than four years and/or 
+            have stated that your investment knowledge is low.  
+            However, you do understand that prices of securities may go up as well as down.
+            </span>
+            <br>   
+            <br>         
+            <span class="app-sum-body-ref">
+             Experienced Investor   
+            </span>
+            <br>
+            <span class="app-sum-header-note-container">
+            You have invested in various classes for a period of more than four years and have experienced volatility.  
+            You have stated that your investment knowledge is good or higher and acknowledge investment risk.
+            </span>
+            <br>   
+            <br>         
+            <span class="app-sum-body-ref">
+             Professional Investor   
+            </span>
+            <br>
+            <span class="app-sum-header-note-container">
+            You frequently trade various asset classes each year for more than four years.  As an individual, 
+            you have in excess of US$1.1 million of “investible” assets and have extensive investment knowledge.
+            </span>
+            <br>  
+            <br>   
+            <br>         
+            <span class="app-sum-body-ref">
+             NOTE:   
+            </span>
+            <span class="app-sum-header-note-container">
+            Pursuant to change to the PI framework, effective 25 March 2016, the Company elects to treat all investors 
+            as non-professional investors.  No PI assessment is conducted as no wealth management client will be treated 
+            as Professional Investors, with the exception of Corporate Professional Investors “CPI”.
+            </span>
+        </div>
+    </div>
+    <br>
\ No newline at end of file
diff --git a/Pman/Coba/templates/js/lexis-nexis.js b/Pman/Coba/templates/js/lexis-nexis.js
new file mode 100644 (file)
index 0000000..dc4197f
--- /dev/null
@@ -0,0 +1,17 @@
+
+Roo.onReady(function(){
+    
+    Roo.each(Roo.select('i.trigger', true).elements, function(t){
+        
+        t.on('click', function(e){
+            
+            e.preventDefault();
+            
+            var parent = t.findParent('div.rejected', false, true);
+        
+            parent.toggleClass('expanded');
+        });
+        
+    });
+    
+});
\ No newline at end of file
diff --git a/Pman/Coba/templates/lexis-nexis-detail.html b/Pman/Coba/templates/lexis-nexis-detail.html
new file mode 100644 (file)
index 0000000..23aae5e
--- /dev/null
@@ -0,0 +1,130 @@
+
+<div class="container well matches">
+    <div class="row">
+        <div class="col-sm-3">
+            Source Date:
+        </div>
+        <div class="col-sm-9 text-bold">
+            {t.formatDate(detail.ResultDate,#m/d/Y#)}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3">
+            Entity Type:
+        </div>
+        <div class="col-sm-9 text-bold">
+            {detail.EntityDetails.EntityType}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3">
+            Gender:
+        </div>
+        <div class="col-sm-9 text-bold">
+            {detail.EntityDetails.Gender}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3">
+            Entity Date:
+        </div>
+        <div class="col-sm-9 text-bold">
+            {t.formatDate(detail.EntityDetails.DateListed,#m/d/Y#)}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3">
+            Number:
+        </div>
+        <div class="col-sm-9 text-bold">
+            {detail.EntityDetails.ListReferenceNumber}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3">
+            Reason Listed:
+        </div>
+        <div class="col-sm-9 text-bold">
+            {detail.EntityDetails.ReasonListed}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3">
+            Comments:
+        </div>
+        <div class="col-sm-9">
+            {t.comments(detail.EntityDetails.Comments):h}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-12 text-bold bottom-dotted">
+            IDs
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3 text-bold">
+            {detail.EntityDetails.IDs.EntityID.Type}:
+        </div>
+        <div class="col-sm-9">
+            {detail.EntityDetails.IDs.EntityID.Number}
+        </div>
+    </div>
+
+    <div class="row" style="margin-top: 15px;">
+        <div class="col-sm-12 text-bold bottom-dotted">
+            Addresses
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-12 text-bold">
+            Address:
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-3" style="padding-left: 30px;">
+            Country:
+        </div>
+        <div class="col-sm-9">
+            {detail.EntityDetails.Addresses.EntityAddress.Country}
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-sm-12 text-bold bottom-dotted">
+            Additional Information
+        </div>
+    </div>
+
+    <div flexy:foreach="detail.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+        <div class="row">
+            <div class="col-sm-3 text-bold">
+                {t.infoKey(info)}
+            </div>
+            <div class="col-sm-9">
+                {info.Value}
+            </div>
+        </div>
+
+        <div class="row" flexy:if='info.Comments'>
+            <div class="col-sm-3" style="padding-left: 30px;">
+                Comments:
+            </div>
+            <div class="col-sm-9">
+                {t.comments(info.Comments):h}
+            </div>
+        </div>
+
+    </div>
+
+
+</div>
\ No newline at end of file
diff --git a/Pman/Coba/templates/lexis-nexis-master.html b/Pman/Coba/templates/lexis-nexis-master.html
new file mode 100644 (file)
index 0000000..96e091f
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:html="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 
+
+    <head>
+        <title>Lexis Nexis Result</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+
+        <meta name="google" value="notranslate">
+
+        <link href="{rootURL}/roojs1/css-bootstrap/bootstrap.min.css" rel="stylesheet">
+        <link href="{rootURL}/roojs1/css-bootstrap/font-awesome.css" rel="stylesheet" type="text/css" />
+        <link href="{rootURL}/Pman/Coba/templates/css/lexis-nexis.css" rel="stylesheet">
+
+    </head>
+
+    <body class="ytheme-gray" xtype="Roo.bootstrap.Body">
+
+        {outputBody()}
+
+    </body>
+    
+    <script type="text/javascript" src="{rootURL}/roojs1/roojs-core-debug.js"></script>
+    <script type="text/javascript" src="{rootURL}/roojs1/roojs-bootstrap-debug.js"></script>
+        
+
+    <flexy:toJSON 
+        baseURL="baseURL" 
+        rootURL="rootURL"
+    ></flexy:toJSON>
+    
+    <script src="{rootURL}/Pman/Coba/templates/js/lexis-nexis.js" type="text/javascript"></script>
+    
+</html>
diff --git a/Pman/Coba/templates/lexis-nexis.html b/Pman/Coba/templates/lexis-nexis.html
new file mode 100644 (file)
index 0000000..aed9609
--- /dev/null
@@ -0,0 +1,337 @@
+{if:!t.completed}
+    <div class="container">
+        <div class="row">
+            <div class="col-xs-12">
+                <div class="alert alert-danger"><i class="glyphicon glyphicon-warning-sign"></i> Lexis Nexis has not been run yet</div>
+            </div>
+        </div>
+    </div>
+{else:}
+    
+    <div class="container well">
+        <div class="row">
+            <div class="col-xs-12">
+                Search Date: {t.reportDate}
+            </div>
+        </div>
+    </div>
+
+    <div class="container well" flexy:if="!matches">
+        <div class="row">
+            <div class="col-sm-12">
+                No matches where found in the Database
+            </div>
+        </div>
+    </div>
+
+    <div flexy:if="matches">
+
+        <div class="container well matches" flexy:foreach="matches,m">
+            
+            {if:is_rejected(m.coba_investor_lexis_result.status)}
+                <div class="rejected">
+                    
+                    <div class="row">
+                        <div class="col-sm-6">
+                            <i class="trigger fa fa-plus"></i>
+                            <span>Result {m.EntityUniqueID} was flagged as not a match by {m.coba_investor_lexis_result.person_id_name}</span>
+                        </div>
+                        <div class="col-sm-6 text-right">
+                            <button type="button" data-id="{m.coba_investor_lexis_result.id}" class="btn btn-default un-reject-match">
+                                <i class="fa fa-times"></i> Undo Reject
+                            </button>
+                        </div>
+                    </div>
+
+                    <div class="row">
+                        <div class="col-sm-12">
+                            {m.coba_investor_lexis_result.reason:h}
+                        </div>
+                    </div>
+
+                    <div class="details">
+
+                        <hr/>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Source Date:
+                            </div>
+                            <div class="col-sm-9 text-bold">
+                                {t.formatDate(m.ResultDate,#m/d/Y#)}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Entity Type:
+                            </div>
+                            <div class="col-sm-9 text-bold">
+                                {m.EntityDetails.EntityType}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Gender:
+                            </div>
+                            <div class="col-sm-9 text-bold">
+                                {m.EntityDetails.Gender}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Entity Date:
+                            </div>
+                            <div class="col-sm-9 text-bold">
+                                {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Number:
+                            </div>
+                            <div class="col-sm-9 text-bold">
+                                {m.EntityDetails.ListReferenceNumber}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Reason Listed:
+                            </div>
+                            <div class="col-sm-9 text-bold">
+                                {m.EntityDetails.ReasonListed}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3">
+                                Comments:
+                            </div>
+                            <div class="col-sm-9">
+                                {t.comments(m.EntityDetails.Comments):h}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12 text-bold bottom-dotted">
+                                IDs
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3 text-bold">
+                                {m.EntityDetails.IDs.EntityID.Type}:
+                            </div>
+                            <div class="col-sm-9">
+                                {m.EntityDetails.IDs.EntityID.Number}
+                            </div>
+                        </div>
+
+                        <div class="row" style="margin-top: 15px;">
+                            <div class="col-sm-12 text-bold bottom-dotted">
+                                Addresses
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12 text-bold">
+                                Address:
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-3" style="padding-left: 30px;">
+                                Country:
+                            </div>
+                            <div class="col-sm-9">
+                                {m.EntityDetails.Addresses.EntityAddress.Country}
+                            </div>
+                        </div>
+
+                        <div class="row">
+                            <div class="col-sm-12 text-bold bottom-dotted">
+                                Additional Information
+                            </div>
+                        </div>
+
+                        <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                            <div class="row">
+                                <div class="col-sm-3 text-bold">
+                                    {t.infoKey(info)}
+                                </div>
+                                <div class="col-sm-9">
+                                    {info.Value}
+                                </div>
+                            </div>
+
+                            <div class="row" flexy:if='info.Comments'>
+                                <div class="col-sm-3" style="padding-left: 30px;">
+                                    Comments:
+                                </div>
+                                <div class="col-sm-9">
+                                    {t.comments(info.Comments):h}
+                                </div>
+                            </div>
+
+                        </div>
+
+                    </div>
+                </div>
+            {else:}
+            
+                <div class="row">
+                
+                    <div class="col-sm-12 text-right" flexy:if="is_pending(m.coba_investor_lexis_result.status)">
+                        <button type="button" data-id="{m.coba_investor_lexis_result.id}" class="btn btn-success accept-match">
+                            <i class="fa fa-check"></i> Accept this match
+                        </button>
+                        <button type="button" data-id="{m.coba_investor_lexis_result.id}" class="btn btn-danger reject-match">
+                            <i class="fa fa-times"></i> Reject this match
+                        </button>
+                    </div>
+
+                    <div class="col-sm-12 text-right" flexy:if="is_accepted(m.coba_investor_lexis_result.status)">
+                        <button type="button" data-id="{m.coba_investor_lexis_result.id}" class="btn btn-default un-accept-match">
+                            <i class="fa fa-check"></i> Undo Accept
+                        </button>
+                    </div>
+
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Source Date:
+                    </div>
+                    <div class="col-sm-9 text-bold">
+                        {t.formatDate(m.ResultDate,#m/d/Y#)}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Entity Type:
+                    </div>
+                    <div class="col-sm-9 text-bold">
+                        {m.EntityDetails.EntityType}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Gender:
+                    </div>
+                    <div class="col-sm-9 text-bold">
+                        {m.EntityDetails.Gender}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Entity Date:
+                    </div>
+                    <div class="col-sm-9 text-bold">
+                        {t.formatDate(m.EntityDetails.DateListed,#m/d/Y#)}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Number:
+                    </div>
+                    <div class="col-sm-9 text-bold">
+                        {m.EntityDetails.ListReferenceNumber}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Reason Listed:
+                    </div>
+                    <div class="col-sm-9 text-bold">
+                        {m.EntityDetails.ReasonListed}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3">
+                        Comments:
+                    </div>
+                    <div class="col-sm-9">
+                        {t.comments(m.EntityDetails.Comments):h}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-12 text-bold bottom-dotted">
+                        IDs
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3 text-bold">
+                        {m.EntityDetails.IDs.EntityID.Type}:
+                    </div>
+                    <div class="col-sm-9">
+                        {m.EntityDetails.IDs.EntityID.Number}
+                    </div>
+                </div>
+
+                <div class="row" style="margin-top: 15px;">
+                    <div class="col-sm-12 text-bold bottom-dotted">
+                        Addresses
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-12 text-bold">
+                        Address:
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-3" style="padding-left: 30px;">
+                        Country:
+                    </div>
+                    <div class="col-sm-9">
+                        {m.EntityDetails.Addresses.EntityAddress.Country}
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="col-sm-12 text-bold bottom-dotted">
+                        Additional Information
+                    </div>
+                </div>
+
+                <div flexy:foreach="m.EntityDetails.AdditionalInfo.EntityAdditionalInfo,info">
+                    <div class="row">
+                        <div class="col-sm-3 text-bold">
+                            {t.infoKey(info)}
+                        </div>
+                        <div class="col-sm-9">
+                            {info.Value}
+                        </div>
+                    </div>
+
+                    <div class="row" flexy:if='info.Comments'>
+                        <div class="col-sm-3" style="padding-left: 30px;">
+                            Comments:
+                        </div>
+                        <div class="col-sm-9">
+                            {t.comments(info.Comments):h}
+                        </div>
+                    </div>
+
+                </div>
+            
+            {end:}
+            
+        </div>
+        
+    </div>
+    
+{end:}
diff --git a/Pman/Coba/templates/veridate/report-footer.html b/Pman/Coba/templates/veridate/report-footer.html
new file mode 100644 (file)
index 0000000..527ea11
--- /dev/null
@@ -0,0 +1,15 @@
+        <div class="container">
+            <div class="row app-sum-footer-container">
+                <div class="col-md-12">
+                    <table>
+                        <tr>
+                            <td class="col-md-2 app-sum-footer-cib-container">                                
+                            </td>
+                            <td class="col-md-10 app-sum-footer-text">
+                                <span class="app-sum-footer-capcomp"><span class="client-company-name"></span></span>.
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </div>
+        </div>
\ No newline at end of file
diff --git a/Pman/Coba/templates/veridate/report-header.html b/Pman/Coba/templates/veridate/report-header.html
new file mode 100644 (file)
index 0000000..f52fc76
--- /dev/null
@@ -0,0 +1,18 @@
+<div class="row">
+    <div class="col-md-12 app-sum-header-address-container">
+    <span class="client-company-name"></span> <span class="client-parent-company-name"></span><br />
+                    <span class="client-address"></span>
+    </div>
+</div>
+<div class="row">
+    <div class="col-md-12 app-sum-header-note-container">
+    <strong>Note: </strong>
+    <span class="client-company-name"></span> are committed to ensuring that any personal data received is safeguarded against unauthorized disclosure.  
+                    The data provided herein is subject to the provisions of the Personal Data (Privacy) Ordinance (Cap. 486, Laws of Hong Kong).  
+                    This means that we will not disclose any personal data unless we have given written authorization to do so, or unless the disclosure is 
+                    otherwise permitted under the provisions of the Personal Data (Privacy) Ordinance.<br />
+                    The information collected in this report has been submitted on a voluntary basis. In no event, will <span class="client-company-name"></span>, 
+                    its related entities, or the partners or employees thereof be liable to the recipient or anyone else for any decision made or action taken in 
+                    reliance on the information supplied below.
+    </div>
+</div>
diff --git a/Pman/Core b/Pman/Core
new file mode 120000 (symlink)
index 0000000..1d50ce5
--- /dev/null
+++ b/Pman/Core
@@ -0,0 +1 @@
+../Pman.Core
\ No newline at end of file
diff --git a/Pman/GnumericToExcel.php b/Pman/GnumericToExcel.php
new file mode 120000 (symlink)
index 0000000..7b6575d
--- /dev/null
@@ -0,0 +1 @@
+../Pman.Base/Pman/GnumericToExcel.php
\ No newline at end of file
diff --git a/Pman/I18n.php b/Pman/I18n.php
new file mode 120000 (symlink)
index 0000000..c5aa918
--- /dev/null
@@ -0,0 +1 @@
+../Pman.Base/Pman/I18n.php
\ No newline at end of file
diff --git a/Pman/Images.php b/Pman/Images.php
new file mode 120000 (symlink)
index 0000000..509d4d1
--- /dev/null
@@ -0,0 +1 @@
+../Pman.Base/Pman/Images.php
\ No newline at end of file
diff --git a/Pman/Login.php b/Pman/Login.php
new file mode 120000 (symlink)
index 0000000..3577953
--- /dev/null
@@ -0,0 +1 @@
+../Pman.Base/Pman/Login.php
\ No newline at end of file
diff --git a/Pman/Roo.php b/Pman/Roo.php
new file mode 120000 (symlink)
index 0000000..2fcac77
--- /dev/null
@@ -0,0 +1 @@
+../Pman.Base/Pman/Roo.php
\ No newline at end of file