monicka-booking 0.2.2__tar.gz → 0.2.3__tar.gz

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 (44) hide show
  1. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/CHANGELOG.md +6 -0
  2. {monicka_booking-0.2.2/src/monicka_booking.egg-info → monicka_booking-0.2.3}/PKG-INFO +1 -1
  3. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/pyproject.toml +1 -1
  4. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/booking.js +6 -5
  5. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/booking.html +1 -1
  6. {monicka_booking-0.2.2 → monicka_booking-0.2.3/src/monicka_booking.egg-info}/PKG-INFO +1 -1
  7. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/MANIFEST.in +0 -0
  8. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/README.md +0 -0
  9. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/setup.cfg +0 -0
  10. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/__init__.py +0 -0
  11. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/admin.py +0 -0
  12. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/apps.py +0 -0
  13. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/client.py +0 -0
  14. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/migrations/0001_initial.py +0 -0
  15. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/migrations/0002_alter_bookingwidgetconfig_currency_label.py +0 -0
  16. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/migrations/0003_alter_bookingwidgetconfig_theme.py +0 -0
  17. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/migrations/__init__.py +0 -0
  18. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/models.py +0 -0
  19. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/assessment.js +0 -0
  20. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/booking.css +0 -0
  21. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/fonts/OFL.txt +0 -0
  22. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/fonts/Vazirmatn-Bold.ttf +0 -0
  23. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/fonts/Vazirmatn-Regular.ttf +0 -0
  24. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/fonts/Vazirmatn-SemiBold.ttf +0 -0
  25. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/monicka-logo.png +0 -0
  26. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/static/monicka_booking/therapist-placeholder.svg +0 -0
  27. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/assessment_access.html +0 -0
  28. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/assessment_complete.html +0 -0
  29. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/assessment_form.html +0 -0
  30. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/assessments.html +0 -0
  31. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/base.html +0 -0
  32. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/complete.html +0 -0
  33. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/error.html +0 -0
  34. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/gateway.html +0 -0
  35. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/host_layout.html +0 -0
  36. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/templates/monicka_booking/standalone.html +0 -0
  37. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/urls.py +0 -0
  38. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking/views.py +0 -0
  39. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking.egg-info/SOURCES.txt +0 -0
  40. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking.egg-info/dependency_links.txt +0 -0
  41. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking.egg-info/requires.txt +0 -0
  42. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/src/monicka_booking.egg-info/top_level.txt +0 -0
  43. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/tests/test_booking_quality.py +0 -0
  44. {monicka_booking-0.2.2 → monicka_booking-0.2.3}/tests/test_plugin.py +0 -0
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3 — 2026-11-29
4
+
5
+ - Highlight the selected calendar day and show its date above the available times.
6
+ - Show each available time and duration once, regardless of the number of available rooms, and ignore outdated slot responses.
7
+ - Run booking interface regression tests in the release workflow.
8
+
3
9
  ## 0.2.2 — 2026-11-26
4
10
 
5
11
  - Improve the therapist placeholder and mute upcoming steps in the Tolue Noor theme.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monicka-booking
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Accessible Persian clinic booking pages for Monicka API
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "monicka-booking"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Accessible Persian clinic booking pages for Monicka API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -7,7 +7,7 @@
7
7
  const availabilityUrl=url('availability-url'), slotsUrl=url('slots-url'), currency=url('currency-label');
8
8
  const specialScope=url('booking-scope'), invalidScope=url('booking-scope-invalid');
9
9
  if(invalidScope)return;
10
- const $=id=>find(id), state={therapist:null,branch:null,date:null,duration:'',branchFilter:'',month:null,available:new Set()};
10
+ const $=id=>find(id), state={therapist:null,branch:null,date:null,duration:'',branchFilter:'',month:null,available:new Set(),slotRequest:0};
11
11
  const fa=new Intl.DateTimeFormat('fa-IR-u-ca-persian-nu-latn',{year:'numeric',month:'numeric',day:'numeric'});
12
12
  const faMonth=new Intl.DateTimeFormat('fa-IR-u-ca-persian',{year:'numeric',month:'long'});
