Files
growstuff/app/javascript/application.js
T
Brenda Wallace 7cbd5cf666 Add crop job season handling and warnings
- Introduced a new JavaScript module for crop job season management, including functions to describe planting days and update warnings based on selected dates.
- Updated the CropJobTemplate model to include methods for determining if a date is within the season for a given latitude.
- Enhanced the AddCropJobs service to support planting dates and adjust job due dates accordingly.
- Created a new view for displaying season warnings when adding crop jobs, allowing users to confirm adding jobs outside the specified season.
- Updated the job modal to prompt users for planting dates and display relevant warnings.
- Added tests for the new functionality, ensuring correct behavior for seasonal warnings and job creation based on planting dates.
2026-11-04 06:31:14 +13:00

47 lines
1.6 KiB
JavaScript

// The site's jQuery-era scripts expect these as globals, and jQuery plugins
// attach to window.jQuery, so globals must be set before anything else loads.
import './globals';
import 'jquery-ujs';
import 'jquery-ui/dist/jquery-ui';
import 'leaflet.markercluster';
import './site/auto_suggest';
import './site/crop_job_season';
import './site/cropmap';
import './site/editable';
import './site/finish_toggle';
import './site/job_ideas';
import './site/job_notepad';
import './site/likes';
import './site/members';
import './site/navbar_search';
import './site/packet_sheet';
import './site/places';
import './site/planting_alternate_name';
import './site/shareon';
import './site/tab_navigation';
import { initFlashMessages } from './site/flash_messages';
document.addEventListener('DOMContentLoaded', function() {
initFlashMessages();
var popoverTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
popoverTrigger.map(function(popoverTrigger2) {
return new bootstrap.Popover(popoverTrigger2);
});
var tooltipTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTrigger.map(function(tooltipTrigger2) {
return new bootstrap.Tooltip(tooltipTrigger2);
});
});
// Tell the server which time zone the browser is in, so "today" and "yesterday"
// are the member's own days.
try {
document.cookie = 'timezone=' + encodeURIComponent(Intl.DateTimeFormat().resolvedOptions().timeZone) +
'; path=/; max-age=31536000; SameSite=Lax';
} catch (error) {
// No time zone to send: the server's is used.
}