diff --git a/web/admin/src/loans/lib.js b/web/admin/src/loans/lib.js index 5ee6313b..d54cf2c2 100644 --- a/web/admin/src/loans/lib.js +++ b/web/admin/src/loans/lib.js @@ -2,13 +2,22 @@ Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de) Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah) */ -import AdapterBase from '../../../api/AdapterBase'; +//import AdapterBase from '../../../api/AdapterBase'; +import ReactModalAdapterBase from '../../../api/ReactModalAdapterBase'; /** * CompanyLoanAdapter */ -class CompanyLoanAdapter extends AdapterBase { +class CompanyLoanAdapter extends ReactModalAdapterBase { + constructor(endPoint, tab, filter, orderBy) { + super(endPoint, tab, filter, orderBy); + this.fieldNameMap = {}; + this.hiddenFields = {}; + this.tableFields = {}; + this.formOnlyFields = {}; + } + getDataMapping() { return [ 'id', @@ -25,13 +34,35 @@ class CompanyLoanAdapter extends AdapterBase { ]; } + getTableColumns() { + return [ + { + title: 'Name', + dataIndex: 'name', + sorter: true, + }, + { + title: 'Details', + dataIndex: 'details', + sorter: true, + } + ]; + } + getFormFields() { + if(this.showSave){ return [ ['id', { label: 'ID', type: 'hidden' }], ['name', { label: 'Name', type: 'text', validation: '' }], ['details', { label: 'Details', type: 'textarea', validation: 'none' }], ]; } + return [ + ['id', { label: 'ID', type: 'hidden' }], + ['name', { label: 'Name', type: 'text', validation: '' }], + ['details', { label: 'Details', type: 'textarea', validation: 'none' }], + ]; +} } @@ -39,7 +70,15 @@ class CompanyLoanAdapter extends AdapterBase { * EmployeeCompanyLoanAdapter */ -class EmployeeCompanyLoanAdapter extends AdapterBase { +class EmployeeCompanyLoanAdapter extends ReactModalAdapterBase { + constructor(endPoint, tab, filter, orderBy) { + super(endPoint, tab, filter, orderBy); + this.fieldNameMap = {}; + this.hiddenFields = {}; + this.tableFields = {}; + this.formOnlyFields = {}; + } + getDataMapping() { return [ 'id', @@ -66,6 +105,46 @@ class EmployeeCompanyLoanAdapter extends AdapterBase { ]; } + getTableColumns() { + return [ + { + title: 'Employee', + dataIndex: 'employee', + sorter: true, + }, + { + title: 'Loan Type', + dataIndex: 'loan', + sorter: true, + }, + { + title: 'Loan Start Date', + dataIndex: 'start_date', + sorter: true, + }, + { + title: 'Loan Period (Months)', + dataIndex: 'period_months', + sorter: true, + }, + { + title: 'Currency', + dataIndex: 'currency', + sorter: true, + }, + { + title: 'Amount', + dataIndex: 'amount', + sorter: true, + }, + { + title: 'Status', + dataIndex: 'status', + sorter: true, + } + ]; + } + getFormFields() { return [ ['id', { label: 'ID', type: 'hidden' }],