13
13
  const faNumber=new Intl.NumberFormat('fa-IR',{useGrouping:false});
@@ -15,6 +15,7 @@
15
15
  const jdate=d=>{const p=parts(d);return `${p.year}/${String(p.month).padStart(2,'0')}/${String(p.day).padStart(2,'0')}`};
16
16
  const jm=d=>{const p=parts(d);return {year:+p.year,month:+p.month}};
17
17
  const say=t=>$('live-message').textContent=t;
18
+ function clearDate(){state.date=null;state.slotRequest++;$('slot-area').hidden=true;}
18
19
  const sections={therapist:'therapist',calendar:'calendar',details:'details'};
19
20
  function show(section){Object.keys(sections).forEach(s=>$(`step-${sections[s]}`).hidden=s!==section);root.querySelectorAll('[data-step-label]').forEach((e,i)=>e.classList.toggle('current',i===['therapist','calendar','details'].indexOf(section)));}
20
21
  function eligibleBranches(t){return t.branches.filter(b=>(!state.branchFilter||b.clinic_id===+state.branchFilter)&&(!state.duration||b.allowed_durations.includes(+state.duration)))}
@@ -38,16 +39,16 @@
38
39
  if(!list.children.length)list.textContent='درمانگری با این مشخصات پیدا نشد.';
39
40
  }
40
41
  function initFilters(){const branchFilter=$('branch-filter');if(branchFilter){branchFilter.onchange=()=>{state.branchFilter=branchFilter.value;renderTherapists()}}[...new Set(catalog.therapists.flatMap(t=>t.branches.flatMap(b=>b.allowed_durations)))].sort((a,b)=>a-b).forEach(n=>{const o=document.createElement('option');o.value=n;o.textContent=`${faNumber.format(n)} دقیقه`;$('duration-filter').append(o)});$('therapist-search').oninput=renderTherapists;$('duration-filter').onchange=()=>{state.duration=$('duration-filter').value;renderTherapists()};}
41
- function selectTherapist(t,clinicId=null){state.therapist=t;const branches=clinicId===null?eligibleBranches(t):t.branches.filter(b=>b.clinic_id===clinicId);if(!branches.length)return;state.branch=branches[0];$('selected-therapist').textContent=`${t.full_name} · ${state.branch.clinic_name}`;const row=$('branch-row'),sel=$('branch-select');sel.replaceChildren();branches.forEach(b=>{const o=document.createElement('option');o.value=b.clinic_id;o.textContent=b.clinic_name;sel.append(o)});row.hidden=branches.length<2||clinicId!==null;sel.onchange=()=>{state.branch=branches.find(b=>b.clinic_id===+sel.value);state.date=null;$('slot-area').hidden=true;loadAvailability()};state.month=jm(new Date());show('calendar');loadAvailability();}
42
+ function selectTherapist(t,clinicId=null){state.therapist=t;const branches=clinicId===null?eligibleBranches(t):t.branches.filter(b=>b.clinic_id===clinicId);if(!branches.length)return;clearDate();state.branch=branches[0];$('selected-therapist').textContent=`${t.full_name} · ${state.branch.clinic_name}`;const row=$('branch-row'),sel=$('branch-select');sel.replaceChildren();branches.forEach(b=>{const o=document.createElement('option');o.value=b.clinic_id;o.textContent=b.clinic_name;sel.append(o)});row.hidden=branches.length<2||clinicId!==null;sel.onchange=()=>{state.branch=branches.find(b=>b.clinic_id===+sel.value);clearDate();loadAvailability()};state.month=jm(new Date());show('calendar');loadAvailability();}
42
43
  function findFirstDay(m){const now=new Date();for(let i=-500;i<500;i++){const d=new Date(now);d.setDate(d.getDate()+i);const p=parts(d),x=jm(d);if(x.year===m.year&&x.month===m.month&&+p.day===1)return d}return null}
43
44
  function addMonth(m,n){const i=m.year*12+m.month-1+n;return {year:Math.floor(i/12),month:i%12+1}}
