function transfertManager(magasinsOptions, produitsOptions, oldInput = {}) {
    const today = new Date().toISOString().slice(0, 10);
    return {
        showModal: false,
        showDetailModal: false,
        selectedItem: null,
        detailReference: "",
        magasinsOptions: magasinsOptions || [],
        produitsOptions: produitsOptions || [],
        oldInput: oldInput,
        form: {
            magasin_origine_id: "",
            magasin_destination_id: "",
            produit_id: "",
            quantite: 1,
            date_transfert: today,
        },
        openModal() {
            this.form = {
                magasin_origine_id: "",
                magasin_destination_id: "",
                produit_id: "",
                quantite: 1,
                date_transfert: today,
            };
            this.showModal = true;
            this.$nextTick(() =>
                this.$el.dispatchEvent(
                    new CustomEvent("form-reset", {
                        bubbles: true,
                        detail: { formId: "transfert-form" },
                    }),
                ),
            );
        },
        viewTransfert(
            reference,
            origine,
            destination,
            produit,
            quantite,
            date,
        ) {
            this.selectedItem = {
                reference: reference,
                origine: origine,
                destination: destination,
                produit: produit,
                quantite: quantite,
                date: date,
            };
            this.detailReference = reference;
            this.showDetailModal = true;
        },
    };
}
