Rev 16929 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
<?php$acl = $this->viewModel()->getRoot()->getVariable('acl');$currentUser = $this->currentUserHelper();$routeReports = $this->url('discovery-contacts/report');$routeDownload = $this->url('discovery-contacts/report/download');$roleName = $currentUser->getUserTypeId();$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.js'));/*$this->headStyle()->captureStart();echo <<<CSS#tableContact {display: flex;flex-flow: column;width: 100%;}#tableContact thead {flex: 0 0 auto;}#tableContact tbody {flex: 1 1 auto;display: block;overflow-y: auto;overflow-x: hidden;}#tableContact tr {width: 100%;display: table;table-layout: fixed;}CSS;$this->headStyle()->captureEnd();*/$this->inlineScript()->captureStart();echo <<<JSjQuery( document ).ready(function( $ ) {$.fn.changeFilter = function() {NProgress.start();$.ajax({'dataType' : 'json','accept' : 'application/json','method' : 'get','url' : $('#form-filter').attr('action'),'data' : $('#form-filter').serialize(),}).done(function(response) {if(response['success']) {$('#tableContactBody').empty();$('#tableContactBody').html($('#tableTemplate').render(response['data']));} else {if(jQuery.type(response['data']) == 'string') {$.fn.showError(response['data']);} else {$.each(response['data'], function( fieldname, errors ) {$.fn.showFormErrorValidator('#form #' + fieldname, errors);});}}}).fail(function( jqXHR, textStatus, errorThrown) {$.fn.showError(textStatus);}).always(function() {NProgress.done();});return false;}$('#btn-report').click(function(e) {e.preventDefault();$.fn.changeFilter();});$('#btn-download').click(function(e) {e.preventDefault();NProgress.start();$.ajax({'dataType' : 'json','method' : 'get','url' : '$routeDownload','data' : $('#form-filter').serialize(),}).done(function(response) {if(response['success']) {var anchor = window.document.createElement("a");anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;anchor.download = response['data']['basename'];document.body.appendChild(anchor);anchor.click(); // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-accessdocument.body.removeChild(anchor);} else {$.fn.showError(response['data']);}}).fail(function( jqXHR, textStatus, errorThrown) {$.fn.showError(textStatus);}).always(function() {NProgress.done();});});});JS;$this->inlineScript()->captureEnd();?><div class="container"><div class="row"><div class="col-12 mt-3"><div class="card card-primary"><div class="card-header"><h6 class="card-title">LABEL_REPORTS</h6><!-- /.card-tools --></div><!-- /.card-header --><form name="form-filter" id="form-filter" action="<?php echo $routeReports ?>"><div class="card-body"><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('first_name');$element->setOptions(['label' => 'LABEL_FIRST_NAME' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('last_name');$element->setOptions(['label' => 'LABEL_LAST_NAME' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('personal_email');$element->setOptions(['label' => 'LABEL_PERSONAL_EMAIL' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('corporate_email');$element->setOptions(['label' => 'LABEL_CORPORATE_EMAIL' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('company');$element->setOptions(['label' => 'LABEL_COMPANY' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('position');$element->setOptions(['label' => 'LABEL_POSITION' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('country');$element->setOptions(['label' => 'LABEL_COUNTRY' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('state');$element->setOptions(['label' => 'LABEL_STATE' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('city');$element->setOptions(['label' => 'LABEL_CITY' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('phone');$element->setOptions(['label' => 'LABEL_PHONE' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('phone_extension');$element->setOptions(['label' => 'LABEL_PHONE_EXTENSION' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('celular');$element->setOptions(['label' => 'LABEL_CELULAR' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('whatsapp');$element->setOptions(['label' => 'LABEL_WHATSAPP' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div><div class="col-6 mt-3"><?php$element = $form->get('linkedin');$element->setOptions(['label' => 'LABEL_LINKEDIN' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div><div class="row"><div class="col-6 mt-3"><?php$element = $form->get('sector');$element->setOptions(['label' => 'LABEL_SECTOR' ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formText($element);?></div></div></div><div class="card-footer text-right"><button id="btn-report" class="btn btn-primary"> LABEL_REPORT </button><button id="btn-download" class="btn btn-primary"> LABEL_DOWNLOAD </button></div></form><!-- /.card-body --></div></div></div><div class="row"><div class="col-12 mt-3"><div class="card"><!-- /.card-header --><div class="card-body p-0"><div style="height: 300px;overflow: scroll;"><table id="tableContact" style="width: 100%" class="table table-bordered"><thead><tr><th nowrap>LABEL_FIRST_NAME</th><th nowrap>LABEL_LAST_NAME</th><th nowrap>LABEL_PERSONAL_EMAIL</th><th nowrap>LABEL_CORPORATE_EMAIL</th><th nowrap>LABEL_COMPANY</th><th nowrap>LABEL_POSITION</th><th nowrap>LABEL_COUNTRY</th><th nowrap>LABEL_STATE</th><th nowrap>LABEL_CITY</th><th nowrap>LABEL_PHONE</th><th nowrap>LABEL_PHONE_EXTENSION</th><th nowrap>LABEL_CELULAR</th><th nowrap>LABEL_WHATSAPP</th><th nowrap>LABEL_LINKEDIN</th><th nowrap>LABEL_SECTOR</th></tr></thead><tbody id="tableContactBody" ></tbody></table></div></div><!-- /.card-body --></div></div></div></div><script id="tableTemplate" type="text/x-jsrender">{{for items}}<tr><td>{{:first_name}}</td><td>{{:last_name}}</td><td>{{:personal_email}}</td><td>{{:corporate_email}}</td><td>{{:company}}</td><td>{{:position}}</td><td>{{:country}}</td><td>{{:state}}</td><td>{{:city}}</td><td>{{:phone}}</td><td>{{:phone_extension}}</td><td>{{:celular}}</td><td>{{:whatsapp}}</td><td>{{:linkedin}}</td><td>{{:sector}}</td></tr>{{/for}}</script>