@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.
Files changed (64) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/jasa_proyek/app.rk +4 -0
  3. package/template/base/apps/jasa_proyek/dashboards/rekap_absen.rk +1 -1
  4. package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +17 -1
  5. package/template/base/apps/kelas_kursus/app.rk +3 -0
  6. package/template/base/apps/langganan_jasa/app.rk +5 -1
  7. package/template/base/apps/sewa_alat/app.rk +6 -1
  8. package/template/base/connectors/moka/connector.rk +6 -5
  9. package/template/base/modules/catalogue/models/item.rk +9 -0
  10. package/template/base/modules/contacts/models/customer.rk +10 -1
  11. package/template/base/modules/contacts/models/vendor.rk +10 -1
  12. package/template/base/modules/courses/flows/session_attendance_checked.rk +14 -0
  13. package/template/base/modules/courses/flows/session_of_the_day.rk +34 -0
  14. package/template/base/modules/courses/models/course_attendance.rk +2 -0
  15. package/template/base/modules/courses/models/course_session.rk +1 -0
  16. package/template/base/modules/courses/module.rk +1 -1
  17. package/template/base/modules/courses/screens/absen_kelas.rk +17 -0
  18. package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +26 -8
  19. package/template/base/modules/kitchen/flows/kitchen_ticket_on_update.rk +5 -1
  20. package/template/base/modules/kitchen/flows/kitchen_ticket_on_void.rk +9 -1
  21. package/template/base/modules/kitchen/models/kitchen_guard.rk +5 -0
  22. package/template/base/modules/kitchen/models/kitchen_ticket.rk +5 -0
  23. package/template/base/modules/outlet_sales/flows/moka_api_opened.rk +30 -0
  24. package/template/base/modules/outlet_sales/flows/moka_daily_sales.rk +39 -18
  25. package/template/base/modules/outlet_sales/flows/moka_held_release.rk +35 -0
  26. package/template/base/modules/outlet_sales/flows/moka_line_mapped.rk +26 -2
  27. package/template/base/modules/outlet_sales/flows/moka_transaction_refused.rk +15 -0
  28. package/template/base/modules/outlet_sales/flows/moka_transaction_staged.rk +108 -27
  29. package/template/base/modules/outlet_sales/models/moka_sale_line.rk +15 -2
  30. package/template/base/modules/outlets/models/outlet.rk +13 -1
  31. package/template/base/modules/payroll/flows/payslip_advance_guard.rk +3 -0
  32. package/template/base/modules/payroll/flows/payslip_from_recap.rk +30 -1
  33. package/template/base/modules/payroll/flows/payslip_ytd_guard.rk +18 -1
  34. package/template/base/modules/payroll/flows/payslip_ytd_on_create.rk +28 -1
  35. package/template/base/modules/payroll/models/payslip.rk +19 -1
  36. package/template/base/modules/pos/models/pos_sale.rk +2 -1
  37. package/template/base/modules/pos/models/pos_sale_item.rk +3 -0
  38. package/template/base/modules/pos/screens/kasir.rk +1 -1
  39. package/template/base/modules/projects/flows/attendance_close_on_submit.rk +6 -2
  40. package/template/base/modules/projects/flows/attendance_log_guard_created.rk +3 -1
  41. package/template/base/modules/projects/flows/attendance_log_guard_submitted.rk +8 -4
  42. package/template/base/modules/projects/flows/attendance_log_guard_updated.rk +2 -1
  43. package/template/base/modules/projects/models/assignment.rk +3 -0
  44. package/template/base/modules/projects/models/attendance_close.rk +4 -0
  45. package/template/base/modules/projects/models/attendance_guard.rk +1 -1
  46. package/template/base/modules/projects/models/attendance_log.rk +63 -66
  47. package/template/base/modules/projects/models/work_site.rk +2 -1
  48. package/template/base/modules/projects/module.rk +1 -1
  49. package/template/base/modules/projects/roles/field_worker.rk +2 -0
  50. package/template/base/modules/projects/screens/absen.rk +21 -0
  51. package/template/base/modules/rental/flows/rental_return_on_cancel.rk +5 -3
  52. package/template/base/modules/rental/models/rental_checkout.rk +10 -15
  53. package/template/base/modules/rental/models/rental_return.rk +3 -11
  54. package/template/base/modules/rental/models/rental_schedule.rk +8 -0
  55. package/template/base/modules/rental/models/rental_unit.rk +7 -0
  56. package/template/base/modules/rental/module.rk +1 -1
  57. package/template/base/modules/rental/screens/alat_keluar.rk +19 -0
  58. package/template/base/modules/rental/screens/alat_kembali.rk +19 -0
  59. package/template/base/modules/rental/screens/jadwal_alat.rk +21 -0
  60. package/template/base/modules/subscriptions/models/collection_visit.rk +47 -0
  61. package/template/base/modules/subscriptions/models/subscription.rk +3 -1
  62. package/template/base/modules/subscriptions/module.rk +1 -1
  63. package/template/base/modules/subscriptions/screens/catat_tagih.rk +18 -0
  64. package/template/base/modules/subscriptions/screens/rute_tagih.rk +25 -0
@@ -41,6 +41,9 @@ fields:
41
41
  - {name: site_lat, type: float, label: {id: Lintang lokasi absen}, read_only: true, compute: "work_site != '' ? work_site.lat : 0"}
42
42
  - {name: site_lng, type: float, label: {id: Bujur lokasi absen}, read_only: true, compute: "work_site != '' ? work_site.lng : 0"}
43
43
  - {name: site_radius_m, type: int, label: {id: Radius absen (m)}, read_only: true, compute: "work_site != '' ? work_site.radius_m : 0"}
44
+ # For the clock screen (screens/absen.rk): the worker picks today's assignment as the place to clock in.
45
+ - {name: site_name, type: data, label: {id: Nama lokasi absen}, read_only: true, compute: "work_site != '' ? work_site.site_name : ''"}
46
+ - {name: site_point, type: geo, label: {id: Titik lokasi absen}, read_only: true, hidden: true, compute: "work_site != '' ? {'lat': site_lat, 'lng': site_lng} : ''"}
44
47
  - name: start_date
