Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
tlocke committed Sep 1, 2023
1 parent ae7815c commit 1f109c6
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 0 deletions.
45 changes: 45 additions & 0 deletions chellow/templates/e/site_add_e_supply.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% extends "base.html" %}

{% block title %}
» Sites » {{site.code}} {{site.name}} » Add Electricity SUpply
{% endblock %}

{% block nav %}
<a href="/sites">Sites</a> &raquo;
<a href="/sites/{{site.id}}">{{site.code}} {{site.name}}</a> &raquo;
Add Electricity Supply
{% endblock %}

{% block content %}
<form action="/e/sites/{{site.id}}/add_e_supply" method="post">
<fieldset hx-get="/e/sites/{{site.id}}/add_e_supply/form" hx-params="*"
hx-trigger="load, change"
hx-include="[name='source_id'],[name='start_year'],[name='start_month'],[name='start_day'],[name='start_hour'],[name='start_minute'],[name='pc_id'],[name='name'],[name='imp_mpan_core'],[name='exp_mpan_core'],[name='mop_account'],[name='dc_account'],[name='dc_contract_id'],[name='mop_contract_id'],[name='imp_supplier_account'],[name='exp_supplier_account'],[name='imp_llfc_id'],[name='exp_llfc_id'],[name='mtc_participant_id'],[name='has_imp_mpan'],[name='has_exp_mpan']">
<input type="hidden" name="source_id" value="{{request.values.source_id}}">
<input type="hidden" name="pc_id" value="{{request.values.pc_id}}">
<input type="hidden" name="mtc_participant_id"
value="{{request.values.mtc_participant_id}}">
<input type="hidden" name="name" value="{{request.values.name}}">
<input type="hidden" name="mop_contract_id"
value="{{request.values.mop_contract_id}}">
<input type="hidden" name="mop_account" value="{{request.values.mop_account}}">
<input type="hidden" name="dc_contract_id"
value="{{request.values.dc_contract_id}}">
<input type="hidden" name="dc_account" value="{{request.values.dc_account}}">
<input type="hidden" name="has_imp_mpan" value="{{request.values.has_imp_mpan}}">
<input type="hidden" name="imp_mpan_core"
value="{{request.values.imp_mpan_core}}">
<input type="hidden" name="imp_supplier_account"
value="{{request.values.imp_supplier_account}}">
<input type="hidden" name="imp_llfc_id"
value="{{request.values.imp_llfc_id}}">
<input type="hidden" name="has_exp_mpan" value="{{request.values.has_exp_mpan}}">
<input type="hidden" name="exp_mpan_core"
value="{{request.values.exp_mpan_core}}">
<input type="hidden" name="exp_supplier_account"
value="{{request.values.exp_supplier_account}}">
<input type="hidden" name="exp_llfc_id"
value="{{request.values.exp_llfc_id}}">
</fieldset>
</form>
{% endblock %}
174 changes: 174 additions & 0 deletions chellow/templates/e/site_add_e_supply_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{% extends "macros.html" %}

{% block html %}
<legend>Add an electricity supply</legend>
{% with messages = get_flashed_messages() %}
{% if messages %}
<label>Messages</label>
<ul>
{% for message in messages %}
<li>{{message}}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<label>Name</label> {{input_text('name', required=True)}}
<label>Start Date</label> {{input_date('start')}}
<label>Source</label>
<select name="source_id">
{% for src in sources %}
{{input_option('src_id', src.id, src.code + ' ' + src.name, initial=source.id)}}
{% endfor %}
</select>
{% if source.code in ('gen', 'gen-net') %}
<label>Generator</label>
<select name="generator_type_id">
{% for generator_type in generator_types %}
{{input_option(
'generator_type_id', generator_type.id,
generator_type.code + ' ' +
generator_type.description)}}
{% endfor %}
</select>
{% endif %}
<label>Meter Serial Number</label> {{input_text('msn')}}
<label>GSP Group</label>
<select name="gsp_group_id">
{% for gsp_group in gsp_groups %}
{{input_option(
'gsp_group_id', gsp_group.id,
gsp_group.code + ' ' + gsp_group.description)}}
{% endfor %}
</select>

<label>CoP</label>
<select name="cop_id">
{% for cop in cops %}
{{input_option('cop_id', cop.id, cop.description)}}
{% endfor %}
</select>

