@rangka-os/create 0.5.0-alpha.27 → 0.5.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/base/apps/absen_karyawan/app.rk +37 -0
- package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
- package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
- package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
- package/template/base/apps/jasa_proyek/app.rk +4 -1
- package/template/base/apps/kasir/app.rk +5 -1
- package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
- package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
- package/template/base/apps/pembukuan/app.rk +3 -0
- package/template/base/connectors/midtrans/connector.rk +249 -0
- package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
- package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
- package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
- package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
- package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
- package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
- package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
- package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
- package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
- package/template/base/connectors/rangka_whatsapp/README.md +105 -0
- package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
- package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
- package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
- package/template/base/connectors/shopee/connector.rk +360 -0
- package/template/base/connectors/shopee/fixtures/expect.json +119 -0
- package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
- package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
- package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
- package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
- package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
- package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
- package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
- package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
- package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
- package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
- package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
- package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
- package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
- package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
- package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
- package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
- package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
- package/template/base/connectors/tiktok_shop/connector.rk +300 -0
- package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
- package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
- package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
- package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
- package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
- package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
- package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
- package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
- package/template/base/connectors/whatsapp_business/connector.rk +3 -1
- package/template/base/connectors/whatsapp_business/templates.md +13 -1
- package/template/base/modules/accounting/flows/gl_asset_disposal_post.rk +68 -0
- package/template/base/modules/accounting/flows/gl_asset_disposal_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_depreciation_run_post.rk +43 -0
- package/template/base/modules/accounting/flows/gl_depreciation_run_reverse.rk +36 -0
- package/template/base/modules/accounting/flows/gl_fixed_asset_post.rk +51 -0
- package/template/base/modules/accounting/flows/gl_fixed_asset_reverse.rk +194 -0
- package/template/base/modules/accounting/flows/gl_vendor_bill_post.rk +2 -2
- package/template/base/modules/accounting/models/gl_entry.rk +2 -0
- package/template/base/modules/accounting/module.rk +2 -2
- package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
- package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
- package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
- package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
- package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
- package/template/base/modules/attendance/models/attendance_period.rk +62 -0
- package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
- package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
- package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
- package/template/base/modules/attendance/module.rk +18 -0
- package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
- package/template/base/modules/catalogue/models/item.rk +69 -0
- package/template/base/modules/catalogue/module.rk +1 -1
- package/template/base/modules/contacts/models/customer.rk +43 -19
- package/template/base/modules/contacts/module.rk +1 -1
- package/template/base/modules/coretax/module.rk +1 -1
- package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
- package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
- package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
- package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
- package/template/base/modules/courses/module.rk +1 -1
- package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
- package/template/base/modules/fixed_assets/flows/asset_disposal_on_cancel.rk +14 -0
- package/template/base/modules/fixed_assets/flows/asset_disposal_on_submit.rk +21 -0
- package/template/base/modules/fixed_assets/flows/asset_from_vendor_bill.rk +41 -0
- package/template/base/modules/fixed_assets/flows/depreciation_run_fill.rk +28 -0
- package/template/base/modules/fixed_assets/flows/depreciation_run_monthly.rk +36 -0
- package/template/base/modules/fixed_assets/flows/depreciation_run_on_cancel.rk +30 -0
- package/template/base/modules/fixed_assets/flows/depreciation_run_on_submit.rk +34 -0
- package/template/base/modules/fixed_assets/flows/fixed_asset_on_cancel.rk +24 -0
- package/template/base/modules/fixed_assets/flows/fixed_asset_on_submit.rk +69 -0
- package/template/base/modules/fixed_assets/flows/fixed_assets_setup.rk +29 -0
- package/template/base/modules/fixed_assets/flows/opening_balance_asset_guard.rk +15 -0
- package/template/base/modules/fixed_assets/flows/vendor_bill_asset_guard.rk +14 -0
- package/template/base/modules/fixed_assets/imports/asset_list.rk +22 -0
- package/template/base/modules/fixed_assets/models/asset_bill_line.rk +24 -0
- package/template/base/modules/fixed_assets/models/asset_book.rk +83 -0
- package/template/base/modules/fixed_assets/models/asset_category.rk +54 -0
- package/template/base/modules/fixed_assets/models/asset_disposal.rk +97 -0
- package/template/base/modules/fixed_assets/models/asset_guard.rk +90 -0
- package/template/base/modules/fixed_assets/models/depreciation_line.rk +13 -0
- package/template/base/modules/fixed_assets/models/depreciation_run.rk +65 -0
- package/template/base/modules/fixed_assets/models/fixed_asset.rk +165 -0
- package/template/base/modules/fixed_assets/models/fixed_asset_setting.rk +34 -0
- package/template/base/modules/fixed_assets/module.rk +30 -0
- package/template/base/modules/fixed_assets/print/fixed_asset_register.html +45 -0
- package/template/base/modules/fixed_assets/print/fixed_asset_register.rk +17 -0
- package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
- package/template/base/modules/invoicing/module.rk +15 -2
- package/template/base/modules/kitchen/screens/dapur.rk +1 -0
- package/template/base/modules/outlets/models/outlet.rk +69 -0
- package/template/base/modules/outlets/module.rk +1 -1
- package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
- package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
- package/template/base/modules/payments/models/payment.rk +2 -1
- package/template/base/modules/payments/module.rk +1 -1
- package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
- package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
- package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
- package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
- package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
- package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
- package/template/base/modules/payroll/models/payroll_close.rk +10 -6
- package/template/base/modules/payroll/models/payroll_run.rk +64 -15
- package/template/base/modules/payroll/models/payslip.rk +48 -9
- package/template/base/modules/payroll/module.rk +22 -5
- package/template/base/modules/payroll/print/payslip.html +4 -1
- package/template/base/modules/pos/models/pos_sale.rk +136 -9
- package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
- package/template/base/modules/pos/module.rk +5 -3
- package/template/base/modules/pos/print/pos_receipt.html +7 -3
- package/template/base/modules/pos/screens/kasir.rk +7 -2
- package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
- package/template/base/modules/procurement/models/vendor_bill.rk +21 -2
- package/template/base/modules/procurement/module.rk +11 -2
- package/template/base/modules/projects/screens/absen.rk +1 -0
- package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
- package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
- package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
- package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
- package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
- package/template/base/modules/promotions/models/promo_code.rk +27 -0
- package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
- package/template/base/modules/promotions/models/promo_guard.rk +44 -0
- package/template/base/modules/promotions/models/promotion.rk +197 -0
- package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
- package/template/base/modules/promotions/module.rk +20 -0
- package/template/base/modules/rental/models/rental_unit.rk +13 -3
- package/template/base/modules/rental/module.rk +2 -2
- package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
- package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
- package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
- package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
- package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
- package/template/base/modules/stock/models/stock_reorder.rk +34 -0
- package/template/base/modules/stock/module.rk +17 -2
- package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
- package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
- package/template/base/modules/users/flows/summary_daily.rk +83 -0
- package/template/base/modules/users/flows/summary_monthly.rk +83 -0
- package/template/base/modules/users/flows/summary_weekly.rk +83 -0
- package/template/base/modules/users/models/business_summary.rk +67 -0
- package/template/base/modules/users/models/summary_setting.rk +35 -0
- package/template/base/modules/users/models/user.rk +11 -3
- package/template/base/modules/users/module.rk +21 -2
- package/template/base/modules/users/roles/employee.rk +8 -0
- package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
- package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
- package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
- package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
- package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
- package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
- package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
- package/template/base/modules/whatsapp/module.rk +23 -0
- package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
- package/template/base/modules/whatsapp_booking/module.rk +13 -0
- package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
- package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
- package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
- package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
- package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
- package/template/base/modules/whatsapp_receipt/module.rk +13 -0
- package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
- package/template/base/modules/whatsapp_reminder/module.rk +15 -0
- package/template/base/modules/workforce/imports/worker_list.rk +4 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
2
|
name: accounting
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.4.0
|
|
4
4
|
title: {id: Akuntansi, en: Accounting}
|
|
5
5
|
summary:
|
|
6
6
|
id: Jurnal, saldo awal, tutup buku dan laporan keuangan dari transaksi yang sudah dicatat.
|
|
@@ -13,4 +13,4 @@ icon: book-2-line
|
|
|
13
13
|
# date. Laporan keuangan (financial_report) sums the lines into a profit and loss, a balance sheet and a cash
|
|
14
14
|
# summary (SAK EMKM). Tutup buku (period_close) locks every date up to closed_until.
|
|
15
15
|
requires: {rangka: '>=0.5', users: ^1.2}
|
|
16
|
-
optional: {contacts: ^1.0, outlets: ^1.0, invoicing: ^1.0, payments: ^1.0, procurement: ^1.0, stock: ^1.0, outlet_sales: ^1.0, projects: ^1.0, delivery: ^1.0, production: ^1.0, consignment: ^1.0, rental: ^1.0, pos: ^1.0}
|
|
16
|
+
optional: {contacts: ^1.0, outlets: ^1.0, invoicing: ^1.0, payments: ^1.0, procurement: ^1.0, stock: ^1.0, outlet_sales: ^1.0, projects: ^1.0, delivery: ^1.0, production: ^1.0, consignment: ^1.0, rental: ^1.0, pos: ^1.0, fixed_assets: ^1.0}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every morning at 10:00 (scheduler.timezone): head office and the owner are told which outlet staff have not clocked in
|
|
3
|
+
# today (contract 0066 notice, in-app and email; WhatsApp once paid WhatsApp credits exist). Only employees with access
|
|
4
|
+
# active, an outlet and not attendance_exempt are expected; without shifts (rangka-apps#120) every such employee is
|
|
5
|
+
# expected every day, so a day off shows here too. The flow only reads and tells. Scheduled flows run for the default
|
|
6
|
+
# org only until rangka-os#263 slice a lands.
|
|
7
|
+
# The notice gives the count, not the names: the kernel's CEL has no join(), and a failed {...} part is left in the
|
|
8
|
+
# message as code. Names come back once rangka-os adds a list-to-text function.
|
|
9
|
+
name: attendance_missing_digest
|
|
10
|
+
label: {id: Karyawan belum absen masuk, en: Staff not clocked in}
|
|
11
|
+
description: {id: 'Tiap pagi jam 10, kantor pusat dan pemilik dikabari berapa karyawan outlet yang belum absen masuk hari ini.'}
|
|
12
|
+
schedule: '0 10 * * *'
|
|
13
|
+
steps:
|
|
14
|
+
- find_all: user
|
|
15
|
+
where: access == 'active' && !attendance_exempt && size(outlets) > 0
|
|
16
|
+
sort: full_name
|
|
17
|
+
limit: 300
|
|
18
|
+
as: emps
|
|
19
|
+
- find_all: staff_attendance
|
|
20
|
+
where: work_date == today() && docstatus != 2 && clock_in != ''
|
|
21
|
+
as: logs
|
|
22
|
+
- if: "emps.filter(u, !logs.exists(l, l.employee == u.name)).size() > 0"
|
|
23
|
+
notify: head_office
|
|
24
|
+
notice: attendance_missing
|
|
25
|
+
channel: email
|
|
26
|
+
id: "'missing:' + string(today())"
|
|
27
|
+
title: '{emps.filter(u, !logs.exists(l, l.employee == u.name)).size()} karyawan belum absen masuk hari ini'
|
|
28
|
+
template: >-
|
|
29
|
+
{emps.filter(u, !logs.exists(l, l.employee == u.name)).size()} karyawan outlet belum absen masuk sampai jam 10.
|
|
30
|
+
Siapa yang sudah masuk ada di dasbor Absen hari ini.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: attendance_period_on_cancel
|
|
3
|
+
label: {id: 'Rekap absen karyawan dibatalkan: ringkasannya ditandai batal'}
|
|
4
|
+
# The summaries stay as the trail, marked cancelled (payroll skips cancelled summaries).
|
|
5
|
+
on: attendance_period.cancelled
|
|
6
|
+
if: "'docstatus' in event && event.docstatus == 2"
|
|
7
|
+
steps:
|
|
8
|
+
- find_all: attendance_summary
|
|
9
|
+
where: attendance_period == event.name && !cancelled
|
|
10
|
+
as: sums
|
|
11
|
+
- for_each: sums
|
|
12
|
+
as: s
|
|
13
|
+
do:
|
|
14
|
+
- update: s
|
|
15
|
+
set: {cancelled: true}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: attendance_period_on_submit
|
|
3
|
+
label: {id: Rekap absen karyawan jadi ringkasan per karyawan}
|
|
4
|
+
# One attendance_summary per employee with access active and not attendance_exempt, from the submitted logs of the period
|
|
5
|
+
# (of the period's outlet, or of every outlet). A period of one outlet summarises the employees who clocked in there
|
|
6
|
+
# (an employee of another outlet who never came is not that outlet's absence). Logs waiting for approval do not count.
|
|
7
|
+
# Refused (the whole submit rolls back) when another submitted period overlaps the days for the same outlet or the whole
|
|
8
|
+
# business. Reads in the order attendance_period, user, staff_attendance (contract 0025 locks), like the log guards.
|
|
9
|
+
on: attendance_period.submitted
|
|
10
|
+
# Only a real submit: a hand run (POST /flows/.../run) carries no submitted period and would summarise twice.
|
|
11
|
+
if: "'docstatus' in event && event.docstatus == 1"
|
|
12
|
+
steps:
|
|
13
|
+
- find: attendance_summary
|
|
14
|
+
where: attendance_period == event.name && !cancelled
|
|
15
|
+
as: done
|
|
16
|
+
- if: done != null
|
|
17
|
+
create: staff_attendance_guard
|
|
18
|
+
set:
|
|
19
|
+
reason: "'period_summarised'"
|
|
20
|
+
document: event.name
|
|
21
|
+
- find: attendance_period
|
|
22
|
+
where: >-
|
|
23
|
+
name != event.name && docstatus == 1 && period_from <= event.period_to && period_to >= event.period_from
|
|
24
|
+
&& (only_outlet == '' || event.only_outlet == '' || only_outlet == event.only_outlet)
|
|
25
|
+
as: other
|
|
26
|
+
- if: other != null
|
|
27
|
+
create: staff_attendance_guard
|
|
28
|
+
set:
|
|
29
|
+
reason: "'period_overlap'"
|
|
30
|
+
document: other.name
|
|
31
|
+
- find_all: user
|
|
32
|
+
where: access == 'active' && !attendance_exempt
|
|
33
|
+
sort: full_name
|
|
34
|
+
as: emps
|
|
35
|
+
- find_all: staff_attendance
|
|
36
|
+
where: >-
|
|
37
|
+
docstatus == 1 && work_date >= event.period_from && work_date <= event.period_to
|
|
38
|
+
&& (event.only_outlet == '' || outlet == event.only_outlet)
|
|
39
|
+
sort: work_date
|
|
40
|
+
as: logs
|
|
41
|
+
- for_each: emps
|
|
42
|
+
as: u
|
|
43
|
+
do:
|
|
44
|
+
- if: "event.only_outlet == '' || logs.exists(l, l.employee == u.name)"
|
|
45
|
+
create: attendance_summary
|
|
46
|
+
set:
|
|
47
|
+
attendance_period: event.name
|
|
48
|
+
employee: u.name
|
|
49
|
+
employee_name: u.full_name
|
|
50
|
+
# the period's outlet, else where they clocked in first; empty for a whole-business period without a log (a flow
|
|
51
|
+
# find does not load table fields, so the member's outlets in Tim cannot be read here: rangka-os follow-up)
|
|
52
|
+
outlet: "event.only_outlet != '' ? event.only_outlet : (logs.exists(l, l.employee == u.name) ? logs.filter(l, l.employee == u.name)[0].outlet : '')"
|
|
53
|
+
period_from: event.period_from
|
|
54
|
+
period_to: event.period_to
|
|
55
|
+
days_present: "logs.map(l, l.employee == u.name ? 1 : 0).sum()"
|
|
56
|
+
late_count: "logs.map(l, l.employee == u.name && l.late_min > 0 ? 1 : 0).sum()"
|
|
57
|
+
late_min_total: "logs.map(l, l.employee == u.name ? l.late_min : 0).sum()"
|
|
58
|
+
early_min_total: "logs.map(l, l.employee == u.name ? l.early_min : 0).sum()"
|
|
59
|
+
overtime_hours: "logs.map(l, l.employee == u.name ? l.overtime_hours : 0.0).sum()"
|
|
60
|
+
worked_min_total: "logs.map(l, l.employee == u.name ? l.worked_min : 0).sum()"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: staff_attendance_cancel_guard
|
|
3
|
+
label: {id: Absen di periode yang sudah direkap tidak bisa dibatalkan}
|
|
4
|
+
# The day is already in a submitted period's summaries: cancel the period first.
|
|
5
|
+
on: staff_attendance.cancelled
|
|
6
|
+
steps:
|
|
7
|
+
- find: attendance_period
|
|
8
|
+
where: docstatus == 1 && period_from <= event.work_date && period_to >= event.work_date && (only_outlet == '' || only_outlet == event.outlet)
|
|
9
|
+
as: closed
|
|
10
|
+
- if: closed != null
|
|
11
|
+
create: staff_attendance_guard
|
|
12
|
+
set:
|
|
13
|
+
reason: "'period_closed'"
|
|
14
|
+
document: closed.name
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: staff_attendance_guard_created
|
|
3
|
+
label: {id: Satu absen karyawan per orang per hari (baru)}
|
|
4
|
+
# A second live log of the same employee and day would count the day twice. The read takes the flow lock of contract
|
|
5
|
+
# 0025, so two clock-ins sent at the same moment run one after the other and the second is refused. A draft left without
|
|
6
|
+
# its clock-in time (the clock screen's second write failed) does not hold the day.
|
|
7
|
+
on: staff_attendance.created
|
|
8
|
+
steps:
|
|
9
|
+
- find: staff_attendance
|
|
10
|
+
where: day_key == event.day_key && name != event.name && docstatus != 2 && (docstatus == 1 || clock_in != '')
|
|
11
|
+
as: other
|
|
12
|
+
- if: other != null
|
|
13
|
+
create: staff_attendance_guard
|
|
14
|
+
set:
|
|
15
|
+
reason: "'second_log'"
|
|
16
|
+
document: other.name
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: staff_attendance_guard_submitted
|
|
3
|
+
label: {id: 'Absen karyawan yang diajukan tidak dobel, tidak masuk periode yang sudah direkap, fotonya tidak dipakai ulang'}
|
|
4
|
+
# Runs again at submit (also the submit an approval runs as the employee): no new day inside a submitted period of the
|
|
5
|
+
# same outlet or the whole business, one counted log per employee and day, one photo per log. Reads attendance_period
|
|
6
|
+
# before staff_attendance, the order of attendance_period_on_submit (contract 0025).
|
|
7
|
+
on: staff_attendance.submitted
|
|
8
|
+
steps:
|
|
9
|
+
- find: attendance_period
|
|
10
|
+
where: docstatus == 1 && period_from <= event.work_date && period_to >= event.work_date && (only_outlet == '' || only_outlet == event.outlet)
|
|
11
|
+
as: closed
|
|
12
|
+
- if: closed != null
|
|
13
|
+
create: staff_attendance_guard
|
|
14
|
+
set:
|
|
15
|
+
reason: "'period_closed'"
|
|
16
|
+
document: closed.name
|
|
17
|
+
- find: staff_attendance
|
|
18
|
+
where: day_key == event.day_key && name != event.name && docstatus != 2 && (docstatus == 1 || clock_in != '')
|
|
19
|
+
as: other
|
|
20
|
+
- if: other != null
|
|
21
|
+
create: staff_attendance_guard
|
|
22
|
+
set:
|
|
23
|
+
reason: "'second_log'"
|
|
24
|
+
document: other.name
|
|
25
|
+
# A photo already used by another live log of the same employee (the only logs a staff member can read).
|
|
26
|
+
- if: event.in_photo != ''
|
|
27
|
+
find: staff_attendance
|
|
28
|
+
where: >-
|
|
29
|
+
name != event.name && docstatus != 2 && (
|
|
30
|
+
in_photo == event.in_photo || out_photo == event.in_photo
|
|
31
|
+
|| (event.out_photo != '' && (in_photo == event.out_photo || out_photo == event.out_photo)))
|
|
32
|
+
as: same_photo
|
|
33
|
+
- if: event.in_photo != '' && same_photo != null
|
|
34
|
+
create: staff_attendance_guard
|
|
35
|
+
set:
|
|
36
|
+
reason: "'photo_reused'"
|
|
37
|
+
document: same_photo.name
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: staff_attendance_guard_updated
|
|
3
|
+
label: {id: Satu absen karyawan per orang per hari (diubah)}
|
|
4
|
+
# The same check when the clock-in time, the employee or the date of a draft is set or changed.
|
|
5
|
+
on: staff_attendance.updated
|
|
6
|
+
steps:
|
|
7
|
+
- find: staff_attendance
|
|
8
|
+
where: day_key == event.day_key && name != event.name && docstatus != 2 && (docstatus == 1 || clock_in != '')
|
|
9
|
+
as: other
|
|
10
|
+
- if: other != null && event.clock_in != ''
|
|
11
|
+
create: staff_attendance_guard
|
|
12
|
+
set:
|
|
13
|
+
reason: "'second_log'"
|
|
14
|
+
document: other.name
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: attendance_period
|
|
3
|
+
label: {id: Rekap absen karyawan, en: Staff attendance period}
|
|
4
|
+
icon: calendar
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: RAK-{YYYY}-{####}
|
|
7
|
+
title_field: period_from
|
|
8
|
+
# Closes the staff attendance of a period (a calendar month, or 21st to 20th), for one outlet or the whole business.
|
|
9
|
+
# On submit, flow attendance_period_on_submit writes one attendance_summary per active employee (not attendance_exempt)
|
|
10
|
+
# from the submitted logs of the period: days present, late count and minutes, early leave minutes, overtime hours.
|
|
11
|
+
# Logs still waiting for approval are not counted: decide them first (dashboard absen_hari_ini). While the period is
|
|
12
|
+
# submitted, logs dated inside it can be neither submitted nor cancelled; cancelling the period marks its summaries
|
|
13
|
+
# cancelled. Two submitted periods of overlapping days for the same outlet (or the whole business) are refused.
|
|
14
|
+
permissions:
|
|
15
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
16
|
+
# Read so the guard flows that run in their submit and cancel can see whether a day is closed. Not row scoped
|
|
17
|
+
# (only_outlet is not named outlet): every period's dates and outlet stay visible, the notes do not.
|
|
18
|
+
- {role: outlet_supervisor, read: true}
|
|
19
|
+
- {role: cashier, read: true}
|
|
20
|
+
- {role: outlet_staff, read: true}
|
|
21
|
+
- {role: employee, read: true}
|
|
22
|
+
fields:
|
|
23
|
+
- name: period_from
|
|
24
|
+
type: date
|
|
25
|
+
label: {id: Dari tanggal}
|
|
26
|
+
required: true
|
|
27
|
+
in_list: true
|
|
28
|
+
- name: period_to
|
|
29
|
+
type: date
|
|
30
|
+
label: {id: Sampai tanggal}
|
|
31
|
+
required: true
|
|
32
|
+
in_list: true
|
|
33
|
+
# Empty = every outlet of the business.
|
|
34
|
+
- name: only_outlet
|
|
35
|
+
type: link
|
|
36
|
+
to: outlet
|
|
37
|
+
label: {id: Outlet}
|
|
38
|
+
help: {id: 'Kosongkan untuk merekap semua outlet'}
|
|
39
|
+
in_list: true
|
|
40
|
+
- name: notes
|
|
41
|
+
type: text
|
|
42
|
+
label: {id: Catatan}
|
|
43
|
+
hidden_for: [outlet_supervisor, cashier, outlet_staff, employee]
|
|
44
|
+
rules:
|
|
45
|
+
- name: period_valid
|
|
46
|
+
on: save
|
|
47
|
+
check: period_to >= period_from && days_between(period_from, period_to) <= 30
|
|
48
|
+
message: {id: 'Periode rekap: sampai tanggal tidak boleh sebelum tanggal mulai, paling lama 31 hari'}
|
|
49
|
+
- name: period_over
|
|
50
|
+
on: submit
|
|
51
|
+
check: period_to < today()
|
|
52
|
+
message: {id: 'Periode ini belum selesai; rekap absen setelah tanggal terakhirnya lewat'}
|
|
53
|
+
views:
|
|
54
|
+
list:
|
|
55
|
+
columns: [name, period_from, period_to, only_outlet, status]
|
|
56
|
+
sort: -period_from
|
|
57
|
+
form:
|
|
58
|
+
layout:
|
|
59
|
+
- section: {id: Rekap absen karyawan}
|
|
60
|
+
columns:
|
|
61
|
+
- [period_from, period_to, only_outlet]
|
|
62
|
+
- [notes]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: attendance_summary
|
|
3
|
+
label: {id: Ringkasan absen, en: Attendance summary}
|
|
4
|
+
icon: list
|
|
5
|
+
naming: RGA-{YYYY}-{#####}
|
|
6
|
+
title_field: employee_name
|
|
7
|
+
# One employee's attendance in one submitted attendance_period, written only by its flows (every field read only):
|
|
8
|
+
# days present, lateness, early leave, overtime and minutes worked from the submitted staff_attendance logs. Payroll
|
|
9
|
+
# for in-house staff reads it (rangka-apps#101). Leave days and absent days come with leave and shifts
|
|
10
|
+
# (rangka-apps#114, #120). Cancelling the period marks its summaries cancelled; they are kept as the trail.
|
|
11
|
+
permissions:
|
|
12
|
+
- {role: head_office, read: true, create: true, write: true, export: true, print: true}
|
|
13
|
+
# The outlet supervisor reads the summaries of their outlets (row scope outlet: the employee's outlet in the period).
|
|
14
|
+
- {role: outlet_supervisor, read: true}
|
|
15
|
+
# Staff read their own.
|
|
16
|
+
- {role: cashier, read: true, if: "employee == user.name"}
|
|
17
|
+
- {role: outlet_staff, read: true, if: "employee == user.name"}
|
|
18
|
+
- {role: employee, read: true, if: "employee == user.name"}
|
|
19
|
+
fields:
|
|
20
|
+
- {name: attendance_period, type: link, to: attendance_period, label: {id: Rekap absen}, read_only: true, in_list: true}
|
|
21
|
+
- {name: employee, type: link, to: user, label: {id: Karyawan}, read_only: true}
|
|
22
|
+
- {name: employee_name, type: data, label: {id: Nama}, read_only: true, in_list: true}
|
|
23
|
+
# The period's outlet, else the outlet of the employee's first log in the period (empty without a log).
|
|
24
|
+
- {name: outlet, type: link, to: outlet, label: {id: Outlet}, read_only: true, in_list: true}
|
|
25
|
+
- {name: period_from, type: date, label: {id: Periode dari}, read_only: true, in_list: true}
|
|
26
|
+
- {name: period_to, type: date, label: {id: Periode sampai}, read_only: true}
|
|
27
|
+
- {name: days_present, type: int, label: {id: Hari hadir (sah)}, read_only: true, in_list: true}
|
|
28
|
+
- {name: late_count, type: int, label: {id: Kali terlambat}, read_only: true, in_list: true}
|
|
29
|
+
- {name: late_min_total, type: int, label: {id: Total terlambat (menit)}, read_only: true, in_list: true}
|
|
30
|
+
- {name: early_min_total, type: int, label: {id: Total pulang cepat (menit)}, read_only: true}
|
|
31
|
+
- {name: overtime_hours, type: float, label: {id: Jam lembur}, read_only: true, in_list: true}
|
|
32
|
+
- {name: worked_min_total, type: int, label: {id: Total lama kerja (menit)}, read_only: true}
|
|
33
|
+
- {name: cancelled, type: check, label: {id: Batal}, read_only: true, in_list: true, chip: true}
|
|
34
|
+
views:
|
|
35
|
+
list:
|
|
36
|
+
columns: [employee_name, outlet, period_from, period_to, days_present, late_min_total, overtime_hours, cancelled]
|
|
37
|
+
sort: -period_from
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: staff_attendance
|
|
3
|
+
label: {id: Absen karyawan, en: Staff attendance}
|
|
4
|
+
icon: clock
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: ABK-{YYYY}{MM}-{#####}
|
|
7
|
+
title_field: employee_name
|
|
8
|
+
# One employee, one day at one outlet: clocked in and out from the phone with its position and a selfie (screen
|
|
9
|
+
# absen_outlet, contract 0030 §2 clock). The shape is the project field attendance (projects/models/attendance_log.rk),
|
|
10
|
+
# keyed on the employee (users.user, contract 0056) and the outlet instead of the worker, the assignment and the work site.
|
|
11
|
+
# The employee creates it at clock-in (draft), fills the clock-out and the screen submits it. A submitted log is one day
|
|
12
|
+
# present; attendance_period turns the days of a period into one attendance_summary per employee.
|
|
13
|
+
#
|
|
14
|
+
# Outside the outlet radius, without a position, entered more than a day late or with overtime: saved with a reason and
|
|
15
|
+
# the submit waits for the outlet supervisor or head office (approvals below). Never refused for being far away
|
|
16
|
+
# (contract 0030 §4). Lateness is measured, not held: it is a fact for the summary (and later for payroll rules).
|
|
17
|
+
#
|
|
18
|
+
# Distance: distance_m (haversine) between the phone's geo position and the outlet's point; 1e9 without a position, so
|
|
19
|
+
# "no position" counts as outside. A faked position (fake GPS) is not detected; the selfie and the approver are the check.
|
|
20
|
+
#
|
|
21
|
+
# Clock times, positions and photos are set_once: nobody moves a measured value. A wrong log is corrected by head office
|
|
22
|
+
# cancelling it and making a new one (source manual); the cancelled log stays as the trail.
|
|
23
|
+
#
|
|
24
|
+
# Privacy: positions and selfies are personal data (UU PDP). Staff read only their own logs (permission if: below, which
|
|
25
|
+
# also filters lists and dashboards); the outlet supervisor reads the logs of their outlets (row scope outlet); head
|
|
26
|
+
# office reads all. The selfie is an attachment of this record and is readable by whoever can read the record.
|
|
27
|
+
permissions:
|
|
28
|
+
# Staff: only their own logs, at their own outlets (cashier and outlet_staff are also row scoped by outlet). No cancel,
|
|
29
|
+
# no delete.
|
|
30
|
+
- {role: cashier, read: true, create: true, write: true, submit: true, if: "employee == user.name"}
|
|
31
|
+
- {role: outlet_staff, read: true, create: true, write: true, submit: true, if: "employee == user.name"}
|
|
32
|
+
- {role: employee, read: true, create: true, write: true, submit: true, if: "employee == user.name"}
|
|
33
|
+
# The outlet supervisor reads and prints the logs of their outlets and decides the held submits; they clock in too.
|
|
34
|
+
- {role: outlet_supervisor, read: true, print: true}
|
|
35
|
+
- {role: outlet_supervisor, create: true, write: true, submit: true, if: "employee == user.name"}
|
|
36
|
+
# No amend: a wrong log is cancelled and replaced by a manual log, so a measured clock-in, position and selfie can
|
|
37
|
+
# never be carried over to another employee, outlet or day (audit 2026-11-19 F1). Delete removes a stuck draft.
|
|
38
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, export: true, print: true}
|
|
39
|
+
fields:
|
|
40
|
+
# The member's own employee record (contract 0056). Rule employee_self: only head office names someone else.
|
|
41
|
+
- name: employee
|
|
42
|
+
type: link
|
|
43
|
+
to: user
|
|
44
|
+
label: {id: Karyawan}
|
|
45
|
+
required: true
|
|
46
|
+
in_list: true
|
|
47
|
+
default: user.name
|
|
48
|
+
# set once: the position and selfie of a log can never be moved to another person (audit 2026-11-19 F1)
|
|
49
|
+
set_once: true
|
|
50
|
+
- name: employee_name
|
|
51
|
+
type: data
|
|
52
|
+
label: {id: Nama}
|
|
53
|
+
read_only: true
|
|
54
|
+
in_list: true
|
|
55
|
+
compute: "employee != '' ? employee.full_name : ''"
|
|
56
|
+
- name: outlet
|
|
57
|
+
type: link
|
|
58
|
+
to: outlet
|
|
59
|
+
label: {id: Outlet}
|
|
60
|
+
required: true
|
|
61
|
+
in_list: true
|
|
62
|
+
default: "user.outlets.size() > 0 ? user.outlets[0] : ''"
|
|
63
|
+
set_once: true
|
|
64
|
+
- name: work_date
|
|
65
|
+
type: date
|
|
66
|
+
label: {id: Tanggal}
|
|
67
|
+
required: true
|
|
68
|
+
default: today()
|
|
69
|
+
in_list: true
|
|
70
|
+
set_once: true
|
|
71
|
+
# phone: the clock screen; manual: a head office correction (no selfie needed, always held: it has no position).
|
|
72
|
+
# kiosk is kept for the shared outlet tablet (contract 0048), not accepted yet (rule source_allowed).
|
|
73
|
+
- name: source
|
|
74
|
+
type: select
|
|
75
|
+
label: {id: Sumber}
|
|
76
|
+
default: "'phone'"
|
|
77
|
+
options:
|
|
78
|
+
- {value: phone, label: {id: HP karyawan}}
|
|
79
|
+
- {value: manual, label: {id: Koreksi kantor pusat}}
|
|
80
|
+
- {value: kiosk, label: {id: Tablet outlet}}
|
|
81
|
+
# Clock-in (set by the clock screen together with the photo; set_once)
|
|
82
|
+
- name: clock_in
|
|
83
|
+
type: datetime
|
|
84
|
+
label: {id: Jam masuk}
|
|
85
|
+
set_once: true
|
|
86
|
+
in_list: true
|
|
87
|
+
- {name: in_pos, type: geo, label: {id: Posisi masuk}, set_once: true}
|
|
88
|
+
- {name: in_photo, type: image, label: {id: Foto masuk}, set_once: true}
|
|
89
|
+
# Clock-out
|
|
90
|
+
- name: clock_out
|
|
91
|
+
type: datetime
|
|
92
|
+
label: {id: Jam keluar}
|
|
93
|
+
set_once: true
|
|
94
|
+
in_list: true
|
|
95
|
+
- {name: out_pos, type: geo, label: {id: Posisi keluar}, set_once: true}
|
|
96
|
+
- {name: out_photo, type: image, label: {id: Foto keluar}, set_once: true}
|
|
97
|
+
- name: overtime_hours
|
|
98
|
+
type: float
|
|
99
|
+
label: {id: Jam lembur}
|
|
100
|
+
default: '0'
|
|
101
|
+
- name: reason
|
|
102
|
+
type: text
|
|
103
|
+
label: {id: Alasan}
|
|
104
|
+
# The outlet's point, radius, UTC offset and hours at the time of the log (frozen at submit with the rest of the record,
|
|
105
|
+
# so moving an outlet later leaves old logs measured where they were taken). An outlet without a radius uses 100 m.
|
|
106
|
+
- {name: site_point, type: geo, label: {id: Titik outlet}, hidden: true, read_only: true, compute: "outlet != '' ? outlet.point : ''"}
|
|
107
|
+
- {name: site_radius_m, type: int, label: {id: Radius outlet (m)}, read_only: true, compute: "outlet != '' && outlet.radius_m > 0 ? outlet.radius_m : 100"}
|
|
108
|
+
- {name: utc_offset, type: data, label: {id: Zona waktu}, hidden: true, read_only: true, compute: "outlet == '' ? '+07:00' : (outlet.time_zone == 'wita' ? '+08:00' : (outlet.time_zone == 'wit' ? '+09:00' : '+07:00'))"}
|
|
109
|
+
- {name: grace_min, type: int, label: {id: Toleransi terlambat (menit)}, hidden: true, read_only: true, compute: "outlet != '' && outlet.late_grace_min > 0 ? outlet.late_grace_min : 0"}
|
|
110
|
+
# The schedule of the day: the outlet's default hours (shifts, rangka-apps#120, will fill it per employee). Empty when
|
|
111
|
+
# the outlet has no hours: then no lateness or early leave is measured. A work_end before work_start ends the next day.
|
|
112
|
+
- name: sched_start
|
|
113
|
+
type: datetime
|
|
114
|
+
label: {id: Jadwal masuk}
|
|
115
|
+
read_only: true
|
|
116
|
+
compute: "outlet != '' && outlet.work_start != '' ? string(work_date) + 'T' + outlet.work_start + ':00' + utc_offset : ''"
|
|
117
|
+
- name: sched_end
|
|
118
|
+
type: datetime
|
|
119
|
+
label: {id: Jadwal pulang}
|
|
120
|
+
read_only: true
|
|
121
|
+
compute: >-
|
|
122
|
+
outlet == '' || outlet.work_end == '' ? ''
|
|
123
|
+
: ((outlet.work_start != '' && outlet.work_end <= outlet.work_start ? string(work_date + duration(1)) : string(work_date))
|
|
124
|
+
+ 'T' + outlet.work_end + ':00' + utc_offset)
|
|
125
|
+
# distance_m is 1e9 without a position (contract 0030 §4): "no position" counts as far.
|
|
126
|
+
- {name: in_m, type: float, label: {id: Jarak masuk dari titik (m)}, hidden: true, read_only: true, compute: "distance_m(in_pos, site_point)"}
|
|
127
|
+
- {name: in_located, type: check, label: {id: Lokasi masuk ada}, read_only: true, compute: "in_m < 100000000.0"}
|
|
128
|
+
- {name: in_inside, type: check, label: {id: Masuk di dalam radius}, read_only: true, compute: "in_located && in_m <= site_radius_m"}
|
|
129
|
+
# Text, empty without a position (GPS failed or refused): an int would show 0 m, which reads as "at the outlet".
|
|
130
|
+
- {name: in_site_m, type: data, label: {id: Jarak masuk dari outlet (m)}, read_only: true, compute: "in_located ? string(int(round(in_m))) : ''"}
|
|
131
|
+
- {name: out_m, type: float, label: {id: Jarak keluar dari titik (m)}, hidden: true, read_only: true, compute: "distance_m(out_pos, site_point)"}
|
|
132
|
+
- {name: out_located, type: check, label: {id: Lokasi keluar ada}, read_only: true, compute: "out_m < 100000000.0"}
|
|
133
|
+
- {name: out_inside, type: check, label: {id: Keluar di dalam radius}, read_only: true, compute: "out_located && out_m <= site_radius_m"}
|
|
134
|
+
- {name: out_site_m, type: data, label: {id: Jarak keluar dari outlet (m)}, read_only: true, compute: "out_located ? string(int(round(out_m))) : ''"}
|
|
135
|
+
- name: outside_site
|
|
136
|
+
type: check
|
|
137
|
+
label: {id: Di luar radius}
|
|
138
|
+
read_only: true
|
|
139
|
+
in_list: true
|
|
140
|
+
chip: true
|
|
141
|
+
compute: "!in_inside || (clock_out != '' && !out_inside)"
|
|
142
|
+
# Whole minutes after the scheduled start, less the outlet's grace (08:25 against 08:00 with 10 minutes grace = 15).
|
|
143
|
+
- name: late_min
|
|
144
|
+
type: int
|
|
145
|
+
label: {id: Terlambat (menit)}
|
|
146
|
+
read_only: true
|
|
147
|
+
in_list: true
|
|
148
|
+
compute: "clock_in == '' || sched_start == '' || (epoch(clock_in) - epoch(sched_start)) / 60 <= grace_min ? 0 : (epoch(clock_in) - epoch(sched_start)) / 60 - grace_min"
|
|
149
|
+
- name: early_min
|
|
150
|
+
type: int
|
|
151
|
+
label: {id: Pulang cepat (menit)}
|
|
152
|
+
read_only: true
|
|
153
|
+
compute: "clock_out == '' || sched_end == '' || epoch(clock_out) >= epoch(sched_end) ? 0 : (epoch(sched_end) - epoch(clock_out)) / 60"
|
|
154
|
+
- name: worked_min
|
|
155
|
+
type: int
|
|
156
|
+
label: {id: Lama kerja (menit)}
|
|
157
|
+
read_only: true
|
|
158
|
+
compute: "clock_in == '' || clock_out == '' || epoch(clock_out) <= epoch(clock_in) ? 0 : (epoch(clock_out) - epoch(clock_in)) / 60"
|
|
159
|
+
# One live log per employee per day (flows staff_attendance_guard_*: a cancelled one frees the day).
|
|
160
|
+
- name: day_key
|
|
161
|
+
type: data
|
|
162
|
+
label: {id: Kunci hari}
|
|
163
|
+
hidden: true
|
|
164
|
+
read_only: true
|
|
165
|
+
compute: "employee + ':' + string(work_date)"
|
|
166
|
+
rules:
|
|
167
|
+
- name: source_allowed
|
|
168
|
+
on: save
|
|
169
|
+
check: "source == 'phone' || (source == 'manual' && ('head_office' in user.roles || 'owner' in user.roles))"
|
|
170
|
+
message: {id: 'Absen manual hanya dibuat kantor pusat'}
|
|
171
|
+
- name: employee_self
|
|
172
|
+
on: save
|
|
173
|
+
check: "employee == user.name || 'head_office' in user.roles || 'owner' in user.roles"
|
|
174
|
+
message: {id: 'Kamu hanya bisa absen untuk diri sendiri'}
|
|
175
|
+
- name: own_outlet
|
|
176
|
+
on: save
|
|
177
|
+
check: "outlet in user.outlets || 'head_office' in user.roles || 'owner' in user.roles"
|
|
178
|
+
message: {id: 'Kamu hanya bisa absen di outlet tempatmu bekerja. Kalau outletnya belum ada, minta kantor pusat menambahkannya di Tim'}
|
|
179
|
+
- name: not_future
|
|
180
|
+
on: save
|
|
181
|
+
check: work_date <= today()
|
|
182
|
+
message: {id: 'Tidak bisa absen untuk tanggal yang belum datang'}
|
|
183
|
+
# The clock-in falls on the work date at the outlet's local time (a UTC or a local clock-in string alike).
|
|
184
|
+
- name: clock_in_on_work_date
|
|
185
|
+
on: save
|
|
186
|
+
check: >-
|
|
187
|
+
clock_in == '' || (epoch(clock_in) >= epoch(string(work_date) + 'T00:00:00' + utc_offset)
|
|
188
|
+
&& epoch(clock_in) < epoch(string(work_date) + 'T00:00:00' + utc_offset) + 86400)
|
|
189
|
+
message: {id: 'Jam masuk harus di tanggal absen'}
|
|
190
|
+
- name: out_after_in
|
|
191
|
+
on: save
|
|
192
|
+
check: clock_out == '' || (clock_in != '' && epoch(clock_out) > epoch(clock_in))
|
|
193
|
+
message: {id: 'Jam keluar harus sesudah jam masuk. Kalau tadi salah tekan masuk, minta kantor pusat membatalkan absennya.'}
|
|
194
|
+
- name: overtime_range
|
|
195
|
+
on: save
|
|
196
|
+
check: overtime_hours >= 0 && overtime_hours <= 12
|
|
197
|
+
message: {id: 'Jam lembur 0 sampai 12 jam per hari'}
|
|
198
|
+
# Asked at clock-in, when the clock screen shows the reason box (outside or no position).
|
|
199
|
+
- name: reason_when_outside
|
|
200
|
+
on: save
|
|
201
|
+
check: "in_inside || size(reason) >= 5"
|
|
202
|
+
message: {id: 'Kamu di luar radius outlet (atau lokasi tidak terbaca): tulis alasannya'}
|
|
203
|
+
- name: reason_when_overtime
|
|
204
|
+
on: save
|
|
205
|
+
check: overtime_hours == 0 || size(reason) >= 5
|
|
206
|
+
message: {id: 'Tulis alasan atau pekerjaan lemburnya'}
|
|
207
|
+
- name: out_photo_own
|
|
208
|
+
on: save
|
|
209
|
+
check: out_photo == '' || out_photo != in_photo
|
|
210
|
+
message: {id: 'Foto keluar harus foto baru, bukan foto masuk'}
|
|
211
|
+
- name: clocked_in
|
|
212
|
+
on: submit
|
|
213
|
+
check: clock_in != ''
|
|
214
|
+
message: {id: 'Isi jam masuk dulu (absen masuk) sebelum diajukan'}
|
|
215
|
+
- name: clocked_out
|
|
216
|
+
on: submit
|
|
217
|
+
check: clock_out != ''
|
|
218
|
+
message: {id: 'Isi jam keluar dulu (absen pulang) sebelum diajukan'}
|
|
219
|
+
- name: photo_required
|
|
220
|
+
on: submit
|
|
221
|
+
check: in_photo != '' || source == 'manual'
|
|
222
|
+
message: {id: 'Absen butuh foto masuk'}
|
|
223
|
+
# Held for the outlet supervisor or head office (contract 0007); the owner may always approve. The verb then runs as the
|
|
224
|
+
# employee who asked.
|
|
225
|
+
approvals:
|
|
226
|
+
# An outlet supervisor's own log goes to head office, never to themselves or a fellow supervisor (audit 2026-11-19 F2).
|
|
227
|
+
# Head office and the owner are approvers of their own logs (contract 0007): their corrections count at once.
|
|
228
|
+
- name: outside_site
|
|
229
|
+
on: submit
|
|
230
|
+
when: "outside_site && !('outlet_supervisor' in user.roles)"
|
|
231
|
+
approvers: [outlet_supervisor, head_office]
|
|
232
|
+
label: {id: Absen di luar radius outlet, en: Clock-in outside the outlet radius}
|
|
233
|
+
- name: late_entry
|
|
234
|
+
on: submit
|
|
235
|
+
when: "days_between(work_date, today()) > 1 && !('outlet_supervisor' in user.roles)"
|
|
236
|
+
approvers: [outlet_supervisor, head_office]
|
|
237
|
+
label: {id: Absen diisi lebih dari sehari kemudian, en: Attendance entered more than a day late}
|
|
238
|
+
- name: overtime
|
|
239
|
+
on: submit
|
|
240
|
+
when: "overtime_hours > 0 && !('outlet_supervisor' in user.roles)"
|
|
241
|
+
approvers: [outlet_supervisor, head_office]
|
|
242
|
+
label: {id: Lembur, en: Overtime}
|
|
243
|
+
- name: supervisor_outside_site
|
|
244
|
+
on: submit
|
|
245
|
+
when: "outside_site && 'outlet_supervisor' in user.roles"
|
|
246
|
+
approvers: [head_office]
|
|
247
|
+
label: {id: Absen kepala outlet di luar radius, en: Outlet supervisor clock-in outside the radius}
|
|
248
|
+
- name: supervisor_late_entry
|
|
249
|
+
on: submit
|
|
250
|
+
when: "days_between(work_date, today()) > 1 && 'outlet_supervisor' in user.roles"
|
|
251
|
+
approvers: [head_office]
|
|
252
|
+
label: {id: Absen kepala outlet diisi terlambat, en: Outlet supervisor attendance entered late}
|
|
253
|
+
- name: supervisor_overtime
|
|
254
|
+
on: submit
|
|
255
|
+
when: "overtime_hours > 0 && 'outlet_supervisor' in user.roles"
|
|
256
|
+
approvers: [head_office]
|
|
257
|
+
label: {id: Lembur kepala outlet, en: Outlet supervisor overtime}
|
|
258
|
+
views:
|
|
259
|
+
list:
|
|
260
|
+
columns: [name, employee_name, outlet, work_date, clock_in, clock_out, late_min, outside_site, status]
|
|
261
|
+
sort: -work_date
|
|
262
|
+
form:
|
|
263
|
+
layout:
|
|
264
|
+
- section: {id: Absen}
|
|
265
|
+
columns:
|
|
266
|
+
- [employee, outlet, work_date]
|
|
267
|
+
- [source, overtime_hours, outside_site]
|
|
268
|
+
- section: {id: Masuk}
|
|
269
|
+
columns:
|
|
270
|
+
- [clock_in, in_photo]
|
|
271
|
+
- [in_pos, in_site_m, in_inside]
|
|
272
|
+
- section: {id: Keluar}
|
|
273
|
+
columns:
|
|
274
|
+
- [clock_out, out_photo]
|
|
275
|
+
- [out_pos, out_site_m, out_inside]
|
|
276
|
+
- section: {id: Jadwal}
|
|
277
|
+
columns:
|
|
278
|
+
- [sched_start, late_min]
|
|
279
|
+
- [sched_end, early_min, worked_min]
|
|
280
|
+
- section: {id: Alasan}
|
|
281
|
+
fields: [reason]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: staff_attendance_guard
|
|
3
|
+
label: {id: Penjaga absen karyawan, en: Staff attendance guard}
|
|
4
|
+
icon: check
|
|
5
|
+
naming: SAG-{######}
|
|
6
|
+
title_field: reason
|
|
7
|
+
# Never stored (the pattern of projects/models/attendance_guard.rk): a flow that must refuse the action it runs in
|
|
8
|
+
# creates one, and the rule of its reason fails with that message, which rolls the whole action back. Create is granted
|
|
9
|
+
# to every role whose saves, submits and cancels run those flows (an approved submit runs as the employee who asked).
|
|
10
|
+
permissions:
|
|
11
|
+
- {role: cashier, create: true}
|
|
12
|
+
- {role: outlet_staff, create: true}
|
|
13
|
+
- {role: employee, create: true}
|
|
14
|
+
- {role: outlet_supervisor, create: true}
|
|
15
|
+
- {role: head_office, create: true}
|
|
16
|
+
fields:
|
|
17
|
+
- name: reason
|
|
18
|
+
type: select
|
|
19
|
+
label: {id: Alasan}
|
|
20
|
+
required: true
|
|
21
|
+
options:
|
|
22
|
+
- {value: second_log, label: {id: Absen kedua di hari yang sama}}
|
|
23
|
+
- {value: period_closed, label: {id: Periode absen sudah direkap}}
|
|
24
|
+
- {value: period_overlap, label: {id: Periode rekap tumpang tindih}}
|
|
25
|
+
- {value: photo_reused, label: {id: Foto absen dipakai ulang}}
|
|
26
|
+
- {value: period_summarised, label: {id: Rekap absen sudah diringkas}}
|
|
27
|
+
- name: document
|
|
28
|
+
type: data
|
|
29
|
+
label: {id: Dokumen}
|
|
30
|
+
rules:
|
|
31
|
+
- name: second_log
|
|
32
|
+
on: save
|
|
33
|
+
check: reason != 'second_log'
|
|
34
|
+
message: {id: 'Karyawan ini sudah punya absen di tanggal itu (satu absen per orang per hari)'}
|
|
35
|
+
- name: period_closed
|
|
36
|
+
on: save
|
|
37
|
+
check: reason != 'period_closed'
|
|
38
|
+
message: {id: 'Absen tanggal ini sudah masuk rekap absen karyawan yang diajukan; batalkan rekapnya dulu'}
|
|
39
|
+
- name: period_overlap
|
|
40
|
+
on: save
|
|
41
|
+
check: reason != 'period_overlap'
|
|
42
|
+
message: {id: 'Sudah ada rekap absen karyawan yang tanggal dan outletnya tumpang tindih'}
|
|
43
|
+
- name: photo_reused
|
|
44
|
+
on: save
|
|
45
|
+
check: reason != 'photo_reused'
|
|
46
|
+
message: {id: 'Foto ini sudah dipakai absen lain; ambil foto baru untuk absen hari ini'}
|
|
47
|
+
- name: period_summarised
|
|
48
|
+
on: save
|
|
49
|
+
check: reason != 'period_summarised'
|
|
50
|
+
message: {id: 'Rekap absen ini sudah punya ringkasan; batalkan rekapnya dulu kalau mau mengulang'}
|