<commit_before><?php

class page_reports_member_member extends Page {
	public $title='Member Report';

	function page_index(){
		// parent::init();

		$form = $this->add('Form');
		$type_array = [];
		foreach (explode(",", MEMBER_TYPES) as $key => $value) {
			$type_array[$value] = $value; 
		}

		$form->addField('Dropdown','type')->setValueList(array_merge($type_array,["All"=>"All"]));
		$form->addSubmit('Get List');
		$member_model=$this->add('Model_Member');
		$member_model->setOrder('created_at','desc');

		$grid=$this->add('Grid');
		if($_GET['filter']){
			$this->api->stickyGET('filter');

			if($_GET['type']){
				$this->api->stickyGET('type');
				if($_GET['type'] != "All"){
					$member_model->addCondition('memebr_type',$_GET['type']);
				}
			}

		}else{
			$member_model->addCondition('id',-1);
		}
		// $grid->add('H3',null,'grid_buttons')->set('Member Repo As On '. date('d-M-Y',strtotime($till_date))); 
		$grid->setModel($member_model,array('member_no','branch','name','CurrentAddress','landmark','tehsil','city','PhoneNos','created_at','is_active','is_defaulter','doc_thumb_url','sig_image_id'));
		$grid->addPaginator(50);
		$grid->addQuickSearch(array('member_no','name','PhoneNos'));
		$self=$this;

		$self=$this;
		$grid->addColumn('comment');
		$grid->addMethod('format_comment',function($g,$f)use($self){
			// throw new \Exception($g->model->id, 1);
			$comment_model=$self->add('Model_Comment');//->load($g->model->id);
			$comment_model->addCondition('member_id',$g->model->id);
			$comment_model->setOrder('created_at','desc');
			$comment_model->tryLoadAny();
			$narration=$comment_model->get('narration');
			$g->current_row[$f]=$narration;
		});

		$grid->addMethod('init_image2',function($g){
			$this->js('click')->_selector('img')->univ()->frameURL('IMAGE',[$this->app->url('image'),'image_id'=>$this->js()->_selectorThis()->data('sig-image-id') ]);
		});

		$grid->addMethod('format_image2',function($g,$f)use($self){
			$g->current_row_html[$f]=$g->model['doc_thumb_url']?'<img src="'.$g->model['doc_thumb_url'].'" data-sig-image-id="'.$g->model['sig_image_id'].'"/>':'';
		});
		
		$grid->addFormatter('comment','comment');
		$grid->addFormatter('landmark','wrap');
		$grid->addFormatter('doc_thumb_url','image2');
		

		
		$grid->addColumn('expander','details');
		$grid->addColumn('expander','accounts');
		$grid->addColumn('expander','guarantor_in');
		$grid->removeColumn('sig_image_id');

		// $js=array(
		// 	$this->js()->_selector('.mymenu')->parent()->parent()->toggle(),
		// 	$this->js()->_selector('#header')->toggle(),
		// 	$this->js()->_selector('#footer')->toggle(),
		// 	$this->js()->_selector('ul.ui-tabs-nav')->toggle(),
		// 	$this->js()->_selector('.atk-form')->toggle(),
		// 	);

		// $grid->js('click',$js);

		if($form->isSubmitted()){
			$send = array('type'=>$form['type'],'filter'=>1);
			$grid->js()->reload($send)->execute();

		}	
	}

