title: $:/plugins/linonetwo/tw-calendar/calendar-widget/tiddlywiki-ui/popup/CreateNewTiddlerPopupFooter

\define lingo-base() $:/plugins/linonetwo/tw-calendar/language/
\define cleanUpAction()
<$action-setfield
  $tiddler="$:/state/Calendar/PageLayout/create-tiddler"
  text=""
  tags=""
  draft.title=""
  startDate=""
  endDate=""
  rrule=""
/>
<$action-setfield
  $tiddler="$:/state/Calendar/PageLayout/create-tiddler-caption"
  draft.title=""
/>
<!-- alarm -->
<$action-setfield      $tiddler="$:/state/Calendar/PageLayout/create-tiddler" alarms="" />
<$action-deletetiddler $tiddler="$:/temp/time/alarms_input/$:/state/Calendar/PageLayout/create-tiddler"  />
<$action-deletetiddler $tiddler="$:/temp/time/alarms_msg/$:/state/Calendar/PageLayout/create-tiddler" />
<$action-deletetiddler $tiddler="$:/temp/tw-calendar/recurrence-editor/$:/state/Calendar/PageLayout/create-tiddler" />
\end

<!-- learn this from twMat https://groups.google.com/g/tiddlywiki/c/XXbzgRmcXF0 -->
<$wikify name="newtitle" text="{{$:/plugins/linonetwo/tw-calendar/settings/prefix}}{{$:/state/Calendar/PageLayout/create-tiddler!!draft.title}}" >

<div class="tw-calendar-footer-buttons">
  <$button class="tw-calendar-footer-button tw-calendar-footer-button-cancel" message="tm-close-tiddler">
    <<lingo Modal/CreateEvent/Label/Cancel>>
    <<cleanUpAction>>
  </$button>
  

  <$button class="tw-calendar-footer-button tw-calendar-footer-button-create" message="tm-close-tiddler">
    <<lingo Modal/CreateEvent/Label/Create>>
    <!-- Remove draft.title first -->
    <$action-setfield $tiddler="$:/state/Calendar/PageLayout/create-tiddler" $field="draft.title" />
    <% if [{$:/state/Calendar/PageLayout/create-tiddler-caption!!draft.title}is[blank]] %>
      <$action-createtiddler
        $basetitle=<<newtitle>>
        $template="$:/state/Calendar/PageLayout/create-tiddler"
        type="text/vnd.tiddlywiki"
      />
    <% else %>
      <$action-createtiddler
        $basetitle=<<newtitle>>
        $template="$:/state/Calendar/PageLayout/create-tiddler"
        caption={{$:/state/Calendar/PageLayout/create-tiddler-caption!!draft.title}}
        type="text/vnd.tiddlywiki"
      />
    <% endif %>
    <$let currentTiddler=<<createTiddler-title>> >
      <$action-sendmessage $message="tm-save-tiddler" $param=<<currentTiddler>> />
      <$action-sendmessage $message="tm-auto-save-wiki" />
    </$let>
    <<cleanUpAction>>
  </$button>
</div>
