*       *       *       *       *       *       *       *       *       *       *       *       *       *       *       *       *       *       
*   servisni funkce v kantynovych datech 

*DO ppgm_http  WITH "https://alto:1991.Altopraha@c03-backend.production-c.asrv.cz/"
DO ppgm_http  WITH "https://admin:admin@c03-backend.production-c.asrv.cz/"



retez = '{ "password":"1991.Altopraha" }'
http_request('auth/crud/users/2', "PATCH", m.retez)


json = http_get("settings/crud/settings")
json = http_get("auth/crud/users")

getni()

http_request( 'settings/crud/settings', "POST", '{"key":"canteen.menu.confirmation","value":{"style":"global"}}' )
http_request( 'settings/crud/settings', "POST", '{"key":"auth.login.terminal_login","value":{"enabled":true}  }' )


RETURN
RETURN
RETURN




http_request( 'settings/crud/settings', "POST", '{"key":"canteen.menu","value":{"number_of_days":15, "show_days_wo_meals":false}}' )

http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_side","group":"lunch","display_name":"Přílohy"         ,"order_number":23, "is_additional":true}')






getni()

RETURN 
RETURN 
RETURN 





http_request("canteen/crud/course_groups" , "POST", '{"name":"lunch4"    ,"display_name":"Čtvrtý strávník" ,"served_at":"10:00:00","lock_before":"12:00:00","order_number":12}')
http_request("canteen/crud/course_groups" , "POST", '{"name":"lunch5"    ,"display_name":"Pátý strávník"   ,"served_at":"10:00:00","lock_before":"12:00:00","order_number":13}')


http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_pre4" ,"group":"lunch4","display_name":"Polévky a saláty","order_number":21, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_main4","group":"lunch4","display_name":"Hlavní jídla"    ,"order_number":22, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_side4","group":"lunch4","display_name":"Přílohy"         ,"order_number":23, "is_additional":true}')

http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_pre5" ,"group":"lunch5","display_name":"Polévky a saláty","order_number":25, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_main5","group":"lunch5","display_name":"Hlavní jídla"    ,"order_number":26, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_side5","group":"lunch5","display_name":"Přílohy"         ,"order_number":27, "is_additional":true}')





FOR iii = 1 TO 399
    id_txt = ALLTRIM(STR(m.iii))
    http_request("canteen/crud/orders/" + m.id_txt, "DELETE", "")
ENDFOR 

FOR iii = 444 TO 499
    id_txt = ALLTRIM(STR(m.iii))
    http_request("canteen/crud/meals/" + m.id_txt, "DELETE", "")
ENDFOR 





dat = '"2022-10-16"'

ml( '{"canteen":1, "course":"lunch_pre", "additional_course":null,"name":"Kuřecí polifka","description":"kureci polivka s nudli","date":[DAT],"number":1,"show_on_web":true,"stock_card_number":174,"additional_course_default_number":null}' )
ml( '{"canteen":1, "course":"lunch_pre", "additional_course":null,"name":"Kachní polifka","description":"kachni polivka s nudli","date":[DAT],"number":2,"show_on_web":true,"stock_card_number":176,"additional_course_default_number":null}' )

ml( '{"canteen":1,"course":"lunch_side","additional_course":null,"name":"brambory vařené, máslo","description":"brambory varene,maslo"  ,"date":[DAT],"number":8,"show_on_web":true,"stock_card_number":64,"additional_course_default_number":null}' )
ml( '{"canteen":1,"course":"lunch_side","additional_course":null,"name":"zelenina na másle"     ,"description":"zelenina var.maslo,150g","date":[DAT],"number":9,"show_on_web":true,"stock_card_number":88,"additional_course_default_number":null}' )

ml( '{"canteen":1,"course":"lunch_main","additional_course":"lunch_side","name":"Roštěná se šunkou","description":"rostena se sunkou" ,"date":[DAT],"number":3,"show_on_web":true,"stock_card_number":248,"additional_course_default_number":9}' )
ml( '{"canteen":1,"course":"lunch_main","additional_course":"lunch_side","name":"Vepřová plec  ","description":"vep.plec 150g","date":[DAT],"number":4,"show_on_web":true,"stock_card_number":3410,"additional_course_default_number":8}' )
ml( '{"canteen":1,"course":"lunch_main","additional_course":null,"name":"Kachni žebra v rejzi","description":"kachni zebdo s rejzi","date":[DAT],"number":5,"show_on_web":true,"stock_card_number":176,"additional_course_default_number":null}' )


