Amenitiz - Negative charges

Allows negative charges

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Amenitiz - Negative charges
// @namespace    http://amenitiz.io
// @version      1.0
// @description  Allows negative charges
// @author       Laurent Chervet
// @license      MIT
// @match        https://*.amenitiz.io/fr/admin/calendar
// @match        https://*.amenitiz.io/fr/admin/clients/show*
// @match        https://*.amenitiz.io/admin/invoice/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=microsoft.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    console.log('ℹ️ Init Amenitiz - Negative charges')

    function scripty_negativeCharges_applyPatch(element) {
        element.classList.add('j-skip-verification')
        element.removeAttribute('min')
    }

    const scripty_negativeCharges_observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(addedNode => {
                if (addedNode instanceof Element) {
                    if (addedNode.classList.contains('row-input-new-charge') || addedNode.classList.contains('td-form-container')) {
                        let scripty_negativeCharges_charge = addedNode.querySelector('#charge_price')
                        if (scripty_negativeCharges_charge) {
                            scripty_negativeCharges_applyPatch(scripty_negativeCharges_charge)
                        }
                    }
                }
            })
        })
    })

    let scripty_negativeCharges_container = document.querySelector('.booking-manager__sidepanel')
    if (scripty_negativeCharges_container) {
        scripty_negativeCharges_observer.observe(scripty_negativeCharges_container, {childList: true, subtree: true})
    }

    scripty_negativeCharges_container = document.querySelector('#extra_price_per_product')
    if (scripty_negativeCharges_container) {
        scripty_negativeCharges_applyPatch(scripty_negativeCharges_container)
    }

    scripty_negativeCharges_container = document.querySelector('#extra_price_per_adult')
    if (scripty_negativeCharges_container) {
        scripty_negativeCharges_applyPatch(scripty_negativeCharges_container)
    }

    scripty_negativeCharges_container = document.querySelector('#extra_price_per_children')
    if (scripty_negativeCharges_container) {
        scripty_negativeCharges_applyPatch(scripty_negativeCharges_container)
    }

    scripty_negativeCharges_container = document.querySelector('#extra_percentage_to_apply')
    if (scripty_negativeCharges_container) {
        scripty_negativeCharges_applyPatch(scripty_negativeCharges_container)
    }
})();