111 |
112 |
113 |
${translations.type}${existingBill.type}
114 |
115 |
116 |
${translations.asset}${existingBill.asset}
117 |
118 |
119 |
`;
120 | } else {
121 | if (currentBillId) {
122 | let existingBill2 = bills.find(item => item.id === currentBillId);
123 | if (existingBill2) {
124 | existingBill2.infosShown = false;
125 | // Hide Infos
126 | let title = existingBill2.asset;
127 | if (title.length > 18) {
128 | title = title.slice(0, 18) + "...";
129 | }
130 | let divlClass = "mainDivInsideBillDivLR";
131 | if (existingBill2.paid) {
132 | divlClass = "mainDivInsideBillDivLR mainDivInsideBillDivLRGreen";
133 | }
134 | document.getElementById(`mainDivInsideBillDiv-${existingBill2.id}`).innerHTML=`
135 |
137 |
138 |
139 |
${translations.type}${existingBill2.type}
140 |
141 |
142 |
${translations.asset}${existingBill2.asset}
143 |
144 |
145 |
`;
146 | }
147 | }
148 | currentBillId = Number(name2);
149 | existingBill.infosShown = true;
150 | let asset = existingBill.asset;
151 | if (asset.length > 18) {
152 | asset = asset.slice(0, 18) + "...";
153 | }
154 | let amountText = "Amount Due";
155 | let divlClass = "mainDivInsideBillDivLR";
156 | if (existingBill.paid) {
157 | divlClass = "mainDivInsideBillDivLR mainDivInsideBillDivLRGreen";
158 | amountText = "Amount Paid";
159 | document.getElementById(`mainDivInsideBillDiv-${existingBill.id}`).innerHTML=`
160 |
162 |
163 |
164 |
${translations.type}${existingBill.type}
165 |
166 |
167 |
${translations.asset}${existingBill.asset}
168 |
169 |
173 |
174 |
175 |
176 |
${amountText}$${existingBill.amount} incl. ${existingBill.taxRate}% tax
177 |
178 |
${translations.pay_bill}
179 |
`;
180 | } else {
181 | document.getElementById(`mainDivInsideBillDiv-${existingBill.id}`).innerHTML=`
182 |
184 |
185 |
186 |
${translations.type}${existingBill.type}
187 |
188 |
189 |
${translations.asset}${existingBill.asset}
190 |
191 |
195 |
196 |
197 |
198 |
${amountText}$${existingBill.amount} incl. ${existingBill.taxRate}% tax
199 |
200 |
${translations.pay_bill}
201 |
`;
202 | }
203 | }
204 | }
205 | } else if (name1 === "showOutstandings") {
206 | document.getElementById("billingDivInside2TopRightBtn1").classList.add("billingDivInside2TopRightBtnActive");
207 | document.getElementById("billingDivInside2TopRightBtn2").classList.remove("billingDivInside2TopRightBtnActive");
208 | document.getElementById("billingDivInside2BottomBottom").innerHTML="";
209 | bills.forEach(function(billData, index) {
210 | if (billData.paid === false) {
211 | var billHTML = `
212 |