mirror of
https://github.com/itflow-org/itflow
synced 2026-11-21 03:47:25 +00:00
Quotes: a line can have a picture beside its name on the quote, guest link, portal and PDF, uploaded or pulled from a link to a picture or a product page's main picture, fetched only from public addresses and kept as ITFlow's own resized copy in uploads/quote_images; products keep a picture that a quote line added from them copies, Copy Quote copies them, and deleting a line, quote, client or product removes the files; Admin Settings Quotes can switch pictures off; database 3.8.8 adds quote_items.item_image, products.product_image and config_quote_show_images; 26.11.9 changelog entries
This commit is contained in:
30
js/app.js
30
js/app.js
@@ -1006,6 +1006,36 @@ itflowBindOnce('itflowModalStackHidden', 'hidden.bs.modal', '.modal', function (
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* A picture field (quoteImageField(), functions/quote_images.php) - the file
|
||||
* picked shows in its box before it is saved, and picking one clears a link
|
||||
* typed in and a Remove ticked.
|
||||
*/
|
||||
itflowBindOnce('itflowImageField', 'change', '[data-image-file]', function () {
|
||||
const field = this.closest('[data-image-field]');
|
||||
const file = this.files && this.files[0];
|
||||
if (!field || !file || !/^image\//.test(file.type)) {
|
||||
return;
|
||||
}
|
||||
const preview = field.querySelector('[data-image-preview]');
|
||||
const empty = field.querySelector('[data-image-empty]');
|
||||
const url = field.querySelector('[data-image-url]');
|
||||
const remove = field.querySelector('[data-image-remove]');
|
||||
if (preview) {
|
||||
preview.src = URL.createObjectURL(file);
|
||||
preview.hidden = false;
|
||||
}
|
||||
if (empty) {
|
||||
empty.hidden = true;
|
||||
}
|
||||
if (url) {
|
||||
url.value = '';
|
||||
}
|
||||
if (remove) {
|
||||
remove.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A required field left empty on a tab that isn't showing - the Ticket tab of
|
||||
* a template while Sets up is open, a fill-in on Details while Tasks is -
|
||||
|
||||
Reference in New Issue
Block a user