44
45
  function bounds(){const first=findFirstDay(state.month);if(!first)return null;const start=new Date(first);start.setDate(first.getDate()-((first.getDay()+1)%7));const days=Array.from({length:42},(_,i)=>{const d=new Date(start);d.setDate(start.getDate()+i);return d});return {first,days}}
45
46
  async function loadAvailability(){const b=bounds();if(!b)return;state.available.clear();const today=new Date();today.setHours(0,0,0,0);const begin=new Date(Math.max(b.first.getTime(),today.getTime()+86400000));const limit=new Date(today);limit.setDate(limit.getDate()+(+state.branch.booking_days||20));const end=new Date(Math.min(b.days[41].getTime(),limit.getTime()));if(begin<=end){try{const u=new URL(availabilityUrl,location.href);u.search=new URLSearchParams({clinic:state.branch.clinic_id,therapist:state.therapist.id,start:jdate(begin),end:jdate(end)});const r=await fetch(u,{headers:{Accept:'application/json'}});if(!r.ok)throw Error();(await r.json()).available_days.forEach(x=>state.available.add(x.date))}catch{say('روزهای آزاد بارگذاری نشد. دوباره تلاش کنید.')}}drawMonth(state.month)}
46
- function drawMonth(m){state.month=m;const b=bounds();if(!b)return;$('month-label').textContent=faMonth.format(b.first);const grid=root.querySelector('.calendar-grid');grid.querySelectorAll('.day').forEach(x=>x.remove());const today=new Date();today.setHours(0,0,0,0);const horizon=new Date(today);horizon.setDate(horizon.getDate()+(+state.branch.booking_days||20));b.days.forEach(d=>{const p=parts(d),x=jm(d),same=x.year===m.year&&x.month===m.month;if(!same){const empty=document.createElement('span');empty.className='day day-empty';empty.setAttribute('aria-hidden','true');grid.append(empty);return}const j=jdate(d),button=document.createElement('button');button.type='button';button.className='day';button.textContent=faNumber.format(+p.day);button.setAttribute('role','gridcell');button.setAttribute('aria-label',`${faNumber.format(+p.day)} ${faMonth.format(d)}`);const avail=state.available.has(j);button.disabled=!avail||d<=today||d>horizon;button.classList.toggle('available',avail&&!button.disabled);button.setAttribute('aria-pressed',state.date===j?'true':'false');button.onclick=()=>selectDate(j);grid.append(button)});const monthIdx=m.year*12+m.month-1,now=jm(today),last=jm(horizon);$('previous-month').disabled=monthIdx<=now.year*12+now.month-1;$('next-month').disabled=monthIdx>=last.year*12+last.month-1;}
47
- async function selectDate(date){state.date=date;$('slot-area').hidden=false;$('slot-list').textContent='در حال دریافت ساعت‌های آزاد…';try{const u=new URL(slotsUrl,location.href);u.search=new URLSearchParams({clinic:state.branch.clinic_id,therapist:state.therapist.id,date});const r=await fetch(u,{headers:{Accept:'application/json'}});if(!r.ok)throw Error();const data=await r.json(),list=$('slot-list');list.replaceChildren();data.slots.filter(s=>!state.duration||s.duration_minutes===+state.duration).forEach(s=>(s.available_rooms||[]).forEach(room=>{const button=document.createElement('button');button.type='button';button.className='slot-button';button.textContent=`${new Intl.DateTimeFormat('fa-IR',{hour:'2-digit',minute:'2-digit',timeZone:'Asia/Tehran'}).format(new Date(s.start))} — ${faNumber.format(s.duration_minutes)} دقیقه`;button.onclick=()=>chooseSlot(s,button);list.append(button)}));if(!list.children.length)list.textContent='برای این روز ساعتی باقی نمانده است.'}catch{$('slot-list').textContent='دریافت ساعت‌ها ممکن نشد. دوباره تلاش کنید.'}}
47
+ function drawMonth(m){state.month=m;const b=bounds();if(!b)return;$('month-label').textContent=faMonth.format(b.first);const grid=root.querySelector('.calendar-grid');grid.querySelectorAll('.day').forEach(x=>x.remove());const today=new Date();today.setHours(0,0,0,0);const horizon=new Date(today);horizon.setDate(horizon.getDate()+(+state.branch.booking_days||20));b.days.forEach(d=>{const p=parts(d),x=jm(d),same=x.year===m.year&&x.month===m.month;if(!same){const empty=document.createElement('span');empty.className='day day-empty';empty.setAttribute('aria-hidden','true');grid.append(empty);return}const j=jdate(d),button=document.createElement('button');button.type='button';button.className='day';button.textContent=faNumber.format(+p.day);button.setAttribute('role','gridcell');button.setAttribute('aria-label',`${faNumber.format(+p.day)} ${faMonth.format(d)}`);const avail=state.available.has(j),selected=state.date===j;button.disabled=!avail||d<=today||d>horizon;button.classList.toggle('available',avail&&!button.disabled);button.classList.toggle('selected',selected);button.setAttribute('aria-pressed',selected?'true':'false');button.onclick=()=>selectDate(j,button.getAttribute('aria-label'));grid.append(button)});const monthIdx=m.year*12+m.month-1,now=jm(today),last=jm(horizon);$('previous-month').disabled=monthIdx<=now.year*12+now.month-1;$('next-month').disabled=monthIdx>=last.year*12+last.month-1;}
48
+ async function selectDate(date,label){state.date=date;const request=++state.slotRequest;drawMonth(state.month);root.querySelector('.day.selected')?.focus();$('slot-title').textContent=`ساعت‌های آزاد ${label}`;$('slot-area').hidden=false;$('slot-list').textContent='در حال دریافت ساعت‌های آزاد…';try{const u=new URL(slotsUrl,location.href);u.search=new URLSearchParams({clinic:state.branch.clinic_id,therapist:state.therapist.id,date});const r=await fetch(u,{headers:{Accept:'application/json'}});if(!r.ok)throw Error();const data=await r.json();if(request!==state.slotRequest)return;const list=$('slot-list'),seen=new Set();list.replaceChildren();data.slots.filter(s=>!state.duration||s.duration_minutes===+state.duration).forEach(s=>{const key=`${s.start}|${s.duration_minutes}`;if(seen.has(key))return;seen.add(key);const button=document.createElement('button');button.type='button';button.className='slot-button';button.textContent=`${new Intl.DateTimeFormat('fa-IR',{hour:'2-digit',minute:'2-digit',timeZone:'Asia/Tehran'}).format(new Date(s.start))} — ${faNumber.format(s.duration_minutes)} دقیقه`;button.onclick=()=>chooseSlot(s,button);list.append(button)});if(!list.children.length)list.textContent='برای این روز ساعتی باقی نمانده است.'}catch{if(request===state.slotRequest)$('slot-list').textContent='دریافت ساعت‌ها ممکن نشد. دوباره تلاش کنید.'}}
48
49
  function feeLabel(rawBase,minutes,perMinute,minimum){const [whole='',fraction='']=String(rawBase).split('.'),cents=BigInt(whole)*100n+BigInt((fraction+'00').slice(0,2));let total=cents;if(perMinute&&minutes>minimum){const numerator=cents*BigInt(minutes);total=numerator/60n;const remainder=numerator%60n;if(remainder*2n>60n||(remainder*2n===60n&&total%2n===1n))total+=1n}const integer=(total/100n).toLocaleString('fa-IR'),decimal=new Intl.NumberFormat('fa-IR',{minimumIntegerDigits:2,useGrouping:false}).format(Number(total%100n));return `${integer}٫${decimal}`}
