Skip to content

Commit f126704

Browse files
committedJul 8, 2016
small fixes + more TutorCruncher looking
1 parent e7e1920 commit f126704

File tree

3 files changed

+38
-42
lines changed

3 files changed

+38
-42
lines changed
 

‎css/modal.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.modal-content{
2+
-webkit-border-radius: 6px !important;
3+
-moz-border-radius: 6px !important;
4+
border-radius: 6px !important;
5+
}

‎invoice template.html

+33-30
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8">
66
<title>Invoice Template Form</title>
77
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" crossorigin="anonymous">
8-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" crossorigin="anonymous">
8+
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" crossorigin="anonymous">-->
99
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
1010
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script>
1111
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.1/mustache.min.js"></script>
@@ -15,6 +15,7 @@
1515
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css">
1616
<link rel="stylesheet" href="css/pdf_styles.css">
1717
<link rel="stylesheet" href="css/pdf_preview_styles.css">
18+
<link rel="stylesheet" href="css/modal.css">
1819
</head>
1920

2021
<body>
@@ -23,12 +24,13 @@
2324

2425
<!-- Buttons -->
2526

26-
<div id="buttons">
27-
<button id="button-trigger" type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
27+
<div id="buttons" class="text-center">
28+
<p><h1>TutorCruncher Invoice Template</h1></p>
29+
<button id="button-trigger" type="button" class="btn btn-default btn-lg" data-toggle="modal" data-target="#myModal">
2830
Edit
2931
</button>
30-
<button type="button" class="btn btn-success btn-lg" onclick="savePDF()">
31-
Save
32+
<button type="button" class="btn btn-primary btn-lg" onclick="savePDF()">
33+
Save and Generate Invoice
3234
</button>
3335
</div>
3436

@@ -39,7 +41,7 @@
3941
<div class="modal-content">
4042
<div class="modal-header">
4143
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
42-
<h3 class="modal-title" id="myModalLabel">Invoice Generation</h3>
44+
<h3 class="modal-title" id="myModalLabel">Invoice Template</h3>
4345
</div>
4446
<div class="modal-body">
4547
<form>
@@ -129,9 +131,6 @@ <h3>Branch Details</h3>
129131
</div>
130132
</div>
131133

132-
133-
134-
135134
<h3>Payment Details</h3>
136135

137136
<div class="row">
@@ -147,7 +146,7 @@ <h3>Payment Details</h3>
147146

148147
<div class="row">
149148
<div class="form-group col-md-6">
150-
<label for="iban" class="control-label">Account Number</label>
149+
<label for="iban" class="control-label">IBAN</label>
151150
<input type="text" class="form-control" placeholder="IBAN" name="iban" id="iban">
152151
</div>
153152
<div class="form-group col-md-6">
@@ -159,6 +158,9 @@ <h3>Payment Details</h3>
159158
<div class="form-group">
160159
<input type="text" class="form-control" placeholder="Bank Address" name="bank_address" id="bank_address">
161160
</div>
161+
<div class="form-group">
162+
<textarea class="form-control" placeholder="Custom Message" name="custom_message" id="custom_message"></textarea>
163+
</div>
162164

163165
<div id="items">
164166
<div id="item_1">
@@ -197,14 +199,14 @@ <h3>Item 1</h3>
197199
</div>
198200

199201
<div class="modal-footer">
200-
<button type="button" class="btn btn-primary" onclick="addItem();">Add Item</button>
201-
<button type="button" id="remove_button" class="btn btn-danger" onclick="removeItem();">Remove Item</button>
202+
<button type="button" class="btn btn-default" onclick="addItem();">Add Item</button>
203+
<button type="button" id="remove_button" class="btn btn-default" onclick="removeItem();">Remove Item</button>
202204
</div>
203205

204206
</form>
205207
</div>
206208
<div class="modal-footer">
207-
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
209+
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
208210
</div>
209211
</div>
210212
</div>
@@ -221,17 +223,18 @@ <h1 style="margin-bottom: 5px">
221223
Summary
222224
</h1>
223225
<h3>
224-
<small>Invoice ID: {{{ invoice_label }}}</small> <br>
225-
<small>{{{ date_sent }}}</small>
226+
<small>Invoice ID: {{ invoice_label }}</small> <br>
227+
<small>{{ date_sent }}</small>
226228
</h3>
227229
</div>
228230
<div class="col-xs-7">
229231
<img class="logo" src="" alt="your logo">
230232
</div>
231233
</div>
234+
232235
<div class="row addresses">
233236
<div class="col-xs-5">
234-
<strong>{{ client_name }}</strong><br>
237+
<strong>{{ client_first_name }} {{ client_last_name }}</strong><br>
235238
{{ client_first_line }}<br>
236239
{{ client_second_line }}<br>
237240
{{ client_town }}<br>
@@ -250,9 +253,6 @@ <h3>
250253

