@rangka-os/create 0.5.0-alpha.10 → 0.5.0-alpha.12

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 (95) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/dapur/app.rk +35 -0
  3. package/template/base/apps/dapur/dashboards/dapur_hari_ini.rk +26 -0
  4. package/template/base/apps/fnb_cabang/app.rk +2 -2
  5. package/template/base/apps/fnb_cabang/dashboards/outlet_harian.rk +36 -0
  6. package/template/base/apps/jasa_proyek/app.rk +5 -2
  7. package/template/base/apps/jasa_proyek/dashboards/absen_saya.rk +15 -0
  8. package/template/base/apps/jasa_proyek/dashboards/rekap_absen.rk +18 -0
  9. package/template/base/apps/kelas_kursus/app.rk +1 -1
  10. package/template/base/apps/kelas_kursus/dashboards/kelas_saya.rk +41 -0
  11. package/template/base/apps/penjualan_harian/app.rk +1 -1
  12. package/template/base/apps/ritel_cabang/app.rk +1 -1
  13. package/template/base/apps/sewa_alat/app.rk +7 -5
  14. package/template/base/apps/sewa_alat/dashboards/alat_hari_ini.rk +90 -0
  15. package/template/base/apps/stok_outlet/app.rk +1 -1
  16. package/template/base/apps/stok_outlet/dashboards/outlet_hari_ini.rk +33 -0
  17. package/template/base/connectors/doku/connector.rk +128 -0
  18. package/template/base/connectors/doku/fixtures/create_checkout.json +6 -0
  19. package/template/base/connectors/doku/fixtures/expect.json +38 -0
  20. package/template/base/connectors/doku/fixtures/payment_notified.json +5 -0
  21. package/template/base/connectors/doku/fixtures/payment_notified_failed.json +3 -0
  22. package/template/base/connectors/doku/fixtures/payment_notified_no_type.json +3 -0
  23. package/template/base/connectors/doku/fixtures/payment_notified_null_type.json +3 -0
  24. package/template/base/connectors/doku/fixtures/payment_notified_refund.json +3 -0
  25. package/template/base/connectors/doku/mock/doku_mock.py +206 -0
  26. package/template/base/connectors/moka/connector.rk +46 -12
  27. package/template/base/connectors/moka/fixtures/expect.json +44 -0
  28. package/template/base/connectors/moka/fixtures/latest_transactions.json +79 -0
  29. package/template/base/connectors/moka/fixtures/list_items.json +4 -0
  30. package/template/base/connectors/moka/fixtures/list_outlets.json +4 -0
  31. package/template/base/connectors/moka/fixtures/transaction_created.json +44 -0
  32. package/template/base/connectors/moka/fixtures/transaction_created_refund.json +39 -0
  33. package/template/base/connectors/moka/fixtures/transaction_created_refund_later.json +51 -0
  34. package/template/base/modules/courses/models/course_batch.rk +7 -0
  35. package/template/base/modules/courses/models/course_session.rk +4 -1
  36. package/template/base/modules/courses/module.rk +1 -1
  37. package/template/base/modules/kitchen/flows/kitchen_ticket_on_sale.rk +29 -0
  38. package/template/base/modules/kitchen/flows/kitchen_ticket_on_update.rk +26 -0
  39. package/template/base/modules/kitchen/flows/kitchen_ticket_on_void.rk +15 -0
  40. package/template/base/modules/kitchen/models/kitchen_guard.rk +35 -0
  41. package/template/base/modules/kitchen/models/kitchen_route.rk +26 -0
  42. package/template/base/modules/kitchen/models/kitchen_station.rk +40 -0
  43. package/template/base/modules/kitchen/models/kitchen_ticket.rk +78 -0
  44. package/template/base/modules/kitchen/models/kitchen_ticket_item.rk +10 -0
  45. package/template/base/modules/kitchen/module.rk +18 -0
  46. package/template/base/modules/kitchen/print/kitchen_ticket.html +29 -0
  47. package/template/base/modules/kitchen/print/kitchen_ticket.rk +9 -0
  48. package/template/base/modules/kitchen/roles/kitchen.rk +6 -0
  49. package/template/base/modules/kitchen/screens/dapur.rk +22 -0
  50. package/template/base/modules/outlet_sales/flows/moka_daily_sales.rk +57 -0
  51. package/template/base/modules/outlet_sales/flows/moka_line_mapped.rk +14 -0
  52. package/template/base/modules/outlet_sales/flows/moka_transaction_staged.rk +90 -0
  53. package/template/base/modules/outlet_sales/models/moka_sale_line.rk +53 -0
  54. package/template/base/modules/outlet_sales/models/moka_transaction.rk +26 -0
  55. package/template/base/modules/outlet_sales/models/outlet_sales.rk +4 -3
  56. package/template/base/modules/outlet_sales/module.rk +1 -1
  57. package/template/base/modules/outlets/models/outlet.rk +9 -0
  58. package/template/base/modules/payments/flows/payment_from_doku.rk +73 -0
  59. package/template/base/modules/payments/models/payment.rk +1 -0
  60. package/template/base/modules/payments/module.rk +1 -1
  61. package/template/base/modules/projects/flows/attendance_close_cancel_guard.rk +15 -0
  62. package/template/base/modules/projects/flows/attendance_close_on_submit.rk +64 -0
  63. package/template/base/modules/projects/flows/attendance_log_cancel_guard.rk +14 -0
  64. package/template/base/modules/projects/flows/attendance_log_guard_created.rk +15 -0
  65. package/template/base/modules/projects/flows/attendance_log_guard_submitted.rk +34 -0
  66. package/template/base/modules/projects/flows/attendance_log_guard_updated.rk +14 -0
  67. package/template/base/modules/projects/flows/timesheet_attendance_overlap_guard.rk +20 -0
  68. package/template/base/modules/projects/models/assignment.rk +21 -1
  69. package/template/base/modules/projects/models/attendance_close.rk +63 -0
  70. package/template/base/modules/projects/models/attendance_guard.rk +57 -0
  71. package/template/base/modules/projects/models/attendance_log.rk +266 -0
  72. package/template/base/modules/projects/models/timesheet.rk +7 -1
  73. package/template/base/modules/projects/models/work_site.rk +73 -0
  74. package/template/base/modules/projects/module.rk +1 -1
  75. package/template/base/modules/projects/roles/field_worker.rk +7 -0
  76. package/template/base/modules/projects/roles/site_supervisor.rk +7 -0
  77. package/template/base/modules/rental/flows/rental_checkout_on_cancel.rk +11 -0
  78. package/template/base/modules/rental/flows/rental_checkout_on_submit.rk +13 -1
  79. package/template/base/modules/rental/flows/rental_return_on_cancel.rk +12 -1
  80. package/template/base/modules/rental/flows/rental_return_on_submit.rk +17 -0
  81. package/template/base/modules/rental/models/rental_booking.rk +1 -0
  82. package/template/base/modules/rental/models/rental_checkout.rk +61 -2
  83. package/template/base/modules/rental/models/rental_checkout_unit.rk +22 -0
  84. package/template/base/modules/rental/models/rental_guard.rk +21 -0
  85. package/template/base/modules/rental/models/rental_item.rk +10 -2
  86. package/template/base/modules/rental/models/rental_return.rk +67 -8
  87. package/template/base/modules/rental/models/rental_return_unit.rk +29 -0
  88. package/template/base/modules/rental/models/rental_schedule.rk +2 -0
  89. package/template/base/modules/rental/models/rental_unit.rk +73 -0
  90. package/template/base/modules/rental/module.rk +7 -1
  91. package/template/base/modules/rental/print/rental_bast_in.html +107 -0
  92. package/template/base/modules/rental/print/rental_bast_in.rk +9 -0
  93. package/template/base/modules/rental/print/rental_bast_out.html +98 -0
  94. package/template/base/modules/rental/print/rental_bast_out.rk +11 -0
  95. package/template/base/modules/rental/roles/rental_staff.rk +7 -0