49
50
  function chooseSlot(s,button){root.querySelectorAll('.slot-button').forEach(b=>b.setAttribute('aria-pressed','false'));button.setAttribute('aria-pressed','true');$('form-clinic').value=state.branch.clinic_id;$('form-therapist').value=state.therapist.id;$('form-starts-at').value=s.start;$('form-duration').value=s.duration_minutes;const policy=state.therapist.branches.find(b=>b.clinic_id===state.branch.clinic_id),amount=feeLabel(policy.base_fee,s.duration_minutes,policy.calculate_per_minute,policy.minimum_length_of_appointments);$('booking-summary').textContent=`${state.therapist.full_name}، ${state.branch.clinic_name}، ${jdate(new Date(s.start)).replace(/\d/g,digit=>faNumber.format(+digit))}، ${faNumber.format(s.duration_minutes)} دقیقه، مبلغ ${amount} ${currency}`;show('details')}
50
- $('previous-month').onclick=()=>{state.month=addMonth(state.month,-1);loadAvailability()};$('next-month').onclick=()=>{state.month=addMonth(state.month,1);loadAvailability()};root.querySelectorAll('[data-back]').forEach(b=>b.onclick=()=>show(b.dataset.back));$('add-participant').onclick=()=>{const row=document.createElement('div');row.className='participant-row';const name=document.createElement('label');name.textContent='نام همراه';const ni=document.createElement('input');ni.name='participant_name';ni.maxLength=200;name.append(ni);const phone=document.createElement('label');phone.textContent='شماره همراه';const pi=document.createElement('input');pi.name='participant_phone';pi.inputMode='tel';pi.pattern='[+0-9۰-۹٠-٩\\- ]{10,16}';phone.append(pi);row.append(name,phone);$('participants').append(row)};
51
+ $('previous-month').onclick=()=>{clearDate();state.month=addMonth(state.month,-1);loadAvailability()};$('next-month').onclick=()=>{clearDate();state.month=addMonth(state.month,1);loadAvailability()};root.querySelectorAll('[data-back]').forEach(b=>b.onclick=()=>show(b.dataset.back));$('add-participant').onclick=()=>{const row=document.createElement('div');row.className='participant-row';const name=document.createElement('label');name.textContent='نام همراه';const ni=document.createElement('input');ni.name='participant_name';ni.maxLength=200;name.append(ni);const phone=document.createElement('label');phone.textContent='شماره همراه';const pi=document.createElement('input');pi.name='participant_phone';pi.inputMode='tel';pi.pattern='[+0-9۰-۹٠-٩\\- ]{10,16}';phone.append(pi);row.append(name,phone);$('participants').append(row)};
51
52
  initFilters();renderTherapists();