ml( '{"canteen":1, "course":"lunch_pre2", "additional_course":null,"name":"Kureci polifka","description":"kureci polivka s nudli","date":[DAT],"number":1,"show_on_web":true,"stock_card_number":174,"additional_course_default_number":null}' )
ml( '{"canteen":1, "course":"lunch_pre2", "additional_course":null,"name":"Kachni polifka","description":"kachni polivka s nudli","date":[DAT],"number":2,"show_on_web":true,"stock_card_number":176,"additional_course_default_number":null}' )

ml( '{"canteen":1,"course":"lunch_side2","additional_course":null,"name":"brambory vařené, máslo","description":"brambory varene,maslo"  ,"date":[DAT],"number":8,"show_on_web":true,"stock_card_number":64,"additional_course_default_number":null}' )
ml( '{"canteen":1,"course":"lunch_side2","additional_course":null,"name":"zelenina na másle"     ,"description":"zelenina var.maslo,150g","date":[DAT],"number":9,"show_on_web":true,"stock_card_number":88,"additional_course_default_number":null}' )

ml( '{"canteen":1,"course":"lunch_main2","additional_course":"lunch_side2","name":"Roštěná se šunkou","description":"rostena se sunkou" ,"date":[DAT],"number":3,"show_on_web":true,"stock_card_number":248,"additional_course_default_number":9}' )
ml( '{"canteen":1,"course":"lunch_main2","additional_course":"lunch_side2","name":"Vepřová plec  ","description":"vep.plec 150g","date":[DAT],"number":4,"show_on_web":true,"stock_card_number":3410,"additional_course_default_number":8}' )
ml( '{"canteen":1,"course":"lunch_main2","additional_course":null,"name":"Kachni zebra v rejzi","description":"kachni zebdo s rejzi","date":[DAT],"number":5,"show_on_web":true,"stock_card_number":176,"additional_course_default_number":null}' )



ml( '{"canteen":1, "course":"lunch_pre3", "additional_course":null,"name":"Kureci polifka","description":"kureci polivka s nudli","date":[DAT],"number":1,"show_on_web":true,"stock_card_number":174,"additional_course_default_number":null}' )
ml( '{"canteen":1, "course":"lunch_pre3", "additional_course":null,"name":"Kachni polifka","description":"kachni polivka s nudli","date":[DAT],"number":2,"show_on_web":true,"stock_card_number":176,"additional_course_default_number":null}' )

ml( '{"canteen":1,"course":"lunch_side3","additional_course":null,"name":"brambory vařené, máslo","description":"brambory varene,maslo"  ,"date":[DAT],"number":8,"show_on_web":true,"stock_card_number":64,"additional_course_default_number":null}' )
ml( '{"canteen":1,"course":"lunch_side3","additional_course":null,"name":"zelenina na másle"     ,"description":"zelenina var.maslo,150g","date":[DAT],"number":9,"show_on_web":true,"stock_card_number":88,"additional_course_default_number":null}' )

ml( '{"canteen":1,"course":"lunch_main3","additional_course":"lunch_side3","name":"Roštěná se šunkou","description":"rostena se sunkou" ,"date":[DAT],"number":3,"show_on_web":true,"stock_card_number":248,"additional_course_default_number":9}' )
ml( '{"canteen":1,"course":"lunch_main3","additional_course":"lunch_side3","name":"Vepřová plec  ","description":"vep.plec 150g","date":[DAT],"number":4,"show_on_web":true,"stock_card_number":3410,"additional_course_default_number":8}' )
ml( '{"canteen":1,"course":"lunch_main3","additional_course":null,"name":"Kachni zebra v rejzi","description":"kachni zebdo s rejzi","date":[DAT],"number":5,"show_on_web":true,"stock_card_number":176,"additional_course_default_number":null}' )