45
48
  type: date
46
49
  label: {id: Mulai}
@@ -37,9 +37,13 @@ fields:
37
37
  label: {id: Sampai tanggal}
38
38
  required: true
39
39
  in_list: true
40
+ # Workers and supervisors keep read (the guards of their log submit read the close) and are not row scoped (no worker or
41
+ # work_site field, contract 0010 §5), so they can list every project's closes; the notes stay hidden from them
42
+ # (audit 8 Nov L7, accepted limit: project, period and status remain visible).
40
43
  - name: notes
41
44
  type: text
42
45
  label: {id: Catatan}
46
+ hidden_for: [field_worker, site_supervisor]
43
47
  # No unique key on the period: a cancelled close must not block its amendment or a new close of the same days. Two live
44
48
  # closes of overlapping days are refused by attendance_close_on_submit under the flow lock (contract 0025).
45
49
  rules:
@@ -54,4 +54,4 @@ rules:
54
54
  - name: photo_reused
55
55
  on: save
56
56
  check: reason != 'photo_reused'
57
- message: {id: 'Foto masuk ini sudah dipakai absen lain; ambil foto baru untuk absen hari ini'}
57
+ message: {id: 'Foto ini sudah dipakai absen lain; ambil foto baru untuk absen hari ini'}
@@ -15,15 +15,18 @@ title_field: worker_name
15
15
  # the distance and the photo; a rejected log stays a draft and is not counted. Nothing is refused for being far away
16
16
  # (contract 0030 §4, as Talenta and Gadjian do).
17
17
  #
18
- # Distance: the kernel has no distance_m yet (it comes with WS6, the `geo` field type). Until then the phone sends lat/lng
19
- # and its own distance (in_distance_m, kept for the record only), and the kernel decides inside/outside itself from lat/lng
20
- # with a flat-earth formula (equirectangular; cos(lat) by its Taylor series, enough for |lat| < 30): squared metres against
21
- # the squared radius, so no square root is needed. A faked position (fake GPS) is not detected; the supervisor checks the
22
- # photo (contract 0030 §4).
18
+ # Distance: the phone sends its position as a `geo` value {lat, lng, accuracy_m, at} (contract 0030 §4, WS6) and the
19
+ # kernel measures it against the site's point with distance_m (haversine). What the phone shows is only an estimate; the
20
+ # computes below decide. A faked position (fake GPS) is not detected; the supervisor checks the photo (contract 0030 §4).
23
21
  #
24
- # Photos are attachments of the record (contract 0011, POST /api/v1/r/attendance_log/{name}/attachments); in_photo and
25
- # out_photo (type image, contract 0030 §4) hold the attachment id. The kernel does not check yet that the id belongs to this
26
- # record, nor gives the field a camera widget (WS6).
22
+ # Photos are attachments of the record (contract 0011); in_photo and out_photo (type image) hold the attachment id, and
23
+ # the kernel accepts only an image attachment of this same log (contract 0030 §4). The clock screen (screens/absen.rk)
24
+ # creates the log with the position, attaches the photo, then sets the photo and the clock-in time together.
25
+ #
26
+ # The clock-in and clock-out time, position and photo are set_once (contract 0030 §4): a worker fills them once and can
27
+ # never move a clock-in the kernel measured as outside, and nobody else can either: amend copies them, locked. A wrong
28
+ # value is corrected by the project admin cancelling the log and making a new one for the day (not an amendment; the
29
+ # cancelled log stays as the trail, attendance_close counts only submitted logs). Audit 2026-11-12 F5.
27
30
  #
28
31
  # Not linked to by any record while it is a draft (contract 0030 §10), so it can be submittable.
29
32
  permissions:
@@ -72,28 +75,28 @@ fields:
72
75
  default: today()
73
76
  in_list: true
74
77
  # Clock-in
78
+ # Set by the clock screen together with the photo (a default would block that write: set_once). Required at submit.
75
79
  - name: clock_in
76
80
  type: datetime
77
81
  label: {id: Jam masuk}
78
- required: true
79
- default: now()
82
+ set_once: true
80
83
  in_list: true
81
- - {name: in_lat, type: float, label: {id: Lintang masuk}}
82
- - {name: in_lng, type: float, label: {id: Bujur masuk}}
83
- - {name: in_accuracy_m, type: float, label: {id: Akurasi GPS masuk (m)}}
84
- # What the phone computed, kept for the record; the kernel decides with its own measure (in_inside, in_site_m).
85
- - {name: in_distance_m, type: float, label: {id: Jarak masuk menurut HP (m)}}
86
- - {name: in_photo, type: image, label: {id: Foto masuk (lampiran)}}
84
+ - {name: in_pos, type: geo, label: {id: Posisi masuk}, set_once: true}
85
+ # Before the geo fields (projects 1.1) the position was two numbers. Kept read-only so a log made before the upgrade
86
+ # is still measured from where it was taken (audit 2026-11-12 F1); new logs leave them 0.
87
+ - {name: in_lat, type: float, label: {id: Lintang masuk (lama)}, hidden: true, read_only: true}
88
+ - {name: in_lng, type: float, label: {id: Bujur masuk (lama)}, hidden: true, read_only: true}
89
+ - {name: in_photo, type: image, label: {id: Foto masuk}, set_once: true}
87
90
  # Clock-out
88
91
  - name: clock_out
89
92
  type: datetime
90
93
  label: {id: Jam keluar}
94
+ set_once: true
91
95
  in_list: true
