Phase 11, step 1: the parties of a contract and the conflict check
A contract's other side was one line of text. Now each other party is a row with its names in English and Thai, an ID, passport or registration number and its role (migration 0010; the old line became the first party). Parties are never deleted or rewritten: taking one off marks it removed, and both are in the journal. The conflict check (src/conflicts.rs) looks for the name or number among the clients, the other parties, the visa people and the employers. Names match regardless of case, word order, punctuation and company words in English and Thai (Co., Ltd., บริษัท ... จำกัด), or when every word of the shorter name, at least two, is in the longer one. A new party that is a client, a visa client or an employer is a conflict; a new or renamed client that was on the other side of a contract is one too; a client's name or number again is perhaps the same client. Those stop the save (409) until a lawyer ticks that they looked, with what they checked; the matches and the note go into the journal entry. /conflicts runs the check alone before a first meeting and saves nothing. Tests: 119 unit, 63 integration.
This commit is contained in:
1 parent
f7fb2c7af4
commit
9ae4d7bd07
16 files changed
+1464
-25
No files matched your search
@@ -0,0 +1,25 @@
|
||||
{#- The conflict check's matches, and when they wait for a decision, the
|
||||
box a lawyer ticks and what they write: both go into the journal. -#}
|
||||
{% macro block(check) %}
|
||||
<div class="conflicts{% if check.ask %} ask{% endif %}" id="conflicts">
|
||||
{% if check.ask %}<p class="cfhead"><b>Conflict check: {{ check.hits|length }} match{% if check.hits|length != 1 %}es{% endif %} to look at before saving</b></p>{% endif %}
|
||||
<ul class="hits">
|
||||
{% for h in check.hits %}
|
||||
<li class="hit {{ h.level }}">
|
||||
<span class="chip {% if h.level == "conflict" %}bad{% elif h.level == "same" %}warn{% else %}plain{% endif %}">{% if h.level == "conflict" %}Conflict{% elif h.level == "same" %}Same client?{% else %}Note{% endif %}</span>
|
||||
<span class="hitwhat">{{ h.what }}</span>
|
||||
<a class="strong" href="{{ h.href }}" target="_blank" rel="noopener">{{ h.name }}</a>
|
||||
<div class="small">{{ h.means }} <span class="muted">({{ h.why }})</span></div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if check.ask %}
|
||||
<label class="clearbox"><input type="checkbox" name="cleared" value="1" id="f-cleared" required> I looked at these matches: there is no conflict, or the clients agreed to it in writing.</label>
|
||||
<div class="field wide">
|
||||
<label for="f-cleared_note">What you checked</label>
|
||||
<input id="f-cleared_note" name="cleared_note" value="{{ check.note }}" maxlength="500" placeholder="Such as: another company with a similar name; both clients agreed in writing on Nov 22">
|
||||
<p class="hint">Goes into the journal with the matches.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -2,7 +2,7 @@
|
||||
{% block main %}
|
||||
<div class="pagehead">
|
||||
<h1>{% if former %}Former clients{% else %}Clients{% endif %}</h1>
|
||||
<div class="actions"><a class="btn pri" href="/clients/new" id="new-client">+ New client</a></div>
|
||||
<div class="actions"><a class="btn sm ghost" href="/conflicts" id="conflict-check">Conflict check</a> <a class="btn pri" href="/clients/new" id="new-client">+ New client</a></div>
|
||||
</div>
|
||||
<p class="meta">People and organizations, Thai or foreign, whom Lanna Desk advises or acts for: artists, labels, festivals, companies and private clients. Each has a lawyer in charge and their contracts.</p>
|
||||
{% if cards or n_former %}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "_fields.html" as fm %}
|
||||
{% import "_conflicts.html" as cf %}
|
||||
{% block main %}
|
||||
<div class="crumbs"><a href="/clients">Clients</a></div>
|
||||
<div class="pagehead"><h1>Conflict check</h1></div>
|
||||
<p class="meta">Before a first meeting, look up a name or a number among the clients, the other parties of the contracts, the visa clients and the employers. Nothing is saved here. Adding a client or a party runs the same check and writes it into the journal.</p>
|
||||
<form method="get" action="/conflicts" class="form" id="conflict-search">
|
||||
<section class="card">
|
||||
<div class="grid">
|
||||
{{ fm.text("name", "Name", name, cls="wide", hint="In English or Thai. Word order, capitals and words such as Co., Ltd. or บริษัท do not count.") }}
|
||||
{{ fm.text("number", "ID, passport or registration number", number, hint="Compared on its letters and digits.") }}
|
||||
</div>
|
||||
<div class="formactions"><button type="submit" class="btn pri" id="check">Check</button></div>
|
||||
</section>
|
||||
</form>
|
||||
{% if asked %}
|
||||
<section class="card" id="results">
|
||||
<header><h2>{% if check.hits %}{{ check.hits|length }} match{% if check.hits|length != 1 %}es{% endif %}{% else %}No match{% endif %}</h2></header>
|
||||
{% if check.hits %}{{ cf.block(check) }}{% else %}<p class="empty-inline">Nobody on record has this name or number.</p>{% endif %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -2,6 +2,7 @@
|
||||
{% import "_fields.html" as fm %}
|
||||
{% import "_agreement_text.html" as ag %}
|
||||
{% import "_journal.html" as jn %}
|
||||
{% import "_conflicts.html" as cf %}
|
||||
{% block main %}
|
||||
<div class="phead">
|
||||
<div class="crumbs"><a href="/contracts">Contracts</a> <span class="sep">/</span> <a href="/clients/{{ head.client_id }}">{{ client_name }}</a></div>
|
||||
@@ -42,6 +43,37 @@
|
||||
{% endfor %}
|
||||
</section>
|
||||
</div>
|
||||
<section class="card" id="parties">
|
||||
<header><h2>Parties</h2><span class="muted small">each one added is checked for conflicts</span></header>
|
||||
<ul class="parties">
|
||||
<li><div class="prow"><span><a class="strong" href="/clients/{{ head.client_id }}">{{ client_name }}</a> <span class="tag gold">our client</span></span></div></li>
|
||||
{% for p in parties %}
|
||||
<li id="party-{{ p.id }}"{% if p.removed %} class="old"{% endif %}>
|
||||
<div class="prow">
|
||||
<span><b>{{ p.name }}</b>{% if p.name_th %} <span lang="th">{{ p.name_th }}</span>{% endif %}{% if p.role %} <span class="tag">{{ p.role }}</span>{% endif %}{% if p.removed %} <span class="chip plain">removed</span>{% endif %}</span>
|
||||
{% if not p.removed %}<form method="post" action="/contracts/{{ id }}/parties/{{ p.id }}/remove" class="inline-form" data-confirm="Take {{ p.name }} off this contract? It stays on record, marked removed."><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="btn sm ghost">Remove</button></form>{% endif %}
|
||||
</div>
|
||||
<div class="sub">{% if p.id_no %}<span class="mono">{{ p.id_no }}</span> · {% endif %}added {{ p.added }} by {{ p.by }}{% if p.removed %} · removed {{ p.removed }} by {{ p.removed_by }}{% endif %}</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if not live_parties %}<p class="empty-inline">No other party yet: add the other side, and the check looks for it among everyone on record.</p>{% endif %}
|
||||
<details class="addparty"{% if check.hits or party_errors %} open{% endif %}>
|
||||
<summary class="btn sm" id="add-party-open">Add a party</summary>
|
||||
<form method="post" action="/contracts/{{ id }}/parties" class="form" id="party-form">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
{% if check.hits %}{{ cf.block(check) }}{% endif %}
|
||||
<div class="grid">
|
||||
{{ fm.text("party_name", "Name", party.name, err=party_errors.party_name, req=true, cls="wide", hint="As registered, or as in the ID card or passport.") }}
|
||||
{{ fm.text("party_name_th", "Name in Thai", party.name_th, err=party_errors.party_name_th, cls="wide") }}
|
||||
{{ fm.text("party_id_no", "ID, passport or registration number", party.id_no, err=party_errors.party_id_no, hint="The check compares numbers too.") }}
|
||||
{{ fm.text("party_role", "Role", party.role, err=party_errors.party_role, list="roles", ph="Label, venue, landlord") }}
|
||||
</div>
|
||||
<div class="formactions"><button type="submit" class="btn pri" id="add-party">{% if check.ask %}Add the party{% else %}Check and add{% endif %}</button></div>
|
||||
</form>
|
||||
</details>
|
||||
<datalist id="roles">{% for r in roles %}<option value="{{ r }}"></option>{% endfor %}</datalist>
|
||||
</section>
|
||||
{% if reading %}
|
||||
<section class="card" id="reading">
|
||||
<header><h2>{% if compare %}Version {{ reading }} against version {{ before }}{% else %}Version {{ reading }}{% endif %}{% if reading_note %}: {{ reading_note }}{% endif %}</h2>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "_fields.html" as fm %}
|
||||
{% import "_conflicts.html" as cf %}
|
||||
{% block main %}
|
||||
{% if p %}
|
||||
{% include "_person_head.html" %}
|
||||
@@ -9,6 +10,7 @@
|
||||
{% endif %}
|
||||
<form method="post" action="{{ action }}" class="form" id="record-form">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
{% if check and check.hits %}<section class="card warncard">{{ cf.block(check) }}</section>{% endif %}
|
||||
<section class="card">
|
||||
{% if p %}<header><h2>{{ heading }}</h2></header>{% endif %}
|
||||
{% if lead %}<p class="hint lead">{{ lead }}</p>{% endif %}
|
||||
|
||||
Reference in new issue
Block a user