Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
Merge branch 'Release-v0.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
TBSliver committed Aug 17, 2017
2 parents d123dc5 + f8c6bd0 commit 11b59ef
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 49 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

# v0.0.3

* Improve Feedback submission
* Improve colouring of popover screens
* Added minimum limit to submission date for receipt
* Fixes for resetting receipt form
* Better error messages on receipt submit
* Fix date format for backend server

# v0.0.2

* Reduced image quality to increase upload speed
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.peartrade.localloop" version="0.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="org.peartrade.localloop" version="0.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>LocalLoop</name>
<description>Tracking Local Money for Local People.</description>
<author email="[email protected]" href="http://github.com/pear-trading">Pear Trading Development Team</author>
Expand Down
5 changes: 5 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ ion-app.md {
background: none;
}

.alert-md .alert-title {
color: color($colors, primary);
text-align: center;
}

.item-submit {
font-size: 1.2em;
color: rgba(255, 255, 255, .8);
Expand Down
14 changes: 0 additions & 14 deletions src/declarations.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/pages/feedback/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export class FeedbackPage {
result => {
console.log('Form submitted!');
this.presentToast('Feedback succesfully submitted.');
this.feedbackForm.patchValue({
feedbacktext: '',
});
},
error => {
console.log(JSON.parse(error._body).message);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/receipt/receipt.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

<ion-item>
<ion-label stacked>Click to Edit Time of Purchase</ion-label>
<ion-datetime displayFormat="HH:mm DD/MM/YYYY" [(ngModel)]="myDate"></ion-datetime>
<ion-datetime displayFormat="HH:mm DD/MM/YYYY" [min]="minDate" [(ngModel)]="myDate"></ion-datetime>
</ion-item>
<!-- move onto next -->
<ion-item>
Expand Down
79 changes: 49 additions & 30 deletions src/pages/receipt/receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
LoadingController, Loading, ToastController
} from 'ionic-angular';
import { AlertController, ActionSheetController } from 'ionic-angular';
import { convertDataToISO } from 'ionic-angular/util/datetime-util';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { FilePath } from '@ionic-native/file-path';
import { Transfer } from '@ionic-native/transfer';
Expand Down Expand Up @@ -54,6 +55,7 @@ export class ReceiptPage {
currentStep: number = 1;

myDate: string;
minDate: any;

constructor(
public actionSheetCtrl: ActionSheetController,
Expand All @@ -72,32 +74,27 @@ export class ReceiptPage {
public alertCtrl: AlertController // alert screen for confirmation of receipt entries
) {
this.myDate = moment().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');
}

// calculateTime(offset: any) {
// // create Date object for current location
// let d = new Date();
//
// // create new Date object using supplied offset
// let nd = new Date(d.getTime() + (3600000 * offset));
//
// return nd.toISOString();
// }
//
// stdTimezoneOffset(today: any) {
// let jan = new Date(today.getFullYear(), 0, 1);
// let jul = new Date(today.getFullYear(), 6, 1);
// return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
// }
//
// dst(today: any) {
// return today.getTimezoneOffset() < this.stdTimezoneOffset(today);
// }
}

ionViewDidEnter(){
this.platform.ready().then(() => {
this.keyboard.disableScroll(true);
});
this.getMinDate();
}

getMinDate(){
// gets the April 1st date of the current year
let aprilDate = moment().month(3).date(1);
let now = moment();
// Checks if current time is before April 1st, if so returns true
let beforeApril = now.isBefore(aprilDate);
if ( beforeApril == true ) {
this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD');
} else {
this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD');
}
}

previousStep(){
Expand Down Expand Up @@ -271,28 +268,34 @@ export class ReceiptPage {
// // File name only
var filename = this.lastImage;
var myParams: any;
let purchaseTime: string;
if ( typeof( this.myDate ) === 'string' ) {
purchaseTime = this.myDate;
} else {
purchaseTime = convertDataToISO( this.myDate );
}
switch(this.transactionAdditionType){
case 1:
myParams = {
transaction_type : this.transactionAdditionType,
transaction_value : this.amount,
purchase_time : this.myDate,
purchase_time : purchaseTime,
organisation_id : this.organisationId,
};
break;
case 2:
myParams = {
transaction_type : this.transactionAdditionType,
transaction_value : this.amount,
purchase_time : this.myDate,
purchase_time : purchaseTime,
organisation_id : this.organisationId,
};
break;
case 3:
myParams = {
transaction_type : this.transactionAdditionType,
transaction_value : this.amount,
purchase_time : this.myDate,
purchase_time : purchaseTime,
organisation_name : this.submitOrg.name,
street_name : this.submitOrg.street_name,
town : this.submitOrg.town,
Expand All @@ -309,16 +312,30 @@ export class ReceiptPage {

this.peopleService.upload(myParams, targetPath).subscribe(
response => {
console.log('Successful Upload');
console.log(response);
this.loading.dismiss();
this.readSubmitPrompt();
if( response.success == true ) {
console.log('Successful Upload');
console.log(response);
this.loading.dismiss();
this.readSubmitPrompt();
this.resetForm();
} else {
console.log('Upload Error');
this.loading.dismiss();
this.presentToast(JSON.stringify(response.status) + 'Error, ' + JSON.stringify(response.message));
}
},
err => {
console.log('Upload Error');
console.log(err);
this.loading.dismiss();
this.presentToast('Error while uploading:' + JSON.stringify(err));
let errorString;
try {
let jsonError = JSON.parse(err.body);
errorString = JSON.stringify(jsonError.status) + 'Error, ' + JSON.stringify(jsonError.message);
} catch(e) {
errorString = 'There was a server error, please try again later.';
}
this.presentToast(errorString);
}
);
}
Expand All @@ -330,9 +347,13 @@ export class ReceiptPage {
town: '',
postcode: '',
};
this.storeList = null;
this.amount = null;
this.lastImage = null;
this.step1Invalid = true;
this.step2Invalid = true;
this.currentStep = 1;
this.myDate = moment().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');
}

// Create a new name for the image
Expand Down Expand Up @@ -360,7 +381,6 @@ export class ReceiptPage {
buttons: [
{
text: 'No Thanks',
role: 'Yes I do!',
handler: () => {
console.log('Cancel clicked');
this.navCtrl.setRoot(UserPage);
Expand All @@ -370,7 +390,6 @@ export class ReceiptPage {
text: 'Yes!',
handler: () => {
console.log('Form reset clicked');
this.resetForm();
}
}
]
Expand Down
24 changes: 21 additions & 3 deletions src/theme/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ $colors: (
whitish: #fefefe,
button-blue: #248ed0,
light-grey: #9f9f9f,
background-blue: #34688d,
);


Expand Down Expand Up @@ -64,14 +65,31 @@ $tabs-md-tab-color-active: rgba(255, 255, 255, 1);

$grid-padding-width: 2px;

$alert-md-button-text-color: color($colors, secondary);
// $alert-md-button-text-color: color($colors, primary);
$alert-md-background-color: color($colors, background-blue);
$alert-md-message-text-color: color($colors, primary);
$alert-md-input-text-color: color($colors, primary);
$alert-md-radio-label-text-color: darken(color($colors, primary), 25%);
$alert-md-radio-label-text-color-checked: color($colors, primary);
$alert-md-button-text-align: center;
$alert-md-button-group-justify-content: center;
// These two below should work but are not in 3.4.2
// $alert-md-button-padding-start: 20px;
// $alert-md-button-padding-end: 20px;
$alert-md-button-group-padding: 8px;
$alert-md-button-padding: 14px;
$alert-button-font-size: 18px;
$alert-md-border-radius: 10px;



$label-md-text-color: color($colors, primary);

$select-md-icon-color: color($colors, whitish);

$picker-md-button-text-color: color($colors, secondary);
$picker-md-option-selected-color: color($colors, button-blue);
// $picker-md-button-text-color: color($colors, secondary);
// $picker-md-option-selected-color: color($colors, button-blue);
$picker-md-background-color: color($colors, background-blue);

/*$segment-button-md-border-bottom-color-activated: #ff0000;*/
// App Windows Variables
Expand Down

0 comments on commit 11b59ef

Please sign in to comment.