@@ -242,6 +242,8 @@ define(['marionette',
242242 add : '.add_image' ,
243243 ads : 'a.add_point' ,
244244 adr : 'a.add_region' ,
245+ addis : 'a.add_dispensing' ,
246+ deldis : 'a.del_dispensing' ,
245247
246248 drop : '.dropimage' ,
247249 prog : '.progress' ,
@@ -275,6 +277,8 @@ define(['marionette',
275277 'change @ui.ins' : 'selectInspection' ,
276278 'click @ui.ads' : 'setAddSubsamplePoint' ,
277279 'click @ui.adr' : 'setAddSubsampleRegion' ,
280+ 'click @ui.addis' : 'setAddDispensing' ,
281+ 'click @ui.deldis' : 'deleteDispensing' ,
278282 'click a.add_inspection' : 'showAddInspection' ,
279283 'click a.view_sched' : 'showViewSchedule' ,
280284 'click @ui.play' : 'playInspection' ,
@@ -483,16 +487,24 @@ define(['marionette',
483487 this . ui . ads . removeClass ( 'button-highlight' )
484488 this . image . setAddSubsample ( false )
485489 this . ui . ads . find ( 'span' ) . text ( 'Mark Point' )
490+ this . ui . ads . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
486491
487492 } else {
488493 this . ui . ads . addClass ( 'button-highlight' )
489494 this . image . setAddSubsample ( true )
490495 this . ui . ads . find ( 'span' ) . text ( 'Finish' )
496+ this . ui . ads . find ( 'i' ) . removeClass ( 'fa-plus' ) . addClass ( 'fa-times' )
491497 }
492498
493499 this . ui . adr . removeClass ( 'button-highlight' )
500+ this . ui . addis . removeClass ( 'button-highlight' )
494501 this . image . setAddSubsampleRegion ( false )
502+ this . image . setAddDispensing ( false )
495503 this . ui . adr . find ( 'span' ) . text ( 'Mark Region' )
504+ this . ui . adr . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
505+ this . ui . addis . find ( 'span' ) . text ( 'Mark Dispensing' )
506+ this . ui . addis . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
507+ this . ui . deldis . hide ( )
496508 } ,
497509
498510
@@ -503,16 +515,59 @@ define(['marionette',
503515 this . ui . adr . removeClass ( 'button-highlight' )
504516 this . image . setAddSubsampleRegion ( false )
505517 this . ui . adr . find ( 'span' ) . text ( 'Mark Region' )
518+ this . ui . adr . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
506519
507520 } else {
508521 this . ui . adr . addClass ( 'button-highlight' )
509522 this . image . setAddSubsampleRegion ( true )
510523 this . ui . adr . find ( 'span' ) . text ( 'Finish' )
524+ this . ui . adr . find ( 'i' ) . removeClass ( 'fa-plus' ) . addClass ( 'fa-times' )
511525 }
512526
513527 this . ui . ads . removeClass ( 'button-highlight' )
528+ this . ui . addis . removeClass ( 'button-highlight' )
514529 this . image . setAddSubsample ( false )
530+ this . image . setAddDispensing ( false )
515531 this . ui . ads . find ( 'span' ) . text ( 'Mark Point' )
532+ this . ui . ads . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
533+ this . ui . addis . find ( 'span' ) . text ( 'Mark Dispensing' )
534+ this . ui . addis . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
535+ this . ui . deldis . hide ( )
536+ } ,
537+
538+ setAddDispensing : function ( e ) {
539+ if ( e ) e . preventDefault ( )
540+
541+ if ( this . ui . addis . hasClass ( 'button-highlight' ) ) {
542+ this . ui . addis . removeClass ( 'button-highlight' )
543+ this . image . setAddDispensing ( false )
544+ this . ui . addis . find ( 'span' ) . text ( 'Mark Dispensing' )
545+ this . ui . addis . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
546+ this . ui . deldis . hide ( )
547+
548+ } else {
549+ this . ui . addis . addClass ( 'button-highlight' )
550+ this . image . setAddDispensing ( true )
551+ this . ui . addis . find ( 'span' ) . text ( 'Cancel' )
552+ this . ui . addis . find ( 'i' ) . removeClass ( 'fa-plus' ) . addClass ( 'fa-times' )
553+ if ( this . subsamples . length && this . subsamples . findWhere ( { BLSAMPLEID : this . getSample ( ) } ) . get ( 'DISPENSEX' ) ) {
554+ this . ui . deldis . show ( )
555+ }
556+ }
557+
558+ this . ui . ads . removeClass ( 'button-highlight' )
559+ this . ui . adr . removeClass ( 'button-highlight' )
560+ this . image . setAddSubsample ( false )
561+ this . image . setAddSubsampleRegion ( false )
562+ this . ui . ads . find ( 'span' ) . text ( 'Mark Point' )
563+ this . ui . ads . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
564+ this . ui . adr . find ( 'span' ) . text ( 'Mark Region' )
565+ this . ui . adr . find ( 'i' ) . removeClass ( 'fa-times' ) . addClass ( 'fa-plus' )
566+ } ,
567+
568+ deleteDispensing : function ( e ) {
569+ e . preventDefault ( )
570+ this . image . deleteDispensing ( )
516571 } ,
517572
518573
@@ -905,12 +960,14 @@ define(['marionette',
905960 this . listenTo ( this . image , 'image:prev' , this . prevImage , this )
906961 this . listenTo ( this . image , 'image:first' , this . firstImage , this )
907962 this . listenTo ( this . image , 'image:last' , this . lastImage , this )
963+ this . listenTo ( this . image , 'finishdispensing' , this . setAddDispensing , this )
908964
909965 if ( this . getOption ( 'params' ) . iid ) this . ui . ins . val ( this . getOption ( 'params' ) . iid )
910966 this . selectInspection ( )
911967
912968 this . ui . prog . hide ( )
913969 this . ui . prog . progressbar ( { value : 0 } )
970+ this . ui . deldis . hide ( )
914971
915972 this . img . show ( this . image )
916973 this . sten . show ( new ImageHistoryView ( { historyimages : this . startendimages , embed : true } ) )
0 commit comments