@rangka-os/create 0.5.0-alpha.13 → 0.5.0-alpha.15
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/jasa_proyek/app.rk +4 -0
- package/template/base/apps/jasa_proyek/dashboards/rekap_absen.rk +1 -1
- package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +17 -1
- package/template/base/apps/kelas_kursus/app.rk +3 -0
- package/template/base/apps/langganan_jasa/app.rk +5 -1
- package/template/base/apps/sewa_alat/app.rk +6 -1
- package/template/base/connectors/moka/connector.rk +6 -5
- package/template/base/modules/catalogue/models/item.rk +9 -0
- package/template/base/modules/contacts/models/customer.rk +10 -1
- package/template/base/modules/contacts/models/vendor.rk +10 -1
- package/template/base/modules/courses/flows/session_attendance_checked.rk +14 -0
- package/template/base/modules/courses/flows/session_of_the_day.rk +34 -0
- package/template/base/modules/courses/models/course_attendance.rk +2 -0
- package/template/base/modules/courses/models/course_session.rk +1 -0
- package/template/base/modules/courses/module.rk +1 -1
- package/template/base/modules/courses/screens/absen_kelas.rk +17 -0
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +26 -8
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_update.rk +5 -1
- package/template/base/modules/kitchen/flows/kitchen_ticket_on_void.rk +9 -1
- package/template/base/modules/kitchen/models/kitchen_guard.rk +5 -0
- package/template/base/modules/kitchen/models/kitchen_ticket.rk +5 -0
- package/template/base/modules/outlet_sales/flows/moka_api_opened.rk +30 -0
- package/template/base/modules/outlet_sales/flows/moka_daily_sales.rk +39 -18
- package/template/base/modules/outlet_sales/flows/moka_held_release.rk +35 -0
- package/template/base/modules/outlet_sales/flows/moka_line_mapped.rk +26 -2
- package/template/base/modules/outlet_sales/flows/moka_transaction_refused.rk +15 -0
- package/template/base/modules/outlet_sales/flows/moka_transaction_staged.rk +108 -27
- package/template/base/modules/outlet_sales/models/moka_sale_line.rk +15 -2
- package/template/base/modules/outlets/models/outlet.rk +13 -1
- package/template/base/modules/payroll/flows/payslip_advance_guard.rk +3 -0
- package/template/base/modules/payroll/flows/payslip_from_recap.rk +30 -1
- package/template/base/modules/payroll/flows/payslip_ytd_guard.rk +18 -1
- package/template/base/modules/payroll/flows/payslip_ytd_on_create.rk +28 -1
- package/template/base/modules/payroll/models/payslip.rk +19 -1
- package/template/base/modules/pos/models/pos_sale.rk +2 -1
- package/template/base/modules/pos/models/pos_sale_item.rk +3 -0
- package/template/base/modules/pos/screens/kasir.rk +1 -1
- package/template/base/modules/projects/flows/attendance_close_on_submit.rk +6 -2
- package/template/base/modules/projects/flows/attendance_log_guard_created.rk +3 -1
- package/template/base/modules/projects/flows/attendance_log_guard_submitted.rk +8 -4
- package/template/base/modules/projects/flows/attendance_log_guard_updated.rk +2 -1
- package/template/base/modules/projects/models/assignment.rk +3 -0
- package/template/base/modules/projects/models/attendance_close.rk +4 -0
- package/template/base/modules/projects/models/attendance_guard.rk +1 -1
- package/template/base/modules/projects/models/attendance_log.rk +63 -66
- package/template/base/modules/projects/models/work_site.rk +2 -1
- package/template/base/modules/projects/module.rk +1 -1
- package/template/base/modules/projects/roles/field_worker.rk +2 -0
- package/template/base/modules/projects/screens/absen.rk +21 -0
- package/template/base/modules/rental/flows/rental_return_on_cancel.rk +5 -3
- package/template/base/modules/rental/models/rental_checkout.rk +10 -15
- package/template/base/modules/rental/models/rental_return.rk +3 -11
- package/template/base/modules/rental/models/rental_schedule.rk +8 -0
- package/template/base/modules/rental/models/rental_unit.rk +7 -0
- package/template/base/modules/rental/module.rk +1 -1
- package/template/base/modules/rental/screens/alat_keluar.rk +19 -0
- package/template/base/modules/rental/screens/alat_kembali.rk +19 -0
- package/template/base/modules/rental/screens/jadwal_alat.rk +21 -0
- package/template/base/modules/subscriptions/models/collection_visit.rk +47 -0
- package/template/base/modules/subscriptions/models/subscription.rk +3 -1
- package/template/base/modules/subscriptions/module.rk +1 -1
- package/template/base/modules/subscriptions/screens/catat_tagih.rk +18 -0
- package/template/base/modules/subscriptions/screens/rute_tagih.rk +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rangka-os/create",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.15",
|
|
4
4
|
"description": "Start a Rangka OS project: npm create @rangka-os@latest my-shop",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"homepage": "https://rangka-os.github.io/rangka-os/guide/quick-start",
|
|
@@ -30,6 +30,10 @@ dashboards: [jasa_overview, ar_aging, project_margin, absen_saya, rekap_absen]
|
|
|
30
30
|
# field_worker and site_supervisor (field attendance, A2) have their role files in the projects module.
|
|
31
31
|
roles: [sales_manager, finance_manager, purchasing_manager, project_admin, field_worker, site_supervisor]
|
|
32
32
|
home: {dashboard: jasa_overview}
|
|
33
|
+
# Work screens (contract 0030 §3): the field worker lands on the clock; the site supervisor keeps the rekap_absen
|
|
34
|
+
# dashboard as home (first dashboard of their role) and decides held logs in Persetujuan.
|
|
35
|
+
work:
|
|
36
|
+
- {screen: absen, roles: [field_worker], home: true}
|
|
33
37
|
menu:
|
|
34
38
|
- group: {id: Penjualan}
|
|
35
39
|
items: [quotation, customer_order, sales_invoice]
|
|
@@ -12,7 +12,7 @@ widgets:
|
|
|
12
12
|
- {name: outside_today, type: number, label: {id: Di luar radius hari ini}, model: attendance_log, filter: work_date == today() && docstatus != 2 && outside_site, compact: true, span: 3, good_when: down}
|
|
13
13
|
- {name: waiting, type: number, label: {id: Menunggu persetujuan}, description: {id: 'Sudah absen pulang tapi belum sah'}, model: attendance_log, filter: docstatus == 0 && clock_out != '', compact: true, span: 3, good_when: down}
|
|
14
14
|
- {name: days_present, type: number, label: {id: Hari hadir sah}, model: attendance_log, filter: docstatus == 1, period: work_date, compact: true, span: 3}
|
|
15
|
-
- {name: waiting_list, type: list, label: {id: Absen yang menunggu}, model: attendance_log, filter: docstatus == 0 && clock_out != '', columns: [
|
|
15
|
+
- {name: waiting_list, type: list, label: {id: Absen yang menunggu}, model: attendance_log, filter: docstatus == 0 && clock_out != '', columns: [worker_name, work_date, in_site_m, out_site_m, overtime_hours, reason], sort: work_date, limit: 20, span: 12}
|
|
16
16
|
- {name: by_worker, type: chart, chart: bar, label: {id: Hari hadir per pekerja}, model: attendance_log, group_by: worker_name, filter: docstatus == 1, period: work_date, sort: -value, span: 6}
|
|
17
17
|
- {name: by_site, type: chart, chart: bar, label: {id: Hari hadir per lokasi}, model: attendance_log, group_by: work_site, filter: docstatus == 1, period: work_date, sort: -value, span: 6}
|
|
18
18
|
- {name: today_list, type: list, label: {id: Absen hari ini}, model: attendance_log, filter: work_date == today() && docstatus != 2, columns: [worker_name, work_site, clock_in, clock_out, in_site_m, status], sort: clock_in, limit: 50, span: 12}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rangka-app-kasir
|
|
3
|
-
description: "Rangka Kasir (app kasir): the browser cashier for shops and F&B outlets, with shifts per outlet, numbered receipts, cash and QRIS, stock and recipes taken out automatically. Use when an owner asks for a cashier or POS (\"mau pakai kasir\", \"tambahin POS\", \"jualan langsung di outlet\"), to explain what it shares with apps they already run,
|
|
3
|
+
description: "Rangka Kasir (app kasir): the browser cashier for shops and F&B outlets, with shifts per outlet, numbered receipts, cash and QRIS, stock and recipes taken out automatically. Use when an owner asks for a cashier or POS (\"mau pakai kasir\", \"tambahin POS\", \"jualan langsung di outlet\"), to explain what it shares with apps they already run, for what to set up after it is added, and in the studio interview to decide whether a counter business gets the cashier on its map."
|
|
4
4
|
metadata: {rangka: {version: 1.0.0, app: kasir, requires: [rangka-compose, rangka-changesets]}}
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -30,6 +30,22 @@ specific to the cashier.
|
|
|
30
30
|
- **Not GoFood, GrabFood or ShopeeFood.** Orders from those apps are not rung up here; see `rangka-compose`, "When
|
|
31
31
|
nothing fits".
|
|
32
32
|
|
|
33
|
+
## In the studio interview: when the cashier goes on the map
|
|
34
|
+
|
|
35
|
+
For Raka's consultant interview (`rangka-consult`, contract 0042). The deciding fact is the tools the owner uses
|
|
36
|
+
today and whether Juragan replaces them:
|
|
37
|
+
|
|
38
|
+
- A business that serves buyers at a counter (kedai, kafe, restoran, toko) and has **no cashier app yet**, or chose
|
|
39
|
+
**ganti penuh**, gets a piece `{kind: catalogue, ref: kasir}` at the payment stage. Tell the owner the cashier
|
|
40
|
+
screen runs on a tablet or a phone:
|
|
41
|
+
|
|
42
|
+
> Untuk meja kasir aku pasang Kasir. Layarnya jalan di tablet atau HP, jadi tidak perlu mesin kasir khusus.
|
|
43
|
+
|
|
44
|
+
- If the owner keeps their current cashier (**pendamping**, for example Moka or another POS), do not place kasir. Their
|
|
45
|
+
sales come in through the imports from the cashier they already use (check which imports exist with
|
|
46
|
+
`rangka_catalogue` / `rangka_meta` before naming one).
|
|
47
|
+
- If you do not know yet, ask what they use at the counter today before placing anything.
|
|
48
|
+
|
|
33
49
|
## Explaining it to an owner who already runs an app
|
|
34
50
|
|
|
35
51
|
Use the catalogue's `shares` and `adds` for `kasir`. On a site running Rangka F&B Cabang it shares items, outlets,
|
|
@@ -20,6 +20,9 @@ modules:
|
|
|
20
20
|
dashboards: [kursus_ringkas, kelas_saya]
|
|
21
21
|
roles: [course_admin, instructor, finance_manager]
|
|
22
22
|
home: {dashboard: kursus_ringkas}
|
|
23
|
+
# The instructor lands on the class roll (contract 0030 roll); Kelas saya stays their dashboard.
|
|
24
|
+
work:
|
|
25
|
+
- {screen: absen_kelas, roles: [instructor], home: true}
|
|
23
26
|
menu:
|
|
24
27
|
- group: {id: Kelas}
|
|
25
28
|
items: [course_batch, course_session, enrollment]
|
|
@@ -23,10 +23,14 @@ modules:
|
|
|
23
23
|
dashboards: [langganan_ringkas, penagihan_saya]
|
|
24
24
|
roles: [finance_manager, collector]
|
|
25
25
|
home: {dashboard: langganan_ringkas}
|
|
26
|
+
# The collector lands on the route of the day (contract 0030 route); Penagihan saya stays their dashboard.
|
|
27
|
+
work:
|
|
28
|
+
- {screen: rute_tagih, roles: [collector], home: true}
|
|
29
|
+
- {screen: catat_tagih, roles: [collector]}
|
|
26
30
|
menu:
|
|
27
31
|
- group: {id: Langganan}
|
|
28
32
|
items: [subscription, subscription_bill, subscription_extra, subscription_status_log]
|
|
29
33
|
- group: {id: Penagihan lapangan}
|
|
30
|
-
items: [field_collection, collector_deposit, service_area]
|
|
34
|
+
items: [field_collection, collection_visit, collector_deposit, service_area]
|
|
31
35
|
- group: {id: Pengaturan langganan}
|
|
32
36
|
items: [subscription_plan, subscription_month]
|
|
@@ -11,7 +11,7 @@ rangka: '>=0.5'
|
|
|
11
11
|
# A piece (riset/desain/11-susunan-kepingan.md) for rental businesses (kamera, alat pesta, alat outdoor). The rent
|
|
12
12
|
# invoices it drafts are collected through faktur_piutang (payments); the deposit journals need pembukuan. Staf gudang
|
|
13
13
|
# (rental_staff) records equipment out and back per unit with a checklist and prints the BAST; their dashboard is
|
|
14
|
-
# alat_hari_ini
|
|
14
|
+
# alat_hari_ini; their home is the work screen jadwal_alat (contract 0030), which opens the handover screens.
|
|
15
15
|
modules:
|
|
16
16
|
users: ^1.0
|
|
17
17
|
contacts: ^1.0
|
|
@@ -21,6 +21,11 @@ modules:
|
|
|
21
21
|
dashboards: [sewa_ringkas, alat_hari_ini]
|
|
22
22
|
roles: [sales_manager, finance_manager, head_office, rental_staff]
|
|
23
23
|
home: {dashboard: sewa_ringkas}
|
|
24
|
+
work:
|
|
25
|
+
- {screen: jadwal_alat, roles: [rental_staff], home: true}
|
|
26
|
+
- {screen: jadwal_alat, roles: [sales_manager]}
|
|
27
|
+
- {screen: alat_keluar}
|
|
28
|
+
- {screen: alat_kembali}
|
|
24
29
|
menu:
|
|
25
30
|
- group: {id: Sewa alat}
|
|
26
31
|
items: [rental_booking, rental_checkout, rental_return, rental_schedule]
|
|
@@ -46,11 +46,11 @@ triggers:
|
|
|
46
46
|
# what is emitted, kept 30 days); a refunded one emits a new event (payment_refunds, refunded_quantity), and flow
|
|
47
47
|
# moka_transaction_staged (rangka-apps) books only the quantity refunded since, per checkout uuid.
|
|
48
48
|
# - A sale synced late from offline mode comes in with its sync time, inside the window.
|
|
49
|
-
# -
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
49
|
+
# - Pages: next: next makes the kernel follow Moka's next_url (on api.mokapos.com only) until it is null (rangka-os
|
|
50
|
+
# contract 0002, refinement 11 Nov 2026; at most 50 pages of 100 per outlet and poll), so the whole window is read
|
|
51
|
+
# and nothing in it is lost. A refund made more than two days after the sale is outside the window (head office
|
|
52
|
+
# books it, or the export). An outlet moves from the export file to the API on the day head office sets its
|
|
53
|
+
# moka_api_from (rangka-apps outlet; until then its API transactions are kept without lines).
|
|
54
54
|
# To confirm once Moka grants API access: synchronized_at for offline sales, the largest per_page, the offset of
|
|
55
55
|
# created_at (flows take the day from its first 10 characters, a Z time as WIB).
|
|
56
56
|
- name: transaction_created
|
|
@@ -64,6 +64,7 @@ triggers:
|
|
|
64
64
|
since: "(days_between('1970-01-01', today()) - 2) * 86400"
|
|
65
65
|
time_filter: "'synchronized_at'"
|
|
66
66
|
reorder_type: "'DESC'"
|
|
67
|
+
next: next
|
|
67
68
|
for_each: payments[]
|
|
68
69
|
emit:
|
|
69
70
|
transaction_id: item.id
|
|
@@ -122,6 +122,15 @@ fields:
|
|
|
122
122
|
label: {id: Kode barang/jasa Coretax}
|
|
123
123
|
help: {id: '6 angka dari referensi kode barang/jasa Coretax. Kosongkan bila tidak tahu (000000)'}
|
|
124
124
|
depends_on: app_installed('coretax')
|
|
125
|
+
# Records already linked by documents cannot be deleted (kernel: 409 linked); one no longer used is switched off
|
|
126
|
+
# instead and kept for its history. Hiding it from link pickers is a kernel follow-up (web).
|
|
127
|
+
- name: active
|
|
128
|
+
type: check
|
|
129
|
+
label: {id: Aktif}
|
|
130
|
+
help: {id: 'Matikan bila barang tidak dijual atau dibeli lagi. Barang yang sudah dipakai transaksi tidak bisa dihapus'}
|
|
131
|
+
default: 'true'
|
|
132
|
+
in_list: true
|
|
133
|
+
in_filter: true
|
|
125
134
|
rules:
|
|
126
135
|
- name: coretax_code_6
|
|
127
136
|
on: save
|
|
@@ -140,6 +140,15 @@ fields:
|
|
|
140
140
|
type: table
|
|
141
141
|
of: contact_person
|
|
142
142
|
label: {id: Kontak person}
|
|
143
|
+
# Records already linked by documents cannot be deleted (kernel: 409 linked); one no longer used is switched off
|
|
144
|
+
# instead and kept for its history. Hiding it from link pickers is a kernel follow-up (web).
|
|
145
|
+
- name: active
|
|
146
|
+
type: check
|
|
147
|
+
label: {id: Aktif}
|
|
148
|
+
help: {id: 'Matikan bila pelanggan tidak aktif lagi. Pelanggan yang sudah punya transaksi tidak bisa dihapus'}
|
|
149
|
+
default: 'true'
|
|
150
|
+
in_list: true
|
|
151
|
+
in_filter: true
|
|
143
152
|
rules:
|
|
144
153
|
- name: npwp_16
|
|
145
154
|
on: save
|
|
@@ -162,7 +171,7 @@ views:
|
|
|
162
171
|
layout:
|
|
163
172
|
- section: {id: Identitas}
|
|
164
173
|
columns:
|
|
165
|
-
- [customer_name, city, address]
|
|
174
|
+
- [customer_name, city, address, active]
|
|
166
175
|
- [npwp, phone, email]
|
|
167
176
|
- section: {id: Data pajak (e-Faktur)}
|
|
168
177
|
columns:
|
|
@@ -68,6 +68,15 @@ fields:
|
|
|
68
68
|
type: table
|
|
69
69
|
of: contact_person
|
|
70
70
|
label: {id: Kontak person}
|
|
71
|
+
# Records already linked by documents cannot be deleted (kernel: 409 linked); one no longer used is switched off
|
|
72
|
+
# instead and kept for its history. Hiding it from link pickers is a kernel follow-up (web).
|
|
73
|
+
- name: active
|
|
74
|
+
type: check
|
|
75
|
+
label: {id: Aktif}
|
|
76
|
+
help: {id: 'Matikan bila pemasok tidak dipakai lagi. Pemasok yang sudah punya transaksi tidak bisa dihapus'}
|
|
77
|
+
default: 'true'
|
|
78
|
+
in_list: true
|
|
79
|
+
in_filter: true
|
|
71
80
|
rules:
|
|
72
81
|
- name: npwp_16
|
|
73
82
|
on: save
|
|
@@ -90,7 +99,7 @@ views:
|
|
|
90
99
|
layout:
|
|
91
100
|
- section: {id: Identitas}
|
|
92
101
|
columns:
|
|
93
|
-
- [vendor_name, city, address]
|
|
102
|
+
- [vendor_name, city, address, active]
|
|
94
103
|
- [npwp, phone, email]
|
|
95
104
|
- section: {id: Data pajak (bukti potong)}
|
|
96
105
|
columns:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: session_attendance_checked
|
|
3
|
+
label: {id: Absen pertemuan dicek saat pengajar menyimpannya}
|
|
4
|
+
# The instructor's roll screen (screens/absen_kelas.rk) saves the attendance lines and nothing else (contract 0030 §2
|
|
5
|
+
# roll; course_session is not submittable). Saving them is the check: an instructor's save of a session on or before
|
|
6
|
+
# its day ticks attendance_taken, so the meeting leaves "Absen belum dicek" (dashboard kelas_saya). A save that
|
|
7
|
+
# unticks it (before ticked) is left as the instructor wrote it; the course admin's saves tick nothing.
|
|
8
|
+
on: course_session.updated
|
|
9
|
+
if: "event.before != null && !event.before.attendance_taken && !event.attendance_taken && size(event.attendance) > 0 && event.session_date <= today() && 'instructor' in user.roles"
|
|
10
|
+
steps:
|
|
11
|
+
- {find: course_session, where: name == event.name, as: me}
|
|
12
|
+
- update: me
|
|
13
|
+
set:
|
|
14
|
+
attendance_taken: 'true'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: session_of_the_day
|
|
3
|
+
label: {id: Pertemuan hari ini dibuka dari jadwal mingguan}
|
|
4
|
+
# Every day at 00:10 (scheduler.timezone), and by the owner from the flow list: each running batch with a class on
|
|
5
|
+
# today's weekday (class_days, the same test as dashboard kelas_saya) and no session dated today gets one, numbered
|
|
6
|
+
# after its last session, with one attendance line per registered or active student marked present. So the
|
|
7
|
+
# instructor's roll screen (screens/absen_kelas.rk) has today's class ready and only the exceptions are marked.
|
|
8
|
+
# A flow-made record runs no other flow, so the lines are filled here as session_fill_attendance does for a session
|
|
9
|
+
# made by hand. session_key (batch|session_no) is unique: a second run the same day makes nothing new.
|
|
10
|
+
# At most 200 batches per run.
|
|
11
|
+
schedule: '10 0 * * *'
|
|
12
|
+
steps:
|
|
13
|
+
- find_all: course_batch
|
|
14
|
+
where: "start_date <= today() && (end_date == '' || end_date >= today()) && class_days.contains(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'][days_between('2024-01-01', today()) % 7])"
|
|
15
|
+
sort: name
|
|
16
|
+
limit: 200
|
|
17
|
+
as: batches
|
|
18
|
+
- for_each: batches
|
|
19
|
+
as: b
|
|
20
|
+
do:
|
|
21
|
+
- find_all: course_session
|
|
22
|
+
where: batch == b.name
|
|
23
|
+
as: past
|
|
24
|
+
- find_all: enrollment
|
|
25
|
+
where: batch == b.name && (status == 'registered' || status == 'active')
|
|
26
|
+
sort: student
|
|
27
|
+
as: list
|
|
28
|
+
- create: course_session
|
|
29
|
+
if: "past.map(x, x.session_date == today() ? 1 : 0).sum() == 0"
|
|
30
|
+
set:
|
|
31
|
+
batch: b.name
|
|
32
|
+
session_no: "past.size() == 0 ? 1 : max(past.map(x, x.session_no)) + 1"
|
|
33
|
+
session_date: today()
|
|
34
|
+
attendance: "list.map(e, {'enrollment': e.name, 'status': 'present'})"
|
|
@@ -9,6 +9,8 @@ fields:
|
|
|
9
9
|
required: true
|
|
10
10
|
- {name: student, type: link, to: student, label: {id: Peserta}, compute: enrollment.student}
|
|
11
11
|
- {name: batch, type: link, to: course_batch, label: {id: Angkatan}, compute: enrollment.batch}
|
|
12
|
+
# the name the roll screen shows on each line (screens/absen_kelas.rk)
|
|
13
|
+
- {name: student_name, type: data, label: {id: Nama peserta}, compute: enrollment.student.student_name}
|
|
12
14
|
- name: status
|
|
13
15
|
type: select
|
|
14
16
|
label: {id: Kehadiran}
|
|
@@ -18,6 +18,7 @@ fields:
|
|
|
18
18
|
required: true
|
|
19
19
|
in_list: true
|
|
20
20
|
- {name: instructor, type: link, to: user, label: {id: Akun pengajar}, compute: batch.instructor}
|
|
21
|
+
- {name: batch_title, type: data, label: {id: Nama angkatan}, compute: batch.batch_name}
|
|
21
22
|
- name: session_no
|
|
22
23
|
type: int
|
|
23
24
|
label: {id: Pertemuan ke}
|
|
@@ -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: courses
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.2.0
|
|
4
4
|
title: {id: Kursus dan pelatihan, en: Courses and training}
|
|
5
5
|
summary:
|
|
6
6
|
id: Program kursus, angkatan, peserta, pendaftaran, jadwal pertemuan dan tagihannya.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
|
|
2
|
+
name: absen_kelas
|
|
3
|
+
type: roll
|
|
4
|
+
label: {id: Absen kelas, en: Class roll}
|
|
5
|
+
icon: users
|
|
6
|
+
# The instructor marks today's class from the phone (plans/layar-kerja.md §3 #5, contract 0030 §2 roll): every
|
|
7
|
+
# student starts present (flow session_of_the_day or session_fill_attendance), the instructor marks only who is
|
|
8
|
+
# excused, sick or absent, and saves; saving ticks "Absen sudah dicek" (flow session_attendance_checked). The
|
|
9
|
+
# meetings offered are the instructor's own (row scope) up to today whose attendance is not checked yet, newest
|
|
10
|
+
# first; one opens by itself. No submit: course_session is not a submittable document.
|
|
11
|
+
roles: [instructor]
|
|
12
|
+
device: phone
|
|
13
|
+
offline: queue
|
|
14
|
+
roll:
|
|
15
|
+
document: {model: course_session, find: "session_date <= today() && !attendance_taken", sort: "-session_date", title: batch_title, subtitle: session_date}
|
|
16
|
+
rows: {table: attendance, label: student_name, mark: {field: status, values: [present, excused, sick, absent], default: present}, note: note}
|
|
17
|
+
submit: false
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
2
|
# Runs inside a receipt's payment (pos_sale submitted), as the cashier: one ticket per active station of the outlet
|
|
3
|
-
# with the receipt's lines whose item category is routed to that station
|
|
4
|
-
# (a shop) and a receipt without kitchen lines make nothing. A
|
|
5
|
-
#
|
|
3
|
+
# with the receipt's lines whose item category (pos_sale_item.category, kept on the line) is routed to that station
|
|
4
|
+
# (kitchen_route). An outlet without stations (a shop) and a receipt without kitchen lines make nothing. A failure here
|
|
5
|
+
# rolls the payment back, so a paid receipt never misses its tickets.
|
|
6
|
+
# A receipt paid again after a void (amend) is a revision: what the voided receipt's picked-up tickets of that station
|
|
7
|
+
# already sent out is not cooked again. The served quantity of an item is spread over the revision's lines of that item
|
|
8
|
+
# in their order (line idx), so two lines of one item never both count the same served portion. The rest goes to the kitchen as Baru, and the part already served is kept as a
|
|
9
|
+
# ticket that is Diambil from the start, so a later revision knows it too.
|
|
6
10
|
name: kitchen_ticket_on_sale
|
|
7
11
|
label: {id: 'Struk dibayar: kirim tiket ke stasiun dapur'}
|
|
8
12
|
on: pos_sale.submitted
|
|
@@ -11,13 +15,15 @@ steps:
|
|
|
11
15
|
- if: stations.size() > 0
|
|
12
16
|
then:
|
|
13
17
|
- {find_all: kitchen_route, where: outlet == event.outlet, as: routes}
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
- if: event.amended_from != ''
|
|
19
|
+
then:
|
|
20
|
+
- {find_all: kitchen_ticket, where: "sale == event.amended_from && status == 'picked_up'", as: served}
|
|
21
|
+
else:
|
|
22
|
+
- {find_all: kitchen_station, where: "false", as: served}
|
|
17
23
|
- for_each: stations
|
|
18
24
|
as: st
|
|
19
25
|
do:
|
|
20
|
-
- if: "event.items.filter(l,
|
|
26
|
+
- if: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).size() > 0"
|
|
21
27
|
create: kitchen_ticket
|
|
22
28
|
set:
|
|
23
29
|
sale: event.name
|
|
@@ -26,4 +32,16 @@ steps:
|
|
|
26
32
|
date: event.date
|
|
27
33
|
buyer: event.buyer
|
|
28
34
|
revision_of: event.amended_from
|
|
29
|
-
items: "event.items.filter(l,
|
|
35
|
+
items: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).map(l, {'item': l.item, 'description': l.description, 'qty': l.qty - max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())), 'uom': l.uom, 'note': l.note})"
|
|
36
|
+
- if: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).size() > 0"
|
|
37
|
+
create: kitchen_ticket
|
|
38
|
+
set:
|
|
39
|
+
sale: event.name
|
|
40
|
+
outlet: event.outlet
|
|
41
|
+
station: st.name
|
|
42
|
+
date: event.date
|
|
43
|
+
buyer: event.buyer
|
|
44
|
+
revision_of: event.amended_from
|
|
45
|
+
status: "'picked_up'"
|
|
46
|
+
picked_up_at: now()
|
|
47
|
+
items: "event.items.filter(l, routes.filter(r, r.station == st.name && r.category == l.category).size() > 0 && max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())) > 0).map(l, {'item': l.item, 'description': l.description, 'qty': max(0, min(l.qty, served.filter(t, t.station == st.name).map(t, t.served.map(x, x.item == l.item ? x.qty : 0).sum()).sum() - event.items.filter(y, y.item == l.item && y.idx < l.idx).map(y, y.qty).sum())), 'uom': l.uom, 'note': l.note})"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# A ticket's status moves one step at a time, forward or back (Baru -> Dimasak -> Siap -> Diambil; back is the work
|
|
3
3
|
# screen's "Urungkan"), and each step is stamped with its time; a step back clears the stamp of the step undone. Batal
|
|
4
4
|
# is set only by flow kitchen_ticket_on_void (writes by flows start no flow), so a person cannot void a ticket, and a
|
|
5
|
-
# void ticket does not come back. Runs inside the write, as the writer; kitchen_guard refuses the write.
|
|
5
|
+
# void ticket does not come back, nor does a picked-up ticket of a voided receipt (sale_void). Runs inside the write, as the writer; kitchen_guard refuses the write.
|
|
6
6
|
name: kitchen_ticket_on_update
|
|
7
7
|
label: {id: 'Tiket dapur diubah: satu langkah, catat waktunya'}
|
|
8
8
|
on: kitchen_ticket.updated
|
|
@@ -14,6 +14,10 @@ steps:
|
|
|
14
14
|
- if: event.status == 'void'
|
|
15
15
|
create: kitchen_guard
|
|
16
16
|
set: {reason: "'void_by_receipt'", document: event.name}
|
|
17
|
+
# a picked-up ticket of a voided receipt stays picked up: its receipt no longer exists to cook for
|
|
18
|
+
- if: event.before.status == 'picked_up' && event.sale_void
|
|
19
|
+
create: kitchen_guard
|
|
20
|
+
set: {reason: "'sale_void'", document: event.name}
|
|
17
21
|
# positions 0..3; a jump of more than one step is refused
|
|
18
22
|
- if: "event.status != 'void' && event.before.status != 'void' && ({'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.status] - {'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.before.status]) * ({'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.status] - {'new': 0, 'cooking': 1, 'ready': 2, 'picked_up': 3}[event.before.status]) > 1"
|
|
19
23
|
create: kitchen_guard
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
2
|
# A voided receipt (pos_sale cancelled, same day, open shift) voids its tickets that are not picked up yet, as the
|
|
3
|
-
# cashier who voided it; the kitchen screen drops them. A ticket already picked up stays
|
|
3
|
+
# cashier who voided it; the kitchen screen drops them. A ticket already picked up stays Diambil (the food went out)
|
|
4
|
+
# and is marked sale_void, so it cannot be pulled back into the queue (flow kitchen_ticket_on_update).
|
|
4
5
|
name: kitchen_ticket_on_void
|
|
5
6
|
label: {id: 'Struk dibatalkan: tiket dapurnya batal'}
|
|
6
7
|
on: pos_sale.cancelled
|
|
@@ -13,3 +14,10 @@ steps:
|
|
|
13
14
|
set:
|
|
14
15
|
status: "'void'"
|
|
15
16
|
void_at: now()
|
|
17
|
+
- {find_all: kitchen_ticket, where: "sale == event.name && status == 'picked_up' && !sale_void", as: served}
|
|
18
|
+
- for_each: served
|
|
19
|
+
as: t
|
|
20
|
+
do:
|
|
21
|
+
- update: t
|
|
22
|
+
set:
|
|
23
|
+
sale_void: "true"
|
|
@@ -19,6 +19,7 @@ fields:
|
|
|
19
19
|
- {value: ticket_void, label: {id: Tiket sudah batal}}
|
|
20
20
|
- {value: void_by_receipt, label: {id: Batal hanya dari struk}}
|
|
21
21
|
- {value: one_step, label: {id: Satu langkah}}
|
|
22
|
+
- {value: sale_void, label: {id: Struk sudah batal}}
|
|
22
23
|
- {name: document, type: data, label: {id: Dokumen}}
|
|
23
24
|
rules:
|
|
24
25
|
- name: ticket_void
|
|
@@ -33,3 +34,7 @@ rules:
|
|
|
33
34
|
on: save
|
|
34
35
|
check: reason != 'one_step'
|
|
35
36
|
message: {id: 'Status tiket maju atau mundur satu langkah saja (Baru, Dimasak, Siap, Diambil)'}
|
|
37
|
+
- name: sale_void
|
|
38
|
+
on: save
|
|
39
|
+
check: reason != 'sale_void'
|
|
40
|
+
message: {id: 'Struk tiket ini sudah dibatalkan; tiket yang sudah diambil tidak bisa dikembalikan ke antrean'}
|
|
@@ -36,6 +36,11 @@ fields:
|
|
|
36
36
|
in_list: true
|
|
37
37
|
- {name: items, type: table, of: kitchen_ticket_item, label: {id: Menu}, read_only: true, min_rows: 1}
|
|
38
38
|
- {name: item_count, type: float, label: {id: Jumlah porsi}, compute: "items.map(l, l.qty).sum()"}
|
|
39
|
+
# the lines as a list a flow can read (a flow's find does not load table rows): a revision of the receipt does not
|
|
40
|
+
# cook again what a picked-up ticket already sent out (flow kitchen_ticket_on_sale)
|
|
41
|
+
- {name: served, type: json, label: {id: Menu (data)}, hidden: true, compute: "items.map(l, {'item': l.item, 'qty': l.qty})"}
|
|
42
|
+
# set by flow kitchen_ticket_on_void on a ticket already picked up when its receipt is voided: it stays Diambil
|
|
43
|
+
- {name: sale_void, type: check, label: {id: Struk dibatalkan}, read_only: true}
|
|
39
44
|
- name: status
|
|
40
45
|
type: select
|
|
41
46
|
label: {id: Status}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Head office set (or moved earlier) an outlet's moka_api_from: the outlet's held Moka lines dated on or after it become
|
|
3
|
+
# staged and go into the next daily recap (flow moka_daily_sales). Held lines are what the API polled before the gate
|
|
4
|
+
# opened (audit moka-guard H1): without this they would be counted by neither the API nor the export. Lines dated
|
|
5
|
+
# before the date stay held (the export counts those days). A held line without item (head office emptied it) goes back
|
|
6
|
+
# to unmapped instead of staged, so saving the outlet is never refused by rule staged_has_outlet_and_item (audit
|
|
7
|
+
# moka-guard D2); flow moka_held_release catches held lines this run did not see (D1). Lines of the outlet from the
|
|
8
|
+
# date on that are still unmapped (an unknown item polled while the outlet was on the export, which was not told then:
|
|
9
|
+
# D3) are told to head office now, so the day is not recapped without them unnoticed (audit held-release A2).
|
|
10
|
+
name: moka_api_opened
|
|
11
|
+
label: {id: Baris Moka yang ditahan dilepas saat outlet mulai pakai API}
|
|
12
|
+
on: outlet.updated
|
|
13
|
+
if: "event.moka_api_from != null && event.moka_api_from != ''"
|
|
14
|
+
steps:
|
|
15
|
+
- find_all: moka_sale_line
|
|
16
|
+
where: "outlet == event.name && status == 'held' && date >= event.moka_api_from"
|
|
17
|
+
as: held
|
|
18
|
+
- for_each: held
|
|
19
|
+
as: l
|
|
20
|
+
do:
|
|
21
|
+
- update: l
|
|
22
|
+
set:
|
|
23
|
+
status: "l.item != '' ? 'staged' : 'unmapped'"
|
|
24
|
+
- find_all: moka_sale_line
|
|
25
|
+
where: "outlet == event.name && status == 'unmapped' && date >= event.moka_api_from"
|
|
26
|
+
as: waiting
|
|
27
|
+
- notify: head_office
|
|
28
|
+
if: size(waiting) > 0
|
|
29
|
+
channel: email
|
|
30
|
+
template: {id: '{event.outlet_name} mulai pakai API Moka: {size(waiting)} baris Moka belum dipetakan, petakan di Baris penjualan Moka'}
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
# (legacy_key_overlap) and rule legacy_key_reviewed holds its submit until head office has removed what is counted
|
|
10
10
|
# twice; an export imported after the API day is flagged by flow moka_legacy_key_overlap.
|
|
11
11
|
# An unmapped line waits in Baris penjualan Moka and does not hold anything back; once mapped it joins the next recap.
|
|
12
|
+
# One run is one unit of work: a refused create would roll back every outlet-day of the run, and the next run would
|
|
13
|
+
# pick the same oldest day again. So before creating, the lines whose item was deleted, whose outlet was deleted or
|
|
14
|
+
# whose outlet no longer uses Moka (Nama outlet di Moka emptied) go back to unmapped with that item or outlet emptied,
|
|
15
|
+
# head office is told, and the other lines of the day are recapped. (The kernel lets a linked record be deleted; a
|
|
16
|
+
# rangka-os card asks it to refuse.)
|
|
17
|
+
# Cost: the kernel reads a whole model for every find, so each slot reads moka_sale_line once (the oldest staged lines,
|
|
18
|
+
# the outlet-day taken from the first) and a slot runs only while the slot before found lines: a run with nothing to
|
|
19
|
+
# recap reads the table once, a run with N outlet-days N + 1 times.
|
|
12
20
|
name: moka_daily_sales
|
|
13
21
|
label: {id: Rekap harian penjualan Moka per outlet}
|
|
14
22
|
schedule: '15 * * * *'
|
|
@@ -16,42 +24,55 @@ steps:
|
|
|
16
24
|
- for_each: "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]"
|
|
17
25
|
as: slot
|
|
18
26
|
do:
|
|
27
|
+
# the oldest staged lines; the outlet-day of this slot is the first one's (lines are sorted by date, then the
|
|
28
|
+
# slot keeps those of the same outlet and day)
|
|
19
29
|
- find_all: moka_sale_line
|
|
30
|
+
if: slot == 1 || size(batch) > 0
|
|
20
31
|
where: "status == 'staged' && outlet != '' && date < today()"
|
|
21
32
|
sort: date
|
|
22
|
-
limit: 1
|
|
23
|
-
as: first
|
|
24
|
-
- find_all: moka_sale_line
|
|
25
|
-
if: size(first) > 0
|
|
26
|
-
where: "outlet == first[0].outlet && date == first[0].date && status == 'staged'"
|
|
27
|
-
sort: name
|
|
28
33
|
limit: 1000
|
|
29
|
-
as:
|
|
34
|
+
as: batch
|
|
30
35
|
- find: outlet
|
|
31
|
-
if: size(
|
|
32
|
-
where: name ==
|
|
36
|
+
if: size(batch) > 0
|
|
37
|
+
where: name == batch[0].outlet
|
|
33
38
|
as: o
|
|
39
|
+
- find_all: item
|
|
40
|
+
if: size(batch) > 0
|
|
41
|
+
where: "name in batch.filter(r, r.outlet == batch[0].outlet && r.date == batch[0].date).map(r, r.item)"
|
|
42
|
+
as: alive
|
|
34
43
|
- find: outlet_sales
|
|
35
|
-
if: size(
|
|
36
|
-
where: "outlet ==
|
|
44
|
+
if: size(batch) > 0
|
|
45
|
+
where: "outlet == batch[0].outlet && date == batch[0].date && source == 'moka' && docstatus != 2 && key_version != 3"
|
|
37
46
|
as: filed
|
|
38
47
|
- create: outlet_sales
|
|
39
|
-
if: size(
|
|
48
|
+
if: "size(batch) > 0 && o != null && o.moka_name != '' && size(batch.filter(r, r.outlet == batch[0].outlet && r.date == batch[0].date && r.item in alive.map(i, i.name))) > 0"
|
|
40
49
|
set:
|
|
41
|
-
outlet:
|
|
42
|
-
date:
|
|
50
|
+
outlet: batch[0].outlet
|
|
51
|
+
date: batch[0].date
|
|
43
52
|
source: "'moka'"
|
|
44
|
-
moka_outlet:
|
|
53
|
+
moka_outlet: o.moka_name
|
|
45
54
|
key_version: "3"
|
|
46
55
|
note: "'Dari Moka API'"
|
|
47
56
|
legacy_key_overlap: filed != null
|
|
48
|
-
lines: "
|
|
57
|
+
lines: "batch.filter(r, r.outlet == batch[0].outlet && r.date == batch[0].date && r.item in alive.map(i, i.name)).map(r, {'item': r.item, 'description': r.description, 'qty': r.qty, 'gross': r.gross, 'discount': r.discount, 'refund': r.refund})"
|
|
49
58
|
as: sales
|
|
50
|
-
- for_each:
|
|
51
|
-
if: size(first) > 0
|
|
59
|
+
- for_each: "size(batch) > 0 && o != null && o.moka_name != '' ? batch.filter(r, r.outlet == batch[0].outlet && r.date == batch[0].date && r.item in alive.map(i, i.name)) : []"
|
|
52
60
|
as: r
|
|
53
61
|
do:
|
|
54
62
|
- update: r
|
|
55
63
|
set:
|
|
56
64
|
status: "'posted'"
|
|
57
65
|
sales: sales.name
|
|
66
|
+
# lines that cannot go into a record: back to unmapped, the missing item or outlet emptied, head office told
|
|
67
|
+
- for_each: "size(batch) > 0 ? batch.filter(r, r.outlet == batch[0].outlet && r.date == batch[0].date && (o == null || o.moka_name == '' || !(r.item in alive.map(i, i.name)))) : []"
|
|
68
|
+
as: r
|
|
69
|
+
do:
|
|
70
|
+
- update: r
|
|
71
|
+
set:
|
|
72
|
+
status: "'unmapped'"
|
|
73
|
+
outlet: "o != null && o.moka_name != '' ? r.outlet : ''"
|
|
74
|
+
item: "r.item in alive.map(i, i.name) ? r.item : ''"
|
|
75
|
+
- notify: head_office
|
|
76
|
+
if: "size(batch) > 0 && size(batch.filter(r, r.outlet == batch[0].outlet && r.date == batch[0].date && (o == null || o.moka_name == '' || !(r.item in alive.map(i, i.name))))) > 0"
|
|
77
|
+
channel: email
|
|
78
|
+
template: {id: 'Rekap Moka {batch[0].outlet} {batch[0].date}: barang/outlet terhapus atau outlet tanpa Moka, baris kembali Belum dipetakan'}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every hour at :10 (before the recap at :15, flow moka_daily_sales) and from the flow list: held Moka lines whose
|
|
3
|
+
# outlet now counts the API for their day (outlet.moka_api_from set, on or before the line's date) become staged.
|
|
4
|
+
# Flow moka_api_opened does this when head office saves the outlet; this run catches the rest (audit moka-guard D1): a
|
|
5
|
+
# held line head office moved to an outlet already on the API, or a line a poll wrote while the outlet was being
|
|
6
|
+
# saved. A held line without item (head office emptied it) goes back to unmapped instead (rule
|
|
7
|
+
# staged_has_outlet_and_item, D2). Only outlets whose API has started (moka_api_from <= today) are read, and only lines
|
|
8
|
+
# from the earliest of their dates on (audit held-release A1: an outlet with a future date or a long export period
|
|
9
|
+
# must not fill the 2000-line read), and each line against its own outlet's date in the read itself (A1': a held line
|
|
10
|
+
# before a later gate is never released, so it must not take a place in the 2000); if 2000 lines still come back,
|
|
11
|
+
# head office is told and the next runs go on with the rest.
|
|
12
|
+
# A held line without outlet is not read: it waits until head office gives it an outlet.
|
|
13
|
+
name: moka_held_release
|
|
14
|
+
label: {id: Baris Moka yang ditahan dilepas bila outlet sudah pakai API}
|
|
15
|
+
schedule: '10 * * * *'
|
|
16
|
+
steps:
|
|
17
|
+
- find_all: outlet
|
|
18
|
+
where: "moka_api_from != '' && moka_name != '' && moka_api_from <= today()"
|
|
19
|
+
sort: moka_api_from
|
|
20
|
+
as: open
|
|
21
|
+
- find_all: moka_sale_line
|
|
22
|
+
if: size(open) > 0
|
|
23
|
+
where: "status == 'held' && outlet in open.map(o, o.name) && date >= open[0].moka_api_from && open.exists(o, o.name == outlet && o.moka_api_from <= date)"
|
|
24
|
+
limit: 2000
|
|
25
|
+
as: held
|
|
26
|
+
- for_each: "size(open) > 0 ? held : []"
|
|
27
|
+
as: l
|
|
28
|
+
do:
|
|
29
|
+
- update: l
|
|
30
|
+
set:
|
|
31
|
+
status: "l.item != '' ? 'staged' : 'unmapped'"
|
|
32
|
+
- notify: head_office
|
|
33
|
+
if: size(open) > 0 && size(held) >= 2000
|
|
34
|
+
channel: email
|
|
35
|
+
template: {id: 'Lebih dari 2000 baris Moka masih ditahan; dilepas bertahap tiap jam. Cek tanggal Mulai pakai API Moka di outlet'}
|