From 183995b685ede177aa825b7bd59d9052c6a6c46c Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 15:50:47 -0500 Subject: [PATCH 01/32] Added HTML sub-tab to FD2 School sub-tab --- farmdata2/farmdata2_modules/fd2_school/fd2_school.module | 8 ++++++++ farmdata2/farmdata2_modules/fd2_school/html/html.html | 1 + 2 files changed, 9 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/html/html.html diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 167ca8ef..d2c932a4 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -61,6 +61,14 @@ function fd2_school_menu() { ); // Add items blocks for new sub-tabs here. + $items['farm/fd2-school/html'] = array( + 'title' => 'HTML', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('html'), + 'access arguments' => array('view fd2 school'), + 'weight' => 10, + ); return $items; }; diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html new file mode 100644 index 00000000..d8ef35e9 --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -0,0 +1 @@ +

Maximo Sanchez

\ No newline at end of file From 1fdec3d43cbebda2980a0ca0106af6b5d9309807 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 16:38:06 -0500 Subject: [PATCH 02/32] Created the Harvest Report and My Sample Harvest Report sections in html.html --- .../farmdata2_modules/fd2_school/html/html.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index d8ef35e9..9a9335c1 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -1 +1,16 @@ -

Maximo Sanchez

\ No newline at end of file + +

Harvest Report

+

This page is a mockup of a simplified harvest report.

+

My Sample Harvest Report

+

Details:

+ + + \ No newline at end of file From f0e2d68135369b6439e988206954d90faed40416 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 16:52:36 -0500 Subject: [PATCH 03/32] Edited the html.html from fd2_school to make it more stylish using html elements --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 9a9335c1..fccb829a 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -1,6 +1,7 @@

Harvest Report

-

This page is a mockup of a simplified harvest report.

+

This page is a mockup of a simplified harvest report.

+

My Sample Harvest Report

Details:

    @@ -8,6 +9,7 @@

    My Sample Harvest Report

  • User:manager1
  • Language:English
+
  • Start:05/01/2018
  • End:05/15/2018
  • From 492b2dffa92d021348754d0ed4c9b94e151d1f20 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 17:37:25 -0500 Subject: [PATCH 04/32] Added Title input textbox and Generate Report button to html.html in fd2_school --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index fccb829a..0431eeb6 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -4,6 +4,12 @@

    Harvest Report


    My Sample Harvest Report

    Details:

    +
    +

    + + +

    +
    • Farm:Sample Farm
    • User:manager1
    • @@ -14,5 +20,7 @@

      My Sample Harvest Report

    • Start:05/01/2018
    • End:05/15/2018
    • Crop:Kale
    • -
    +
+
+ \ No newline at end of file From e6aba6ab95cb11d4332b5b8e5a9bc2e0f89ab4a4 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 18:55:49 -0500 Subject: [PATCH 05/32] Moved up the title input text box and added the start and end date boxes in html.html in fd2_school --- .../fd2_school/html/html.html | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 0431eeb6..3d422731 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -1,15 +1,25 @@

Harvest Report

This page is a mockup of a simplified harvest report.

-
-

My Sample Harvest Report

-

Details:



+

+ + + + +

+
+ +
+

My Sample Harvest Report

+

Details:

  • Farm:Sample Farm
  • User:manager1
  • @@ -21,6 +31,4 @@

    My Sample Harvest Report

  • End:05/15/2018
  • Crop:Kale
-
- \ No newline at end of file From 408eb853a76049b3debc6f440b104d64638761a0 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 19:08:20 -0500 Subject: [PATCH 06/32] Added the crop selection box to html.html in fd2_school --- .../fd2_school/html/html.html | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 3d422731..30d20018 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -8,12 +8,21 @@

Harvest Report


- - - - + + + + +

+
+

+ +


