2018-05-25 13:49:00 +00:00
|
|
|
<mat-card>
|
|
|
|
<mat-card-title-group>
|
|
|
|
<mat-card-title>Receipt</mat-card-title>
|
2020-10-01 15:21:22 +00:00
|
|
|
<mat-icon
|
|
|
|
matSuffix
|
|
|
|
(click)="voucher.isStarred = !voucher.isStarred"
|
|
|
|
class="pointer"
|
|
|
|
[class.gold]="voucher.isStarred"
|
|
|
|
>
|
2018-07-07 11:01:44 +00:00
|
|
|
{{ voucher.isStarred ? 'star' : 'star_border' }}
|
|
|
|
</mat-icon>
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-card-title-group>
|
|
|
|
<mat-card-content>
|
|
|
|
<form [formGroup]="form" fxLayout="column">
|
2020-10-01 15:21:22 +00:00
|
|
|
<div
|
|
|
|
fxLayout="row"
|
|
|
|
fxLayoutAlign="space-around start"
|
|
|
|
fxLayout.lt-md="column"
|
|
|
|
fxLayoutGap="20px"
|
|
|
|
fxLayoutGap.lt-md="0px"
|
|
|
|
>
|
2018-05-25 13:49:00 +00:00
|
|
|
<mat-form-field fxFlex="40">
|
2020-10-01 15:21:22 +00:00
|
|
|
<input
|
|
|
|
matInput
|
|
|
|
[matDatepicker]="date"
|
|
|
|
placeholder="Date"
|
|
|
|
formControlName="date"
|
|
|
|
autocomplete="off"
|
|
|
|
#dateElement
|
|
|
|
(focus)="dateElement.select()"
|
|
|
|
/>
|
2018-05-25 13:49:00 +00:00
|
|
|
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
|
|
|
|
<mat-datepicker #date></mat-datepicker>
|
|
|
|
</mat-form-field>
|
|
|
|
<mat-form-field fxFlex="40">
|
|
|
|
<mat-select formControlName="receiptAccount">
|
|
|
|
<mat-option *ngFor="let account of receiptAccounts" [value]="account.id">
|
|
|
|
{{ account.name }}
|
|
|
|
</mat-option>
|
|
|
|
</mat-select>
|
|
|
|
</mat-form-field>
|
|
|
|
<mat-form-field fxFlex="20">
|
|
|
|
<mat-label>Receipt Amount</mat-label>
|
|
|
|
<span matPrefix>₹ </span>
|
2020-10-01 15:21:22 +00:00
|
|
|
<input type="text" matInput formControlName="receiptAmount" />
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-form-field>
|
|
|
|
</div>
|
|
|
|
|
2020-10-01 15:21:22 +00:00
|
|
|
<div
|
|
|
|
formGroupName="addRow"
|
|
|
|
fxLayout="row"
|
|
|
|
fxLayoutAlign="space-around start"
|
|
|
|
fxLayout.lt-md="column"
|
|
|
|
fxLayoutGap="20px"
|
|
|
|
fxLayoutGap.lt-md="0px"
|
|
|
|
>
|
2018-05-25 13:49:00 +00:00
|
|
|
<mat-form-field fxFlex="55">
|
2020-10-01 15:21:22 +00:00
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
matInput
|
|
|
|
placeholder="Account"
|
|
|
|
#accountElement
|
|
|
|
[matAutocomplete]="auto"
|
|
|
|
formControlName="account"
|
|
|
|
autocomplete="off"
|
|
|
|
/>
|
2018-05-25 13:49:00 +00:00
|
|
|
<mat-hint *ngIf="accBal">
|
2020-10-01 15:21:22 +00:00
|
|
|
Balance as on Date: <strong>{{ accBal.date | currency: 'INR' | accounting }}</strong> /
|
|
|
|
Final balance: <strong>{{ accBal.total | currency: 'INR' | accounting }}</strong>
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-hint>
|
|
|
|
</mat-form-field>
|
2020-10-01 15:21:22 +00:00
|
|
|
<mat-autocomplete
|
|
|
|
#auto="matAutocomplete"
|
|
|
|
autoActiveFirstOption
|
|
|
|
[displayWith]="displayAccount"
|
|
|
|
(optionSelected)="accountSelected($event)"
|
|
|
|
>
|
|
|
|
<mat-option *ngFor="let account of accounts | async" [value]="account">{{
|
|
|
|
account.name
|
|
|
|
}}</mat-option>
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-autocomplete>
|
|
|
|
<mat-form-field fxFlex="25">
|
|
|
|
<mat-label>Amount</mat-label>
|
|
|
|
<span matPrefix>₹ </span>
|
2020-10-01 15:21:22 +00:00
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
matInput
|
|
|
|
placeholder="Amount"
|
|
|
|
formControlName="amount"
|
|
|
|
autocomplete="off"
|
|
|
|
/>
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-form-field>
|
|
|
|
|
|
|
|
<button mat-raised-button color="primary" (click)="addRow()" fxFlex="20">Add</button>
|
|
|
|
</div>
|
|
|
|
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
|
|
|
|
<!-- Account Column -->
|
|
|
|
<ng-container matColumnDef="account">
|
|
|
|
<mat-header-cell *matHeaderCellDef>Account</mat-header-cell>
|
2020-10-01 15:21:22 +00:00
|
|
|
<mat-cell *matCellDef="let row">{{ row.account.name }}</mat-cell>
|
2018-05-25 13:49:00 +00:00
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
<!-- Amount Column -->
|
|
|
|
<ng-container matColumnDef="amount">
|
|
|
|
<mat-header-cell *matHeaderCellDef class="right">Amount</mat-header-cell>
|
2020-10-01 15:21:22 +00:00
|
|
|
<mat-cell *matCellDef="let row" class="right">{{
|
|
|
|
row.amount | currency: 'INR'
|
|
|
|
}}</mat-cell>
|
2018-05-25 13:49:00 +00:00
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
<!-- Action Column -->
|
|
|
|
<ng-container matColumnDef="action">
|
|
|
|
<mat-header-cell *matHeaderCellDef class="center">Action</mat-header-cell>
|
|
|
|
<mat-cell *matCellDef="let row" class="center">
|
2019-04-18 10:34:42 +00:00
|
|
|
<button mat-icon-button tabindex="-1" (click)="editRow(row)">
|
2018-05-25 13:49:00 +00:00
|
|
|
<mat-icon>edit</mat-icon>
|
|
|
|
</button>
|
2019-04-18 10:34:42 +00:00
|
|
|
<button mat-icon-button tabindex="-1" color="warn" (click)="deleteRow(row)">
|
2018-05-25 13:49:00 +00:00
|
|
|
<mat-icon>delete</mat-icon>
|
|
|
|
</button>
|
|
|
|
</mat-cell>
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
2020-10-01 15:21:22 +00:00
|
|
|
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-table>
|
|
|
|
<mat-form-field>
|
|
|
|
<mat-label>Narration</mat-label>
|
2020-10-01 15:21:22 +00:00
|
|
|
<textarea
|
|
|
|
matInput
|
|
|
|
matTextareaAutosize
|
|
|
|
matAutosizeMinRows="5"
|
|
|
|
placeholder="Narration"
|
|
|
|
formControlName="narration"
|
|
|
|
></textarea>
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-form-field>
|
|
|
|
<div fxLayout="row" fxLayoutGap="0.5%" fxLayoutAlign="center">
|
|
|
|
<div class="img-container" fxFlex="20%" *ngFor="let item of voucher.files">
|
2020-10-01 15:21:22 +00:00
|
|
|
<img [src]="item.thumbnail" (click)="zoomImage(item)" />
|
2018-05-25 13:49:00 +00:00
|
|
|
<button mat-icon-button class="overlay" (click)="deleteImage(item)">
|
|
|
|
<mat-icon>delete</mat-icon>
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-06-09 12:04:57 +00:00
|
|
|
<div class="img-container" fxFlex="20%">
|
|
|
|
<label ng-href for="fileUp">
|
|
|
|
<img
|
2020-10-01 15:21:22 +00:00
|
|
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTUwIj48cmVjdCB3aWR0aD0iMTAwIiBoZWlnaHQ9IjE1MCIgZmlsbD0iI2VlZSIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjUwIiB5PSI3NSIgc3R5bGU9ImZpbGw6I2FhYTtmb250LXdlaWdodDpib2xkO2ZvbnQtc2l6ZToxMDBweDtmb250LWZhbWlseTpBcmlhbCxIZWx2ZXRpY2Esc2Fucy1zZXJpZjtkb21pbmFudC1iYXNlbGluZTpjZW50cmFsIj4rPC90ZXh0Pjwvc3ZnPg=="
|
|
|
|
/>
|
2018-06-09 12:04:57 +00:00
|
|
|
</label>
|
2020-10-01 15:21:22 +00:00
|
|
|
<input
|
|
|
|
type="file"
|
|
|
|
id="fileUp"
|
|
|
|
multiple
|
|
|
|
accept="image/*"
|
|
|
|
style="display: none"
|
|
|
|
(change)="detectFiles($event)"
|
|
|
|
/>
|
2018-06-09 12:04:57 +00:00
|
|
|
</div>
|
2018-05-25 13:49:00 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</mat-card-content>
|
|
|
|
<mat-card-actions>
|
|
|
|
<button mat-raised-button color="primary" (click)="save()" [disabled]="!canSave()">
|
2020-10-01 15:21:22 +00:00
|
|
|
{{ voucher.id ? 'Update' : 'Save' }}
|
2018-05-25 13:49:00 +00:00
|
|
|
</button>
|
2020-10-01 15:21:22 +00:00
|
|
|
<button
|
|
|
|
mat-raised-button
|
|
|
|
(click)="post()"
|
|
|
|
*ngIf="voucher.id"
|
|
|
|
[disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"
|
|
|
|
>
|
|
|
|
{{ voucher.posted ? 'Posted' : 'Post' }}
|
2018-05-25 13:49:00 +00:00
|
|
|
</button>
|
2020-10-01 15:21:22 +00:00
|
|
|
<button
|
|
|
|
mat-raised-button
|
|
|
|
color="warn"
|
|
|
|
(click)="confirmDelete()"
|
|
|
|
*ngIf="voucher.id"
|
|
|
|
[disabled]="!canSave()"
|
|
|
|
>
|
2018-05-25 13:49:00 +00:00
|
|
|
Delete
|
|
|
|
</button>
|
|
|
|
</mat-card-actions>
|
|
|
|
<mat-card-subtitle *ngIf="voucher.id">
|
2020-10-01 15:21:22 +00:00
|
|
|
Created on <strong>{{ voucher.creationDate | localTime }}</strong> and Last Edited on
|
|
|
|
<strong>{{ voucher.lastEditDate | localTime }}</strong> by
|
|
|
|
<strong>{{ voucher.user.name }}</strong
|
|
|
|
>. {{ voucher.poster ? 'Posted by ' + voucher.poster : '' }}
|
2018-05-25 13:49:00 +00:00
|
|
|
</mat-card-subtitle>
|
|
|
|
</mat-card>
|