Commit 40a5ffbf authored by Dave Griffiths's avatar Dave Griffiths

removed save button - saving all the time

parent 1bbfac8d
......@@ -100,7 +100,10 @@
;;
(begin
(msg "entity-set-value! - adding new " key "of type" type "to entity")
(entity-add-value-create! key type value)))))
(entity-add-value-create! key type value)))
;; save straight to local db every time
(entity-update-single-value! (list key type value))
))
(define (date-time->string dt)
......@@ -155,6 +158,17 @@
(else
(msg "no values or no id to update as entity:" unique-id "values:" values))))))
(define (entity-update-single-value! ktv)
(let ((db (get-current 'db #f))
(table (get-current 'table #f))
(unique-id (ktv-get (get-current 'entity-values '()) "unique_id")))
(cond
(unique-id
(update-entity db table (entity-id-from-unique db table unique-id) (list ktv)))
(else
(msg "no values or no id to update as entity:" unique-id "values:" values)))))
(define (entity-reset!)
(set-current! 'entity-values '())
(set-current! 'db "reset")
......
......@@ -328,20 +328,20 @@
(layout 'fill-parent 'fill-parent 1 'centre 0)
(list 0 0 0 0)
(list
(mbutton-scale
'save
(lambda ()
(list
(alert-dialog
"ok-check"
(mtext-lookup 'save-are-you-sure)
(lambda (v)
(cond
((eqv? v 1)
(entity-update-values!)
(list))
(else
(list))))))))
; (mbutton-scale
; 'save
; (lambda ()
; (list
; (alert-dialog
; "ok-check"
; (mtext-lookup 'save-are-you-sure)
; (lambda (v)
; (cond
; ((eqv? v 1)
; (entity-update-values!)
; (list))
; (else
; (list))))))))
(mbutton-scale 'back (lambda () (list (finish-activity 1))))))
(lambda (fragment arg)
(activity-layout fragment))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment