Sfoglia il codice sorgente

Merge branch 'master' of https://rav.triplestart.com/tigerphp/lemon-admin

Samson Mutunga 5 mesi fa
parent
commit
c3cafe9b75

+ 13 - 6
app/Http/Controllers/AdminController.php

@@ -84,6 +84,13 @@ class AdminController extends Controller
             }
         }
 
+        $hide_duplicates = $request->get('hide_duplicates');
+        if($hide_duplicates){
+            if($hide_duplicates == 'YES'){
+                $users = $users->where('is_marked_as_duplicate', false);
+            }
+        }
+
         $users = $users->orderBy('created_at', 'DESC')->paginate(30);
         return view('app.my-account.admin.users.index', compact('users', 'filters'));
     }
@@ -564,30 +571,30 @@ class AdminController extends Controller
         $order->save();
     }
     return $this->pass();
-    
+
   }
 
   public function emailAttachment(Request $request){
     $params = $request->only(['toEmail', 'toName', 'subject', 'message', 'attachmentPath']);
-    $response = $this->emailService->sendEmailWithAttachment($params);
+    //$response = $this->emailService->sendEmailWithAttachment($params);
     return $this->pass();
   }
 
   public function emailReport(Request $request, StoreOrder $order){
-    $results_attachment = $order->getDetailJsonValue('results_attachment');
+    //$results_attachment = $order->getDetailJsonValue('results_attachment');
 
     $emailParams = [
         'toEmail' => $order->user->getEmail(),
         'toName' => $order->user->displayName(),
         'subject' => 'Your Test Results Are Ready',
-        'message' => $request->get('message'),
-        'attachmentPath' => $results_attachment['path']
+        'message' => $request->get('message')
+        //'attachmentPath' => $results_attachment['path']
     ];
     if(!$emailParams['message']){
         $emailParams['message'] = '<p>Your test results are now available in your secure account.</p><p>To view your results, please click the button below to log in:</p>';
     }
 
-    $response = $this->emailService->sendEmailWithAttachment($emailParams);
+    //$response = $this->emailService->sendEmailWithAttachment($emailParams);
     return $this->pass();
 
   }

+ 6 - 6
app/Http/Services/EmailService.php

@@ -54,7 +54,7 @@ class EmailService
             ->post($url, $data)
             ->body();
         }
-        
+
 
         return json_decode($response, true);
     }
@@ -242,7 +242,7 @@ class EmailService
         $html = (string) view('emails.templates.attachment', compact('params', 'appUrl', 'emailFromName', 'appInternalName', 'stringMappingConfig'));
         $plainText = (string) '';
 
-        $attachment = $this->getAttachmentFromStoragePath($params['attachmentPath'], 'attachment1');
+       // $attachment = $this->getAttachmentFromStoragePath($params['attachmentPath'], 'attachment1');
 
 
         $emailParams = [
@@ -253,11 +253,11 @@ class EmailService
             'contentHtml' => $html,
             'contentText' => $plainText,
             'entityType' => null,
-            'entityUid' => null,
-            'attachment1' => $attachment
+            'entityUid' => null
+           // 'attachment1' => $attachment
         ];
 
-        $response = $this->callJava('/api/email/send', $emailParams, null, $attachment);
+        $response = $this->callJava('/api/email/send', $emailParams, null);
     }
 
     protected function getAttachmentFromStoragePath($path, $fileName){
@@ -269,7 +269,7 @@ class EmailService
                 'mime' => Storage::disk('custom')->mimeType($path),
             ];
         }
-    
+
         return null;
     }
 }

+ 13 - 1
resources/views/app/my-account/admin/users/filters.blade.php

@@ -48,6 +48,18 @@ $url = route('admin.users');
                     <option value="NO">No</option>
                 </select>
             </div>
+            <div class="d-flex flex-wrap justify-content-start">
+                <div class="form-group mb-0 me-2">
+                    <label class="text-secondary text-sm mb-1">Hide duplicates?</label>
+                    <select name="hide_duplicates"
+                            class="d-block p-1 border border-secondary max-width-110px bg-white width-100px"
+                            v-model="filters.hide_duplicates" select2_>
+                        <option value=""></option>
+                        <option value="YES" selected>Yes</option>
+                        <option value="NO">No</option>
+                    </select>
+                </div>
+            </div>
         </div>
     </div>
 
@@ -82,7 +94,7 @@ $url = route('admin.users');
 
 <?php
 $loadedFilters = $filters;
-$allFilterKeys = ['payment_profile', 'customer_name', 'is_admin'];
+$allFilterKeys = ['payment_profile', 'customer_name', 'is_admin', 'hide_duplicates'];
 for ($i = 0; $i < count($allFilterKeys); $i++) {
     if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
         $loadedFilters[$allFilterKeys[$i]] = '';