PageSourceSearch

https://app.rosalog.com/up/invoice/views/RecurringInvoiceDisplayView.js

js rosalog.com collected 2026-10-07 19:57:32 UTC 8,798 bytes, 161 lines download raw bytes

1var sr;
2(function (sr) {
3    var invoice;
4    (function (invoice) {
5        var views;
6        (function (views) {
7            var DisplayViewOptions = sr.oui.view.DisplayViewOptions;
8            var salesDocumentService = sr.invoice.services.salesDocumentService;
9            var Div = sr.ui.Div;
10            var SRElement = sr.ui.SRElement;
11            var Segment = sr.ui.semantic.Segment;
12            var SalesDocumentKind = sr.invoice.model.SalesDocumentKind;
13            var RecurringInvoiceStatus = sr.invoice.model.RecurringInvoiceStatus;
14            var RecurringInvoice = sr.invoice.model.RecurringInvoice;
15            class RecurringInvoiceDisplayViewOptions extends DisplayViewOptions {
16                constructor() {
17                    super(...arguments);
18                    this.onMobileApp = false;
19                }
20            }
21            views.RecurringInvoiceDisplayViewOptions = RecurringInvoiceDisplayViewOptions;
22            class RecurringInvoiceDisplayView extends sr.oui.view.DisplayView {
23                constructor(app, storageAccess, displayViewOptions) {
24                    super(displayViewOptions);
25                    this.app = app;
26                    this.storageAccess = storageAccess;
27                    this.displayViewOptions = displayViewOptions;
28                    let __this = this;
29                }
30                build() {
31                    let __this = this;
32                    __this.makePanel();
33                    __this.buttonsSegment = new sr.ui.Div();
34                    __this.panel.add(__this.buttonsSegment);
35                    __this.documentPanel = new sr.ui.Div();
36                    __this.panel.add(__this.documentPanel);
37                }
38                makePanel() {
39                    let __this = this;
40                    if (!__this.panel) {
41                        __this.panel = new sr.ui.Div();
42                    }
43                }
44                makeButtons() {
45                    let __this = this;
46                    __this.buttonsSegment.removeChildren();
47                    if (__this.displayViewOptions.withCloseButton) {
48                        __this.closeButton = new sr.ui.semantic.CloseButton("");
49                        __this.closeButton.setStyle("float: right;padding: 6px;");
50                    }
51                    if (__this.displayViewOptions.withChangeButtons) {
52                        __this.modifyButton = new sr.ui.semantic.Button(sr.NLSSForButton(["generic", "Modify"]), "pen", sr.ui.semantic.Color.yellow);
53                        __this.modifyButton.setSize(sr.ui.semantic.Size.tiny);
54                        __this.deleteButton = new sr.ui.semantic.Button(sr.NLSSForButton(["generic", "Delete"]), "trash", sr.ui.semantic.Color.red);
55                        __this.deleteButton.setSize(sr.ui.semantic.Size.tiny);
56                    }
57                    if (__this.displayViewOptions.withQuickChangeButtons) {
58                    }
59                    if (true) {
60                        let showIndicateActivate = false;
61                        let showIndicateDesactivate = false;
62                        if (__this.current) {
63                            let status = invoice.RecurringInvoiceMethods.status(__this.current);
64                            switch (status) {
65                                case RecurringInvoiceStatus.ACTIVE:
66                                    showIndicateDesactivate = true;
67                                    break;
68                                case RecurringInvoiceStatus.INACTIVE:
69                                    showIndicateActivate = true;
70                                    break;
71                            }
72                        }
73                        if (showIndicateActivate) {
74                            let indicateActivateButton = new sr.ui.semantic.Button("Activer");
75                            indicateActivateButton.addClickListener(() => {
76                                if (__this.current) {
77                                    let modifications = new RecurringInvoice();
78                                    //FIXME modifications.totallyPaid = true;
79                                    __this.storageAccess.update(RecurringInvoice.mmClass, __this.current, modifications)
80                                        .then(() => {
81                                        __this.app.refresh();
82                                    });
83                                }
84                            });
85                            __this.buttonsSegment.add(indicateActivateButton);
86                        }
87                        if (showIndicateDesactivate) {
88                            let indicateDesactivateButton = new sr.ui.semantic.Button("Désactiver");
89                            indicateDesactivateButton.addClickListener(() => {
90                                if (__this.current) {
91                                    let modifications = new RecurringInvoice();
92                                    //FIXME modifications.totallyPaid = true;
93                                    __this.storageAccess.update(RecurringInvoice.mmClass, __this.current, modifications)
94                                        .then(() => {
95                                        __this.app.refresh();
96                                    });
97                                }
98                            });
99                            __this.buttonsSegment.add(indicateDesactivateButton);
100                        }
101                        if (true) {
102                            let duplicateButton = new sr.ui.semantic.Button("Dupliquer");
103                            duplicateButton.addClickListener(() => {
104                                if (__this.current) {
105                                    delete __this.current.dataId;
106                                    delete __this.current.id;
107                                    __this.storageAccess.insert(RecurringInvoice.mmClass, __this.current)
108                                        .then(() => {
109                                        __this.app.refresh();
110                                    });
111                                }
112                            });
113                            __this.buttonsSegment.add(duplicateButton);
114                        }
115                    }
116                }
117                fill(recurringInvoice) {
118                    let __this = this;
119                    this.current = new RecurringInvoice(recurringInvoice);
120                    __this.makeButtons();
121                    __this.documentPanel.removeChildren();
122                    salesDocumentService.generateHTMLSalesDocument(SalesDocumentKind.RECURRING_INVOICE, recurringInvoice.dataId, true)
123                        .then(function (html) {
124                        __this.documentPanel.removeChildren();
125                        __this.documentPanel.setStyle("width: 18cm;margin-left: auto;margin-right: auto;");
126                        let segmentForDocument = new Segment("raised paper");
127                        segmentForDocument.setStyle("display:inline-block");
128                        __this.documentPanel.add(segmentForDocument);
129                        let ribbon = new Div("ui right ribbon label");
130                        let color = invoice.RecurringInvoiceMethods.statusColor(recurringInvoice);
131                        ribbon.addClass(color);
132                        ribbon.setText(invoice.RecurringInvoiceMethods.statusMessage(recurringInvoice));
133                        segmentForDocument.add(ribbon);
134                        let divForHtmlDocument = new Div();
135                        divForHtmlDocument.setStyle("padding: 1cm");
136                        segmentForDocument.add(divForHtmlDocument);
137                        let elementForGeneratedHTML = new SRElement();
138                        elementForGeneratedHTML.el.innerHTML = html;
139                        divForHtmlDocument.add(elementForGeneratedHTML);
140                    })
141                        .catch(function (e) {
142                        __this.documentPanel.add(new Div("Error calling service " + e));
143                    });
144                }
145                getPanel() {
146                    return this.panel;
147                }
148                show() {
149                    // if (this.current)
150                    //     this.fill(this.current);
151                }
152                refresh() {
153                    // if (this.current)
154                    //     this.fill(this.current);
155                }
156            }
157            views.RecurringInvoiceDisplayView = RecurringInvoiceDisplayView;
158        })(views = invoice.views || (invoice.views = {}));
159    })(invoice = sr.invoice || (sr.invoice = {}));
160})(sr || (sr = {}));
161//# sourceMappingURL=RecurringInvoiceDisplayView.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.