92
- - {name: out_lat, type: float, label: {id: Lintang keluar}}
93
- - {name: out_lng, type: float, label: {id: Bujur keluar}}
94
- - {name: out_accuracy_m, type: float, label: {id: Akurasi GPS keluar (m)}}
95
- - {name: out_distance_m, type: float, label: {id: Jarak keluar menurut HP (m)}}
96
- - {name: out_photo, type: image, label: {id: Foto keluar (lampiran)}}
96
+ - {name: out_pos, type: geo, label: {id: Posisi keluar}, set_once: true}
97
+ - {name: out_lat, type: float, label: {id: Lintang keluar (lama)}, hidden: true, read_only: true}
98
+ - {name: out_lng, type: float, label: {id: Bujur keluar (lama)}, hidden: true, read_only: true}
99
+ - {name: out_photo, type: image, label: {id: Foto keluar}, set_once: true}
97
100
  - name: overtime_hours
98
101
  type: float
99
102
  label: {id: Jam lembur}
@@ -106,54 +109,33 @@ fields:
106
109
  - {name: site_lat, type: float, label: {id: Lintang lokasi}, read_only: true, compute: "work_site != '' ? work_site.lat : 0"}
107
110
  - {name: site_lng, type: float, label: {id: Bujur lokasi}, read_only: true, compute: "work_site != '' ? work_site.lng : 0"}
108
111
  - {name: site_radius_m, type: int, label: {id: Radius lokasi (m)}, read_only: true, compute: "work_site != '' ? work_site.radius_m : 0"}
109
- # Metres per degree of longitude at the site: 111320 x cos(lat), cos by 1 - x^2/2 + x^4/24 - x^6/720 (x in radians).
110
- - name: site_m_per_lng
111
- type: float
112
- label: {id: Meter per derajat bujur}
113
- hidden: true
114
- read_only: true
115
- compute: "111320.0 * (1.0 - (site_lat * 0.0174532925) * (site_lat * 0.0174532925) / 2.0 + (site_lat * 0.0174532925) * (site_lat * 0.0174532925) * (site_lat * 0.0174532925) * (site_lat * 0.0174532925) / 24.0 - (site_lat * 0.0174532925) * (site_lat * 0.0174532925) * (site_lat * 0.0174532925) * (site_lat * 0.0174532925) * (site_lat * 0.0174532925) * (site_lat * 0.0174532925) / 720.0)"
116
- - {name: in_located, type: check, label: {id: Lokasi masuk ada}, read_only: true, compute: "in_lat != 0 || in_lng != 0"}
117
- - {name: in_dx, type: float, label: {id: Selisih timur masuk (m)}, hidden: true, read_only: true, compute: "(in_lng - site_lng) * site_m_per_lng"}
118
- - {name: in_ax, type: float, label: {id: Selisih timur masuk mutlak}, hidden: true, read_only: true, compute: "in_dx < 0 ? -in_dx : in_dx"}
119
- - {name: in_ay, type: float, label: {id: Selisih utara masuk mutlak}, hidden: true, read_only: true, compute: "in_dy < 0 ? -in_dy : in_dy"}
120
- # Square root of dx^2 + dy^2 by two Newton steps from the octagonal estimate (max + 0.4 min, within 4%): within
121
- # 0.01% of the flat-earth distance.
122
- - {name: in_r0, type: float, label: {id: Jarak awal masuk}, hidden: true, read_only: true, compute: "(in_ax > in_ay ? in_ax : in_ay) + 0.4 * (in_ax > in_ay ? in_ay : in_ax)"}
123
- - {name: in_r1, type: float, label: {id: Jarak langkah 1 masuk}, hidden: true, read_only: true, compute: "in_r0 == 0 ? 0.0 : (in_r0 + (in_dx * in_dx + in_dy * in_dy) / in_r0) / 2.0"}
124
- - {name: in_r2, type: float, label: {id: Jarak langkah 2 masuk}, hidden: true, read_only: true, compute: "in_r1 == 0 ? 0.0 : (in_r1 + (in_dx * in_dx + in_dy * in_dy) / in_r1) / 2.0"}
125
- - {name: in_dy, type: float, label: {id: Selisih utara masuk (m)}, hidden: true, read_only: true, compute: "(in_lat - site_lat) * 110574.0"}
112
+ - {name: site_point, type: geo, label: {id: Titik lokasi}, hidden: true, read_only: true, compute: "work_site != '' ? {'lat': site_lat, 'lng': site_lng} : ''"}
113
+ # distance_m is 1e9 without a position (contract 0030 §4): "no position" counts as far.
114
+ - {name: in_m, type: float, label: {id: Jarak masuk dari titik (m)}, hidden: true, read_only: true, compute: "distance_m(in_pos, site_point) < 100000000.0 ? distance_m(in_pos, site_point) : (in_lat != 0 || in_lng != 0 ? distance_m({'lat': in_lat, 'lng': in_lng}, site_point) : distance_m(in_pos, site_point))"}
115
+ - {name: in_located, type: check, label: {id: Lokasi masuk ada}, read_only: true, compute: "in_m < 100000000.0"}
126
116
  - name: in_inside
127
117
  type: check
128
118
  label: {id: Masuk di dalam radius}
129
119
  read_only: true
130
- compute: "in_located && work_site != '' && in_dx * in_dx + in_dy * in_dy <= site_radius_m * site_radius_m"
131
- # Distance in metres for people to read (the decision above does not depend on it).
120
+ compute: "in_located && work_site != '' && in_m <= site_radius_m"
121
+ # Distance in metres for people to read (0 without a position).
132
122
  - name: in_site_m
133
123
  type: int
134
124
  label: {id: Jarak masuk dari lokasi (m)}
135
125
  read_only: true
