1515use App \Gene ;
1616use App \Notification ;
1717use App \Group ;
18+ use App \Panel ;
1819
1920class FollowController extends Controller
2021{
@@ -172,6 +173,24 @@ public function create(ApiRequest $request)
172173
173174 $ notification ->save ();
174175 }
176+ else if ($ input ['gene ' ][0 ] == '! ' )
177+ {
178+ $ name = $ input ['gene ' ];
179+ $ panel = Panel::ident (substr ($ name , 1 ))->first ();
180+
181+ $ hasit = $ user ->panels ()->where ('panel.id ' , $ panel ->id )->exists ();
182+
183+ if (($ panel !== null ) && ($ hasit === false ))
184+ {
185+ $ user ->panels ()->attach ($ panel ->id );
186+ }
187+
188+ $ bucket = $ notification ->checkGroup ($ name );
189+ if ($ bucket === false )
190+ $ notification ->addDefault ($ name );
191+
192+ $ notification ->save ();
193+ }
175194 else
176195 {
177196
@@ -299,6 +318,30 @@ public function remove(ApiRequest $request)
299318 if ($ bucket !== false )
300319 $ notification ->removeGroup ($ group ->name , $ bucket );
301320 }
321+ else if ($ input ['gene ' ][0 ] == '! ' )
322+ {
323+ $ name = $ input ['gene ' ];
324+
325+ $ ident = substr ($ input ['gene ' ], 1 );
326+
327+ $ panel = Panel::ident ($ ident )->first ();
328+
329+ if ($ panel === null )
330+ return response ()->json (['success ' => 'false ' ,
331+ 'status_code ' => 2021 ,
332+ 'gene ' => $ ident ,
333+ 'message ' => "Panel Lookup Error " ],
334+ 501 );
335+
336+ $ user ->panels ()->detach ($ panel ->id );
337+
338+ $ bucket = $ notification ->checkGroup ($ name );
339+
340+ if ($ bucket !== false )
341+ $ notification ->removeGroup ($ name , $ bucket );
342+
343+ $ name = $ panel ->smart_title ;
344+ }
302345 else
303346 {
304347
@@ -307,7 +350,7 @@ public function remove(ApiRequest $request)
307350 if ($ gene === null )
308351 return response ()->json (['success ' => 'false ' ,
309352 'status_code ' => 2001 ,
310- 'gene ' => $ name ,
353+ 'gene ' => $ input [ ' gene ' ] ,
311354 'message ' => "Gene Lookup Error " ],
312355 501 );
313356
@@ -337,7 +380,7 @@ public function remove(ApiRequest $request)
337380 return response ()->json (['success ' => 'true ' ,
338381 'status_code ' => 200 ,
339382 'gene ' => $ name ,
340- 'message ' => 'Gene UnFollowed ' ],
383+ 'message ' => 'Item UnFollowed ' ],
341384 200 );
342385
343386 }
@@ -410,8 +453,8 @@ public function reload()
410453
411454 foreach ($ user ->panels as $ panel )
412455 {
413- $ gene = new Gene (['name ' => $ panel ->name ,
414- 'hgnc_id ' => $ panel ->affiliate_id ,
456+ $ gene = new Gene (['name ' => $ panel ->smart_title ,
457+ 'hgnc_id ' => ' ! ' . $ panel ->ident ,
415458 'activity ' => ['dosage ' => false , 'pharma ' => false , 'varpath ' => false , 'validity ' => false , 'actionability ' => false ],
416459 'type ' => 4 ,
417460 'date_last_curated ' => ''
@@ -451,6 +494,29 @@ public function dare_expand(Request $request, $group = null)
451494 ->with ('group ' , $ region )
452495 ->with ('genes ' , $ genes ->collection );
453496 }
497+
498+
499+ /**
500+ * Expand a panel entry row.
501+ *
502+ * @return \Illuminate\Contracts\Support\Renderable
503+ */
504+ public function dape_expand (Request $ request , $ group = null )
505+ {
506+ if (empty ($ group ))
507+ return "Panel not found " ;
508+
509+ $ panel = Panel::ident ($ group )->first ();
510+
511+ if ($ panel === null )
512+ return "Panel not found " ;
513+
514+ $ genes = $ panel ->genes ;
515+
516+ return view ('dashboard.includes.expand-panel ' )
517+ ->with ('group ' , $ panel )
518+ ->with ('genes ' , $ genes );
519+ }
454520/*
455521 @foreach ($genes as $gene)
456522 <tr data-hgnc="{{ $gene->hgnc_id }}">
0 commit comments