-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from DLL-S/desenvolvimento
Atualiza base de código de produção
- Loading branch information
Showing
41 changed files
with
1,345 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NgModule } from "@angular/core"; | ||
import { RouterModule, Routes } from "@angular/router"; | ||
import { ComandasListComponent } from "./containers/comandas-list/comandas-list.component"; | ||
|
||
const comandasRoutes: Routes = [ | ||
{ path: "", component: ComandasListComponent } | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(comandasRoutes) | ||
], | ||
exports: [] | ||
}) | ||
export class ComandasRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,65 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
|
||
|
||
|
||
@NgModule({ | ||
declarations: [], | ||
imports: [ | ||
CommonModule | ||
] | ||
}) | ||
export class ComandasModule { } | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatRippleModule } from '@angular/material/core'; | ||
import { MatDialogModule } from '@angular/material/dialog'; | ||
import { MatExpansionModule } from '@angular/material/expansion'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { MatGridListModule } from '@angular/material/grid-list'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
import { MatListModule } from '@angular/material/list'; | ||
import { MatPaginatorModule } from '@angular/material/paginator'; | ||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; | ||
import { MatSelectModule } from '@angular/material/select'; | ||
import { MatSortModule } from '@angular/material/sort'; | ||
import { MatTableModule } from '@angular/material/table'; | ||
import { MatTooltipModule } from '@angular/material/tooltip'; | ||
import { NgxMaskModule } from 'ngx-mask'; | ||
import { CoreModule } from './../../core/core.module'; | ||
import { SharedModule } from './../../shared/shared.module'; | ||
import { ComandasRoutingModule } from './comandas-routing.module'; | ||
import { ComandaConfirmDialogComponent } from './components/comanda-confirm-dialog/comanda-confirm-dialog.component'; | ||
import { ComandaViewComponent } from './components/comanda-view/comanda-view.component'; | ||
import { ComandasListComponent } from './containers/comandas-list/comandas-list.component'; | ||
import { ComandasService } from './services/comandas.service'; | ||
import { ComandasState } from './state/comandas-state'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [ | ||
ComandasListComponent, | ||
ComandaViewComponent, | ||
ComandaConfirmDialogComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
ComandasRoutingModule, | ||
SharedModule, | ||
CoreModule, | ||
FormsModule, | ||
ReactiveFormsModule, | ||
MatTableModule, | ||
MatIconModule, | ||
MatRippleModule, | ||
MatSortModule, | ||
MatPaginatorModule, | ||
MatSelectModule, | ||
MatProgressSpinnerModule, | ||
MatExpansionModule, | ||
MatButtonModule, | ||
MatInputModule, | ||
MatListModule, | ||
MatFormFieldModule, | ||
MatTooltipModule, | ||
MatDialogModule, | ||
MatGridListModule, | ||
NgxMaskModule.forRoot(), | ||
], | ||
providers: [ | ||
ComandasState, | ||
ComandasService | ||
] | ||
}) | ||
export class ComandasModule { } |
Empty file.
13 changes: 13 additions & 0 deletions
13
.../modules/comandas/components/comanda-confirm-dialog/comanda-confirm-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h1 mat-dialog-title>Encerrar comanda {{data.id}}</h1> | ||
<div mat-dialog-content> | ||
<p>Deseja realmente encerrar a comanda <strong>{{data.nome}}</strong> ?</p> | ||
</div> | ||
<div mat-dialog-actions> | ||
<button mat-button | ||
color="warn" | ||
cdkFocusInitial | ||
(click)="cancelar()">Não</button> | ||
<button mat-button | ||
color="primary" | ||
(click)="confirmar()">Sim</button> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
...dules/comandas/components/comanda-confirm-dialog/comanda-confirm-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ComandaConfirmDialogComponent } from './comanda-confirm-dialog.component'; | ||
|
||
describe('ComandaConfirmDialogComponent', () => { | ||
let component: ComandaConfirmDialogComponent; | ||
let fixture: ComponentFixture<ComandaConfirmDialogComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ComandaConfirmDialogComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ComandaConfirmDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
...pp/modules/comandas/components/comanda-confirm-dialog/comanda-confirm-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component, Inject, Optional } from '@angular/core'; | ||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; | ||
import { Comanda } from '../../models/comanda.model'; | ||
|
||
@Component({ | ||
selector: 'app-comanda-confirm-dialog', | ||
templateUrl: './comanda-confirm-dialog.component.html', | ||
styleUrls: [ './comanda-confirm-dialog.component.css' ] | ||
}) | ||
export class ComandaConfirmDialogComponent { | ||
|
||
dados: Comanda; | ||
|
||
constructor ( | ||
public dialogRef: MatDialogRef<ComandaConfirmDialogComponent>, | ||
@Optional() @Inject(MAT_DIALOG_DATA) public data: Comanda | ||
) { | ||
this.dados = { ...data }; | ||
} | ||
|
||
confirmar() { | ||
this.dialogRef.close({ | ||
confirmacao: true | ||
}); | ||
} | ||
|
||
cancelar() { | ||
this.dialogRef.close({ | ||
confirmacao: false | ||
}); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/app/modules/comandas/components/comanda-view/comanda-view.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.label { | ||
color: rgb(73, 73, 73); | ||
} | ||
|
||
.content:not(:first-child) { | ||
margin-top: 25px; | ||
} | ||
|
||
.linha { | ||
margin-bottom: 4px; | ||
} | ||
|
||
.mat-expansion-panel { | ||
margin-top: 10px; | ||
} | ||
|
||
.mat-accordion > .mat-expansion-panel-spacing:first-child, | ||
.mat-accordion > *:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing { | ||
margin-top: 10px !important; | ||
} | ||
|
||
img { | ||
border-radius: 2px; | ||
max-width: 120px; | ||
min-width: 120px; | ||
object-fit: cover; | ||
} |
41 changes: 41 additions & 0 deletions
41
src/app/modules/comandas/components/comanda-view/comanda-view.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<h1 mat-dialog-title>Detalhes da comanda {{data.id}} ({{data.nome}})</h1> | ||
|
||
<div *ngFor="let item of data.listaPedidos" | ||
class="content"> | ||
<div class="linha"> | ||
<span class="label">Id do pedido:</span> | ||
<span class="valor"> {{item.id}}</span> | ||
</div> | ||
<div class="linha"> | ||
<span class="label">Horário:</span> | ||
<span class="valor"> {{item.dataHoraPedido | date:"dd/MM/yyyy HH:MM"}}</span> | ||
</div> | ||
<div class="linha"> | ||
<span class="label">Valor total:</span> | ||
<span class="valor"> {{getValorToral(item) | currency:"BRL"}}</span> | ||
</div> | ||
|
||
<mat-accordion> | ||
<mat-expansion-panel [expanded]="true"> | ||
<mat-expansion-panel-header> | ||
<mat-panel-title> | ||
Produtos | ||
</mat-panel-title> | ||
<mat-panel-description> | ||
Lista de produtos deste pedido | ||
</mat-panel-description> | ||
</mat-expansion-panel-header> | ||
|
||
<mat-list> | ||
<mat-list-item *ngFor="let produto of item.produtosDoPedido"> | ||
<img class="imagem" | ||
src='data:image/png;base64,{{produto.produto.foto}}' /> | ||
<div mat-line>{{produto.produto.nome}}</div> | ||
<div mat-line>Preço: {{produto.produto.preco | currency:"BRL"}}</div> | ||
<div mat-line>Quantidade: {{produto.quantidade}}x</div> | ||
<div mat-line>Status: {{getStatusProdutoPedido(produto.status)}}</div> | ||
</mat-list-item> | ||
</mat-list> | ||
</mat-expansion-panel> | ||
</mat-accordion> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
src/app/modules/comandas/components/comanda-view/comanda-view.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ComandaViewComponent } from './comanda-view.component'; | ||
|
||
describe('ComandaViewComponent', () => { | ||
let component: ComandaViewComponent; | ||
let fixture: ComponentFixture<ComandaViewComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ComandaViewComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ComandaViewComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
src/app/modules/comandas/components/comanda-view/comanda-view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component, Inject, OnInit, Optional } from '@angular/core'; | ||
import { MAT_DIALOG_DATA } from '@angular/material/dialog'; | ||
import { NotificationService } from 'src/app/core/services/notification.service'; | ||
import { Pedido } from 'src/app/modules/pedidos/models/pedido.model'; | ||
import { EnumStatusProdutoDoPedido } from './../../../../shared/models/enums/status-produto-pedido.enum'; | ||
import { Comanda } from './../../models/comanda.model'; | ||
import { ComandasService } from './../../services/comandas.service'; | ||
|
||
@Component({ | ||
selector: 'app-comanda-view', | ||
templateUrl: './comanda-view.component.html', | ||
styleUrls: [ './comanda-view.component.css' ] | ||
}) | ||
export class ComandaViewComponent implements OnInit { | ||
|
||
constructor (private comandaService: ComandasService, | ||
private notificationService: NotificationService, | ||
@Optional() @Inject(MAT_DIALOG_DATA) public data: Comanda | ||
) { } | ||
|
||
ngOnInit(): void { | ||
console.log(this.data); | ||
} | ||
|
||
getStatusProdutoPedido(status: EnumStatusProdutoDoPedido) { | ||
return EnumStatusProdutoDoPedido[ status ]; | ||
} | ||
|
||
getValorToral(pedido: Pedido) { | ||
return pedido.produtosDoPedido.reduce((partialSum, a) => partialSum + (a.produto.preco * a.quantidade), 0); | ||
} | ||
} |
Oops, something went wrong.