<label>Comm</label>
<select name="comm_id">
{% for comm in comms %}
{{input_option(
'comm_id', comm.id, comm.code + ' ' + comm.description)}}
{% endfor %}
</select>

<label>Energisation Status</label>
<select name="energisation_status_id">
{% for energisation_status in energisation_statuses %}
{{input_option(
'energisation_status_id', energisation_status.id,
energisation_status.code + ' - ' +
energisation_status.description,
initial=default_energisation_status.id)}}
{% endfor %}
</select>

<label>MOP Contract</label>
<select name="mop_contract_id">
{% for contract in mop_contracts %}
{{input_option(
'mop_contract_id', contract.id, contract.name)}}
{% endfor %}
</select>
<label>MOP Account</label> {{input_text('mop_account', required=True)}}
<label>DC Contract</label>
<select name="dc_contract_id">
{% for contract in dc_contracts %}
{{input_option('dc_contract_id', contract.id, contract.name)}}
{% endfor %}
</select>
<label>DC Account</label> {{input_text('dc_account', required=True)}}

<label>Profile Class</label>
<select name="pc_id">
{% for p in pcs %}
{{input_option('pc_id', p.id, p.code + ' ' + p.name, initial=pc.id)}}
{% endfor %}
</select>

<label>DNO</label>
<select name="dno_id">
{% for dno in dnos %}
{{input_option( 'dno_id', dno.id, dno.dno_code + ' ' + dno.name)}}
{% endfor %}
</select>

<label>SSC</label>
<select name="ssc_id">
{% for ss in sscs %}
{{input_option( 'ssc_id', ss.id, ss.code + ' ' + ss.description)}}
{% endfor %}
</select>

<label>MTC</label>
<select name="mtc_participant_id">
{% for mtc_participant in mtc_participants %}
{{input_option( 'mtc_participant_id', mtc_participant.id,
mtc_participant.mtc.code + ' ' + mtc_participant.description)}}
{% endfor %}
</select>

<label>Properties</label> {{input_textarea('properties', '{}', 20, 80)}}

<label>Has An Import MPAN?</label> {{input_checkbox('has_imp_mpan')}}

{% if 'has_imp_mpan' in request.values %}
<fieldset>
<legend>Import</legend>
<label>Mpan Core</label>
{{input_text('imp_mpan_core', '', 35, pattern='[0-9 ]*', required=True)}}
<label>LLFC</label>
<select name="imp_llfc_id">
{% for llfc in imp_llfcs %}
{{input_option('imp_llfc_id', llfc.id, llfc.code + ' ' + llfc.description)}}
{% endfor %}
</select>
<label>Supply Capacity</label> {{input_number('imp_sc', '0', required=True)}}
<label>Supplier Contract</label>
<select name="imp_supplier_contract_id">
{% for contract in supplier_contracts %}
{{input_option(
'imp_supplier_contract_id', contract.id,
contract.name)}}
{% endfor %}
</select>
<label>Supplier Account</label>
{{input_text('imp_supplier_account', required=True)}}
</fieldset>
{% endif %}

<label>Has An Export MPAN?</label> {{input_checkbox('has_exp_mpan')}}

{% if 'has_exp_mpan' in request.values %}
<fieldset>
<legend>Export</legend>
<label>Mpan Core</label>
{{input_text('exp_mpan_core', '', 35, pattern='[0-9 ]*', required=True)}}

<label>LLFC</label>
<select name="exp_llfc_id">
{% for llfc in exp_llfcs %}
{{input_option('exp_llfc_id', llfc.id, llfc.code + ' ' + llfc.description)}}
{% endfor %}
</select>

<label>Supply Capacity</label>
{{input_number('exp_sc', '0', required=True)}}
<label>Supplier Contract</label>
<select name="exp_supplier_contract_id">
{% for contract in supplier_contracts %}
{{input_option(
'exp_supplier_contract_id', contract.id,
contract.name)}}
{% endfor %}
</select>
<label>Supplier Account</label>
{{input_text('exp_supplier_account', required=True)}}
</fieldset>
{% endif %}
<input name="insert_electricity" type="submit" value="Add">
{% endblock %}

0 comments on commit 1f109c6

Please sign in to comment.