@@ -0,0 +1,266 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: attendance_log
3
+ label: {id: Absen harian, en: Attendance log}
4
+ icon: clock
5
+ is_submittable: true
6
+ naming: ABS-{YYYY}{MM}-{#####}
7
+ title_field: worker_name
8
+ # One worker, one day at one work site: clocked in and out with the phone's position and a photo (A2, plans/layar-kerja.md
9
+ # §4.1; the record of the `clock` screen in contract 0030 §2 and §9, built later as WS9a). The worker creates it at clock-in
10
+ # (draft), fills the clock-out and submits it. A submitted log is one day present; attendance_close turns the days of a
11
+ # period into the monthly recap timesheet that payroll already reads (payslip_from_recap).
12
+ #
13
+ # Every log needs a clock-in photo. Inside the radius it submits at once. Outside the radius, with no position, entered
14
+ # late or with overtime, the submit waits for the site supervisor (contract 0007 approvals below), who sees the reason,
15
+ # the distance and the photo; a rejected log stays a draft and is not counted. Nothing is refused for being far away
16
+ # (contract 0030 §4, as Talenta and Gadjian do).
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).
23
+ #
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).
27
+ #
28
+ # Not linked to by any record while it is a draft (contract 0030 §10), so it can be submittable.
29
+ permissions:
30
+ # A worker sees and writes only their own logs (row scope worker = their worker record, roles/field_worker.rk). No cancel,
31
+ # no delete: a submitted day is corrected by the project admin.
32
+ - {role: field_worker, read: true, create: true, write: true, submit: true}
33
+ # The supervisor reads the logs of their sites and decides the held submits (approvals); writes nothing.
34
+ - {role: site_supervisor, read: true, print: true}
35
+ - {role: project_admin, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
36
+ - {role: finance_manager, read: true, export: true}
37
+ fields:
38
+ - name: worker
39
+ type: link
40
+ to: worker
41
+ label: {id: Tenaga kerja}
42
+ required: true
43
+ in_list: true
44
+ # The name, for the worker and the supervisor, who may not read worker records (they carry pay).
45
+ - name: worker_name
46
+ type: data
47
+ label: {id: Nama}
48
+ read_only: true
49
+ in_list: true
50
+ compute: "worker != '' ? worker.worker_name : ''"
51
+ - name: assignment
52
+ type: link
53
+ to: assignment
54
+ label: {id: Penugasan}
55
+ required: true
56
+ - name: project
57
+ type: link
58
+ to: project
59
+ label: {id: Proyek}
60
+ default: assignment.project
61
+ in_list: true
62
+ - name: work_site
63
+ type: link
64
+ to: work_site
65
+ label: {id: Lokasi kerja}
66
+ default: assignment.work_site
67
+ in_list: true
68
+ - name: work_date
69
+ type: date
70
+ label: {id: Tanggal}
71
+ required: true
72
+ default: today()
73
+ in_list: true
74
+ # Clock-in
75
+ - name: clock_in
76
+ type: datetime
77
+ label: {id: Jam masuk}
78
+ required: true
79
+ default: now()
80
+ 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)}}
87
+ # Clock-out
88
+ - name: clock_out
89
+ type: datetime
90
+ label: {id: Jam keluar}
91
+ 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)}}
97
+ - name: overtime_hours
98
+ type: float
99
+ label: {id: Jam lembur}
100
+ default: '0'
101
+ # Why the worker is outside the site, has no position, enters a past day or claims overtime.
102
+ - name: reason
103
+ type: text
104
+ label: {id: Alasan}
105
+ # The site's point and radius at the time of the log (frozen at submit with the rest of the record).
106
+ - {name: site_lat, type: float, label: {id: Lintang lokasi}, read_only: true, compute: "work_site != '' ? work_site.lat : 0"}
107
+ - {name: site_lng, type: float, label: {id: Bujur lokasi}, read_only: true, compute: "work_site != '' ? work_site.lng : 0"}
108
+ - {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"}
126
+ - name: in_inside
127
+ type: check
128
+ label: {id: Masuk di dalam radius}
129
+ 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).
132
+ - name: in_site_m
133
+ type: int
134
+ label: {id: Jarak masuk dari lokasi (m)}
135
+ 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"}
147
+ - name: out_inside
148
+ type: check
149
+ label: {id: Keluar di dalam radius}
150
+ read_only: true
151
+ compute: "out_located && work_site != '' && out_dx * out_dx + out_dy * out_dy <= site_radius_m * site_radius_m"
152
+ - name: out_site_m
153
+ type: int
154
+ label: {id: Jarak keluar dari lokasi (m)}
155
+ read_only: true
156
+ compute: "!out_located || work_site == '' ? 0 : round(out_r2)"
157
+ # Outside: clock-in not inside the radius (or no position), or a clock-out entered and not inside.
158
+ - name: outside_site
159
+ type: check
160
+ label: {id: Di luar radius}
161
+ read_only: true
162
+ in_list: true
163
+ chip: true
164
+ compute: "!in_inside || (clock_out != '' && !out_inside)"
165
+ # One live log per worker per day (flow attendance_log_guard_*: a cancelled one frees the day for its amendment).
166
+ - name: day_key
167
+ type: data
168
+ label: {id: Kunci hari}
169
+ hidden: true
170
+ read_only: true
171
+ compute: "worker + ':' + work_date"
172
+ rules:
173
+ - name: assignment_of_worker
174
+ on: save
175
+ check: assignment == '' || assignment.worker == worker
176
+ message: {id: 'Penugasan ini bukan milik tenaga kerja ini'}
177
+ - name: within_assignment
178
+ on: save
179
+ check: assignment == '' || (work_date >= assignment.start_date && work_date <= assignment.end_date)
180
+ message: {id: 'Tanggal absen di luar masa penugasan'}
181
+ - name: same_project_and_site
182
+ on: save
183
+ check: assignment == '' || (project == assignment.project && work_site == assignment.work_site)
184
+ message: {id: 'Proyek dan lokasi kerja mengikuti penugasan'}
185
+ - name: has_site
186
+ on: save
187
+ check: work_site != ''
188
+ message: {id: 'Penugasan ini belum punya lokasi kerja; minta admin proyek mengisinya'}
189
+ - name: not_future
190
+ on: save
191
+ check: work_date <= today()
192
+ 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
198
+ 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)'}
201
+ - name: out_after_in
202
+ on: save
203
+ check: clock_out == '' || clock_out > clock_in
204
+ message: {id: 'Jam keluar harus sesudah jam masuk'}
205
+ - name: overtime_range
206
+ on: save
207
+ check: overtime_hours >= 0 && overtime_hours <= 12
208
+ message: {id: 'Jam lembur 0 sampai 12 jam per hari'}
209
+ - name: reason_when_outside
210
+ on: save
211
+ check: "!outside_site || size(reason) >= 5"
212
+ message: {id: 'Kamu di luar radius lokasi kerja (atau lokasi tidak terbaca): tulis alasannya'}
213
+ - name: reason_when_overtime
214
+ on: save
215
+ check: overtime_hours == 0 || size(reason) >= 5
216
+ message: {id: 'Tulis alasan atau pekerjaan lemburnya'}
217
+ - name: clocked_out
218
+ on: submit
219
+ check: clock_out != ''
220
+ message: {id: 'Isi jam keluar dulu (absen pulang) sebelum diajukan'}
221
+ # Every clock-in carries a photo (audit 8 Nov H2): a log inside the radius is counted without anyone deciding it, and a
222
+ # worker knows the site's point, so the photo is the evidence the supervisor and the admin can check afterwards.
223
+ - name: photo_required
224
+ on: submit
225
+ check: in_photo != ''
226
+ message: {id: 'Absen butuh foto masuk'}
227
+ # Held for the site supervisor (contract 0007); the owner may always approve. The verb then runs as the worker.
228
+ approvals:
229
+ - name: outside_site
230
+ on: submit
231
+ when: outside_site
232
+ approvers: [site_supervisor]
233
+ label: {id: Absen di luar radius lokasi kerja, en: Clock-in outside the site radius}
234
+ - name: late_entry
235
+ on: submit
236
+ when: days_between(work_date, today()) > 1
237
+ approvers: [site_supervisor]
238
+ label: {id: Absen diisi lebih dari sehari kemudian, en: Attendance entered more than a day late}
239
+ - name: overtime
240
+ on: submit
241
+ when: overtime_hours > 0
242
+ approvers: [site_supervisor]
243
+ label: {id: Lembur, en: Overtime}
244
+ views:
245
+ list:
246
+ columns: [name, worker_name, work_site, work_date, clock_in, clock_out, outside_site, status]
247
+ sort: -work_date
248
+ form:
249
+ layout:
250
+ - section: {id: Absen}
251
+ columns:
252
+ - [worker, assignment, project, work_site]
253
+ - [work_date, overtime_hours, outside_site]
254
+ - section: {id: Masuk}
255
+ columns:
256
+ - [clock_in, in_photo, in_site_m, in_inside]
257
+ - [in_lat, in_lng, in_accuracy_m, in_distance_m]
258
+ - section: {id: Keluar}
259
+ columns:
260
+ - [clock_out, out_photo, out_site_m, out_inside]
261
+ - [out_lat, out_lng, out_accuracy_m, out_distance_m]
262
+ - section: {id: Alasan}
263
+ fields: [reason]
264
+ - section: {id: Lokasi kerja}
265
+ columns:
266
+ - [site_lat, site_lng, site_radius_m]
@@ -53,6 +53,12 @@ fields:
53
53
  type: text