136
- compute: "!in_located || work_site == '' ? 0 : round(in_r2)"
137
- - {name: out_located, type: check, label: {id: Lokasi keluar ada}, read_only: true, compute: "out_lat != 0 || out_lng != 0"}
138
- - {name: out_dx, type: float, label: {id: Selisih timur keluar (m)}, hidden: true, read_only: true, compute: "(out_lng - site_lng) * site_m_per_lng"}
139
- - {name: out_ax, type: float, label: {id: Selisih timur keluar mutlak}, hidden: true, read_only: true, compute: "out_dx < 0 ? -out_dx : out_dx"}
140
- - {name: out_ay, type: float, label: {id: Selisih utara keluar mutlak}, hidden: true, read_only: true, compute: "out_dy < 0 ? -out_dy : out_dy"}
141
- # Square root of dx^2 + dy^2 by two Newton steps from the octagonal estimate (max + 0.4 min, within 4%): within
142
- # 0.01% of the flat-earth distance.
143
- - {name: out_r0, type: float, label: {id: Jarak awal keluar}, hidden: true, read_only: true, compute: "(out_ax > out_ay ? out_ax : out_ay) + 0.4 * (out_ax > out_ay ? out_ay : out_ax)"}
144
- - {name: out_r1, type: float, label: {id: Jarak langkah 1 keluar}, hidden: true, read_only: true, compute: "out_r0 == 0 ? 0.0 : (out_r0 + (out_dx * out_dx + out_dy * out_dy) / out_r0) / 2.0"}
145
- - {name: out_r2, type: float, label: {id: Jarak langkah 2 keluar}, hidden: true, read_only: true, compute: "out_r1 == 0 ? 0.0 : (out_r1 + (out_dx * out_dx + out_dy * out_dy) / out_r1) / 2.0"}
146
- - {name: out_dy, type: float, label: {id: Selisih utara keluar (m)}, hidden: true, read_only: true, compute: "(out_lat - site_lat) * 110574.0"}
126
+ compute: "!in_located || work_site == '' ? 0 : round(in_m)"
127
+ - {name: out_m, type: float, label: {id: Jarak keluar dari titik (m)}, hidden: true, read_only: true, compute: "distance_m(out_pos, site_point) < 100000000.0 ? distance_m(out_pos, site_point) : (out_lat != 0 || out_lng != 0 ? distance_m({'lat': out_lat, 'lng': out_lng}, site_point) : distance_m(out_pos, site_point))"}
128
+ - {name: out_located, type: check, label: {id: Lokasi keluar ada}, read_only: true, compute: "out_m < 100000000.0"}
147
129
  - name: out_inside
148
130
  type: check
149
131
  label: {id: Keluar di dalam radius}
150
132
  read_only: true
151
- compute: "out_located && work_site != '' && out_dx * out_dx + out_dy * out_dy <= site_radius_m * site_radius_m"
133
+ compute: "out_located && work_site != '' && out_m <= site_radius_m"
152
134
  - name: out_site_m
153
135
  type: int
154
136
  label: {id: Jarak keluar dari lokasi (m)}
155
137
  read_only: true
156
- compute: "!out_located || work_site == '' ? 0 : round(out_r2)"
138
+ compute: "!out_located || work_site == '' ? 0 : round(out_m)"
157
139
  # Outside: clock-in not inside the radius (or no position), or a clock-out entered and not inside.
158
140
  - name: outside_site
159
141
  type: check
@@ -190,30 +172,45 @@ rules:
190
172
  on: save
191
173
  check: work_date <= today()
192
174
  message: {id: 'Tidak bisa absen untuk tanggal yang belum datang'}
193
- - name: position_valid
194
- on: save
195
- check: in_lat >= -90 && in_lat <= 90 && in_lng >= -180 && in_lng <= 180 && out_lat >= -90 && out_lat <= 90 && out_lng >= -180 && out_lng <= 180 && in_accuracy_m >= 0 && out_accuracy_m >= 0 && in_distance_m >= 0 && out_distance_m >= 0
196
- message: {id: 'Posisi GPS tidak valid'}
197
- - name: photo_is_attachment
175
+ # The clock-in falls on the day being paid (audit 8 Nov L9). A clock-in with a local offset (+07:00) starts with the
176
+ # local date. A UTC one (Z or +00:00, how the store keeps it) falls between 00:00 WIT and 24:00 WIB of that date:
177
+ # 15:00 UTC the day before up to 17:00 UTC (audit apps-low F3). The org timezone is not readable in CEL.
178
+ - name: clock_in_on_work_date
198
179
  on: save
199
- check: (in_photo == '' || in_photo.startsWith('att_')) && (out_photo == '' || out_photo.startsWith('att_'))
200
- message: {id: 'Foto diisi dengan id lampiran (unggah fotonya dulu)'}
180
+ check: >-
181
+ clock_in == '' || ((clock_in.endsWith('Z') || clock_in.endsWith('+00:00'))
182
+ ? ((clock_in.startsWith(work_date) && clock_in < work_date + 'T17:00:00')
183
+ || (clock_in.startsWith(work_date - duration(1)) && clock_in >= (work_date - duration(1)) + 'T15:00:00'))
184
+ : clock_in.startsWith(work_date))
185
+ message: {id: 'Jam masuk harus di tanggal absen'}
201
186
  - name: out_after_in
202
187
  on: save
203
- check: clock_out == '' || clock_out > clock_in
188
+ check: clock_out == '' || (clock_in != '' && clock_out > clock_in)
204
189
  message: {id: 'Jam keluar harus sesudah jam masuk'}
205
190
  - name: overtime_range
206
191
  on: save
207
192
  check: overtime_hours >= 0 && overtime_hours <= 12
208
193
  message: {id: 'Jam lembur 0 sampai 12 jam per hari'}
194
+ # The reason is asked at the clock-in (the clock screen shows the box only then, contract 0030 §2 clock). A clock-out
195
+ # outside the radius needs none: it still marks the log outside_site, so the submit waits for the supervisor, who
196
+ # sees the distance and the photo.
209
197
  - name: reason_when_outside
210
198
  on: save
211
- check: "!outside_site || size(reason) >= 5"
199
+ check: "in_inside || size(reason) >= 5"
212
200
  message: {id: 'Kamu di luar radius lokasi kerja (atau lokasi tidak terbaca): tulis alasannya'}
213
201
  - name: reason_when_overtime
214
202
  on: save
215
203
  check: overtime_hours == 0 || size(reason) >= 5
216
204
  message: {id: 'Tulis alasan atau pekerjaan lemburnya'}