52
53
  if(specialScope){const therapist=catalog.therapists.find(t=>t.id===specialScope.therapist_id);if(therapist)selectTherapist(therapist,specialScope.clinic_id)}
53
54
  })();
@@ -34,7 +34,7 @@
34
34
  <div class="calendar-head"><button type="button" id="previous-month" class="button secondary" aria-label="ماه قبل">ماه قبل</button><h3 id="month-label" aria-live="polite"></h3><button type="button" id="next-month" class="button secondary" aria-label="ماه بعد">ماه بعد</button></div>
35
35
  <div class="calendar-grid" role="grid" aria-label="تقویم شمسی"><div class="weekday">شنبه</div><div class="weekday">یکشنبه</div><div class="weekday">دوشنبه</div><div class="weekday">سه‌شنبه</div><div class="weekday">چهارشنبه</div><div class="weekday">پنجشنبه</div><div class="weekday">جمعه</div></div>
36
36
  <p id="calendar-help" class="muted">روزهای دارای نوبت با دکمه قابل انتخاب هستند.</p>
37
- <div id="slot-area" hidden><h3>ساعت‌های آزاد</h3><div id="slot-list" class="slot-list"></div></div>
37
+ <div id="slot-area" hidden><h3 id="slot-title">ساعت‌های آزاد</h3><div id="slot-list" class="slot-list"></div></div>
38
38
  </section>
39
39
  <section class="panel" id="step-details" aria-labelledby="details-title" hidden>
40
40
  <div class="section-top"><div><h2 id="details-title">اطلاعات رزرو</h2><p id="booking-summary"></p></div><button type="button" class="button secondary" data-back="calendar">تغییر ساعت</button></div>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monicka-booking
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Accessible Persian clinic booking pages for Monicka API
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10