Skip to content

Commit dacdbfd

Browse files
committed
feat: Added Terms and Conditions section to print template
1 parent d72d256 commit dacdbfd

File tree

10 files changed

+79
-2
lines changed

10 files changed

+79
-2
lines changed

models/baseModels/PrintSettings/PrintSettings.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export class PrintSettings extends Doc {
1313
displayLogo?: boolean;
1414
displayTime?: boolean;
1515
displayDescription?: boolean;
16+
displaytermsandconditions?: boolean;
17+
termsAndConditions?: string;
1618
posPrintWidth?: number;
1719
amountInWords?: boolean;
18-
override hidden: HiddenMap = {};
20+
override hidden: HiddenMap = {
21+
termsAndConditions: () => !this.displaytermsandconditions,
22+
};
1923
}

schemas/app/PrintSettings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@
133133
"fieldtype": "Check",
134134
"section": "Customizations"
135135
},
136+
{
137+
"fieldname": "displaytermsandconditions",
138+
"label": "Display Terms and Conditions",
139+
"fieldtype": "Check",
140+
"section": "Customizations"
141+
},
142+
{
143+
"fieldname": "termsAndConditions",
144+
"label": "Terms and Conditions",
145+
"fieldtype": "Text",
146+
"section": "Customizations"
147+
},
136148
{
137149
"fieldname": "posPrintWidth",
138150
"label": "Pos Print Width",

src/pages/TemplateBuilder/PrintContainer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
:scale="Math.max(scale, 0.1)"
55
:width="width"
66
:height="height"
7+
:show-overflow="true"
78
class="mx-auto shadow-lg border"
89
>
910
<ErrorBoundary

src/pages/TemplateBuilder/ScaledContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="overflow-hidden" :style="outerContainerStyle">
33
<div
44
:style="innerContainerStyle"
5-
:class="showOverflow ? 'overflow-auto no-scrollbar' : ''"
5+
:class="showOverflow ? 'overflow-auto no-scrollbar' : 'overflow-visible'"
66
>
77
<slot></slot>
88
</div>

src/utils/printTemplates.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const printSettingsFields = [
3838
'address',
3939
'companyName',
4040
'amountInWords',
41+
'displaytermsandconditions',
42+
'termsAndConditions',
4143
];
4244
const accountingSettingsFields = ['gstin', 'taxId'];
4345

templates/Basic.template.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,15 @@ <h3>{{ t`Grand Total` }}</h3>
153153
</div>
154154
</section>
155155
</footer>
156+
157+
<!-- Terms and Conditions -->
158+
<section
159+
class="mt-8 px-6"
160+
v-if="print.displaytermsandconditions && print.termsAndConditions"
161+
>
162+
<h3 class="text-lg font-semibold">{{ t`Terms and Conditions` }}</h3>
163+
<p class="mt-4 text-lg whitespace-pre-line">
164+
{{ print.termsAndConditions }}
165+
</p>
166+
</section>
156167
</main>

templates/Business.Payment.template.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,16 @@ <h3 class="text-lg font-semibold">{{t`Notes`}}</h3>
122122

123123
<p class="mt-4 text-lg whitespace-pre-line">{{ doc.terms }}</p>
124124
</section>
125+
126+
<!-- Terms and Conditions -->
127+
<section
128+
class="mt-12"
129+
v-if="print.displaytermsandconditions && print.termsAndConditions"
130+
>
131+
<h3 class="text-lg font-semibold">{{t`Terms and Conditions`}}</h3>
132+
<p class="mt-4 text-lg whitespace-pre-line">
133+
{{ print.termsAndConditions }}
134+
</p>
135+
</section>
125136
</footer>
126137
</main>

templates/Business.Shipment.template.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,16 @@ <h3 class="text-lg font-semibold">Notes</h3>
107107

108108
<p class="mt-4 text-lg whitespace-pre-line">{{ doc.terms }}</p>
109109
</section>
110+
111+
<!-- Terms and Conditions -->
112+
<section
113+
class="mt-12"
114+
v-if="print.displaytermsandconditions && print.termsAndConditions"
115+
>
116+
<h3 class="text-lg font-semibold">{{t`Terms and Conditions`}}</h3>
117+
<p class="mt-4 text-lg whitespace-pre-line">
118+
{{ print.termsAndConditions }}
119+
</p>
120+
</section>
110121
</footer>
111122
</main>

templates/Business.template.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,21 @@ <h3>{{ t`Grand Total` }}</h3>
132132
<h3 class="text-lg font-semibold">{{t`Notes`}}</h3>
133133
<p class="mt-4 text-lg whitespace-pre-line">{{ doc.terms }}</p>
134134
</section>
135+
135136
<div v-if="print.amountInWords" class="flex justify-end mt-10">
136137
<h3 class="text-lg font-semibold mr-2">{{t`Grand Total In Words`}}:</h3>
137138
<p>{{doc.grandTotalInWords}}</p>
138139
</div>
140+
141+
<!-- Terms and Conditions -->
142+
<section
143+
class="mt-12"
144+
v-if="print.displaytermsandconditions && print.termsAndConditions"
145+
>
146+
<h3 class="text-lg font-semibold">{{t`Terms and Conditions`}}</h3>
147+
<p class="mt-4 text-lg whitespace-pre-line">
148+
{{ print.termsAndConditions }}
149+
</p>
150+
</section>
139151
</footer>
140152
</main>

templates/Minimal.template.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,17 @@ <h3>{{ t`Grand Total` }}</h3>
177177
</div>
178178
</section>
179179
</footer>
180+
181+
<!-- Terms and Conditions -->
182+
<section
183+
class="px-12 py-10"
184+
v-if="print.displaytermsandconditions && print.termsAndConditions"
185+
>
186+
<h3 class="uppercase text-sm tracking-widest font-semibold text-gray-800">
187+
{{ t`Terms and Conditions` }}
188+
</h3>
189+
<p class="mt-4 text-lg whitespace-pre-line">
190+
{{ print.termsAndConditions }}
191+
</p>
192+
</section>
180193
</main>

0 commit comments

Comments
 (0)