From a22c2757e2bcf5e154ee403898c5bf00f12a9908 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 19:15:01 -0500 Subject: [PATCH 07/32] Added the field selection box to html.html in fd2_school --- farmdata2/farmdata2_modules/fd2_school/html/html.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 30d20018..5dcbd8b1 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -1,7 +1,6 @@

Harvest Report

This page is a mockup of a simplified harvest report.

-

@@ -23,6 +22,12 @@

Harvest Report

+ +


From 8e48f13afa0c515a1083742e54d7b80afc4165b5 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Fri, 9 Feb 2024 19:55:53 -0500 Subject: [PATCH 08/32] Added table with information about crops at the end of html.html in fd2_School --- .../fd2_school/html/html.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/html/html.html b/farmdata2/farmdata2_modules/fd2_school/html/html.html index 5dcbd8b1..e930b07a 100644 --- a/farmdata2/farmdata2_modules/fd2_school/html/html.html +++ b/farmdata2/farmdata2_modules/fd2_school/html/html.html @@ -45,4 +45,27 @@

My Sample Harvest Report

  • End:05/15/2018
  • Crop:Kale
  • + + + + + + + + + + + + + + + + + + + + + + +
    DateAreaCropYieldUnits
    05/02/2018Chuau-1Kale10Bunches
    05/05/2018SQ7Kale7Bunches
    \ No newline at end of file From c3b4f08c4f1ad69e2933c1c76174a7a6912ac6de Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 14:16:23 -0500 Subject: [PATCH 09/32] Added Vue1 sub-tab to the FD2 School tab --- .../fd2_school/fd2_school.module | 9 +++ .../fd2_school/vue1/vue1.html | 71 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index d2c932a4..51495d88 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -70,6 +70,15 @@ function fd2_school_menu() { 'weight' => 10, ); + $items['farm/fd2-school/vue1'] = array( + 'title' => 'Vue1', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('vue1'), + 'access arguments' => array('view fd2 school'), + 'weight' => 10, + ); + return $items; }; diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html new file mode 100644 index 00000000..e930b07a --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -0,0 +1,71 @@ + +

    Harvest Report

    +

    This page is a mockup of a simplified harvest report.

    +

    + + +

    +
    +

    + + + + +

    +
    +

    + + + + +

    +
    + +
    +

    My Sample Harvest Report

    +

    Details:

    +
      +
    • Farm:Sample Farm
    • +
    • User:manager1
    • +
    • Language:English
    • +
    +
    +
      +
    • Start:05/01/2018
    • +
    • End:05/15/2018
    • +
    • Crop:Kale
    • +
    + + + + + + + + + + + + + + + + + + + + + + +
    DateAreaCropYieldUnits
    05/02/2018Chuau-1Kale10Bunches
    05/05/2018SQ7Kale7Bunches
    + \ No newline at end of file From 116d08fc4250102490cbaad4de4dd47aafc48bf5 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 15:13:42 -0500 Subject: [PATCH 10/32] Added Vue elements to vue1.html, now you can change the title of the harvest report in real time using the title text box --- .../fd2_school/vue1/vue1.html | 152 ++++++++++-------- 1 file changed, 83 insertions(+), 69 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index e930b07a..30c80e4a 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -1,71 +1,85 @@ + -

    Harvest Report

    -

    This page is a mockup of a simplified harvest report.

    -

    - - -

    -
    -

    - - - - -

    -
    -

    - - - - -

    -
    - -
    -

    My Sample Harvest Report

    -

    Details:

    -
      -
    • Farm:Sample Farm
    • -
    • User:manager1
    • -
    • Language:English
    • -
    -
    -
      -
    • Start:05/01/2018
    • -
    • End:05/15/2018
    • -
    • Crop:Kale
    • -
    - - - - - - - - - - - - - - - - - - - - - - -
    DateAreaCropYieldUnits
    05/02/2018Chuau-1Kale10Bunches
    05/05/2018SQ7Kale7Bunches
    + +

    Harvest Report

    +

    This page is a mockup of a simplified harvest report.

    +
    + + +
    +

    + + + + +

    +
    +

    + + + + +

    +
    + +
    +

    {{ header }}

    +
    + + +

    Details:

    +
      +
    • Farm:Sample Farm
    • +
    • User:manager1
    • +
    • Language:English
    • +
    +
    +
      +
    • Start:05/01/2018
    • +
    • End:05/15/2018
    • +
    • Crop:Kale
    • +
    + + + + + + + + + + + + + + + + + + + + + + +
    DateAreaCropYieldUnits
    05/02/2018Chuau-1Kale10Bunches
    05/05/2018SQ7Kale7Bunches
    + \ No newline at end of file From 33f5c17d9afa638e9b385574ec1912cd7692d915 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 15:30:25 -0500 Subject: [PATCH 11/32] Bounded the start date, end date, and crop elements to the vue object to update the report section in real time --- .../fd2_school/vue1/vue1.html | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index 30c80e4a..a296efb5 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -9,16 +9,16 @@

    Harvest Report


    - + - +


    - @@ -34,6 +34,41 @@

    Harvest Report


    {{ header }}

    +

    Details:

    +
      +
    • Farm:Sample Farm
    • +
    • User:manager1
    • +
    • Language:English
    • +
    +
    +
      +
    • Start:{{ startDate }}
    • +
    • End:{{ endDate }}
    • +
    • Crop:{{ crop }}
    • +
    + + + + + + + + + + + + + + + + + + + + + + +
    DateAreaCropYieldUnits
    05/02/2018Chuau-1Kale10Bunches
    05/05/2018SQ7Kale7Bunches
    - -

    Details:

    -
      -
    • Farm:Sample Farm
    • -
    • User:manager1
    • -
    • Language:English
    • -
    -
    -
      -
    • Start:05/01/2018
    • -
    • End:05/15/2018
    • -
    • Crop:Kale
    • -
    - - - - - - - - - - - - - - - - - - - - - - -
    DateAreaCropYieldUnits
    05/02/2018Chuau-1Kale10Bunches
    05/05/2018SQ7Kale7Bunches
    \ No newline at end of file From 3b3386839c60fbddaa6a5e643db34f548f215f35 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 16:31:11 -0500 Subject: [PATCH 12/32] Added ternary condition to the title of the report so that 'Mock Harvest report' shows up if the text input for the title is empty --- farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index a296efb5..5a9e967a 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -33,7 +33,7 @@

    Harvest Report



    -

    {{ header }}

    +

    {{ header == '' ? 'Mock Harvest Report':header }}

    Details:

    • Farm:Sample Farm
    • From d1767b10c0e71d6250cc97e73371084f098bf2e0 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 16:53:26 -0500 Subject: [PATCH 13/32] Added array objects areas and crops so that the select boxes don't have hardcoded options --- .../fd2_school/vue1/vue1.html | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index 5a9e967a..96a2009e 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -19,15 +19,11 @@

      Harvest Report


      @@ -79,7 +75,17 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      header: 'My Sample Harvest Report', startDate: '2020-05-05', endDate: '2020-05-15', - crop: 'Kale' + crop: 'Kale', + crops:[ + 'Kale', + 'Broccoli', + 'Peas', + ], + areas:[ + 'All', + 'Chuau-1', + 'SQ7', + ] } }); From a24010cbccf6b29646b55271cc8582297caadf72 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 21:20:27 -0500 Subject: [PATCH 14/32] Added reports array of objects so that the table can be built from those reports --- .../fd2_school/vue1/vue1.html | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index 96a2009e..34657740 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -50,19 +50,12 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      Yield Units - - 05/02/2018 - Chuau-1 - Kale - 10 - Bunches - - - 05/05/2018 - SQ7 - Kale - 7 - Bunches + + {{ r.date }} + {{ r.area }} + {{ r.crop }} + {{ r.yield }} + {{ r.units }} @@ -85,6 +78,10 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      'All', 'Chuau-1', 'SQ7', + ], + reports:[ + {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:10, units:'Bunches'}, + {date:'2019-08-13', area:'SQ7', crop:'Broccoli', yield:32, units:'lbs'} ] } }); From d7deac8cb55da811e1023c7f24159223cac85b2f Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 18 Feb 2024 21:39:01 -0500 Subject: [PATCH 15/32] Added Vue dev tools to vue1.html --- farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html | 1 + 1 file changed, 1 insertion(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html index 34657740..6a139608 100644 --- a/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html +++ b/farmdata2/farmdata2_modules/fd2_school/vue1/vue1.html @@ -60,6 +60,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      + + \ No newline at end of file diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 51495d88..4cf9ea6e 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -79,6 +79,15 @@ function fd2_school_menu() { 'weight' => 10, ); + $items['farm/fd2-school/a04'] = array( + 'title' => 'A04', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('a04'), + 'access arguments' => array('view fd2 school'), + 'weight' => 10, + ); + return $items; }; From 6256d6bb4a905dbc4ca93441fdb6873fba8ad306 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 25 Feb 2024 16:52:12 -0500 Subject: [PATCH 17/32] The generate report button now creates a row in the table at the bottom of the page --- .../farmdata2_modules/fd2_school/a04/a04.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html index 6a139608..f31f1980 100644 --- a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html +++ b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html @@ -9,7 +9,7 @@

      Harvest Report


      - Harvest Report

      - -


      - +

      {{ header == '' ? 'Mock Harvest Report':header }}

      Details:

      @@ -67,7 +67,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      el: '#harvest-report', data: { header: 'My Sample Harvest Report', - startDate: '2020-05-05', + startDate: '', endDate: '2020-05-15', crop: 'Kale', crops:[ @@ -80,9 +80,11 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      'Chuau-1', 'SQ7', ], + newArea: '', + newCrop:'', + newReport:{date:'', area:'', crop:'', yield:10, units:'bunches'}, reports:[ {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:10, units:'Bunches'}, - {date:'2019-08-13', area:'SQ7', crop:'Broccoli', yield:32, units:'lbs'} ] } }); From 7a0b8a47b6ed3166f956b647cb12ed112bddf1f4 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 25 Feb 2024 19:36:33 -0500 Subject: [PATCH 18/32] fixed the date not passing the current selected date and passed the button functionality to the method section of the Vue object --- .../farmdata2_modules/fd2_school/a04/a04.html | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html index f31f1980..e489b23b 100644 --- a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html +++ b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html @@ -9,7 +9,7 @@

      Harvest Report


      - Harvest Report

      - -


      - +

      {{ header == '' ? 'Mock Harvest Report':header }}

      Details:

      @@ -67,7 +67,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      el: '#harvest-report', data: { header: 'My Sample Harvest Report', - startDate: '', + startDate: '2020-05-05', endDate: '2020-05-15', crop: 'Kale', crops:[ @@ -82,10 +82,31 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      ], newArea: '', newCrop:'', - newReport:{date:'', area:'', crop:'', yield:10, units:'bunches'}, reports:[ {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:10, units:'Bunches'}, ] + }, + methods: { + generateReport: function(){ + const newReport = {date:'', area:'', crop:'', yield:10, units:'bunches'}; + const newDate=this.startDate; + newReport.area = this.newArea; + newReport.crop = this.newCrop; + newReport.date=newDate; + let newR = JSON.stringify(newReport); + let same = 0; + console.log(newR); + for(const report in this.reports){ + let r = JSON.stringify(this.reports[report]); + console.log(r); + if(r == newR){ + same = 1; + } + } + if(same == 0){ + this.reports.push(newReport); + } + } } }); From 90d662a82ec3c02054023042d1e8593884afeb0c Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 25 Feb 2024 20:40:40 -0500 Subject: [PATCH 19/32] Added delete column to the table at the bottom of the page --- farmdata2/farmdata2_modules/fd2_school/a04/a04.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html index e489b23b..b0830ec8 100644 --- a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html +++ b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html @@ -49,13 +49,15 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      Crop Yield Units + Delete - + {{ r.date }} {{ r.area }} {{ r.crop }} {{ r.yield }} {{ r.units }} + @@ -106,6 +108,9 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      if(same == 0){ this.reports.push(newReport); } + }, + deleteReport: function(reportIndex){ + this.reports.splice(reportIndex, 1) } } }); From f231da5fff8ddae8af981965dae8442c657772ff Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 25 Feb 2024 21:34:46 -0500 Subject: [PATCH 20/32] Table at the bottom of the page is only displayed when there are available reports now and if no records are found, then there's a default message that is displayed --- .../farmdata2_modules/fd2_school/a04/a04.html | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html index b0830ec8..621eee49 100644 --- a/farmdata2/farmdata2_modules/fd2_school/a04/a04.html +++ b/farmdata2/farmdata2_modules/fd2_school/a04/a04.html @@ -42,15 +42,18 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

    • End:{{ endDate }}
    • Crop:{{ crop }}
    +
    - - - - - - - - + + + + + + + + + + @@ -60,6 +63,8 @@

    {{ header == '' ? 'Mock Harvest Report':header }}

    DateAreaCropYieldUnitsDelete
    DateAreaCropYieldUnitsDelete
    {{ r.date }} {{ r.area }}
    +
    +

    No matching records.

    + + \ No newline at end of file diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 4cf9ea6e..dea7d660 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -88,6 +88,15 @@ function fd2_school_menu() { 'weight' => 10, ); + $items['farm/fd2-school/api'] = array( + 'title' => 'API', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('api'), + 'access arguments' => array('view fd2 school'), + 'weight' => 10, + ); + return $items; }; From 1fdac6dc4dfc489a6596ba38736a96bf4172900e Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sat, 2 Mar 2024 22:35:14 -0500 Subject: [PATCH 25/32] Bounded the Farm, User, and Language details from the harvest report to the vue instance --- farmdata2/farmdata2_modules/fd2_school/api/api.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index 30af7f39..27d4bc37 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -33,9 +33,9 @@

    Harvest Report

    {{ header == '' ? 'Mock Harvest Report':header }}

    Details:

      -
    • Farm:Sample Farm
    • -
    • User:manager1
    • -
    • Language:English
    • +
    • Farm:{{ farm }}
    • +
    • User:{{ user }}
    • +
    • Language:{{ language }}

      @@ -95,7 +95,11 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      newArea: '', reports:[ {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:10, units:'Bunches'}, - ] + ], + farm:'Sample Farm', + user:'manager1', + language:'English' + }, computed:{ totalYield(){ From ed9b795ec78d15206b040605bcf602b2a668d71e Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sat, 2 Mar 2024 22:38:25 -0500 Subject: [PATCH 26/32] The generate report button now sets the values of the Farm, User, and Language details of the harvesting report --- farmdata2/farmdata2_modules/fd2_school/api/api.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index 27d4bc37..860b5896 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -96,9 +96,9 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      reports:[ {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:10, units:'Bunches'}, ], - farm:'Sample Farm', - user:'manager1', - language:'English' + farm:'', + user:'', + language:'' }, computed:{ @@ -113,10 +113,13 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      methods: { generateReport: function(newState){ const newReport = {date:'', area:'', crop:'', yield:10, units:'bunches'}; - const newDate=this.startDate; + const newDate = this.startDate; newReport.area = this.newArea; newReport.crop = this.newCrop; - newReport.date=newDate; + newReport.date = newDate; + this.farm = 'Sample Farm'; + this.user = 'manager1'; + this.language = 'English'; let newR = JSON.stringify(newReport); let same = 0; console.log(newR); From 895a52568196c0878c9423464ba1283dd86b0b57 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 3 Mar 2024 00:11:44 -0500 Subject: [PATCH 27/32] Added axios API call to retrieve the values for the Farm, User, and Language details fields on the harvest report from the FarmOS API --- farmdata2/farmdata2_modules/fd2_school/api/api.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index 860b5896..a15fc871 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -112,14 +112,21 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      }, methods: { generateReport: function(newState){ + axios.get('/farm.json') // this line sends the request. + .then((response) => { + this.farm = response.data.name; + this.user = response.data.user.name; + this.language = response.data.languages.en.name; + }) + .catch((error) => { + console.log('Error Occurred'); + console.log(error); + }) const newReport = {date:'', area:'', crop:'', yield:10, units:'bunches'}; const newDate = this.startDate; newReport.area = this.newArea; newReport.crop = this.newCrop; newReport.date = newDate; - this.farm = 'Sample Farm'; - this.user = 'manager1'; - this.language = 'English'; let newR = JSON.stringify(newReport); let same = 0; console.log(newR); From 3425008eafb97854b6198dfdee614d0dcfdc647f Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Sun, 3 Mar 2024 20:04:47 -0500 Subject: [PATCH 28/32] Crop dropdown now retrieves the values from the FarmOS API --- .../farmdata2_modules/fd2_school/api/api.html | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api/api.html b/farmdata2/farmdata2_modules/fd2_school/api/api.html index a15fc871..2c36cabe 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api/api.html +++ b/farmdata2/farmdata2_modules/fd2_school/api/api.html @@ -19,7 +19,7 @@

      Harvest Report

      +
      +

      + + + + +

      +
      +

      + + + + +

      +
      + +
      +
      +

      {{ header == '' ? 'Mock Harvest Report':header }}

      +

      Details:

      +
        +
      • Farm:{{ farm }}
      • +
      • User:{{ user }}
      • +
      • Language:{{ language }}
      • +
      +
      +
        +
      • Start:{{ startDate }}
      • +
      • End:{{ endDate }}
      • +
      • Crop:{{ newCrop }}
      • +
      +
      + + + + + + + + + + + + + + + + + + + +
      DateAreaCropYieldUnitsDelete
      {{ r.date }}{{ r.area }}{{ r.crop }}{{ r.yield }}{{ r.units }}
      +

      Total Yield: {{ totalYield }}

      +
      +

      No matching records.

      +
      + + + + + \ No newline at end of file diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index dea7d660..3702e95c 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -97,6 +97,15 @@ function fd2_school_menu() { 'weight' => 10, ); + $items['farm/fd2-school/api2'] = array( + 'title' => 'API2', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('api2'), + 'access arguments' => array('view fd2 school'), + 'weight' => 10, + ); + return $items; }; From 4d76b60b3a0a9f6242034edead14a98b9febbdba Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Tue, 5 Mar 2024 17:53:36 -0500 Subject: [PATCH 30/32] The @click generateReport handler now retrieves from the API all of the harvest reports available from the startDate up until the endDate --- .../fd2_school/api2/api2.html | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index 2c36cabe..858b5721 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -106,7 +106,8 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      farm:'', user:'', language:'', - idToCropMap: new Map() + idToCropMap: new Map(), + getAllPagesRes:[] }, computed:{ @@ -134,6 +135,23 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      console.log('Error Occurred'); console.log(error); }) + + // Assumes that result is an existing array + const timestampStartDate = dayjs(this.startDate).unix(); + const timestampEndDate = dayjs(this.endDate).unix(); + const request = '/log.json?type=farm_harvest×tamp[ge]=' + timestampStartDate + + '×tamp[le]=' + timestampEndDate; + + getAllPages(request, this.getAllPagesRes) + .then(() => { + console.log('Request performed successfully!'); + console.log(this.getAllPagesRes); + }) + .catch((err) => { + console.log('An error occurred'); + console.log(err); + }) + const newReport = {date:'', area:'', crop:'', yield:10, units:'bunches'}; const newDate = this.startDate; newReport.area = this.newArea; @@ -142,6 +160,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      let newR = JSON.stringify(newReport); let same = 0; console.log(newR); + for(const report in this.reports){ let r = JSON.stringify(this.reports[report]); console.log(r); From 9390396513b26f8fcca10cafac99a351b6d0efd3 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Tue, 5 Mar 2024 19:04:39 -0500 Subject: [PATCH 31/32] The @click generateReport handler now also retrieves and parses the harvest report logs and populates the table of reports with these retrieved values. Also deleted old code that hardcoded reports --- .../fd2_school/api2/api2.html | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index 858b5721..3af4d3dd 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -55,7 +55,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      Delete - + {{ r.date }} {{ r.area }} {{ r.crop }} @@ -121,7 +121,24 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      cropNamesArr(){ cropNames = Array.from(this.idToCropMap.values()); return cropNames; + }, + harvestReportRows() { + let tableRows = [] + //log iterates through the response array as the index + for(let log of this.getAllPagesRes) { + let tableRow = { + //parses the timestamp to a human readable date + date: dayjs.unix(log.timestamp).format('MM/DD/YYYY'), + area: log.area[0].name, + yield: log.quantity[0].value, + units: log.quantity[0].unit.name, + crop: this.idToCropMap.get(log.data.crop_tid) + } + tableRows.push(tableRow) + } + return tableRows } + }, methods: { generateReport: function(newState){ @@ -145,37 +162,12 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      getAllPages(request, this.getAllPagesRes) .then(() => { console.log('Request performed successfully!'); - console.log(this.getAllPagesRes); }) .catch((err) => { console.log('An error occurred'); console.log(err); }) - - const newReport = {date:'', area:'', crop:'', yield:10, units:'bunches'}; - const newDate = this.startDate; - newReport.area = this.newArea; - newReport.crop = this.newCrop; - newReport.date = newDate; - let newR = JSON.stringify(newReport); - let same = 0; - console.log(newR); - - for(const report in this.reports){ - let r = JSON.stringify(this.reports[report]); - console.log(r); - if(r == newR){ - same = 1; - } - } - if(same == 0){ - this.reports.push(newReport); - } - this.state = newState; }, - deleteReport: function(reportIndex){ - this.reports.splice(reportIndex, 1) - } } }); From 0998d1a88f1c95271dee40c69a79702d79c7aa41 Mon Sep 17 00:00:00 2001 From: MaxiSanc37 Date: Tue, 5 Mar 2024 19:56:15 -0500 Subject: [PATCH 32/32] The @click generateReport handler now will only show reports in the table that have the crop matching the crop in the dropdown --- farmdata2/farmdata2_modules/fd2_school/api2/api2.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html index 3af4d3dd..8003184b 100644 --- a/farmdata2/farmdata2_modules/fd2_school/api2/api2.html +++ b/farmdata2/farmdata2_modules/fd2_school/api2/api2.html @@ -102,6 +102,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      newArea: '', reports:[ {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:10, units:'Bunches'}, + {date:'2018-05-02', area:'Chuau-1', crop:'Kale', yield:11, units:'Bunches'}, ], farm:'', user:'', @@ -126,7 +127,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      let tableRows = [] //log iterates through the response array as the index for(let log of this.getAllPagesRes) { - let tableRow = { + let tableRow = { //parses the timestamp to a human readable date date: dayjs.unix(log.timestamp).format('MM/DD/YYYY'), area: log.area[0].name, @@ -134,7 +135,9 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      units: log.quantity[0].unit.name, crop: this.idToCropMap.get(log.data.crop_tid) } - tableRows.push(tableRow) + if(this.idToCropMap.get(log.data.crop_tid) == this.newCrop){ + tableRows.push(tableRow) + } } return tableRows } @@ -142,6 +145,7 @@

      {{ header == '' ? 'Mock Harvest Report':header }}

      }, methods: { generateReport: function(newState){ + this.state = newState; axios.get('/farm.json') // this line sends the request. .then((response) => { this.farm = response.data.name;