From 8d2894d8095de1ca5569bea4c3daaba26aa28831 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Aug 2017 13:22:53 +0100 Subject: [PATCH 01/13] Removed redundant file --- src/declarations.d.ts | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/declarations.d.ts diff --git a/src/declarations.d.ts b/src/declarations.d.ts deleted file mode 100644 index 423e2f1..0000000 --- a/src/declarations.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - Declaration files are how the Typescript compiler knows about the type information(or shape) of an object. - They're what make intellisense work and make Typescript know all about your code. - - A wildcard module is declared below to allow third party libraries to be used in an app even if they don't - provide their own type declarations. - - To learn more about using third party libraries in an Ionic app, check out the docs here: - http://ionicframework.com/docs/v2/resources/third-party-libs/ - - For more info on type definition files, check out the Typescript docs here: - https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html -*/ -declare module '*'; \ No newline at end of file From 82272b00de055c419d982c3e471a5b587d2296f9 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Aug 2017 13:23:10 +0100 Subject: [PATCH 02/13] Changed Alert box and picker theme --- src/app/app.scss | 4 ++++ src/theme/variables.scss | 23 ++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/app/app.scss b/src/app/app.scss index bace1cc..97e5cb0 100644 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -28,6 +28,10 @@ ion-app.md { background: none; } +.alert-md .alert-title { + color: color($colors, primary); +} + .item-submit { font-size: 1.2em; color: rgba(255, 255, 255, .8); diff --git a/src/theme/variables.scss b/src/theme/variables.scss index e91b3e6..c2cc323 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -35,6 +35,7 @@ $colors: ( whitish: #fefefe, button-blue: #248ed0, light-grey: #9f9f9f, + background-blue: #34688d, ); @@ -64,14 +65,30 @@ $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), 40%); +$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; + + $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 From eae0cd6f82e4ee8d91e9a4b09f560d0786416e71 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Aug 2017 13:26:31 +0100 Subject: [PATCH 03/13] Improved Darken on alert --- src/theme/variables.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/theme/variables.scss b/src/theme/variables.scss index c2cc323..59b88dc 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -69,7 +69,7 @@ $grid-padding-width: 2px; $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), 40%); +$alert-md-radio-label-text-color: darken(color($colors, primary), 30%); $alert-md-radio-label-text-color-checked: color($colors, primary); $alert-md-button-text-align: center; $alert-md-button-group-justify-content: center; From 7fd5d23200296a149d8c46d5ae7079cf61660932 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Aug 2017 13:40:10 +0100 Subject: [PATCH 04/13] CSS edited --- src/app/app.scss | 1 + src/theme/variables.scss | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/app.scss b/src/app/app.scss index 97e5cb0..a4257c0 100644 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -30,6 +30,7 @@ ion-app.md { .alert-md .alert-title { color: color($colors, primary); + text-align: center; } .item-submit { diff --git a/src/theme/variables.scss b/src/theme/variables.scss index 59b88dc..7365dd7 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -69,7 +69,7 @@ $grid-padding-width: 2px; $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), 30%); +$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; @@ -79,6 +79,7 @@ $alert-md-button-group-justify-content: center; $alert-md-button-group-padding: 8px; $alert-md-button-padding: 14px; $alert-button-font-size: 18px; +$alert-md-border-radius: 10px; From b0c335378f261edfea72125cb803791dd6d3bbb2 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Aug 2017 15:40:08 +0100 Subject: [PATCH 05/13] Removed redundant code --- src/pages/receipt/receipt.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/pages/receipt/receipt.ts b/src/pages/receipt/receipt.ts index ecca4f7..272b11f 100644 --- a/src/pages/receipt/receipt.ts +++ b/src/pages/receipt/receipt.ts @@ -74,26 +74,6 @@ export class ReceiptPage { 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); From 9369c6f59869ed838d228e683be843564d9bf6dd Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Aug 2017 16:19:14 +0100 Subject: [PATCH 06/13] Made feedback submission more intuitive --- src/pages/feedback/feedback.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/feedback/feedback.ts b/src/pages/feedback/feedback.ts index fe8b755..95384dc 100644 --- a/src/pages/feedback/feedback.ts +++ b/src/pages/feedback/feedback.ts @@ -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); From 55867ddc594f5dc405b2293614751db947d2915b Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 17 Aug 2017 14:50:45 +0100 Subject: [PATCH 07/13] Minimum submission Date added --- src/pages/receipt/receipt.html | 2 +- src/pages/receipt/receipt.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pages/receipt/receipt.html b/src/pages/receipt/receipt.html index 1001130..71ff907 100644 --- a/src/pages/receipt/receipt.html +++ b/src/pages/receipt/receipt.html @@ -69,7 +69,7 @@ Click to Edit Time of Purchase - + diff --git a/src/pages/receipt/receipt.ts b/src/pages/receipt/receipt.ts index 272b11f..769e13d 100644 --- a/src/pages/receipt/receipt.ts +++ b/src/pages/receipt/receipt.ts @@ -54,6 +54,7 @@ export class ReceiptPage { currentStep: number = 1; myDate: string; + minDate: any; constructor( public actionSheetCtrl: ActionSheetController, @@ -72,12 +73,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'); + } 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 = moment(aprilDate).subtract(2, 'years').format('YYYY-MM-DD'); + } else { + this.minDate = moment(aprilDate).subtract(1, 'years').format('YYYY-MM-DD'); + } } previousStep(){ From 98a4412ed9fdebe75bd1da4c6603848e0714d20f Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 17 Aug 2017 15:05:02 +0100 Subject: [PATCH 08/13] Made it use less power for min date --- src/pages/receipt/receipt.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/receipt/receipt.ts b/src/pages/receipt/receipt.ts index 769e13d..e686bac 100644 --- a/src/pages/receipt/receipt.ts +++ b/src/pages/receipt/receipt.ts @@ -90,9 +90,9 @@ export class ReceiptPage { // Checks if current time is before April 1st, if so returns true let beforeApril = now.isBefore(aprilDate); if ( beforeApril == true ) { - this.minDate = moment(aprilDate).subtract(2, 'years').format('YYYY-MM-DD'); + this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD'); } else { - this.minDate = moment(aprilDate).subtract(1, 'years').format('YYYY-MM-DD'); + this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD'); } } From 5fe75f74d6967b85dcbee226ed4d35ca79e1e0b3 Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 17 Aug 2017 16:07:49 +0100 Subject: [PATCH 09/13] Added receipt submission reset fixes --- src/pages/receipt/receipt.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/receipt/receipt.ts b/src/pages/receipt/receipt.ts index e686bac..cdbf12a 100644 --- a/src/pages/receipt/receipt.ts +++ b/src/pages/receipt/receipt.ts @@ -309,6 +309,7 @@ export class ReceiptPage { console.log(response); this.loading.dismiss(); this.readSubmitPrompt(); + this.resetForm(); }, err => { console.log('Upload Error'); @@ -326,9 +327,13 @@ export class ReceiptPage { town: '', postcode: '', }; + this.storeList = null; this.amount = null; this.lastImage = null; + step1Invalid = true; + step2Invalid = true; this.currentStep = 1; + this.myDate = moment().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ'); } // Create a new name for the image @@ -356,7 +361,6 @@ export class ReceiptPage { buttons: [ { text: 'No Thanks', - role: 'Yes I do!', handler: () => { console.log('Cancel clicked'); this.navCtrl.setRoot(UserPage); @@ -366,7 +370,6 @@ export class ReceiptPage { text: 'Yes!', handler: () => { console.log('Form reset clicked'); - this.resetForm(); } } ] From fab05358fb57bd670f920a969a53f606305b737e Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 17 Aug 2017 17:10:58 +0100 Subject: [PATCH 10/13] Better error logging added --- src/pages/receipt/receipt.ts | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/pages/receipt/receipt.ts b/src/pages/receipt/receipt.ts index cdbf12a..311db47 100644 --- a/src/pages/receipt/receipt.ts +++ b/src/pages/receipt/receipt.ts @@ -305,17 +305,30 @@ export class ReceiptPage { this.peopleService.upload(myParams, targetPath).subscribe( response => { - console.log('Successful Upload'); - console.log(response); - this.loading.dismiss(); - this.readSubmitPrompt(); - this.resetForm(); + 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); } ); } @@ -330,8 +343,8 @@ export class ReceiptPage { this.storeList = null; this.amount = null; this.lastImage = null; - step1Invalid = true; - step2Invalid = true; + this.step1Invalid = true; + this.step2Invalid = true; this.currentStep = 1; this.myDate = moment().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ'); } From 9b0512d3c2c8f54469cd30dc881e3d18c473b2fd Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 17 Aug 2017 17:27:46 +0100 Subject: [PATCH 11/13] Fix for purchase date not being correct ISO format for backend --- src/pages/receipt/receipt.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/receipt/receipt.ts b/src/pages/receipt/receipt.ts index 311db47..e8387e3 100644 --- a/src/pages/receipt/receipt.ts +++ b/src/pages/receipt/receipt.ts @@ -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'; @@ -267,12 +268,18 @@ 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; @@ -280,7 +287,7 @@ export class ReceiptPage { myParams = { transaction_type : this.transactionAdditionType, transaction_value : this.amount, - purchase_time : this.myDate, + purchase_time : purchaseTime, organisation_id : this.organisationId, }; break; @@ -288,7 +295,7 @@ export class ReceiptPage { 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, From b5feff836a85646cd12c9df231b712b37bf03460 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 17 Aug 2017 17:51:04 +0100 Subject: [PATCH 12/13] Bump version number to 0.0.3 --- config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.xml b/config.xml index 4c759cd..33a06bf 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + LocalLoop Tracking Local Money for Local People. Pear Trading Development Team From f8c6bd059e00b9e7774c6f87c9d0d6be58ca010d Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 17 Aug 2017 17:51:15 +0100 Subject: [PATCH 13/13] Added changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cea672e..bb37c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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