From a72d8a516239c6bb14f79ca5c0773866cae02549 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 3 Jan 2019 10:26:15 -0500 Subject: [PATCH] changing dropdowns to be browser default, adding ajax model to populate memberEdit form --- css/admin.css | 7 +- models/admin/ajax/adminSearch.php | 103 ------------------ models/admin/ajax/memberManagement.php | 12 +- models/admin/member/memberInfo.php | 5 +- views/admin/manageDashboard/index.html | 16 ++- views/admin/member/memberInfo.html | 20 ++-- .../member/memberInfo/editProfileAddress.html | 10 +- .../member/memberInfo/editProfileMailing.html | 4 +- .../member/memberInfo/editProfileStatus.html | 2 +- 9 files changed, 46 insertions(+), 133 deletions(-) delete mode 100644 models/admin/ajax/adminSearch.php diff --git a/css/admin.css b/css/admin.css index 8b109212..6eccf130 100755 --- a/css/admin.css +++ b/css/admin.css @@ -377,7 +377,7 @@ td.glm-nowrap { border: 1px black solid; border-radius: 7px; padding: 5px; - z-index: 1000 !important; + z-index: 100000 !important; } .glm-dialog-no-close .ui-dialog-titlebar-close { display: none; @@ -803,4 +803,7 @@ td.glm-nowrap { { cursor: pointer; } -.glm-import-td { padding:15px !important; margin: 0; } \ No newline at end of file +.glm-import-td { padding:15px !important; margin: 0; } +textarea{ + color: black !important; +} \ No newline at end of file diff --git a/models/admin/ajax/adminSearch.php b/models/admin/ajax/adminSearch.php deleted file mode 100644 index add69882..00000000 --- a/models/admin/ajax/adminSearch.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 0.1 - */ -require_once GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php'; -/** - * - * This class exports the currently selected members list - * to a printable HTML file, to a CSV file, or otherwise. - */ -class GlmMembersAdmin_ajax_adminSearch extends glmMembersAdmin -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - - /** - * Constructor - * - * This constructor sets up this model. At this time that only includes - * storing away the WordPress data object. - * - * @return object Class object - * - */ - public function __construct ($wpdb, $config) - { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - //parent::__construct(false, false); - - } - function write_log ( $log ) { - if ( true === WP_DEBUG ) { - if ( is_array( $log ) || is_object( $log ) ) { - error_log( print_r( $log, true ) ); - } else { - error_log( $log ); - } - } - } - /** - * Perform Model Action - * - * This modelAction takes an AJAX image upload and stores the image in the - * media/images directory of the plugin. - * - * This model action does not return, it simply does it's work then calls die(); - * - * @param $actionData - * - * Echos JSON string as response and does not return - */ - public function modelAction ($actionData = false) - { - global $wpdb; - - $where = ' true '; - $alphaWhere = ' true '; - $start = 1; - $limit = 20; - - $status = $this->config['status_numb']['Active']; - // $list = apply_filters('glm-member-db-admin-search', ''); - $list = $this->controller( 'manageDashboard', 'members', false, true, true); - - - $return = array( - 'searchData' => $list // Where our events list will go - ); - - //header('Content-type:application/json;charset=utf-8', true); - echo json_encode($return); - wp_die(); - } -} diff --git a/models/admin/ajax/memberManagement.php b/models/admin/ajax/memberManagement.php index 66516e09..e80f5ed4 100644 --- a/models/admin/ajax/memberManagement.php +++ b/models/admin/ajax/memberManagement.php @@ -87,6 +87,7 @@ class GlmMembersAdmin_ajax_memberManagement extends glmMembersAdmin $memberID = $_REQUEST['memberID']; $data = $this->controller( 'member', 'index', array("memberID" => $memberID), true, true); } + if($_REQUEST['option'] == 'list'){ $where = ' true '; $alphaWhere = ' true '; @@ -94,12 +95,17 @@ class GlmMembersAdmin_ajax_memberManagement extends glmMembersAdmin $limit = 20; $status = $this->config['status_numb']['Active']; - // $list = apply_filters('glm-member-db-admin-search', ''); $data = $this->controller( 'manageDashboard', 'members', false, true, true); } - + + if($_REQUEST['option'] == 'edit'){ + $memberID = $_REQUEST['memberID']; + $memberInfo = $_REQUEST['memberInfo']; + $data = $this->controller( 'member', 'memberInfo', false, true, true); + } + $return = array( - "test" => $sql, + "test" => [$memberID, $memberInfo], 'searchData' => $data, // Where our events list will go ); diff --git a/models/admin/member/memberInfo.php b/models/admin/member/memberInfo.php index d3a8f95b..aaf2c2be 100755 --- a/models/admin/member/memberInfo.php +++ b/models/admin/member/memberInfo.php @@ -243,10 +243,9 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo if (isset($_REQUEST['memberInfo'])) { $this->memberInfoID = $_REQUEST['memberInfo']-0; $this->haveMemberInfo = true; - } } - + // Check to see if the user is locked to a particular member $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); @@ -430,7 +429,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo // Default is to display the currently selected member information record in a form for updates default: - + // Edit the existing member $this->memberInfo = $this->editEntry($this->memberInfoID); diff --git a/views/admin/manageDashboard/index.html b/views/admin/manageDashboard/index.html index 1846ed46..aa49addf 100644 --- a/views/admin/manageDashboard/index.html +++ b/views/admin/manageDashboard/index.html @@ -31,7 +31,7 @@ glm_action : defaultData.glm_action, } - var Glma = (function() { + window.Glma = (function() { var xhr = function(data, complete, success, error, type){ $.ajax({ dataType: "json", @@ -81,7 +81,7 @@ outDuration : 400 }); - + var memberInfo, memberID; /* * Text Search Autocomplete */ @@ -218,7 +218,8 @@ $(document).on("click",".member-record-name", function(){ $(".edit-screen").html(''); editData.option = "manage"; - editData.memberID = $(this).parent().data('id') + editData.memberID = $(this).parent().data('id'); + memberID = editData.memberID; Glma.memberEdit( editData, function(complete) {}, @@ -236,18 +237,23 @@ $(document).on("click","#edit-member-profile",function(e){ e.preventDefault(); $(".edit-screen").html(''); - editData.option = "edit"; + editData.option = "edit"; + editData.memberInfo = $(this).data("memberinfo"); + editData.member = memberID; Glma.memberEdit( editData, function(complete) {}, function(success) { + console.log(success); + $(".edit-screen").html(success.searchData); + }, function(error) { console.log(error); }, "POST", - ) + ); }); }); diff --git a/views/admin/member/memberInfo.html b/views/admin/member/memberInfo.html index 31e3894d..03e6a96a 100755 --- a/views/admin/member/memberInfo.html +++ b/views/admin/member/memberInfo.html @@ -117,7 +117,7 @@ {if $errorMessage}{$errorMessage}{/if} - +

@@ -147,7 +147,7 @@ {/if}

* Required

- + @@ -226,9 +226,9 @@ {/if} -