Skip to content

Commit

Permalink
Order edit button added and login button style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoumpierre committed Aug 9, 2018
1 parent ea339b1 commit 3e39b57
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@
"android"
]
}
}
}
2 changes: 0 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export class MyApp {
// Here you can do any higher level native things you might need.
storage.get('token')
.then((res) => {
console.log('token', res);

if (res && res != null) {
this.rootPage = HomePage;
} else {
Expand Down
28 changes: 28 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ ion-list {
margin-bottom: 0;
margin-top: 0;

> .list-item__content {
padding: 0;
}

> div {

> div {
Expand Down Expand Up @@ -381,6 +385,13 @@ ion-list {
}
}
}

.table-grid--product-list {

> .single-item {
padding: 1rem 0;
}
}
}

form {
Expand Down Expand Up @@ -518,6 +529,23 @@ form {
}
}

@media screen and (max-width: map_get($screen-breakpoints, lg)) {
.table-grid--product-list {

.single-item {
border-bottom: 1px solid #F1F1F1;

&:last-child {
border-bottom: none;
}

> ion-item {
padding: 0;
}
}
}
}

@each $size, $size-value in $screen-breakpoints {
.hide-#{$size} {
@media (min-width: $size-value) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.then(() => console.log('service worker installed'))
.catch(err => console.error('Error', err));
}
</script>-->
</script> -->

<link href="build/main.css" rel="stylesheet">

Expand Down
6 changes: 6 additions & 0 deletions src/pages/login-form/login-form.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
page-login-form {

ion-navbar {
color: #000000;

Expand Down Expand Up @@ -41,6 +42,7 @@ page-login-form {
}

&.item-input {

> .item-inner {
border-bottom: 1px solid #cccbd0 !important;
-webkit-box-shadow: none !important;
Expand All @@ -57,6 +59,10 @@ page-login-form {
color: #FFF;
font-size: 1.4rem;
background-color: #3b5998;

&:hover {
background-color: #31497d !important;
}
}
}
}
2 changes: 0 additions & 2 deletions src/pages/login-form/login-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export class LoginFormPage {
.then((res) => {
this.AuthProvider.hideLoader();

console.log('res', res);

this.storage.set('token', res.access_token).then(() => {
this.AuthProvider.getUser().subscribe((user) => {
this.storage.set('user', user).then(() => this.navCtrl.setRoot(HomePage))
Expand Down
2 changes: 2 additions & 0 deletions src/pages/orders/form/order-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export class OrderFormPage {

this.order = orderProducts;
this.paymentDays = paymentDate.diff(deliveryDate, 'days');

this.updateTotal();
});
}

Expand Down
21 changes: 11 additions & 10 deletions src/pages/orders/index/orders.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
page-orders {
@media screen and (min-width: map-get($screen-breakpoints, lg)) {
ion-col {

&:not(.was-read) {
ion-col {

&:not(.was-read) {

ion-label {
ion-label {

> .list-item__content {
color: #333;
> .list-item__content {
color: #333;

&,
> .highlight {
font-weight: 700;
}
&,
> .highlight {
font-weight: 700;
}
}
}
}
}

@media screen and (min-width: map-get($screen-breakpoints, lg)) {
.table-grid--orders {

ion-label {
Expand Down
5 changes: 5 additions & 0 deletions src/pages/orders/view/order-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<ion-title *ngIf="order">Pedido {{ order.id }}</ion-title>

<ion-buttons end>
<button ion-button icon-only (click)="goToForm()" *ngIf="currentUser && currentUser.role == 1">
<ion-icon name="create"></ion-icon>
<span class="hide-xs hide-sm show-lg show-xl">Editar</span>
</button>

<button ion-button icon-only (click)="download()">
<ion-icon name="download"></ion-icon>
<span class="hide-xs hide-sm show-lg show-xl">Download</span>
Expand Down
34 changes: 13 additions & 21 deletions src/pages/orders/view/order-view.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { ApiProvider } from '../../../providers/api/api';
import { ListFormPage } from "../../list-form/list-form";
import { DownloadProvider } from "../../../providers/download/download";

/**
* Generated class for the OrderViewPage page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
import { OrderFormPage } from "../form/order-form";
import { Storage } from "@ionic/storage";

@IonicPage()
@Component({
Expand All @@ -19,9 +13,14 @@ import { DownloadProvider } from "../../../providers/download/download";
export class OrderViewPage {
public order;
private id;
private currentUser;

constructor(public navCtrl: NavController, public navParams: NavParams, private apiProvider: ApiProvider,
private downloadProvider: DownloadProvider) {
private downloadProvider: DownloadProvider, private storage: Storage) {
this.storage.get('user').then((user) => {
this.currentUser = user;
console.log(user);
});
}

/**
Expand All @@ -30,22 +29,15 @@ export class OrderViewPage {
ionViewDidLoad() {
this.id = this.navParams.get('id');

this.apiProvider.builder('orders/' + this.id).loader().get().subscribe((res) => {
this.order = res;
console.log(res);
});
this.apiProvider.builder('orders/' + this.id).loader().get().subscribe((res) => this.order = res);
}

/**
* Push to list form page
* Push to order form page
*/
// goToForm() {
// this.navCtrl.push(ListFormPage, {
// customer: this.order.customer.id,
// orderId: this.id,
// order: this.order.order_product
// });
// }
goToForm() {
this.navCtrl.push(OrderFormPage, {id: this.id});
}

/**
* Calls the download method
Expand Down

0 comments on commit 3e39b57

Please sign in to comment.