205
+ - name: clocked_in
206
+ on: submit
207
+ check: clock_in != ''
208
+ message: {id: 'Isi jam masuk dulu (absen masuk) sebelum diajukan'}
209
+ # The clock-out photo is its own evidence, not the clock-in photo again (audit 2026-11-12 F4).
210
+ - name: out_photo_own
211
+ on: save
212
+ check: out_photo == '' || out_photo != in_photo
213
+ message: {id: 'Foto keluar harus foto baru, bukan foto masuk'}
217
214
  - name: clocked_out
218
215
  on: submit
219
216
  check: clock_out != ''
@@ -253,12 +250,12 @@ views:
253
250
  - [work_date, overtime_hours, outside_site]
254
251
  - section: {id: Masuk}
255
252
  columns:
256
- - [clock_in, in_photo, in_site_m, in_inside]
257
- - [in_lat, in_lng, in_accuracy_m, in_distance_m]
253
+ - [clock_in, in_photo]
254
+ - [in_pos, in_site_m, in_inside]
258
255
  - section: {id: Keluar}
259
256
  columns:
260
- - [clock_out, out_photo, out_site_m, out_inside]
261
- - [out_lat, out_lng, out_accuracy_m, out_distance_m]
257
+ - [clock_out, out_photo]
258
+ - [out_pos, out_site_m, out_inside]
262
259
  - section: {id: Alasan}
263
260
  fields: [reason]
264
261
  - section: {id: Lokasi kerja}
@@ -37,6 +37,8 @@ fields:
37
37
  type: float
38
38
  label: {id: Bujur (lng)}
39
39
  required: true
40
+ # The point as a position (contract 0030 §4 geo) for distance_m and the clock screen's site slot.
41
+ - {name: point, type: geo, label: {id: Titik lokasi}, read_only: true, compute: "{'lat': lat, 'lng': lng}"}
40
42
  - name: radius_m
41
43
  type: int
42
44
  label: {id: Radius absen (meter)}
@@ -55,7 +57,6 @@ rules:
55
57
  on: save
56
58
  check: lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180 && (lat != 0 || lng != 0)
57
59
  message: {id: 'Titik lokasi tidak valid: lintang -90 sampai 90, bujur -180 sampai 180'}
58
- # The distance check (attendance_log) is a flat-earth approximation, good to well under a metre for these distances.
59
60
  - name: radius_range
60
61
  on: save
61
62
  check: radius_m >= 20 && radius_m <= 5000
@@ -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: projects
3
- version: 1.1.1
3
+ version: 1.2.0
4
4
  title: {id: Proyek, en: Projects}
5
5
  summary:
6
6
  id: Proyek dengan penugasan, absensi, biaya, termin tagihan dan untung per proyek.
@@ -2,6 +2,8 @@
2
2
  name: field_worker
3
3
  label: {id: Pekerja lapangan}
4
4
  description: {id: 'Absen masuk dan pulang di lokasi kerja, dan melihat absennya sendiri'}
5
+ # Works from the phone: the clock screen full screen (work shell, contract 0030 §3), no sidebar.
6
+ desk: false
5
7
  # Contract 0010 §5: records whose worker is the member's own worker record (rangka user add --record WRK-0001), so a
6
8
  # worker sees only their own logs and assignments. Pay and selling rates of an assignment are hidden (contract 0027).
7
9
  scope: {field: worker, from: '[user.name]'}
@@ -0,0 +1,21 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
2
+ name: absen
3
+ type: clock
4
+ label: {id: Absen, en: Clock in}
5
+ icon: clock
6
+ # A worker clocks in and out at the client's site from their phone (plans/layar-kerja.md §3 #2, contract 0030 §2 clock).
7
+ # The site is today's assignment (the worker cannot read the firm's list of client sites, only their own assignments),
8
+ # its point and radius come from the work site. A clock-in outside the radius or without a position is saved with the
9
+ # reason and waits for the site supervisor (attendance_log approvals); the record's own computes decide, not the phone.
10
+ # No offline queue: every clock-in carries a photo, which needs the connection (contract 0030 §7).
11
+ roles: [field_worker]
12
+ device: phone
13
+ needs: [location, photo]
14
+ clock:
15
+ # The worker's own logs (row scope worker); the open one is the newest with a clock-in and no clock-out.
16
+ record: {model: attendance_log, filter: "docstatus == 0", set: {worker: user.name}}
17
+ in: {field: clock_in, location: in_pos, photo: in_photo}
18
+ out: {field: clock_out, location: out_pos, photo: out_photo}
19
+ site: {model: assignment, link: assignment, filter: "start_date <= today() && end_date >= today() && work_site != ''", title: site_name, location: site_point, radius_m: site_radius_m}
20
+ reason: reason
21
+ submit: true
@@ -3,7 +3,9 @@ name: rental_return_on_cancel
3
3
  label: {id: Alat kembali dibatalkan}
4
4
  # A return entered by mistake: the schedule goes back to out (the deposit journal is reversed by gl_rental_return_reverse),
5
5
  # refused while the invoice for what the deposit did not cover is submitted (cancel that first). Its units go back out
6
- # with the booking in the condition they left in, refused for a unit that went out again since.
6
+ # with the booking in the condition they left in, refused for a unit that went out again or moved to another item since. Each unit's last checkout
7
+ # becomes this booking's checkout again (the schedule keeps it), so that checkout can still be cancelled after a
8
+ # checkout of another booking took the unit and was cancelled in between (audit 8 Nov L1).
7
9
  on: rental_return.cancelled
8
10
  steps:
9
11
  - {find: rental_schedule, where: booking == event.booking, as: s}
@@ -19,8 +21,8 @@ steps:
19
21
  do:
20
22
  - {find: rental_unit, where: name == row.unit, as: u}
21
23
  - create: rental_guard
22
- if: "u == null || u.state != 'in' || u.last_return != event.name"
24
+ if: "u == null || u.state != 'in' || u.last_return != event.name || u.rental_item != event.rental_item"
23
25
  set: {reason: "'unit_moved'", document: event.name}
