{
	"onmousedown": "ontouchstart",
	"tag": "app",
	"label": "reminder",
	"id": "x307979324",
	"children": [],
	"properties": [],
	"methods": [],
	"classes": [
		{
			"tag": "app_cls",
			"id": "reminderManager",
			"properties": [
				{
					"tag": "app_pro",
					"id": "fields",
					"type": "[{field}]",
					"docs": {
						"files": [],
						"text": "Colonnes de grille affichant la liste des rappels. Si elles ne sont pas précisées alors ce sera celles de l'objet éventuellement associé. Sinon ce sera simplement la date et le libellé "
					},
					"tabs": []
				},
				{
					"tag": "app_pro",
					"id": "reminds",
					"type": "[{remind}]",
					"docs": {
						"files": [],
						"text": "Ensemble des rappels auxiliaires qui ne sont pas encore dans la liste des rappels \n\nIls sont toujours liés à un rappel maître.\n Dans le cas où un rappel est annoncé N fois à l'avance il y a N+1 rappels auxiliaires (le dernier correspondant à celui de l'heure prévue)\n\nLa liste des rappels qui apparaît à l'utilisateur affiche en réalité les rappels auxiliaires"
					},
					"tabs": []
				},
				{
					"tag": "app_pro",
					"id": "obj",
					"type": "#object",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_pro",
					"id": "reminders",
					"type": "[{reminder}]",
					"docs": {
						"files": [],
						"text": "Ensemble des rappels maîtres \n\n"
					},
					"tabs": []
				},
				{
					"tag": "app_pro",
					"id": "remindeds",
					"type": "[{reminded}]",
					"docs": {
						"files": [],
						"text": "Ensemble des rappels génériques déjà dans la liste des rappeld"
					},
					"tabs": []
				}
			],
			"methods": [
				{
					"tag": "app_fn",
					"id": "initDefaulFields",
					"proto": "()",
					"code": "this.fields=[\n  {tag:\"field\", id:\"dateBegin\", type:\"dateTime\", label:\"DateBegin\"},\n  {tag:\"field\", id:\"label\", type:\"string\", label:\"Label\"}\n  ]",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "afterInit",
					"proto": "()",
					"code": "if(!this.obj && !this.fields.length)this.initDefaultFields()\nthis.updateRemindeds()",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "addReminder",
					"proto": "async (map)",
					"code": "var reminder=this.newReminder(map)\nvar result=await this.dlgReminder(reminder); if(!result)return\nthis.reminders.push(reminder)\n\nthis.createReminds(reminder)\nthis.updateReminds()\nthis.updateContent()",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "newReminder",
					"proto": "(map)",
					"code": "return jsa.sum({\n   tag:\"reminder\", \n   id:jsa.generateId(\"reminder\"),\n   label:\"New event\"\n   }, map)",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "dlgReminder",
					"proto": "async (reminder)",
					"code": "return await dlgSync(reminder)",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "updateContent",
					"proto": "()",
					"code": "var oldDiv=this _divBody\nvar newDiv=jsa.generate(this.displayBody())\noldDiv.parentElement.replaceChild(newDiv, oldDiv)",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "deleteReminder",
					"proto": "(reminder)",
					"code": "// {reminder} or #reminder\nif(typeof(reminder)==\"string\")reminder=this.reminders.find(reminder0=> reminder0.id==reminder)\nvar index=this.reminders.indexOf(reminder)\nthis.reminders.splice(index, 1)\nthis.reminds.forEach((remind, index2) => {\n   if(remind.idReminder==reminder.id){\n     reminds.splice(index2, 1)\n     }\n   })\n// Verifier que le forEach asso à un splice ne cree pas de trous",
					"docs": {
						"files": [],
						"text": "Supprime le reminder indiqué et tous les reminds associés "
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "createRemind",
					"proto": "(reminder, preRemind)",
					"code": "var date=this.toDate(reminder.dateBegin)\nif(preRemind){\n  var match=preRemind.match(/^(\\d+)(\\w)/)\n  var nb=parseInt(match[1])\n  var type=match[2]\n  }\nswitch(type){\n  case \"m\":\n    date.setMinutes(date.getMinutes() + nb)\n    break;\n  case \"h\":\n    date.setHours(date.getHours() + nb)\n    break;\n  case \"D\":\n    date.setDate(date.getDate() + nb)\n    break;\n  case \"W\":\n    date.setWeek(date.getWeek() + nb)\n    break;\n  case \"M\":\n   date.setMonth(date.getMonth() + nb)\n   break;\n  case \"Y\":\n    date.setYear(date.getYear() + nb)\n    break;\n  default:\n  }\nvar strDate=this.toStrDate(date)\nvar remind0=jsa.cp2({}, reminder)\nremind0.idReminder=reminder.id\nremind0.preRemind=preRemind\nvar index=this reminds.findIndex(remind => remind.dateBegin>strDate)\nif(index==-1)index=0;\nthis.reminds.splice(index, 0, remind0)",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "toDate",
					"proto": "(dateBegin)",
					"code": "",
					"docs": {
						"files": [],
						"text": "aaaa/mm/dd -> date js"
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "updateRemindeds",
					"proto": "()",
					"code": "var strToday=this.toStrDate(new Date)\nthis.reminds.forEach((remind, index) => {\n   if(remind.dateBegin>=strToday){\n     var index0=this.remindeds.findIndex(reminded => reminded.idReminder==remind.idReminder)\n     if(index0>-1)this.remindeds.splice(index0, 1)\n     this.remindeds.push(remind)\n     this.reminds.splice(index, 1)\n     if(!remind.preRemind && remind.every){\n        var reminder=this.reminders.find(reminder => reminder.id==remind.idReminder)\n        this.createReminds(reminder)\n        }\n     }\n   })\nthis.updateContent()\n// verifier que le forEach associé au splice ne créé pas de lacunes",
					"docs": {
						"files": [],
						"text": "Parcourre les reminds à la recherche de ceux qui sont d'actualité"
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "createReminds",
					"proto": "(reminder)",
					"code": "this.createRemind(reminder.dateBegin)\nreminder.preReminds.forEach(preRemind => this.createRemind(reminder, preRemind))\n",
					"docs": {
						"files": []
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "toStrDate",
					"proto": "(date)",
					"code": "",
					"docs": {
						"files": [],
						"text": "date js => aaaa/mm/dd"
					},
					"tabs": []
				},
				{
					"tag": "app_fn",
					"id": "beforeInit",
					"proto": "()",
					"code": "this.reminders=[]\nthis.reminds=[]\nthis.remindeds=[]",
					"docs": {
						"files": []
					},
					"tabs": []
				}
			],
			"docs": {
				"text": "",
				"files": [
					{
						"tag": "app_file",
						"label": "reminder",
						"content": "label\ndateBegin\ndateEnd\ncyclic : (boolean)\npreReminds:[{preRemind}]\n",
						"tabs": []
					},
					{
						"tag": "app_file",
						"label": "preRemind",
						"content": "nb : (uint)\nunit : (string) // m, h, D, W, M, Y",
						"tabs": []
					}
				]
			},
			"graphic": {
				"tag": "div",
				"className": "reminder ",
				"css": {},
				"style": {},
				"attributes": {},
				"children": []
			},
			"tabs": [],
			"elt": {
				"tag": "div",
				"className": "appElt_default reminder ",
				"css": {
					"height": "100%",
					"display": "flex",
					"flexDirection": "column",
					"minHeight": "1px"
				},
				"style": {},
				"docs": {
					"text": "",
					"files": []
				},
				"children": [
					{
						"tag": "div",
						"className": "appElt_default _header",
						"css": {},
						"style": {},
						"docs": {
							"text": "",
							"files": []
						},
						"children": [],
						"dn": "displayHeader"
					},
					{
						"tag": "div",
						"className": "appElt_default _body",
						"css": {
							"flex": 1
						},
						"style": {},
						"docs": {
							"text": "",
							"files": []
						},
						"children": [
							{
								"css": {},
								"style": {},
								"docs": {
									"files": []
								},
								"tag": "grid",
								"obj1": "$this.obj",
								"fields1": "$this.fields",
								"fields": [],
								"records1": "$this.reminds",
								"records": [],
								"deleteRecord": "function(record){me deleteReminder(record.idReminder)}",
								"isObj": "_grid"
							}
						],
						"dn": "displayBody",
						"isElt": "_divBody"
					},
					{
						"tag": "div",
						"className": "appElt_default _footer",
						"css": {},
						"style": {},
						"docs": {
							"text": "",
							"files": []
						},
						"children": [
							{
								"tag": "tool",
								"className": "tool",
								"id": "cmdAdd",
								"src": "img/add.png",
								"title": "New event",
								"css": {},
								"style": {},
								"docs": {
									"files": []
								},
								"onclick": "function(evt){console.log(\">\");}"
							}
						],
						"dn": "displayFooter"
					}
				],
				"": "",
				"fields": "",
				"paste": "",
				"pro": "",
				"property": ""
			},
			"obj": {
				"tag": "app_object",
				"id": "reminderManager",
				"label": "reminderManager",
				"fields": []
			}
		},
		{
			"tag": "app_cls",
			"id": "",
			"properties": [],
			"methods": [],
			"docs": {
				"text": "",
				"files": []
			},
			"graphic": {
				"tag": "div",
				"className": "",
				"css": {},
				"style": {},
				"attributes": {},
				"children": []
			}
		},
		{
			"tag": "app_cls",
			"id": "reminder",
			"properties": [],
			"methods": [
				{
					"tag": "app_fn",
					"id": "updateRemindeds",
					"proto": "()",
					"code": "",
					"docs": {
						"files": []
					}
				}
			],
			"docs": {
				"text": "",
				"files": []
			},
			"graphic": {
				"tag": "div",
				"className": "reminder",
				"css": {},
				"style": {},
				"attributes": {},
				"children": []
			},
			"tabs": [],
			"obj": {
				"tag": "app_object",
				"id": "reminder",
				"label": "reminder",
				"fields": [
					{
						"tag": "formInput",
						"id": "label",
						"label": "Label",
						"type2": "string",
						"required": true,
						"type": "string"
					},
					{
						"tag": "formInput",
						"id": "dateBegin",
						"label": "Date begin",
						"type2": "dateTime",
						"required": true,
						"type": "string"
					},
					{
						"tag": "formInput",
						"id": "dateEnd",
						"label": "Date end",
						"type2": "dateTime",
						"required": false,
						"type": "string"
					},
					{
						"tag": "formInput",
						"id": "duration",
						"label": "Duration",
						"type2": "string",
						"proposedValue": [
							{
								"id": "15m",
								"label": "15 min"
							},
							{
								"id": "30m",
								"label": "30 minutes"
							},
							{
								"id": "45m",
								"label": "45 minutes "
							},
							{
								"id": "1h",
								"label": "1 hour"
							},
							{
								"id": "1.5h",
								"label": "1.5 hour"
							},
							{
								"id": "2h",
								"label": "2 hours"
							},
							{
								"id": "3h",
								"label": "3 hours"
							},
							{
								"id": "4h",
								"label": "4 hours"
							},
							{
								"id": "1d",
								"label": "1 day"
							}
						],
						"type": "string"
					},
					{
						"tag": "formInput",
						"id": "comment ",
						"label": "Detail",
						"type2": "longText",
						"type": "string"
					},
					{
						"tag": "formInput",
						"id": "every",
						"label": "Every",
						"type2": "string",
						"possibleValues": [
							{
								"id": "1D",
								"label": "Each day "
							},
							{
								"id": "1W",
								"label": "Each week "
							},
							{
								"id": "1M",
								"label": "Each month"
							},
							{
								"id": "2M",
								"label": "2 months"
							},
							{
								"id": "3M",
								"label": "3 months"
							},
							{
								"id": "6M",
								"label": "6 months"
							},
							{
								"id": "1Y",
								"label": "Each year"
							}
						],
						"type": "string"
					},
					{
						"tag": "grid",
						"id": "preReminds",
						"label": "Reminds",
						"idObj": "preRemind",
						"type": "string"
					}
				]
			}
		},
		{
			"tag": "app_cls",
			"id": "preRemind",
			"properties": [],
			"methods": [],
			"docs": {
				"text": "",
				"files": []
			},
			"graphic": {
				"tag": "div",
				"className": "preRemind",
				"css": {},
				"style": {},
				"attributes": {},
				"children": []
			},
			"tabs": [],
			"obj": {
				"tag": "app_object",
				"id": "preRemind",
				"label": "preRemind",
				"fields": [
					{
						"tag": "formInput",
						"id": "value ",
						"label": "Value",
						"type2": "string",
						"showLabel": false,
						"proposedValue": [
							{
								"id": "5M",
								"label": "5 min"
							},
							{
								"id": "10M",
								"label": "10 min"
							},
							{
								"id": "15M",
								"label": "15 min"
							},
							{
								"id": "30M",
								"label": "30 minutes "
							},
							{
								"id": "1H",
								"label": "1 hour"
							},
							{
								"id": "2H",
								"label": "2 hours"
							},
							{
								"id": "4H",
								"label": "4 hours"
							},
							{
								"id": "1D",
								"label": "1 day"
							},
							{
								"id": "2D",
								"label": "2 days"
							},
							{
								"id": "3D",
								"label": "3 days"
							},
							{
								"id": "1W",
								"label": "1 week"
							},
							{
								"id": "2W",
								"label": "2 weeks"
							},
							{
								"id": "1M",
								"label": "1 month"
							},
							{
								"id": "2M",
								"label": "2 months"
							},
							{
								"id": "3M",
								"label": "3 months"
							}
						],
						"type": "string"
					}
				]
			}
		}
	],
	"dirs": [],
	"docs": {
		"text": "",
		"files": []
	},
	"elt": {
		"tag": "div",
		"className": "appElt_default myApp reminder",
		"css": {
			"height": "100%",
			"display": "flex",
			"flexDirection": "column",
			"minHeight": "1px"
		},
		"style": {},
		"docs": {
			"text": "",
			"files": []
		},
		"children": [],
		"cld": ""
	},
	"tabs": [],
	"x": "109px",
	"y": "134px"
}