update koneksi DB

This commit is contained in:
Wian Drs
2026-09-11 18:06:17 +07:00
parent 4ef15c22ae
commit ff870b7667
30 changed files with 390 additions and 115 deletions
+1
View File
@@ -0,0 +1 @@
.company-settings-workspace{padding:20px;background:#f4f6f9;min-height:calc(100vh - 70px);color:#182230}.company-settings-hero{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:24px 28px;border-radius:18px;background:linear-gradient(125deg,#172b4d,#24456f 62%,#e77800);color:#fff;margin-bottom:16px}.company-settings-hero span{font-size:10px;letter-spacing:.18em;color:#fbbf77}.company-settings-hero h3{margin:4px 0}.company-settings-hero p{margin:0;color:#dbe7f5}.active-company-chip{min-width:260px;padding:11px 14px;border:1px solid rgba(255,255,255,.22);border-radius:12px;background:rgba(255,255,255,.1)}.active-company-chip small,.active-company-chip b{display:block}.company-settings-nav{display:flex;gap:6px;padding:8px;margin-bottom:15px;border:1px solid #e4e7ec;border-radius:14px;background:#fff;overflow-x:auto;flex-wrap:nowrap}.company-settings-nav .nav-link{white-space:nowrap;color:#344054;border-radius:9px}.company-settings-nav .nav-link.active{background:#172b4d}.settings-card{padding:20px;border:1px solid #e4e7ec;border-radius:14px;background:#fff;box-shadow:0 5px 18px rgba(16,24,40,.04)}.settings-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;padding-bottom:12px;border-bottom:1px solid #eaecf0}.settings-card-head h5{margin:0}.settings-card-head p{margin:3px 0 0;color:#667085}.identity-grid{display:grid;grid-template-columns:240px minmax(0,1fr);gap:25px}.logo-field small{display:block;color:#667085;margin-top:6px}.company-logo-preview{display:flex;height:150px;margin-bottom:12px;align-items:center;justify-content:center;flex-direction:column;border:1px dashed #98a2b3;border-radius:12px;background:#f8fafc;color:#667085;overflow:hidden}.company-logo-preview img{width:100%;height:100%;object-fit:contain}.company-logo-preview i{font-size:32px}.settings-split{display:grid;grid-template-columns:minmax(300px,38%) minmax(0,62%);gap:15px}.table small{display:block;color:#667085}.currency-list,.company-switch-list{display:grid;gap:7px}.currency-row,.company-switch{display:flex;width:100%;justify-content:space-between;align-items:center;padding:11px;border:1px solid #e4e7ec;border-radius:9px;background:#fff;color:#344054;text-align:left;text-decoration:none}.currency-row:hover,.company-switch:hover{border-color:#84adff;background:#f5f8ff}.currency-row span:last-child{font-size:11px;color:#667085}.company-switch span,.company-switch small{display:block}.company-switch.active{border-color:#175cd3;background:#eff8ff}.form-label{font-size:12px;font-weight:600;color:#344054}@media(max-width:900px){.company-settings-hero{align-items:flex-start;flex-direction:column}.active-company-chip{min-width:0;width:100%}.identity-grid,.settings-split{grid-template-columns:1fr}.company-settings-workspace{padding:12px}}
+57 -12
View File
@@ -135,7 +135,9 @@
'"><i class="bi bi-truck"></i> Buat Surat Jalan</button>';
if (p.export)
html +=
'<button class="btn btn-sm btn-outline-danger open-invoice-pdf" data-url="' +
'<button class="btn btn-sm btn-outline-danger open-invoice-pdf" data-id="' +
row.id +
'" data-url="' +
cfg.base +
"invoices/pdf/" +
row.id +
@@ -230,6 +232,7 @@
render: function (d,t,r) {
if(r.invoice_purpose==="loan")return "Tagihan Pinjaman";
if(r.invoice_purpose==="savings")return "Tagihan Tabungan";
if(r.invoice_purpose==="mixed")return "Penjualan + Tabungan";
return esc(
r.recognition_policy === "accrual"
? "Diakui saat Posted"
@@ -456,7 +459,7 @@
$(".invoice-batch-common").toggleClass("d-none", savings);
$("#nonInventoryDescriptionLabel").html(savings ? 'Deskripsi <span class="text-danger">*</span>' : 'Nama Jasa / Deskripsi <span class="text-danger">*</span>');
$("#lineValueLabel").text(savings ? "Nominal" : "Harga Satuan / Nominal");
if(savings){form.find("[name=tax_rate]").val("0");form.find("[name=qty]").val("1");form.find("[name=unit]").val("Tabungan");form.find("[name=batch_discount]").val("0");}
if(savings){form.find("[name=tax_rate]").val("0");form.find("[name=qty]").val("1");form.find("[name=unit]").val("Tabungan");}
else if(!inventory)form.find("[name=unit]").val("Jasa");
selectedItem = null;
selectedBars = [];
@@ -537,7 +540,7 @@
var date = form.find("[name=service_date]").val(),
discount = parseMoney(form.find("[name=batch_discount]").val()),
gross = batchLines.reduce(function (s, x) {
return s + x.qty * x.unit_price;
return s + (x.line_type === "savings" ? 0 : x.qty * x.unit_price);
}, 0);
if (!date) return notify("Tanggal transaksi wajib diisi.", "warning");
if (discount < 0 || discount > gross)
@@ -663,7 +666,6 @@
}
if(type === "savings")line.tax_rate=0;
if(Number(form.find("[name=editing_line_id]").val())>0)return updateExistingLine(line);
if(batchLines.length){var firstSavings=batchLines[0].line_type==="savings",currentSavings=line.line_type==="savings";if(firstSavings!==currentSavings)return notify("Barang/Jasa dan Tabungan harus dibuat pada invoice terpisah agar jurnalnya jelas.","warning");}
batchLines.push(line);
resetComposer();
renderBatchLines();
@@ -831,23 +833,26 @@
function calcBatch() {
var form = $("#invoiceLineForm");
if (!form.length) return;
var gross = batchLines.reduce(function (s, x) {
return s + x.qty * x.unit_price;
}, 0),
var displayGross = batchLines.reduce(function (s, x) {
return s + x.qty * x.unit_price;
}, 0),
gross = batchLines.reduce(function (s, x) {
return s + (x.line_type === "savings" ? 0 : x.qty * x.unit_price);
}, 0),
discount = parseMoney(form.find("[name=batch_discount]").val()),
last = -1,
used = 0,
total = 0;
batchLines.forEach(function (x, i) {
if (x.qty * x.unit_price > 0) last = i;
if (x.line_type !== "savings" && x.qty * x.unit_price > 0) last = i;
});
batchLines.forEach(function (x, i) {
var share = allocatedDiscount(x, i, gross, discount, last, used);
var share = x.line_type === "savings" ? 0 : allocatedDiscount(x, i, gross, discount, last, used);
used += share;
total +=
Math.max(0, x.qty * x.unit_price - share) * (1 + x.tax_rate / 100);
});
$("#batchGrossTotal").text(money(gross));
$("#batchGrossTotal").text(money(displayGross));
$("#batchDiscountTotal").text(money(discount));
$("#lineLiveTotal").text(money(total));
var valid = batchLines.length > 0 && discount >= 0 && discount <= gross;
@@ -1227,11 +1232,51 @@
});
});
});
$(document).on("click", ".open-invoice-pdf", function () {
$("#invoicePdfModal iframe").attr("src", $(this).data("url"));
function openInvoicePdf(url) {
$("#invoicePdfModal iframe").attr("src", url);
bootstrap.Modal.getOrCreateInstance(
document.getElementById("invoicePdfModal"),
).show();
}
$(document).on("click", ".open-invoice-pdf", function () {
var button = $(this),
url = String(button.data("url") || ""),
id = Number(button.data("id") || url.split("/").filter(Boolean).pop());
if (!id || !url) return notify("Invoice tidak valid.", "error");
button.prop("disabled", true);
$.getJSON(cfg.base + "invoices/pdf_options/" + id)
.done(function (response) {
if (!response.status) return notify(response.message, "error");
var option = response.data || {};
if (Number(option.count || 0) < 1)
return openInvoicePdf(url + "?include_previous=0");
Swal.fire({
title: "Pilihan PDF Invoice",
html:
"Customer memiliki <b>" +
esc(option.count) +
" invoice sebelumnya</b> yang belum lunas dengan total " +
esc(money(option.total)) +
".",
icon: "question",
input: "checkbox",
inputValue: 0,
inputPlaceholder:
"Sertakan daftar tagihan sebelumnya pada PDF",
showCancelButton: true,
confirmButtonText: "Tampilkan PDF",
cancelButtonText: "Batal",
}).then(function (result) {
if (result.isConfirmed)
openInvoicePdf(
url + "?include_previous=" + (result.value ? "1" : "0"),
);
});
})
.fail(error)
.always(function () {
button.prop("disabled", false);
});
});
$("#invoicePdfModal").on("hidden.bs.modal", function () {
$(this).find("iframe").attr("src", "about:blank");