import{a as q}from"./chunk-5OT2MLHH.js";import{a as L}from"./chunk-4IRXRL4C.js";import"./chunk-LAJI7RPC.js";import{a as U}from"./chunk-4MZCYQX4.js";import{b as M,c as j,d as z}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as u}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{$a as D,Ob as P,_a as N,a as Q,c as m,l as k,tb as v,wb as E}from"./chunk-YSQLW2JA.js";import"./chunk-NVJ2ZZFT.js";import{Aa as b,Dc as l,Fb as T,Hb as A,Mg as g,Ng as h,Te as _,ab as S,bb as p,bh as w,cd as R,dd as d,g as K,gg as f,hd as y,hg as I,jg as O,kb as C,ya as c}from"./chunk-SKPDQO4E.js";var G=`<div class="h-100">
  <side-navigation *ngIf="visibleComponent">
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12 mb-2" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'SOCA.TRANSACTION_ACTION_OWNER' | translate}}</label>
          <armon-select-search query="identity" [allowMulti]="false" [(ngModel)]="filter.actionUserId"
            (ngModelChange)="onActionIdentityChanged($event)">
          </armon-select-search>
        </div>
        <div class="col-12 mb-2" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'SOCA.TRANSACTION_ACTION_USER' | translate}}</label>
          <armon-select-search query="identity" [allowMulti]="false" [(ngModel)]="filter.targetUserId"
            (ngModelChange)="onTargetIdentityChanged($event)">
          </armon-select-search>
        </div>
      </div>
      <!-- Buttons for filtering state -->
      <div class="centered filterButtons">
        <button class="btn btn-success btn-sm" (click)="onGetExcelClicked($event)">{{'BUTTON.EXCEL'
          | translate}}</button>
      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row report-filter-container">
          <div class="col-12">
            <div class="row">
              <div class="col-12">
                <armon-date-picker [options]="datePickerOptions" (selectionChanged)="onDateSelectionChanged($event)">
                </armon-date-picker>
              </div>
            </div>
          </div>
        </div>
        <div class="row pt-5" *ngIf="!transactions || transactions.length==0">
          <div class="col-12">
            <nz-empty [nzNotFoundContent]="contentTpl" [nzNotFoundImage]="'./assets/images/empty/empty_list.png'">
              <ng-template #contentTpl>
                <span>{{'COMMON.NO_DATA'|translate}}</span>
              </ng-template>
            </nz-empty>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container"
          *ngIf="transactions && transactions.length > 0">
          <div class="col-12">
            <p-table [value]="transactions" dataKey="id" [responsive]="true" rowExpandMode="single">
              <ng-template pTemplate="header">
                <tr>
                  <th>{{'SOCA.TRANSACTION_ACTION_OWNER' | translate}}</th>
                  <th>{{'SOCA.TRANSACTION_ACTION_DATE' | translate}}</th>
                  <th class="width-20p">{{'SOCA.TRANSACTION_ACTION_AMOUNT' | translate}}</th>
                </tr>
              </ng-template>
              <ng-template pTemplate="body" let-transaction let-rowData let-expanded="expanded">
                <tr [pRowToggler]="rowData" [attr.expanded]="expanded" class="data-row">
                  <td>
                    <span>{{transaction.actionUser.fullname}}</span>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <span class="main-text">{{transaction.dateDayText}}<armon-local-date [dateUtc]="transaction.date">
                        </armon-local-date></span>
                      <span class="sub-text">{{transaction.dateText}}</span>
                    </div>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <span class="main-text">{{transaction.amount|number}}</span>
                      <span class="sub-text">{{'SOCA.BALANCE_UNIT' | translate}}</span>
                    </div>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-transaction>
                <tr>
                  <td [attr.colspan]="3" class="expanded-row">
                    <armon-soca-transactions-report-detail [transaction]="transaction">
                    </armon-soca-transactions-report-detail>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </div>
          <div class="col-12 mb-3 mt-3">
            <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
              (pageChanged)="pageChanged($event)"></armon-pagination>
          </div>
        </div>
      </div>
    </ng-template>
  </side-navigation>
</div>`;var B=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}
`;var J=K(Q());var $=`<div class="w-100">
  <div class="row mb-3" *ngIf="transaction.note && transaction.note!=''">
    <div class="col-12">
      <span class="text-sm"><strong>{{'SOCA.BALANCE_NEW_ACTION_NOTE' | translate}}</strong></span> :
      <span>{{transaction.note}}</span>
    </div>
  </div>
  <div class="row mb-2">
    <div class="col-12">
      <span class="text-sm fw-medium">{{'SOCA.TRANSACTION_ACTION_USERS' | translate}}</span>
    </div>
  </div>
  <div class="row">
    <div class="col-lg-3 col-md-4 col-sm-6 col-12" *ngFor="let user of users">
      <div class="p-2">
        <cds-icon shape="user" class="me-2">
        </cds-icon><span class="text-xs">{{user.fullname}}</span>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-xl-12 mb-3 mt-3">
      <armon-pagination [paginationResponse]="paginationResponse" [scrollDisable]="true"
        (pageChanged)="pageChanged($event)"></armon-pagination>
    </div>
  </div>