24
26
  - update: u
25
27
  if: u != null
26
- set: {state: "'out'", booking: event.booking, condition: u.out_condition, last_return: "''"}
28
+ set: {state: "'out'", booking: event.booking, condition: u.out_condition, last_return: "''", last_checkout: "s != null ? s.checkout : ''"}
@@ -10,9 +10,10 @@ title_field: booking
10
10
  # Handover (berita acara serah terima): the checklist lists each unit handed over and its condition; an item with
11
11
  # track_units must list exactly the booked number of units, and the customer who receives them signs (signed_by,
12
12
  # required on submit). A photo and the drawn signature are attachments of this record (contract 0011); their ids are
13
- # kept in photo and signature, the image and signature fields of contract 0030 §5 (the camera and signature pad come
14
- # with kernel WS6). The BAST prints from rental_bast_out. The flow marks each unit out with this booking and refuses
15
- # a unit that is already out.
13
+ # kept in photo and signature (image and signature fields: the kernel accepts only an image attachment of this same
14
+ # record, contract 0030 §4). The warehouse fills it on the handover screen alat_keluar (opened from jadwal_alat with
15
+ # the booking prefilled): scan units, photo, signature, submit, BAST. The BAST prints from rental_bast_out. The flow
16
+ # marks each unit out with this booking and refuses a unit that is already out.
16
17
  permissions:
