@@ -70,7 +70,12 @@ public function data($ticketList = 'active')
7070 $ collection ->inList ($ value );
7171
7272 }elseif (in_array ($ field , ['start_date ' , 'limit_date ' ])){
73- $ collection ->where ($ field , '>= ' , Carbon::createFromFormat (trans ('panichd::lang.datetime-format ' ), $ value ));
73+ if ($ search_fields [$ field . '_type ' ] == 'exact_day ' ){
74+ $ collection ->whereDate ($ field , Carbon::createFromFormat (trans ('panichd::lang.datetime-format ' ), $ value )->toDateTimeString ());
75+
76+ }else {
77+ $ collection ->where ($ field , ($ search_fields [$ field . '_type ' ] == 'from ' ? '>= ' : '< ' ), Carbon::createFromFormat (trans ('panichd::lang.datetime-format ' ), $ value )->toDateTimeString ());
78+ }
7479
7580 }elseif (in_array ($ field , $ this ->a_search_fields_text )){
7681 $ collection ->where ($ field , 'like ' , '% ' . $ value . '% ' );
@@ -791,6 +796,15 @@ public function register_search_fields(Request $request)
791796 }
792797 }
793798
799+ // Register Start date and Limit date types (from radio buttons)
800+ if ($ request ->filled ('start_date ' ) or $ request ->filled ('start_date ' )){
801+ foreach (['start_date ' , 'limit_date ' ] as $ field ){
802+ if ($ request ->filled ($ field )){
803+ $ search_fields [$ field . '_type ' ] = $ request ->{$ field . '_type ' };
804+ }
805+ }
806+ }
807+
794808 // Check ticket tags
795809 if ($ request ->filled ('category_id ' ) and $ request ->filled ('category_ ' . $ request ->category_id . '_tags ' )){
796810 $ search_fields ['tags ' ] = $ request ->{'category_ ' . $ request ->category_id . '_tags ' };
0 commit comments