251254
<div class="row" style="margin-top: 10px;">
252255
<div class="col-xs-12">
253-
<p style="text-align: justify;">
254-
{{{ branch_statement_prefix }}}
255-
</p>
256256
<strong>Summary of invoices payable for the period</strong>
257257
</div>
258258
</div>
@@ -277,15 +277,21 @@ <h3>
277277

278278
<div class="row" style="margin-top: 5px">
279279
<p class="col-xs-12">
280-
This is a summary. For invoice breakdown please see individual PDFs also attached.
280+
{{ custom_message }}
281281
</p>
282282
</div>
283283
<div class="row text-right" style="padding-top: 20px;">
284284
<div class="col-xs-12">
285285
<h4>{{ please_quote }}</h4>
286286

287287
<div class="small-para-gap">
288-
{{ company_name }}<br/> Account Number - {{ account_number }}<br/> Sort Code - {{ sort_code }}<br/> {{ bank_address }}<br/> {{ bank_city }}<br/> {{ bank_postcode }}<br/>
288+
{{ company_name }}<br/>
289+
Account Number - {{ account_number }}<br/>
290+
Sort Code - {{ sort_code }}<br/>
291+
IBAN - {{ iban }}<br/>
292+
{{ bank_address }}<br/>
293+
{{ bank_city }}<br/>
294+
{{ bank_postcode }}<br/>
289295
</div>
290296
</div>
291297
</div>
@@ -300,7 +306,6 @@ <h1 style="margin-bottom: 5px">
300306
</h1>
301307

302308
<h3 style="margin-top: 5px">
303-
<small>{{ page_subtitle }}</small>
304309
<br>
305310
<small>{{{ date_sent }}}</small>
306311
</h3>
@@ -312,7 +317,12 @@ <h3 style="margin-top: 5px">
312317

313318
<div class="row addresses">
314319
<div class="col-xs-5">
315-
<strong>{{ client_name }}</strong><br> {{ client_first_line }}<br> {{ client_town }}<br> {{ client_country }}<br> {{ client_postcode }}<br> {{ client_phone }}
320+
<strong>{{ client_first_name }} {{ client_last_name }}</strong><br>
321+
{{ client_first_line }}<br>
322+
{{ client_town }}<br>
323+
{{ client_country }}<br>
324+
{{ client_postcode }}<br>
325+
{{ client_phone }}
316326
</div>
317327
<div class="col-xs-5 col-xs-offset-2 text-right">
318328
<strong>{{ payee_name }}</strong><br> {{ payee_street }}<br> {{ payee_town }}<br> {{ payee_country }}<br> {{ payee_postcode }}
@@ -366,13 +376,6 @@ <h3 style="margin-top: 5px">
366376
<p>£{{ gross_amount }}</p>
367377
</strong>
368378
</div>
369-
370-
</div>
371-
372-
<div class="row text-right info-block">
373-
<div class="col-xs-12 small-para-gap">
374-
{{{ page_suffix }}}
375-
</div>
376379
</div>
377380
</page>
378381
</div>

‎logic.js

-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ $(document).ready(function() {
1010
});
1111

1212
var nbItems = 1;
13-
var saved = false;
1413

1514
function fillWithSavedData() {
1615
if (localStorage.getItem('data') != null) {
@@ -108,11 +107,6 @@ function removeItem() {
108107
}
109108
}
110109

111-
function closeAndGenerate() {
112-
saved = true;
113-
$("#myModal").modal('hide'); // then "$('#myModal').on('hidden.bs.modal'..." occurs
114-
}
115-
116110
function generateInvoice() {
117111
console.log('Generating invoice');
118112
var pre_data = $('form').serializeArray();
@@ -161,12 +155,6 @@ function generateInvoice() {
161155
fillWithSavedData();
162156
}
163157

164-
$('#myModal').on('hidden.bs.modal', function(e) {
165-
if (saved) { // so it only happens when the modal is dismissed via the ok button
166-
generateInvoice();
167-
}
168-
});
169-
170158
function loadImage() { // called automatically when the user chooses a file
171159
var imgs = document.querySelectorAll('img');
172160
var file = document.querySelector('input[type=file]').files[0];

0 commit comments

Comments
 (0)
Please sign in to comment.