17
18
  - {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
18
19
  # warehouse staff hand the equipment over (no money moves on a checkout); undoing one is the admin's
@@ -33,19 +34,21 @@ fields:
33
34
  - {name: notes, type: text, label: {id: 'Catatan (kondisi alat, kelengkapan)'}}
34
35
  - {name: signed_by, type: data, label: {id: Diterima oleh (nama penyewa)}, in_list: true}
35
36
  - {name: handed_by, type: data, label: {id: Diserahkan oleh (petugas)}}
36
- - {name: photo, type: image, label: {id: Foto alat saat keluar}, help: {id: 'Id lampiran foto (att_...). Foto lain cukup dilampirkan ke catatan ini'}}
37
- - {name: signature, type: signature, label: {id: Tanda tangan penyewa}, help: {id: 'Id lampiran gambar tanda tangan (att_...)'}}
37
+ - {name: photo, type: image, label: {id: Foto alat saat keluar}, help: {id: 'Foto pertama dari layar serah terima; foto lain ikut terlampir di catatan ini'}}
38
+ - {name: signature, type: signature, label: {id: Tanda tangan penyewa}, help: {id: 'Ditandatangani di layar serah terima'}}
38
39
  rules:
39
40
  - name: booking_submitted
40
41
  on: save
41
42
  check: booking.docstatus == 1
42
43
  message: {id: Pesanan sewa belum diajukan atau sudah batal}
44
+ # The handover screen (screens/alat_keluar.rk) creates the draft from the schedule, then saves the checklist one
45
+ # scan at a time: the count is checked when it is submitted (the unit moves happen at submit).
43
46
  - name: units_required
44
- on: save
47
+ on: submit
45
48
  check: "!track_units || units.size() > 0"
46
49
  message: {id: 'Alat ini diserahkan per unit: isi checklist unit yang keluar'}
47
50
  - name: units_match_qty
48
- on: save
51
+ on: submit
49
52
  check: units.size() == 0 || units.size() == qty
50
53
  message: {id: Jumlah unit di checklist harus sama dengan jumlah unit pesanan}
51
54
  - name: units_of_item
@@ -68,14 +71,6 @@ rules:
68
71
  on: save
69
72
  check: signature == '' || signed_by != ''
70
73
  message: {id: Tanda tangan perlu nama penyewa yang menandatangani}
71
- - name: photo_is_attachment
72
- on: save
73
- check: "photo == '' || photo.startsWith('att_')"
74
- message: {id: 'Foto harus berupa lampiran catatan ini (id att_...)'}
75
- - name: signature_is_attachment
76
- on: save
77
- check: "signature == '' || signature.startsWith('att_')"
78
- message: {id: 'Tanda tangan harus berupa lampiran catatan ini (id att_...)'}
79
74
  views:
80
75
  list:
81
76
  columns: [name, booking, customer, rental_item, out_date, signed_by, status]
@@ -63,8 +63,8 @@ fields:
63
63
  - {value: transfer, label: {id: Transfer bank}}
64
64
  - {name: signed_by, type: data, label: {id: Diserahkan kembali oleh (nama penyewa)}, in_list: true}
65
65
  - {name: received_by, type: data, label: {id: Diterima oleh (petugas)}}
66
- - {name: photo, type: image, label: {id: Foto alat saat kembali}, help: {id: 'Id lampiran foto (att_...). Foto kerusakan lain cukup dilampirkan ke catatan ini'}}
67
- - {name: signature, type: signature, label: {id: Tanda tangan penyewa}, help: {id: 'Id lampiran gambar tanda tangan (att_...)'}}
66
+ - {name: photo, type: image, label: {id: Foto alat saat kembali}, help: {id: 'Foto pertama dari layar serah terima; foto kerusakan lain ikut terlampir di catatan ini'}}
67
+ - {name: signature, type: signature, label: {id: Tanda tangan penyewa}, help: {id: 'Ditandatangani di layar serah terima'}}
68
68
  rules:
69
69
  - name: booking_submitted
70
70
  on: save
@@ -84,7 +84,7 @@ rules:
84
84
  check: "damage_fee >= 0 && units.map(r, r.fee < 0 ? 1 : 0).sum() == 0"
85
85
  message: {id: Biaya kerusakan tidak boleh minus}
86
86
  - name: units_match_qty
87
- on: save
87
+ on: submit
88
88
  check: units.size() == 0 || units.size() == qty
89
89
  message: {id: 'Jumlah unit di checklist harus sama dengan jumlah unit pesanan (unit hilang tetap dicatat, kondisi Hilang)'}
90
90
  - name: units_of_item
@@ -108,14 +108,6 @@ rules:
108
108
  on: save
109
109
  check: signature == '' || signed_by != ''
110
110
  message: {id: Tanda tangan perlu nama penyewa yang menandatangani}
111
- - name: photo_is_attachment
112
- on: save
113
- check: "photo == '' || photo.startsWith('att_')"
114
- message: {id: 'Foto harus berupa lampiran catatan ini (id att_...)'}
115
- - name: signature_is_attachment
116
- on: save
117
- check: "signature == '' || signature.startsWith('att_')"
118
- message: {id: 'Tanda tangan harus berupa lampiran catatan ini (id att_...)'}
119
111
  views:
120
112
  list:
121
113
  columns: [name, booking, customer, return_date, late_days, signed_by, deposit_refund, extra_due, status]
@@ -37,6 +37,14 @@ fields:
37
37
  - {name: returned_date, type: date, label: {id: Tanggal kembali aktual}, read_only: true}
38
38
  - {name: checkout, type: link, to: rental_checkout, label: {id: Bukti alat keluar}, read_only: true}
39
39
  - {name: rental_return, type: link, to: rental_return, label: {id: Bukti alat kembali}, read_only: true}
40
+ # For the warehouse's route of the day (screens/jadwal_alat.rk): what to do with this booking today.
41
+ - {name: item_title, type: data, label: {id: Nama alat}, read_only: true, compute: "rental_item.title"}
42
+ - {name: customer_name, type: data, label: {id: Nama pelanggan}, read_only: true, compute: "customer.customer_name"}
43
+ - name: todo
44
+ type: data
45
+ label: {id: Tugas hari ini}
46
+ read_only: true
47
+ compute: "state == 'booked' ? 'Serahkan ke ' + customer_name : (state == 'out' ? 'Terima kembali dari ' + customer_name : '')"
40
48
  rules:
41
49
  # Made by rental_booking_on_submit inside the booking's submit; a row for a draft booking (made by hand) would hold
42
50
  # units for a booking that was never confirmed, and would block that booking's own row (booking is unique).
@@ -54,6 +54,13 @@ fields:
54
54
  - {name: last_return, type: link, to: rental_return, label: {id: Alat kembali terakhir}, read_only: true}
55
55
  - {name: active, type: check, label: {id: Masih dipakai}, default: 'true'}
56
56
  - {name: notes, type: text, label: {id: Catatan}}
57
+ rules:
58
+ # A unit out with a booking stays a unit of the booked item until it comes back (audit 8 Nov L2): moving it to another
59
+ # item's pool while out would lock the booking's return (units_of_item) and count it twice.
60
+ - name: item_locked_while_out
61
+ on: save
62
+ check: state != 'out' || booking == '' || rental_item == booking.rental_item
63
+ message: {id: 'Unit sedang keluar: alatnya tidak bisa diganti sampai unit kembali'}
57
64
  views:
58
65
  list:
59
66
  columns: [code, rental_item, serial_no, condition, state, booking]
@@ -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: rental
3
- version: 1.1.0
3
+ version: 1.2.0
4
4
  title: {id: Sewa alat, en: Equipment rental}
5
5
  summary:
6
6
  id: Sewa alat dengan jadwal tanpa bentrok, alat keluar dan kembali.
@@ -0,0 +1,19 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
2
+ name: alat_keluar
3
+ type: handover
4
+ label: {id: Serah alat keluar, en: Equipment out}
5
+ icon: truck
6
+ # Equipment goes out with proof (contract 0030 §2 handover, WS8): scan each unit (rental_unit.code), mark its
7
+ # condition, at least one photo, the renter signs, submit, print the BAST. Opened from jadwal_alat, the new draft gets
8
+ # the booking of that stop; otherwise the warehouse's drafts are offered. Units, deposit and schedule move in
9
+ # rental_checkout and its submit flow (audited there), not in the screen. Photos and the signature need the connection.
10
+ roles: [rental_staff, sales_manager]
11
+ device: tablet
12
+ needs: [scan, photo, signature, print]
13
+ handover:
14
+ document: {model: rental_checkout, find: "docstatus == 0", create: true, set: {booking: stop.booking}, title: item_title, subtitle: customer_name}
15
+ rows: {table: units, unit: unit, condition: condition, note: notes}
16
+ scan: {match: code}
17
+ photos: {field: photo, min: 1}
18
+ signature: {field: signature, by: signed_by}
19
+ print: rental_bast_out
@@ -0,0 +1,19 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
2
+ name: alat_kembali
3
+ type: handover
4
+ label: {id: Terima alat kembali, en: Equipment back}
5
+ icon: undo
6
+ # Equipment comes back with proof (contract 0030 §2 handover): scan each unit, mark its condition (Hilang for a lost
7
+ # one), photos of the damage, the renter signs. The warehouse only saves the checklist (submit: false): the damage
8
+ # fees and the submit, which pays the deposit back, stay with the admin (rental_return permissions). Opened from
9
+ # jadwal_alat the new draft gets the booking; return_date defaults to today, the actual day.
10
+ roles: [rental_staff, sales_manager]
11
+ device: tablet
12
+ needs: [scan, photo, signature]
13
+ handover:
14
+ document: {model: rental_return, find: "docstatus == 0", create: true, set: {booking: stop.booking}, title: item_title, subtitle: customer_name}
15
+ rows: {table: units, unit: unit, condition: condition, note: notes}
16
+ scan: {match: code}
17
+ photos: {field: photo, min: 1}
18
+ signature: {field: signature, by: signed_by}
19
+ submit: false
@@ -0,0 +1,21 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
2
+ name: jadwal_alat
3
+ type: route
4
+ label: {id: Jadwal alat hari ini, en: Today's equipment}
5
+ icon: calendar
6
+ # The warehouse's list of the day (plans/layar-kerja.md §3 #6-7): bookings whose equipment goes out today (or is
7
+ # overdue to go out) and those due back today or late. Each opens the handover screen with the booking prefilled
8
+ # (contract 0030 §2 route actions, ?stop=rental_schedule/<name>). No visit record and no position: the stops are at
9
+ # the counter, not places to drive to.
10
+ roles: [rental_staff, sales_manager]
11
+ device: tablet
12
+ route:
13
+ stops:
14
+ model: rental_schedule
15
+ filter: "(state == 'booked' && start_date <= today()) || (state == 'out' && end_date <= today())"
16
+ sort: start_date
17
+ title: item_title
18
+ subtitle: todo
19
+ actions:
20
+ - {label: {id: Serah keluar, en: Hand out}, screen: alat_keluar}
21
+ - {label: {id: Terima kembali, en: Take back}, screen: alat_kembali}
@@ -0,0 +1,47 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: collection_visit
3
+ label: {id: Kunjungan penagih, en: Collection visit}
4
+ icon: map
5
+ naming: KPG-{YYYY}-{#####}
6
+ title_field: customer_name
7
+ # The collector checked in at a subscriber's place (contract 0030 §2 route visit, screens/rute_tagih.rk): when, where
8
+ # the phone stood (geo) and a photo of the place. It moves no money: cash taken is a field_collection, deposited
9
+ # through collector_deposit. The distance from the subscriber's point is measured by the kernel (distance_m) so the
10
+ # finance team can see a visit made far from the house; a subscription without a point shows 0. Position and photo
11
+ # are set_once, and so are the subscriber and the time (a check-in cannot be moved afterwards, audit 2026-11-12 F6); the photo must be an attachment of this visit.
12
+ permissions:
13
+ - {role: collector, read: true, create: true, write: true}
14
+ - {role: finance_manager, read: true, export: true, print: true}
15
+ - {role: sales_manager, read: true}
16
+ fields:
17
+ - {name: subscription, type: link, to: subscription, label: {id: Langganan}, required: true, set_once: true, in_list: true}
18
+ - {name: customer_name, type: data, label: {id: Nama pelanggan}, compute: subscription.customer_name, in_list: true}
19
+ # Row scope of the collector role (roles/collector.rk): the member's own user record.
20
+ - {name: collector, type: link, to: user, label: {id: Penagih}, default: user.name, required: true, in_list: true}
21
+ - {name: visited_at, type: datetime, label: {id: Waktu kunjungan}, default: now(), required: true, set_once: true, in_list: true}
22
+ - {name: pos, type: geo, label: {id: Posisi saat kunjungan}, set_once: true}
23
+ - {name: photo, type: image, label: {id: Foto tempat}, set_once: true}
24
+ - {name: unpaid_amount, type: currency, label: {id: Belum dibayar saat kunjungan}, read_only: true, compute: subscription.unpaid_amount}
25
+ - {name: away_m, type: float, label: {id: Jarak dari titik pelanggan (m)}, hidden: true, read_only: true, compute: "distance_m(pos, subscription.location)"}
26
+ - name: distance_m
27
+ type: int
28
+ label: {id: Jarak dari titik pelanggan (m)}
29
+ read_only: true
30
+ in_list: true
31
+ compute: "away_m < 100000000.0 ? round(away_m) : 0"
32
+ - {name: notes, type: text, label: {id: Catatan}}
33
+ rules:
34
+ # The same area check as field_collection (flow field_collection_cap_*): a collector visits their own area's subscribers.
35
+ - name: own_area
36
+ on: save
37
+ check: subscription.collector == collector
38
+ message: {id: 'Langganan ini bukan di area penagih ini'}
39
+ - name: not_future
40
+ on: save
41
+ check: visited_at <= now()
42
+ message: {id: 'Waktu kunjungan tidak boleh sesudah sekarang'}
43
+ views:
44
+ list:
45
+ columns: [name, visited_at, customer_name, collector, distance_m, unpaid_amount]
46
+ filters: [collector, subscription]
47
+ sort: -visited_at
@@ -40,6 +40,8 @@ fields:
40
40
  label: {id: ID layanan}
41
41
  help: {id: 'Nomor pelanggan, user PPPoE, domain, atau nomor lisensi'}
42
42
  - {name: area, type: link, to: service_area, label: {id: Area}, in_list: true}
43
+ # Where the service is (the house, the shop): the collector's route sorts and measures by it (screens/rute_tagih.rk).
44
+ - {name: location, type: geo, label: {id: Titik lokasi pelanggan}}
43
45
  - {name: collector, type: link, to: user, label: {id: Penagih}, compute: area.collector}
44
46
  - name: cycle
45
47
  type: select
@@ -215,7 +217,7 @@ views:
215
217
  layout:
216
218
  - section: {id: Pelanggan}
217
219
  columns:
218
- - [customer, customer_name, phone, address]
220
+ - [customer, customer_name, phone, address, location]
219
221
  - [service_id, area, collector, status]
220
222
  - section: {id: Paket dan siklus}
221
223
  columns:
@@ -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: subscriptions
3
- version: 1.0.0
3
+ version: 1.1.0
4
4
  title: {id: Langganan, en: Subscriptions}
5
5
  summary:
6
6
  id: Paket langganan, tagihan tiap periode, area layanan dan setoran penagih.
@@ -0,0 +1,18 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/screen.json
2
+ name: catat_tagih
3
+ type: entry
4
+ label: {id: Catat uang tertagih, en: Record cash collected}
5
+ icon: wallet
6
+ # Cash taken at the subscriber's place (contract 0030 §2 entry): one field_collection. Opened from rute_tagih the
7
+ # subscription is filled (stop); opened alone the collector picks it. The flows field_collection_cap_* refuse more
8
+ # than what the subscription still owes and a subscriber of another area; the cash reaches the books through the
9
+ # collector's deposit (collector_deposit), checked by finance.
10
+ roles: [collector]
11
+ device: phone
12
+ offline: queue
13
+ entry:
14
+ model: field_collection
15
+ fields: [subscription, amount, notes]
16
+ set: {subscription: stop.name, collector: user.name}
17
+ submit: false
18
+ again: false