From 58adf92e663a59aaaf41bc72e31df7fb0f2b839c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 25 Apr 2019 20:25:20 +0000 Subject: [PATCH] Bug 22779: WIP POC combining the page and making the prediction automatic --- .../prog/en/modules/serials/subscription-add.tt | 21 +++++-------- .../intranet-tmpl/prog/js/subscription-add.js | 34 ++++++++++++---------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index 0f056f0bd1..25308b6996 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -33,7 +33,7 @@ fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
-

[% IF ( modify ) %] Modify subscription for [% bibliotitle | html %][% ELSE %]Add a new subscription[% END %] (1/2)

+

[% IF ( modify ) %] Modify subscription for [% bibliotitle | html %][% ELSE %]Add a new subscription[% END %]

[% IF ( modify ) %] @@ -45,8 +45,7 @@ fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ -
-
+
Subscription details
    @@ -209,14 +208,9 @@ fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
-
- -
-
-
-
+
[% IF ( Koha.Preference('Mana') == 1) && !mana_url %]

The Mana Knowledge Base can be used to import subscription patterns submitted by other libraries and save you extra work. Ask your system administrator to configure this service and complete the configuration, or remove this message by disabling the system preference @@ -469,15 +463,14 @@ fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
- -
-
-
+
+ Cannot predict pattern due to issues below: +
    +
  • -
    diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js index d82b875dbf..2fd6c2ac8a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js +++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js @@ -45,7 +45,7 @@ function Clear(id) { $("#"+id).val(''); } -function Check_page1() { +function Check_page(){ if ( $("#aqbooksellerid").val().length == 0) { input_box = confirm( MSG_LINK_TO_VENDOR ); if (input_box==false) { @@ -57,10 +57,6 @@ function Check_page1() { return false; } - return true; -} - -function Check_page2(){ if( more_than_one_serial == "" ){ if($("#acqui_date").val().length == 0){ alert( MSG_REQUIRED_PUB_DATE ); @@ -260,25 +256,31 @@ function testPredictionPattern() { var error = 0; var error_msg = ""; if(frequencyid == undefined || frequencyid == ""){ - error_msg += "- " + MSG_FREQUENCY_UNDEFINED + "\n"; + error_msg += "
  • " + MSG_FREQUENCY_UNDEFINED + "
  • "; error ++; } acquidate = $("#acqui_date").val(); if(acquidate == undefined || acquidate == ""){ - error_msg += "-" + MSG_PUB_DATE_UNDEFINED + "\n"; + error_msg += "
  • " + MSG_PUB_DATE_UNDEFINED + "
  • "; error ++; } if( more_than_one_serial !== "" ){ var nextacquidate = $("#nextacquidate").val(); if(nextacquidate == undefined || nextacquidate == ""){ - error_msg += "-" + MSG_NEXT_ISSUE_UNDEFINED + "\n"; + error_msg += "
  • " + MSG_NEXT_ISSUE_UNDEFINED + "
  • "; error ++; } } if(error){ - alert( MSG_PATTERN_TEST_FAILED.format(error_msg) ); + $("#pattern_error_box").show(); + $("#pattern_errors").html( error_msg ); + $("#displayexample").hide(); + // alert( MSG_PATTERN_TEST_FAILED.format(error_msg) ); return false; + } else { + $("#pattern_error_box").hide(); + $("#pattern_errors").html(""); } var custompattern = 0; @@ -382,7 +384,6 @@ function saveAdvancedPattern() { function show_page_1() { $("#page_1").show(); $("#page_2").hide(); - $("#page_number").text("1/2"); } function show_page_2() { @@ -615,11 +616,12 @@ $(document).ready(function() { }); } - $("#mana_search").hide(); + //$("#mana_search").hide(); - show_page_1(); + //show_page_1(); + testPredictionPattern(); $("#subscription_add_form").on("submit",function(){ - return Check_page2(); + return Check_page(); }); $("#vendor_search").on("click",function(e){ e.preventDefault(); @@ -665,8 +667,10 @@ $(document).ready(function() { e.preventDefault(); saveAdvancedPattern(); }); - $("#testpatternbutton").on("click",function(e){ - e.preventDefault(); + $("#frequency, #acqui_date, #nextacquidate, #numberpattern, #moreoptionst input").on("change input",function(e){ + console.log("trig"); + //e.preventDefault(); + numberpatternload(); testPredictionPattern(); }); $('#save-subscription').on("click", function(e){ -- 2.11.0