ml( '{"canteen":1,"course":"lunch_main1","additional_course":null,"name":"Rostena se zelim rejzi","description":"rostena se sunkou a rejze" ,"date":[DAT],"number":1,"show_on_web":true,"stock_card_number":248,"additional_course_default_number":null}' )


getni()

RETURN 
RETURN 
RETURN 




*!*    http_request("canteen/crud/course_groups/lunch"  , "PATCH", '{"display_name":"Oběd"}')
*!*    http_request("canteen/crud/course_groups/lunch1" , "PATCH", '{"display_name":"Objednavka po limitu"}')

*!*    http_request("canteen/crud/course_groups/lunch2" , "PATCH", '{"display_name":"druhý strávník"}')
*!*    http_request("canteen/crud/course_groups/lunch3" , "PATCH", '{"display_name":"třetí strávník"}')

*!*    http_request("canteen/crud/courses/lunch_pre"   , "PATCH",  '{"display_name":"Polévky a saláty"}')
*!*    http_request("canteen/crud/courses/lunch_main"  , "PATCH",  '{"display_name":"Hlavní jídla"    }')
*!*    http_request("canteen/crud/courses/lunch_side"  , "PATCH",  '{"display_name":"Přílohy"         }')

*!*    http_request("canteen/crud/courses/lunch_pre2"   , "PATCH",  '{"display_name":"Polévky a saláty"}')
*!*    http_request("canteen/crud/courses/lunch_main2"  , "PATCH",  '{"display_name":"Hlavní jídla"    }')
*!*    http_request("canteen/crud/courses/lunch_side2"  , "PATCH",  '{"display_name":"Přílohy"         }')

*!*    http_request("canteen/crud/courses/lunch_pre3"   , "PATCH",  '{"display_name":"Polévky a saláty"}')
*!*    http_request("canteen/crud/courses/lunch_main3"  , "PATCH",  '{"display_name":"Hlavní jídla"    }')
*!*    http_request("canteen/crud/courses/lunch_side3"  , "PATCH",  '{"display_name":"Přílohy"         }')





*{"id":72254,"canteen":1,"course":"lunch_pre","additional_course":null,"name":"Ku°ecÝ vřvar s masem a kapßnÝm 1,3,7,9","description":"pol.kur.maso,kapani","date":"2022-04-01","number":1,"show_on_web":true,"stock_card_number":17479,"additional_course_default_number":null},
*{"id":72256,"canteen":1,"course":"lunch_pre","additional_course":null,"name":"Salßt zelnř s paprikami","description":"salat zelny s paprikami","date":"2022-04-01","number":3,"show_on_web":true,"stock_card_number":268,"additional_course_default_number":null},
*{"id":72257,"canteen":1,"course":"lunch_main","additional_course":"lunch_side","name":"150g RoÜtýnß se Üunkou a vejcem 3,7","description":"rostena se sunkou a vejci","date":"2022-04-01","number":1,"show_on_web":true,"stock_card_number":248,"additional_course_default_number":1},
*{"id":72258,"canteen":1,"course":"lunch_main","additional_course":"lunch_side","name":"150g Vep°ovß plec bratislavskß 1,7,9","description":"vep.plec bratislavska 150 *g","date":"2022-04-01","number":2,"show_on_web":true,"stock_card_number":3410,"additional_course_default_number":2},
*{"id":72259,"canteen":1,"course":"lunch_main","additional_course":"lunch_side","name":"150g Sma×enÚ ×ampiony, tatarskß omßŔka 1,3,7,9,10","description":"32023","date":"2022-04-01","number":3,"show_on_web":true,"stock_card_number":32023,"additional_course_default_number":3},
*{"id":72260,"canteen":1,"course":"lunch_side","additional_course":null,"name":"opeŔenÚ brambory","description":"","date":"2022-04-01","number":1,"show_on_web":true,"stock_card_number":65,"additional_course_default_number":null},
*{"id":72261,"canteen":1,"course":"lunch_side","additional_course":null,"name":"knedlÝky houskovÚ 1,3,7","description":"knedliky houskove","date":"2022-04-01","number":2,"show_on_web":true,"stock_card_number":96,"additional_course_default_number":null},





http_request("canteen/crud/courses/breakfast", "DELETE", '')
http_request("canteen/crud/courses/dinner"   , "DELETE", '')