54
54
  label: {id: Uraian pekerjaan}
55
55
  required: true
56
+ # Made by a field attendance close (attendance_close_on_submit) from the daily logs; empty for typed or imported recaps.
57
+ - name: attendance_close
58
+ type: link
59
+ to: attendance_close
60
+ label: {id: Rekap absen lapangan}
61
+ read_only: true
56
62
  - name: evidence
57
63
  type: attach
58
64
  label: {id: Bukti kerja}
@@ -152,7 +158,7 @@ views:
152
158
  - [work_date, period_to, days, hours, overtime_hours]
153
159
  - section: {id: Pekerjaan}
154
160
  columns:
155
- - [description, evidence]
161
+ - [description, evidence, attendance_close]
156
162
  - section: {id: Tagihan}
157
163
  columns:
158
164
  - [billable, rate_basis, day_rate, hour_rate, overtime_rate, amount]
@@ -0,0 +1,73 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: work_site
3
+ label: {id: Lokasi kerja, en: Work site}
4
+ icon: map
5
+ naming: LOK-{###}
6
+ title_field: site_name
7
+ # Where workers clock in: a client's factory, a building a guard keeps, an office a cleaner works in (A2, plans/layar-kerja.md
8
+ # §4.1, the `site` slot of the clock screen in contract 0030). A clock-in further than radius_m from the point (lat, lng) is
9
+ # kept, not refused, and waits for the site supervisor (attendance_log). The site supervisor's row scope is the members'
10
+ # `outlets` list holding site codes (LOK-001), see roles/site_supervisor.rk.
11
+ permissions:
12
+ - {role: project_admin, read: true, create: true, write: true, delete: true, export: true, print: true}
13
+ - {role: finance_manager, read: true}
14
+ # A site supervisor reads only their own sites (row scope by name). A worker reads the point of their own site through
15
+ # the assignment (site_lat, site_lng, site_radius_m), not the list of the firm's client sites.
16
+ - {role: site_supervisor, read: true}
17
+ fields:
18
+ - name: site_name
19
+ type: data
20
+ label: {id: Nama lokasi}
21
+ required: true
22
+ in_list: true
23
+ - name: customer
24
+ type: link
25
+ to: customer
26
+ label: {id: Klien}
27
+ in_list: true
28
+ - name: address
29
+ type: text
30
+ label: {id: Alamat}
31
+ # Decimal degrees, as a phone's GPS or a map gives them (Karawang is about -6.3, 107.3).
32
+ - name: lat
33
+ type: float
34
+ label: {id: Lintang (lat)}
35
+ required: true
36
+ - name: lng
37
+ type: float
38
+ label: {id: Bujur (lng)}
39
+ required: true
40
+ - name: radius_m
41
+ type: int
42
+ label: {id: Radius absen (meter)}
43
+ default: '150'
44
+ in_list: true
45
+ - name: active
46
+ type: check
47
+ label: {id: Aktif}
48
+ default: 'true'
49
+ in_list: true
50
+ - name: notes
51
+ type: text
52
+ label: {id: Catatan}
53
+ rules:
54
+ - name: point_valid
55
+ on: save
56
+ check: lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180 && (lat != 0 || lng != 0)
57
+ 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
+ - name: radius_range
60
+ on: save
61
+ check: radius_m >= 20 && radius_m <= 5000
62
+ message: {id: 'Radius absen 20 sampai 5000 meter'}
63
+ views:
64
+ list:
65
+ columns: [name, site_name, customer, radius_m, active]
66
+ form:
67
+ layout:
68
+ - section: {id: Lokasi}
69
+ columns:
70
+ - [site_name, customer, active]
71
+ - [lat, lng, radius_m]
72
+ - section: {id: Alamat}
73
+ fields: [address, notes]
@@ -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.0.0
3
+ version: 1.1.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.
@@ -0,0 +1,7 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
2
+ name: field_worker
3
+ label: {id: Pekerja lapangan}
4
+ description: {id: 'Absen masuk dan pulang di lokasi kerja, dan melihat absennya sendiri'}
5
+ # Contract 0010 §5: records whose worker is the member's own worker record (rangka user add --record WRK-0001), so a
6
+ # worker sees only their own logs and assignments. Pay and selling rates of an assignment are hidden (contract 0027).
7
+ scope: {field: worker, from: '[user.name]'}
@@ -0,0 +1,7 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
2
+ name: site_supervisor
3
+ label: {id: Pengawas lokasi}
4
+ description: {id: 'Mandor atau danru: melihat absen lokasi kerjanya dan menyetujui absen di luar radius, terlambat diisi atau lembur'}
5
+ # Contract 0010 §5: records whose work_site is one of the member's places of work. The kernel keeps one list of places per
6
+ # member, `outlets` (rangka user add --outlets LOK-001,LOK-002); for this role it holds work site codes.
7
+ scope: {field: work_site, from: user.outlets}
@@ -2,6 +2,7 @@
2
2
  name: rental_checkout_on_cancel
3
3
  label: {id: Alat keluar dibatalkan}
4
4
  # A checkout entered by mistake: the schedule goes back to booked, refused once the equipment is recorded as returned.
5
+ # Its units go back to the warehouse (refused for a unit that another document has moved since).
5
6
  on: rental_checkout.cancelled
6
7
  steps:
7
8
  - {find: rental_schedule, where: booking == event.booking, as: s}
@@ -11,3 +12,13 @@ steps:
11
12
  - update: s
12
13
  if: s != null
13
14
  set: {state: "'booked'", out_date: "null", checkout: "''"}
15
+ - for_each: event.units
16
+ as: row
17
+ do:
18
+ - {find: rental_unit, where: name == row.unit, as: u}
19
+ - create: rental_guard
20
+ if: "u == null || u.state != 'out' || u.booking != event.booking || u.last_checkout != event.name"
21
+ set: {reason: "'unit_moved'", document: event.name}
22
+ - update: u
23
+ if: u != null
24
+ set: {state: "'in'", booking: "''", last_checkout: "''"}
@@ -4,7 +4,9 @@ label: {id: Alat keluar dicatat}
4
4
  # The booking must be waiting to go out (schedule booked): a second checkout of the same booking, or one of a
5
5
  # cancelled booking, is refused. The units physically out (other bookings still out, also late ones) plus this one
6
6
  # may not exceed the item's units. The schedule becomes out with the actual date. Reads rental_item before
7
- # rental_schedule, like every flow of this module (one lock order).
7
+ # rental_schedule, then rental_unit, like every flow of this module (one lock order). Each unit on the checklist must
8
+ # be in the warehouse, still used, and not last recorded broken or lost; it becomes out with this booking, and its
9
+ # condition is the one on the checklist (kept as out_condition for a cancelled return).
8
10
  on: rental_checkout.submitted
9
11
  steps:
10
12
  - {find: rental_item, where: name == event.rental_item, as: ri}
@@ -19,3 +21,13 @@ steps:
19
21
  - update: s
20
22
  if: s != null
21
23
  set: {state: "'out'", out_date: event.out_date, checkout: event.name}
24
+ - for_each: event.units
25
+ as: row
26
+ do:
27
+ - {find: rental_unit, where: name == row.unit, as: u}
28
+ - create: rental_guard
29
+ if: "u == null || u.state != 'in' || !u.active || u.condition == 'rusak' || u.condition == 'hilang'"
30
+ set: {reason: "'unit_busy'", document: event.name}
31
+ - update: u
32
+ if: u != null
33
+ set: {state: "'out'", booking: event.booking, condition: row.condition, out_condition: row.condition, last_checkout: event.name}
@@ -2,7 +2,8 @@
2
2
  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
- # refused while the invoice for what the deposit did not cover is submitted (cancel that first).
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
7
  on: rental_return.cancelled
7
8
  steps:
8
9
  - {find: rental_schedule, where: booking == event.booking, as: s}
@@ -13,3 +14,13 @@ steps:
13
14
  - update: s
14
15
  if: s != null && s.rental_return == event.name
15
16
  set: {state: "'out'", returned_date: "null", rental_return: "''"}
17
+ - for_each: event.units
18
+ as: row
19
+ do:
20
+ - {find: rental_unit, where: name == row.unit, as: u}
21
+ - create: rental_guard
22
+ if: "u == null || u.state != 'in' || u.last_return != event.name"
23
+ set: {reason: "'unit_moved'", document: event.name}
24
+ - update: u
25
+ if: u != null
26
+ set: {state: "'out'", booking: event.booking, condition: u.out_condition, last_return: "''"}
@@ -5,10 +5,27 @@ label: {id: Alat kembali dicatat}
5
5
  # before the equipment went out. The schedule becomes returned with the actual date. The deposit journal (2-1400
6
6
  # against 4-9200 and cash or bank) is gl_rental_return_post. What the deposit does not cover (in a PKP business: all
7
7
  # of the fee, with PPN on the invoice) becomes a draft invoice whose notes carry this return's number in ().
8
+ # Units: the checklist must list exactly the units out with this booking (none for a booking that went out without a
9
+ # checklist); each goes back to the warehouse with the condition on the checklist (a lost one stays recorded hilang
10
+ # and cannot go out again until someone changes its condition).
8
11
  on: rental_return.submitted
9
12
  steps:
10
13
  - {find: rental_item, where: name == event.rental_item, as: ri}
11
14
  - {find: rental_schedule, where: booking == event.booking, as: s}
15
+ - {find_all: rental_unit, where: "booking == event.booking && state == 'out'", as: outs}
16
+ - create: rental_guard
17
+ if: outs.size() != event.units.size()
18
+ set: {reason: "'units_mismatch'", document: event.name}
19
+ - for_each: event.units
20
+ as: row
21
+ do:
22
+ - {find: rental_unit, where: name == row.unit, as: u}
23
+ - create: rental_guard
24
+ if: "u == null || u.state != 'out' || u.booking != event.booking"
25
+ set: {reason: "'unit_not_out'", document: event.name}
26
+ - update: u
27
+ if: u != null
28
+ set: {state: "'in'", booking: "''", condition: row.condition, last_return: event.name}
12
29
  - create: rental_guard
13
30
  if: s == null || s.state != 'out'
14
31
  set: {reason: "'not_out'", document: event.name}
@@ -14,6 +14,7 @@ title_field: customer
14
14
  permissions:
15
15
  - {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
16
16
  - {role: finance_manager, read: true, cancel: true, export: true, print: true}
17
+ - {role: rental_staff, read: true}
17
18
  - {role: head_office, read: true, export: true, print: true}
18
19
  fields:
19
20
  - name: customer
@@ -7,8 +7,16 @@ naming: KLR-{YYYY}-{#####}
7
7
  title_field: booking
8
8
  # The equipment of a booking leaves on its actual date. Submitting it moves the booking's schedule from booked to out
9
9
  # (flow rental_checkout_on_submit refuses a booking that is not waiting to go out); cancelling it moves it back.
10
+ # Handover (berita acara serah terima): the checklist lists each unit handed over and its condition; an item with
11
+ # track_units must list exactly the booked number of units, and the customer who receives them signs (signed_by,
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.
10
16
  permissions:
11
17
  - {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
18
+ # warehouse staff hand the equipment over (no money moves on a checkout); undoing one is the admin's
19
+ - {role: rental_staff, read: true, create: true, write: true, delete: true, submit: true, export: true, print: true}
12
20
  - {role: finance_manager, read: true, export: true, print: true}
13
21
  - {role: head_office, read: true, export: true, print: true}
14
22
  fields:
@@ -16,22 +24,73 @@ fields:
16
24
  - {name: customer, type: data, label: {id: Pelanggan}, compute: booking.customer, in_list: true}
17
25
  - {name: rental_item, type: data, label: {id: Alat}, compute: booking.rental_item, in_list: true}
18
26
  - {name: qty, type: int, label: {id: Jumlah unit}, compute: booking.qty}
27
+ # names for the BAST (prints only resolve top-level links)
28
+ - {name: customer_name, type: data, label: {id: Nama pelanggan}, hidden: true, compute: booking.customer.customer_name}
29
+ - {name: item_title, type: data, label: {id: Nama alat}, hidden: true, compute: booking.rental_item.title}
30
+ - {name: track_units, type: check, label: {id: Serah terima per unit}, compute: booking.rental_item.track_units}
19
31
  - {name: out_date, type: date, label: {id: Tanggal keluar}, required: true, default: today(), in_list: true}
32
+ - {name: units, type: table, of: rental_checkout_unit, label: {id: Checklist unit}}
20
33
  - {name: notes, type: text, label: {id: 'Catatan (kondisi alat, kelengkapan)'}}
34
+ - {name: signed_by, type: data, label: {id: Diterima oleh (nama penyewa)}, in_list: true}
35
+ - {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_...)'}}
21
38
  rules:
22
39
  - name: booking_submitted
23
40
  on: save
24
41
  check: booking.docstatus == 1
25
42
  message: {id: Pesanan sewa belum diajukan atau sudah batal}
43
+ - name: units_required
44
+ on: save
45
+ check: "!track_units || units.size() > 0"
46
+ message: {id: 'Alat ini diserahkan per unit: isi checklist unit yang keluar'}
47
+ - name: units_match_qty
48
+ on: save
49
+ check: units.size() == 0 || units.size() == qty
50
+ message: {id: Jumlah unit di checklist harus sama dengan jumlah unit pesanan}
51
+ - name: units_of_item
52
+ on: save
53
+ check: "units.map(r, r.unit_item == rental_item ? 0 : 1).sum() == 0"
54
+ message: {id: Ada unit dari alat lain di checklist}
55
+ - name: units_unique
56
+ on: save
57
+ check: "units.map(r, units.map(x, x.unit == r.unit ? 1 : 0).sum()).sum() == units.size()"
58
+ message: {id: Unit yang sama tercatat dua kali di checklist}
59
+ - name: unit_fit
60
+ on: save
61
+ check: "units.map(r, r.condition == 'rusak' || r.condition == 'hilang' ? 1 : 0).sum() == 0"
62
+ message: {id: 'Unit rusak atau hilang tidak bisa disewakan. Ganti dengan unit lain.'}
63
+ - name: signed_by_required
64
+ on: submit
65
+ check: "!track_units || signed_by != ''"
66
+ message: {id: Isi nama penyewa yang menerima alat (tanda tangan berita acara)}
67
+ - name: signature_needs_name
68
+ on: save
69
+ check: signature == '' || signed_by != ''
70
+ 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_...)'}
26
79
  views:
27
80
  list:
28
- columns: [name, booking, customer, rental_item, out_date, status]
81
+ columns: [name, booking, customer, rental_item, out_date, signed_by, status]
29
82
  sort: -out_date
30
83
  form:
31
84
  layout:
32
85
  - section: {id: Alat keluar}
33
86
  columns:
34
87
  - [booking, out_date]
35
- - [customer, rental_item, qty]
88
+ - [customer, rental_item, qty, track_units]
89
+ - section: {id: Checklist unit}
90
+ fields: [units]
91
+ - section: {id: Serah terima}
92
+ columns:
93
+ - [signed_by, handed_by]
94
+ - [photo, signature]
36
95
  - section: {id: Catatan}
37
96
  fields: [notes]
@@ -0,0 +1,22 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # A row of the checkout checklist: one unit handed to the customer and its condition as both sides saw it. A unit
3
+ # that is broken or missing cannot go out (rules of rental_checkout); scratches are noted and go out.
4
+ name: rental_checkout_unit
5
+ is_child: true
6
+ fields:
7
+ - {name: unit, type: link, to: rental_unit, label: {id: Unit}, required: true, peek: [serial_no, condition]}
8
+ - {name: unit_code, type: data, label: {id: Kode unit}, compute: unit.code}
9
+ - {name: serial_no, type: data, label: {id: Nomor seri}, compute: unit.serial_no}
10
+ # the rental item of the unit picked (rule units_of_item: a unit of this checkout's item)
11
+ - {name: unit_item, type: data, label: {id: Alat unit}, hidden: true, compute: unit.rental_item}
12
+ - name: condition
13
+ type: select
14
+ label: {id: Kondisi}
15
+ required: true
16
+ default: "'lengkap'"
17
+ options:
18
+ - {value: lengkap, label: {id: 'Lengkap, baik'}}
19
+ - {value: lecet, label: {id: Lecet}}
20
+ - {value: rusak, label: {id: Rusak}}
21
+ - {value: hilang, label: {id: Hilang}}
22
+ - {name: notes, type: data, label: {id: Catatan}, help: {id: 'Misalnya baterai 2, tas, strap; lecet di sisi kiri'}}
@@ -10,6 +10,7 @@ title_field: reason
10
10
  permissions:
11
11
  - {role: sales_manager, create: true}
12
12
  - {role: finance_manager, create: true}
13
+ - {role: rental_staff, create: true}
13
14
  fields:
14
15
  - name: reason
15
16
  type: select
@@ -26,6 +27,10 @@ fields:
26
27
  - {value: invoice_tag, label: {id: Catatan faktur sewa diubah}}
27
28
  - {value: still_out, label: {id: Unit masih di luar}}
28
29
  - {value: before_out, label: {id: Kembali sebelum keluar}}
30
+ - {value: unit_busy, label: {id: Unit tidak bisa keluar}}
31
+ - {value: unit_not_out, label: {id: Unit bukan milik pesanan ini}}
32
+ - {value: units_mismatch, label: {id: Unit kembali tidak sama dengan unit keluar}}
33
+ - {value: unit_moved, label: {id: Unit sudah dipakai lagi}}
29
34
  - name: document
30
35
  type: data
31
36
  label: {id: Dokumen}
@@ -70,3 +75,19 @@ rules:
70
75
  on: save
71
76
  check: reason != 'before_out'
72
77
  message: {id: Tanggal kembali tidak boleh sebelum tanggal alat keluar}
78
+ - name: unit_busy
79
+ on: save
80
+ check: reason != 'unit_busy'
81
+ message: {id: 'Ada unit yang masih keluar, sudah tidak dipakai, atau tercatat rusak atau hilang. Pilih unit lain, atau ubah kondisinya setelah diperbaiki.'}
82
+ - name: unit_not_out
83
+ on: save
84
+ check: reason != 'unit_not_out'
85
+ message: {id: 'Ada unit di checklist yang tidak sedang keluar untuk pesanan ini.'}
86
+ - name: units_mismatch
87
+ on: save
88
+ check: reason != 'units_mismatch'
89
+ message: {id: 'Unit yang kembali harus sama dengan semua unit yang keluar untuk pesanan ini (unit hilang tetap dicatat, kondisi Hilang).'}
90
+ - name: unit_moved
91
+ on: save
92
+ check: reason != 'unit_moved'
93
+ message: {id: 'Ada unit yang sudah tercatat keluar atau kembali di dokumen lain sesudah ini. Batalkan dokumen itu dulu.'}