	function page_details(){
		$this->api->stickyGET('members_id');
		$member_model=$this->add('Model_Member');
		$member_model->addCondition('id',$_GET['members_id']);

		$grid=$this->add('Grid');

		$extra_fields=array('branch_id','name','CurrentAddress','tehsil','city','PhoneNos','created_at','is_active','is_defaulter');
		foreach ($extra_fields as $key => $value) {
			$member_model->getElement($value)->system(true);
		}
		$grid->setModel($member_model);
		
		$grid->addMethod('format_Nominee',function($g,$q){
			if($g->model['Nominee'])
				$nominee = $g->model['Nominee'];
			else{
				$sm_account = $g->add('Model_Account_SM')->addCondition('member_id',$g->model->id);
				$sm_account->tryLoadAny();
				$nominee = $sm_account['Nominee'];
			}
			$g->current_row_html['Nominee'] = $nominee;
		});
		$grid->addFormatter('Nominee','Nominee');

<commit_msg>member report add bank filter condition<commit_after><?php

class page_reports_member_member extends Page {
	public $title='Member Report';

	function page_index(){
		// parent::init();

		$form = $this->add('Form');
		$type_array = [];
		foreach (explode(",", MEMBER_TYPES) as $key => $value) {
			$type_array[$value] = $value; 
		}

		$form->addField('Dropdown','type')->setValueList(array_merge($type_array,["All"=>"All"]));
		$bank_field = $form->addField('Dropdown','bank')->setEmptyText('All Banks');
		$bank_field->setModel('Bank');
		$form->addSubmit('Get List');
		$member_model=$this->add('Model_Member');
		$member_model->setOrder('created_at','desc');
		$member_model->addExpression('bank_a_id')->set($member_model->refSQL('bankbranch_a_id')->fieldQuery('bank_id'));
		$member_model->addExpression('bank_b_id')->set($member_model->refSQL('bankbranch_b_id')->fieldQuery('bank_id'));
		
		$grid=$this->add('Grid');
		if($_GET['filter']){
			$this->api->stickyGET('filter');

			if($_GET['type']){
				$this->api->stickyGET('type');
				if($_GET['type'] != "All"){
					$member_model->addCondition('memebr_type',$_GET['type']);
				}
			}
			if($_GET['bank']){
				$this->api->stickyGET('bank');
				$member_model->addCondition([['bank_a_id',$_GET['bank']],['bank_b_id',$_GET['bank']]]);
			}

		}else{
			$member_model->addCondition('id',-1);
		}
		// $grid->add('H3',null,'grid_buttons')->set('Member Repo As On '. date('d-M-Y',strtotime($till_date))); 
		$grid->setModel($member_model,array('member_no','branch','name','CurrentAddress','landmark','tehsil','city','PhoneNos','created_at','is_active','is_defaulter','doc_thumb_url','sig_image_id'));
		$grid->addPaginator(50);
		$grid->addQuickSearch(array('member_no','name','PhoneNos'));
		$self=$this;

		$self=$this;
		$grid->addColumn('comment');
		$grid->addMethod('format_comment',function($g,$f)use($self){
			// throw new \Exception($g->model->id, 1);
			$comment_model=$self->add('Model_Comment');//->load($g->model->id);
			$comment_model->addCondition('member_id',$g->model->id);
			$comment_model->setOrder('created_at','desc');
			$comment_model->tryLoadAny();
			$narration=$comment_model->get('narration');
			$g->current_row[$f]=$narration;
		});

		$grid->addMethod('init_image2',function($g){
			$this->js('click')->_selector('img')->univ()->frameURL('IMAGE',[$this->app->url('image'),'image_id'=>$this->js()->_selectorThis()->data('sig-image-id') ]);
		});

		$grid->addMethod('format_image2',function($g,$f)use($self){
			$g->current_row_html[$f]=$g->model['doc_thumb_url']?'<img src="'.$g->model['doc_thumb_url'].'" data-sig-image-id="'.$g->model['sig_image_id'].'"/>':'';
		});
		
		$grid->addFormatter('comment','comment');
		$grid->addFormatter('landmark','wrap');
		$grid->addFormatter('doc_thumb_url','image2');
		

		
		$grid->addColumn('expander','details');
		$grid->addColumn('expander','accounts');
		$grid->addColumn('expander','guarantor_in');
		$grid->removeColumn('sig_image_id');

		// $js=array(
		// 	$this->js()->_selector('.mymenu')->parent()->parent()->toggle(),
		// 	$this->js()->_selector('#header')->toggle(),
		// 	$this->js()->_selector('#footer')->toggle(),
		// 	$this->js()->_selector('ul.ui-tabs-nav')->toggle(),
		// 	$this->js()->_selector('.atk-form')->toggle(),
		// 	);

		// $grid->js('click',$js);

		if($form->isSubmitted()){
			$send = array('type'=>$form['type'],'bank'=>$form['bank'],'filter'=>1);
			$grid->js()->reload($send)->execute();

		}	
	}

	function page_details(){
		$this->api->stickyGET('members_id');
		$member_model=$this->add('Model_Member');
		$member_model->addCondition('id',$_GET['members_id']);

		$grid=$this->add('Grid');

		$extra_fields=array('branch_id','name','CurrentAddress','tehsil','city','PhoneNos','created_at','is_active','is_defaulter');
		foreach ($extra_fields as $key => $value) {
			$member_model->getElement($value)->system(true);
		}
		$grid->setModel($member_model);
		
		$grid->addMethod('format_Nominee',function($g,$q){
			if($g->model['Nominee'])
				$nominee = $g->model['Nominee'];
			else{
				$sm_account = $g->add('Model_Account_SM')->addCondition('member_id',$g->model->id);
				$sm_account->tryLoadAny();
				$nominee = $sm_account['Nominee'];
			}
			$g->current_row_html['Nominee'] = $nominee;
		});
		$grid->addFormatter('Nominee','Nominee');


{'fraction_non_alphanumeric': 0.2660493827160494, 'fraction_numerical': 0.0022222222222222222, 'mean_word_length': 6.150044130626655, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 222, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4127151', 'n_tokens_mistral': 3248, 'n_tokens_neox': 2883, 'n_words': 234}