</div>`;var F=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}
`;var Z=function(o,t,n,a){var i=arguments.length,e=i<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(o,t,n,a);else for(var r=o.length-1;r>=0;r--)(s=o[r])&&(e=(i<3?s(e):i>3?s(t,n,e):s(t,n))||e);return i>3&&e&&Object.defineProperty(t,n,e),e},x=class{socialAreaService;transaction;request;users;paginationResponse=new h;paginationRequest=new g;visibleComponent=!1;constructor(t){this.socialAreaService=t}ngOnInit(){this.request=D.getEmptyModel(),this.getList()}getList(){this.socialAreaService.getTransactionDetail(this.transaction.id,this.request).subscribe(t=>{this.users=t.users,this.paginationResponse=t.pagination})}pageChanged(t){this.request.pagination.skip=t.skip,this.request.pagination.take=t.take,this.getList()}static ctorParameters=()=>[{type:v}];static propDecorators={transaction:[{type:b}]}};x=Z([c({selector:"armon-soca-transactions-report-detail",template:$,standalone:!0,imports:[p,S,u,d],styles:[F]})],x);var tt=function(o,t,n,a){var i=arguments.length,e=i<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")e=Reflect.decorate(o,t,n,a);else for(var r=o.length-1;r>=0;r--)(s=o[r])&&(e=(i<3?s(e):i>3?s(t,n,e):s(t,n))||e);return i>3&&e&&Object.defineProperty(t,n,e),e},W=class{router;route;authService;socialAreaService;translate;filter;transactions;visibleComponent=!1;paginationResponse=new h;paginationRequest=new g;permissionSearchIdentity;datePickerOptions=new I;constructor(t,n,a,i,e){this.router=t,this.route=n,this.authService=a,this.socialAreaService=i,this.translate=e}ngOnInit(){this.permissionSearchIdentity=this.authService.checkPermission(y.IDENTITY.getReadBasic()),this.filter=N.getEmptyModel(),this.datePickerOptions.items=[{type:f.LastWeek,selected:!0},{type:f.LastMonth},{type:f.CustomWithTimer}];let t=O.getDateSelection(this.datePickerOptions.items[0]);this.setDateSelection(t),this.visibleComponent=!0}ngAfterViewInit(){this.route.queryParams.subscribe(t=>{let n=!1;t&&t[m.UserId]&&t[m.UserId]!=""&&this.permissionSearchIdentity&&(this.filter.targetUserId=t[m.UserId],n=!0),n||this.getList()})}ngOnDestroy(){}setDateSelection(t){this.filter.dateRange.startDateTime=t.startDate,this.filter.dateRange.endDateTime=t.endDate}getList(){this.socialAreaService.getTransactionList(this.filter).subscribe(t=>{this.transactions=t.items,this.paginationResponse=t.pagination})}onGetExcelClicked(t){this.socialAreaService.getTransactionListAsExcel(this.filter).subscribe(n=>{this.translate.get(["PAGES.SOCA_REPORT_TRANSACTIONS"]).subscribe(a=>{J.default.saveAs(n,a["PAGES.SOCA_REPORT_TRANSACTIONS"]+" "+l.fromJSDate(this.filter.dateRange.startDateTime).toLocaleString(l.DATETIME_MED)+" "+l.fromJSDate(this.filter.dateRange.endDateTime).toLocaleString(l.DATETIME_MED)+".xlsx")})})}refreshList(t=!0){t&&(this.filter.pagination.skip=0),this.getList()}onActionIdentityChanged(t){this.refreshList()}onTargetIdentityChanged(t){this.refreshList()}pageChanged(t){this.filter.pagination.skip=t.skip,this.filter.pagination.take=t.take,this.refreshList(!1)}onDateSelectionChanged(t){this.setDateSelection(t),this.refreshList()}static ctorParameters=()=>[{type:A},{type:T},{type:P},{type:v},{type:R}]};W=tt([c({selector:"armon-soca-transactions-report",template:G,standalone:!0,imports:[p,z,M,E,_,j,k,w,q,U,L,x,u,C,d],styles:[B]})],W);export{W as SocaTransactionsReportComponent};