http_request("canteen/crud/course_groups/breakfast", "DELETE", '')
http_request("canteen/crud/course_groups/dinner"   , "DELETE", '')



http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_pre2" ,"group":"lunch2","display_name":"Polévky a saláty","order_number":11, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_main2","group":"lunch2","display_name":"Hlavní jídla"    ,"order_number":12, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_side2","group":"lunch2","display_name":"Přílohy"         ,"order_number":13, "is_additional":true}')

http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_pre3" ,"group":"lunch3","display_name":"Polévky a saláty","order_number":15, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_main3","group":"lunch3","display_name":"Hlavní jídla"    ,"order_number":16, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_side3","group":"lunch3","display_name":"Přílohy"         ,"order_number":17, "is_additional":true}')

http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_main1","group":"lunch1","display_name":"HlavnÝ jÝdla"    ,"order_number":19, "is_additional":false}')


http_request("canteen/crud/course_groups" , "POST", '{"name":"lunch1"    ,"display_name":"Obýd1"   ,"served_at":"10:00:00","lock_before":"00:00:00","order_number":7}')
http_request("canteen/crud/course_groups" , "POST", '{"name":"lunch2"    ,"display_name":"Obýd2"   ,"served_at":"10:00:00","lock_before":"00:00:00","order_number":8}')
http_request("canteen/crud/course_groups" , "POST", '{"name":"lunch3"    ,"display_name":"Obýd3"   ,"served_at":"10:00:00","lock_before":"00:00:00","order_number":9}')


http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_pre" ,"group":"lunch","display_name":"PolÚvky a salßty","order_number":5, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_main","group":"lunch","display_name":"HlavnÝ jÝdla"    ,"order_number":6, "is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_side","group":"lunch","display_name":"P°Ýlohy"         ,"order_number":7, "is_additional":true}')






RETURN 
RETURN 
RETURN 


*http_request("canteen/crud/course_groups/lunch" , "PATCH", '{"served_at":"08:08:08","lock_before":"12:00:00"}')

*http_request("canteen/crud/courses/lunch", "DELETE", '')
*http_request("canteen/crud/courses"      , "POST", '{"name":"lunch_main","group":"lunch","display_name":"Hlavni jidla","order_number":6,"is_additional":false}')
http_request("canteen/crud/courses"      , "POST",  '{"name":"lunch_pre" ,"group":"lunch","display_name":"Polevky","order_number":2,"is_additional":false}')



json = http_get("sk/crud/bill_headers")
json = http_get("sk/crud/bill_items")
json = http_get("sk/crud/bill_payments")



http_request("canteen/crud/canteens", "POST", '{"name":"SKF CHodov","register_number":-999}')

http_request("canteen/crud/course_groups" , "POST", '{"name":"breakfast","display_name":"SnÝdaný","served_at":"06:00:00","lock_before":"00:00:00","order_number":1}')
http_request("canteen/crud/course_groups" , "POST", '{"name":"lunch"    ,"display_name":"Obýd"   ,"served_at":"10:00:00","lock_before":"00:00:00","order_number":2}')
http_request("canteen/crud/course_groups" , "POST", '{"name":"dinner"   ,"display_name":"VeŔe°e" ,"served_at":"18:00:00","lock_before":"00:00:00","order_number":3}')

http_request("canteen/crud/courses"       , "POST", '{"name":"lunch_main","group":"lunch","display_name":"Hlavní jídla"    ,"order_number":5,"served_at":"12:00:00"},"is_additional":false')



*2018-08-27T14:07  GET canteen/crud/canteens
*{"id":1,"name":"06 SnýmovnÝ 1","register_number":null}



*= http_request("canteen/crud/orders/605", "DELETE", '{"ordered":0}')
*= http_request("canteen/crud/orders/12", "PATCH", '{"ordered":0}')



*2018-08-27T14:07  GET canteen/crud/canteens
*{"id":1,"name":"06 SnýmovnÝ 1","register_number":null}
*{"id":2,"name":"01 SnýmovnÝ 4","register_number":null}

      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *
*2018-08-27T14:07  GET canteen/crud/course_groups
*{"name":"breakfast","display_name":"SnÝdaný","served_at":"06:00:00","lock_before":"00:00:00","order_number":1}
*{"name":"dinner","display_name":"VeŔe°e","served_at":"14:00:00","lock_before":"00:00:00","order_number":3}
*{"name":"lunch","display_name":"Obýd","served_at":"08:00:00","lock_before":"20:00:00","order_number":2}


*= http_request("canteen/crud/canteens/2", "PATCH", '{"register_number":23}')
*= http_request("canteen/crud/course_groups/lunch" , "PATCH", '{"served_at":"10:30:00","lock_before":"20:20:00"}')


*= http_request("canteen/crud/orders/13", "PATCH", '{"eaten":0}')

*= http_request("canteen/crud/course_groups/breakfast" , "PATCH", '{"name":"breakfast","display_name":"Snidane","served_at":"08:00:00","lock_before":"00:00:00","order_number":1}')
*= http_request("canteen/crud/course_groups/lunch"     , "PATCH", '{"name":"lunch"    ,"display_name":"Oběd"   ,"served_at":"09:00:00","lock_before":"00:00:00","order_number":2}')
*= http_request("canteen/crud/course_groups/dinner"    , "PATCH", '{"name":"dinner"   ,"display_name":"Večeře" ,"served_at":"18:00:00","lock_before":"00:00:00","order_number":3}')


*= http_request("canteen/crud/course_groups/lunch"     , "PATCH", '{"served_at":"11:30:00","lock_before":"22:00:00"}')

*{"name":"lunch","display_name":"Obed","served_at":"09:00:00","lock_before":"00:00:00","order_number":2}



*= http_request("canteen/crud/courses", "POST", '{"name":"lunch_pre" ,"group":"lunch","display_name":"Polévky a saláty","order_number":5,"served_at":"12:00:00"},"is_additional":false')
*= http_request("canteen/crud/courses", "POST", '{"name":"lunch_main","group":"lunch","display_name":"Hlavní jídla"    ,"order_number":6,"served_at":"12:00:00"},"is_additional":false')
*= http_request("canteen/crud/courses", "POST", '{"name":"lunch_side","group":"lunch","display_name":"Přílohy"         ,"order_number":7,"served_at":"12:00:00"},"is_additional":true')

*= http_request("canteen/crud/courses/lunch_side", "PATCH", '{"name":"lunch_side","group":"lunch","display_name":"Přílohy","order_number":7,"served_at":"12:00:00","is_additional":true}')

*= http_request("canteen/crud/courses/dinner", "PATCH", '{"order_number":9}')

*{"name":"dinner","group":"dinner","display_name":"Vecere","order_number":3,"is_additional":false}



*= http_request("canteen/crud/courses/lunch", "DELETE", '')

*radek = '{"name":"dinner","group":"dinner","display_name":"Vecere" ,"order_number":9,"served_at":"18:00:00"}'
*json = http_request("canteen/crud/courses/dinner", "PATCH", m.radek)

*{"name":"lunch_pre" ,"group":"lunch","display_name":"Polévky a saláty","order_number":2,"is_additional":false},
*{"name":"lunch_main","group":"lunch","display_name":"Hlavní jídla","order_number":3,"is_additional":false},
*{"name":"lunch_side","group":"lunch","display_name":"Prílohy 1","order_number":4,"is_additional":true},


*FOR iii = 1 TO 99
*    id_txt = ALLTRIM(STR(m.iii))
*    http_request("canteen/crud/meals/" + m.id_txt, "DELETE", "")
*ENDFOR 


json = http_get('canteen/crud/canteens')
json = http_get('canteen/crud/course_groups')
*json = http_get('canteen/crud/courses')
*json = http_get('canteen/crud/meals')
*json = http_get('canteen/crud/orders')

oznam_hotovo()


*      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *
FUNCTION ml (js)
js = STRTRAN(m.js, '[DAT]', m.dat)
http_request("canteen/crud/meals", "POST", m.js)


*      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *      *
PROCEDURE getni
*json = http_get('canteen/crud/canteens')
json = http_get('canteen/crud/course_groups')
json = http_get('canteen/crud/courses')
json = http_get("sk/crud/products")
json = http_get('canteen/crud/meals')
json = http_get('canteen/crud/orders')
